devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "mirela.rabulea@oss.nxp.com" <mirela.rabulea@oss.nxp.com>
To: Ming Qian <ming.qian@nxp.com>,
	mchehab@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de
Cc: hverkuil-cisco@xs4all.nl, kernel@pengutronix.de,
	festevam@gmail.com, linux-imx@nxp.com,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] media: imx-jpeg: Correct the pixel format of rgb
Date: Mon, 11 Apr 2022 12:17:10 +0300	[thread overview]
Message-ID: <506172e8-fe48-5fa5-415c-e8ba9835dff3@oss.nxp.com> (raw)
In-Reply-To: <20220406094733.8562-1-ming.qian@nxp.com>



On 06.04.2022 12:47, Ming Qian wrote:
> The hardware is capable of encoding/decoding RGB and ARGB formats
> in whatever order the color components are,
> but the resulting jpegs look good
> if we start with raw data in BGR/ABGR order,
> so we will further only support V4L2_PIX_FMT_BGR24 and V4L2_PIX_FMT_ABGR32.
> 
> Signed-off-by: Ming Qian <ming.qian@nxp.com>

Reviewed-by: Mirela Rabulea <mirela.rabulea@nxp.com>

> ---
>   .../media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h |  4 +--
>   .../media/platform/nxp/imx-jpeg/mxc-jpeg.c    | 34 +++++++++----------
>   .../media/platform/nxp/imx-jpeg/mxc-jpeg.h    |  2 +-
>   3 files changed, 20 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h
> index 356e40140987..e7e8954754b1 100644
> --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h
> +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h
> @@ -102,11 +102,11 @@ enum mxc_jpeg_image_format {
>   	MXC_JPEG_INVALID = -1,
>   	MXC_JPEG_YUV420 = 0x0, /* 2 Plannar, Y=1st plane UV=2nd plane */
>   	MXC_JPEG_YUV422 = 0x1, /* 1 Plannar, YUYV sequence */
> -	MXC_JPEG_RGB	= 0x2, /* RGBRGB packed format */
> +	MXC_JPEG_BGR	= 0x2, /* BGR packed format */
>   	MXC_JPEG_YUV444	= 0x3, /* 1 Plannar, YUVYUV sequence */
>   	MXC_JPEG_GRAY = 0x4, /* Y8 or Y12 or Single Component */
>   	MXC_JPEG_RESERVED = 0x5,
> -	MXC_JPEG_ARGB	= 0x6,
> +	MXC_JPEG_ABGR	= 0x6,
>   };
>   
>   #include "mxc-jpeg.h"
> diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
> index 3df51d866011..8bee179c5cec 100644
> --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
> +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
> @@ -8,7 +8,7 @@
>    * Baseline and extended sequential jpeg decoding is supported.
>    * Progressive jpeg decoding is not supported by the IP.
>    * Supports encode and decode of various formats:
> - *     YUV444, YUV422, YUV420, RGB, ARGB, Gray
> + *     YUV444, YUV422, YUV420, BGR, ABGR, Gray
>    * YUV420 is the only multi-planar format supported.
>    * Minimum resolution is 64 x 64, maximum 8192 x 8192.
>    * To achieve 8192 x 8192, modify in defconfig: CONFIG_CMA_SIZE_MBYTES=320
> @@ -73,8 +73,8 @@ static const struct mxc_jpeg_fmt mxc_formats[] = {
>   		.flags		= MXC_JPEG_FMT_TYPE_ENC,
>   	},
>   	{
> -		.name		= "RGB", /*RGBRGB packed format*/
> -		.fourcc		= V4L2_PIX_FMT_RGB24,
> +		.name		= "BGR", /*BGR packed format*/
> +		.fourcc		= V4L2_PIX_FMT_BGR24,
>   		.subsampling	= V4L2_JPEG_CHROMA_SUBSAMPLING_444,
>   		.nc		= 3,
>   		.depth		= 24,
> @@ -85,8 +85,8 @@ static const struct mxc_jpeg_fmt mxc_formats[] = {
>   		.precision	= 8,
>   	},
>   	{
> -		.name		= "ARGB", /* ARGBARGB packed format */
> -		.fourcc		= V4L2_PIX_FMT_ARGB32,
> +		.name		= "ABGR", /* ABGR packed format */
> +		.fourcc		= V4L2_PIX_FMT_ABGR32,
>   		.subsampling	= V4L2_JPEG_CHROMA_SUBSAMPLING_444,
>   		.nc		= 4,
>   		.depth		= 32,
> @@ -420,10 +420,10 @@ static enum mxc_jpeg_image_format mxc_jpeg_fourcc_to_imgfmt(u32 fourcc)
>   		return MXC_JPEG_YUV420;
>   	case V4L2_PIX_FMT_YUV24:
>   		return MXC_JPEG_YUV444;
> -	case V4L2_PIX_FMT_RGB24:
> -		return MXC_JPEG_RGB;
> -	case V4L2_PIX_FMT_ARGB32:
> -		return MXC_JPEG_ARGB;
> +	case V4L2_PIX_FMT_BGR24:
> +		return MXC_JPEG_BGR;
> +	case V4L2_PIX_FMT_ABGR32:
> +		return MXC_JPEG_ABGR;
>   	default:
>   		return MXC_JPEG_INVALID;
>   	}
> @@ -697,11 +697,11 @@ static int mxc_jpeg_fixup_sof(struct mxc_jpeg_sof *sof,
>   		sof->comp[0].h = 0x2;
>   		break;
>   	case V4L2_PIX_FMT_YUV24:
> -	case V4L2_PIX_FMT_RGB24:
> +	case V4L2_PIX_FMT_BGR24:
>   	default:
>   		sof->components_no = 3;
>   		break;
> -	case V4L2_PIX_FMT_ARGB32:
> +	case V4L2_PIX_FMT_ABGR32:
>   		sof->components_no = 4;
>   		break;
>   	case V4L2_PIX_FMT_GREY:
> @@ -729,11 +729,11 @@ static int mxc_jpeg_fixup_sos(struct mxc_jpeg_sos *sos,
>   		sos->components_no = 3;
>   		break;
>   	case V4L2_PIX_FMT_YUV24:
> -	case V4L2_PIX_FMT_RGB24:
> +	case V4L2_PIX_FMT_BGR24:
>   	default:
>   		sos->components_no = 3;
>   		break;
> -	case V4L2_PIX_FMT_ARGB32:
> +	case V4L2_PIX_FMT_ABGR32:
>   		sos->components_no = 4;
>   		break;
>   	case V4L2_PIX_FMT_GREY:
> @@ -764,8 +764,8 @@ static unsigned int mxc_jpeg_setup_cfg_stream(void *cfg_stream_vaddr,
>   	memcpy(cfg + offset, jpeg_soi, ARRAY_SIZE(jpeg_soi));
>   	offset += ARRAY_SIZE(jpeg_soi);
>   
> -	if (fourcc == V4L2_PIX_FMT_RGB24 ||
> -	    fourcc == V4L2_PIX_FMT_ARGB32) {
> +	if (fourcc == V4L2_PIX_FMT_BGR24 ||
> +	    fourcc == V4L2_PIX_FMT_ABGR32) {
>   		memcpy(cfg + offset, jpeg_app14, sizeof(jpeg_app14));
>   		offset += sizeof(jpeg_app14);
>   	} else {
> @@ -1277,9 +1277,9 @@ static u32 mxc_jpeg_get_image_format(struct device *dev,
>   	 * encoded with 3 components have RGB colorspace, see Recommendation
>   	 * ITU-T T.872 chapter 6.5.3 APP14 marker segment for colour encoding
>   	 */
> -	if (fourcc == V4L2_PIX_FMT_YUV24 || fourcc == V4L2_PIX_FMT_RGB24) {
> +	if (fourcc == V4L2_PIX_FMT_YUV24 || fourcc == V4L2_PIX_FMT_BGR24) {
>   		if (header->app14_tf == V4L2_JPEG_APP14_TF_CMYK_RGB)
> -			fourcc = V4L2_PIX_FMT_RGB24;
> +			fourcc = V4L2_PIX_FMT_BGR24;
>   		else
>   			fourcc = V4L2_PIX_FMT_YUV24;
>   	}
> diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.h b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.h
> index 9c9da32b2125..6e8c5aa7d956 100644
> --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.h
> +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.h
> @@ -17,7 +17,7 @@
>   #define MXC_JPEG_FMT_TYPE_RAW		1
>   #define MXC_JPEG_DEFAULT_WIDTH		1280
>   #define MXC_JPEG_DEFAULT_HEIGHT		720
> -#define MXC_JPEG_DEFAULT_PFMT		V4L2_PIX_FMT_RGB24
> +#define MXC_JPEG_DEFAULT_PFMT		V4L2_PIX_FMT_BGR24
>   #define MXC_JPEG_MIN_WIDTH		64
>   #define MXC_JPEG_MIN_HEIGHT		64
>   #define MXC_JPEG_MAX_WIDTH		0x2000

      reply	other threads:[~2022-04-11  9:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-06  9:47 [PATCH] media: imx-jpeg: Correct the pixel format of rgb Ming Qian
2022-04-11  9:17 ` mirela.rabulea [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=506172e8-fe48-5fa5-415c-e8ba9835dff3@oss.nxp.com \
    --to=mirela.rabulea@oss.nxp.com \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=ming.qian@nxp.com \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).