200 likes | 344 Views
Lab9 Case Study. Speaker: Yu-Lin Hsiao Advisor: Prof. Chun-Yao Wang December 1, 2005. Department of Computer Science National Tsing Hua University. Outline. JPEG Baseline Compression Lab requirement & report. JPEG Baseline Compression. Baseline Sequential DCT-based coding
E N D
Lab9 Case Study Speaker: Yu-Lin Hsiao Advisor: Prof. Chun-Yao Wang December 1, 2005 Department of Computer Science National Tsing Hua University
Outline • JPEG Baseline Compression • Lab requirement & report
JPEG Baseline Compression • Baseline Sequential DCT-based coding - Lossy Compression • Content ﹣RGB → YUV ﹣Sub-sampling ﹣Shift the block ﹣FDCT ﹣Quantize ﹣Zig-Zag Scan ﹣Entropy Coding
JPEG Encoder Overview • Split into 8×8 pixels per block • Use FDCT, Quantizer and Entropy encoder to compress data
RGB → YUV (1) • RGB format ﹣Three data segments per pixel, each segment consists 8 bits. ﹣255, 0, 0 → pure red • YUV format • Y:Luminance • U:Cb, Blue Chrominance • V:Cr, Red Chrominance
RGB → YUV (2) • Y = 0.299 R + 0.578 G + 0.114 B • U = – 0.1687 R – 0.3313 G + 0.5 B + 128 • V = 0.5 R – 0.4187 G – 0.0813 B + 128
Sub-sampling • Discarding of chrominance data • YUV can be sub-sampled as 4:2:2 or 4:1:1 ratio
Shift the block • The block is shifted from 0 ~ 255 to -128 ~ 127 by subtracting 128
DC coefficient FDCT (Forward Discrete Cosine Transform) • Spatial domain → frequency-space
Quantize the block • Formula: (Round to nearest integer) Quantized value (a, b) = DCT (a, b) / Quantization Table value (a, b)
Entropy Coding • Entropy Coding : develop "code" words for the input value or " symbols“. • Entropy coding transfer the quantized data to compressed data • Entropy coding is composed of Run Length Coding (RLC) and Variable Length Coding (VLC, Huffman Coding)
AC Run Length Coding • Zero is the value occurs at highest frequency in quantized data
Variable Length Coding (DC Huffman Coding) • DC code word = Category code word + DIFF code word
Variable Length Coding (AC Huffman Coding) • AC code word = Run-Size code word + AC coefficient code word
Outline • JPEG Baseline Compression • Lab requirement & report
Requirement • Try to explain the given DCT content • Implement the JPEG encoder (We will give you fully C or C++ code, you can modify the reference code) • Compare the timing constraint of your own design with the reference code (profiling)
HW/SW Implementation • Partition your design into HW & SW parts and implement it
Report • Source code of your JPEG encoder • Profiling file of your source encoder • Report that describes your idea and result (or differences) • Determine the HW/SW part
Reference • JPEG Baseline Compression • Code Example supplied by NCTU • JPEG Still Image Specification • Lab08:How to design an IP with AMBA standard