diff options
author | albeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-01-19 17:01:03 +0000 |
---|---|---|
committer | albeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-01-19 17:01:03 +0000 |
commit | 01e9ed23bf2e20d79c4bc08fdb15427d146e6d7f (patch) | |
tree | eed674173faf82d069e79bf44c2909a24e7f47cd /postproc | |
parent | 679844e497f3bd84c0c67cb834cd0675fe1936e3 (diff) | |
download | mpv-01e9ed23bf2e20d79c4bc08fdb15427d146e6d7f.tar.bz2 mpv-01e9ed23bf2e20d79c4bc08fdb15427d146e6d7f.tar.xz |
Added reverting support for -pp and -npp options
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4258 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'postproc')
-rw-r--r-- | postproc/postprocess.c | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/postproc/postprocess.c b/postproc/postprocess.c index 316d0dfad1..95770240e1 100644 --- a/postproc/postprocess.c +++ b/postproc/postprocess.c @@ -75,6 +75,7 @@ dont use #ifdef ARCH_X86 for the asm stuff ... cross compilers? (note cpudetect #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <errno.h> #ifdef HAVE_MALLOC_H #include <malloc.h> #endif @@ -148,6 +149,7 @@ static uint64_t packedYScale= 0x0100010001000100LL; 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; extern int verbose; @@ -759,7 +761,7 @@ struct PPMode getPPModeByNameAndQuality(char *name, int quality) /** * Check and load the -npp part of the cmd line */ -int readPPOpt(void *conf, char *arg) +int readNPPOpt(void *conf, char *arg) { int quality; @@ -778,10 +780,37 @@ int readPPOpt(void *conf, char *arg) newPPFlag=1; //divx_quality is passed to postprocess if autoq if off - divx_quality= GET_PP_QUALITY_MAX; + divx_quality= GET_PP_QUALITY_MAX; + firstTime = firstTime2 = 1; return 1; } +int readPPOpt(void *conf, char *arg) +{ + int val; + + if(arg == NULL) + return -2; // ERR_MISSING_PARAM + errno = 0; + val = (int)strtol(arg,NULL,0); + if(errno != 0) + return -4; // What about include cfgparser.h and use ERR_* defines */ + if(val < 0) + return -3; // ERR_OUT_OF_RANGE + + divx_quality = val; + firstTime = 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 @@ -795,7 +824,6 @@ void postprocess(unsigned char * src[], int src_stride, { struct PPMode ppMode; static QP_STORE_T zeroArray[2048/8]; - static int firstTime=1; if(newPPFlag) { @@ -882,7 +910,6 @@ void postprocess2(unsigned char * src[], int src_stride, { QP_STORE_T quantArray[2048/8]; - static int firstTime=1; if(QP_store==NULL || (mode->lumMode & FORCE_QUANT)) { @@ -895,10 +922,10 @@ void postprocess2(unsigned char * src[], int src_stride, for(i=0; i<2048/8; i++) quantArray[i]= 1; } - if(firstTime && verbose) + if(firstTime2 && verbose) { printf("using npp filters 0x%X/0x%X\n", mode->lumMode, mode->chromMode); - firstTime=0; + firstTime2=0; } #ifdef HAVE_ODIVX_POSTPROCESS |