0

According to a reference that I've been reading, some planar YUV formats (e.g. UYVY) use macropixels which contain data for multiple pixels - specifically, in the case of UYVY, luma values per pixel and U and V samples for every other horizontal pixel.

What I don't see described is what value should be used for video when the dimensions are not divisible by 2. For example, if a frame's width in pixels is odd, should the last macropixel on each line wrap onto the next line, or should the second Y value be assumed to be ignored during decoding? Is there a standard for what that Y value should be set to (e.g. zero)?

If the macropixels do wrap, then what should be the case for the final macropixel in frame sizes with an odd pixel count, such as 51x51?

Polynomial
  • 27,674
  • 12
  • 80
  • 107

1 Answers1

2

I asked about this on #ffmpeg on Freenode IRC, and a kind person named iive gave me some answers.

Each line is treated separately, so there's no wrapping of values in a macropixel from one line to the next. In the case of an odd frame width, the Y value from the last pixel is duplicated. So, if you've got a pixel with YUV values of [123, 45, 67] at the end of a line, the UYVY macropixel would have values of [45, 123, 67, 123].

There may also be padding at the end of each line's data, in order to align each frame line to a boundary so that SIMD instructions only need to operate on aligned data. This depends on the exact format you're using.

Polynomial
  • 27,674
  • 12
  • 80
  • 107