From a56d65e0a508ebedc4d38de113b4f3df37d30f1e Mon Sep 17 00:00:00 2001 From: Peng Yixin Date: Sat, 28 Dec 2019 17:41:52 +0800 Subject: [PATCH] media_module: Optimize the h264 frame drop problem [1/1] PD#OTT-7782 Problem: Very few decoded macro block error can also cause the frame drop. Solution: If the decoded macro block error rate less than 10% (it can adjust the threshold based on field conditions later), the frame is considered correct, thus reducing the frame drop and ensuring that there is only a small mosaic. Verify: U212 Change-Id: I62d9d4ed5c4929689f2102979081a223765b3a18 Signed-off-by: Peng Yixin --- .../decoder/h264_multi/vmh264.c | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/frame_provider/decoder/h264_multi/vmh264.c b/drivers/frame_provider/decoder/h264_multi/vmh264.c index 4eb7ca2..dbd0127 100644 --- a/drivers/frame_provider/decoder/h264_multi/vmh264.c +++ b/drivers/frame_provider/decoder/h264_multi/vmh264.c @@ -267,6 +267,9 @@ static unsigned int i_only_flag; bit[12] i_only when error happen bit[13] 0: mark error according to last pic, 1: ignore mark error bit[14] 0: result done when timeout from ucode. 1: reset bufmgr when timeout. + bit[15] 1: dpb_frame_count If the dpb_frame_count difference is large, it moves out of the DPB buffer. + bit[16] 1: check slice header number. + bit[17] 1: If the decoded Mb count is insufficient but greater than the threshold, it is considered the correct frame. bit[18] 1: time out status, store pic to dpb buffer. */ static unsigned int error_proc_policy = 0x7Cfb6; /*0x1f14*/ @@ -308,6 +311,8 @@ static unsigned int frmbase_cont_bitlevel = 0x40; static unsigned int frmbase_cont_bitlevel2 = 0x1; +static unsigned int mb_count_threshold = 10; /*percentage*/ + #define MH264_USERDATA_ENABLE /* DOUBLE_WRITE_MODE is enabled only when NV21 8 bit output is needed */ @@ -5441,16 +5446,22 @@ static void check_decoded_pic_error(struct vdec_h264_hw_s *hw) return; if (get_cur_slice_picture_struct(p_H264_Dpb) != FRAME) mb_total /= 2; - if (error_proc_policy & 0x100) { - if (decode_mb_count < mb_total) - p->data_flag |= ERROR_FLAG; - } if ((error_proc_policy & 0x200) && READ_VREG(ERROR_STATUS_REG) != 0) { p->data_flag |= ERROR_FLAG; } + if (error_proc_policy & 0x100) { + if (decode_mb_count < mb_total) { + p->data_flag |= ERROR_FLAG; + if ((error_proc_policy & 0x20000) && + decode_mb_count >= mb_total * (100 - mb_count_threshold) / 100) { + p->data_flag &= ~ERROR_FLAG; + } + } + } + if (p->data_flag & ERROR_FLAG) { dpb_print(DECODE_ID(hw), PRINT_FLAG_ERRORFLAG_DBG, "%s: decode error, seq_info2 0x%x, mby_mbx 0x%x, mb_total %d decoded mb_count %d ERROR_STATUS_REG 0x%x\n", @@ -9528,6 +9539,9 @@ module_param(without_display_mode, uint, 0664); MODULE_PARM_DESC(without_display_mode, "\n without_display_mode\n"); +module_param(mb_count_threshold, uint, 0664); +MODULE_PARM_DESC(mb_count_threshold, "\n mb_count_threshold\n"); + module_init(ammvdec_h264_driver_init_module); module_exit(ammvdec_h264_driver_remove_module); -- 2.20.1