All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve Longerbeam <slongerbeam@gmail.com>
To: linux-media@vger.kernel.org
Cc: Tim Harvey <tharvey@gateworks.com>,
	Steve Longerbeam <slongerbeam@gmail.com>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	devel@driverdev.osuosl.org (open list:STAGING SUBSYSTEM),
	linux-kernel@vger.kernel.org (open list)
Subject: [PATCH v4 4/4] media: imx: Allow BT.709 encoding for IC routes
Date: Fri,  8 Feb 2019 17:47:48 -0800	[thread overview]
Message-ID: <20190209014748.10427-5-slongerbeam@gmail.com> (raw)
In-Reply-To: <20190209014748.10427-1-slongerbeam@gmail.com>

The IC now supports BT.709 Y'CbCr encoding, in addition to existing BT.601
encoding, so allow both, for pipelines that route through the IC.

Reported-by: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
---
Changes in v2:
- move ic_route check above default colorimetry checks, and fill default
  colorimetry for ic_route, otherwise it's not possible to set BT.709
  encoding for ic routes.
---
 drivers/staging/media/imx/imx-media-utils.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/media/imx/imx-media-utils.c b/drivers/staging/media/imx/imx-media-utils.c
index 5f110d90a4ef..dde0e47550d7 100644
--- a/drivers/staging/media/imx/imx-media-utils.c
+++ b/drivers/staging/media/imx/imx-media-utils.c
@@ -544,6 +544,19 @@ void imx_media_fill_default_mbus_fields(struct v4l2_mbus_framefmt *tryfmt,
 	if (tryfmt->field == V4L2_FIELD_ANY)
 		tryfmt->field = fmt->field;
 
+	if (ic_route) {
+		if (tryfmt->colorspace == V4L2_COLORSPACE_DEFAULT)
+			tryfmt->colorspace = fmt->colorspace;
+
+		tryfmt->quantization = is_rgb ?
+			V4L2_QUANTIZATION_FULL_RANGE :
+			V4L2_QUANTIZATION_LIM_RANGE;
+
+		if (tryfmt->ycbcr_enc != V4L2_YCBCR_ENC_601 &&
+		    tryfmt->ycbcr_enc != V4L2_YCBCR_ENC_709)
+			tryfmt->ycbcr_enc = V4L2_YCBCR_ENC_601;
+	}
+
 	/* fill colorimetry if necessary */
 	if (tryfmt->colorspace == V4L2_COLORSPACE_DEFAULT) {
 		tryfmt->colorspace = fmt->colorspace;
@@ -566,13 +579,6 @@ void imx_media_fill_default_mbus_fields(struct v4l2_mbus_framefmt *tryfmt,
 					tryfmt->ycbcr_enc);
 		}
 	}
-
-	if (ic_route) {
-		tryfmt->quantization = is_rgb ?
-			V4L2_QUANTIZATION_FULL_RANGE :
-			V4L2_QUANTIZATION_LIM_RANGE;
-		tryfmt->ycbcr_enc = V4L2_YCBCR_ENC_601;
-	}
 }
 EXPORT_SYMBOL_GPL(imx_media_fill_default_mbus_fields);
 
-- 
2.17.1


      parent reply	other threads:[~2019-02-09  1:48 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-09  1:47 [PATCH v4 0/4] media: imx: Add support for BT.709 encoding Steve Longerbeam
2019-02-09  1:47 ` [PATCH v4 1/4] gpu: ipu-v3: ipu-ic: Rename yuv2rgb encoding matrices Steve Longerbeam
2019-02-09  1:47   ` Steve Longerbeam
2019-02-11  9:58   ` Philipp Zabel
2019-02-11  9:58     ` Philipp Zabel
2019-02-11 18:24     ` Steve Longerbeam
2019-02-11 18:24       ` Steve Longerbeam
2019-02-12 10:17       ` Philipp Zabel
2019-02-12 10:17         ` Philipp Zabel
2019-02-12 17:42         ` Steve Longerbeam
2019-02-12 17:42           ` Steve Longerbeam
2019-02-13 10:35           ` Philipp Zabel
2019-02-13 10:35             ` Philipp Zabel
2019-02-14 18:54             ` Steve Longerbeam
2019-02-14 18:54               ` Steve Longerbeam
2019-02-11 23:33     ` Steve Longerbeam
2019-02-11 23:33       ` Steve Longerbeam
2019-02-09  1:47 ` [PATCH v4 2/4] gpu: ipu-v3: ipu-ic: Simplify selection of encoding matrix Steve Longerbeam
2019-02-09  1:47   ` Steve Longerbeam
2019-02-11 10:00   ` Philipp Zabel
2019-02-11 10:00     ` Philipp Zabel
2019-02-09  1:47 ` [PATCH v4 3/4] gpu: ipu-v3: ipu-ic: Add support for BT.709 encoding Steve Longerbeam
2019-02-09  1:47   ` Steve Longerbeam
2019-02-09  1:47   ` Steve Longerbeam
2019-02-11 10:12   ` Philipp Zabel
2019-02-11 10:12     ` Philipp Zabel
2019-02-11 10:12     ` Philipp Zabel
2019-02-12  1:20     ` Steve Longerbeam
2019-02-12  1:20       ` Steve Longerbeam
2019-02-12  1:20       ` Steve Longerbeam
2019-02-12 11:34       ` Philipp Zabel
2019-02-12 11:34         ` Philipp Zabel
2019-02-12 11:34         ` Philipp Zabel
2019-02-12 17:50         ` Steve Longerbeam
2019-02-12 17:50           ` Steve Longerbeam
2019-02-12 17:50           ` Steve Longerbeam
2019-02-09  1:47 ` Steve Longerbeam [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190209014748.10427-5-slongerbeam@gmail.com \
    --to=slongerbeam@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=tharvey@gateworks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.