diff mbox series

media: rkisp1: Apply full quantization when color space JPEG is requested

Message ID 20250226192413.2903243-1-stefan.klug@ideasonboard.com (mailing list archive)
State New
Headers show
Series media: rkisp1: Apply full quantization when color space JPEG is requested | expand

Commit Message

Stefan Klug Feb. 26, 2025, 7:23 p.m. UTC
When color space V4L2_COLORSPACE_JPEG is requested the ISP incorrectly
sets the output quantization to V4L2_QUANTIZATION_LIM_RANGE. Fix that by
applying the default quantization for the requested color space.

Fixes: c1ec5efba080 ("media: rkisp1: Allow setting all color space fields on ISP source pad")
Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
---
 drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Stefan Klug Feb. 26, 2025, 8:40 p.m. UTC | #1
Hi all,

unfortunately I was tricked by my own observations and this patch
doesn't actually fix the problem. So please ignore. I'll post a proper
fix soon.

Sorry for the noise.

Best regards,
Stefan

On Wed, Feb 26, 2025 at 08:23:53PM +0100, Stefan Klug wrote:
> When color space V4L2_COLORSPACE_JPEG is requested the ISP incorrectly
> sets the output quantization to V4L2_QUANTIZATION_LIM_RANGE. Fix that by
> applying the default quantization for the requested color space.
> 
> Fixes: c1ec5efba080 ("media: rkisp1: Allow setting all color space fields on ISP source pad")
> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
> ---
>  drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
> index d94917211828..98635d875ac4 100644
> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
> @@ -646,7 +646,7 @@ static void rkisp1_isp_set_src_fmt(struct rkisp1_isp *isp,
>  
>  	/*
>  	 * Copy the color space for the sink pad. When converting from Bayer to
> -	 * YUV, default to a limited quantization range.
> +	 * YUV, default to the default quantization range of the color space.
>  	 */
>  	src_fmt->colorspace = sink_fmt->colorspace;
>  	src_fmt->xfer_func = sink_fmt->xfer_func;
> @@ -654,7 +654,8 @@ static void rkisp1_isp_set_src_fmt(struct rkisp1_isp *isp,
>  
>  	if (sink_info->pixel_enc == V4L2_PIXEL_ENC_BAYER &&
>  	    src_info->pixel_enc == V4L2_PIXEL_ENC_YUV)
> -		src_fmt->quantization = V4L2_QUANTIZATION_LIM_RANGE;
> +		src_fmt->quantization = V4L2_MAP_QUANTIZATION_DEFAULT(
> +			false, sink_fmt->colorspace, sink_fmt->ycbcr_enc);
>  	else
>  		src_fmt->quantization = sink_fmt->quantization;
>  
> -- 
> 2.43.0
> 
>
diff mbox series

Patch

diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
index d94917211828..98635d875ac4 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
@@ -646,7 +646,7 @@  static void rkisp1_isp_set_src_fmt(struct rkisp1_isp *isp,
 
 	/*
 	 * Copy the color space for the sink pad. When converting from Bayer to
-	 * YUV, default to a limited quantization range.
+	 * YUV, default to the default quantization range of the color space.
 	 */
 	src_fmt->colorspace = sink_fmt->colorspace;
 	src_fmt->xfer_func = sink_fmt->xfer_func;
@@ -654,7 +654,8 @@  static void rkisp1_isp_set_src_fmt(struct rkisp1_isp *isp,
 
 	if (sink_info->pixel_enc == V4L2_PIXEL_ENC_BAYER &&
 	    src_info->pixel_enc == V4L2_PIXEL_ENC_YUV)
-		src_fmt->quantization = V4L2_QUANTIZATION_LIM_RANGE;
+		src_fmt->quantization = V4L2_MAP_QUANTIZATION_DEFAULT(
+			false, sink_fmt->colorspace, sink_fmt->ycbcr_enc);
 	else
 		src_fmt->quantization = sink_fmt->quantization;