Contents > Editor Modes > RawGfx Mode > Raw Image Data Model
Previous | Next

2.3.1 Raw Image Data Model

The raw graphics mode interpretes binary data as image data. Any file can be opened and looked at in raw graphics mode, not only surface or framebuffer dumps.

Image data can be preceded by an optional header (see RawGfx|View|HeaderSize). After skipping the header file data is expected to be a sequence of video frames, each frame is of equal size. The color format specifies how the data in each frame is interpreted as pixels.

Regardless of color format, frames are made up of planes. (Bit planes for bit-planar "Amiga" style color formats, or byte planes for planar YUV formats). Non-planar formats, also called "chunky", you can think of as being planar with only 1 plane. Each frame, or more specically each plane, has a width, a height, and a linestride.

Planar YUV formats may use different width and height for their planes. This is also called subsampling, usually the Y plane has a higher resolution than U and V planes. When specifying width, height, and stride in RawGfx mode, it is always applied to the first full resolution Y plane. The settings for U and V plane are derived automatically. Alignment restrictions apply.

When configuring the image parameters, the linestride is implicitely derived from the width and the stride align value.

The following parameters can be configured in the RawGfx mode, they allow to describe almost any raw image format:

Below formulars illustrate how all pieces fit together to interprete binary data as frames:

framesize        = linestride * height * number_of_planes
number_of_planes = derived from color_format
linestride       = Align((width * bpp) >> 3, stride_align)

If the color format is <8bpp, Frame Width must be a multiple of pixels per byte (= 8 / bpp).

If the color format uses vertical downsampling (YUV420, or YUV422R), the height must be a multiple of 2. If the color format uses horizontal downsampling (YUV420, YUV422, etc.), the width must be a multiple of 2.

Stride Align must be a power of 2, and between 1 and 128.

For further illustration below are a few examples of image data, and how the user needed to configure the image parameters to correctly display it:

Example 1: 321x256 24-bit RGB, where lines have to start on 32-bit boundary (Windows BMP format)

color_format = BGR888
width        = 321
height       = 256
stride_align = 4
implicit linestride will be Align((321*24)>>3, 4) = 964 bytes
implicit number of planes is 1
implicit framesize will be 964 * 256 * 1 bytes

Example 2: QVGA YUV420 raw image data dump

color_format = YUV420
width        = 320
height       = 240
stride_align = 1
implicit linestride will be Align((320*8)>>3, 1) = 320 bytes
implicit number of planes is 3
implicit horizontal downsampling shift factor: 1
implicit vertical downsampling shift factor: 1
implicit framesize will be 320 * 240 + (320>>1) * (240>>1) * 2 bytes


http://datahammer.de
Previous | Next