After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 732621 - video-info: wrong stride with NV12 buffers
video-info: wrong stride with NV12 buffers
Status: RESOLVED WONTFIX
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
1.2.0
Other All
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-07-02 12:12 UTC by Fabien Dessenne
Modified: 2014-07-02 14:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Align to 2 for NV12 (1.37 KB, patch)
2014-07-02 12:26 UTC, Fabien Dessenne
none Details | Review

Description Fabien Dessenne 2014-07-02 12:12:42 UTC
In video-info.c, the fill_planes() function align the strides value to multiple of 4:
  info->stride[0] = GST_ROUND_UP_4 (width);
  info->stride[1] = info->stride[0];

This is wrong, the stride (as well as the width) shall be rounded to a multiple of 2. Indeed the NV12 pixel format uses 2x2 sub-sampling (details: http://www.fourcc.org/yuv.php#NV12), and as a consequence it is expected that the dimensions of a NV12 buffer are multiple of 2.
Comment 1 Tim-Philipp Müller 2014-07-02 12:25:32 UTC
I think it's not really right or wrong, it's just the default value used if you don't negotiate/announce your own custom strides. The default values tend to be what X expects IIRC.
Comment 2 Fabien Dessenne 2014-07-02 12:26:25 UTC
Created attachment 279747 [details] [review]
Align to 2 for NV12
Comment 3 Sebastian Dröge (slomo) 2014-07-02 12:26:41 UTC
Note that these values are only the GStreamer defaults, you can use different strides and offsets if you use buffers with a GstVideoMeta attached to them. Also fourcc.org quotes some MS documentation that says that the stride is supposed to be the same as for the Y plane.

We use 4-byte aligned strides by default mostly because it's what most APIs expected.
Comment 4 Nicolas Dufresne (ndufresne) 2014-07-02 14:43:56 UTC
I'd add that this default was chosen because it's word aligned, so it's most likely a fair optimization for SW operation. There should be no issue if you HW produce lower alignment, though take this with a grain of salt, it wasn't thoroughly tested. For your interest, not only X uses 4 bytes alignment, but also most camera drivers (if not more).