![]() Ignoring the zero weights in leads to a single multiply for in the branch where there are multiples in the branch in Figure 2. The efficiencies from ignoring the zero weights in as well as folding the even-symmetric weights in will further reduce the number of multiplies needed to implement the filtering. It was shown prior that applying a PFB structure to a decimate by 2 for filter length N can reduce the amount of multiplies by 1/2. YPolyParallelFolded = foldedAOutput + BOutputįigure 5 gives an example of the output from the folded PFB with ignored zero weights showing it is the same output as the naive decimation approach. PreAdd = delayLine + delayLineįoldedAOutput = np.sum(weightedPreAdd) # remove the last sample from the delay line XAPad = np.concatenate((xA,np.zeros(len(AWeights)-1)))ĭelayLine = np.insert(delayLine,0,xAPad) # zero-pad the input so all input samples to the sample The code to implement the folded PFB in Figure 4 is given below: Folding and performing a pre-addition reduces the implementation to Which multiplies each input sample in the delay line with the corresponding filter weight. As an example, without folding the filter branch would be implemented as # implement the PFB with ignored zero weightsīOutput = np.concatenate((np.zeros(M),hB*xB,np.zeros(M-1)))įigure 3 compares the PFB implementation of Figure 2 against the naive implementation of filtering then downsampling showing that the more efficient PBF approach produces the same exact output.įolding the even-symmetric filter weights reduces the number of multiplications by performing an extra addition of the data beforehand. # the odd indexing starts at zero because the HBFWeights wereīIndices = np.arange(0,len(HBFWeightsPad),2) # the even indexing starts at one because the HBFWeights wereĪIndices = np.arange(1,len(HBFWeightsPad),2) HBFWeightsPad = np.concatenate((np.zeros(1),HBFWeights)) ![]() # you have to zero pad on the front to account for time-reversal in convolution! ![]() The filter structure from Figure 2 is implemented in the following code:
0 Comments
Leave a Reply. |