[PATCH v5 7/7] media: imx: Allow BT.709 encoding for IC routes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx>
Signed-off-by: Steve Longerbeam <slongerbeam@xxxxxxxxx>
---
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(-)

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 =
-- 
2.17.1




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux