mirror of https://git.ffmpeg.org/ffmpeg.git
cleanup
Originally committed as revision 8039 to svn://svn.mplayerhq.hu/mplayer/trunk/postproc
This commit is contained in:
parent
05c4072b45
commit
c41d972d9c
|
@ -77,6 +77,7 @@ try to unroll inner for(x=0 ... loop to avoid these damn if(x ... checks
|
||||||
//#define DEBUG_BRIGHTNESS
|
//#define DEBUG_BRIGHTNESS
|
||||||
#include "../libvo/fastmemcpy.h"
|
#include "../libvo/fastmemcpy.h"
|
||||||
#include "postprocess.h"
|
#include "postprocess.h"
|
||||||
|
#include "postprocess_internal.h"
|
||||||
#include "../mangle.h"
|
#include "../mangle.h"
|
||||||
|
|
||||||
#define MIN(a,b) ((a) > (b) ? (b) : (a))
|
#define MIN(a,b) ((a) > (b) ? (b) : (a))
|
||||||
|
@ -104,55 +105,6 @@ static int verbose= 0;
|
||||||
|
|
||||||
static const int deringThreshold= 20;
|
static const int deringThreshold= 20;
|
||||||
|
|
||||||
struct PPFilter{
|
|
||||||
char *shortName;
|
|
||||||
char *longName;
|
|
||||||
int chromDefault; // is chrominance filtering on by default if this filter is manually activated
|
|
||||||
int minLumQuality; // minimum quality to turn luminance filtering on
|
|
||||||
int minChromQuality; // minimum quality to turn chrominance filtering on
|
|
||||||
int mask; // Bitmask to turn this filter on
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct PPContext{
|
|
||||||
uint8_t *tempBlocks; //used for the horizontal code
|
|
||||||
|
|
||||||
/* we need 64bit here otherwise we´ll going to have a problem
|
|
||||||
after watching a black picture for 5 hours*/
|
|
||||||
uint64_t *yHistogram;
|
|
||||||
|
|
||||||
uint64_t __attribute__((aligned(8))) packedYOffset;
|
|
||||||
uint64_t __attribute__((aligned(8))) packedYScale;
|
|
||||||
|
|
||||||
/* Temporal noise reducing buffers */
|
|
||||||
uint8_t *tempBlured[3];
|
|
||||||
int32_t *tempBluredPast[3];
|
|
||||||
|
|
||||||
/* Temporary buffers for handling the last row(s) */
|
|
||||||
uint8_t *tempDst;
|
|
||||||
uint8_t *tempSrc;
|
|
||||||
|
|
||||||
/* Temporary buffers for handling the last block */
|
|
||||||
uint8_t *tempDstBlock;
|
|
||||||
uint8_t *tempSrcBlock;
|
|
||||||
uint8_t *deintTemp;
|
|
||||||
|
|
||||||
uint64_t __attribute__((aligned(8))) pQPb;
|
|
||||||
uint64_t __attribute__((aligned(8))) pQPb2;
|
|
||||||
|
|
||||||
uint64_t __attribute__((aligned(8))) mmxDcOffset[32];
|
|
||||||
uint64_t __attribute__((aligned(8))) mmxDcThreshold[32];
|
|
||||||
|
|
||||||
QP_STORE_T *nonBQPTable;
|
|
||||||
|
|
||||||
int QP;
|
|
||||||
int nonBQP;
|
|
||||||
|
|
||||||
int frameNum;
|
|
||||||
|
|
||||||
int cpuCaps;
|
|
||||||
|
|
||||||
PPMode ppMode;
|
|
||||||
} PPContext;
|
|
||||||
|
|
||||||
static struct PPFilter filters[]=
|
static struct PPFilter filters[]=
|
||||||
{
|
{
|
||||||
|
@ -489,9 +441,10 @@ static inline void horizX1Filter(uint8_t *src, int stride, int QP)
|
||||||
// minor note: the HAVE_xyz is messed up after that line so dont use it
|
// minor note: the HAVE_xyz is messed up after that line so dont use it
|
||||||
|
|
||||||
static inline void postProcess(uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height,
|
static inline void postProcess(uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height,
|
||||||
QP_STORE_T QPs[], int QPStride, int isColor, PPMode *ppMode, pp_context_t *vc)
|
QP_STORE_T QPs[], int QPStride, int isColor, pp_mode_t *vm, pp_context_t *vc)
|
||||||
{
|
{
|
||||||
PPContext *c= (PPContext *)vc;
|
PPContext *c= (PPContext *)vc;
|
||||||
|
PPMode *ppMode= (PPMode *)vm;
|
||||||
c->ppMode= *ppMode; //FIXME
|
c->ppMode= *ppMode; //FIXME
|
||||||
|
|
||||||
// useing ifs here as they are faster than function pointers allthough the
|
// useing ifs here as they are faster than function pointers allthough the
|
||||||
|
@ -570,27 +523,29 @@ char *pp_help=
|
||||||
* name is the string after "-pp" on the command line
|
* name is the string after "-pp" on the command line
|
||||||
* quality is a number from 0 to GET_PP_QUALITY_MAX
|
* quality is a number from 0 to GET_PP_QUALITY_MAX
|
||||||
*/
|
*/
|
||||||
struct PPMode pp_get_mode_by_name_and_quality(char *name, int quality)
|
pp_mode_t *pp_get_mode_by_name_and_quality(char *name, int quality)
|
||||||
{
|
{
|
||||||
char temp[GET_MODE_BUFFER_SIZE];
|
char temp[GET_MODE_BUFFER_SIZE];
|
||||||
char *p= temp;
|
char *p= temp;
|
||||||
char *filterDelimiters= ",/";
|
char *filterDelimiters= ",/";
|
||||||
char *optionDelimiters= ":";
|
char *optionDelimiters= ":";
|
||||||
struct PPMode ppMode;
|
struct PPMode *ppMode;
|
||||||
char *filterToken;
|
char *filterToken;
|
||||||
|
|
||||||
ppMode.lumMode= 0;
|
ppMode= memalign(8, sizeof(PPMode));
|
||||||
ppMode.chromMode= 0;
|
|
||||||
ppMode.maxTmpNoise[0]= 700;
|
ppMode->lumMode= 0;
|
||||||
ppMode.maxTmpNoise[1]= 1500;
|
ppMode->chromMode= 0;
|
||||||
ppMode.maxTmpNoise[2]= 3000;
|
ppMode->maxTmpNoise[0]= 700;
|
||||||
ppMode.maxAllowedY= 234;
|
ppMode->maxTmpNoise[1]= 1500;
|
||||||
ppMode.minAllowedY= 16;
|
ppMode->maxTmpNoise[2]= 3000;
|
||||||
ppMode.baseDcDiff= 256/4;
|
ppMode->maxAllowedY= 234;
|
||||||
ppMode.flatnessThreshold=40;
|
ppMode->minAllowedY= 16;
|
||||||
ppMode.flatnessThreshold= 56-16;
|
ppMode->baseDcDiff= 256/4;
|
||||||
ppMode.maxClippedThreshold= 0.01;
|
ppMode->flatnessThreshold=40;
|
||||||
ppMode.error=0;
|
ppMode->flatnessThreshold= 56-16;
|
||||||
|
ppMode->maxClippedThreshold= 0.01;
|
||||||
|
ppMode->error=0;
|
||||||
|
|
||||||
strncpy(temp, name, GET_MODE_BUFFER_SIZE);
|
strncpy(temp, name, GET_MODE_BUFFER_SIZE);
|
||||||
|
|
||||||
|
@ -652,7 +607,7 @@ struct PPMode pp_get_mode_by_name_and_quality(char *name, int quality)
|
||||||
spaceLeft= p - temp + plen;
|
spaceLeft= p - temp + plen;
|
||||||
if(spaceLeft + newlen >= GET_MODE_BUFFER_SIZE)
|
if(spaceLeft + newlen >= GET_MODE_BUFFER_SIZE)
|
||||||
{
|
{
|
||||||
ppMode.error++;
|
ppMode->error++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
memmove(p + newlen, p, plen+1);
|
memmove(p + newlen, p, plen+1);
|
||||||
|
@ -667,30 +622,30 @@ struct PPMode pp_get_mode_by_name_and_quality(char *name, int quality)
|
||||||
if( !strcmp(filters[i].longName, filterName)
|
if( !strcmp(filters[i].longName, filterName)
|
||||||
|| !strcmp(filters[i].shortName, filterName))
|
|| !strcmp(filters[i].shortName, filterName))
|
||||||
{
|
{
|
||||||
ppMode.lumMode &= ~filters[i].mask;
|
ppMode->lumMode &= ~filters[i].mask;
|
||||||
ppMode.chromMode &= ~filters[i].mask;
|
ppMode->chromMode &= ~filters[i].mask;
|
||||||
|
|
||||||
filterNameOk=1;
|
filterNameOk=1;
|
||||||
if(!enable) break; // user wants to disable it
|
if(!enable) break; // user wants to disable it
|
||||||
|
|
||||||
if(q >= filters[i].minLumQuality)
|
if(q >= filters[i].minLumQuality)
|
||||||
ppMode.lumMode|= filters[i].mask;
|
ppMode->lumMode|= filters[i].mask;
|
||||||
if(chrom==1 || (chrom==-1 && filters[i].chromDefault))
|
if(chrom==1 || (chrom==-1 && filters[i].chromDefault))
|
||||||
if(q >= filters[i].minChromQuality)
|
if(q >= filters[i].minChromQuality)
|
||||||
ppMode.chromMode|= filters[i].mask;
|
ppMode->chromMode|= filters[i].mask;
|
||||||
|
|
||||||
if(filters[i].mask == LEVEL_FIX)
|
if(filters[i].mask == LEVEL_FIX)
|
||||||
{
|
{
|
||||||
int o;
|
int o;
|
||||||
ppMode.minAllowedY= 16;
|
ppMode->minAllowedY= 16;
|
||||||
ppMode.maxAllowedY= 234;
|
ppMode->maxAllowedY= 234;
|
||||||
for(o=0; options[o]!=NULL; o++)
|
for(o=0; options[o]!=NULL; o++)
|
||||||
{
|
{
|
||||||
if( !strcmp(options[o],"fullyrange")
|
if( !strcmp(options[o],"fullyrange")
|
||||||
||!strcmp(options[o],"f"))
|
||!strcmp(options[o],"f"))
|
||||||
{
|
{
|
||||||
ppMode.minAllowedY= 0;
|
ppMode->minAllowedY= 0;
|
||||||
ppMode.maxAllowedY= 255;
|
ppMode->maxAllowedY= 255;
|
||||||
numOfUnknownOptions--;
|
numOfUnknownOptions--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -703,7 +658,7 @@ struct PPMode pp_get_mode_by_name_and_quality(char *name, int quality)
|
||||||
for(o=0; options[o]!=NULL; o++)
|
for(o=0; options[o]!=NULL; o++)
|
||||||
{
|
{
|
||||||
char *tail;
|
char *tail;
|
||||||
ppMode.maxTmpNoise[numOfNoises]=
|
ppMode->maxTmpNoise[numOfNoises]=
|
||||||
strtol(options[o], &tail, 0);
|
strtol(options[o], &tail, 0);
|
||||||
if(tail!=options[o])
|
if(tail!=options[o])
|
||||||
{
|
{
|
||||||
|
@ -724,14 +679,14 @@ struct PPMode pp_get_mode_by_name_and_quality(char *name, int quality)
|
||||||
if(tail==options[o]) break;
|
if(tail==options[o]) break;
|
||||||
|
|
||||||
numOfUnknownOptions--;
|
numOfUnknownOptions--;
|
||||||
if(o==0) ppMode.baseDcDiff= val;
|
if(o==0) ppMode->baseDcDiff= val;
|
||||||
else ppMode.flatnessThreshold= val;
|
else ppMode->flatnessThreshold= val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(filters[i].mask == FORCE_QUANT)
|
else if(filters[i].mask == FORCE_QUANT)
|
||||||
{
|
{
|
||||||
int o;
|
int o;
|
||||||
ppMode.forcedQuant= 15;
|
ppMode->forcedQuant= 15;
|
||||||
|
|
||||||
for(o=0; options[o]!=NULL && o<1; o++)
|
for(o=0; options[o]!=NULL && o<1; o++)
|
||||||
{
|
{
|
||||||
|
@ -740,20 +695,30 @@ struct PPMode pp_get_mode_by_name_and_quality(char *name, int quality)
|
||||||
if(tail==options[o]) break;
|
if(tail==options[o]) break;
|
||||||
|
|
||||||
numOfUnknownOptions--;
|
numOfUnknownOptions--;
|
||||||
ppMode.forcedQuant= val;
|
ppMode->forcedQuant= val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!filterNameOk) ppMode.error++;
|
if(!filterNameOk) ppMode->error++;
|
||||||
ppMode.error += numOfUnknownOptions;
|
ppMode->error += numOfUnknownOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(verbose>1) printf("pp: lumMode=%X, chromMode=%X\n", ppMode.lumMode, ppMode.chromMode);
|
if(verbose>1) printf("pp: lumMode=%X, chromMode=%X\n", ppMode->lumMode, ppMode->chromMode);
|
||||||
|
if(ppMode->error)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "%d errors in postprocess string \"%s\"\n", ppMode->error, name);
|
||||||
|
free(ppMode);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
return ppMode;
|
return ppMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *pp_get_context(int width, int height, int cpuCaps){
|
void pp_free_mode(pp_mode_t *mode){
|
||||||
|
if(mode) free(mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
pp_context_t *pp_get_context(int width, int height, int cpuCaps){
|
||||||
PPContext *c= memalign(32, sizeof(PPContext));
|
PPContext *c= memalign(32, sizeof(PPContext));
|
||||||
int i;
|
int i;
|
||||||
int mbWidth = (width+15)>>4;
|
int mbWidth = (width+15)>>4;
|
||||||
|
@ -812,11 +777,12 @@ void pp_postprocess(uint8_t * src[3], int srcStride[3],
|
||||||
uint8_t * dst[3], int dstStride[3],
|
uint8_t * dst[3], int dstStride[3],
|
||||||
int width, int height,
|
int width, int height,
|
||||||
QP_STORE_T *QP_store, int QPStride,
|
QP_STORE_T *QP_store, int QPStride,
|
||||||
PPMode *mode, void *vc, int pict_type)
|
pp_mode_t *vm, void *vc, int pict_type)
|
||||||
{
|
{
|
||||||
int mbWidth = (width+15)>>4;
|
int mbWidth = (width+15)>>4;
|
||||||
int mbHeight= (height+15)>>4;
|
int mbHeight= (height+15)>>4;
|
||||||
QP_STORE_T quantArray[2048/8];
|
QP_STORE_T quantArray[2048/8];
|
||||||
|
PPMode *mode = (PPMode*)vm;
|
||||||
PPContext *c = (PPContext*)vc;
|
PPContext *c = (PPContext*)vc;
|
||||||
|
|
||||||
if(QP_store==NULL || (mode->lumMode & FORCE_QUANT))
|
if(QP_store==NULL || (mode->lumMode & FORCE_QUANT))
|
||||||
|
|
|
@ -16,84 +16,27 @@
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// POSTPROCESS_H is defined by opendivx's postprocess.h
|
|
||||||
#ifndef NEWPOSTPROCESS_H
|
#ifndef NEWPOSTPROCESS_H
|
||||||
#define NEWPOSTPROCESS_H
|
#define NEWPOSTPROCESS_H
|
||||||
|
|
||||||
#define V_DEBLOCK 0x01
|
|
||||||
#define H_DEBLOCK 0x02
|
|
||||||
#define DERING 0x04
|
|
||||||
#define LEVEL_FIX 0x08 /* Brightness & Contrast */
|
|
||||||
|
|
||||||
#define LUM_V_DEBLOCK V_DEBLOCK // 1
|
|
||||||
#define LUM_H_DEBLOCK H_DEBLOCK // 2
|
|
||||||
#define CHROM_V_DEBLOCK (V_DEBLOCK<<4) // 16
|
|
||||||
#define CHROM_H_DEBLOCK (H_DEBLOCK<<4) // 32
|
|
||||||
#define LUM_DERING DERING // 4
|
|
||||||
#define CHROM_DERING (DERING<<4) // 64
|
|
||||||
#define LUM_LEVEL_FIX LEVEL_FIX // 8
|
|
||||||
#define CHROM_LEVEL_FIX (LEVEL_FIX<<4) // 128 (not implemented yet)
|
|
||||||
|
|
||||||
// Experimental vertical filters
|
|
||||||
#define V_X1_FILTER 0x0200 // 512
|
|
||||||
|
|
||||||
// Experimental horizontal filters
|
|
||||||
#define H_X1_FILTER 0x2000 // 8192
|
|
||||||
|
|
||||||
// select between full y range (255-0) or standart one (234-16)
|
|
||||||
#define FULL_Y_RANGE 0x8000 // 32768
|
|
||||||
|
|
||||||
//Deinterlacing Filters
|
|
||||||
#define LINEAR_IPOL_DEINT_FILTER 0x10000 // 65536
|
|
||||||
#define LINEAR_BLEND_DEINT_FILTER 0x20000 // 131072
|
|
||||||
#define CUBIC_BLEND_DEINT_FILTER 0x8000 // (not implemented yet)
|
|
||||||
#define CUBIC_IPOL_DEINT_FILTER 0x40000 // 262144
|
|
||||||
#define MEDIAN_DEINT_FILTER 0x80000 // 524288
|
|
||||||
#define FFMPEG_DEINT_FILTER 0x400000
|
|
||||||
|
|
||||||
#define TEMP_NOISE_FILTER 0x100000
|
|
||||||
#define FORCE_QUANT 0x200000
|
|
||||||
|
|
||||||
#define GET_PP_QUALITY_MAX 6
|
#define GET_PP_QUALITY_MAX 6
|
||||||
|
|
||||||
//use if u want a faster postprocessing code
|
|
||||||
//cant differentiate between chroma & luma filters (both on or both off)
|
|
||||||
//obviosly the -pp option at the commandline has no effect except turning the here selected
|
|
||||||
//filters on
|
|
||||||
//#define COMPILE_TIME_MODE 0x77
|
|
||||||
|
|
||||||
#define QP_STORE_T int8_t
|
#define QP_STORE_T int8_t
|
||||||
|
|
||||||
typedef void pp_context_t;
|
typedef void pp_context_t;
|
||||||
|
typedef void pp_mode_t;
|
||||||
|
|
||||||
extern char *pp_help;
|
extern char *pp_help; //a simple help text
|
||||||
|
|
||||||
//FIXME decide if this should be exported at all
|
|
||||||
typedef struct PPMode{
|
|
||||||
int lumMode; // acivates filters for luminance
|
|
||||||
int chromMode; // acivates filters for chrominance
|
|
||||||
int error; // non zero on error
|
|
||||||
|
|
||||||
int minAllowedY; // for brigtness correction
|
|
||||||
int maxAllowedY; // for brihtness correction
|
|
||||||
float maxClippedThreshold; // amount of "black" u r willing to loose to get a brightness corrected picture
|
|
||||||
|
|
||||||
int maxTmpNoise[3]; // for Temporal Noise Reducing filter (Maximal sum of abs differences)
|
|
||||||
|
|
||||||
int baseDcDiff;
|
|
||||||
int flatnessThreshold;
|
|
||||||
|
|
||||||
int forcedQuant; // quantizer if FORCE_QUANT is used
|
|
||||||
} PPMode;
|
|
||||||
|
|
||||||
void pp_postprocess(uint8_t * src[3], int srcStride[3],
|
void pp_postprocess(uint8_t * src[3], int srcStride[3],
|
||||||
uint8_t * dst[3], int dstStride[3],
|
uint8_t * dst[3], int dstStride[3],
|
||||||
int horizontalSize, int verticalSize,
|
int horizontalSize, int verticalSize,
|
||||||
QP_STORE_T *QP_store, int QP_stride,
|
QP_STORE_T *QP_store, int QP_stride,
|
||||||
PPMode *mode, pp_context_t *ppContext, int pict_type);
|
pp_mode_t *mode, pp_context_t *ppContext, int pict_type);
|
||||||
|
|
||||||
// name is the stuff after "-pp" on the command line
|
// name is the stuff after "-pp" on the command line
|
||||||
PPMode pp_get_mode_by_name_and_quality(char *name, int quality);
|
pp_mode_t *pp_get_mode_by_name_and_quality(char *name, int quality);
|
||||||
|
void pp_free_mode(pp_mode_t *mode);
|
||||||
|
|
||||||
pp_context_t *pp_get_context(int width, int height, int cpuCaps);
|
pp_context_t *pp_get_context(int width, int height, int cpuCaps);
|
||||||
void pp_free_context(pp_context_t *ppContext);
|
void pp_free_context(pp_context_t *ppContext);
|
||||||
|
|
|
@ -0,0 +1,125 @@
|
||||||
|
/*
|
||||||
|
Copyright (C) 2001-2002 Michael Niedermayer (michaelni@gmx.at)
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define V_DEBLOCK 0x01
|
||||||
|
#define H_DEBLOCK 0x02
|
||||||
|
#define DERING 0x04
|
||||||
|
#define LEVEL_FIX 0x08 /* Brightness & Contrast */
|
||||||
|
|
||||||
|
#define LUM_V_DEBLOCK V_DEBLOCK // 1
|
||||||
|
#define LUM_H_DEBLOCK H_DEBLOCK // 2
|
||||||
|
#define CHROM_V_DEBLOCK (V_DEBLOCK<<4) // 16
|
||||||
|
#define CHROM_H_DEBLOCK (H_DEBLOCK<<4) // 32
|
||||||
|
#define LUM_DERING DERING // 4
|
||||||
|
#define CHROM_DERING (DERING<<4) // 64
|
||||||
|
#define LUM_LEVEL_FIX LEVEL_FIX // 8
|
||||||
|
#define CHROM_LEVEL_FIX (LEVEL_FIX<<4) // 128 (not implemented yet)
|
||||||
|
|
||||||
|
// Experimental vertical filters
|
||||||
|
#define V_X1_FILTER 0x0200 // 512
|
||||||
|
|
||||||
|
// Experimental horizontal filters
|
||||||
|
#define H_X1_FILTER 0x2000 // 8192
|
||||||
|
|
||||||
|
// select between full y range (255-0) or standart one (234-16)
|
||||||
|
#define FULL_Y_RANGE 0x8000 // 32768
|
||||||
|
|
||||||
|
//Deinterlacing Filters
|
||||||
|
#define LINEAR_IPOL_DEINT_FILTER 0x10000 // 65536
|
||||||
|
#define LINEAR_BLEND_DEINT_FILTER 0x20000 // 131072
|
||||||
|
#define CUBIC_BLEND_DEINT_FILTER 0x8000 // (not implemented yet)
|
||||||
|
#define CUBIC_IPOL_DEINT_FILTER 0x40000 // 262144
|
||||||
|
#define MEDIAN_DEINT_FILTER 0x80000 // 524288
|
||||||
|
#define FFMPEG_DEINT_FILTER 0x400000
|
||||||
|
|
||||||
|
#define TEMP_NOISE_FILTER 0x100000
|
||||||
|
#define FORCE_QUANT 0x200000
|
||||||
|
|
||||||
|
//use if u want a faster postprocessing code
|
||||||
|
//cant differentiate between chroma & luma filters (both on or both off)
|
||||||
|
//obviosly the -pp option at the commandline has no effect except turning the here selected
|
||||||
|
//filters on
|
||||||
|
//#define COMPILE_TIME_MODE 0x77
|
||||||
|
|
||||||
|
struct PPFilter{
|
||||||
|
char *shortName;
|
||||||
|
char *longName;
|
||||||
|
int chromDefault; // is chrominance filtering on by default if this filter is manually activated
|
||||||
|
int minLumQuality; // minimum quality to turn luminance filtering on
|
||||||
|
int minChromQuality; // minimum quality to turn chrominance filtering on
|
||||||
|
int mask; // Bitmask to turn this filter on
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct PPMode{
|
||||||
|
int lumMode; // acivates filters for luminance
|
||||||
|
int chromMode; // acivates filters for chrominance
|
||||||
|
int error; // non zero on error
|
||||||
|
|
||||||
|
int minAllowedY; // for brigtness correction
|
||||||
|
int maxAllowedY; // for brihtness correction
|
||||||
|
float maxClippedThreshold; // amount of "black" u r willing to loose to get a brightness corrected picture
|
||||||
|
|
||||||
|
int maxTmpNoise[3]; // for Temporal Noise Reducing filter (Maximal sum of abs differences)
|
||||||
|
|
||||||
|
int baseDcDiff;
|
||||||
|
int flatnessThreshold;
|
||||||
|
|
||||||
|
int forcedQuant; // quantizer if FORCE_QUANT is used
|
||||||
|
} PPMode;
|
||||||
|
|
||||||
|
typedef struct PPContext{
|
||||||
|
uint8_t *tempBlocks; //used for the horizontal code
|
||||||
|
|
||||||
|
/* we need 64bit here otherwise we´ll going to have a problem
|
||||||
|
after watching a black picture for 5 hours*/
|
||||||
|
uint64_t *yHistogram;
|
||||||
|
|
||||||
|
uint64_t __attribute__((aligned(8))) packedYOffset;
|
||||||
|
uint64_t __attribute__((aligned(8))) packedYScale;
|
||||||
|
|
||||||
|
/* Temporal noise reducing buffers */
|
||||||
|
uint8_t *tempBlured[3];
|
||||||
|
int32_t *tempBluredPast[3];
|
||||||
|
|
||||||
|
/* Temporary buffers for handling the last row(s) */
|
||||||
|
uint8_t *tempDst;
|
||||||
|
uint8_t *tempSrc;
|
||||||
|
|
||||||
|
/* Temporary buffers for handling the last block */
|
||||||
|
uint8_t *tempDstBlock;
|
||||||
|
uint8_t *tempSrcBlock;
|
||||||
|
uint8_t *deintTemp;
|
||||||
|
|
||||||
|
uint64_t __attribute__((aligned(8))) pQPb;
|
||||||
|
uint64_t __attribute__((aligned(8))) pQPb2;
|
||||||
|
|
||||||
|
uint64_t __attribute__((aligned(8))) mmxDcOffset[32];
|
||||||
|
uint64_t __attribute__((aligned(8))) mmxDcThreshold[32];
|
||||||
|
|
||||||
|
QP_STORE_T *nonBQPTable;
|
||||||
|
|
||||||
|
int QP;
|
||||||
|
int nonBQP;
|
||||||
|
|
||||||
|
int frameNum;
|
||||||
|
|
||||||
|
int cpuCaps;
|
||||||
|
|
||||||
|
PPMode ppMode;
|
||||||
|
} PPContext;
|
||||||
|
|
Loading…
Reference in New Issue