Datenkompression - Eine Übersicht

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    Datenkompression - Eine Übersicht - Presentation Transcript

    1. Datenkompression Ein Überblick
    2. Speicherplatz ist wie Motorleistung … … man hat nie genug davon 
    3. Speicher oder nicht Speicher …
    4. Speicherprobleme heute …
    5. Komprimierungsverfahren • Verlustfrei – RLE – Huffman – LZW • Verlustbehaftet – JPEG • YCbCr • DCT • Quantisierung • Entropiekodierung
    6. RLE – Run Length Encoding • Idee – Vermeiden von Wiederholungen • Umsetzung – Ersetzen von x Wiederholungen eines Symbols S durch xS
    7. RLE W W W W S W W W W W W W S S S W W W W W S S W S S W W W W S W W W S W W W W S S S S S W W W W S W W W S W W W W S W W W S W W W W S W W W S W W W W S W W W S W W
    8. RLE • Symbole – WWWWSWWWWWWWSSSWWWWWSSW SSWWWWSWWWSWWWWSSSSSWWWW SWWWSWWWWSWWWSWWWWSWWWS WWWWSWWWSWW – 9x9 = 81 Symbole Speicherbedarf • RLE (erste Zeile) – Aus „WWWWSWWWW“ wird „4W1S4W“ – 4*W, 1*S, 4*W
    9. RLE • Symbole – WWWWSWWWWWWWSSSWWWWWSSWSS WWWWSWWWSWWWWSSSSSWWWWSWW WSWWWWSWWWSWWWWSWWWSWWWWS WWWSWW – 9x9 = 81 Symbole Speicherbedarf • RLE – 4W1S7W3S5W2S1W2S4W1S3W1S4W5S4W1S 3W1S4W1S3W1S4W1S3W1S4W1S3W1S2W – 62 Symbole Speicherbedarf • Kompression 76%
    10. RLE • Symbole – ABCDEFGHIABCDEFGHIABCDEFGHIABCDEFGHI ABCDEFGHIABCDEFGHIABCDEFGHIABCDEFGHI ABCDEFGHI – 9x9 = 81 Symbole Speicherbedarf • RLE – 1A1B1C1D1E1F1G1H1I1A1B1C1D1E1F1G1H1I1A1 B1C1D1E1F1G1H1I1A1B1C1D1E1F1G1H1I1A1B1C 1D1E1F1G1H1I1A1B1C1D1E1F1G1H1I1A1B1C1D1 E1F1G1H1I1A1B1C1D1E1F1G1H1I1A1B1C1D1E1F 1G1H1I – 162 Symbole Speicherbedarf!!! • Kompression 200%!!!!!
    11. RLE • Einsatzgebiete – Bilder • BMP • GIF – Textverbeitung • Char+Style
    12. Huffman Encoding • Idee – Häufig vorkommende Symbole bekommen einen kürzeren „Prefix“ • Umsetzung – Häufigkeitstabelle anlegen – Optimale Prefix Codes berechnen (Magie!!) – Eingabetext mithilfe der Prefix Codes ausgeben
    13. Huffman Encoding Char Freq • Beispieltext space 7 – „this is an example of a huffman tree” a 4 e 4 – 36 “Symbole” = 36 Bytes f 3 Speicherverbrauch h 2 i 2 m 2 n 2 s 2 t 2 l 1 o 1 p 1 r 1 u 1 x 1
    14. Huffman Encoding e/4 Char Freq Code 8 n/2 space 7 4 o/1 16 2 a 4 a/4 u/1 e 4 8 t/2 f 3 4 m/2 h 2 i 2 i/2 m 2 36 4 x/1 n 2 2 8 p/1 s 2 h/2 t 2 4 l 1 s/2 20 o 1 r/1 p 1 2 r 1 5 l/1 12 f/3 u 1 Space/7 x 1
    15. Huffman Encoding e/4 Char Freq Code 8 n/2 space 7 111 4 o/1 16 2 a 4 010 a/4 u/1 e 4 000 8 t/2 f 3 1101 4 m/2 h 2 1010 i 2 1000 i/2 m 2 0111 36 4 x/1 n 2 0010 2 8 p/1 s 2 1011 h/2 t 2 0110 4 l 1 11001 s/2 20 o 1 00111 r/1 p 1 10011 2 r 1 11000 5 l/1 12 f/3 u 1 00111 Space/7 x 1 10010
    16. Huffman Encoding • Beispieltext Char Freq Code space 7 111 – „this is an example of a huffman tree” a 4 010 – 36 “Symbole” = 36 Bytes e 4 000 Speicherverbrauch f 3 1101 h 2 1010 i 2 1000 • Huffman codiert m 2 0111 – 011010101000101111110001011111010001 n 2 0010 011100010010010011110011110010001110 s 2 1011 0111110111101011110100011111011101011 t 2 0110 10100010111011011000000000 l 1 11001 o 1 00111 p 1 10011 – 135bits ~= 17 bytes r 1 11000 – Kompresionsrate ~ 47% u 1 00111 x 1 10010
    17. Huffman Encoding • Einsatzgebiet – Als Symbol Coding in vielen Kompresionstools und -arten versteckt …
    18. LZW (Lempel-Ziv-Welch) • Idee – Sich wiederholende Symbolkombinationen finden und diesen einen kurzen Code zuweisen
    19. LZW • Beispieltext – ananasana • Ausgabe 0/a –0 • Aktion 1/n – Index++ – Nächstes Symbol 2/s einhängen
    20. LZW • Beispieltext – ananasana • Ausgabe –0 0/a 3/n 1/n • Aktion – Index++ 2/s – Nächstes Symbol einhängen
    21. LZW • Beispieltext – ananasana • Ausgabe – 01 0/a 3/n 1/n • Aktion – Index++ 2/s – Nächstes Symbol einhängen
    22. LZW • Beispieltext – ananasana • Ausgabe – 01 0/a 3/n 1/n 4/a • Aktion – Index++ 2/s – Nächstes Symbol einhängen
    23. LZW • Beispieltext – ananasana • Ausgabe – 013 0/a 3/n 1/n 4/a • Aktion – Index++ 2/s – Nächstes Symbol einhängen
    24. LZW • Beispieltext – ananasana • Ausgabe – 013 0/a 3/n 5/a 1/n 4/a • Aktion – Index++ 2/s – Nächstes Symbol einhängen
    25. LZW • Beispieltext – ananasana • Ausgabe – 0130 0/a 3/n 5/a 1/n 4/a • Aktion – Index++ 2/s – Nächstes Symbol einhängen
    26. LZW • Beispieltext – ananasana • Ausgabe 3/n 5/a – 0130 0/a 6/s • Aktion 1/n 4/a – Index++ 2/s – Nächstes Symbol einhängen
    27. LZW • Beispieltext – ananasana • Ausgabe 3/n 5/a – 01302 0/a 6/s • Aktion 1/n 4/a – Index++ 2/s – Nächstes Symbol einhängen
    28. LZW • Beispieltext – ananasana • Ausgabe 3/n 5/a – 01302 0/a 6/s • Aktion 1/n 4/a – Index++ 2/s 7/a – Nächstes Symbol einhängen
    29. LZW • Beispieltext – ananasana • Ausgabe 3/n 5/a – 013025 0/a 6/s • Aktion 1/n 4/a – Index++ 2/s 7/a – Nächstes Symbol einhängen
    30. LZW • Einsatzgebiete – compress – (PK, G, B) ZIP – IPComp – Java (jar) – WS-* –…
    31. JPEG - YCbCr • RGB Bilddaten sind redundant – z.B. Helligkeit • YCbCr ist ein anderer „Farbraum“ – Y: Luma (Helligkeit) – Cb: Chroma Blue-difference – Cr: Chroma Red-difference • Verlustfrei!!!
    32. JPEG - YCbCr RGB Cb Cr Y
    33. Menschliche Wahrnehmung von Licht und Farbe • Verschiedene Rezeptoren für Farbe und Licht auf der Netzhaut • Helligkeitskanten werden besser wahrgenommen • Helligkeitsunterschiede in diagonaler Richtung werden nicht so gut wahrgenommen in horizontaler und vertikaler
    34. JPEG – 4:2:2 und 4:1:1 • Reduktion der Farbinformation – 4:2:2 • Auf 4 Y Werte kommen jeweils 2 Cr/Cb Werte – 4:1:1 • Auf 4 Y Werte kommt jeweils 1 Cr/Cb Wert • Normalerweise nicht wahrnehmbar … – … aber verlustbehaftet!!
    35. JPEG – 4:2:2 und 4:1:1 • Reduktion der Farbinformation – 4:2:2 Y Y • Auf 4 Y Werte kommen jeweils 2 Cr/Cb Werte – 4:1:1 Cr,Cb • Auf 4 Y Werte kommt jeweils 1 Cr/Cb Wert Y Y • Normalerweise nicht wahrnehmbar … – … aber verlustbehaftet!!
    36. Magie!!!
    37. DCT • Teilen der Teilbilder in 8x8 Pixel Blöcke • Anwendung einer Diskreten Cosinus Transformation (DCT) auf jeden 8x8 Pixelblock – Transformation in Frequenzraum – Theoretisch verlustfrei, in Praxis aber Rundungsfehler
    38. DCT Teilbild Y-Kanal 16x16
    39. DCT 8x8 8x8 8x8 8x8 Teilbild Y-Kanal 8x8 Teilbild Y-Kanal 16x16
    40. DCT 117 115 106 75 53 56 54 60 123 125 121 112 91 71 65 69 120 123 121 109 90 76 65 54 8x8 8x8 114 117 108 72 59 49 42 47 116 118 109 95 92 67 45 50 119 118 116 122 120 83 49 53 121 120 121 122 124 100 57 46 8x8 8x8 125 122 121 120 122 108 71 46 Teilbild Y-Kanal 8x8 Graustufenwerte Teilbild Y-Kanal 16x16
    41. DCT -11 -13 -22 -53 -75 -72 -74 -68 -5 -3 -7 -16 -37 -57 -63 -59 -8 -5 -7 -19 -38 -52 -63 -74 8x8 8x8 -14 -11 -20 -56 -69 -79 -86 -81 -12 -10 -19 -33 -36 -61 -83 -78 -9 -10 -12 -6 -8 -45 -79 -75 -7 -8 -7 -6 -4 -28 -71 -82 8x8 8x8 -3 -6 -7 -8 -6 -20 -57 -82 Teilbild Y-Kanal 8x8 Graustufenwerte - 128 Teilbild Y-Kanal 16x16
    42. DCT -1147,5 15 -33,6 28,9 -14,7 27 -1,8 7,4 27 -33,3 12,8 -15 24 -3,2 11 -2,1 -11 -13 -22 -53 -75 -72 -74 -68 -5 -3 -7 -16 -37 -57 -63 -59 -64,5 10,3 -21,4 18,4 -9,3 17 -1,7 4,7 -8 -5 -7 -19 -38 -52 -63 -74 DCT 12,3 -26,1 11,7 -12,9 18 -3,8 9 -2,1 8x8 8x8 -14 -11 -20 -56 -69 -79 -86 -81 -12 -10 -19 -33 -36 -61 -83 -78 -33,9 9,2 -15,7 13,5 -7,4 11,8 -2,5 3,4 -9 -10 -12 -6 -8 -45 -79 -75 -7 -8 -7 -6 -4 -28 -71 -82 10,4 -15,2 8,8 -8,9 10,5 -3,8 5,6 -1,7 8x8 8x8 -3 -6 -7 -8 -6 -20 -57 -82 -14,5 6,1 -8 6,9 -4,6 5,5 -2,2 1,7 Teilbild Y-Kanal 8x8 4,9 -4,4 3,5 -3,2 3,1 -1,9 1,7 -0,7 Graustufenwerte - 128 Teilbild Y-Kanal 16x16 DCT Koeffizienten
    43. DCT What????
    44. DCT Basis Funktionen • Kompressionsidee y y y y y y y y x x x x x x x x – Hohe Frequenzen y x kleinerer Amplitude können vernachlässigt y werden! x y – Orginal 8x8 Block als x Linearkombination der y x DCT Basis Funktionen y x y x y x y x
    45. IDCT (Inverse DCT) Vereinfacht! -1147,5 * + -1147,5 15 -33,6 28,9 -14,7 27 -1,8 7,4 15 * + 27 -33,3 12,8 -15 24 -3,2 11 -2,1 -33,6 * + -64,5 10,3 -21,4 18,4 -9,3 17 -1,7 4,7 12,3 -26,1 11,7 -12,9 18 -3,8 9 -2,1 … IDCT -33,9 9,2 -15,7 13,5 -7,4 11,8 -2,5 3,4 10,4 -15,2 8,8 -8,9 10,5 -3,8 5,6 -1,7 1,9 * + -14,5 6,1 -8 6,9 -4,6 5,5 -2,2 1,7 1,7 * + 4,9 -4,4 3,5 -3,2 3,1 -1,9 1,7 -0,7 DCT Koeffizienten -0,7 * = Orginal 8x8 Block
    46. DCT für die echte Geeks … X7 X7 · µ ¶ ¸ · µ ¶ ¸ ¼ 1 ¼ 1 Gu ;v = ®(u)®(v) gx ;y cos x+ u cos y+ v x = 0 y= 0 8 2 8 2 u: Ort sfrequenz 0 · u < 8 u: Ort sfrequenz 0 · v < 8 q q 1 2 ®p (n): Normalisierungsfunkt ion 8 fur n = 0, ansonst en Ä 8 gx ;y : Pixelwert an der K oordinat en (x; y) Gu ;v : DCT K oe± zient an den K oordinat en (u; v)
    47. DCT (Quantisierung) • Menschliches Auge weniger empfindlich für (fehlende) hohe Frequenzen • Hauptursache der zunehmenden Unschärfe bei hohen Kompressionsraten -1147,5 15 -33,6 28,9 -14,7 27 -1,8 7,4 10 15 25 37 51 66 82 100 -115 1 -1 1 0 0 0 0 27 -33,3 12,8 -15 24 -3,2 11 -2,1 15 19 28 39 52 67 83 101 2 -2 0 0 0 0 0 0 -64,5 10,3 -21,4 18,4 -9,3 17 -1,7 4,7 25 28 35 45 58 72 88 105 -3 0 -1 0 0 0 0 0 37 39 45 54 66 79 94 111 0 -1 0 0 0 0 0 0 12,3 -26,1 11,7 -12,9 18 -3,8 9 -2,1 „/“ 51 52 58 66 76 89 103 119 = -1 0 0 0 0 0 0 0 -33,9 9,2 -15,7 13,5 -7,4 11,8 -2,5 3,4 66 67 72 79 89 101 114 130 0 0 0 0 0 0 0 0 10,4 -15,2 8,8 -8,9 10,5 -3,8 5,6 -1,7 82 83 88 94 103 114 127 142 0 0 0 0 0 0 0 0 -14,5 6,1 -8 6,9 -4,6 5,5 -2,2 1,7 100 101 105 111 119 130 142 156 0 0 0 0 0 0 0 0 4,9 -4,4 3,5 -3,2 3,1 -1,9 1,7 -0,7 Quantisierungsmatrix Q Ergebnis E ³ D CT ´ x ;y DCT Koeffizienten E x ;y = round Qx ;y
    48. Entropiekodierung • Zick-Zack Kodierung über die quantisierten Koeffizienten • Start: Links oben • Symbolcoding: -115 1 -1 1 0 0 0 0 2 -2 0 0 0 0 0 0 – z.B. Huffmann Kodierung -3 0 -1 0 0 0 0 0 0 -1 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    49. JPEG Kompression • Platzeinsparung an zwei Stellen: – 4:x:x Codierung • Farbinformationen werden nicht für jedes Pixel gespeichert – Quantisierung der DCT Matrix • Durch „Rundungsfehler“ werden primär höherfrequente Signale Null • Je mehr Nullen in der DCT Matrix um so effizienter die anschliessende Huffmancodierung
    50. JPEG DeKompression • Analog zu Kompression – Huffmann DeKompression ergibt quantisierte DCT Koeffizienten – Malnehmen Quantisierungs-Matrix ergibt DCT Koeffizienten – IDCT ergibt Grauwert Pixelblock – „Aufblasen“ der Cb,Cr Bilder – YCrCb ergibt „Orginal“ Bild
    51. Fragen?
    52. Danke
    SlideShare Zeitgeist 2009

    + Udo SchneiderUdo Schneider Nominate

    custom

    155 views, 0 favs, 0 embeds more stats

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 155
      • 155 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 0
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories