平面YUV420数据布局

编程入门 行业动态 更新时间:2024-10-22 17:38:05
本文介绍了平面YUV420数据布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在我的项目中,我使用 OpenH264 编解码器,据说以 YUV 4:2:0平面格式。解码后,我得到一个数组与 width * height * 1.5 元素,在显示时,它们看起来像这样:

In my project I use OpenH264 codec, which is said to output data in the YUV 4:2:0 planar format. After decoding I get one array with width * height * 1.5 elements, which, when displaying, looks like this image:

http://o3d.googlecode。 com / svn / trunk / samples_webgl / assets / shaving_cream.png

为什么主要区域下面有四个区域(包含Y-负责灰度 - 元素),而不是两个,就像在我的第二张照片上?这是否意味着格式不同或我错了,我的世界刚刚崩溃了?

Why there are four areas below the main one (which contains Y - responsible for grayscale - elements ), instead of two, like on my second picture? Is that mean that the format is different or am I wrong and my world just collapsed?

我认为重生应该是这样的:

I thought that the resoult should have looked like this:

推荐答案

这正是你的假设。您只是忽略了在图像宽度上有一半的U和V像素。所以U数据的偶数行在左边,奇数在右边。接下来是V数据。

It is exactly the way you assume. You are just overlooking that there are half as many U and V pixels across the width of the image. So the even numbered lines of U data are on the left, the odd numbered ones on the right. Followed by the V data.

为了按照你想要的方式排列它,解码器必须交错U和V数据。它没有这样做。只是在转换为RGB之前不要开始查看图像:)

To get it arranged the way you want to look at it, the decoder would have to interleave the U and V data. It doesn't do that. Just don't start looking at the image until you converted to RGB :)

更多推荐

平面YUV420数据布局

本文发布于:2023-11-30 20:38:32,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1651408.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:布局   平面   数据

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!