RGB32

From Avisynth wiki
Jump to: navigation, search

RGB32 is an RGB video format where each pixel of the image contains one byte for each of the R (red), G (green) and B (blue) components plus an additional byte for transparency mask (A component) in successive places of memory. Since one byte occupies 8 bits, the total number of bits consumed by one pixel is 4*8 = 32 and thus the 32 at the end of the format's name.

As it is apparent, the layout of bytes in memory for an RGB32 video frame follows (assuming a least-significant-bit-is-first memory layout) the pattern below:

low memory address    ---->      high memory address
| pixel | pixel | pixel | pixel | pixel | pixel |...
|-------|-------|-------|-------|-------|-------|...
|B|G|R|A|B|G|R|A|B|G|R|A|B|G|R|A|B|G|R|A|B|G|R|A|...

Using the RGB32 video format provides in modern processors faster access to video data because the data is aligned to machine's word boundaries. For this reason many applications use it instead of RGB24 even when there is no transparency mask information in the fourth (A) byte, since in general the improved processing speed outweighs the memory overhead introduced by the unused A byte per pixel.

Personal tools