From 0250dab00c58fcb790d79de4bef647520e54b2a9 Mon Sep 17 00:00:00 2001 From: Johnson Ding Date: Fri, 19 Mar 2021 14:47:07 +0800 Subject: [PATCH] [h264d]: fix field combination error Change-Id: Iad69f04299911d3b593d6719eff80e8c6436e5d8 Signed-off-by: Johnson Ding --- mpp/codec/dec/h264/h264d_dpb.c | 6 +++--- mpp/codec/dec/h264/h264d_dpb.h | 2 +- mpp/codec/dec/h264/h264d_init.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mpp/codec/dec/h264/h264d_dpb.c b/mpp/codec/dec/h264/h264d_dpb.c index 2a1678a8..49400163 100644 --- a/mpp/codec/dec/h264/h264d_dpb.c +++ b/mpp/codec/dec/h264/h264d_dpb.c @@ -1313,7 +1313,7 @@ MPP_RET store_picture_in_dpb(H264_DpbBuf_t *p_Dpb, H264_StorePic_t *p) } } //!< if necessary, combine top and botteom to frame - if (get_filed_dpb_combine_flag(p_Dpb->last_picture, p)) { + if (get_field_dpb_combine_flag(p_Dpb->last_picture, p)) { if (p_Dpb->last_picture->is_directout) { FUN_CHECK(ret = direct_output(p_Vid, p_Dpb, p)); //!< output frame } else { @@ -1677,13 +1677,13 @@ __FAILED: *********************************************************************** */ //extern "C" -RK_U32 get_filed_dpb_combine_flag(H264_FrameStore_t *p_last, H264_StorePic_t *p) +RK_U32 get_field_dpb_combine_flag(H264_FrameStore_t *p_last, H264_StorePic_t *p) { RK_U32 combine_flag = 0; if ((p->structure == TOP_FIELD) || (p->structure == BOTTOM_FIELD)) { // check for frame store with same pic_number - if (p_last) { + if (p_last && (p_last->structure == TOP_FIELD || p_last->structure == BOTTOM_FIELD)) { if ((RK_S32)p_last->frame_num == p->pic_num) { if (((p->structure == TOP_FIELD) && (p_last->is_used == 2)) || ((p->structure == BOTTOM_FIELD) && (p_last->is_used == 1))) { diff --git a/mpp/codec/dec/h264/h264d_dpb.h b/mpp/codec/dec/h264/h264d_dpb.h index f8284d89..864ef9a3 100644 --- a/mpp/codec/dec/h264/h264d_dpb.h +++ b/mpp/codec/dec/h264/h264d_dpb.h @@ -44,7 +44,7 @@ MPP_RET output_dpb (H264_DecCtx_t *p_Dec, H264_DpbBuf_t *p_Dpb); void free_dpb (H264_DpbBuf_t *p_Dpb); MPP_RET exit_picture(H264dVideoCtx_t *p_Vid, H264_StorePic_t **dec_pic); -RK_U32 get_filed_dpb_combine_flag(H264_FrameStore_t *p_last, H264_StorePic_t *p); +RK_U32 get_field_dpb_combine_flag(H264_FrameStore_t *p_last, H264_StorePic_t *p); H264_StorePic_t *alloc_storable_picture(H264dVideoCtx_t *p_Vid, RK_S32 structure); #ifdef __cplusplus diff --git a/mpp/codec/dec/h264/h264d_init.c b/mpp/codec/dec/h264/h264d_init.c index 3af64e7e..bb46b9f0 100755 --- a/mpp/codec/dec/h264/h264d_init.c +++ b/mpp/codec/dec/h264/h264d_init.c @@ -655,7 +655,7 @@ static MPP_RET alloc_decpic(H264_SLICE_t *currSlice) dec_pic->height = p_Vid->height; dec_pic->width_after_crop = p_Vid->width_after_crop; dec_pic->height_after_crop = p_Vid->height_after_crop; - dec_pic->combine_flag = get_filed_dpb_combine_flag(p_Dpb->last_picture, dec_pic); + dec_pic->combine_flag = get_field_dpb_combine_flag(p_Dpb->last_picture, dec_pic); /* malloc dpb_memory */ FUN_CHECK(ret = dpb_mark_malloc(p_Vid, dec_pic)); FUN_CHECK(ret = check_dpb_discontinuous(p_Vid->last_pic, dec_pic, currSlice));