Signal processing by frames and samples
Terms used.
|
Sample-based processing
Sample-based processing - signals are processed one data element at a time. This processing is characterised by data updates at each time step, which corresponds to the sampling period. Time step is equal to the Sample period, denoted as . Sample rate is defined as the inverse of the Sample period, i.e. - meaning that data is updated and processed at each step .
Sample-by-sample processing is better suited for real-time systems that require an immediate response to each new data measurement. Examples of such systems are:
-
Audio processing
-
Real-time monitoring
Frame-based processing
Frame-based processing - signals are processed in frames, where each frame contains multiple data elements. Frame-based processing updates the data at each time step equal to the frame period. The frame period is defined as the product of the number of elements in the frame ( ) by the sampling period, i.e. . Accordingly, Frame rate is equal to the sampling rate divided by the number of elements in the frame: - this allows processing large amounts of data in one time step.
Frame-by-frame processing is efficient for processing large amounts of data. Examples of usage:
-
Fourier transform
-
Digital filtering
-
Image and video processing
Comparison of sampling and frame-by-frame processing
For clarity, see the figure that shows an example of sample-by-sample and frame-by-frame signal processing:
Comparison table |
|
---|---|
Processing by counts |
Processing by frames |
|
|
Thus, it is recommended to start development with frame-by-frame processing, as it is convenient for rapid prototyping and demonstration of the system operation. Due to its simplicity and speed of development, frame-by-frame processing makes it easy to test and tune algorithms without worrying about the complexities of memory handling. Once one is satisfied that the algorithms and models are working correctly, one can move to frame-by-frame processing. This processing, although more complex to implement, provides the high accuracy and optimisation needed to deal with physical systems that require detailed signals and memory interactions. This approach allows you to maximise the benefits of both methods at different stages of development.
Examples
Build a model from blocks:
-
DSP Sine Wave - supplying a discrete sine wave.
-
Terminator - block closes the output port.
-
Buffer - forcibly stores the specified number of data elements in one frame. Block Buffer forcibly processes the signal frame-by-frame.
-
Unbuffer - forcibly turns any number of frames into samples. With the Unbuffer block, the signal is forced count-by-counts.
-
Enable signal recording
at the output of blocks DSP Sine Wave, Buffer and Unbuffer.
-
For clarity in the settings window
in the tab Debugging enable:
-
Line dimensions
-
Signal sampling rate
-
Highlighting
-
Set the following block parameters:
-
At block DSP Sine Wave
-
Sample time to
0.1
; -
Samples per frame to
5
.
-
-
For block Buffer
-
Output buffer size (per channel) to
6
.
-
-
Blocks Unbuffer and Terminator have no configurable parameters. In the settings window, the simulation interval and solver selection remain by default.
Run a simulation of the model . The graphs will show the changes in the sine signal over time. The X axis represents the simulation time interval from
0
to 10
seconds, and Y shows the value of the sine wave. Then the graph window will display:
The graph shows the result of the Buffer block, which forcibly stores the specified number of data elements in one frame. Each frame contains six data items, represented by coloured lines on the graph. These lines represent the state of each element in the frame.
The horizontal stepped sections of the lines show how the values of the data items remain constant during each frame. The values are updated every 0.6
seconds, which corresponds to the frame update interval (6
data items * 0.1
sec/item = 0.6
sec). The Buffer block groups the data items into 6
pieces and displays them as a single frame in which each colour corresponds to a particular data item.
In this example, count-by-colour processing is chosen, even though the Buffer block forcibly stores the data items into a single frame. This is done to demonstrate how the block works and to display each data item separately.
The graph shows the output of the Unbuffer block, which turns any number of frames into samples. Each frame containing 6
data elements is split into individual data elements and passed to the output of the Unbuffer block one at a time. The resulting graph shows successive data elements of a sinusoidal signal returned to the original discrete form.
The graph is staggered because the values of the data elements change every 0.1
seconds. This corresponds to the time step specified for generating the sine signal. Consequently, the Unbuffer block converts the frame-by-frame signal back to a count, which illustrates the inverse process of data buffering.
To switch the graph from counts to frame-by-frame display, click the button Signal Menu ![]() ![]() |
Thus, frame-by-frame and count-by-frame processing can affect the presentation and processing of signals in different ways. The Buffer block converts samples into frames, grouping data elements and making processing more efficient for tasks that require processing groups of data simultaneously. The Unbuffer block returns frames back to the samples format.