[av1d_api]: fix usr_set_fmt flag assignment err

Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: Ia9e1a7025145acda57b0c8ba2ea8eedcb97945cc
This commit is contained in:
Yandong Lin
2023-03-07 16:05:14 +08:00
parent 2c1cbfbb50
commit 919dfeefcc
3 changed files with 6 additions and 4 deletions

View File

@@ -49,6 +49,7 @@ MPP_RET av1d_init(void *ctx, ParserCfg *init)
}
av1_ctx->pix_fmt = MPP_FMT_BUTT;
av1_ctx->usr_set_fmt = MPP_FMT_BUTT;
if ((ret = av1d_parser_init(av1_ctx, init)) != MPP_OK)
goto _err_exit;
@@ -252,12 +253,12 @@ MPP_RET av1d_control(void *ctx, MpiCmd cmd, void *param)
Av1CodecContext *av1_ctx = (Av1CodecContext *)ctx;
MPP_RET ret = MPP_OK;
if (!ctx || !param)
if (!ctx)
return MPP_ERR_VALUE;
switch (cmd) {
case MPP_DEC_SET_OUTPUT_FORMAT : {
av1_ctx->usr_set_fmt = *(MppFrameFormat*)param;
av1_ctx->usr_set_fmt = param ? *((MppFrameFormat *)param) : MPP_FMT_YUV420SP;
} break;
default:
break;

View File

@@ -124,7 +124,7 @@ typedef struct Av1CodecContext_t {
RK_U32 stream_offset;
RK_S32 eos;
RK_U32 usr_set_fmt;
MppFrameFormat usr_set_fmt;
} Av1CodecContext;
#endif /*__AV1D_CODEC_H__*/

View File

@@ -120,7 +120,8 @@ static MPP_RET get_pixel_format(Av1CodecContext *ctx)
pix_fmt = MPP_FMT_YUV420SP;
else if (bit_depth == 10) {
pix_fmt = MPP_FMT_YUV420SP_10BIT;
if (ctx->usr_set_fmt && s->cfg->base.out_fmt == MPP_FMT_YUV420SP)
if ((ctx->usr_set_fmt & MPP_FRAME_FMT_MASK) == MPP_FMT_YUV420SP &&
(s->cfg->base.out_fmt & MPP_FRAME_FMT_MASK) == MPP_FMT_YUV420SP)
pix_fmt = MPP_FMT_YUV420SP;
} else {
mpp_err_f("no support MPP_FMT_YUV420SP bit depth > 8\n");