NV21 format and odd image dimensions

你说的曾经没有我的故事 提交于 2019-12-10 17:08:40

问题


I have been working for some time with NV21 images in Android and I have been tracking a bug that might be caused by incorrect indexing bytes in an NV21 image.

The image in the answer of this question has a nice overview of how the Y, U and V bytes are positioned in the image buffer. Not sure it is allowed, but I am embedding it below:

  1. What happens when the image has odd dimensions (as in parity)? Is that even possible in this format?
  2. Do we have an official specification of this format somewhere?

回答1:


In the case of an image with odd dimensions (i.e one of W or H, in a WxH image is odd), you'd expect the Y plane to be fully sampled as always, with WxH samples, followed by 2(⌈W/2⌉ x ⌈H/2⌉) chroma samples, where we divide each image dimension by 2 but round up rather than round down.

So some of the pixels at the very edge of the image have chroma samples that correspond to only 1 or 2 original pixels, rather than 4. I hope that makes sense. You can see in this link that a couple of other libraries have had issues handling odd dimensions in YUV images previously.

For your second question, I haven't seen an official specification, but I have seen some code in the android framework that handles this format, I will see if I can dig up a link to it, and append it to this answer.



来源:https://stackoverflow.com/questions/33812585/nv21-format-and-odd-image-dimensions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!