YUV Formats

Color is decomposed in three components.

      Y: represents Luminance. 
      U (Cb): is the Chroma channel, U axis, blue component.
      V (Cr): is the Chroma channel, V axis, red component.

The first reason to use the YUV decomposition is that a conversion of an RGB signal (such as the one used on computer monitors) to YUV requires just a linear transform, which is really easy to do with analogue circuitry and it is cheap to compute numerically.

The second reason that YUV allows separating the color information from the luminance component (which we perceive as brightness). For this reason YUV is used worldwide for television and motion picture encoding standards such as PAL, SECAM and for JPEG/MPEG compression. Since the human eye is also much more responsive to luminance, JPEG compresses more heavily the chroma channels which are less likely to cause perceptible differences in the resulting image.

 

There are several YUV formats. There are interleaved formats and planar formats (also called packed formats). The main difference is how they are stored in memory.

Interleaved images have all color components needed to represent a pixel placed at the same place in memory. For planar formats the data is not interleaved, but stored separately for each color channel (also called color plane).

For filter writers this means that they can write one simple function that is called three times, one for each color channel, assuming that the operations are channel-independent (which is not always the case). Again, using aligned for both color and luma channels will allow easy memory access. The use of a planar format gives in most cases a significant speedup, since all bytes of each plane can be treated the same way. It can also give a speedup because your filter doesn't have to work on all planes, if it only modifies one or two of them.

 

4:4:4 Format (Base YUV Format)

 

 

In this format size of matrices of Y, U and V value are as same as RGB.

Image size: 176x144.
RGB: 3 matrices in size of 176x144.
YUV: 3 matrices in size of 176x144.

 

4:2:2 Format (Known as YUY2)

However in 4:2:2 format Y value is 176x144 but U and V values are half sizes, 88x72.

Image size: 176x144.
RGB: 3 matrices in size of 176x144.
     Y: 176x144.
     U: 88x72.
     V: 88x72.

 

YUY2 colorformat

YUY2 is an interleaved image format. Bytes are arranged in memory like this:

YUYV|YUYV|YUYV|YUYV|YUYV|YUYV|...
^first byte in a row.

 

 

So when converting back to RGB color space each U and V value is used four times to complete the conversion. Figure 1 shows the usage of the 4:2:2 format while converting back to RGB.

Figure 1. YUV 4:2:2 format.

时间: 2025-01-20 12:56:21

YUV Formats的相关文章

Video for Linux Two API Specification revision0.24【转】

转自:http://blog.csdn.net/jmq_0000/article/details/7536805#t136 Video for Linux Two API Specification Revision 0.24 Michael H Schimek             <mschimek@gmx.at>            Bill Dirks Hans Verkuil Martin Rubli Copyright 1999, 2000, 2001, 2002, 2003,

Video for Linux Two API Specification Revision 2.6.32【转】

转自:https://www.linuxtv.org/downloads/legacy/video4linux/API/V4L2_API/spec-single/v4l2.html Video for Linux Two API Specification Revision 2.6.32 Michael H Schimek     <mschimek@gmx.at>    Bill Dirks Original author of the V4L2 API and documentation.

FFMPEG 实现 YUV,RGB各种图像原始数据之间的转换(swscale)

FFMPEG中的swscale提供了视频原始数据(YUV420,YUV422,YUV444,RGB24...)之间的转换,分辨率变换等操作,使用起来十分方便,在这里记录一下它的用法. swscale主要用于在2个AVFrame之间进行转换. 下面来看一个视频解码的简单例子,这个程序完成了对"北京移动开发者大会茶歇视频2.flv"(其实就是优酷上的一个普通视频)的解码工作,并将解码后的数据保存为原始数据文件(例如YUV420,YUV422,RGB24等等).其中略去了很多的代码. 注:完

Converting Between YUV and RGB

It is frequently necessary to convert between YUV pixel formats (used by the JPEG and MPEG compression methods) and RGB format (used by many hardware manufacturers.) The following formulas show how to compute a pixel's value in one format from the pi

几种常见的YUV格式--yuv422:yuv420【转】

转自:http://blog.csdn.net/u012288815/article/details/51799477 关于yuv 格式 YUV 格式通常有两大类:打包(packed)格式和平面(planar)格式.前者将 YUV 分量存放在同一个数组中,通常是几个相邻的像素组成一个宏像素(macro-pixel);而后者使用三个数组分开存放 YUV 三个分量,就像是一个三维平面一样. 下图是DM6467的视频接口处理前端     TI的几款达芬奇处理器对于接收YCbCr数据和存放数据的方式是不

常用YUV转RGB代码

常用YUV转RGB  [java] view plaincopyprint? public class YuvToRGB {       private static int R = 0;       private static int G = 1;       private static int B = 2;       //I420是yuv420格式,是3个plane,排列方式为(Y)(U)(V)       public static int[] I420ToRGB(byte[] sr

YUV转RGB(NV21-ARGB)的Neon优化代码

说明 此代码仅限于 NV21 格式转 ARGB 格式. NV21 格式中,Y 单独存储,UV分量交错存储. 使用如下公式: R = Y + 1.402*(V-128); G = Y - 0.34414*(U-128) - 0.71414*(V-128); B = Y + 1.772*(U-128); 浮点乘法用 6位精度处理(即a*b = ((a << 6)*b )>>6) 代码 #ifdef HAS_NEON #include <arm_neon.h> #endif

如何使用MATLAB语言读写YUV文件

本文详细介绍了如何使用MATLAB进行读写YUV文件,并给出了详细的代码及其分析. 示例程序如下: close all; clear; fid1=fopen('D:\HM-14.0-ROI\bin\vc10\Win32\Release\Result\背景建模Result\hall_cif_352x288_300\QP=22\bgf_rec.yuv','rb'); fid2=fopen('D:\HM-14.0-ROI\bin\vc10\Win32\Release\Result\背景建模Result

RGB与YUV简介

RGB: 红绿蓝(RGB)是计算机显示的基色,RGB565支持的色深可编程至高达每像素16位, 即 RGB565(红色5位,绿色6位,蓝色5位). YUV: 视频编解码器功能 视频编码器要求YUV4:2:0格式的视频输入,因此可能根据应用需要进行视频输入的预处 理,即对YUV4:2:2隔行扫描(例如从摄像机)到YUV 4:2:0非隔行扫描转换,仅抽取但不过滤UV分.对视频解码器而言,还需要进行后处理,以将解码的YUV 4:2:0数据转换为RGB进行显示,包括:YUV 4:2:0到RGB转换:16