gst-plugins-good: v4l2: Add adobe colorspace support
Nicolas Dufresne
nicolas.dufresne at collabora.com
Thu Jan 21 08:25:43 PST 2016
see comment inline.
Le jeudi 21 janvier 2016 à 01:52 -0800, Wim Taymans a écrit :
> Module: gst-plugins-good
> Branch: master
> Commit: 681bab62e5d3a54b930b8c73f98f3a1ca80c4f14
> URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit
> /?id=681bab62e5d3a54b930b8c73f98f3a1ca80c4f14
>
> Author: Wim Taymans <wtaymans at redhat.com>
> Date: Thu Jan 21 10:49:44 2016 +0100
>
> v4l2: Add adobe colorspace support
>
> Use the new primaries and transfer function for Adobe RGB.
> Explicitly list the colorimetry instead of using the default
> GStreamer
> ones. The defaults for BT2020, for example, do not match.
> Explicitly set the matrix of SRGB to RGB.
>
> ---
>
> sys/v4l2/gstv4l2object.c | 39 ++++++++++++++++++++++++++----------
> ---
> 1 file changed, 26 insertions(+), 13 deletions(-)
>
> diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c
> index 740dfcf..095e2f3 100644
> --- a/sys/v4l2/gstv4l2object.c
> +++ b/sys/v4l2/gstv4l2object.c
> @@ -1892,14 +1892,23 @@ gst_v4l2_object_get_colorspace (enum
> v4l2_colorspace colorspace,
> /* First step, set the defaults for each primaries */
> switch (colorspace) {
> case V4L2_COLORSPACE_SMPTE170M:
> - ret = gst_video_colorimetry_from_string (cinfo,
> - GST_VIDEO_COLORIMETRY_BT601);
> + cinfo->range = GST_VIDEO_COLOR_RANGE_16_235;
> + cinfo->matrix = GST_VIDEO_COLOR_MATRIX_BT601;
> + cinfo->transfer = GST_VIDEO_TRANSFER_BT709;
> + cinfo->primaries = GST_VIDEO_COLOR_PRIMARIES_SMPTE170M;
> break;
> case V4L2_COLORSPACE_REC709:
> - ret = gst_video_colorimetry_from_string (cinfo,
> - GST_VIDEO_COLORIMETRY_BT709);
> + cinfo->range = GST_VIDEO_COLOR_RANGE_16_235;
> + cinfo->matrix = GST_VIDEO_COLOR_MATRIX_BT709;
> + cinfo->transfer = GST_VIDEO_TRANSFER_BT709;
> + cinfo->primaries = GST_VIDEO_COLOR_PRIMARIES_BT709;
> break;
> case V4L2_COLORSPACE_SRGB:
> + cinfo->range = GST_VIDEO_COLOR_RANGE_0_255;
> + cinfo->matrix = GST_VIDEO_COLOR_MATRIX_RGB;
This is not according to the V4L2 spec.
http://linuxtv.org/downloads/v4l-dvb-apis/ch02s06.html#col-srgb
"The luminance (Y') and color difference (Cb and Cr) are obtained with
the following V4L2_YCBCR_ENC_SYCC encoding as defined by [sYCC]:"
SRGB in GStreamer seems to have a different meaning then in V4L2 here.
> + cinfo->transfer = GST_VIDEO_TRANSFER_SRGB;
> + cinfo->primaries = GST_VIDEO_COLOR_PRIMARIES_BT709;
> + break;
> case V4L2_COLORSPACE_JPEG:
> /* This is in fact sYCC */
> cinfo->range = GST_VIDEO_COLOR_RANGE_0_255;
> @@ -1908,17 +1917,22 @@ gst_v4l2_object_get_colorspace (enum
> v4l2_colorspace colorspace,
> cinfo->primaries = GST_VIDEO_COLOR_PRIMARIES_BT709;
> break;
> case V4L2_COLORSPACE_ADOBERGB:
> - GST_FIXME ("AdobeRGB is not yet supported by GStreamer");
> - /* We are missing the primaries and the transfer function */
> - ret = FALSE;
> + cinfo->range = GST_VIDEO_COLOR_RANGE_16_235;
> + cinfo->matrix = GST_VIDEO_COLOR_MATRIX_BT601;
> + cinfo->transfer = GST_VIDEO_TRANSFER_ADOBERGB;
> + cinfo->primaries = GST_VIDEO_COLOR_PRIMARIES_ADOBERGB;
> break;
> case V4L2_COLORSPACE_BT2020:
> - ret = gst_video_colorimetry_from_string (cinfo,
> - GST_VIDEO_COLORIMETRY_BT2020);
> + cinfo->range = GST_VIDEO_COLOR_RANGE_16_235;
> + cinfo->matrix = GST_VIDEO_COLOR_MATRIX_BT2020;
> + cinfo->transfer = GST_VIDEO_TRANSFER_BT709;
> + cinfo->primaries = GST_VIDEO_COLOR_PRIMARIES_BT2020;
> break;
> case V4L2_COLORSPACE_SMPTE240M:
> - ret = gst_video_colorimetry_from_string (cinfo,
> - GST_VIDEO_COLORIMETRY_SMPTE240M);
> + cinfo->range = GST_VIDEO_COLOR_RANGE_16_235;
> + cinfo->matrix = GST_VIDEO_COLOR_MATRIX_SMPTE240M;
> + cinfo->transfer = GST_VIDEO_TRANSFER_SMPTE240M;
> + cinfo->primaries = GST_VIDEO_COLOR_PRIMARIES_SMPTE240M;
> break;
> case V4L2_COLORSPACE_470_SYSTEM_M:
> cinfo->range = GST_VIDEO_COLOR_RANGE_16_235;
> @@ -2005,8 +2019,7 @@ gst_v4l2_object_get_colorspace (enum
> v4l2_colorspace colorspace,
> cinfo->transfer = GST_VIDEO_TRANSFER_SRGB;
> break;
> case V4L2_XFER_FUNC_ADOBERGB:
> - GST_FIXME ("AdobeRGB is not yet supported by GStreamer");
> - cinfo->transfer = GST_VIDEO_TRANSFER_UNKNOWN;
> + cinfo->transfer = GST_VIDEO_TRANSFER_ADOBERGB;
> break;
> case V4L2_XFER_FUNC_SMPTE240M:
> cinfo->transfer = GST_VIDEO_TRANSFER_SMPTE240M;
>
> _______________________________________________
> gstreamer-commits mailing list
> gstreamer-commits at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-commits
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20160121/8abd251d/attachment.sig>
More information about the gstreamer-devel
mailing list