author | Peng yixin <yixin.peng@amlogic.com> | 2020-04-30 02:24:29 (GMT) |
---|---|---|
committer | Hui Zhang <hui.zhang@amlogic.com> | 2020-05-08 13:21:41 (GMT) |
commit | 0df6cb97608dab12c92a631cabeca6326629421a (patch) | |
tree | 84914363221e11515c444b83c1e8c2a298bba956 | |
parent | c28cab8c28a75cc4988e7aeea01426c26368fbb8 (diff) | |
download | media_modules-0df6cb97608dab12c92a631cabeca6326629421a.zip media_modules-0df6cb97608dab12c92a631cabeca6326629421a.tar.gz media_modules-0df6cb97608dab12c92a631cabeca6326629421a.tar.bz2 |
media_module: h265 fixed display incorrect pictures [1/1]
PD#SWPL-25170
Problem:
Decoder output one more frame between the
first frame and the second frame.
Solution:
If video file only I frame, the first
frame will output twice, and when the
second frame display, the decoder is
already decoding another frame use
this buffer, resulting in show an
abnormal frame.
Verify:
AB311-B
Change-Id: Ieb9fe19ad8c5eca789e56c72c8dda549dfb1d5b6
Signed-off-by: Peng yixin <yixin.peng@amlogic.com>
-rw-r--r-- | drivers/frame_provider/decoder/h265/vh265.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/drivers/frame_provider/decoder/h265/vh265.c b/drivers/frame_provider/decoder/h265/vh265.c index 6a549db..83e4ffe 100644 --- a/drivers/frame_provider/decoder/h265/vh265.c +++ b/drivers/frame_provider/decoder/h265/vh265.c @@ -3904,7 +3904,7 @@ static struct PIC_s *output_pic(struct hevc_state_s *hevc, if (pic_display && hevc->sps_num_reorder_pics_0 && (hevc->vf_pre_count == 1) && (hevc->first_pic_flag == 1)) { pic_display = NULL; - hevc->first_pic_flag = 0; + hevc->first_pic_flag = 2; } return pic_display; } @@ -5608,6 +5608,7 @@ static void recycle_mmu_bufs(struct hevc_state_s *hevc) static struct PIC_s *get_new_pic(struct hevc_state_s *hevc, union param_u *rpm_param) { + struct vdec_s *vdec = hw_to_vdec(hevc); struct PIC_s *new_pic = NULL; struct PIC_s *pic; int i; @@ -5693,7 +5694,9 @@ static struct PIC_s *get_new_pic(struct hevc_state_s *hevc, new_pic->dis_mark = 0; /* new_pic->output_ready = 0; */ new_pic->num_reorder_pic = rpm_param->p.sps_num_reorder_pics_0; - new_pic->ip_mode = (!new_pic->num_reorder_pic && !disable_ip_mode) ? true : false; + new_pic->ip_mode = (!new_pic->num_reorder_pic && + !(vdec->slave || vdec->master) && + !disable_ip_mode) ? true : false; new_pic->losless_comp_body_size = hevc->losless_comp_body_size; new_pic->POC = hevc->curr_POC; new_pic->pic_struct = hevc->curr_pic_struct; @@ -5739,6 +5742,7 @@ static struct PIC_s *get_new_pic(struct hevc_state_s *hevc, static struct PIC_s *v4l_get_new_pic(struct hevc_state_s *hevc, union param_u *rpm_param) { + struct vdec_s *vdec = hw_to_vdec(hevc); int ret; struct aml_vcodec_ctx * v4l = hevc->v4l2_ctx; struct v4l_buff_pool *pool = &v4l->cap_pool; @@ -5817,7 +5821,9 @@ static struct PIC_s *v4l_get_new_pic(struct hevc_state_s *hevc, new_pic->dis_mark = 0; /* new_pic->output_ready = 0; */ new_pic->num_reorder_pic = rpm_param->p.sps_num_reorder_pics_0; - new_pic->ip_mode = (!new_pic->num_reorder_pic && !disable_ip_mode) ? true : false; + new_pic->ip_mode = (!new_pic->num_reorder_pic && + !(vdec->slave || vdec->master) && + !disable_ip_mode) ? true : false; new_pic->losless_comp_body_size = hevc->losless_comp_body_size; new_pic->POC = hevc->curr_POC; new_pic->pic_struct = hevc->curr_pic_struct; @@ -6263,7 +6269,14 @@ static inline void hevc_pre_pic(struct hevc_state_s *hevc, } if (get_dbg_flag(hevc) & H265_DEBUG_BUFMGR) dump_pic_list(hevc); - pic = get_pic_by_POC(hevc, decoded_poc); + if (hevc->vf_pre_count == 1 && + hevc->first_pic_flag == 1) { + hevc->first_pic_flag = 2; + pic = NULL; + } + else + pic = get_pic_by_POC(hevc, decoded_poc); + flush_output(hevc, pic); } @@ -6829,7 +6842,9 @@ static int hevc_slice_segment_header_process(struct hevc_state_s *hevc, if (hevc->wait_buf == 0) { hevc->sps_num_reorder_pics_0 = rpm_param->p.sps_num_reorder_pics_0; - hevc->ip_mode = (!hevc->sps_num_reorder_pics_0 && !disable_ip_mode) ? true : false; + hevc->ip_mode = (!hevc->sps_num_reorder_pics_0 && + !(vdec->slave || vdec->master) && + !disable_ip_mode) ? true : false; hevc->m_temporalId = rpm_param->p.m_temporalId; hevc->m_nalUnitType = rpm_param->p.m_nalUnitType; hevc->interlace_flag = @@ -10535,7 +10550,9 @@ force_output: } else { hevc->sps_num_reorder_pics_0 = hevc->param.p.sps_num_reorder_pics_0; - hevc->ip_mode = (!hevc->sps_num_reorder_pics_0 && !disable_ip_mode) ? true : false; + hevc->ip_mode = (!hevc->sps_num_reorder_pics_0 && + !(vdec->slave || vdec->master) && + !disable_ip_mode) ? true : false; hevc->pic_list_init_flag = 1; if ((!IS_4K_SIZE(hevc->pic_w, hevc->pic_h)) && ((hevc->param.p.profile_etc & 0xc) == 0x4) |