98 6. REAL-TIME FILTERING
6.3 FRAME PROCESSING
When it comes to processing frames of data, such as when performing FFT or block convo-
lution, triple buffering is an efficient data frame handling mechanism. While samples of the
current frame are being collected by the CPU in an input buffer, samples of the previous frame
in an intermediate array can get processed during the time left between frame captures. At the
same time, the samples of a previously processed frame available in an output array can be sent
out. In this manner, the CPU is used to set up the input array and process the intermediate array
while processed data is moved from the output array. At the end of each frame or the start of
a new frame, the roles of these arrays can be interchanged. e input array is reassigned as the
intermediate array to be processed, the processed intermediate array is reassigned as the output
array to be sent out, and the output array is reassigned as the input array to collect incoming
samples for the current frame. In the FIR filtering method mentioned above, it is required that
one keeps a memory of previous signal values. If processing is performed on framed segments
of N input signal samples, one requires access to N C 1 C M sample values. is process is
illustrated in Figure 6.2.
frame N-2 frame N-1 frame N
-Time available to CPU for
setting up INPUT
array for Nth frame and
processing INTERMEDIA
TE array for
(N-1)th frame.
-Time available for sending out
OUTPUT array for (N-2)th frame.
Array roles are interchanged
INPUT OUTPUT
INTERMEDIATE INPUT
OUTPUT INTERMEDIATE
Figure 6.2: Triple buffering technique.
Depending on the size of the filter M , the overlap could require more than three frames
to be kept. Using the technique of frame processing, it is possible to reduce the computational
burden of creating a windowed signal by allowing chunks of input data to be sampled, processed,
and stored at once instead of performing all of these operations for each sample individually. e
following code shows how an input frame of data can be processed using the frame processing
method:
static void processFIRFilter(short* inputSamples, short* output) {
int i, j;
for( i = 0; i < N; i++) {
inputBuffer[i] = inputBuffer[N + i];
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.216.34.146