| Video and Image Processing Blockset™ | ![]() |
Transforms

The 2-D DCT block calculates the two-dimensional discrete cosine transform of the input signal. The equation for the two-dimensional DCT is
![]()
where
for
and
otherwise.
The number of rows and columns of the input signal must be powers of two. The output of this block has dimensions the same dimensions as the input.
| Port | Input/Output | Supported Data Types | Complex Values Supported |
|---|---|---|---|
Input | Vector or matrix of intensity values |
| No |
Output | 2-D DCT of the input | Same as Input port | No |
If the data type of the input signal is floating point, the output of the block is the same data type.
Use the Sine and cosine computation parameter to specify how the block computes the sine and cosine terms in the DCT algorithm. If you select Trigonometric fcn, the block computes the sine and cosine values during the simulation. If you select Table lookup, the block computes and stores the trigonometric values before the simulation starts. In this case, the block requires extra memory.
The following diagram shows the data types used in the 2-D DCT block for fixed-point signals. Inputs are first cast to the output data type and stored in the output buffer. Each butterfly stage processes signals in the accumulator data type, with the final output of the butterfly being cast back into the output data type.

The output of the multiplier is in the product output data type when at least one of the inputs to the multiplier is real. When both inputs to the multiplier are complex, the result of the multiplication is in the accumulator data type. For details on the complex multiplication performed, refer to Multiplication Data Types in the Signal Processing Blockset documentation. You can set the sine table, product output, accumulator, and output data types in the block mask as discussed in the next section.
The Main pane of the 2-D DCT dialog box appears as shown in the following figure.

Specify how the block computes the sine and cosine terms in the DCT algorithm. If you select Trigonometric fcn, the block computes the sine and cosine values during the simulation. If you select Table lookup, the block computes and stores the trigonometric values before the simulation starts. In this case, the block requires extra memory.
The Fixed-point pane of the 2-D DCT dialog box appears as shown in the following figure.

Select the rounding mode for fixed-point operations. The sine table values do not obey this parameter; they are always saturated and rounded to Nearest.
Select the overflow mode for fixed-point operations. The sine table values do not obey this parameter; they are always saturated and rounded to Nearest.
Choose how to specify the word length of the values of the sine table. The fraction length of the sine table values is always equal to the word length minus 1:
When you select Same word length as input, the word length of the sine table values match that of the input to the block.
When you select Binary point scaling, you can enter the word length of the sine table values, in bits.
When you select Slope and bias scaling, you can enter the word length of the sine table values, in bits.
The sine table values do not obey the Rounding mode and Overflow mode parameters; they are always saturated and rounded to Nearest.
Use this parameter to specify how to designate the product output word and fraction lengths. Refer to Fixed-Point Data Types and Multiplication Data Types in the Signal Processing Blockset documentation for illustrations depicting the use of the product output data type in this block:
When you select Inherit via internal rule, the product output word length and fraction length are automatically set according to the following equations:
![]()
![]()
When you select Same as input, these characteristics match those of the input to the block.
When you select Binary point scaling, you can enter the word length and the fraction length of the product output, in bits.
When you select Slope and bias scaling, you can enter the word length, in bits, and the slope of the product output. The bias of all signals in the Video and Image Processing Blockset software is 0.
Use this parameter to specify how to designate the accumulator word and fraction lengths. Refer to Fixed-Point Data Types and Multiplication Data Types in the Signal Processing Blockset documentation for illustrations depicting the use of the accumulator data type in this block:
When you select Inherit via internal rule, the accumulator word length and fraction length are automatically set according to the following equations:
![]()
![]()
When you select Same as product output, these characteristics match those of the product output.
When you select Same as input, these characteristics match those of the input to the block.
When you select Binary point scaling, you can enter the word length and the fraction length of the accumulator, in bits.
When you select Slope and bias scaling, you can enter the word length, in bits, and the slope of the accumulator. The bias of all signals in the Video and Image Processing Blockset software is 0.
Choose how to specify the output word length and fraction length:
When you select Inherit via internal rule, the output word length and fraction length are automatically set according to the following equations, where the input matrix is M-by-N:
If M>1 and N>1, output word length = input word length + floor(log 2((M-1)(N-1)))+1
If M>1 and N=1, output word length = input word length + floor(log 2(M-1))+1
If M=1 and N>1, output word length = input word length + floor(log 2(N-1))+1
output fraction length = input fraction length
When you select Same as input, these characteristics match those of the input to the block.
When you select Binary point scaling, you can enter the word length and the fraction length of the output, in bits.
When you select Slope and bias scaling, you can enter the word length, in bits, and the slope of the output. The bias of all signals in the Video and Image Processing Blockset software is 0.
Select this parameter to prevent any fixed-point scaling you specify in this block mask from being overridden by the autoscaling tool in the Fixed-Point Tool. For more information, see fxptdlg, a reference page on the Fixed-Point Tool in the Simulink documentation.
[1] Chen, W.H, C.H. Smith, and S.C. Fralick, "A fast computational algorithm for the discrete cosine transform," IEEE Trans. Commun., vol. COM-25, pp. 1004-1009. 1977.
[2] Wang, Z. "Fast algorithms for the discrete W transform and for the discrete Fourier transform," IEEE Trans. Acoust., Speech, Signal Processing, vol. ASSP-32, pp. 803-816, Aug. 1984.
Video and Image Processing Blockset software | |
Video and Image Processing Blockset software | |
Video and Image Processing Blockset software |
![]() | 2-D Correlation | 2-D FFT | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |