Digital Signal Processing Reference
In-Depth Information
Several buffers are used, and
iobuffer
is the primary input/output buffer. At
each sampling interval, the ISR is executed. The next output value is read from
iobuffer
, output to the codec, and then replaced by a new input sample. After
PTS/2 sampling instants,
iobuffer
contains a new frame of PTS/2 input samples.
This situation is signaled by setting
flag
to 1.
The main program waits for this flag signal using
while (flag == 0);
and subsequently carries out the following operations:
1.
Resets
flag
to 0
2.
Copies the contents of the buffer
iobuffer
(frame of new input samples) to
the first PTS/2 locations of the buffer
samples
3.
Copies the contents of the buffer
overlap
(previously computed frame of
output samples) to the buffer
iobuffer
4.
Processes the new frame of input samples to compute the next frame of output
samples
The frame processing operation (within an infinite loop) has PTS/2 sampling
periods in which to execute and comprises the following steps:
1.
The contents of the last PTS/2 locations of the
samples
buffer (real parts)
are copied to the
overlap
buffer. These time-domain data may be thought
of as the overlapping latter half (PTS/2 samples) of the
previous
frame pro-
cessing operation.
2.
The last PTS/2 locations of the buffer
samples
are zero-padded. The buffer
samples
now contains PTS/2 new samples followed by PTS/2 zeros.
3.
The buffer
samples
is transformed in-place into the frequency domain using
a PTS-point FFT.
4.
The complex frequency-domain sample values are multiplied by the complex
frequency-domain filter coefficients stored in
h
.
5.
The results are transformed back into the time domain by applying a PTS-
point IFFT to the contents of the samples buffer. The resulting PTS time-
domain samples will be real-valued.
6.
The contents of the first PTS/2 locations of the buffer
samples
(i.e., the
former half of the
current
frame processing result) are added to the contents
of the
overlap
buffer.
Since the input and output signals are real-valued, so are the buffers
iobuffer
and
overlap
. However, since the frequency-domain representation of these signals
is complex, the buffer
samples
and the array of filter coefficients
h
are complex,
requiring two floating-point values (real and imaginary parts) per sample.
Search WWH ::
Custom Search