summaryrefslogtreecommitdiff
path: root/drivers/media/platform/mtk-jpeg
diff options
context:
space:
mode:
authorXia Jiang <xia.jiang@mediatek.com>2020-08-14 10:11:55 +0300
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2020-08-28 16:35:04 +0300
commitbd627ff5d58507358759e76f1e8148ef3fdcda02 (patch)
tree0d29fe5481d96b8dc33d5f78ef84ca749ab5f5f4 /drivers/media/platform/mtk-jpeg
parent0b90056a39ed23284f27672497333e5a9d957d62 (diff)
downloadlinux-bd627ff5d58507358759e76f1e8148ef3fdcda02.tar.xz
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@chromium.org> Signed-off-by: Xia Jiang <xia.jiang@mediatek.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media/platform/mtk-jpeg')
-rw-r--r--drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c12
1 files 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 f2c6a472fd63..144dc587a5b2 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 @@ dec_end:
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)