vmh264: fix bug of abnormal cropping. [1/1]
authormiaohong chen <miaohong.chen@amlogic.com>
Mon, 27 Jul 2020 08:52:31 +0000 (16:52 +0800)
committerGan Zhang <gan.zhang@amlogic.com>
Tue, 28 Jul 2020 10:31:46 +0000 (18:31 +0800)
PD#SWPL-28943

Problem:
chroma_format_idc may not exist, causing misuse,
resulting in abnormal crop

Solution:
According to grammar rules,
when chroma_format_idc does not exist, set it to 1.

Verify:
u212

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

index 4257a8bf4f5f4fc0de71cdf8deb6bb7a5eb732a3..948b436db28c06b477941c86f1c91f4f1541a7ba 100644 (file)
@@ -4812,6 +4812,12 @@ static int vh264_set_params(struct vdec_h264_hw_s *hw,
                   bit 15: frame_mbs_only_flag
                   bit 13-14: chroma_format_idc */
                frame_mbs_only_flag = (hw->seq_info >> 15) & 0x01;
+               if (p_H264_Dpb->mSPS.profile_idc != 100 &&
+                       p_H264_Dpb->mSPS.profile_idc != 110 &&
+                       p_H264_Dpb->mSPS.profile_idc != 122 &&
+                       p_H264_Dpb->mSPS.profile_idc != 144) {
+                       p_H264_Dpb->chroma_format_idc = 1;
+               }
                chroma_format_idc = p_H264_Dpb->chroma_format_idc;
 
                /* @AV_SCRATCH_6.31-16 =  (left  << 8 | right ) << 1
@@ -8376,6 +8382,12 @@ static int vmh264_get_ps_info(struct vdec_h264_hw_s *hw,
         * bit 13-14: chroma_format_idc
         */
        frame_mbs_only_flag = (hw->seq_info >> 15) & 0x01;
+       if (hw->dpb.mSPS.profile_idc != 100 &&
+               hw->dpb.mSPS.profile_idc != 110 &&
+               hw->dpb.mSPS.profile_idc != 122 &&
+               hw->dpb.mSPS.profile_idc != 144) {
+               hw->dpb.chroma_format_idc = 1;
+       }
        chroma_format_idc = hw->dpb.chroma_format_idc;
 
        /*