From 919dfeefcc3e64ddf44c45e89a2a7ee2df3a58fc Mon Sep 17 00:00:00 2001 From: Yandong Lin Date: Tue, 7 Mar 2023 16:05:14 +0800 Subject: [PATCH] [av1d_api]: fix usr_set_fmt flag assignment err Signed-off-by: Yandong Lin Change-Id: Ia9e1a7025145acda57b0c8ba2ea8eedcb97945cc --- mpp/codec/dec/av1/av1d_api.c | 5 +++-- mpp/codec/dec/av1/av1d_codec.h | 2 +- mpp/codec/dec/av1/av1d_parser.c | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/mpp/codec/dec/av1/av1d_api.c b/mpp/codec/dec/av1/av1d_api.c index fcdb5e9c..9797fd89 100644 --- a/mpp/codec/dec/av1/av1d_api.c +++ b/mpp/codec/dec/av1/av1d_api.c @@ -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; diff --git a/mpp/codec/dec/av1/av1d_codec.h b/mpp/codec/dec/av1/av1d_codec.h index 3dcc6df0..eb7466cb 100644 --- a/mpp/codec/dec/av1/av1d_codec.h +++ b/mpp/codec/dec/av1/av1d_codec.h @@ -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__*/ diff --git a/mpp/codec/dec/av1/av1d_parser.c b/mpp/codec/dec/av1/av1d_parser.c index 7169bb06..f90630f0 100644 --- a/mpp/codec/dec/av1/av1d_parser.c +++ b/mpp/codec/dec/av1/av1d_parser.c @@ -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");