LinuxTV Patchwork [v6,7/7] media: imx: Allow BT.709 encoding for IC routes

login
register
mail settings
Submitter Steve Longerbeam
Date March 7, 2019, 11:33 p.m.
Message ID <20190307233356.23748-8-slongerbeam@gmail.com>
Download mbox | patch
Permalink /patch/54945/
State New
Delegated to: Hans Verkuil
Headers show

Comments

Steve Longerbeam - March 7, 2019, 11:33 p.m.
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 v5:
- rebased this patch on top of repurposing the function to
  imx_media_try_colorimetry().
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 | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Patch

diff --git a/drivers/staging/media/imx/imx-media-utils.c b/drivers/staging/media/imx/imx-media-utils.c
index aa7d4be77a7e..12967d6d7e1a 100644
--- a/drivers/staging/media/imx/imx-media-utils.c
+++ b/drivers/staging/media/imx/imx-media-utils.c
@@ -524,7 +524,7 @@  EXPORT_SYMBOL_GPL(imx_media_init_cfg);
  * If this format is destined to be routed through the Image Converter,
  * quantization and Y`CbCr encoding must be fixed. The IC supports only
  * full-range quantization for RGB at its input and output, and only
- * BT.601 Y`CbCr encoding.
+ * BT.601 or Rec.709 Y`CbCr encoding.
  */
 void imx_media_try_colorimetry(struct v4l2_mbus_framefmt *tryfmt,
 			       bool ic_route)
@@ -563,7 +563,9 @@  void imx_media_try_colorimetry(struct v4l2_mbus_framefmt *tryfmt,
 		    tryfmt->quantization == V4L2_QUANTIZATION_DEFAULT)
 			tryfmt->quantization = V4L2_QUANTIZATION_FULL_RANGE;
 
-		tryfmt->ycbcr_enc = V4L2_YCBCR_ENC_601;
+		if (tryfmt->ycbcr_enc != V4L2_YCBCR_ENC_601 &&
+		    tryfmt->ycbcr_enc != V4L2_YCBCR_ENC_709)
+			tryfmt->ycbcr_enc = V4L2_YCBCR_ENC_601;
 	} else {
 		if (tryfmt->ycbcr_enc == V4L2_YCBCR_ENC_DEFAULT) {
 			tryfmt->ycbcr_enc =

Privacy Policy