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>
This commit is contained in:
Xia Jiang 2020-08-14 09:11:55 +02:00 committed by Mauro Carvalho Chehab
parent 0b90056a39
commit bd627ff5d5
1 changed files with 2 additions and 10 deletions

View File

@ -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)