mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 04:10:18 +09:00
di: fix TL1 cave video 1080i 60hz have drawing [1/1]
PD#SWPL-7006 Problem: TL1 cave video 1080i 60hz have drawing. Solution: dark scenes don't into pulldown32 by vlsi yanling Verify: TL1 Signed Change-Id: Ib77c0f99940c416943baa9b9a8a02a059b274e5b Signed-off-by: Wenfeng Guo <wenfeng.guo@amlogic.com>
This commit is contained in:
@@ -3245,7 +3245,8 @@ static void pre_de_done_buf_config(void)
|
||||
&glb_field_mot_num);
|
||||
if (pulldown_enable)
|
||||
pulldown_detection(&post_wr_buf->pd_config,
|
||||
di_pre_stru.mtn_status, overturn);
|
||||
di_pre_stru.mtn_status, overturn,
|
||||
di_pre_stru.di_inp_buf->vframe);
|
||||
if (combing_fix_en)
|
||||
cur_lev = adaptive_combing_fixing(
|
||||
di_pre_stru.mtn_status,
|
||||
|
||||
@@ -17,7 +17,9 @@
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/amlogic/media/vfm/vframe.h>
|
||||
#include "film_vof_soft.h"
|
||||
#include "../deinterlace.h"
|
||||
|
||||
|
||||
static int DIweavedetec(struct sFlmSftPar *pPar, int nDif01);
|
||||
@@ -69,6 +71,8 @@ UINT8 FlmVOFSftInt(struct sFlmSftPar *pPar)
|
||||
pPar->dif01rate = 20;
|
||||
pPar->flag_di01th = 0;
|
||||
pPar->numthd = 60;
|
||||
pPar->flm32_dif02_gap_th = 7;
|
||||
pPar->flm32_luma_th = 90;
|
||||
pPar->sF32Dif02M0 = 4096;/* mpeg-4096, cvbs-8192 */
|
||||
pPar->sF32Dif02M1 = 4096;
|
||||
|
||||
@@ -231,6 +235,7 @@ static int dif01_ratio = 10;
|
||||
module_param(dif01_ratio, int, 0644);
|
||||
MODULE_PARM_DESC(dif01_ratio, "dif01_ratio");
|
||||
|
||||
|
||||
int comsum;
|
||||
|
||||
int FlmVOFSftTop(UINT8 *rCmb32Spcl, unsigned short *rPstCYWnd0,
|
||||
@@ -240,7 +245,8 @@ int FlmVOFSftTop(UINT8 *rCmb32Spcl, unsigned short *rPstCYWnd0,
|
||||
UINT8 *dif01flag, UINT32 *rROFldDif01, UINT32 *rROFrmDif02,
|
||||
UINT32 *rROCmbInf, UINT32 glb_frame_mot_num,
|
||||
UINT32 glb_field_mot_num, unsigned int *combing_row_num,
|
||||
unsigned int *frame_diff_avg, struct sFlmSftPar *pPar, bool reverse)
|
||||
unsigned int *frame_diff_avg, struct sFlmSftPar *pPar, bool reverse,
|
||||
struct vframe_s *vf)
|
||||
{
|
||||
static UINT32 DIF01[HISDIFNUM]; /* Last one is global */
|
||||
static UINT32 DIF02[HISDIFNUM]; /* Last one is global */
|
||||
@@ -379,7 +385,7 @@ int FlmVOFSftTop(UINT8 *rCmb32Spcl, unsigned short *rPstCYWnd0,
|
||||
}
|
||||
/* --------------------------------------------------------- */
|
||||
/* Film-Detection */
|
||||
nS1 = FlmDetSft(&pRDat, nDIF01, nDIF02, nT0, pPar);
|
||||
nS1 = FlmDetSft(&pRDat, nDIF01, nDIF02, nT0, pPar, vf);
|
||||
|
||||
nS0 = FlmModsDet(&pRDat, rROFldDif01[0], rROFrmDif02[0]);
|
||||
/* --------------------------------------------------------- */
|
||||
@@ -621,12 +627,12 @@ int FlmVOFSftTop(UINT8 *rCmb32Spcl, unsigned short *rPstCYWnd0,
|
||||
/* nDif02: Frame Difference */
|
||||
/* WND: The index of Window */
|
||||
int FlmDetSft(struct sFlmDatSt *pRDat, int *nDif01, int *nDif02,
|
||||
int WND, struct sFlmSftPar *pPar)
|
||||
int WND, struct sFlmSftPar *pPar, struct vframe_s *vf)
|
||||
{
|
||||
int nT0 = 0;
|
||||
|
||||
/* 3-2 */
|
||||
Flm32DetSft(pRDat, nDif02, nDif01, pPar);
|
||||
Flm32DetSft(pRDat, nDif02, nDif01, pPar, vf);
|
||||
|
||||
/* Film2-2 Detection */
|
||||
/* debug0304 */
|
||||
@@ -639,7 +645,7 @@ int FlmDetSft(struct sFlmDatSt *pRDat, int *nDif01, int *nDif02,
|
||||
/* pFlm02[0:nLEN-1] : recursive, 0-2 dif */
|
||||
/* pFlm01[0:nLEN-1] : recursive, 0-1 dif */
|
||||
int Flm32DetSft(struct sFlmDatSt *pRDat, int *nDif02,
|
||||
int *nDif01, struct sFlmSftPar *pPar)
|
||||
int *nDif01, struct sFlmSftPar *pPar, struct vframe_s *vf)
|
||||
{
|
||||
int sFrmDifAvgRat = pPar->sFrmDifAvgRat; /* 16; //0~32 */
|
||||
/* The Large Decision should be: (large>average+LgDifThrd) */
|
||||
@@ -647,7 +653,6 @@ int Flm32DetSft(struct sFlmDatSt *pRDat, int *nDif02,
|
||||
int sF32StpWgt01 = pPar->sF32StpWgt01; /* 15; */
|
||||
int sF32StpWgt02 = pPar->sF32StpWgt02; /* 15; */
|
||||
int sF32DifLgRat = pPar->sF32DifLgRat; /* 16; Dif>Rat*Min-->Larger */
|
||||
|
||||
/* int sF32DifSmRat = 16; //Dif*Rat<Max --> Smaller */
|
||||
|
||||
UINT8 *pFlm02 = pRDat->pFrm32;
|
||||
@@ -681,6 +686,29 @@ int Flm32DetSft(struct sFlmDatSt *pRDat, int *nDif02,
|
||||
int nFlgChk2 = 0;
|
||||
int nFlgChk3 = 0; /* for Mit32VHLine */
|
||||
|
||||
int luma_avg = 0;
|
||||
int flm32_dif02_gap = 0;
|
||||
|
||||
int flm32_luma_th = pPar->flm32_luma_th; // APL th
|
||||
int flm32_dif02_gap_th = pPar->flm32_dif02_gap_th;
|
||||
|
||||
/* ============================================= */
|
||||
/*patch for dark scenes don't into pulldown32 by vlsi yanling*/
|
||||
if (vf == NULL || !IS_VDIN_SRC(vf->source_type))
|
||||
luma_avg = flm32_luma_th;
|
||||
else {
|
||||
if (vf->prop.hist.pixel_sum > 0)
|
||||
luma_avg = vf->prop.hist.luma_sum /
|
||||
vf->prop.hist.pixel_sum;
|
||||
else
|
||||
luma_avg = flm32_luma_th;
|
||||
}
|
||||
if (luma_avg < flm32_luma_th)
|
||||
flm32_dif02_gap = flm32_dif02_gap_th * 2;
|
||||
else
|
||||
flm32_dif02_gap = flm32_dif02_gap_th;
|
||||
/*---------------------------------*/
|
||||
|
||||
prt_flg = ((pr_pd >> 2) & 0x1);
|
||||
if (prt_flg)
|
||||
sprintf(debug_str, "#Dbg32:\n");
|
||||
@@ -779,7 +807,6 @@ int Flm32DetSft(struct sFlmDatSt *pRDat, int *nDif02,
|
||||
nFlgChk1 = 0;
|
||||
nFlgChk2 = 0;
|
||||
}
|
||||
/* ============================================= */
|
||||
|
||||
nT2 = 5 * nDif02[HISDIFNUM - 1] / (nMn + sFrmDifLgTDif + 1);
|
||||
nT2 = nT2>>1;
|
||||
@@ -799,7 +826,10 @@ int Flm32DetSft(struct sFlmDatSt *pRDat, int *nDif02,
|
||||
|
||||
if (nSTP > 16)
|
||||
nSTP = 16;
|
||||
|
||||
/*patch for dark scenes don't into pulldown32 by vlsi yanling*/
|
||||
if (((nMx + nMn/2) / (nMn + 1)) < flm32_dif02_gap)
|
||||
nSTP = 0;
|
||||
/*---------------*/
|
||||
for (nT0 = 1; nT0 < HISDETNUM; nT0++) {
|
||||
pFlm02[nT0 - 1] = pFlm02[nT0];
|
||||
pFlm02t[nT0 - 1] = pFlm02t[nT0];
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#ifndef _FLMVOFSFT_H_
|
||||
#define _FLMVOFSFT_H_
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/amlogic/media/vfm/vframe.h>
|
||||
|
||||
/* Film Detection and VOF detection Software implementation */
|
||||
/* Designer: Xin.Hu@amlogic.com */
|
||||
/* Date: 12/06/13 */
|
||||
@@ -130,6 +132,9 @@ struct sFlmSftPar {
|
||||
int flag_di01th;
|
||||
int numthd;
|
||||
|
||||
int flm32_dif02_gap_th;
|
||||
int flm32_luma_th;
|
||||
|
||||
UINT32 sF32Dif02M0; /* mpeg-4096, cvbs-8192 */
|
||||
UINT32 sF32Dif02M1; /* mpeg-4096, cvbs-8192 */
|
||||
unsigned int field_count;
|
||||
@@ -164,7 +169,8 @@ int FlmVOFSftTop(UINT8 *rCmb32Spcl, unsigned short *rPstCYWnd0,
|
||||
UINT8 *dif01flag, UINT32 *rROFldDif01, UINT32 *rROFrmDif02,
|
||||
UINT32 *rROCmbInf, UINT32 glb_frame_mot_num,
|
||||
UINT32 glb_field_mot_num, unsigned int *cmb_row_num,
|
||||
unsigned int *frame_diff_avg, struct sFlmSftPar *pPar, bool reverse);
|
||||
unsigned int *frame_diff_avg, struct sFlmSftPar *pPar, bool reverse,
|
||||
struct vframe_s *vf);
|
||||
|
||||
/* length of pFlm01/nDif01: [0:5]; */
|
||||
/* iDx: index of minimum dif02 ([0:5] */
|
||||
@@ -175,7 +181,7 @@ int Cal32Flm01(UINT8 *pFlm01, int *nDif01, int iDx, struct sFlmSftPar *pPar);
|
||||
/* nDif02: Frame Difference */
|
||||
/* WND: The index of Window */
|
||||
int FlmDetSft(struct sFlmDatSt *pRDat, int *nDif01, int *nDif02, int WND,
|
||||
struct sFlmSftPar *pPar);
|
||||
struct sFlmSftPar *pPar, struct vframe_s *vf);
|
||||
|
||||
int VOFDetSub1(int *PREWV, int *nCNum, int nMod, UINT32 *nRCmb, int nROW,
|
||||
struct sFlmSftPar *pPar);
|
||||
@@ -187,7 +193,7 @@ int VOFDetSft(int *VOFWnd, int *nCNum, int *nGCmb,
|
||||
|
||||
/* */
|
||||
int Flm32DetSft(struct sFlmDatSt *pRDat, int *nDif02, int *nDif01,
|
||||
struct sFlmSftPar *pPar);
|
||||
struct sFlmSftPar *pPar, struct vframe_s *vf);
|
||||
|
||||
/* Film2-2 Detection */
|
||||
int Flm22DetSft(struct sFlmDatSt *pRDat, int *nDif02,
|
||||
|
||||
@@ -112,7 +112,7 @@ module_param(cmb_3point_rrat, uint, 0644);
|
||||
MODULE_PARM_DESC(cmb_3point_rrat, "cmb_3point_rrat/n");
|
||||
|
||||
unsigned int pulldown_detection(struct pulldown_detected_s *res,
|
||||
struct combing_status_s *cmb_sts, bool reverse)
|
||||
struct combing_status_s *cmb_sts, bool reverse, struct vframe_s *vf)
|
||||
{
|
||||
unsigned int glb_frame_mot_num, glb_field_mot_num, i;
|
||||
unsigned int mot_row = 0, mot_max = 0, ntmp = 0;
|
||||
@@ -142,7 +142,8 @@ unsigned int pulldown_detection(struct pulldown_detected_s *res,
|
||||
&cmb_sts->cmb_row_num,
|
||||
&cmb_sts->frame_diff_avg,
|
||||
&pd_param,
|
||||
reverse);
|
||||
reverse,
|
||||
vf);
|
||||
|
||||
difflag = dectres.dif01flag;
|
||||
if (dectres.rFlmPstMod == 1)
|
||||
@@ -413,6 +414,10 @@ static struct pd_param_s pd_params[] = {
|
||||
&(pd_param.flag_di01th) },
|
||||
{ "numthd",
|
||||
&(pd_param.numthd) },
|
||||
{ "flm32_dif02_gap_th",
|
||||
&(pd_param.flm32_dif02_gap_th) },
|
||||
{ "flm32_luma_th",
|
||||
&(pd_param.flm32_luma_th) },
|
||||
{ "sF32Dif02M0",
|
||||
&(pd_param.sF32Dif02M0) }, /* mpeg-4096, cvbs-8192 */
|
||||
{ "sF32Dif02M1",
|
||||
|
||||
@@ -46,7 +46,7 @@ struct pulldown_detected_s {
|
||||
unsigned char pulldown_init(unsigned short width, unsigned short height);
|
||||
|
||||
unsigned int pulldown_detection(struct pulldown_detected_s *res,
|
||||
struct combing_status_s *cmb_sts, bool reverse);
|
||||
struct combing_status_s *cmb_sts, bool reverse, struct vframe_s *vf);
|
||||
|
||||
void pulldown_vof_win_vshift(struct pulldown_detected_s *wins,
|
||||
unsigned short v_offset);
|
||||
|
||||
Reference in New Issue
Block a user