Using more than one JPEG encoder to enhance the bandwidth of JPEG compression.

Brief Description

Files:
\examples\Processing\Advanced\JPEG\JPEG_multi\JPEG_Color.va
\examples\Processing\Advanced\JPEG\JPEG_multi\JPEG_Gray.va
\examples\Processing\Advanced\JPEG\JPEG_multi\Software

Default Platform:
mE5-MA-VCL
mE5-MA-ACX-QP

Short Description

Using more than one encoder to enhance the bandwidth for a JPEG compression.

This example is designed to enhance the bandwidth for a JPEG compression. To allow this several encoders are used in parallel. There exist two examples for the marathon mE5 VCL plattform. The JPEG_Gray example uses 4 encoders to encode a full configuration grayscale image. The JPEG_Color example uses 6 encoders to encode an image from a bayer camera with a subsampling in horizontal and vertical direction for the Chroma components.

JPEG_Gray - VisualApplets Design

This Design uses four JPEG_Encoder_Gray operators to to encode an image with a bandwidth of maximum 1200MP/s (this would be suffizient for a CameraLink Camera in full configuration).
A JPEG Stream bases on a runlength encoding. Each Stream starts with a DC part followed by several AC components. So in order to split an image to several encoders the encoding needs to be restarted in intervals. This can be done in the JPEG format using Restart markers. The VisualApplets design therefor splits the Image into Blocks of 8 Lines (1 Line of MCUs). At the end of each MCU Line a restart Marker is inserted.

Basic design structure

Figure 219. Basic design structure


In Fig. 219 you can see the general applet. For the compression there are three interesting hierarchical boxes (JPEGBlockSorter8x8, SplitImage and SYNC). In JPEGBlockSorter8x8(Fig. 220) the data of 8 lines is rearanged to blocks of 8x8 pixel. These blocks are send consecutively.
To keep the image handy the dimensions are kept the same.
SplitImage(Fig. 222) saves the image to the DRAM and rearanges the lines in a way, that the 4 consecutive lines addresses 4 independend MCU-block-lines. In this way for streams of MCU-block-lines can be split and send to 4 independend encoders.
SYNC collects the encoded streams, replaces the information Tag at the end by a restart marker and appends all lines to an image.

Content of box JPEGBlockSorter8x8

Figure 220. Content of box JPEGBlockSorter8x8


First 8 pixel are appended to one "block-pixel". In the Sort Box these "block-pixel" are arranged in a way that the block pixel of each line follow after another as shown in Fig. 221

Rearangement of Pixel in JPEGBlockSorter8x8

Figure 221. Rearangement of Pixel in JPEGBlockSorter8x8


The SplitImage(Fig. 222) box rearanges the lines from the JPEGBlockSorter8x8(Fig. 220) into a schema, where always 4 blocks are separatly transmitted. Each Block consists of 8 Lines. This procedure is repeated till all lines are transmitted.
In the Split box the image is split into 4 Images. This is done by removing all lines from each link that doesn't belong to the image. These sub images are split to images of the height 8, so that the applet can insert restart intervalls at the end of 8 lines.

Content of SplitImage box

Figure 222. Content of SplitImage box


The SYNC box combines the streams of each JPEG_Converter into one image. This is done in three steps. First the final bytes (0xFFD9 - End of Image Marker + Informations from the operator) are marked for removal. This is done in the Box RemoveFillByte(Fig. 223). Second restart markers are added in between the blocks. Restart Markers in a JPEG stream are in a structure: "0xFFDx", where x is a value from 0 to 7 counting round and robbin. This is done in the Box RestartMarker(Fig. 220). Third unused Bytes are removed.

Content of the RemoveFillByte box

Figure 223. Content of the RemoveFillByte box


Content of the RestartMarker box

Figure 224. Content of the RestartMarker box


For the imagedata you get out of this applet you need to add Restart information to the header. This is done by adding the DRI Marker (0xFF DD) to the header.

JPEG_Gray - VisualApplets Design

Basic design structure

Figure 225. Basic design structure


This Example is basically the same as the Gray example. The differences are:
1. RGB data from a Bayer conversion is converted to the YCrCb colorspace.
2. Cr and Cb components are subsampled.
3. The separated images are buffered in a separate buffer. In order to sort the Lines to 6 converters without inserting dummy lines an independend sorting buffer is needed.
4. Sync needs to be split into 3 different images of different height.

In order to use restart interfalls in a subsampled image the sampling factor needs to be adjusted to the minimum number of MCUs in a channel. We use a 4:2:0 Subsampling. This means we have only half the line width in the Cr and Cb image. That's why lines need to be split in half in the Y image as well in order to get all restart markers in the same place.