vmh264: stream mosaic [1/1]
authormiaohong chen <miaohong.chen@amlogic.com>
Tue, 14 Jul 2020 13:28:23 +0000 (21:28 +0800)
committerMiaohong Chen <miaohong.chen@amlogic.com>
Tue, 21 Jul 2020 03:20:07 +0000 (20:20 -0700)
PD#SWPL-29711

Problem:
H264 stream mosaic

Solution:
The first gop of the code stream is a single slice,
and the latter part is a multi-slice.
Because the multi-slice detection mechanism is added before,
the single slice decision is triggered by mistake, resulting in mosaic.
Improve multi-slice detection mechanism.

Verify:
u212

Change-Id: I1e3491a1e0441eb50dcec8666c5ebffcd01ba1f7
Signed-off-by: miaohong chen <miaohong.chen@amlogic.com>
(cherry picked from commit 9a5cbbebe1cc6f2b7dff38121ba5a2c9397f6fbf)

drivers/frame_provider/decoder/h264_multi/vmh264.c

index 87b5bdead9f1c6b6bd2c0eb61cb7907a05ed7346..00fe87af343cfac68511bac492675bbceb8f4687 100644 (file)
@@ -5953,6 +5953,9 @@ static irqreturn_t vh264_isr_thread_fn(struct vdec_s *vdec, int irq)
                union param dpb_param_bak;
                /*unsigned char is_idr;*/
                unsigned short *p = (unsigned short *)hw->lmem_addr;
+               unsigned mb_width = hw->seq_info2 & 0xff;
+               unsigned short first_mb_in_slice;
+               unsigned int decode_mb_count, mby_mbx;
                reset_process_time(hw);
 
 #ifdef DETECT_WRONG_MULTI_SLICE
@@ -5972,7 +5975,21 @@ static irqreturn_t vh264_isr_thread_fn(struct vdec_s *vdec, int irq)
                        hw->picture_slice_count,
                        hw->cur_picture_slice_count,
                        hw->multi_slice_pic_flag);
-                       if (hw->cur_picture_slice_count > hw->last_picture_slice_count)
+
+                       first_mb_in_slice = p[FIRST_MB_IN_SLICE + 3];
+                       mby_mbx = READ_VREG(MBY_MBX);
+                       decode_mb_count = ((mby_mbx & 0xff) * mb_width +
+                                       (((mby_mbx >> 8) & 0xff) + 1));
+
+                       if (first_mb_in_slice == decode_mb_count &&
+                               first_mb_in_slice != 0) {
+                               dpb_print(DECODE_ID(hw), PRINT_FLAG_VDEC_STATUS,
+                               "%s first_mb_in_slice = %d \n",
+                               __func__, first_mb_in_slice);
+
+                               hw->multi_slice_pic_flag = 0;
+                               hw->multi_slice_pic_check_count = 0;
+                       } else if (hw->cur_picture_slice_count > hw->last_picture_slice_count)
                                vh264_pic_done_proc(vdec);
                        else {
                                if (p_H264_Dpb->mVideo.dec_picture) {