[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 <johnson.ding@rock-chips.com>
This commit is contained in:
Johnson Ding
2019-07-02 14:07:43 +08:00
committed by Herman Chen
parent 671b3e0f00
commit 031ec1f546
2 changed files with 2 additions and 2 deletions

View File

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

View File

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