introduction to discrete cosine transform and quantization
DESCRIPTION
Introduction to Discrete Cosine Transform and Quantization. DSP TA: Wei-Nien Chen 2007/05/09. Typical Transform coding scheme. Discrete cosine transform. Any signal= Σ cosine of various frequencise. Decompose signals into combinations of DCT basis vectors. 1-D DCT. 2-D DCT (8x8). Why DCT. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Introduction to Discrete Cosine Transform and Quantization](https://reader033.vdocuments.net/reader033/viewer/2022061505/56814909550346895db64348/html5/thumbnails/1.jpg)
DSP TA: Wei-Nien Chen2007/05/09
![Page 2: Introduction to Discrete Cosine Transform and Quantization](https://reader033.vdocuments.net/reader033/viewer/2022061505/56814909550346895db64348/html5/thumbnails/2.jpg)
![Page 3: Introduction to Discrete Cosine Transform and Quantization](https://reader033.vdocuments.net/reader033/viewer/2022061505/56814909550346895db64348/html5/thumbnails/3.jpg)
Any signal=Σcosine of various frequencise.
Decompose signals into combinations of DCT basis vectors
![Page 4: Introduction to Discrete Cosine Transform and Quantization](https://reader033.vdocuments.net/reader033/viewer/2022061505/56814909550346895db64348/html5/thumbnails/4.jpg)
![Page 5: Introduction to Discrete Cosine Transform and Quantization](https://reader033.vdocuments.net/reader033/viewer/2022061505/56814909550346895db64348/html5/thumbnails/5.jpg)
![Page 6: Introduction to Discrete Cosine Transform and Quantization](https://reader033.vdocuments.net/reader033/viewer/2022061505/56814909550346895db64348/html5/thumbnails/6.jpg)
Energy compaction. (for further quantization)
![Page 7: Introduction to Discrete Cosine Transform and Quantization](https://reader033.vdocuments.net/reader033/viewer/2022061505/56814909550346895db64348/html5/thumbnails/7.jpg)
![Page 8: Introduction to Discrete Cosine Transform and Quantization](https://reader033.vdocuments.net/reader033/viewer/2022061505/56814909550346895db64348/html5/thumbnails/8.jpg)
original 1 coef. 3coef.
5 coef. 10 coef. 30coef.
![Page 9: Introduction to Discrete Cosine Transform and Quantization](https://reader033.vdocuments.net/reader033/viewer/2022061505/56814909550346895db64348/html5/thumbnails/9.jpg)
Represent coefficients using less steps(fewer bits) to obtain compression.
![Page 10: Introduction to Discrete Cosine Transform and Quantization](https://reader033.vdocuments.net/reader033/viewer/2022061505/56814909550346895db64348/html5/thumbnails/10.jpg)
Quantization Table: Each DCT coefficients uses different quantization step size obtained from psychophysical studies.
![Page 11: Introduction to Discrete Cosine Transform and Quantization](https://reader033.vdocuments.net/reader033/viewer/2022061505/56814909550346895db64348/html5/thumbnails/11.jpg)
),(
2
),(),(),(
),(vuQ
vuQvuFsignvuF
vuFq
),(),(),( vuQvuFvuF qiq
9910310011298959272
10112012110387786449
921131048164553524
771031096856372218
6280875129221714
5669574024161314
5560582619141212
6151402416101116
),( vuQ
Quantization
Inverse Quantization
![Page 12: Introduction to Discrete Cosine Transform and Quantization](https://reader033.vdocuments.net/reader033/viewer/2022061505/56814909550346895db64348/html5/thumbnails/12.jpg)
Adapted from W. J. Tsai, DTV chap2 classnote
![Page 13: Introduction to Discrete Cosine Transform and Quantization](https://reader033.vdocuments.net/reader033/viewer/2022061505/56814909550346895db64348/html5/thumbnails/13.jpg)
DSP TA: Wei-Nien Chen2007/05/09
![Page 14: Introduction to Discrete Cosine Transform and Quantization](https://reader033.vdocuments.net/reader033/viewer/2022061505/56814909550346895db64348/html5/thumbnails/14.jpg)
Source Efficiency Coding Effort
Compiler Optimizer
Assembly Optimizer
Hand OptimizerAssembly
Linear Assembly
C sourceFile
50-80%
90-100%
100%
Low
Med
High
![Page 15: Introduction to Discrete Cosine Transform and Quantization](https://reader033.vdocuments.net/reader033/viewer/2022061505/56814909550346895db64348/html5/thumbnails/15.jpg)
Code Composer Studio (CCS)◦ Software pipeline is very important◦ Build option setting
Optimization level : File level (-o3)◦ Configurations
Release mode is faster than Debug mode (profile)
![Page 16: Introduction to Discrete Cosine Transform and Quantization](https://reader033.vdocuments.net/reader033/viewer/2022061505/56814909550346895db64348/html5/thumbnails/16.jpg)
Fixed Point Operation◦ Fixed point : char, short, int, long◦ Floating point : float, double
Computation cycles with different data types
Char8-bit
Short16-bit
Int32-bit
Long40-bit
Float32-bit
Double64-bit
Add 1 1 1 2 77 146
Mul 2 2 6 8 54 69
![Page 17: Introduction to Discrete Cosine Transform and Quantization](https://reader033.vdocuments.net/reader033/viewer/2022061505/56814909550346895db64348/html5/thumbnails/17.jpg)
Use Intrinsic Function (spru198i) Packet Data Processing Change int type to char, short type
◦ Put 2 “16-bit” data or 4 “8-bit” data in a 32-bit space
◦ Single instruction multiple data (SIMD) (intrinsic)
int
short
char
short
char char char
32 bitsA1 (short) A2 (short)
B1 (short) B2 (short)
+
=
A1+B1 A2+B2
SIMD
![Page 18: Introduction to Discrete Cosine Transform and Quantization](https://reader033.vdocuments.net/reader033/viewer/2022061505/56814909550346895db64348/html5/thumbnails/18.jpg)
Loop unrolling◦ Break the branch barrier◦ Trade off between performance and code size◦ #pragma MUST_ITERATE(min, max, multiple), ◦ #pragma UNROLL(n)
Loop order#pragma MUST_ITERATE(10)For (i=0;i<N;i++){ ……..}
Slower
Faster
![Page 19: Introduction to Discrete Cosine Transform and Quantization](https://reader033.vdocuments.net/reader033/viewer/2022061505/56814909550346895db64348/html5/thumbnails/19.jpg)
TI has provided several optimized function for programmer’s, such as FIR, IIR, FFT, DCT, etc. (spru023b)
Include libraries and use it!! Be ware of data type!!
Library location:\CCStudio3\c6400\dsplib\lib\dsp64x.lib\CCStudio3\c6400\imglib\lib\img64x.lib
![Page 20: Introduction to Discrete Cosine Transform and Quantization](https://reader033.vdocuments.net/reader033/viewer/2022061505/56814909550346895db64348/html5/thumbnails/20.jpg)
Memory Management is important◦ Designer’s Responsibility
Memory Load/Store is critical◦ 80% time for load/store
Linker Command File (*.cmd)◦ Allocate memory
![Page 21: Introduction to Discrete Cosine Transform and Quantization](https://reader033.vdocuments.net/reader033/viewer/2022061505/56814909550346895db64348/html5/thumbnails/21.jpg)
MEMORY{ ISRAM: o = 0x00000000 l = 0x00040000 SDRAM: o = 0x80000000 l = 0x08000000}SECTIONS{ .text > ISRAM //Code .cinit > ISRAM //Initial values for global/static variables .stack > ISRAM //Stack (local variables) .const > ISRAM //Global and static string literals .switch > ISRAM //Tables for switch instructions .cio > ISRAM //Buffers for studio functions .bss > ISRAM //Global and static variables .far > ISRAM //Global and static declared far .sysmem > SDRAM //Memory for malloc functions (heap) .mycode > ISRAM .mydata > ISRAM} -stack 0x1F74-heap 0x500000
#pragma CODE_SECTION(function_name,”mycode”)
#pragma DATA_SECTION(array_name,”mydata”)
![Page 22: Introduction to Discrete Cosine Transform and Quantization](https://reader033.vdocuments.net/reader033/viewer/2022061505/56814909550346895db64348/html5/thumbnails/22.jpg)
Enhanced Direct Memory Access (EDMA) DSP/BIOS Cache
Tools that help you:Compiler consultantOptimization tools: cache tune/code size tune