From 031ec1f54637a7fea9cd84fbafb4b14aa6332893 Mon Sep 17 00:00:00 2001 From: Johnson Ding Date: Tue, 2 Jul 2019 14:07:43 +0800 Subject: [PATCH] [jpegd]: Fix UV data is cut out on odd height case A picture vertical stride should align with 16. But in jpeg decoding picture is dividing into 8x8 blocks. So hardware decoder is designed to keep the original data rather than cut out redundant data. If more than 7 is need to fill into the height of a picture when aligning the height with 16, there will be an extra line of 8x8 blocks which do not contain any information of the original picture. In this case jpeg_height8_flag should be enabled to tell hardware to cut out them. In other case, don't. Otherewise there will be a 8 pixels-height green bar in the bottom of the picture after decoding. Change-Id: Ic042eb0b6deccb6fc3727d7a288b4cd4efd8320d Signed-off-by: Johnson Ding --- mpp/hal/vpu/jpegd/hal_jpegd_vdpu1.c | 2 +- mpp/hal/vpu/jpegd/hal_jpegd_vdpu2.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mpp/hal/vpu/jpegd/hal_jpegd_vdpu1.c b/mpp/hal/vpu/jpegd/hal_jpegd_vdpu1.c index 978e861c..33655195 100644 --- a/mpp/hal/vpu/jpegd/hal_jpegd_vdpu1.c +++ b/mpp/hal/vpu/jpegd/hal_jpegd_vdpu1.c @@ -692,7 +692,7 @@ static MPP_RET jpegd_gen_regs(JpegdHalCtx *ctx, JpegdSyntax *syntax) reg->reg5.sw_sync_marker_e = 1; /* tell hardware that height is 8-pixel aligned, but not 16-pixel aligned */ - if ((s->height % 16) && + if ((s->height % 16) && ((s->height % 16) <= 8) && (s->yuv_mode == JPEGDEC_YUV422 || s->yuv_mode == JPEGDEC_YUV444 || s->yuv_mode == JPEGDEC_YUV411)) { diff --git a/mpp/hal/vpu/jpegd/hal_jpegd_vdpu2.c b/mpp/hal/vpu/jpegd/hal_jpegd_vdpu2.c index 0607dfde..24895f22 100644 --- a/mpp/hal/vpu/jpegd/hal_jpegd_vdpu2.c +++ b/mpp/hal/vpu/jpegd/hal_jpegd_vdpu2.c @@ -654,7 +654,7 @@ MPP_RET jpegd_gen_regs(JpegdHalCtx *ctx, JpegdSyntax *syntax) /* tell hardware that height is 8-pixel aligned, * but not 16-pixel aligned */ - if ((s->height % 16) && + if ((s->height % 16) && ((s->height % 16) <= 8) && (s->yuv_mode == JPEGDEC_YUV422 || s->yuv_mode == JPEGDEC_YUV444 || s->yuv_mode == JPEGDEC_YUV411)) {