Difference between revisions of "Digital Signal Transmission/Applications for Multimedia Files"

From LNTwww
 
(40 intermediate revisions by 6 users not shown)
Line 1: Line 1:
 
  {{LastPage}}
 
  {{LastPage}}
 
{{Header
 
{{Header
|Untermenü=Digitale Kanalmodelle
+
|Untermenü=Digital Channel Models
 
|Vorherige Seite=Bündelfehlerkanäle
 
|Vorherige Seite=Bündelfehlerkanäle
 
|Nächste Seite=
 
|Nächste Seite=
 
}}
 
}}
  
== Bilder im BMP–Format ==
+
== Images in BMP format ==
 
<br>
 
<br>
Eines der ältesten Bildformate ist das so genannte Bitmap&ndash;Format. Entsprechende Dateien werden mit der Endung &bdquo;bmp&rdquo; gekennzeichnet. Wesentliche Eigenschaften von BMP&ndash;Bildern sind:
+
One of the oldest image formats is the so-called&nbsp; "'''bitmap format'''".&nbsp; Corresponding files are marked with the extension "bmp".  
*Unter einer Bitmap versteht man eine Matrix von Bildpunkten, deren einzelne Elemente auch als Pixel (<i>Picture Elements</i>) bezeichnet werden. Abgespeichert werden die Bildpunkte zeilenweise, jeweils von rechts unten nach links oben.<br>
 
  
*Jedes Pixel bekommt noch einen RGB&ndash;Farbwert aus den additiven Grundfarben Rot, Grün und Blau zugewiesen. Je größer der Farbwert sein kann, desto feiner können die darzustellenden Farben abgestuft werden.<br>
+
Essential properties of BMP images are:
 +
*A bitmap is a matrix of pixels, whose individual elements are also called pixels&nbsp; $($"picture elements"$)$. The pixels are stored line by line, from bottom right to top left.<br>
  
*Die Farbtiefe eines Bildes wird in Bits per Pixel (BPP) angegeben. Gängig sind Farbtiefen von 1 (Schwarzweißbild), 4, 8 und 24 (Echtfarbbild, <i>True Color</i>).<br>
+
*Each pixel is also assigned an RGB color value from the additive primary colors&nbsp; "$\rm r$ed",&nbsp; "$\rm g$reen" &nbsp;and&nbsp; "$\rm b$lue". &nbsp; The larger the color value can be, the finer the colors to be displayed can be graded.<br>
  
*Da die meisten Bilder nicht das gesamte Farbenspektrum ausnutzen, kann man in jeder Bitmap eine spezifische Zuordnung in Form einer Farbtabelle definieren. So lassen sich auch mit relativ geringer Farbtiefe (bis zu 8 Bit) die Bilder mit guter Farbqualität darstellen.<br>
+
*The color depth of an image is specified in&nbsp; ''bits per pixel''&nbsp; (BPP). Common color depths are &nbsp;$1$&nbsp; (black and white image),&nbsp; $4$,&nbsp; $8$&nbsp; and&nbsp; $24$&nbsp; (true color image).<br>
  
:
+
*Since most images do not use the entire color spectrum, it is possible to define a specific assignment in each bitmap in the form of a color table. This way, even with relatively low color depth (up to eight bits), the images can be displayed with good color quality.<br>
[[File:P ID1851 Dig T 5 4 S1 version1.png|Hexdump einer BMP-Datei|class=fit]]<br>
 
  
Eine jede BMP&ndash;Datei besteht aus drei Teilblöcken, wie die obere Grafik beispielhaft verdeutlicht:
 
*dem Dateikopf (14 Byte),<br>
 
  
*dem Informationsblock (mindestens 40 Byte),  und anschließend<br>
+
[[File:P ID1851 Dig T 5 4 S1 version1.png|right|frame|Hexdump of a BMP file|class=fit]]
  
*dem Bilddatenblock<br><br>
+
Each BMP file consists of three sub-blocks, as the adjacent graphic illustrates:
 +
*the file header (14 bytes),<br>
  
Die Erklärung der einzelnen Blöcke folgt auf der nächsten Seite.<br>
+
*the information block (at least 40 bytes), and finally<br>
  
== Bilder im BMP–Format (2) ==
+
*the image data block.<br><br>
<br>
 
Nachfolgend sehen Sie die ersten 160 Byte der Datei &bdquo;LNTprofs.bmp&rdquo;. Gelb hinterlegt sind sowohl der Dateikopf (in Hexadezimaldarstellung von 0x00 bis 0x0D) als auch der Bilddatenbereich (ab 0x36). Nicht hinterlegt ist der 40 Byte&ndash;Informationsblock (von 0x0E bis 0x35).<br>
 
  
[[File:P ID1847 Dig T 5 4 S1 version1.png|Hexdump der Datei LNTprofs.bmp|class=fit]]<br>
+
Shown are the first 160 bytes of the file "LNTprofs.bmp". The file header (in hexadecimal representation from 0x00 to 0x0D) as well as the image data area (from 0x36) are highlighted in yellow. Not highlighted is the 40 byte information block (from 0x0E to 0x35).<br>
  
Der Dateikopf beinhaltet folgende Informationen (der Präfix 0x zeigt die Hexadezimaldarstellung an):  
+
The '''file header''' contains the following information (the prefix "0x" indicates the hexadecimal representation and the trailing "d" indicates the decimal representation):
*0x00 ... 0x01 (2 Byte)&nbsp;&nbsp;&nbsp;BMP&ndash;Kennung: 0x 42 4D&nbsp;&nbsp;&nbsp;&#8658;&nbsp;&nbsp;&nbsp;&bdquo;BM&rdquo;,<br>
+
*0x00 ... 0x01 (2 bytes)&nbsp;&nbsp;&nbsp;BMP identifier: 0x 42 4D&nbsp;&nbsp;&nbsp;&#8658;&nbsp;&nbsp;&nbsp;"BM",<br>
  
*0x02 ... 0x05 (4 Byte)&nbsp;&nbsp;&nbsp;Dateigröße in Byte: 0x 02 DE 98&nbsp;&nbsp;&nbsp;&#8658;&nbsp;&nbsp;&nbsp;188056d,<br>
+
*0x02 ... 0x05 (4 bytes)&nbsp;&nbsp;&nbsp;file size in bytes: 0x 02 DE 98&nbsp;&nbsp;&nbsp;&#8658;&nbsp;&nbsp;&nbsp;188056d,<br>
  
*0x06 ... 0x09 (5 Byte)&nbsp;&nbsp;&nbsp;reserviert (muss immer mit Nullen belegt sein),<br>
+
*0x06 ... 0x09 (5 bytes)&nbsp;&nbsp;&nbsp;reserved (must always be filled with zeros),<br>
  
*0x0A ... 0x0D (4 Byte)&nbsp;Offset (Beginn der Bilddaten): 0x 00 00 00 36&nbsp;&nbsp;&nbsp;&#8658;&nbsp;&nbsp;&nbsp;54d.<br><br>
+
*0x0A ... 0x0D (4 bytes)&nbsp;offset (start of image data): 0x 00 00 00 36&nbsp;&nbsp;&nbsp;&#8658;&nbsp;&nbsp;&nbsp;54d.<br><br>
  
<b>Hinweis:</b> Diese Angaben gelten allerdings nur für den Intel&ndash;Prozessor, der nach der so genannten <i>Little&ndash;Endian&ndash;Byteanordnung</i> vom niederwertigsten (LSB) zum höchstwertigen (MSB) Byte liest. Die
+
<i>Note:</i> &nbsp;However, these specifications only apply to the Intel processor, which reads according to the so-called &nbsp;<i>little&ndash;endian byte order</i>&nbsp; from the least significant byte &nbsp;(LSB)&nbsp; to the most significant byte &nbsp;(MSB).&nbsp; The order "98 DE 02 00" of bytes 2, ..., 5 is thus to be interpreted as "0x 00 02 DE 98", which corresponds to the decimal number "188056".<br>
Anordnung 98 DE 02 00 der Bytes 2, 3, 4 und 5 ist somit als 0x 00 02 DE 98 zu interpretieren, was der Dezimalzahl 188056 entspricht.<br>
 
  
Der 40 Byte&ndash;Informationsblock beinhaltet folgende Werte:
+
The '''40 byte information block''' contains the following values (bytes with the content "00" are not specified here):
*0x0E ... 0x11 (4 Byte)&nbsp;&nbsp;&nbsp;Länge des Info&ndash;Blocks:&nbsp;&nbsp;&nbsp;0x 28&nbsp;&nbsp;&nbsp;&#8658;&nbsp;&nbsp;&nbsp;40d,<br>
+
*0x0E ... 0x11 (4 bytes)&nbsp;&nbsp;&nbsp;Length of info block:&nbsp;&nbsp;&nbsp;0x 28&nbsp;&nbsp;&nbsp;&#8658;&nbsp;&nbsp;&nbsp;40d,<br>
  
*0x12 ... 0x15 (4 Byte)&nbsp;&nbsp;&nbsp;Bildbreite in Pixel:&nbsp;&nbsp;&nbsp;0x FA&nbsp;&nbsp;&nbsp;&#8658;&nbsp;&nbsp;&nbsp;250d,<br>
+
*0x12 ... 0x15 (4 bytes)&nbsp;&nbsp;&nbsp;Image width in pixels:&nbsp;&nbsp;&nbsp;0x FA&nbsp;&nbsp;&nbsp;&#8658;&nbsp;&nbsp;&nbsp;250d,<br>
  
*0x16 ... 0x19 (4 Byte)&nbsp;&nbsp;&nbsp;Bildhöhe in Pixel: &nbsp;&nbsp;&nbsp;0x FA&nbsp;&nbsp;&nbsp;&#8658;&nbsp;&nbsp;&nbsp;250d,<br>
+
*0x16 ... 0x19 (4 bytes)&nbsp;&nbsp;&nbsp;Image height in pixels: &nbsp;&nbsp;&nbsp;0x FA&nbsp;&nbsp;&nbsp;&#8658;&nbsp;&nbsp;&nbsp;250d,<br>
  
*0x1A ... 0x1B (2 Byte)&nbsp;&nbsp;Anzahl der Farbebenen (immer auf 1 gesetzt),<br>
+
*0x1A ... 0x1B (2 bytes)&nbsp;&nbsp;Number of color planes (always set to 1),<br>
  
*0x1C ... 0x1D (2 Byte)&nbsp;&nbsp;Bits per Pixel (BPP):&nbsp;&nbsp;&nbsp;0x0018&nbsp;&nbsp;&nbsp;&#8658;&nbsp;&nbsp;&nbsp;24d,<br>
+
*0x1C ... 0x1D (2 bytes)&nbsp;&nbsp;Bits per pixel (BPP):&nbsp;&nbsp;&nbsp;0x0018&nbsp;&nbsp;&nbsp;&#8658;&nbsp;&nbsp;&nbsp;24d,<br>
  
*0x1E ... 0x21 (4 Byte)&nbsp;&nbsp;&nbsp;Art der Datenkomprimierung,<br>
+
*0x1E ... 0x21 (4 bytes)&nbsp;&nbsp;&nbsp;Type of data compression,<br>
  
*0x22 ... 0x25 (4 Byte)&nbsp;&nbsp;&nbsp;Größe der Bitmap in Byte:&nbsp;&nbsp;&nbsp;0x 02 DE 62&nbsp;&nbsp;&nbsp;&#8658;&nbsp;&nbsp;&nbsp;188002d,<br>
+
*0x22 ... 0x25 (4 bytes)&nbsp;&nbsp;&nbsp;Size of bitmap in bytes:&nbsp;&nbsp;&nbsp;0x 02 DE 62&nbsp;&nbsp;&nbsp;&#8658;&nbsp;&nbsp;&nbsp;188002d,<br>
  
*0x26 ... 0x29 (4 Byte)&nbsp;&nbsp;&nbsp;Horizontalauflösung in Pixel/Meter:&nbsp;&nbsp;&nbsp;0x 26 70&nbsp;&nbsp;&nbsp;&#8658;&nbsp;&nbsp;&nbsp;9840d,<br>
+
*0x26 ... 0x29 (4 bytes)&nbsp;&nbsp;&nbsp;Horizontal resolution in pixels/meter:&nbsp;&nbsp;&nbsp;0x 26 70&nbsp;&nbsp;&nbsp;&#8658;&nbsp;&nbsp;&nbsp;9840d,<br>
  
*0x2A ... 0x2D (4 Byte)&nbsp;&nbsp;Vertikalauflösung in Pixel/Meter: &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0x 26 70&nbsp;&nbsp;&nbsp;&#8658;&nbsp;&nbsp;&nbsp;9840d,<br>
+
*0x2A ... 0x2D (4 bytes)&nbsp;&nbsp;Vertical resolution in pixels/meter: &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;0x 26 70&nbsp;&nbsp;&nbsp;&#8658;&nbsp;&nbsp;&nbsp;9840d,<br>
  
*0x2E ... 0x31 (4 Byte)&nbsp;&nbsp;&nbsp;Anzahl der verwendeten Farben,<br>
+
*0x2E ... 0x31 (4 bytes)&nbsp;&nbsp;&nbsp;Number of colors used,<br>
  
*0x32 ... 0x35 (4 Byte)&nbsp;&nbsp;&nbsp;Anzahl der wichtigen Farben.<br><br>
+
*0x32 ... 0x35 (4 bytes)&nbsp;&nbsp;&nbsp;Number of important colors.<br><br>
  
Anschließend beginnt mit 0x 43 2A 23 der Bilddatenbereich (im Beispiel jeweils drei Byte pro Pixel für R &ndash; G &ndash; B). Da auch hier (beim Intel&ndash;Prozessor) die <i>Little&ndash;Endian&ndash;Byteanordnung</i> gilt, bezeichnen diese Einträge die Farbwerte R = 23, G = 2A, B = 43 (jeweils hexadezimal).<br>
+
Then the '''image data area''' begins with "0x 43 2A 23" (in the example three bytes per pixel each for R &ndash; G &ndash; B). Since also here (with the Intel processor) the <i>little&ndash;endian byte order</i> applies, these entries designate the color values&nbsp; $\rm R = 23$,&nbsp; $\rm G = 2A$,&nbsp; $\rm B = 43$&nbsp; (in each case hexadecimal) or &nbsp; $\rm R = 35$,&nbsp; $\rm G = 42$,&nbsp; $\rm B = 67$&nbsp; (decimal) .<br>
  
Die Bilder auf der nächsten Seite machen deutlich, dass bereits wenige Fehler in Dateikopf (14 Byte) oder Informationsblock (40 Byte) genügen, um ein Bild völlig unbrauchbar zu machen. Der Header einer Multimedia&ndash;Datei sollte deshalb besonders geschützt werden. Bei BMP umfasst dieser Header 54 Byte.<br>
+
The images in the next section make it clear that even a few errors in the file header ($14$&nbsp; bytes) or information block ($40$&nbsp; bytes) are enough to render an image completely unusable. The header of a multimedia file should therefore be specially protected. In the case of BMP, this header comprises a total of $54$&nbsp; bytes.<br>
  
== Übertragungsfehler im Dateikopf und Informationsblock ==
+
== Transmission errors in the file header and information block ==
 
<br>
 
<br>
Mit einer Bilderserie sollen die Auswirkungen von Übertragungsfehlern innerhalb von Dateikopf (0x00&ndash;0x0D) und Informationsblock (0x0E&ndash;0x35) verdeutlicht werden. Die folgende Abbildung zeigt den Hexadezimal&ndash;Dump der verfälschten Datei im Vergleich zur Originaldatei.<br>
+
A series of images is used to illustrate the effects of transmission errors within the file header (0x00 ... 0x0D) and information block (0x0E ... 0x35). The left figure shows the hexadecimal dump of the falsified file compared to the original file (right).<br>
 +
 
 +
[[File:EN_Dig_T_5_4_S2a_v3.png|center|frame|Hexdumps of the falsified file and the original file|class=fit]]
 +
 
 +
Below you can see the images that result when the five error blocks are successively corrected:
 +
[[File:EN_Dig_T_5_4_S2b.png|right|frame|Effects of errors in the BMP header|class=fit]]
  
[[File:P ID1852 Dig T 5 4 S2a version1.png|Hexdumps der verfälschten Datei und der Originaldatei|class=fit]]<br>
+
*The given file cannot be opened at all. If we correct the first two bytes (purple marking) from "0x 40 00" to "0x 42 4D", we get the upper left uniform gray image.<br>
  
Unten sehen Sie die Bilder, die sich ergeben, wenn die fünf Fehlerblöcke sukzessive korrigiert werden:
+
*Correcting the image width from "0x C5" to "0x FA" &nbsp; &#8658; &nbsp; 250d and the image height from "0x 7D" to "0x FA" &nbsp; &#8658; &nbsp;  250d (green mark) results in the middle upper image already with the correct size (250 x 250 pixels), but still with gray content.<br>
*Die gegebene Datei lässt sich gar nicht öffnen. Korrigiert man die beiden ersten Byte (violette Markierung) in 0x 42 4D, so ergibt sich das linke obere Bild (einheitlich grau).<br>
 
  
*Korrigiert man die Bildbreite und Bildhöhe von 197 x 125 Pixel auf 250 x 250 Pixel (grüne Markierung), so ergibt sich das mittlere Bild oben (bereits mit richtiger Größe).<br>
+
*The upper right image can be reached by correcting the color depth (''bits per pixel'', BPP) from "0x 08" &nbsp; &#8658; &nbsp; 8d to "0x 18" &nbsp; &#8658; &nbsp; 24d (blue mark). After that, one can already partially recognize content, but with poor quality.<br>
  
*Zum rechten oberen Bild kommt man durch Berichtigung der Farbtiefe von 8 BPP auf 24 BPP (hexadezimal 18, blaue Markierung).<br>
+
*By correcting the red error block in the range 0x0A ... 0x0D (offset) from "0x 36 01" &nbsp; to "0x 36 00" &nbsp; you finally get the original image "LNTprofs.bmp".
 +
<br clear=all>
 +
== BMP files after BSC falsification==
 +
<br>
 +
The following series of images shows the influence of statistically independent errors (BSC model) with the following (bit) error probabilities:
 +
:$$p = 10^{-3}, \ p = 10^{-2}, \ p = 10^{-1}.$$
 +
[[File:Dig_T_5_4_S3_version2.png|right|frame|Influence of BSC errors on BMP files, above with 24 BPP, below with 8 BPP|class=fit]]
  
*Durch Korrektur des roten Fehlerblocks im Bereich 0x0A ... 0x0D (Offset) erhält man schließlich das Originalbild &bdquo;LNTprofs.bmp&rdquo;.<br>
+
The file header is error-free in each case.<br>
  
:[[File:P ID1848 Dig T 5 4 S2b version90.png|Auswirkungen von Fehlern im BMP–Header|class=fit]]<br>
+
*The upper row is based on the color image "LNTprofs.bmp" with&nbsp; $\rm 24$&nbsp; bits per pixel; the actual image area is&nbsp; $250 \cdot 250 \cdot  24 = 1.5 \cdot 10^6$ bits.
 +
*The bottom row is based on a grayscale image with&nbsp; $\rm 8$&nbsp; bits per pixel. The file is thus about a factor of&nbsp; $3$&nbsp; smaller than the color file.
  
== BMP– und WAV–Dateien nach BSC–Verfälschung ==
+
 
 +
One recognizes from these representations:
 +
*The error probability&nbsp; $p = 10^{-3}$&nbsp; is still not too disturbing. With the color image, about&nbsp; $1500$&nbsp; bits and also comparatively as many pixels are falsified (statistical statements). With the grayscale image, there are only about&nbsp; $500$&nbsp; bit errors because of the smaller file.<br>
 +
 
 +
*Subjectively, the disturbing impression of bit errors with the grayscale image is about the same as with the color image, despite the smaller number of bit errors, since with the latter some bit errors only have an effect in a marginal color change.<br>
 +
<br clear=all>
 +
== BMP files with burst errors ==
 
<br>
 
<br>
Die folgende Bilderserie zeigt den Einfluss von statistisch unabhängigen Fehlern (BSC&ndash;Modell) mit den Fehlerwahrscheinlichkeiten <i>p</i> = 10<sup>&ndash;3</sup>, <i>p</i> = 10<sup>&ndash;2</sup> und <i>p</i> = 10<sup>&ndash;1</sup>. Der Dateiheader ist jeweils fehlerfrei.<br>
+
Let's now look at the influence of burst errors on BMP files using the following graphic.
 +
 
 +
*The left image &nbsp;$\rm A$&nbsp; shows the original file "Weiß.bmp" with only white pixels.
 +
*The result is therefore independent of the color depth.
 +
*However, the file "Weiß1.bmp" (1 BPP, 4046 bytes) is almost by a factor of&nbsp; $24$&nbsp; smaller than the file "Weiß24.bmp" (24 BPP, 90456 bytes).
 +
*Almost because the header is the same size for both files and the &nbsp;$\text{1 BPP}$ file also contains a color table.<br>
  
[[File:P ID1850 Dig T 5 4 S3 version1.png|Einfluss von BSC–Fehlern auf BMP–Dateien|class=fit]]<br>
+
<br clear=all>
 +
For the four right images, transmission errors with the (average) error probability&nbsp; $p_{\rm M}  = 1\%$&nbsp; are considered in each case. One recognizes:
 +
[[File:EN_Dig_T_5_4_S4.png|right|frame|Influence of burst errors on BMP files|class=fit]]
  
Bei der oberen Reihe wurde vom Farbbild &bdquo;LNTprofs.bmp&rdquo; mit 24 BPP ausgegangen; der eigentliche Bildbereich umfasst 250 x 250 x 24 = 1.5 &middot; 10<sup>6</sup> Bit. Die untere Reihe basiert auf einem Graustufenbild mit 8 BPP. Die Datei ist somit etwa um den Faktor 3 kleiner als die Farbdatei. Man erkennt:
+
*The errors in image&nbsp; $\rm B$&nbsp; are statistically independent and were generated according to the&nbsp; [[Digital_Signal_Transmission/Binary_Symmetric_Channel_(BSC)|"BSC model"]].&nbsp; They are randomly distributed over the whole image area.<br>
*Die Fehlerwahrscheinlichkeit <i>p</i> = 10<sup>&ndash;3</sup> ist noch nicht allzu störend. Beim Farbbild sind damit etwa 1500 Bit und auch vergleichsweise ebensoviele Pixel verfälscht (statistische Aussagen). Beim Graustufenbild sind es wegen der kleineren Datei nur etwa 500 Bitfehler.<br>
 
  
*Subjektiv ist der störende Eindruck von Bitfehlern beim Graustufenbild trotz kleinerer Bitfehlerzahl etwa genau so wie beim Farbbild, da sich bei letzterem manche Bitfehler nur in einer marginalen Farbveränderung auswirken.<br><br>
+
*In contrast, images&nbsp; $\rm C$&nbsp; and&nbsp; $\rm D$&nbsp; show burst error structures according to the&nbsp; [[Digital_Signal_Transmission/Burst_Error_Channels#Channel_model_according_to_Gilbert-Elliott|"GE model"]]&nbsp; with different error correlation durations&nbsp; $D_{\rm K} \approx 8$&nbsp; and &nbsp;$D_{\rm K} \approx 95$. It can be seen from the error structure that BMP images are saved line by line.<br>
  
Nachfolgend finden Sie das mit dem BSC&ndash;Modell verfälschte Audio &bdquo;Stille.wav&rdquo; mit unterschiedlichen Fehlerwahrscheinlichkeiten (BER: <i>Bit Error Rate</i>). Der besonders zu schützende Dateiheader umfasst bei WAV&ndash;Dateien 43 Byte. Die Länge der Audios ist ca. 10 Sekunden.<br>
+
*For the black and white images (1 BPP) &nbsp;$\rm B$,&nbsp; $\rm C$&nbsp; and&nbsp; $\rm D$,&nbsp; every 100th pixel is falsified on statistical average. In contrast, image&nbsp; $\rm E$&nbsp; with 24 BPP (''True Color'') has more pixel falsifications despite the same average error probability&nbsp; $p_{\rm M}  = 1\%$.&nbsp; <br>
  
<lntmedia>file:A_ID41__ruhe1_bsc_00001.mp3</lntmedia><br>
+
*A comparison of images&nbsp; $\rm D$&nbsp; and&nbsp; $\rm E$&nbsp; shows the different correlation durations related to pixels&nbsp; $(D_{\rm K} \approx 95$&nbsp; versus &nbsp;$D_{\rm K} \approx 95/24 \approx 4)$. It can also be seen that in image&nbsp; $\rm E$&nbsp; the error pixels are colored.<br><br>
<lntmedia>file:A_ID43__ruhe1_bsc_0001.mp3</lntmedia><br>
 
<lntmedia>file:A_ID44__ruhe1_bsc_001.mp3</lntmedia><br>
 
<lntmedia>file:A_ID45__ruhe1_bsc_01.mp3</lntmedia><br>
 
<lntmedia>file:A_ID46__ruhe1_bsc_1.mp3</lntmedia>
 
  
== BMP– und WAV–Dateien mit Bündelfehlern ==
+
== Effects of transmission errors on audios ==
 
<br>
 
<br>
Das linke Bild (A) zeigt die Originaldatei &bdquo;Weiß.bmp&rdquo; mit ausschließlich weißen Pixeln. Das Ergebnis ist unabhängig von der Farbtiefe, doch ist die Datei &bdquo;Weiß1.bmp&rdquo; (1 BMP, 4046 Byte) nahezu um den Faktor 24 kleiner als die Datei &bdquo;Weiß24.bmp&rdquo; (24 BPP, 90456 Byte). Nahezu deshalb, weil der Header bei beiden Dateien gleich groß ist und in der 1 BPP&ndash;Datei ebenfalls eine Farbtabelle mit enthalten ist.<br>
+
The [https://en.wikipedia.org/wiki/WAV "WAVE file format"] is a container format for digital storage of audio data, based on the ''Resource Interchange File Format'' (RIFF) defined by Microsoft for Windows. The file header of WAVE files, which requires special protection, comprises &nbsp;$43$ bytes.
 +
 
 +
It usually contains so-called PCM raw data, i.e. a time- and value-discrete representation of the temporal course of a signal. The quality of the recorded sound then depends on two values, namely
 +
*the sampling rate (number of samples per time unit),
 +
*the resolution (bit depth).
 +
 
 +
 
 +
We will first demonstrate the influence of transmission errors on the audio file "Stille.wav" with a duration of about 10 seconds. That means: All you hear are transmission errors.
 +
 
 +
 
 +
'''Statistically independent errors according to the BSC model'''
 +
 +
For the following WAVE files we start with the&nbsp; [[Digital_Signal_Transmission/Binary_Symmetric_Channel_(BSC)|"BSC parameter"]]&nbsp; $p= 10^{-5}$&nbsp; and increase it up to&nbsp; $p= 10\%$.  
 +
*$p$&nbsp; indicates at the same time the average error probability&nbsp; $p_{\rm M}$,&nbsp; which is also called <i>Bit Error Rate</i> (BER).
 +
*In each case, the author's subjective assessment is also indicated.<br>
 +
 
 +
 
 +
<lntmedia>file:A_ID41__ruhe1_bsc_00001.mp3</lntmedia> &nbsp; &nbsp; $p=10^{-5}$ &nbsp; &rArr; &nbsp;  Barely audible. <br><br>
 +
<lntmedia>file:A_ID43__ruhe1_bsc_0001.mp3</lntmedia> &nbsp; &nbsp; $p=10^{-4}$ &nbsp; &rArr; &nbsp;  Not yet very disturbing. <br><br>
 +
<lntmedia>file:A_ID44__ruhe1_bsc_001.mp3</lntmedia> &nbsp; &nbsp; $p=10^{-3}$ &nbsp; &rArr; &nbsp;  Noticeably disturbing. <br><br>
 +
<lntmedia>file:A_ID45__ruhe1_bsc_01.mp3</lntmedia> &nbsp; &nbsp; $p=10^{-2}$ &nbsp; &rArr; &nbsp;  Warning before opening.<br><br>
 +
<lntmedia>file:A_ID46__ruhe1_bsc_1.mp3</lntmedia> &nbsp; &nbsp; $p=10^{-1}$ &nbsp; &rArr; &nbsp; Only suitable for those extremely insensitive to noise.<br><br>
  
[[File:P ID1853 Dig T 5 4 S4 version1.png|Einfluss von Bündelfehlern auf BMP–Dateien|class=fit]]<br>
+
'''Comparison of statistically independent errors and burst errors'''
  
Bei den vier rechten Bildern sind jeweils Übertragungsfehler mit der (mittleren) Fehlerwahrscheinlichkeit <i>p</i><sub>M</sub> = 0.01 berücksichtigt. Man erkennt:
+
*The statistically independent errors were again generated using the&nbsp;  [[Digital_Signal_Transmission/Binary_Symmetric_Channel_(BSC)|"BSC model"]].&nbsp; Mean error probability: &nbsp; $p_{\rm M}=10^{-3}$.
*Die Fehler im Bild (B) sind statistisch unabhängig und wurden gemäß dem BSC&ndash;Modell generiert. Sie sind zufällig über die gesamte Bildfläche verteilt.<br>
+
*For the generation of the burst errors, the&nbsp; [[Digital_Signal_Transmission/Burst_Error_Channels#Channel_model_according_to_Gilbert-Elliott|"Gilbert&ndash;Elliott"]]&nbsp; (GE) channel model was used.
 +
*The mean error probability here is also&nbsp; $p_{\rm M}=10^{-3}$.  
 +
*Contrast this with the very short&nbsp; [[Digital_Signal_Transmission/Burst_Error_Channels#Error_correlation_function_of_the_Gilbert-Elliott_model|"correlation period"]]&nbsp; $D_{\rm K}= 8$&nbsp; with long-range statistical ties &nbsp; &rArr; &nbsp;  $D_{\rm K}= 1000$.
  
*Dagegen zeigen die Bilder (C) und (D) Bündelfehlerstrukturen (GE&ndash;Modell) mit unterschiedlichen Fehlerkorrelationsdauern <i>D</i><sub>K</sub> &asymp; 8 bzw. <i>D</i><sub>K</sub> &asymp; 95. Man erkennt, dass BMP&ndash;Bilder zeilenweise abgespeichert werden.<br>
 
  
*Bei den 1 BPP&ndash;Bildern (B), (C) und (D) ist im statistischen Mittel jedes 100. Pixel verfälscht. Bei der 24 BPP&ndash;Datei (E) gibt es demgegenüber trotz gleicher Fehlerwahrscheinlichkeit <i>p</i><sub>M</sub> = 1% mehr Pixelverfälschungen.<br>
+
First, we start again from the file "Stille.wav". We can see that a short error correlation duration of the GE model in the result is not too different from statistically independent errors, since each sample is represented with &nbsp;$16$ bits.
 +
 +
<lntmedia>file:A_ID43__ruhe1_bsc_0001.mp3</lntmedia> &nbsp; &nbsp; BSC model. <br><br>
 +
<lntmedia>file:A_ID51__ruhe1_ge_8.mp3</lntmedia> &nbsp; &nbsp; GE model with $D_{\rm K}= 8$. <br><br>
 +
<lntmedia>file:A_ID52__ruhe1_ge_1000.mp3</lntmedia> &nbsp; &nbsp; GE model with $D_{\rm K}= 1000$.<br><br>
  
*Ein Vergleich der Bilder (D) und (E) zeigt die unterschiedlichen Korrelationsdauern bezogen auf Pixel (&asymp; 95 gegenüber &asymp; 4). Außerdem erkennt man, dass im Bild (E) die Fehlerpixel farbig sind.<br><br>
+
The same channel parameters also apply to the following short piece of music and one recognizes similar characteristics.<br>
  
Die nachfolgenden Audios sollen den Einfluss von statistisch unabhängigen Fehlern bzw. Bündelfehlern auf WAV&ndash;Dateien zeigen. Zunächst gehen wir von der Datei &bdquo;Stille.wav&rdquo; aus.<br>
+
<lntmedia>file:A_ID48__k2_bsc.mp3</lntmedia> &nbsp; &nbsp; BSC model. <br><br>
 +
<lntmedia>file:A_ID53__k2_ge_8.mp3</lntmedia> &nbsp; &nbsp; GE model with $D_{\rm K}= 8$. <br><br>
 +
<lntmedia>file:A_ID54__k2_ge_1000.mp3</lntmedia> &nbsp; &nbsp; GE model with $D_{\rm K}= 1000$.<br><br>
  
[[Audio Please add link -  Total 3]]<br>
+
''Note'': &nbsp; All ( falsified ) BMP images and WAV audios for this chapter were generated with the Windows program "Digital Channel Models & Multimedia" from the (former) practical course "Simulation of Digital Transmission Systems" at the Chair of Communications Engineering of the TU Munich. The following links provide:
 +
*the Windows program&nbsp; [http://en.lntwww.de/downloads/Sonstiges/Programme/DKM.zip DKM] &nbsp; &rArr; &nbsp; link refers to the ZIP version of the program; and
 +
*the corresponding&nbsp; [http://en.lntwww.de/downloads/Sonstiges/Texte/Digitale_Kanalmodelle.pdf lab manual]  &nbsp; &rArr; &nbsp; link refers to the PDF version.
  
Man erkennt, dass eine kurze Fehlerkorrelationsdauer des GE&ndash;Modells im Ergebnis sich nicht allzu sehr von statistisch unabhängigen Fehlern unterscheidet, da jeder Abtastwert mit 16 Bit dargestellt wird. Auch beim nachfolgenden kurzen Musikstück beträgt die mittlere Fehlerwahrscheinlichkeit jeweils 0.1%.<br>
 
  
[[Audio Please add link - Total 3]]<br>
 
  
==Aufgaben==
+
==Exercises for the chapter==
 
<br>
 
<br>
[[Aufgaben:5.8 BMP-Format|A5.8 BMP-Format]]
+
[[Aufgaben:Exercise_5.8:_BMP_Format|Exercise 5.8: BMP Format]]
  
[[Zusatzaufgaben:5.8 Verfälschung von BMP-Bildern]]
+
[[Aufgaben:Exercise_5.8Z:_Falsification_of_BMP_Images|Exercise 5.8Z: Falsification of BMP Images]]
  
 
{{Display}}
 
{{Display}}

Latest revision as of 12:54, 17 April 2023



Images in BMP format


One of the oldest image formats is the so-called  "bitmap format".  Corresponding files are marked with the extension "bmp".

Essential properties of BMP images are:

  • A bitmap is a matrix of pixels, whose individual elements are also called pixels  $($"picture elements"$)$. The pixels are stored line by line, from bottom right to top left.
  • Each pixel is also assigned an RGB color value from the additive primary colors  "$\rm r$ed",  "$\rm g$reen"  and  "$\rm b$lue".   The larger the color value can be, the finer the colors to be displayed can be graded.
  • The color depth of an image is specified in  bits per pixel  (BPP). Common color depths are  $1$  (black and white image),  $4$,  $8$  and  $24$  (true color image).
  • Since most images do not use the entire color spectrum, it is possible to define a specific assignment in each bitmap in the form of a color table. This way, even with relatively low color depth (up to eight bits), the images can be displayed with good color quality.


Hexdump of a BMP file

Each BMP file consists of three sub-blocks, as the adjacent graphic illustrates:

  • the file header (14 bytes),
  • the information block (at least 40 bytes), and finally
  • the image data block.

Shown are the first 160 bytes of the file "LNTprofs.bmp". The file header (in hexadecimal representation from 0x00 to 0x0D) as well as the image data area (from 0x36) are highlighted in yellow. Not highlighted is the 40 byte information block (from 0x0E to 0x35).

The file header contains the following information (the prefix "0x" indicates the hexadecimal representation and the trailing "d" indicates the decimal representation):

  • 0x00 ... 0x01 (2 bytes)   BMP identifier: 0x 42 4D   ⇒   "BM",
  • 0x02 ... 0x05 (4 bytes)   file size in bytes: 0x 02 DE 98   ⇒   188056d,
  • 0x06 ... 0x09 (5 bytes)   reserved (must always be filled with zeros),
  • 0x0A ... 0x0D (4 bytes) offset (start of image data): 0x 00 00 00 36   ⇒   54d.

Note:  However, these specifications only apply to the Intel processor, which reads according to the so-called  little–endian byte order  from the least significant byte  (LSB)  to the most significant byte  (MSB).  The order "98 DE 02 00" of bytes 2, ..., 5 is thus to be interpreted as "0x 00 02 DE 98", which corresponds to the decimal number "188056".

The 40 byte information block contains the following values (bytes with the content "00" are not specified here):

  • 0x0E ... 0x11 (4 bytes)   Length of info block:   0x 28   ⇒   40d,
  • 0x12 ... 0x15 (4 bytes)   Image width in pixels:   0x FA   ⇒   250d,
  • 0x16 ... 0x19 (4 bytes)   Image height in pixels:    0x FA   ⇒   250d,
  • 0x1A ... 0x1B (2 bytes)  Number of color planes (always set to 1),
  • 0x1C ... 0x1D (2 bytes)  Bits per pixel (BPP):   0x0018   ⇒   24d,
  • 0x1E ... 0x21 (4 bytes)   Type of data compression,
  • 0x22 ... 0x25 (4 bytes)   Size of bitmap in bytes:   0x 02 DE 62   ⇒   188002d,
  • 0x26 ... 0x29 (4 bytes)   Horizontal resolution in pixels/meter:   0x 26 70   ⇒   9840d,
  • 0x2A ... 0x2D (4 bytes)  Vertical resolution in pixels/meter:       0x 26 70   ⇒   9840d,
  • 0x2E ... 0x31 (4 bytes)   Number of colors used,
  • 0x32 ... 0x35 (4 bytes)   Number of important colors.

Then the image data area begins with "0x 43 2A 23" (in the example three bytes per pixel each for R – G – B). Since also here (with the Intel processor) the little–endian byte order applies, these entries designate the color values  $\rm R = 23$,  $\rm G = 2A$,  $\rm B = 43$  (in each case hexadecimal) or   $\rm R = 35$,  $\rm G = 42$,  $\rm B = 67$  (decimal) .

The images in the next section make it clear that even a few errors in the file header ($14$  bytes) or information block ($40$  bytes) are enough to render an image completely unusable. The header of a multimedia file should therefore be specially protected. In the case of BMP, this header comprises a total of $54$  bytes.

Transmission errors in the file header and information block


A series of images is used to illustrate the effects of transmission errors within the file header (0x00 ... 0x0D) and information block (0x0E ... 0x35). The left figure shows the hexadecimal dump of the falsified file compared to the original file (right).

Hexdumps of the falsified file and the original file

Below you can see the images that result when the five error blocks are successively corrected:

Effects of errors in the BMP header
  • The given file cannot be opened at all. If we correct the first two bytes (purple marking) from "0x 40 00" to "0x 42 4D", we get the upper left uniform gray image.
  • Correcting the image width from "0x C5" to "0x FA"   ⇒   250d and the image height from "0x 7D" to "0x FA"   ⇒   250d (green mark) results in the middle upper image already with the correct size (250 x 250 pixels), but still with gray content.
  • The upper right image can be reached by correcting the color depth (bits per pixel, BPP) from "0x 08"   ⇒   8d to "0x 18"   ⇒   24d (blue mark). After that, one can already partially recognize content, but with poor quality.
  • By correcting the red error block in the range 0x0A ... 0x0D (offset) from "0x 36 01"   to "0x 36 00"   you finally get the original image "LNTprofs.bmp".


BMP files after BSC falsification


The following series of images shows the influence of statistically independent errors (BSC model) with the following (bit) error probabilities:

$$p = 10^{-3}, \ p = 10^{-2}, \ p = 10^{-1}.$$
Influence of BSC errors on BMP files, above with 24 BPP, below with 8 BPP

The file header is error-free in each case.

  • The upper row is based on the color image "LNTprofs.bmp" with  $\rm 24$  bits per pixel; the actual image area is  $250 \cdot 250 \cdot 24 = 1.5 \cdot 10^6$ bits.
  • The bottom row is based on a grayscale image with  $\rm 8$  bits per pixel. The file is thus about a factor of  $3$  smaller than the color file.


One recognizes from these representations:

  • The error probability  $p = 10^{-3}$  is still not too disturbing. With the color image, about  $1500$  bits and also comparatively as many pixels are falsified (statistical statements). With the grayscale image, there are only about  $500$  bit errors because of the smaller file.
  • Subjectively, the disturbing impression of bit errors with the grayscale image is about the same as with the color image, despite the smaller number of bit errors, since with the latter some bit errors only have an effect in a marginal color change.


BMP files with burst errors


Let's now look at the influence of burst errors on BMP files using the following graphic.

  • The left image  $\rm A$  shows the original file "Weiß.bmp" with only white pixels.
  • The result is therefore independent of the color depth.
  • However, the file "Weiß1.bmp" (1 BPP, 4046 bytes) is almost by a factor of  $24$  smaller than the file "Weiß24.bmp" (24 BPP, 90456 bytes).
  • Almost because the header is the same size for both files and the  $\text{1 BPP}$ file also contains a color table.


For the four right images, transmission errors with the (average) error probability  $p_{\rm M} = 1\%$  are considered in each case. One recognizes:

Influence of burst errors on BMP files
  • The errors in image  $\rm B$  are statistically independent and were generated according to the  "BSC model".  They are randomly distributed over the whole image area.
  • In contrast, images  $\rm C$  and  $\rm D$  show burst error structures according to the  "GE model"  with different error correlation durations  $D_{\rm K} \approx 8$  and  $D_{\rm K} \approx 95$. It can be seen from the error structure that BMP images are saved line by line.
  • For the black and white images (1 BPP)  $\rm B$,  $\rm C$  and  $\rm D$,  every 100th pixel is falsified on statistical average. In contrast, image  $\rm E$  with 24 BPP (True Color) has more pixel falsifications despite the same average error probability  $p_{\rm M} = 1\%$. 
  • A comparison of images  $\rm D$  and  $\rm E$  shows the different correlation durations related to pixels  $(D_{\rm K} \approx 95$  versus  $D_{\rm K} \approx 95/24 \approx 4)$. It can also be seen that in image  $\rm E$  the error pixels are colored.

Effects of transmission errors on audios


The "WAVE file format" is a container format for digital storage of audio data, based on the Resource Interchange File Format (RIFF) defined by Microsoft for Windows. The file header of WAVE files, which requires special protection, comprises  $43$ bytes.

It usually contains so-called PCM raw data, i.e. a time- and value-discrete representation of the temporal course of a signal. The quality of the recorded sound then depends on two values, namely

  • the sampling rate (number of samples per time unit),
  • the resolution (bit depth).


We will first demonstrate the influence of transmission errors on the audio file "Stille.wav" with a duration of about 10 seconds. That means: All you hear are transmission errors.


Statistically independent errors according to the BSC model

For the following WAVE files we start with the  "BSC parameter"  $p= 10^{-5}$  and increase it up to  $p= 10\%$.

  • $p$  indicates at the same time the average error probability  $p_{\rm M}$,  which is also called Bit Error Rate (BER).
  • In each case, the author's subjective assessment is also indicated.


    $p=10^{-5}$   ⇒   Barely audible.

    $p=10^{-4}$   ⇒   Not yet very disturbing.

    $p=10^{-3}$   ⇒   Noticeably disturbing.

    $p=10^{-2}$   ⇒   Warning before opening.

    $p=10^{-1}$   ⇒   Only suitable for those extremely insensitive to noise.

Comparison of statistically independent errors and burst errors

  • The statistically independent errors were again generated using the  "BSC model".  Mean error probability:   $p_{\rm M}=10^{-3}$.
  • For the generation of the burst errors, the  "Gilbert–Elliott"  (GE) channel model was used.
  • The mean error probability here is also  $p_{\rm M}=10^{-3}$.
  • Contrast this with the very short  "correlation period"  $D_{\rm K}= 8$  with long-range statistical ties   ⇒   $D_{\rm K}= 1000$.


First, we start again from the file "Stille.wav". We can see that a short error correlation duration of the GE model in the result is not too different from statistically independent errors, since each sample is represented with  $16$ bits.

    BSC model.

    GE model with $D_{\rm K}= 8$.

    GE model with $D_{\rm K}= 1000$.

The same channel parameters also apply to the following short piece of music and one recognizes similar characteristics.

    BSC model.

    GE model with $D_{\rm K}= 8$.

    GE model with $D_{\rm K}= 1000$.

Note:   All ( falsified ) BMP images and WAV audios for this chapter were generated with the Windows program "Digital Channel Models & Multimedia" from the (former) practical course "Simulation of Digital Transmission Systems" at the Chair of Communications Engineering of the TU Munich. The following links provide:

  • the Windows program  DKM   ⇒   link refers to the ZIP version of the program; and
  • the corresponding  lab manual   ⇒   link refers to the PDF version.


Exercises for the chapter


Exercise 5.8: BMP Format

Exercise 5.8Z: Falsification of BMP Images