diff --git a/test/mpi_enc_test.c b/test/mpi_enc_test.c index 94f648be..5bea68c9 100644 --- a/test/mpi_enc_test.c +++ b/test/mpi_enc_test.c @@ -247,10 +247,14 @@ MPP_RET test_ctx_init(MpiEncMultiCtxInfo *info) } break; } - if (MPP_FRAME_FMT_IS_FBC(p->fmt)) - p->header_size = MPP_ALIGN(MPP_ALIGN(p->width, 16) * MPP_ALIGN(p->height, 16) / 16, SZ_4K); - else + if (MPP_FRAME_FMT_IS_FBC(p->fmt)) { + if ((p->fmt & MPP_FRAME_FBC_MASK) == MPP_FRAME_FBC_AFBC_V1) + p->header_size = MPP_ALIGN(MPP_ALIGN(p->width, 16) * MPP_ALIGN(p->height, 16) / 16, SZ_4K); + else + p->header_size = MPP_ALIGN(p->width, 16) * MPP_ALIGN(p->height, 16) / 16; + } else { p->header_size = 0; + } return ret; } diff --git a/utils/utils.c b/utils/utils.c index 4f114406..0563c211 100644 --- a/utils/utils.c +++ b/utils/utils.c @@ -434,7 +434,12 @@ MPP_RET read_image(RK_U8 *buf, FILE *fp, RK_U32 width, RK_U32 height, if (MPP_FRAME_FMT_IS_FBC(fmt)) { RK_U32 align_w = MPP_ALIGN(width, 16); RK_U32 align_h = MPP_ALIGN(height, 16); - RK_U32 header_size = MPP_ALIGN(align_w * align_h / 16, SZ_4K); + RK_U32 header_size = 0; + + if ((fmt & MPP_FRAME_FBC_MASK) == MPP_FRAME_FBC_AFBC_V1) + header_size = MPP_ALIGN(align_w * align_h / 16, SZ_4K); + else + header_size = align_w * align_h / 16; /* read fbc header first */ read_size = fread(buf, 1, header_size, fp);