YUV422 YUV420 Planar \ Semi-Planar \ Interleaved


關於yuv 格式

YUV 格式通常有兩大類:打包(packed)格式和平面(planar)格式。前者將 YUV 分量存放在同一個數組中,
通常是幾個相鄰的像素組成一個宏像素(macro-pixel);而后者使用三個數組分開存放 YUV 三個分量,就像
是一個三維平面一樣。

 

幾種常見的yuv格式

1.YUV422 Planar

這里,Y\U\V數據是分開存放的,每兩個水平Y采樣點,有一個Cb和一個Cr采樣點,如下圖

ffmpeg 中的定義  PIX_FMT_YUV422P,   ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)  

android  OMX  中的定義  OMX_COLOR_FormatYUV422Planar     //*  YUV422Planar           : Three arrays Y,U,V.

 

2. YUV420 Planar

這個格式跟YUV422 Planar 類似,但對於Cb和Cr的采樣在水平和垂直方向都減少為2:1,如下圖

 

ffmpeg 中定義  PIX_FMT_YUV420P    //< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)

android OMX 中定義  OMX_COLOR_FormatYUV420Planar     //  *  YUV420Planar           : Three arrays Y,U,V   

 

3.YUV422 Semi-Planar                                         Semi 是’半‘的意思 我的理解這個半平面模式

   這個格式的數據量跟YUV422 Planar的一樣,但是U、V是交叉存放的,如下圖。

 

ffmpeg 中 未找到定義

android  OMX  中 OMX_COLOR_FormatYUV422SemiPlanar    ////YUV422SemiPlanar       : Two arrays, one is all Y, the other is U and V

 

4.YUV420 Semi-Planar

 這個格式的數據量跟YUV420 Planar的一樣,但是U、V是交叉存放的,如下圖。

 ffmpeg 中定義  

PIX_FMT_NV12,      ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V)

android   OMX  中定義 OMX_COLOR_FormatYUV420SemiPlanar    //YUV420SemiPlanar       : Two arrays, one is all Y, the other is U and V 

 

5.YUV422 Interleaved        Interleaved -- 交錯   

這個格式的數據量跟YUV422 Planar的一樣,但是Y、U、V是交叉存放的,如下圖。 這個是打包(packed)模式的

ffmpeg  中  PIX_FMT_UYVY422   ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1

android  OMX 中  OMX_COLOR_FormatCbYCrY    //CbYCrY                 : Organized as 16bit UYVY (i.e. CbYCrY)

 

 

 24bit RGB888 -> 16bit RGB565 的轉換

 

 24ibt RGB888 R7 R6 R5 R4 R3 R2 R1 R0 G7 G6 G5 G4 G3 G2 G1 G0 B7 B6 B5 B4 B3 B2 B1 B0

 

 16bit RGB656 R7 R6 R5 R4 R3 G7 G6 G5 G4 G3 G2 B7 B6 B5 B4 B3

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM