Commit a2d56d6a authored by albeu's avatar albeu

Added reverting support for -pp and -npp options


git-svn-id: file:///var/local/repositories/mplayer/trunk/postproc@4258 b3059339-0415-0410-9bf9-f77b7e298cf2
parent e6821eec
...@@ -75,6 +75,7 @@ dont use #ifdef ARCH_X86 for the asm stuff ... cross compilers? (note cpudetect ...@@ -75,6 +75,7 @@ dont use #ifdef ARCH_X86 for the asm stuff ... cross compilers? (note cpudetect
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <errno.h>
#ifdef HAVE_MALLOC_H #ifdef HAVE_MALLOC_H
#include <malloc.h> #include <malloc.h>
#endif #endif
...@@ -148,6 +149,7 @@ static uint64_t packedYScale= 0x0100010001000100LL; ...@@ -148,6 +149,7 @@ static uint64_t packedYScale= 0x0100010001000100LL;
extern int divx_quality; extern int divx_quality;
int newPPFlag=0; //is set if -npp is used int newPPFlag=0; //is set if -npp is used
struct PPMode gPPMode[GET_PP_QUALITY_MAX+1]; struct PPMode gPPMode[GET_PP_QUALITY_MAX+1];
static int firstTime = 0, firstTime2 = 0;
extern int verbose; extern int verbose;
...@@ -759,7 +761,7 @@ struct PPMode getPPModeByNameAndQuality(char *name, int quality) ...@@ -759,7 +761,7 @@ struct PPMode getPPModeByNameAndQuality(char *name, int quality)
/** /**
* Check and load the -npp part of the cmd line * Check and load the -npp part of the cmd line
*/ */
int readPPOpt(void *conf, char *arg) int readNPPOpt(void *conf, char *arg)
{ {
int quality; int quality;
...@@ -779,9 +781,36 @@ int readPPOpt(void *conf, char *arg) ...@@ -779,9 +781,36 @@ int readPPOpt(void *conf, char *arg)
//divx_quality is passed to postprocess if autoq if off //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; 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 * Obsolete, dont use it, use postprocess2() instead
* this will check newPPFlag automatically and use postprocess2 if it is set * this will check newPPFlag automatically and use postprocess2 if it is set
...@@ -795,7 +824,6 @@ void postprocess(unsigned char * src[], int src_stride, ...@@ -795,7 +824,6 @@ void postprocess(unsigned char * src[], int src_stride,
{ {
struct PPMode ppMode; struct PPMode ppMode;
static QP_STORE_T zeroArray[2048/8]; static QP_STORE_T zeroArray[2048/8];
static int firstTime=1;
if(newPPFlag) if(newPPFlag)
{ {
...@@ -882,7 +910,6 @@ void postprocess2(unsigned char * src[], int src_stride, ...@@ -882,7 +910,6 @@ void postprocess2(unsigned char * src[], int src_stride,
{ {
QP_STORE_T quantArray[2048/8]; QP_STORE_T quantArray[2048/8];
static int firstTime=1;
if(QP_store==NULL || (mode->lumMode & FORCE_QUANT)) if(QP_store==NULL || (mode->lumMode & FORCE_QUANT))
{ {
...@@ -895,10 +922,10 @@ void postprocess2(unsigned char * src[], int src_stride, ...@@ -895,10 +922,10 @@ void postprocess2(unsigned char * src[], int src_stride,
for(i=0; i<2048/8; i++) quantArray[i]= 1; 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); printf("using npp filters 0x%X/0x%X\n", mode->lumMode, mode->chromMode);
firstTime=0; firstTime2=0;
} }
#ifdef HAVE_ODIVX_POSTPROCESS #ifdef HAVE_ODIVX_POSTPROCESS
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment