#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);
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;
module_param(dif01_ratio, int, 0644);
MODULE_PARM_DESC(dif01_ratio, "dif01_ratio");
+
int comsum;
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 */
}
/* --------------------------------------------------------- */
/* Film-Detection */
- nS1 = FlmDetSft(&pRDat, nDIF01, nDIF02, nT0, pPar);
+ nS1 = FlmDetSft(&pRDat, nDIF01, nDIF02, nT0, pPar, vf);
nS0 = FlmModsDet(&pRDat, rROFldDif01[0], rROFrmDif02[0]);
/* --------------------------------------------------------- */
/* 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 */
/* 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) */
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;
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");
nFlgChk1 = 0;
nFlgChk2 = 0;
}
- /* ============================================= */
nT2 = 5 * nDif02[HISDIFNUM - 1] / (nMn + sFrmDifLgTDif + 1);
nT2 = nT2>>1;
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];
#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 */
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;
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] */
/* 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);
/* */
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,
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;
&cmb_sts->cmb_row_num,
&cmb_sts->frame_diff_avg,
&pd_param,
- reverse);
+ reverse,
+ vf);
difflag = dectres.dif01flag;
if (dectres.rFlmPstMod == 1)
&(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",