[PATCH 1/3] media: rkisp1: Set format defaults based on requested color space

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

 



When color space JPEG is requested, the ISP sets the quantization
incorrectly to limited range. To fix that, set the xfer_func, ycbcr_enc
and quantization to the defaults for the requested color space if they
are not specified explicitly. Do this only in case we are converting
from RAW to YUV.

Signed-off-by: Stefan Klug <stefan.klug@xxxxxxxxxxxxxxxx>
---
 .../media/platform/rockchip/rkisp1/rkisp1-isp.c   | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
index d94917211828..468f5a7d03c7 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
@@ -680,10 +680,23 @@ static void rkisp1_isp_set_src_fmt(struct rkisp1_isp *isp,
 		if (sink_info->pixel_enc == V4L2_PIXEL_ENC_BAYER) {
 			if (format->colorspace != V4L2_COLORSPACE_DEFAULT)
 				src_fmt->colorspace = format->colorspace;
-			if (format->xfer_func != V4L2_XFER_FUNC_DEFAULT)
+
+			if (format->xfer_func == V4L2_XFER_FUNC_DEFAULT)
 				src_fmt->xfer_func = format->xfer_func;
+			else
+				src_fmt->xfer_func =
+					V4L2_MAP_XFER_FUNC_DEFAULT(format->colorspace);
+
 			if (format->ycbcr_enc != V4L2_YCBCR_ENC_DEFAULT)
 				src_fmt->ycbcr_enc = format->ycbcr_enc;
+			else
+				src_fmt->ycbcr_enc =
+					V4L2_MAP_YCBCR_ENC_DEFAULT(format->colorspace);
+
+			if (format->quantization == V4L2_QUANTIZATION_DEFAULT)
+				src_fmt->quantization =
+					V4L2_MAP_QUANTIZATION_DEFAULT(false,
+						format->colorspace, format->ycbcr_enc);
 		}
 
 		if (format->quantization != V4L2_QUANTIZATION_DEFAULT)
-- 
2.43.0





[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