Main Content

IDCT

Inverse discrete cosine transform (IDCT) of input

Library

Transforms

dspxfrm3

  • IDCT block

Description

The IDCT block computes the inverse discrete cosine transform (IDCT) of each channel in theM-by-Ninput matrix,u.

y = idct(u) % Equivalent MATLAB code

For all N-D input arrays, the block computes the IDCT across the first dimension. The size of the first dimension (frame size), must be a power of two. To work with other frame sizes, use thePadblock to pad or truncate the frame size to a power-of-two length.

When the input is anM-by-Nmatrix, the block treats each input column as an independent channel containingMconsecutive samples. The block outputs anM-by-Nmatrix whoselth column contains the length-MIDCT of the corresponding input column.

y ( m , l ) = k = 1 M w ( k ) u ( k , l ) cos π ( 2 m 1 ) ( k 1 ) 2 M , m = 1 , ... , M

where

w ( k ) = { 1 M 2 M , , k = 1 2 k M

TheSine and cosine computationparameter determines how the block computes the necessary sine and cosine values. This parameter has two settings, each with its advantages and disadvantages, as described in the following table.

Sine and Cosine Computation Parameter Setting Sine and Cosine Computation Method Effect on Block Performance

Table lookup

The block computes and stores the trigonometric values before the simulation starts, and retrieves them during the simulation. When you generate code from the block, the processor running the generated code stores the trigonometric values computed by the block in a speed-optimized table, and retrieves the values during code execution.

The block usually runs much more quickly, but requires extra memory for storing the precomputed trigonometric values.

Trigonometric fcn

The block computes sine and cosine values during the simulation. When you generate code from the block, the processor running the generated code computes the sine and cosine values while the code runs.

The block usually runs more slowly, but does not need extra data memory. For code generation, the block requires a support library to emulate the trigonometric functions, increasing the size of the generated code.

Fixed-Point Data Types

The following diagrams show the data types used within the IDCT block for fixed-point signals. You can set the sine table, accumulator, product output, and output data types displayed in the diagrams in the IDCT block dialog as discussed inParameters.

Inputs to the IDCT block 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, seeMultiplication Data Types.

Note

When the block input is fixed point, all internal data types are signed fixed point.

Parameters

Main Tab

Sine and cosine computation

Sets the block to compute sines and cosines by either looking up sine and cosine values in a speed-optimized table (Table lookup), or by making sine and cosine function calls (Trigonometric fcn). See the table in theDescriptionsection.

Data Types Tab

Rounding mode

Select therounding mode为定点操作。The sine table values do not obey this parameter; they always round toNearest.

Saturate on integer overflow

When you select this parameter, the block saturates the result of its fixed-point operation. When you clear this parameter, the block wraps the result of its fixed-point operation. For details onsaturateandwrap, seeoverflow mode为定点操作。

Note

TheRounding modeandSaturate on integer overflowparameters have no effect on numeric results when all these conditions are met:

  • Product outputdata type isInherit: Inherit via internal rule.

  • Accumulatordata type isInherit: Inherit via internal rule.

With these data type settings, the block operates in full-precision mode.

Sine table

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

Specify 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. For more information on this rule, 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 theProduct outputparameter.

See指定数据类型Using Data Type Assistant(Simulink)for more information.

Accumulator

Specify 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. For more information on this rule, 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 theAccumulatorparameter.

See指定数据类型Using Data Type Assistant(Simulink)for more information.

Output

Specify 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 theOutputparameter.

SeeControl Data Types of Signals(Simulink)for more information.

Output Minimum

指定的最小值the block should output. The default value is[](unspecified). Simulink®software uses this value to perform:

  • Simulation range checking (seeSpecify Signal Ranges(Simulink))

  • Automatic scaling of fixed-point data types

Output Maximum

Specify the maximum value that the block should output. The default value is[](unspecified). Simulink software uses this value to perform:

  • Simulation range checking (seeSpecify Signal Ranges(Simulink))

  • Automatic scaling of fixed-point data types

Lock data type settings against changes 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.

Supported Data Types

Port Supported Data Types

Input

  • Double-precision floating point

  • Single-precision floating point

  • Fixed point (signed and unsigned)

  • 8-, 16-, and 32-bit signed integers

  • 8-, 16-, and 32-bit unsigned integers

Output

  • Double-precision floating point

  • Single-precision floating point

  • Fixed point (signed only)

  • 8-, 16-, and 32-bit signed integers

Extended Capabilities

Fixed-Point Conversion
Design and simulate fixed-point systems using Fixed-Point Designer™.

Version History

Introduced before R2006a

See Also

Functions

Blocks

Baidu
map