Case Study ARM Platformbased JPEG Codec HWSW Codesign
Case Study ARM Platform-based JPEG Codec HW/SW Co-design Teaching Assistant : Yu-Ju Cho Advisor : Prof. An-Yeu Wu So. C Design Laboratory SOC Consortium Course Material
Outline q Introduction to JPEG Codec q Lab ─ Case study q Reference Real-time OS So. C Design Laboratory SOC Consortium Course Material 2
ISO/IEC 10918 -1 JPEG q JPEG: Joint Photographic Experts Group q JPEG voted as international standard in 1994 q JPEG standard has four compression method Real-time OS – Baseline sequential DCT-based coding – Progressive DCT-based coding – Lossless coding method • Sampling and Quantization are not considered at loss-less coding scheme – Hierarchical coding method So. C Design Laboratory SOC Consortium Course Material 3
Compression Method Real-time OS TISO 0730 -93/d 009 Baseline sequential V. S. Progressive DCTbased coding So. C Design Laboratory SOC Consortium Course Material 4
Block Diagram of JPEG Encoder RGB Y Cb Cr Real-time OS 01001011101… DPCM: Differential Pulse Code Modulation RLC: Run-Length Code So. C Design Laboratory SOC Consortium Course Material 5
Color Model in Video ─ YCr. Cb q Y: Luminance q Cb, Cr: Chrominance q YCb. Cr color model is used in JPEG and MPEG Real-time OS So. C Design Laboratory SOC Consortium Course Material 6
Color Model in Video ─ YCr. Cb q CCIR-601 transformula Real-time OS q Color space transform is loss-less So. C Design Laboratory SOC Consortium Course Material 7
Chroma Sub-sampling Real-time OS q 4: 1: 1 and 4: 2: 0 are mostly used in JPEG and MPEG So. C Design Laboratory SOC Consortium Course Material 8
Block Diagram of JPEG Encoder RGB Y Cb Cr Real-time OS 01001011101… DPCM: Differential Pulse Code Modulation RLC: Run-Length Code So. C Design Laboratory SOC Consortium Course Material 9
2 -D DCT (Discrete Cosine Transform) Frequency domain Space domain Real-time OS So. C Design Laboratory SOC Consortium Course Material 10
Basis Image of 2 -D DCT Horizontal Frequency Low High Real-time OS Vertical Frequency High So. C Design Laboratory SOC Consortium Course Material 11
Frequency Distribution of 2 -D DCT By frequency: By direction: Real-time OS So. C Design Laboratory SOC Consortium Course Material 12
8 point 1 -D DCT Algorithm (1/2) Real-time OS Better for VLSI design implementation! So. C Design Laboratory SOC Consortium Course Material 13
8 point 1 -D DCT Algorithm (2/2) Real-time OS So. C Design Laboratory SOC Consortium Course Material 14
Implementation 2 -D DCT Example: row-column decomposition q Separable, row-column decomposition Real-time OS X 1 D DCT Unit Y=AX So. C Design Laboratory Transport Memory (Y) 1 D DCT Unit Z Z=YAT SOC Consortium Course Material 15
Block Diagram of JPEG Encoder RGB Y Cb Cr Real-time OS 01001011101… DPCM: Differential Pulse Code Modulation RLC: Run-Length Code So. C Design Laboratory SOC Consortium Course Material 16
Quantization Table for Luminance Real-time OS So. C Design Laboratory 16 11 10 16 24 40 51 61 12 12 14 19 26 58 60 55 14 13 16 24 40 67 69 56 14 17 22 29 51 87 80 62 18 22 37 56 68 109 103 77 24 35 55 64 81 104 113 92 49 64 78 87 103 121 120 101 72 92 95 98 112 100 103 99 SOC Consortium Course Material 17
Quantization Table for Chrominance Real-time OS So. C Design Laboratory 17 18 24 47 99 99 18 21 26 66 99 99 24 26 56 99 99 99 47 66 99 99 99 99 99 99 99 99 99 99 SOC Consortium Course Material 18
Block Diagram of JPEG Encoder RGB Y Cb Cr Real-time OS 01001011101… DPCM: Differential Pulse Code Modulation RLC: Run-Length Code So. C Design Laboratory SOC Consortium Course Material 19
Predictive Coding of DC Coefficients • Differential Pulse Code Modulation (DPCM) • To Store the differential value is better than the exact value. Real-time OS So. C Design Laboratory SOC Consortium Course Material 20
Zig-zag Scan (AC Coefficients) Real-time OS So. C Design Laboratory SOC Consortium Course Material 21
Run-Length Coding(RLC) DC Real-time OS (R, L) => (0, -3)(0, -2)(0, -1)(2, -1)(EOB) So. C Design Laboratory SOC Consortium Course Material 22
Huffman Coding for DC and AC Coefficient (R, L) => (0, -3)(0, -2)(0, -1)(2, -1)(EOB) (0, 2)(-3), (0, 2)(-2), (0, 1)(-1), (0, 2)(-2), …(0, 0) Real-time OS Category AC Coefficient Range 1 -1, 1 2 -3, -2, 2, 3 3 -7, …, -4, 4, …, 7 4 -15, …, -8, 8, …, 15 5 -31, …, -16, …, 31 6 -63, …, -32, …, 63 7 -127, …, -64, …, 127 8 -255, …, -128, …, 255 9 -511, …, -256, …, 511 10 -1023, …, -512, …, 1023 11 -2047, …, -1024, …, 2047 (Run, SSSS/Catagory ) Huffman Table So. C Design Laboratory SOC Consortium Course Material 23
Huffman Coding for DC and AC Coefficient Run/Size Real-time OS Category Code length Code word 10 2 000 11 3 010 12 3 011 13 3 100 14 3 101 15 3 110 16 4 1110 17 5 11110 18 6 111110 19 7 1111110 10 8 11111110 11 9 11110 Table for luminance DC coefficient differences Code word 0/0 (EOB) 14 1010 0/1 12 00 0/2 12 01 0/3 13 100 0/4 14 1011 0/5 15 11010 0/6 17 1111000 0/7 18 11111000 0/8 10 1111110110 0/9 16 111110000010 0/A 16 111110000011 1/1 14 1100 1/2 15 11011 1/3 17 1111001 1/4 19 111110110 (0, 2)(3), (0, 2)(-2), (0, 1)(-1), (0, 2)(-2), …(0, 0) =>(01) (11) (01) ……(1010) So. C Design Laboratory Code length Table for luminance AC coefficients SOC Consortium Course Material 24
An Example of Baseline DCT-based Coding For Y, (8*8 pixels *8 bits/pixel = 512 bits) -128 FDCT Q Real-time OS (6)(61), (0, 2)(-3), (0, 3)(4), (0, 1)(-1), (1110)(111101)(00)(100) Huffman (0, 3)(-4), (0, 2)(2), (100)(0)(100)(001)(01) (1, 2)(2), (0, 2)(-2), (10)(11011)(10)(01)(01)(11111110111)(10)(111010) Run-length (0, 2)(-2), (5, 2)(2), (3, 1)(1), (6, 1)(-1), (1)(1111011)(0)(11100)(0) (2, 1)(-1), (4, 1)(-1), (111011)(0)(11111010)(0)(1010) (7, 1)(-1), (0, 0) Zig-Zag total 102 bits Q Table So. C Design Laboratory SOC Consortium Course Material 25
Block Diagram of JPEG Encoder RGB Y Cb Cr Real-time OS 01001011101… DPCM: Differential Pulse Code Modulation RLC: Run-Length Code So. C Design Laboratory SOC Consortium Course Material 26
Block Diagram of JPEG Decoder Real-time OS 01001011101… So. C Design Laboratory SOC Consortium Course Material 27
JPEG Bitstream Real-time OS So. C Design Laboratory SOC Consortium Course Material 28
Outline q Introduction to JPEG Codec q Lab ─ Case study q Reference Real-time OS So. C Design Laboratory SOC Consortium Course Material 29
File Structure Real-time OS So. C Design Laboratory SOC Consortium Course Material 30
Read & Write Address Real-time OS So. C Design Laboratory Write_head 0 xcc 000000 0 xcc 000040 0 xcc 000004 0 xcc 000044 0 xcc 000008 0 xcc 000048 0 xcc 00000 c 0 xcc 00004 c 0 xcc 000010 0 xcc 000050 0 xcc 000014 0 xcc 000054 0 xcc 000018 0 xcc 000058 0 xcc 00001 c 0 xcc 00005 c FDCT IDCT Read_head 0 xcc 000020 0 xcc 000060 0 xcc 000024 0 xcc 000064 0 xcc 000028 0 xcc 000068 0 xcc 00002 c 0 xcc 00006 c 0 xcc 000030 0 xcc 000070 0 xcc 000034 0 xcc 000074 0 xcc 000038 0 xcc 000078 0 xcc 00003 c 0 xcc 00007 c SOC Consortium Course Material 31
Result for SW Simulation Real-time OS Original Encoder So. C Design Laboratory SOC Consortium Course Material Decoder 32
Result for HW Simulation Real-time OS Original Encoder So. C Design Laboratory SOC Consortium Course Material Decoder 33
Profiling Result of SW Simulation Real-time OS So. C Design Laboratory SOC Consortium Course Material 34
Lab ─ Case Study q Goal – Implement the JPEG codec system using ARM platform q Principles Real-time OS – Implement the ARM platform-based JPEG codec HW/SW co-design q Requirement – Analysis the profiling of pure software simulation – Explain how to partition the HW/SW of JPEG codec – Implement the JPEG codec with HW/SW co-design q Discussion – Explain where is the stack and heap ? And who initialize them So. C Design Laboratory SOC Consortium Course Material 35
Outline q Introduction to JPEG Codec q Lab ─ Case study q Reference Real-time OS So. C Design Laboratory SOC Consortium Course Material 36
Reference q Wen-Hsiung Chen, C. Harrison Smith, and S. C. Fralick, "A Fast Computational Algorithm for the Discrete Cosine Transform, " IEEE Trans. Commun. , vol. COM-25, pp. 1004 -1009, Sept 1977. q JPEG: Still Image Data Compression Standard by William B. Pennebaker and Joan L. Mitchell, Kluwer Academic Publishers, ISBN: 0442012721 Real-time OS So. C Design Laboratory SOC Consortium Course Material 37
- Slides: 37