Vorlesung Codierungstheorie Quellencodierung Bild und Videokompression Entropy Coding
Vorlesung Codierungstheorie Quellencodierung Bild- und Videokompression
• Entropy Coding: • Unary Coding Golomb Coding • Static Huffman Coding • Adaptive Huffman Coding • Arithmetic Coding • Run Length Encoding (RLE) e. g. BMP • Differential Encoding • Context Sensitive Coding • Lempel-Ziv-* • LZ 77 Gameboy • LZW (Welch) GIF, TIFF • Deflate PNG, zlib, zip, etc. • Lossy Image Coding JPEG Gordon Cichon • The human eye 18. 12. 2021 #2
Numeral Systems unary systems additive systems: (roman: I, III, IV, V, X, C, M, MMXI) positional systems common base: 2, 10, 16 Gordon Cichon 10 2 16 1 1 1 2 10 2 3 11 3 4 100 4 5 101 5 6 110 6 7 111 7 8 1000 8 9 1001 9 10 1010 A 11 1011 B 12 1100 C 13 1101 D 14 1110 E 15 1111 F 16 10000 10 18. 12. 2021 3
Example: Numeral Systems 20 1 21 2 22 4 23 8 24 16 2014 -1024 = 990 -512 = 478 -256 = 222 -128 = 98 -64 = 30 25 32 30 -16 = 14 -8 = 6 -4 = 2 -2 = 0 26 64 binary: 27 128 28 256 29 512 Example: 201410 111 1101 11102 hexadecimal: 7 DE 16 210 1024 211 2048 212 4096 4 Dr. Gordon Cichon 18. 12. 202 1
Run Length Encoding Compresses Repetition of Symbols e. g. A A A B B B 3 x A, 5 x B Special case: binary data {0, 1} 0 0 0 1 1 1 3, 5 Disadvantage: compressed data may be longer than original Soltution: Escape symbol with original data A A A L M U B B B 3 x A, ESC LMU, 5 x B Examples: BMP image format Referat Markus Mustermann 18. 12. 2021 #5
Windows Bitmap Format (BMP) Offset Type Name Description 0 uint 16_t bf. Type „BM“ = 0 x 42 0 x 4 D 2 uint 32_t bf. Size Total size in bytes 6 uint 32_t bf. Reserved 0 10 uint 32_t bf. Off. Bits Offset to image data (54 if no color table) 14 uint 32_t bi. Size 40 (sizeof(BITMAPINFOHEADER)) 18 uint 32_t bi. Width of image 22 uint 32_t bi. Height of image (negative: top-down, positive: bottom-up) 26 uint 16_t bi. Planes 1 28 uint 16_t bi. Bit. Count Bits per pixel (1, 4, 8, 16, 24, 32) Referat Markus Mustermann 18. 12. 2021 #6
Windows Bitmap Format (BMP) – Part 2 Offset Type Name Description 30 uint 32_t bi. Compression 0: BI_RGB 1: BI_RLE 4 2: BI_RLE 8 3: BI_BITFIELDS 34 uint 32_t bi. Size. Image Size of image data in bytes 38 uint 32_t bi. XPels. Per. Met er Bits per pixel in X direction (or 0) 42 uint 32_t bi. YPels. Per. Met er Bits per pixel in Y direction (or 0) 46 uint 32_t bi. Clr. Used Number of entries in color table (max 2 bi. Bit. Count) 50 uint 32_t bi. Clr. Important Same as bi. Clr. Used Referat Markus Mustermann 18. 12. 2021 #7
Windows Bitmap Format (BMP) – Part 3 Color Table: bi. Clr. Used entries of form: Blue, green, red, „ 0“ as bytes Image data: 24 bpp blue, green, red as bytes 1, 4, 8 bpp index into color table Referat Markus Mustermann 18. 12. 2021 #8
Windows Bitmap Format (BMP) – RLE BI_RLE 4, BL_RLE 8 in bi. Compression (offset 30) Two bytes (a, b) a times „b“ e. g. A A A B B B 0 x 03 0 x 41 0 x 05 0 x 42 If a=0: Value of b Description 0 End of image line 1 End of image 2 (a‘, b‘): Skip a‘ columns and b‘ rows 3 -255 ESC for b bytes (align to 16 bits) Referat Markus Mustermann 18. 12. 2021 #9
Differential Encoding Encoder Referat Markus Mustermann Decoder 18. 12. 2021 # 10
- Slides: 10