2-D IDCT

Compute 2-D inverse discrete cosine transform (IDCT)

Library

Transforms

visiontransforms

  • 2-D IDCT block

Description

The 2-D IDCT block calculates the two-dimensional inverse discrete cosine transform of the input signal. The equation for the two-dimensional IDCT is

f ( x , y ) = 2 M N m = 0 M 1 n = 0 N 1 C ( m ) C ( n ) F ( m , n ) cos ( 2 x + 1 ) m π 2 M cos ( 2 y + 1 ) n π 2 N

whereF(m,n)is the DCT of the signalf(x,y)and C ( m ) , C ( n ) = 1 2 for m , n = 0 and C ( m ) , C ( n ) = 1 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

向量或矩阵的强度值

  • Double-precision floating point

  • Single-precision floating point

  • Fixed point

  • 8-, 16-, 32-bit signed integer

  • 8-, 16-, 32-bit unsigned integer

No

Output

2-D IDCT of the input

Same as Input port

No

如果data type of the input signal is floating point, the output of the block is the same data type.

Use theSine and cosine computationparameter to specify how the block computes the sine and cosine terms in the IDCT algorithm. If you selectTrigonometric fcn, the block computes the sine and cosine values during the simulation. If you selectTable lookup, the block computes and stores the trigonometric values before the simulation starts. In this case, the block requires extra memory.

Fixed-Point Data Types

The following diagram shows the data types used in the 2-D IDCT 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 of the 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 toMultiplication Data Types. You can set the sine table, product output, accumulator, and output data types in the block mask as discussed in the next section.

Parameters

Sine and cosine computation

规范ify how the block computes the sine and cosine terms in the IDCT algorithm. If you selectTrigonometric fcn, the block computes the sine and cosine values during the simulation. If you selectTable lookup, the block computes and stores the trigonometric values before the simulation starts. In this case, the block requires extra memory.

Rounding mode

Select theRounding Modes为定点操作。

Saturate on integer overflow

Select the overflow mode for fixed-point operations. SeePrecision and Range. The sine table values do not obey this parameter; instead, they are always saturated.

Sine table data type

Choose how you specify the word length of the values of the sine table. The fraction length of the sine table values always equals the word length minus one. You can set this parameter to:

  • A rule that inherits a data type, for example,Inherit: Same word length as input

  • An expression that evaluates to a valid data type, for example,fixdt(1,16)

The sine table values do not obey theRounding modeandSaturate on integer overflowparameters; instead, they are always saturated and rounded toNearest.

Product output data type

规范ify the product output data type. SeeFixed-Point Data TypesandMultiplication Data Typesfor illustrations depicting the use of the product output data type in this block. You can set this parameter to:

  • A rule that inherits a data type, for example,Inherit: Inherit via internal rule

  • An expression that evaluates to a valid data type, for example,fixdt(1,16,0)

Click theShow data type assistantbuttonto display theData Type Assistant, which helps you set theProduct output data typeparameter.

See规范ify Data Types Using Data Type Assistant(Simulink)for more information.

Accumulator data type

规范ify the accumulator data type. SeeFixed-Point Data Typesfor illustrations depicting the use of the accumulator data type in this block. You can set this parameter to:

  • A rule that inherits a data type, for example,Inherit: Inherit via internal rule

  • An expression that evaluates to a valid data type, for example,fixdt(1,16,0)

Click theShow data type assistantbuttonto display theData Type Assistant, which helps you set theAccumulator data typeparameter.

See规范ify Data Types Using Data Type Assistant(Simulink)for more information.

Output data type

规范ify the output data type. SeeFixed-Point Data Typesfor illustrations depicting the use of the output data type in this block. You can set this parameter to:

  • A rule that inherits a data type, for example,Inherit: Inherit via internal rule.

    When you selectInherit: Inherit via internal rule, the block calculates the output word length and fraction length automatically. The internal rule first calculates an ideal output word length and fraction length using the following equations:

    W L i d e a l o u t p u t = W L i n p u t + f l o o r ( log 2 ( D C T l e n g t h 1 ) ) + 1

    F L i d e a l o u t p u t = F L i n p u t

    Using these ideal results, the internal rule then selects word lengths and fraction lengths that are appropriate for your hardware. For more information, seeInherit via Internal Rule.

  • An expression that evaluates to a valid data type, for example,fixdt(1,16,0)

Click theShow data type assistantbuttonto display theData Type Assistant, which helps you set theOutput data typeparameter.

See规范ify Data Types Using Data Type Assistant(Simulink)for more information.

Lock scaling against changes by the autoscaling tool

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, seefxptdlg(Fixed-Point Designer), a reference page on the Fixed-Point Tool in the Simulink®documentation.

Lock data type settings against change by the fixed-point tools

Select this parameter to prevent the fixed-point tools from overriding the data types you specify on the block mask. For more information, seefxptdlg(Fixed-Point Designer), a reference page on the Fixed-Point Tool in the Simulink documentation.

References

[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.

See Also

2-D DCT

Computer Vision Toolbox™ software

2-D FFT

Computer Vision Toolbox software

2-D IFFT

Computer Vision Toolbox software

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Introduced before R2006a