di: fix sawtooth in the lower patr of AV video [1/1]
authorWenfeng Guo <wenfeng.guo@amlogic.com>
Fri, 5 Jul 2019 03:22:59 +0000 (11:22 +0800)
committerTao Zeng <tao.zeng@amlogic.com>
Mon, 8 Jul 2019 07:56:38 +0000 (00:56 -0700)
PD#SWPL-10831

Problem:
sawtooth in the lower patr of AV video

Solution:
adjust motion num condition

Verify:
marconi

Change-Id: Id42f1cb2d3f702e04cd640dbc99c4f7a97447faf
Signed-off-by: Wenfeng Guo <wenfeng.guo@amlogic.com>
drivers/amlogic/media/deinterlace/nr_drv.c
drivers/amlogic/media/deinterlace/nr_drv.h

index 6308c46..0e7e8b1 100644 (file)
@@ -382,6 +382,7 @@ static void cue_config(struct CUE_PARM_s *pcue_parm, unsigned short field_type)
 {
        pcue_parm->field_count = 8;
        pcue_parm->frame_count = 8;
+       pcue_parm->field_count1 = 8;
        if (field_type != VIDTYPE_PROGRESSIVE) {
                DI_Wr_reg_bits(NR2_CUE_PRG_DIF, 0, 20, 1);
                DI_Wr_reg_bits(DI_NR_CTRL0, 0, 26, 1);
@@ -772,10 +773,23 @@ void adaptive_cue_adjust(unsigned int frame_diff, unsigned int field_diff)
                        pcue_parm->field_count = pcue_parm->field_count > 0 ?
                                (pcue_parm->field_count - 1) : 0;
                }
+               /*--------------------------*/
+               /*patch from vlsi-yanling to fix tv-7314 cue cause sawtooth*/
+               if (field_diff < pcue_parm->glb_mot_fieldthr ||
+                       field_diff > pcue_parm->glb_mot_fieldthr1)
+                       pcue_parm->field_count1 = pcue_parm->field_count1 + 1;
+               else if (pcue_parm->field_count1 > 8) {
+                       pcue_parm->field_count1 = pcue_parm->field_count1 > 0 ?
+                               (pcue_parm->field_count1 - 1) : 0;
+               }
+               /*--------------------------*/
        }
 
        if (cue_glb_mot_check_en) {
-               if (pcue_parm->frame_count > (pcue_parm->glb_mot_fieldnum - 6))
+               if (pcue_parm->frame_count >
+                       (pcue_parm->glb_mot_fieldnum - 6) &&
+                       pcue_parm->field_count1 >
+                       (pcue_parm->glb_mot_fieldnum - 6))
                        cue_en = true;
                else
                        cue_en = false;
@@ -1092,8 +1106,10 @@ static void cue_param_init(struct CUE_PARM_s *cue_parm_p)
        cue_parm_p->glb_mot_framethr = 1000;
        cue_parm_p->glb_mot_fieldnum = 20;
        cue_parm_p->glb_mot_fieldthr = 10;
+       cue_parm_p->glb_mot_fieldthr1 = 1000;/*fix tv-7314 cue cause sawtooth*/
        cue_parm_p->field_count = 8;
        cue_parm_p->frame_count = 8;
+       cue_parm_p->field_count1 = 8;/*fix tv-7314 cue cause sawtooth*/
 }
 static int dnr_prm_init(DNR_PRM_t *pPrm)
 {
index 0d0c714..36b98d1 100644 (file)
@@ -84,8 +84,10 @@ struct CUE_PARM_s {
        int glb_mot_framethr;
        int glb_mot_fieldnum;
        int glb_mot_fieldthr;
+       int glb_mot_fieldthr1;
        int field_count;
        int frame_count;
+       int field_count1;
 };
 
 #define        NR_CTRL_REG_NUM 6