# HG changeset patch # User albeu # Date 1011459663 0 # Node ID 80edc2aaff86622291a7d8c04dcecabd3e042a15 # Parent f1074f0d4969ee60b994295e0c5f35d209cc9bb9 Added reverting support for -pp and -npp options diff -r f1074f0d4969 -r 80edc2aaff86 libpostproc/postprocess.c --- a/libpostproc/postprocess.c Sat Jan 19 16:56:35 2002 +0000 +++ b/libpostproc/postprocess.c Sat Jan 19 17:01:03 2002 +0000 @@ -75,6 +75,7 @@ #include #include #include +#include #ifdef HAVE_MALLOC_H #include #endif @@ -148,6 +149,7 @@ 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 @@ /** * 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 @@ 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 @@ { struct PPMode ppMode; static QP_STORE_T zeroArray[2048/8]; - static int firstTime=1; if(newPPFlag) { @@ -882,7 +910,6 @@ { QP_STORE_T quantArray[2048/8]; - static int firstTime=1; if(QP_store==NULL || (mode->lumMode & FORCE_QUANT)) { @@ -895,10 +922,10 @@ 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