我正在接收一个用GstVideoFrame编写的gstreamer元素的C++结构中的视频帧。
帧采用YUV420 NV12格式。
在这个gstreamer元素中,我试图在单独的缓冲区中复制y帧和uv帧。
根据videolan.org,YUV420 NV12数据存储在传入帧缓冲区中:(从网站复制的信息)
NV12:
Related to I420, NV12 has one luma "luminance" plane Y and one plane with U and V values interleaved.
In NV12, chroma planes (blue and red) are subsampled in both the horizontal and vertical dimensions by a factor of 2.
For a 2×2 group of pixels, you have 4 Y samples and 1 U and 1 V sample.
It can be helpful to think of NV12 as I420 with the U and V planes interleaved.
Here is a graphical representation of NV12. Each letter represents one bit:
For 1 NV12 pixel: YYYYYYYY UVUV
For a 2-pixel NV12 frame: YYYYYYYYYYYYYYYY UVUVUVUV
For a 50-pixel NV12 frame: Y×8×50 (UV)×2×50
For a n-pixel NV12 frame: Y×8×n (UV)×2×n但我似乎无法计算缓冲区中y数据和uv数据的偏移量。
Update_1 :我有帧的高度和宽度来计算y-数据和uv-数据的大小,如下:
y_size = width * height;
uv_size = y_size / 2;
如对此有任何帮助或评论,将不胜感激。
谢谢
发布于 2020-08-13 02:03:37
多亏了@Ext3h,我才能将y数据和uv数据从传入的YUV帧中分离出来。
y_data = (u8 *)GST_VIDEO_FRAME_PLANE_DATA (in_frame, 0);
uv_data =(u8 *)GST_VIDEO_FRAME_PLANE_DATA (in_frame, 1);https://stackoverflow.com/questions/63240547
复制相似问题