YUV - Converting Between Y'UV and RGB

Converting Between Y'UV and RGB

RGB files are typically encoded in 8, 12, 16 or 24 bits per pixel. In these examples, we will assume 24 bits per pixel, which is written as RGB888. The standard byte format is

r0 = rgb; g0 = rgb; b0 = rgb; r1 = rgb; g1 = rgb; b1 = rgb; ...

Y'UV files can be encoded in 12, 16 or 24 bits per pixel. The common formats are Y'UV444 (or YUV444), YUV411, Y'UV422 (or YUV422) and Y'UV420p (or YUV420). The apostrophe after the Y is often omitted, as is the "p" after YUV420p. In terms of actual file formats, YUV420 is the most common, as the data is more easily compressed, and the file extension is usually ".YUV".

To convert from RGB to YUV or back, it is simplest to use RGB888 and YUV444. For YUV411, YUV422 and YUV420, the bytes need to be converted to YUV444 first.

YUV444 3 bytes per pixel YUV422 4 bytes per 2 pixels YUV411 6 bytes per 4 pixels YUV420p 6 bytes per 4 pixels, reordered


Read more about this topic:  YUV

Famous quotes containing the word converting:

    A way of certifying experience, taking photographs is also a way of refusing it—by limiting experience to a search for the photogenic, by converting experience into an image, a souvenir. Travel becomes a strategy for accumulating photographs.
    Susan Sontag (b. 1933)