[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200814071202.25067-24-xia.jiang@mediatek.com>
Date: Fri, 14 Aug 2020 15:11:55 +0800
From: Xia Jiang <xia.jiang@...iatek.com>
To: Hans Verkuil <hverkuil-cisco@...all.nl>,
Mauro Carvalho Chehab <mchehab+samsung@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Matthias Brugger <matthias.bgg@...il.com>,
Rick Chang <rick.chang@...iatek.com>
CC: <linux-media@...r.kernel.org>, <devicetree@...r.kernel.org>,
<linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-mediatek@...ts.infradead.org>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Tomasz Figa <tfiga@...omium.org>,
<srv_heupstream@...iatek.com>, <senozhatsky@...omium.org>,
<mojahsu@...omium.org>, <drinkcat@...omium.org>,
<maoguang.meng@...iatek.com>, Xia Jiang <xia.jiang@...iatek.com>
Subject: [PATCH v12 22/29] media: platform: Refactor mtk_jpeg_set_default_params()
Call mtk_jpeg_try_fmt_mplane() to replace the original computation of
sizeimage and bytesperline, because that mtk_jpeg_try_fmt_mplane()
already did it.
Reviewed-by: Tomasz Figa <tfiga@...omium.org>
Signed-off-by: Xia Jiang <xia.jiang@...iatek.com>
---
v12: no changes
---
drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
index 0376bd3bdbbb..7881e9c93df7 100644
--- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
+++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
@@ -844,7 +844,6 @@ static irqreturn_t mtk_jpeg_dec_irq(int irq, void *priv)
static void mtk_jpeg_set_default_params(struct mtk_jpeg_ctx *ctx)
{
struct mtk_jpeg_q_data *q = &ctx->out_q;
- int i;
q->pix_mp.colorspace = V4L2_COLORSPACE_SRGB;
q->pix_mp.ycbcr_enc = V4L2_YCBCR_ENC_601;
@@ -856,8 +855,7 @@ static void mtk_jpeg_set_default_params(struct mtk_jpeg_ctx *ctx)
MTK_JPEG_FMT_FLAG_DEC_OUTPUT);
q->pix_mp.width = MTK_JPEG_MIN_WIDTH;
q->pix_mp.height = MTK_JPEG_MIN_HEIGHT;
- q->pix_mp.plane_fmt[0].bytesperline = 0;
- q->pix_mp.plane_fmt[0].sizeimage = MTK_JPEG_DEFAULT_SIZEIMAGE;
+ mtk_jpeg_try_fmt_mplane(&q->pix_mp, q->fmt);
q = &ctx->cap_q;
q->fmt = mtk_jpeg_find_format(mtk_jpeg_formats, MTK_JPEG_NUM_FORMATS,
@@ -870,13 +868,7 @@ static void mtk_jpeg_set_default_params(struct mtk_jpeg_ctx *ctx)
q->pix_mp.width = MTK_JPEG_MIN_WIDTH;
q->pix_mp.height = MTK_JPEG_MIN_HEIGHT;
- for (i = 0; i < q->fmt->colplanes; i++) {
- u32 stride = q->pix_mp.width * q->fmt->h_sample[i] / 4;
- u32 h = q->pix_mp.height * q->fmt->v_sample[i] / 4;
-
- q->pix_mp.plane_fmt[i].bytesperline = stride;
- q->pix_mp.plane_fmt[i].sizeimage = stride * h;
- }
+ mtk_jpeg_try_fmt_mplane(&q->pix_mp, q->fmt);
}
static int mtk_jpeg_open(struct file *file)
--
2.18.0
Powered by blists - more mailing lists