[Bug 762529] New: v4l2src produces wrong colorimetry info for NV12

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Tue Feb 23 12:52:07 UTC 2016


https://bugzilla.gnome.org/show_bug.cgi?id=762529

            Bug ID: 762529
           Summary: v4l2src produces wrong colorimetry info for NV12
    Classification: Platform
           Product: GStreamer
           Version: git master
                OS: Linux
            Status: NEW
          Severity: major
          Priority: Normal
         Component: gst-plugins-good
          Assignee: gstreamer-bugs at lists.freedesktop.org
          Reporter: n770galaxy at gmail.com
        QA Contact: gstreamer-bugs at lists.freedesktop.org
     GNOME version: ---

When video is captured in NV12 and later converted by videoconvert into YV12
black turns gray.

To reproduce the issue run:

sudo modprobe vivid
gst-launch-1.0 v4l2src ! video/x-raw, format=NV12 ! videoconvert ! video/x-raw,
format=YV12 ! xvimagesink

Also reproducible with real hardware.

gst_v4l2_object_get_colorspace[1] is called with V4L2_COLORSPACE_SRGB,
V4L2_QUANTIZATION_DEFAULT, V4L2_YCBCR_ENC_DEFAULT, V4L2_XFER_FUNC_DEFAULT which
leads to full range colorimetry when it should be limited range to get proper
colors.

Seems to be a discrepancy at the documentation, the following is the info I've
got at #v4l channel.

{{{
ad-n770:
13:16 I'm looking into one issue in the gstreamer element v4l2src that seems to
lead to a discrepancy in the v4l documentation
13:17 the issue is reproduced with vivid and a uvcvideo compatible hardware
13:18 when NV12 format is selected for capture the GStreamer element produces
wrong colorimetry information that leads black turn to gray
13:18 we tracked down to the following facts
13:20 1) for NV12 is reported V4L2_COLORSPACE_SRGB and
V4L2_QUANTIZATION_DEFAULT
13:21 2) at https://linuxtv.org/downloads/v4l-dvb-apis/ch02s06.html#col-srgb
it's said "The default Y'CbCr quantization is full range."
13:22 3) at https://linuxtv.org/downloads/v4l-dvb-apis/ch02s05.html bottom note
for V4L2_QUANTIZATION_DEFAULT it's said "V4L2_QUANTIZATION_DEFAULT
Use the default quantization encoding as defined by the colorspace. This is
always full range for R'G'B' (except for the BT.2020 colorspace) and usually
limited range for Y'CbCr."
13:24 seems that the issue in the colors is due the fact that we followed the
rule of full range because V4L2_COLORSPACE_SRGB
13:25 but we are not sure if it's either correct for NV12 reporting as SRGB or
if we should follow the note in V4L2_QUANTIZATION_DEFAULT "usually limited
range for Y'CbCr."
13:26 please could you give us some light on this?

hverkuil:
13:27 ad-n770: I believe that the ENC_SYCC documentation is wrong. I think it
is actually the same as ENC_601 and that it is limited range instead of full
range.
13:29 What is confusing is that SYCC is the same as BT601 within the limited
range, but allows values above and below that range.
13:31 It is best to follow the V4L2_MAP_QUANTIZATION_DEFAULT() macro from
videodev2.h: that does the right thing to the best of my knowledge.
13:32 The spec regarding SYCC is confusing. I plan on testing this with a
signal generator to double check this.
13:32 In the meantime I'll prepare a patch to bring the spec in line with the
V4L2_MAP_QUANTIZATION_DEFAULT macro.
}}}

[1]
https://cgit.freedesktop.org/gstreamer/gst-plugins-good/tree/sys/v4l2/gstv4l2object.c#n1879

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list