简体   繁体   English

AV_PIX_FMT_NV12 表示它具有 12bpp 位像素颜色,但数据为 uint8_t 如何修改帧中的像素?

[英]AV_PIX_FMT_NV12 says it has a 12bpp bit pixel color but data is uint8_t how can I modify the pixels from a frame?

The documentaions says AV_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)文档说 AV_PIX_FMT_NV12 平面 YUV 4:2:0,12bpp,Y 的 1 个平面和 UV 组件的 1 个平面,它们是交错的(第一个字节 U 和接下来的字节 V)

also linesize[1] and linesize[0] are 1920, but if I strlen(data[1]) ( UV components ) I get 1044587 this divided by the frame->heigth gives me 967,21... so the linesize is wrong? linesize[1] 和 linesize[0] 也是 1920,但是如果我 strlen(data[1])(UV 分量)我得到 1044587 这除以 frame->heigth 给我 967,21 ... 所以 linesize 是错误的?

It's 8 bits per channel, so uint8_t is correct.每个通道是 8 位,所以 uint8_t 是正确的。

The "12 bits per pixel" comes from 8 bits Y + 2 bits U (8 bits for every 4 pixels) + 2 bits V (8 bits for every 4 pixels) = 12 bits per pixel on average. “每像素 12 位”来自 8 位 Y + 2 位 U(每 4 个像素 8 位)+ 2 位 V(每 4 个像素 8 位)= 平均每像素 12 位。 This is also why the UV plane is half as many bits as the Y plane;这也是为什么 UV 平面的位数是 Y 平面的一半; it's U+V data, but only for 1/4 of the pixels.它是 U+V 数据,但仅适用于 1/4 的像素。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM