1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-28 01:52:19 +00:00

postprocessing cleanup:

remove opendivx #ifdefs
remove rk1 filter
remove unused / obsolete stuff
add -1,4,2,4,-1 deinterlacing filter (ffmpeg uses that)
threadsafe / no more non-const globals
some optimizations
different strides for Y,U,V possible
remove ebx usage (someone really should fix gcc, this is really lame)
change the dering filter slightly (tell me if its worse for any files)


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7947 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
michael 2002-10-28 19:31:04 +00:00
parent a64160a3bd
commit 2d28fdd64c
10 changed files with 747 additions and 885 deletions

View File

@ -40,7 +40,7 @@ OBJS_MPLAYER = $(SRCS_MPLAYER:.c=.o)
VO_LIBS = $(SDL_LIB) $(GGI_LIB) $(AA_LIB) $(X_LIB) $(MP1E_LIB) $(MLIB_LIB) $(SVGA_LIB) $(DIRECTFB_LIB) $(GIF_LIB)
AO_LIBS = $(ARTS_LIB) $(NAS_LIB) $(SGIAUDIO_LIB)
CODEC_LIBS = $(AV_LIB) $(FAME_LIB) $(MAD_LIB) $(VORBIS_LIB) $(FAAD_LIB) $(LZO_LIB) $(XVID_LIB) $(DECORE_LIB) $(PNG_LIB) $(Z_LIB) $(JPEG_LIB) $(ALSA_LIB)
COMMON_LIBS = libmpcodecs/libmpcodecs.a mp3lib/libMP3.a liba52/liba52.a libmpeg2/libmpeg2.a $(W32_LIB) $(DS_LIB) libaf/libaf.a libmpdemux/libmpdemux.a input/libinput.a postproc/libpostproc.a linux/libosdep.a $(CSS_LIB) $(CODEC_LIBS) $(FREETYPE_LIB) $(TERMCAP_LIB) $(CDPARANOIA_LIB) $(STREAMING_LIB) $(WIN32_LIB)
COMMON_LIBS = libmpcodecs/libmpcodecs.a mp3lib/libMP3.a liba52/liba52.a libmpeg2/libmpeg2.a $(W32_LIB) $(DS_LIB) libaf/libaf.a libmpdemux/libmpdemux.a input/libinput.a $(PP_LIB) postproc/libswscale.a linux/libosdep.a $(CSS_LIB) $(CODEC_LIBS) $(FREETYPE_LIB) $(TERMCAP_LIB) $(CDPARANOIA_LIB) $(STREAMING_LIB) $(WIN32_LIB)
CFLAGS = $(OPTFLAGS) -Ilibmpdemux -Iloader -Ilibvo $(EXTRA_INC) $(CDPARANOIA_INC) $(FREETYPE_INC) $(SDL_INC) # -Wall
@ -73,7 +73,12 @@ ifeq ($(CSS_USE),yes)
ALL_PRG += $(PRG_FIBMAP)
endif
COMMON_DEPS = $(W32_DEP) $(DS_DEP) $(MP1E_DEP) $(AV_DEP) libmpdemux/libmpdemux.a libmpcodecs/libmpcodecs.a libao2/libao2.a liba52/liba52.a mp3lib/libMP3.a libmpeg2/libmpeg2.a linux/libosdep.a postproc/libpostproc.a input/libinput.a libvo/libvo.a libaf/libaf.a
COMMON_DEPS = $(W32_DEP) $(DS_DEP) $(MP1E_DEP) $(AV_DEP) libmpdemux/libmpdemux.a libmpcodecs/libmpcodecs.a libao2/libao2.a liba52/liba52.a mp3lib/libMP3.a libmpeg2/libmpeg2.a linux/libosdep.a postproc/libswscale.a input/libinput.a libvo/libvo.a libaf/libaf.a
ifeq (($SHARED_PP),yes)
COMMON_DEPS += postproc/libpostproc.so
else
COMMON_DEPS += postproc/libpostproc.a
endif
ifeq ($(VIDIX),yes)
COMMON_DEPS += libdha/libdha.so vidix/libvidix.a
@ -158,9 +163,15 @@ Gui/libgui.a:
linux/libosdep.a:
$(MAKE) -C linux
postproc/libswscale.a:
$(MAKE) -C postproc
postproc/libpostproc.a:
$(MAKE) -C postproc
postproc/libpostproc.so:
$(MAKE) -C postproc
input/libinput.a:
$(MAKE) -C input
@ -200,6 +211,9 @@ $(PRG_CFG): version.h codec-cfg.c codec-cfg.h
install: $(ALL_PRG)
ifeq ($(VIDIX),yes)
$(DO_MAKE)
endif
ifeq ($(SHARED_PP),yes)
$(MAKE) install -C postproc
endif
if test ! -d $(BINDIR) ; then mkdir -p $(BINDIR) ; fi
$(INSTALL) -m 755 $(INSTALLSTRIP) $(PRG) $(BINDIR)/$(PRG)

View File

@ -135,7 +135,6 @@
{"divxq", "Option -divxq has been renamed to -pp (postprocessing), use -pp !\n",
CONF_TYPE_PRINT, 0, 0, 0, NULL},
{"pp", readPPOpt, CONF_TYPE_FUNC_PARAM, 0, 0, 0, (cfg_default_func_t)&revertPPOpt},
{"npp", readNPPOpt, CONF_TYPE_FUNC_PARAM, 0, 0, 0, (cfg_default_func_t)&revertPPOpt},
#ifdef HAVE_ODIVX_POSTPROCESS
{"oldpp", &use_old_pp, CONF_TYPE_FLAG, 0, 0, 1, NULL},
#else

View File

@ -13,7 +13,6 @@ extern int use_old_pp;
extern int sws_flags;
extern int readPPOpt(void *, char *arg);
extern int readNPPOpt(void *conf, char *arg);
extern void revertPPOpt(void *conf, char* opt);
#ifdef HAVE_DIVX4ENCORE

View File

@ -153,7 +153,6 @@ struct config jpeg_conf[]={
extern int sws_flags;
extern int readPPOpt(void *conf, char *arg);
extern int readNPPOpt(void *conf, char *arg);
extern void revertPPOpt(void *conf, char* opt);
@ -357,7 +356,7 @@ static config_t mplayer_opts[]={
{"dumpmicrodvdsub", &stream_dump_type, CONF_TYPE_FLAG, 0, 0, 7, NULL},
#ifdef HAVE_LIRC
{"lircconf", &lirc_configfile, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL},
{"lircconf", &lirc_configfile, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL},
#endif
{"gui", &use_gui, CONF_TYPE_FLAG, CONF_GLOBAL|CONF_NOCMD, 0, 1, NULL},

15
configure vendored
View File

@ -216,6 +216,7 @@ Miscellaneous options:
options with --enable-static="-lslang -lncurses"
--language=xx select a language (for translated messages/gui) [en]
(Available: $LANGUAGES)
--enabled-shared-pp install & use shared postprocessing lib
Advanced options:
--enable-mmx build with mmx support [autodetect]
@ -1006,6 +1007,7 @@ _libdv=auto
_cdparanoia=auto
_big_endian=auto
_freetype=no
_shared_pp=no
for ac_option do
case "$ac_option" in
@ -1181,6 +1183,9 @@ for ac_option do
--enable-dga=*) _dga=`echo $ac_option | cut -d '=' -f 2` ;;
--disable-dga) _dga=no ;;
--enable-shared-pp) _shared_pp=yes ;;
--disable-shared-pp) _shared_pp=no ;;
--language=*)
LINGUAS=`echo $ac_option | cut -d '=' -f 2`
;;
@ -4164,6 +4169,14 @@ else
fi
echores "$_byte_order"
echocheck "shared postprocess lib"
if test "$_shared_pp" = yes ; then
_ld_pp='-lpostproc'
else
_ld_pp='postproc/libpostproc.a'
fi
echores "$_shared_pp"
# --------------- GUI specific tests begin -------------------
echocheck "GUI"
echo "$_gui"
@ -4431,6 +4444,8 @@ STREAMING = $_streaming
STREAMING_LIVE_DOT_COM = $_live
STREAMING_LIB = $_ld_streaming $_ld_live
VIDIX = $_vidix
PP_LIB = $_ld_pp
SHARED_PP = $_shared_pp
OPENDIVX = $_opendivx

View File

@ -1,6 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include "../config.h"
#include "../mp_msg.h"
@ -12,7 +13,9 @@
#include "../postproc/postprocess.h"
struct vf_priv_s {
unsigned int pp;
int pp;
PPMode ppMode[GET_PP_QUALITY_MAX+1];
void *context;
mp_image_t *dmpi;
unsigned int outfmt;
};
@ -22,6 +25,10 @@ struct vf_priv_s {
static int config(struct vf_instance_s* vf,
int width, int height, int d_width, int d_height,
unsigned int voflags, unsigned int outfmt){
if(vf->priv->context) freePPContext(vf->priv->context);
vf->priv->context= getPPContext(width, height);
return vf_next_config(vf,width,height,d_width,d_height,voflags,vf->priv->outfmt);
}
@ -40,7 +47,7 @@ static int control(struct vf_instance_s* vf, int request, void* data){
case VFCTRL_QUERY_MAX_PP_LEVEL:
return GET_PP_QUALITY_MAX;
case VFCTRL_SET_PP_LEVEL:
vf->priv->pp=getPpModeForQuality(*((unsigned int*)data));
vf->priv->pp= *((unsigned int*)data);
return CONTROL_TRUE;
}
return vf_next_control(vf,request,data);
@ -80,11 +87,11 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){
if(vf->priv->pp || !(mpi->flags&MP_IMGFLAG_DIRECT)){
// do the postprocessing! (or copy if no DR)
postprocess(mpi->planes,mpi->stride[0],
vf->priv->dmpi->planes,vf->priv->dmpi->stride[0],
postprocess(mpi->planes ,mpi->stride,
vf->priv->dmpi->planes,vf->priv->dmpi->stride,
(mpi->w+7)&(~7),mpi->h,
mpi->qscale, mpi->qstride,
vf->priv->pp);
&vf->priv->ppMode[ vf->priv->pp ], vf->priv->context);
}
return vf_next_put_image(vf,vf->priv->dmpi);
@ -102,7 +109,10 @@ static unsigned int fmt_list[]={
};
static int open(vf_instance_t *vf, char* args){
char *endptr;
char *endptr, *name;
int i;
int hex_mode=0;
vf->query_format=query_format;
vf->control=control;
vf->config=config;
@ -116,10 +126,45 @@ static int open(vf_instance_t *vf, char* args){
if(!vf->priv->outfmt) return 0; // no csp match :(
if(args){
vf->priv->pp=strtol(args, &endptr, 0);
if(!(*endptr)) return 1;
if(!strcmp("help", args)){
printf("%s", postproc_help);
exit(1);
}
hex_mode= strtol(args, &endptr, 0);
if(*endptr){
name= args;
}else
name= NULL;
}else{
name="de";
}
vf->priv->pp=divx_quality;
if(name){
for(i=0; i<=GET_PP_QUALITY_MAX; i++){
vf->priv->ppMode[i]= getPPModeByNameAndQuality(name, i);
if(vf->priv->ppMode[i].error) return -1;
}
}else{
/* hex mode for compatibility */
for(i=0; i<=GET_PP_QUALITY_MAX; i++){
PPMode ppMode;
ppMode.lumMode= hex_mode;
ppMode.chromMode= ((hex_mode&0xFF)>>4) | (hex_mode&0xFFFFFF00);
ppMode.maxTmpNoise[0]= 700;
ppMode.maxTmpNoise[1]= 1500;
ppMode.maxTmpNoise[2]= 3000;
ppMode.maxAllowedY= 234;
ppMode.minAllowedY= 16;
ppMode.maxDcDiff= 1;
ppMode.flatnessThreshold=40;
vf->priv->ppMode[i]= ppMode;
}
}
vf->priv->pp=GET_PP_QUALITY_MAX; //divx_quality;
return 1;
}

View File

@ -1,10 +1,15 @@
include ../config.mak
LIBNAME = libpostproc.a
SWSLIB = libswscale.a
SPPLIB = libpostproc.so
SPPVERSION = 0.0.1
PPLIB = libpostproc.a
SRCS=postprocess.c swscale.c rgb2rgb.c yuv2rgb.c
OBJS=$(SRCS:.c=.o)
SWSSRCS=swscale.c rgb2rgb.c yuv2rgb.c
SWSOBJS=$(SWSSRCS:.c=.o)
PPOBJS=postprocess.o
SPPOBJS=postprocess_pic.o
CS_TEST_OBJS=cs_test.o rgb2rgb.o ../cpudetect.o ../mp_msg.o
CFLAGS = $(OPTFLAGS) $(MLIB_INC) -I. -I.. $(EXTRA_INC)
@ -17,16 +22,16 @@ CFLAGS = $(OPTFLAGS) $(MLIB_INC) -I. -I.. $(EXTRA_INC)
.c.o:
$(CC) -c $(CFLAGS) -o $@ $<
$(LIBNAME): $(OBJS)
$(AR) r $(LIBNAME) $(OBJS)
all: $(SWSLIB) $(PPLIB) $(SPPLIB)
all: $(LIBNAME)
$(SWSLIB): $(SWSOBJS)
$(AR) r $(SWSLIB) $(SWSOBJS)
clean:
rm -f *.o *.a *~
rm -f *.o *.a *~ *.so
distclean:
rm -f Makefile.bak *.o *.a *~ .depend
rm -f Makefile.bak *.o *.a *~ *.so .depend
dep: depend
@ -36,6 +41,27 @@ depend:
cs_test: $(CS_TEST_OBJS)
$(CC) $(CS_TEST_OBJS) -o cs_test
postprocess_pic.o: postprocess.c
$(CC) -c $(CFLAGS) -fPIC -DPIC -o $@ $<
$(SPPLIB): $(SPPOBJS)
$(CC) -shared -Wl,-soname,$(SPPLIB).0 \
-o $(SPPLIB) $(SPPOBJS)
$(PPLIB): $(PPOBJS)
$(AR) r $(PPLIB) $(PPOBJS)
install: all
ifeq ($(SHARED_PP),yes)
install -d $(prefix)/lib
install -s -m 755 $(SPPLIB) $(prefix)/lib/$(SPPLIB).$(SPPVERSION)
ln -sf $(SPPLIB).$(SPPVERSION) $(prefix)/lib/$(SPPLIB)
ldconfig || true
mkdir -p $(prefix)/include/postproc
install -m 644 postprocess.h $(prefix)/include/postproc/postprocess.h
endif
#
# include dependency files if they exist
#

View File

@ -49,7 +49,6 @@ c = checked against the other implementations (-vo md5)
TODO:
remove global/static vars
reduce the time wasted on the mem transfer
implement everything in C at least (done at the moment but ...)
unroll stuff if instructions depend too much on the prior one
we use 8x8 blocks for the horizontal filters, opendivx seems to use 8x4?
move YScale thing to the end instead of fixing QP
@ -58,13 +57,9 @@ make the mainloop more flexible (variable number of blocks at once
(the if/else stuff per block is slowing things down)
compare the quality & speed of all filters
split this huge file
border remover
optimize c versions
try to unroll inner for(x=0 ... loop to avoid these damn if(x ... checks
smart blur
commandline option for the deblock / dering thresholds
put fastmemcpy back
dont use #ifdef ARCH_X86 for the asm stuff ... cross compilers? (note cpudetect uses ARCH_X86)
...
*/
@ -84,7 +79,7 @@ dont use #ifdef ARCH_X86 for the asm stuff ... cross compilers? (note cpudetect
//#undef HAVE_MMX
//#undef ARCH_X86
//#define DEBUG_BRIGHTNESS
//#include "../libvo/fastmemcpy.h"
#include "../libvo/fastmemcpy.h"
#include "postprocess.h"
#include "../cpudetect.h"
#include "../mangle.h"
@ -96,79 +91,83 @@ dont use #ifdef ARCH_X86 for the asm stuff ... cross compilers? (note cpudetect
#define GET_MODE_BUFFER_SIZE 500
#define OPTIONS_ARRAY_SIZE 10
#define BLOCK_SIZE 8
#define TEMP_STRIDE 8
//#define NUM_BLOCKS_AT_ONCE 16 //not used yet
#ifdef ARCH_X86
#define CAN_COMPILE_X86_ASM
#endif
#ifdef CAN_COMPILE_X86_ASM
static volatile uint64_t __attribute__((aligned(8))) packedYOffset= 0x0000000000000000LL;
static volatile uint64_t __attribute__((aligned(8))) packedYScale= 0x0100010001000100LL;
static uint64_t __attribute__((aligned(8))) w05= 0x0005000500050005LL;
static uint64_t __attribute__((aligned(8))) w20= 0x0020002000200020LL;
static uint64_t __attribute__((aligned(8))) w1400= 0x1400140014001400LL;
static uint64_t __attribute__((aligned(8))) bm00000001= 0x00000000000000FFLL;
static uint64_t __attribute__((aligned(8))) bm00010000= 0x000000FF00000000LL;
static uint64_t __attribute__((aligned(8))) bm00001000= 0x00000000FF000000LL;
static uint64_t __attribute__((aligned(8))) bm10000000= 0xFF00000000000000LL;
static uint64_t __attribute__((aligned(8))) bm10000001= 0xFF000000000000FFLL;
static uint64_t __attribute__((aligned(8))) bm11000011= 0xFFFF00000000FFFFLL;
static uint64_t __attribute__((aligned(8))) bm00000011= 0x000000000000FFFFLL;
static uint64_t __attribute__((aligned(8))) bm11111110= 0xFFFFFFFFFFFFFF00LL;
static uint64_t __attribute__((aligned(8))) bm11000000= 0xFFFF000000000000LL;
static uint64_t __attribute__((aligned(8))) bm00011000= 0x000000FFFF000000LL;
static uint64_t __attribute__((aligned(8))) bm00110011= 0x0000FFFF0000FFFFLL;
static uint64_t __attribute__((aligned(8))) bm11001100= 0xFFFF0000FFFF0000LL;
static uint64_t __attribute__((aligned(8))) b00= 0x0000000000000000LL;
static uint64_t __attribute__((aligned(8))) b01= 0x0101010101010101LL;
static uint64_t __attribute__((aligned(8))) b02= 0x0202020202020202LL;
static uint64_t __attribute__((aligned(8))) b0F= 0x0F0F0F0F0F0F0F0FLL;
static uint64_t __attribute__((aligned(8))) b04= 0x0404040404040404LL;
static uint64_t __attribute__((aligned(8))) b08= 0x0808080808080808LL;
static uint64_t __attribute__((aligned(8))) bFF= 0xFFFFFFFFFFFFFFFFLL;
static uint64_t __attribute__((aligned(8))) b20= 0x2020202020202020LL;
static uint64_t __attribute__((aligned(8))) b80= 0x8080808080808080LL;
static uint64_t __attribute__((aligned(8))) mmxDCOffset= 0x7E7E7E7E7E7E7E7ELL;
static uint64_t __attribute__((aligned(8))) mmxDCThreshold= 0x7C7C7C7C7C7C7C7CLL;
static uint64_t __attribute__((aligned(8))) b3F= 0x3F3F3F3F3F3F3F3FLL;
static uint64_t __attribute__((aligned(8))) temp0=0;
static uint64_t __attribute__((aligned(8))) temp1=0;
static uint64_t __attribute__((aligned(8))) temp2=0;
static uint64_t __attribute__((aligned(8))) temp3=0;
static uint64_t __attribute__((aligned(8))) temp4=0;
static uint64_t __attribute__((aligned(8))) temp5=0;
static uint64_t __attribute__((aligned(8))) pQPb=0;
static uint64_t __attribute__((aligned(8))) pQPb2=0;
static uint8_t __attribute__((aligned(8))) tempBlocks[8*16*2]; //used for the horizontal code
static uint32_t __attribute__((aligned(4))) maxTmpNoise[4];
#else
static uint64_t packedYOffset= 0x0000000000000000LL;
static uint64_t packedYScale= 0x0100010001000100LL;
#endif
extern int divx_quality;
int newPPFlag=0; //is set if -npp is used
struct PPMode gPPMode[GET_PP_QUALITY_MAX+1];
static int firstTime = 0, firstTime2 = 0;
static int firstTime2 = 0;
extern int verbose;
int hFlatnessThreshold= 56 - 16;
int vFlatnessThreshold= 56 - 16;
int deringThreshold= 20;
static int dcOffset;
static int dcThreshold;
//amount of "black" u r willing to loose to get a brightness corrected picture
double maxClippedThreshold= 0.01;
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;
uint64_t __attribute__((aligned(8))) mmxDcThreshold;
int QP;
int dcOffset;
int dcThreshold;
int frameNum;
PPMode ppMode;
} PPContext;
static struct PPFilter filters[]=
{
{"hb", "hdeblock", 1, 1, 3, H_DEBLOCK},
{"vb", "vdeblock", 1, 2, 4, V_DEBLOCK},
{"hr", "rkhdeblock", 1, 1, 3, H_RK1_FILTER},
{"vr", "rkvdeblock", 1, 2, 4, V_RK1_FILTER},
/* {"hr", "rkhdeblock", 1, 1, 3, H_RK1_FILTER},
{"vr", "rkvdeblock", 1, 2, 4, V_RK1_FILTER},*/
{"h1", "x1hdeblock", 1, 1, 3, H_X1_FILTER},
{"v1", "x1vdeblock", 1, 2, 4, V_X1_FILTER},
{"dr", "dering", 1, 5, 6, DERING},
@ -177,6 +176,7 @@ static struct PPFilter filters[]=
{"li", "linipoldeint", 1, 1, 4, LINEAR_IPOL_DEINT_FILTER},
{"ci", "cubicipoldeint", 1, 1, 4, CUBIC_IPOL_DEINT_FILTER},
{"md", "mediandeint", 1, 1, 4, MEDIAN_DEINT_FILTER},
{"fd", "ffmpegdeint", 1, 1, 4, FFMPEG_DEINT_FILTER},
{"tn", "tmpnoise", 1, 7, 8, TEMP_NOISE_FILTER},
{"fq", "forcequant", 1, 0, 0, FORCE_QUANT},
{NULL, NULL,0,0,0,0} //End Marker
@ -191,19 +191,13 @@ static char *replaceTable[]=
NULL //End Marker
};
#ifdef CAN_COMPILE_X86_ASM
#ifdef ARCH_X86
static inline void unusedVariableWarningFixer()
{
if(
packedYOffset + packedYScale + w05 + w20 + w1400 + bm00000001 + bm00010000
+ bm00001000 + bm10000000 + bm10000001 + bm11000011 + bm00000011 + bm11111110
+ bm11000000 + bm00011000 + bm00110011 + bm11001100 + b00 + b01 + b02 + b0F
+ bFF + b20 + b04+ b08 + pQPb2 + b80 + mmxDCOffset + mmxDCThreshold + b3F + temp0 + temp1 + temp2 + temp3 + temp4
+ temp5 + pQPb== 0) b00=0;
if(w05 + w20 + b00 + b01 + b02 + b08 + b80 == 0) b00=0;
}
#endif
#ifdef TIMING
static inline long long rdtsc()
{
long long l;
@ -213,9 +207,8 @@ static inline long long rdtsc()
// printf("%d\n", int(l/1000));
return l;
}
#endif
#ifdef CAN_COMPILE_X86_ASM
#ifdef ARCH_X86
static inline void prefetchnta(void *p)
{
asm volatile( "prefetchnta (%0)\n\t"
@ -250,22 +243,48 @@ static inline void prefetcht2(void *p)
/**
* Check if the given 8x8 Block is mostly "flat"
*/
static inline int isHorizDC(uint8_t src[], int stride)
static inline int isHorizDC(uint8_t src[], int stride, PPContext *c)
{
int numEq= 0;
int y;
const int dcOffset= c->dcOffset;
const int dcThreshold= c->dcThreshold;
for(y=0; y<BLOCK_SIZE; y++)
{
if(((src[0] - src[1] + dcOffset) & 0xFFFF) < dcThreshold) numEq++;
if(((src[1] - src[2] + dcOffset) & 0xFFFF) < dcThreshold) numEq++;
if(((src[2] - src[3] + dcOffset) & 0xFFFF) < dcThreshold) numEq++;
if(((src[3] - src[4] + dcOffset) & 0xFFFF) < dcThreshold) numEq++;
if(((src[4] - src[5] + dcOffset) & 0xFFFF) < dcThreshold) numEq++;
if(((src[5] - src[6] + dcOffset) & 0xFFFF) < dcThreshold) numEq++;
if(((src[6] - src[7] + dcOffset) & 0xFFFF) < dcThreshold) numEq++;
if(((unsigned)(src[0] - src[1] + dcOffset)) < dcThreshold) numEq++;
if(((unsigned)(src[1] - src[2] + dcOffset)) < dcThreshold) numEq++;
if(((unsigned)(src[2] - src[3] + dcOffset)) < dcThreshold) numEq++;
if(((unsigned)(src[3] - src[4] + dcOffset)) < dcThreshold) numEq++;
if(((unsigned)(src[4] - src[5] + dcOffset)) < dcThreshold) numEq++;
if(((unsigned)(src[5] - src[6] + dcOffset)) < dcThreshold) numEq++;
if(((unsigned)(src[6] - src[7] + dcOffset)) < dcThreshold) numEq++;
src+= stride;
}
return numEq > hFlatnessThreshold;
return numEq > c->ppMode.flatnessThreshold;
}
/**
* Check if the middle 8x8 Block in the given 8x16 block is flat
*/
static inline int isVertDC_C(uint8_t src[], int stride, PPContext *c){
int numEq= 0;
int y;
const int dcOffset= c->dcOffset;
const int dcThreshold= c->dcThreshold;
src+= stride*4; // src points to begin of the 8x8 Block
for(y=0; y<BLOCK_SIZE-1; y++)
{
if(((unsigned)(src[0] - src[0+stride] + dcOffset)) < dcThreshold) numEq++;
if(((unsigned)(src[1] - src[1+stride] + dcOffset)) < dcThreshold) numEq++;
if(((unsigned)(src[2] - src[2+stride] + dcOffset)) < dcThreshold) numEq++;
if(((unsigned)(src[3] - src[3+stride] + dcOffset)) < dcThreshold) numEq++;
if(((unsigned)(src[4] - src[4+stride] + dcOffset)) < dcThreshold) numEq++;
if(((unsigned)(src[5] - src[5+stride] + dcOffset)) < dcThreshold) numEq++;
if(((unsigned)(src[6] - src[6+stride] + dcOffset)) < dcThreshold) numEq++;
if(((unsigned)(src[7] - src[7+stride] + dcOffset)) < dcThreshold) numEq++;
src+= stride;
}
return numEq > c->ppMode.flatnessThreshold;
}
static inline int isHorizMinMaxOk(uint8_t src[], int stride, int QP)
@ -422,7 +441,7 @@ static inline void horizX1Filter(uint8_t *src, int stride, int QP)
#define COMPILE_C
#endif
#ifdef CAN_COMPILE_X86_ASM
#ifdef ARCH_X86
#if (defined (HAVE_MMX) && !defined (HAVE_3DNOW) && !defined (HAVE_MMX2)) || defined (RUNTIME_CPUDETECT)
#define COMPILE_MMX
@ -435,7 +454,7 @@ static inline void horizX1Filter(uint8_t *src, int stride, int QP)
#if (defined (HAVE_3DNOW) && !defined (HAVE_MMX2)) || defined (RUNTIME_CPUDETECT)
#define COMPILE_3DNOW
#endif
#endif //CAN_COMPILE_X86_ASM
#endif //ARCH_X86
#undef HAVE_MMX
#undef HAVE_MMX2
@ -487,50 +506,47 @@ 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
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, struct PPMode *ppMode)
QP_STORE_T QPs[], int QPStride, int isColor, PPMode *ppMode, void *vc)
{
PPContext *c= (PPContext *)vc;
c->ppMode= *ppMode; //FIXME
// useing ifs here as they are faster than function pointers allthough the
// difference wouldnt be messureable here but its much better because
// someone might exchange the cpu whithout restarting mplayer ;)
#ifdef RUNTIME_CPUDETECT
#ifdef CAN_COMPILE_X86_ASM
#ifdef ARCH_X86
// ordered per speed fasterst first
if(gCpuCaps.hasMMX2)
postProcess_MMX2(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, ppMode);
postProcess_MMX2(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
else if(gCpuCaps.has3DNow)
postProcess_3DNow(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, ppMode);
postProcess_3DNow(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
else if(gCpuCaps.hasMMX)
postProcess_MMX(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, ppMode);
postProcess_MMX(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
else
postProcess_C(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, ppMode);
postProcess_C(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
#else
postProcess_C(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, ppMode);
postProcess_C(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
#endif
#else //RUNTIME_CPUDETECT
#ifdef HAVE_MMX2
postProcess_MMX2(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, ppMode);
postProcess_MMX2(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
#elif defined (HAVE_3DNOW)
postProcess_3DNow(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, ppMode);
postProcess_3DNow(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
#elif defined (HAVE_MMX)
postProcess_MMX(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, ppMode);
postProcess_MMX(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
#else
postProcess_C(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, ppMode);
postProcess_C(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
#endif
#endif //!RUNTIME_CPUDETECT
}
#ifdef HAVE_ODIVX_POSTPROCESS
#include "../opendivx/postprocess.h"
int use_old_pp=0;
#endif
//static void postProcess(uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height,
// QP_STORE_T QPs[], int QPStride, int isColor, struct PPMode *ppMode);
/* -pp Command line Help
NOTE/FIXME: put this at an appropriate place (--help, html docs, man mplayer)?
*/
char *help=
char *postproc_help=
"-npp <filterName>[:<option>[:<option>...]][,[-]<filterName>[:<option>...]]...\n"
"long form example:\n"
"-npp vdeblock:autoq,hdeblock:autoq,linblenddeint -npp default,-vdeblock\n"
@ -549,8 +565,6 @@ char *help=
" the h & v deblocking filters share these\n"
" so u cant set different thresholds for h / v\n"
"vb vdeblock (2 Threshold) vertical deblocking filter\n"
"hr rkhdeblock\n"
"vr rkvdeblock\n"
"h1 x1hdeblock Experimental h deblock filter 1\n"
"v1 x1vdeblock Experimental v deblock filter 1\n"
"dr dering Deringing filter\n"
@ -560,6 +574,7 @@ char *help=
"li linipoldeint linear interpolating deinterlace\n"
"ci cubicipoldeint cubic interpolating deinterlacer\n"
"md mediandeint median deinterlacer\n"
"fd ffmpegdeint ffmpeg deinterlacer\n"
"de default hb:a,vb:a,dr:a,al\n"
"fa fast h1:a,v1:a,dr:a,al\n"
"tn tmpnoise (3 Thresholds) Temporal Noise Reducer\n"
@ -576,11 +591,13 @@ struct PPMode getPPModeByNameAndQuality(char *name, int quality)
{
char temp[GET_MODE_BUFFER_SIZE];
char *p= temp;
char *filterDelimiters= ",";
char *filterDelimiters= ",/";
char *optionDelimiters= ":";
struct PPMode ppMode= {0,0,0,0,0,0,{150,200,400}};
struct PPMode ppMode= {0,0,0,0,0,{150,200,400}};
char *filterToken;
ppMode.flatnessThreshold= 56-16;
strncpy(temp, name, GET_MODE_BUFFER_SIZE);
if(verbose>1) printf("pp: %s\n", name);
@ -720,8 +737,7 @@ struct PPMode getPPModeByNameAndQuality(char *name, int quality)
numOfUnknownOptions--;
if(o==0) ppMode.maxDcDiff= val;
else hFlatnessThreshold=
vFlatnessThreshold= val;
else ppMode.flatnessThreshold= val;
}
}
else if(filters[i].mask == FORCE_QUANT)
@ -745,46 +761,59 @@ struct PPMode getPPModeByNameAndQuality(char *name, int quality)
ppMode.error += numOfUnknownOptions;
}
#ifdef HAVE_ODIVX_POSTPROCESS
if(ppMode.lumMode & H_DEBLOCK) ppMode.oldMode |= PP_DEBLOCK_Y_H;
if(ppMode.lumMode & V_DEBLOCK) ppMode.oldMode |= PP_DEBLOCK_Y_V;
if(ppMode.chromMode & H_DEBLOCK) ppMode.oldMode |= PP_DEBLOCK_C_H;
if(ppMode.chromMode & V_DEBLOCK) ppMode.oldMode |= PP_DEBLOCK_C_V;
if(ppMode.lumMode & DERING) ppMode.oldMode |= PP_DERING_Y;
if(ppMode.chromMode & DERING) ppMode.oldMode |= PP_DERING_C;
#endif
if(verbose>1) printf("pp: lumMode=%X, chromMode=%X\n", ppMode.lumMode, ppMode.chromMode);
return ppMode;
}
/**
* Check and load the -npp part of the cmd line
*/
int readNPPOpt(void *conf, char *arg)
{
int quality;
if(!strcmp("help", arg))
void *getPPContext(int width, int height){
PPContext *c= memalign(32, sizeof(PPContext));
int i;
c->tempBlocks= (uint8_t*)memalign(8, 2*16*8);
c->yHistogram= (uint64_t*)memalign(8, 256*sizeof(uint64_t));
for(i=0; i<256; i++)
c->yHistogram[i]= width*height/64*15/256;
for(i=0; i<3; i++)
{
printf("%s", help);
exit(1);
//Note:the +17*1024 is just there so i dont have to worry about r/w over te end
c->tempBlured[i]= (uint8_t*)memalign(8, ((width+7)&(~7))*2*((height+7)&(~7)) + 17*1024); //FIXME dstStride instead of width
c->tempBluredPast[i]= (uint32_t*)memalign(8, 256*((height+7)&(~7))/2 + 17*1024);
memset(c->tempBlured[i], 0, ((width+7)&(~7))*2*((height+7)&(~7)) + 17*1024);
memset(c->tempBluredPast[i], 0, 256*((height+7)&(~7))/2 + 17*1024);
}
for(quality=0; quality<GET_PP_QUALITY_MAX+1; quality++)
{
gPPMode[quality]= getPPModeByNameAndQuality(arg, quality);
c->tempDst= (uint8_t*)memalign(8, 1024*24);
c->tempSrc= (uint8_t*)memalign(8, 1024*24);
c->tempDstBlock= (uint8_t*)memalign(8, 1024*24);
c->tempSrcBlock= (uint8_t*)memalign(8, 1024*24);
c->deintTemp= (uint8_t*)memalign(8, width+16);
if(gPPMode[quality].error) return -1;
}
newPPFlag=1;
c->frameNum=-1;
//divx_quality is passed to postprocess if autoq if off
divx_quality= GET_PP_QUALITY_MAX;
firstTime = firstTime2 = 1;
return 1;
return c;
}
void freePPContext(void *vc){
PPContext *c = (PPContext*)vc;
int i;
for(i=0; i<3; i++) free(c->tempBlured[i]);
for(i=0; i<3; i++) free(c->tempBluredPast[i]);
free(c->tempBlocks);
free(c->yHistogram);
free(c->tempDst);
free(c->tempSrc);
free(c->tempDstBlock);
free(c->tempSrcBlock);
free(c->deintTemp);
free(c);
}
//FIXME move this shit away from here
int readPPOpt(void *conf, char *arg)
{
int val;
@ -799,123 +828,31 @@ int readPPOpt(void *conf, char *arg)
return -3; // ERR_OUT_OF_RANGE
divx_quality = val;
firstTime = firstTime2 = 1;
firstTime2 = 1;
return 1;
}
void revertPPOpt(void *conf, char* opt)
{
newPPFlag=0;
divx_quality=0;
}
/**
* Obsolete, dont use it, use postprocess2() instead
* this will check newPPFlag automatically and use postprocess2 if it is set
* mode = quality if newPPFlag
*/
void postprocess(unsigned char * src[], int src_stride,
unsigned char * dst[], int dst_stride,
int horizontal_size, int vertical_size,
QP_STORE_T *QP_store, int QP_stride,
int mode)
{
struct PPMode ppMode;
static QP_STORE_T zeroArray[2048/8];
if(newPPFlag)
{
ppMode= gPPMode[mode];
// printf("%d \n",QP_store[5]);
postprocess2(src, src_stride, dst, dst_stride,
horizontal_size, vertical_size, QP_store, QP_stride, &ppMode);
return;
}
if(firstTime && verbose)
{
printf("using pp filters 0x%X\n", mode);
firstTime=0;
}
if(QP_store==NULL)
{
QP_store= zeroArray;
QP_stride= 0;
}
ppMode.lumMode= mode;
mode= ((mode&0xFF)>>4) | (mode&0xFFFFFF00);
ppMode.chromMode= mode;
ppMode.maxTmpNoise[0]= 700;
ppMode.maxTmpNoise[1]= 1500;
ppMode.maxTmpNoise[2]= 3000;
ppMode.maxAllowedY= 234;
ppMode.minAllowedY= 16;
ppMode.maxDcDiff= 1;
#ifdef HAVE_ODIVX_POSTPROCESS
// Note: I could make this shit outside of this file, but it would mean one
// more function call...
if(use_old_pp){
odivx_postprocess(src,src_stride,dst,dst_stride,horizontal_size,vertical_size,QP_store,QP_stride,mode);
return;
}
#endif
postProcess(src[0], src_stride, dst[0], dst_stride,
horizontal_size, vertical_size, QP_store, QP_stride, 0, &ppMode);
horizontal_size >>= 1;
vertical_size >>= 1;
src_stride >>= 1;
dst_stride >>= 1;
if(ppMode.chromMode)
{
postProcess(src[1], src_stride, dst[1], dst_stride,
horizontal_size, vertical_size, QP_store, QP_stride, 1, &ppMode);
postProcess(src[2], src_stride, dst[2], dst_stride,
horizontal_size, vertical_size, QP_store, QP_stride, 2, &ppMode);
}
else if(src_stride == dst_stride)
{
memcpy(dst[1], src[1], src_stride*vertical_size);
memcpy(dst[2], src[2], src_stride*vertical_size);
}
else
{
int y;
for(y=0; y<vertical_size; y++)
{
memcpy(&(dst[1][y*dst_stride]), &(src[1][y*src_stride]), horizontal_size);
memcpy(&(dst[2][y*dst_stride]), &(src[2][y*src_stride]), horizontal_size);
}
}
#if 0
memset(dst[1], 128, dst_stride*vertical_size);
memset(dst[2], 128, dst_stride*vertical_size);
#endif
}
void postprocess2(unsigned char * src[], int src_stride,
unsigned char * dst[], int dst_stride,
int horizontal_size, int vertical_size,
QP_STORE_T *QP_store, int QP_stride,
struct PPMode *mode)
void postprocess(uint8_t * src[3], int srcStride[3],
uint8_t * dst[3], int dstStride[3],
int horizontalSize, int verticalSize,
QP_STORE_T *QP_store, int QPStride,
PPMode *mode, void *c)
{
QP_STORE_T quantArray[2048/8];
if(QP_store==NULL || (mode->lumMode & FORCE_QUANT))
{
int i;
QP_store= quantArray;
QP_stride= 0;
QPStride= 0;
if(mode->lumMode & FORCE_QUANT)
for(i=0; i<2048/8; i++) quantArray[i]= mode->forcedQuant;
else
@ -928,89 +865,32 @@ void postprocess2(unsigned char * src[], int src_stride,
firstTime2=0;
}
#ifdef HAVE_ODIVX_POSTPROCESS
// Note: I could make this shit outside of this file, but it would mean one
// more function call...
if(use_old_pp){
odivx_postprocess(src,src_stride,dst,dst_stride,horizontal_size,vertical_size,QP_store,QP_stride,
mode->oldMode);
return;
}
#endif
postProcess(src[0], srcStride[0], dst[0], dstStride[0],
horizontalSize, verticalSize, QP_store, QPStride, 0, mode, c);
postProcess(src[0], src_stride, dst[0], dst_stride,
horizontal_size, vertical_size, QP_store, QP_stride, 0, mode);
horizontal_size >>= 1;
vertical_size >>= 1;
src_stride >>= 1;
dst_stride >>= 1;
horizontalSize = (horizontalSize+1)>> 1;
verticalSize = (verticalSize+1)>>1;
if(mode->chromMode)
{
postProcess(src[1], src_stride, dst[1], dst_stride,
horizontal_size, vertical_size, QP_store, QP_stride, 1, mode);
postProcess(src[2], src_stride, dst[2], dst_stride,
horizontal_size, vertical_size, QP_store, QP_stride, 2, mode);
postProcess(src[1], srcStride[1], dst[1], dstStride[1],
horizontalSize, verticalSize, QP_store, QPStride, 1, mode, c);
postProcess(src[2], srcStride[2], dst[2], dstStride[2],
horizontalSize, verticalSize, QP_store, QPStride, 2, mode, c);
}
else if(src_stride == dst_stride)
else if(srcStride[1] == dstStride[1] && srcStride[2] == dstStride[2])
{
memcpy(dst[1], src[1], src_stride*vertical_size);
memcpy(dst[2], src[2], src_stride*vertical_size);
memcpy(dst[1], src[1], srcStride[1]*verticalSize);
memcpy(dst[2], src[2], srcStride[2]*verticalSize);
}
else
{
int y;
for(y=0; y<vertical_size; y++)
for(y=0; y<verticalSize; y++)
{
memcpy(&(dst[1][y*dst_stride]), &(src[1][y*src_stride]), horizontal_size);
memcpy(&(dst[2][y*dst_stride]), &(src[2][y*src_stride]), horizontal_size);
memcpy(&(dst[1][y*dstStride[1]]), &(src[1][y*srcStride[1]]), horizontalSize);
memcpy(&(dst[2][y*dstStride[2]]), &(src[2][y*srcStride[2]]), horizontalSize);
}
}
}
/**
* gets the mode flags for a given quality (larger values mean slower but better postprocessing)
* with -npp it simply returns quality
* 0 <= quality <= 6
*/
int getPpModeForQuality(int quality){
int modes[1+GET_PP_QUALITY_MAX]= {
0,
#if 1
// horizontal filters first
LUM_H_DEBLOCK,
LUM_H_DEBLOCK | LUM_V_DEBLOCK,
LUM_H_DEBLOCK | LUM_V_DEBLOCK | CHROM_H_DEBLOCK,
LUM_H_DEBLOCK | LUM_V_DEBLOCK | CHROM_H_DEBLOCK | CHROM_V_DEBLOCK,
LUM_H_DEBLOCK | LUM_V_DEBLOCK | CHROM_H_DEBLOCK | CHROM_V_DEBLOCK | LUM_DERING,
LUM_H_DEBLOCK | LUM_V_DEBLOCK | CHROM_H_DEBLOCK | CHROM_V_DEBLOCK | LUM_DERING | CHROM_DERING
#else
// vertical filters first
LUM_V_DEBLOCK,
LUM_V_DEBLOCK | LUM_H_DEBLOCK,
LUM_V_DEBLOCK | LUM_H_DEBLOCK | CHROM_V_DEBLOCK,
LUM_V_DEBLOCK | LUM_H_DEBLOCK | CHROM_V_DEBLOCK | CHROM_H_DEBLOCK,
LUM_V_DEBLOCK | LUM_H_DEBLOCK | CHROM_V_DEBLOCK | CHROM_H_DEBLOCK | LUM_DERING,
LUM_V_DEBLOCK | LUM_H_DEBLOCK | CHROM_V_DEBLOCK | CHROM_H_DEBLOCK | LUM_DERING | CHROM_DERING
#endif
};
#ifdef HAVE_ODIVX_POSTPROCESS
int odivx_modes[1+GET_PP_QUALITY_MAX]= {
0,
PP_DEBLOCK_Y_H,
PP_DEBLOCK_Y_H|PP_DEBLOCK_Y_V,
PP_DEBLOCK_Y_H|PP_DEBLOCK_Y_V|PP_DEBLOCK_C_H,
PP_DEBLOCK_Y_H|PP_DEBLOCK_Y_V|PP_DEBLOCK_C_H|PP_DEBLOCK_C_V,
PP_DEBLOCK_Y_H|PP_DEBLOCK_Y_V|PP_DEBLOCK_C_H|PP_DEBLOCK_C_V|PP_DERING_Y,
PP_DEBLOCK_Y_H|PP_DEBLOCK_Y_V|PP_DEBLOCK_C_H|PP_DEBLOCK_C_V|PP_DERING_Y|PP_DERING_C
};
if(use_old_pp) return odivx_modes[quality];
#endif
if(newPPFlag) return quality;
else return modes[quality];
}

View File

@ -20,10 +20,6 @@
#ifndef NEWPOSTPROCESS_H
#define NEWPOSTPROCESS_H
#define BLOCK_SIZE 8
#define TEMP_STRIDE 8
//#define NUM_BLOCKS_AT_ONCE 16 //not used yet
#define V_DEBLOCK 0x01
#define H_DEBLOCK 0x02
#define DERING 0x04
@ -39,11 +35,9 @@
#define CHROM_LEVEL_FIX (LEVEL_FIX<<4) // 128 (not implemented yet)
// Experimental vertical filters
#define V_RK1_FILTER 0x0100 // 256
#define V_X1_FILTER 0x0200 // 512
// Experimental horizontal filters
#define H_RK1_FILTER 0x1000 // 4096
#define H_X1_FILTER 0x2000 // 8192
// select between full y range (255-0) or standart one (234-16)
@ -55,6 +49,7 @@
#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
@ -62,12 +57,6 @@
#define GET_PP_QUALITY_MAX 6
//must be defined if stride%8 != 0
//#define PP_FUNNY_STRIDE
//#define TIMING
//#define MORE_TIMING
//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
@ -76,10 +65,11 @@
#define QP_STORE_T int
struct PPMode{
char *postproc_help;
typedef struct PPMode{
int lumMode; //acivates filters for luminance
int chromMode; //acivates filters for chrominance
int oldMode; // will be passed to odivx
int error; // non zero on error
int minAllowedY; // for brigtness correction
@ -88,35 +78,22 @@ struct PPMode{
int maxTmpNoise[3]; // for Temporal Noise Reducing filter (Maximal sum of abs differences)
int maxDcDiff; // max abs diff between pixels to be considered flat
int flatnessThreshold;
int forcedQuant; // quantizer if FORCE_QUANT is used
};
} PPMode;
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
};
/* Obsolete, dont use it, use postprocess2() instead */
void postprocess(unsigned char * src[], int src_stride,
unsigned char * dst[], int dst_stride,
int horizontal_size, int vertical_size,
QP_STORE_T *QP_store, int QP_stride, int mode);
void postprocess2(unsigned char * src[], int src_stride,
unsigned char * dst[], int dst_stride,
int horizontal_size, int vertical_size,
QP_STORE_T *QP_store, int QP_stride, struct PPMode *mode);
/* Obsolete, dont use it, use getPpModeByNameAndQuality() instead */
int getPpModeForQuality(int quality);
void postprocess(uint8_t * src[3], int srcStride[3],
uint8_t * dst[3], int dstStride[3],
int horizontalSize, int verticalSize,
QP_STORE_T *QP_store, int QP_stride,
PPMode *mode, void *ppContext);
// name is the stuff after "-pp" on the command line
struct PPMode getPPModeByNameAndQuality(char *name, int quality);
PPMode getPPModeByNameAndQuality(char *name, int quality);
void *getPPContext(int width, int height);
void freePPContext(void *ppContext);
int readPPOpt(void *conf, char *arg);

File diff suppressed because it is too large Load Diff