当前位置:网站首页>Introduction to color coding format
Introduction to color coding format
2022-06-12 13:40:00 【Li. CQ】
Simple classification of color coding formats
- YUV
- YUV444
- YUV 4:2:2
- YUV 4:2:0
- YUV420sp
- NV12
- NV21
- YUV420p
- YU12
- YV12
- YUV420sp
- RGB
Grading introduction
YUV, It's divided into three parts ,“Y” Indicates brightness (Luminance or Luma), That is, gray value ; and “U” and “V” It's color (Chrominance or Chroma), It is used to describe image color and saturation , Used to specify the color of pixels . Mainly used in TV system and analog video field , It will send the brightness information (Y) And color information (UV) Separate , No, UV Information can also display complete images , It's just black and white , This design solves the problem of compatibility between color TV and black and white TV . also ,YUV Unlike RGB That requires three independent video signals to be transmitted at the same time , So use YUV Mode transfer takes up very little bandwidth .
YUV Two major categories of formats
- planar : First, store all pixels in a row Y, And then it stores all the pixels U, And then all the pixels V.
- packed : Every pixel point Y,U,V It's continuous * Stored .
frequently-used YUV Format :
- YUV444: every last Y Corresponding to a group of UV component , 1 Pixel rgb The memory occupied by data is 8 + 8 + 8 = 24bit = 3byte;
- YUV422: Every two Y Share a group UV component , 1 Pixel rgb The memory occupied by data is 8 + 4 + 4 = 16bit = 2byte;
- YUV420: Every four Y Share a group UV component , 1 Pixel rgb The memory occupied by data is 8 + 2 + 2 = 12bit = 1.5byte;
YUV420p
YUV420p: Also called planer Flat pattern ,Y ,U,V And then different planes , That is, there are three planes .
- YU12 (I420, Android mode ) : The storage order is save first Y, Save again U, Last deposit V. Such as :YYYYYYYYUUVV;
- YV12: The storage order is save first Y, Save again U, Last deposit V. Such as : YYYYYYYYVVUU;
YUV420sp
YUV420sp: Also called bi-planer or two-planer Biplane ,Y A plane ,UV Cross store on the same plane .
- NV12 (iOS There is only this mode in ) : The storage order is save first Y, Again UV Alternate storage . Such as :YYYYYYYYUVUV;
- NV21( Android mode ): The storage order is save first Y, Again VU Alternate storage . Such as : YYYYYYYYVUVU;
Calculate the size
Y component width * height = Y( The sum of the )
U component Y/4 = U; V component = Y/ 4;
therefore YUV420 The length of the data in memory is width * height * 3 / 2 ( One YUV Occupy 1.5 Bytes ); So the size of a data collection is width * height * 1.5 * Frame rate * time;
Generally speaking , The video data collected directly is RGB24 The format of ,RGB24 The size of a frame size=width×heigth×3 byte ;
So it is usually in the collection of RGB24 after , You need to compress the amount data in this format , Change the color space of the image from RGB To YUV; This will not only reduce the amount of data , and X264 When coding , Need standard YUV420 Format ; then adopt Some coding algorithms , The data will be greatly reduced , then Package the encoded data , Conduct RTP Real time transmission , At the receiving end , After receiving the data, decode it and pass OpenGL Render to screen , Or will YUV420 To RGB24 Post render to screen ;
stay iOS in
stay iOS in Use The camera perhaps Create decoder , Or create a render buffer ; All need to specify PixelFormatType; however iOS By default, the medium and hard disk decoding only supports NV12 The format of , stay PixelFormatType In the enumeration of , There are four
- kCVPixelFormatType_420YpCbCr8Planar
- kCVPixelFormatType_420YpCbCr8PlanarFullRange
- kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange
- kCVPixelFormatType_420YpCbCr8BiPlanarFullRange
Literally , The first one is YUV420p The format of , It's three planes The last two are two planes , Or is it call CVPixelBufferGetPlaneCount(pixel) Function to get the number of planes , The same conclusion will be reached ; But the scope is narrowed down to the last two ;
If the video The resolution is 480*640 ( The difference is The calculation steps are different ) Finally decide to use kCVPixelFormatType_420YpCbCr8BiPlanarFullRange;
- kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange : Y and UV In steps of 480( Actual length , Not completed ) Y The row width of is 640,UV Row width is 320
- kCVPixelFormatType_420YpCbCr8BiPlanarFullRange : Y and UV In steps of 512( Adopted 64 Byte alignment Misaligned complement 0) Y The row width of is 640,UV Row width is 320
边栏推荐
- Overview of embedded system 2- composition and application of embedded system
- Qt5 plug-in production
- 播放器屏幕方向方案
- Realization of Joseph Ring with one-way ring linked list
- Codeforces 1629 F1. Game on sum (easy version) - DP, game, thinking
- 镜像扫描工具预研
- 数据类型转换和条件控制语句
- 上海解封背后,这群开发者“云聚会”造了个AI抗疫机器人
- Actual combat | realizing monocular camera ranging by skillfully using pose solution
- Codeforces 1629 B. GCD arrays - simple thinking
猜你喜欢

一种快速创建测试窗口的方法

Qt5 plug-in production

Octopus network progress monthly report | may 1-May 31, 2022

聊聊MySQL的10大经典错误

How to solve the problem of data table query error when SQLite writes the registration function?

Successful job hopping Ali, advanced learning

import torch_ Data view of geometric

当字节跳动在美国输出中国式 996

创新实训(十)高级界面美化

Experience and learning path of introductory deep learning and machine learning
随机推荐
Getting started with NVIDIA Jetson nano Developer Kit
How to solve the problem of data table query error when SQLite writes the registration function?
Informatics Olympiad all in one 1000: introductory test questions
Encryptor and client authenticate with each other
【SemiDrive源码分析】【X9芯片启动流程】25 - MailBox 核间通信机制介绍(代码分析篇)之 RPMSG-IPCC RTOS & QNX篇
【刷题篇】超级洗衣机
Codeforces 1629 C. Mexico array - simple greed
What if the MySQL installation on the apple computer is completed and cannot be found
Codeforces 1638 B. odd swap sort - tree array, no, simple thinking
【刷题篇】抽牌获胜的概率
Tinyxml Usage Summary
IC chip scheme fs4062b for lithium battery charging with 5V boost to 12.6V
Seekg, tellg related file operations
How to balance multiple losses in deep learning?
C#DBHelper_ FactoryDB_ GetConn
Codeforces 1629 F2. Game on sum (hard version) - Yang Hui's triangle, violence, finding rules
单向环形链表实现约瑟夫环
Pytorch to onnx, onnxruntime reasoning in mmclas
m1 pod install pod lint 失败解决方案
[wustctf2020] selfie score query -1