LIBML  Version 3.2.4
LIBML DSP Software Library
Modules | Functions
DCT Type IV Functions
Collaboration diagram for DCT Type IV Functions:

Modules

 Real FFT Functions
 

Functions

tpt_status tpt_dct4_f32 (f32_t *aInPlace, f32_t *aScratch, size_t aLogN, bool aIdctFlag)
 Processing function for the floating-point DCT4. More...
 
tpt_status tpt_dct4_f64 (f64_t *aInPlace, f64_t *aScratch, size_t aLogN, bool aIdctFlag)
 Processing function for the floating-point DCT4. More...
 
tpt_status tpt_dct4_q15 (q15_t *aInPlace, q15_t *aScratch, size_t aLogN, bool aIdctFlag)
 Processing function for the Q15 DCT4. More...
 
tpt_status tpt_dct4_q31 (q31_t *aInPlace, q31_t *aScratch, size_t aLogN, bool aIdctFlag)
 Processing function for the Q31 DCT4. More...
 
tpt_status tpt_mdct_f32 (f32_t *aOutData, f32_t *aInData, size_t aLogN, bool aImdctFlag)
 Processing function for the floating-point MDCT. Source buffer is modified by this function. More...
 
tpt_status tpt_mdct_q15 (q15_t *aOutData, q15_t *aInData, size_t aLogN, bool aImdctFlag)
 Processing function for the Q15 MDCT. Source buffer is modified by this function. More...
 
tpt_status tpt_mdct_q31 (q31_t *aOutData, q31_t *aInData, size_t aLogN, bool aImdctFlag)
 Processing function for the Q31 MDCT. Source buffer is modified by this function. More...
 
void tpt_mdct12_f32 (f32_t *aOutData, const f32_t *aInData)
 Processing function for the floating-point 12-point MDCT. More...
 
void tpt_mdct12_q15 (q4_11_t *aOutData, const q15_t *aInData)
 Processing function for the Q15 12-point MDCT. More...
 
void tpt_mdct12_q31 (q4_27_t *aOutData, const q31_t *aInData)
 Processing function for the Q31 12-point MDCT. More...
 
void tpt_imdct12_f32 (f32_t *aOutData, const f32_t *aInData)
 Processing function for the floating-point 12-point IMDCT. More...
 
void tpt_imdct12_q15 (q3_12_t *aOutData, const q15_t *aInData)
 Processing function for the Q15 12-point IMDCT. More...
 
void tpt_imdct12_q31 (q3_28_t *aOutData, const q31_t *aInData)
 Processing function for the Q31 12-point IMDCT. More...
 
void tpt_mdct36_f32 (f32_t *aOutData, const f32_t *aInData)
 Processing function for the floating-point 36-point MDCT. More...
 
void tpt_mdct36_q15 (q6_9_t *aOutData, const q15_t *aInData)
 Processing function for the Q15 36-point MDCT. More...
 
void tpt_mdct36_q31 (q6_25_t *aOutData, const q31_t *aInData)
 Processing function for the Q31 36-point MDCT. More...
 
void tpt_imdct36_f32 (f32_t *aOutData, const f32_t *aInData)
 Processing function for the floating-point 36-point IMDCT. More...
 
void tpt_imdct36_q15 (q5_10_t *aOutData, const q15_t *aInData)
 Processing function for the Q31 36-point IMDCT. More...
 
void tpt_imdct36_q31 (q5_26_t *aOutData, const q31_t *aInData)
 Processing function for the Q31 36-point IMDCT. More...
 

Detailed Description

Representation of signals by minimum number of values is important for storage and transmission. The possibility of large discontinuity between the beginning and end of a period of a signal in DFT can be avoided by extending the signal so that it is even-symmetric. Discrete Cosine Transform (DCT) is constructed such that its energy is heavily concentrated in the lower part of the spectrum and is very widely used in signal and image coding applications. The family of DCTs (DCT type - 1,2,3,4) is the outcome of different combinations of homogeneous boundary conditions. DCT has an excellent energy-packing capability, hence has many applications and in data compression in particular.

DCT is essentially the Discrete Fourier Transform(DFT) of an even-extended real signal. Reordering of the input data makes the computation of DCT just a problem of computing the DFT of a real signal with a few additional operations. This approach provides regular, simple, and very efficient DCT algorithms for practical hardware and software implementations.

Algorithm
This function implements DCT Type IV (IDCT for type IV)
           N-1
    X[k] = sum { x[n] * cos(PI * (2 * k + 1) * (2 * n + 1) / (4 * N)) }
           n=0
  

The N-point DCT4 internally uses N/2-point CFFT implementation. It supports lengths of [32, 64, ..., 512] and the corresponding aLogN value is [5, 6, ..., 9].

Normalizing factor
The normalizing factor is 1.0. If necessary, the caller should calculate the normalizing factor separately.

Function Documentation

◆ tpt_dct4_f32()

tpt_status tpt_dct4_f32 ( f32_t aInPlace,
f32_t aScratch,
size_t  aLogN,
bool  aIdctFlag 
)

Processing function for the floating-point DCT4.

Parameters
[in,out]aInPlacepoints to the in-place input and output buffer.
[in]aScratchpoints to a temporary buffer of size 2^aLogN.
[in]aLogNThe length is 2^aLogN.
Returns
execution status

◆ tpt_dct4_f64()

tpt_status tpt_dct4_f64 ( f64_t aInPlace,
f64_t aScratch,
size_t  aLogN,
bool  aIdctFlag 
)

Processing function for the floating-point DCT4.

Parameters
[in,out]aInPlacepoints to the in-place input and output buffer.
[in]aScratchpoints to a temporary buffer of size 2^aLogN.
[in]aLogNThe length is 2^aLogN.
Returns
execution status

◆ tpt_dct4_q15()

tpt_status tpt_dct4_q15 ( q15_t aInPlace,
q15_t aScratch,
size_t  aLogN,
bool  aIdctFlag 
)

Processing function for the Q15 DCT4.

Parameters
[in,out]aInPlacepoints to the in-place input and output buffer.
[in]aScratchpoints to a temporary buffer of size 2^aLogN.
[in]aLogNThe length is 2^aLogN.
Returns
execution status
Input an output formats
Internally inputs are downscaled in the CFFT process function to avoid overflows. Number of bits downscaled, depends on the size of the transform. The input and output formats for different DCT sizes and number of bits to upscale are mentioned in the table below:
Input and Output Formats for Q15 DCT4
aLogNDCT4 SizeInput formatOutput formatNumber of bits to upscale
4 16 1.15 5.11 4
5 32 1.15 6.10 5
6 64 1.15 7.9 6
7 128 1.15 8.8 7
8 256 1.15 9.7 8
9 512 1.15 10.6 9
10 1024 1.15 11.5 10
......

◆ tpt_dct4_q31()

tpt_status tpt_dct4_q31 ( q31_t aInPlace,
q31_t aScratch,
size_t  aLogN,
bool  aIdctFlag 
)

Processing function for the Q31 DCT4.

Parameters
[in,out]aInPlacepoints to the in-place input and output buffer.
[in]aScratchpoints to a temporary buffer of size 2^aLogN.
[in]aLogNThe length is 2^aLogN.
Returns
execution status
Input an output formats
Internally inputs are downscaled in the CFFT process function to avoid overflows. Number of bits downscaled, depends on the size of the transform. The input and output formats for different DCT sizes and number of bits to upscale are mentioned in the table below:
Input and Output Formats for Q31 DCT4
aLogNDCT4 SizeInput formatOutput formatNumber of bits to upscale
4 16 1.31 5.27 0
5 32 1.31 6.26 5
6 64 1.31 7.25 6
7 128 1.31 8.24 7
8 256 1.31 9.23 8
9 512 1.31 10.22 9
10 1024 1.31 11.21 10
......

◆ tpt_imdct12_f32()

void tpt_imdct12_f32 ( f32_t aOutData,
const f32_t aInData 
)

Processing function for the floating-point 12-point IMDCT.

Parameters
[out]aOutDatapoints to output buffer.
[in]aInDatapoints to input buffer. Note: the input length is 6 and the output length is 12.
Returns
none.

◆ tpt_imdct12_q15()

void tpt_imdct12_q15 ( q3_12_t aOutData,
const q15_t aInData 
)

Processing function for the Q15 12-point IMDCT.

Parameters
[out]aOutDatapoints to output buffer.
[in]aInDatapoints to input buffer. Note: the input length is 6 and the output length is 12.
Returns
none.
Input and output formats:
Internally inputs are downscaled in the IMDCT process function to avoid overflows. The return is in 4.12 format.

◆ tpt_imdct12_q31()

void tpt_imdct12_q31 ( q3_28_t aOutData,
const q31_t aInData 
)

Processing function for the Q31 12-point IMDCT.

Parameters
[out]aOutDatapoints to output buffer.
[in]aInDatapoints to input buffer. Note: the input length is 6 and the output length is 12.
Returns
none.
Input and output formats:
Internally inputs are downscaled in the IMDCT process function to avoid overflows. The return is in 4.28 format.

◆ tpt_imdct36_f32()

void tpt_imdct36_f32 ( f32_t aOutData,
const f32_t aInData 
)

Processing function for the floating-point 36-point IMDCT.

Parameters
[out]aOutDatapoints to output buffer.
[in]aInDatapoints to input buffer. Note: the input length is 18 and the output length is 36.
Returns
none.

◆ tpt_imdct36_q15()

void tpt_imdct36_q15 ( q5_10_t aOutData,
const q15_t aInData 
)

Processing function for the Q31 36-point IMDCT.

Parameters
[out]aOutDatapoints to output buffer.
[in]aInDatapoints to input buffer. Note: the input length is 18 and the output length is 36.
Returns
none.
Input and output formats:
Internally inputs are downscaled in the IMDCT process function to avoid overflows. The return is in 6.10 format.

◆ tpt_imdct36_q31()

void tpt_imdct36_q31 ( q5_26_t aOutData,
const q31_t aInData 
)

Processing function for the Q31 36-point IMDCT.

Parameters
[out]aOutDatapoints to output buffer.
[in]aInDatapoints to input buffer. Note: the input length is 18 and the output length is 36.
Returns
none.
Input and output formats:
Internally inputs are downscaled in the IMDCT process function to avoid overflows. The return is in 6.26 format.

◆ tpt_mdct12_f32()

void tpt_mdct12_f32 ( f32_t aOutData,
const f32_t aInData 
)

Processing function for the floating-point 12-point MDCT.

Parameters
[out]aOutDatapoints to output buffer.
[in]aInDatapoints to input buffer. Note: the input length is 12 and the output length is 6.
Returns
none.

◆ tpt_mdct12_q15()

void tpt_mdct12_q15 ( q4_11_t aOutData,
const q15_t aInData 
)

Processing function for the Q15 12-point MDCT.

Parameters
[out]aOutDatapoints to output buffer.
[in]aInDatapoints to input buffer. Note: the input length is 12 and the output length is 6.
Returns
none.
Input and output formats:
Internally inputs are downscaled in the MDCT process function to avoid overflows. The return is in 5.11 format.

◆ tpt_mdct12_q31()

void tpt_mdct12_q31 ( q4_27_t aOutData,
const q31_t aInData 
)

Processing function for the Q31 12-point MDCT.

Parameters
[out]aOutDatapoints to output buffer.
[in]aInDatapoints to input buffer. Note: the input length is 12 and the output length is 6.
Returns
none.
Input and output formats:
Internally inputs are downscaled in the MDCT process function to avoid overflows. The return is in 5.27 format.

◆ tpt_mdct36_f32()

void tpt_mdct36_f32 ( f32_t aOutData,
const f32_t aInData 
)

Processing function for the floating-point 36-point MDCT.

Parameters
[out]aOutDatapoints to output buffer.
[in]aInDatapoints to input buffer. Note: the input length is 36 and the output length is 18.
Returns
none.

◆ tpt_mdct36_q15()

void tpt_mdct36_q15 ( q6_9_t aOutData,
const q15_t aInData 
)

Processing function for the Q15 36-point MDCT.

Parameters
[out]aOutDatapoints to output buffer.
[in]aInDatapoints to input buffer. Note: the input length is 36 and the output length is 18.
Returns
none.
Input and output formats:
Internally inputs are downscaled in the MDCT process function to avoid overflows. The return is in 7.9 format.

◆ tpt_mdct36_q31()

void tpt_mdct36_q31 ( q6_25_t aOutData,
const q31_t aInData 
)

Processing function for the Q31 36-point MDCT.

Parameters
[out]aOutDatapoints to output buffer.
[in]aInDatapoints to input buffer. Note: the input length is 36 and the output length is 18.
Returns
none.
Input and output formats:
Internally inputs are downscaled in the MDCT process function to avoid overflows. The return is in 7.25 format.

◆ tpt_mdct_f32()

tpt_status tpt_mdct_f32 ( f32_t aOutData,
f32_t aInData,
size_t  aLogN,
bool  aImdctFlag 
)

Processing function for the floating-point MDCT. Source buffer is modified by this function.

Parameters
[out]aOutDatapoints to output buffer
[in]aInDatapoints to input buffer (Source buffer is modified by this function.)
[in]aLogNlength is 2^aLogN
[in]aImdctFlagflag that selects transform direction.
  • value = false: forward transform
  • value = true : inverse transform Note: For forward transform: the input length is 2^aLogN and the output length is 2^(aLogN-1). For inverse transform: the input length is 2^(aLogN-1) and the output length is 2^aLogN.
Returns
execution status

◆ tpt_mdct_q15()

tpt_status tpt_mdct_q15 ( q15_t aOutData,
q15_t aInData,
size_t  aLogN,
bool  aImdctFlag 
)

Processing function for the Q15 MDCT. Source buffer is modified by this function.

Parameters
[out]aOutDatapoints to output buffer
[in]aInDatapoints to input buffer (Source buffer is modified by this function.)
[in]aLogNlength is 2^aLogN
[in]aImdctFlagflag that selects transform direction.
  • value = false: forward transform
  • value = true : inverse transform Note: For forward transform: the input length is 2^aLogN and the output length is 2^(aLogN-1). For inverse transform: the input length is 2^(aLogN-1) and the output length is 2^aLogN.
Returns
execution status
Parameters
[out]aOutDatapoints to output buffer
[in]aInDatapoints to input buffer (Source buffer is modified by this function.)
[in]aLogNlength is 2^aLogN
[in]aImdctFlagflag that selects transform direction.
  • value = false: forward transform
  • value = true : inverse transform Note: For forward transform: the input length is 2^aLogN and the output length is 2^(aLogN-1). For inverse transform: the input length is 2^(aLogN-1) and the output length is 2^aLogN.
Returns
execution status
Input an output formats
Internally inputs are downscaled in the MDCT process function to avoid overflows. Number of bits downscaled, depends on the size of the transform. The input and output formats for different MDCT sizes and number of bits to upscale are mentioned in the table below:
Input and Output Formats for Q15 MDCT
aLogNMDCT SizeInput formatOutput formatNumber of bits to upscale
6 64 1.15 7.9 6
7 128 1.15 8.8 7
8 256 1.15 9.7 8
9 512 1.15 10.6 9
10 1024 1.15 11.5 10
......
Input and Output Formats for Q15 IMDCT
aLogNMDCT SizeInput formatOutput formatNumber of bits to upscale
6 64 1.15 6.10 5
7 128 1.15 7.9 6
8 256 1.15 8.8 7
9 512 1.15 9.7 8
10 1024 1.15 10.6 9
......

◆ tpt_mdct_q31()

tpt_status tpt_mdct_q31 ( q31_t aOutData,
q31_t aInData,
size_t  aLogN,
bool  aImdctFlag 
)

Processing function for the Q31 MDCT. Source buffer is modified by this function.

Parameters
[out]aOutDatapoints to output buffer
[in]aInDatapoints to input buffer (Source buffer is modified by this function.)
[in]aLogNlength is 2^aLogN
[in]aImdctFlagflag that selects transform direction.
  • value = false: forward transform
  • value = true : inverse transform Note: For forward transform: the input length is 2^aLogN and the output length is 2^(aLogN-1). For inverse transform: the input length is 2^(aLogN-1) and the output length is 2^aLogN.
Returns
execution status
Parameters
[out]aOutDatapoints to output buffer
[in]aInDatapoints to input buffer (Source buffer is modified by this function.)
[in]aLogNlength is 2^aLogN
[in]aImdctFlagflag that selects transform direction.
  • value = false: forward transform
  • value = true : inverse transform Note: For forward transform: the input length is 2^aLogN and the output length is 2^(aLogN-1). For inverse transform: the input length is 2^(aLogN-1) and the output length is 2^aLogN.
Returns
execution status
Input an output formats
Internally inputs are downscaled in the MDCT process function to avoid overflows. Number of bits downscaled, depends on the size of the transform. The input and output formats for different MDCT sizes and number of bits to upscale are mentioned in the table below:
Input and Output Formats for Q31 MDCT
aLogNMDCT SizeInput formatOutput formatNumber of bits to upscale
6 64 1.31 7.25 6
7 128 1.31 8.24 7
8 256 1.31 9.23 8
9 512 1.31 10.22 9
10 1024 1.31 11.21 10
......
Input and Output Formats for Q31 IMDCT
aLogNMDCT SizeInput formatOutput formatNumber of bits to upscale
6 64 1.31 6.26 5
7 128 1.31 7.25 6
8 256 1.31 8.24 7
9 512 1.31 9.23 8
10 1024 1.31 10.22 9
......