Re: [PATCH v5 10/10] media: imx-jpeg: Use v4l2 jpeg helpers in mxc-jpeg

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

 



On Thu, 2020-11-12 at 05:05 +0200, Mirela Rabulea (OSS) wrote:
> From: Mirela Rabulea <mirela.rabulea@xxxxxxx>
> 
> Use v4l2_jpeg_parse_header in mxc_jpeg_parse, remove the old
> parsing way, which was duplicated in other jpeg drivers.
> 
> Signed-off-by: Mirela Rabulea <mirela.rabulea@xxxxxxx>
> ---
> Changes in v5:
> This was patch 11 in previous version
> Change triggered by patch 7 (app14 data change struct -> int)
> 
>  drivers/media/platform/imx-jpeg/Kconfig    |   1 +
>  drivers/media/platform/imx-jpeg/mxc-jpeg.c | 267 ++++++---------------
>  drivers/media/platform/imx-jpeg/mxc-jpeg.h |  26 +-
>  3 files changed, 80 insertions(+), 214 deletions(-)
> 
> diff --git a/drivers/media/platform/imx-jpeg/Kconfig b/drivers/media/platform/imx-jpeg/Kconfig
> index 7cc89e5eff90..d875f7c88cda 100644
> --- a/drivers/media/platform/imx-jpeg/Kconfig
> +++ b/drivers/media/platform/imx-jpeg/Kconfig
> @@ -4,6 +4,7 @@ config VIDEO_IMX8_JPEG
>  	depends on VIDEO_DEV && VIDEO_V4L2
>  	select VIDEOBUF2_DMA_CONTIG
>  	select V4L2_MEM2MEM_DEV
> +	select V4L2_JPEG_HELPER
>  	default m
>  	help
>  	  This is a video4linux2 driver for the i.MX8 QXP/QM integrated
> diff --git a/drivers/media/platform/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/imx-jpeg/mxc-jpeg.c
> index 8f297803f2c3..d3b7581ce46e 100644
> --- a/drivers/media/platform/imx-jpeg/mxc-jpeg.c
> +++ b/drivers/media/platform/imx-jpeg/mxc-jpeg.c
[...]
> @@ -1448,12 +1317,11 @@ static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx,
>  	 * encoded with 3 components have RGB colorspace, see Recommendation
>  	 * ITU-T T.872 chapter 6.5.3 APP14 marker segment for colour encoding
>  	 */
> -	if (img_fmt == MXC_JPEG_YUV444 && app14 && app14_transform == 0)
> -		img_fmt = MXC_JPEG_RGB;
> -
> -	if (mxc_jpeg_imgfmt_to_fourcc(img_fmt, &fourcc)) {
> -		dev_err(dev, "Fourcc not found for %d", img_fmt);
> -		return -EINVAL;
> +	if (fourcc == V4L2_PIX_FMT_YUV24 || fourcc == V4L2_PIX_FMT_RGB24) {
> +		if (header.app14_tf == 0)

This is what I meant in patch 7, I think it would be more clear to have
an enum value that says "RGB color coding" than to rely on the reader to
know what the value 0 means.

> +			fourcc = V4L2_PIX_FMT_RGB24;
> +		else
> +			fourcc = V4L2_PIX_FMT_YUV24;
>  	}
>  
>  	/*
> 

Otherwise this patch looks fine to me.

regards
Philipp



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux