vmh264: stream not smooth [1/1]
authormiaohong chen <miaohong.chen@amlogic.com>
Thu, 2 Jul 2020 06:00:57 +0000 (14:00 +0800)
committerMiaohong Chen <miaohong.chen@amlogic.com>
Mon, 6 Jul 2020 02:28:37 +0000 (19:28 -0700)
PD#SWPL-28869

Problem:
H264 stream frequently not smooth

Solution:
cause:The number of inverted frames is inaccurate,
which results in the frame not being output in time
and the code stream is not smooth.
If the grammar has reverse frame number reoder_num_frames,
reoder_num_frames is preferred.

Verify:
u212

Change-Id: I1b176ae825db01caed44a2a49de0789a2af8d562
Signed-off-by: miaohong chen <miaohong.chen@amlogic.com>
drivers/frame_provider/decoder/h264_multi/h264_dpb.c
drivers/frame_provider/decoder/h264_multi/h264_dpb.h
drivers/frame_provider/decoder/h264_multi/vmh264.c

index 29910d46a623a0c4a9dc72699b003b7aa9e59224..958c7fa0224268edbe537d67b218facf446adeb9 100644 (file)
@@ -2293,7 +2293,7 @@ int output_frames(struct h264_dpb_stru *p_H264_Dpb, unsigned char flush_flag)
                if (fast_output_flag)
                        ;
                else if (none_displayed_num <
-                       p_H264_Dpb->origin_max_reference)
+                       p_H264_Dpb->reorder_output)
                        return 0;
        }
 
index 493501735c36f3ae7972345bb8924b0a484836c2..e94404b900fdbea4f86b6288c3cf76629e87b8e6 100644 (file)
@@ -900,7 +900,7 @@ struct h264_dpb_stru {
        unsigned int last_dpb_status;
        unsigned char buf_alloc_fail;
        unsigned int dpb_error_flag;
-       unsigned int origin_max_reference;
+       unsigned int reorder_output;
        unsigned int first_insert_frame;
        int first_output_poc;
        int dpb_frame_count;
index 8e877eb3f294b6e9d64ff791da4deb1eb785384b..d92722b355287c0c3d6b48dd7c41a8b0fe40dea3 100644 (file)
@@ -4868,7 +4868,7 @@ static int vh264_set_params(struct vdec_h264_hw_s *hw,
                reg_val = param4;
                level_idc = reg_val & 0xff;
                max_reference_size = (reg_val >> 8) & 0xff;
-               hw->dpb.origin_max_reference = max_reference_size;
+               hw->dpb.reorder_output = max_reference_size;
                dpb_print(DECODE_ID(hw), 0,
                        "mb height/widht/total: %x/%x/%x level_idc %x max_ref_num %x\n",
                        mb_height, mb_width, mb_total,
@@ -4881,10 +4881,11 @@ static int vh264_set_params(struct vdec_h264_hw_s *hw,
                        max_reference_size, mb_width, mb_height);
 
                dpb_print(DECODE_ID(hw), 0,
-                       "restriction_flag=%d, max_dec_frame_buffering=%d, reorder_pic_num=%d\n",
+                       "restriction_flag=%d, max_dec_frame_buffering=%d, reorder_pic_num=%d num_reorder_frames %d\n",
                        hw->bitstream_restriction_flag,
                        hw->max_dec_frame_buffering,
-                       hw->dpb.reorder_pic_num);
+                       hw->dpb.reorder_pic_num,
+                       hw->num_reorder_frames);
 
                if ((hw->bitstream_restriction_flag) &&
                        (hw->max_dec_frame_buffering <
@@ -4895,6 +4896,12 @@ static int vh264_set_params(struct vdec_h264_hw_s *hw,
                        hw->dpb.reorder_pic_num);
                }
 
+               if (p_H264_Dpb->bitstream_restriction_flag &&
+                       p_H264_Dpb->num_reorder_frames <= p_H264_Dpb->max_dec_frame_buffering &&
+                       p_H264_Dpb->num_reorder_frames >= 0) {
+                       hw->dpb.reorder_output = hw->num_reorder_frames + 1;
+               }
+
                active_buffer_spec_num =
                        hw->dpb.reorder_pic_num
                        + used_reorder_dpb_size_margin;