Commit 27f936ec authored by Michael Niedermayer's avatar Michael Niedermayer

Merge branch 'postprocwork'

* postprocwork:
  postproc/postprocess: use av_strtok()
  postprocess: make some variables in pp_get_mode_by_name_and_quality() const
  postproc: simplify forwarding return codes
  libpostproc/postprocess: avoid some if()
  fate: add fate-filter-pp1

This is merged instead of just fast forward pushed due to a bug in the git hook
which does not allow commits to change filter-video.mak except merge commits.
filter-video.mak contains a few tabs, which are needed due to Makefile syntax
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 77f9a81c 9e8be462
...@@ -209,13 +209,13 @@ static inline int isHorizDC_C(const uint8_t src[], int stride, const PPContext * ...@@ -209,13 +209,13 @@ static inline int isHorizDC_C(const uint8_t src[], int stride, const PPContext *
const int dcThreshold= dcOffset*2 + 1; const int dcThreshold= dcOffset*2 + 1;
for(y=0; y<BLOCK_SIZE; y++){ for(y=0; y<BLOCK_SIZE; y++){
if(((unsigned)(src[0] - src[1] + dcOffset)) < dcThreshold) numEq++; numEq += ((unsigned)(src[0] - src[1] + dcOffset)) < dcThreshold;
if(((unsigned)(src[1] - src[2] + dcOffset)) < dcThreshold) numEq++; numEq += ((unsigned)(src[1] - src[2] + dcOffset)) < dcThreshold;
if(((unsigned)(src[2] - src[3] + dcOffset)) < dcThreshold) numEq++; numEq += ((unsigned)(src[2] - src[3] + dcOffset)) < dcThreshold;
if(((unsigned)(src[3] - src[4] + dcOffset)) < dcThreshold) numEq++; numEq += ((unsigned)(src[3] - src[4] + dcOffset)) < dcThreshold;
if(((unsigned)(src[4] - src[5] + dcOffset)) < dcThreshold) numEq++; numEq += ((unsigned)(src[4] - src[5] + dcOffset)) < dcThreshold;
if(((unsigned)(src[5] - src[6] + dcOffset)) < dcThreshold) numEq++; numEq += ((unsigned)(src[5] - src[6] + dcOffset)) < dcThreshold;
if(((unsigned)(src[6] - src[7] + dcOffset)) < dcThreshold) numEq++; numEq += ((unsigned)(src[6] - src[7] + dcOffset)) < dcThreshold;
src+= stride; src+= stride;
} }
return numEq > c->ppMode.flatnessThreshold; return numEq > c->ppMode.flatnessThreshold;
...@@ -233,14 +233,14 @@ static inline int isVertDC_C(const uint8_t src[], int stride, const PPContext *c ...@@ -233,14 +233,14 @@ static inline int isVertDC_C(const uint8_t src[], int stride, const PPContext *c
src+= stride*4; // src points to begin of the 8x8 Block src+= stride*4; // src points to begin of the 8x8 Block
for(y=0; y<BLOCK_SIZE-1; y++){ for(y=0; y<BLOCK_SIZE-1; y++){
if(((unsigned)(src[0] - src[0+stride] + dcOffset)) < dcThreshold) numEq++; numEq += ((unsigned)(src[0] - src[0+stride] + dcOffset)) < dcThreshold;
if(((unsigned)(src[1] - src[1+stride] + dcOffset)) < dcThreshold) numEq++; numEq += ((unsigned)(src[1] - src[1+stride] + dcOffset)) < dcThreshold;
if(((unsigned)(src[2] - src[2+stride] + dcOffset)) < dcThreshold) numEq++; numEq += ((unsigned)(src[2] - src[2+stride] + dcOffset)) < dcThreshold;
if(((unsigned)(src[3] - src[3+stride] + dcOffset)) < dcThreshold) numEq++; numEq += ((unsigned)(src[3] - src[3+stride] + dcOffset)) < dcThreshold;
if(((unsigned)(src[4] - src[4+stride] + dcOffset)) < dcThreshold) numEq++; numEq += ((unsigned)(src[4] - src[4+stride] + dcOffset)) < dcThreshold;
if(((unsigned)(src[5] - src[5+stride] + dcOffset)) < dcThreshold) numEq++; numEq += ((unsigned)(src[5] - src[5+stride] + dcOffset)) < dcThreshold;
if(((unsigned)(src[6] - src[6+stride] + dcOffset)) < dcThreshold) numEq++; numEq += ((unsigned)(src[6] - src[6+stride] + dcOffset)) < dcThreshold;
if(((unsigned)(src[7] - src[7+stride] + dcOffset)) < dcThreshold) numEq++; numEq += ((unsigned)(src[7] - src[7+stride] + dcOffset)) < dcThreshold;
src+= stride; src+= stride;
} }
return numEq > c->ppMode.flatnessThreshold; return numEq > c->ppMode.flatnessThreshold;
...@@ -278,10 +278,7 @@ static inline int isVertMinMaxOk_C(const uint8_t src[], int stride, int QP) ...@@ -278,10 +278,7 @@ static inline int isVertMinMaxOk_C(const uint8_t src[], int stride, int QP)
static inline int horizClassify_C(const uint8_t src[], int stride, const PPContext *c) static inline int horizClassify_C(const uint8_t src[], int stride, const PPContext *c)
{ {
if( isHorizDC_C(src, stride, c) ){ if( isHorizDC_C(src, stride, c) ){
if( isHorizMinMaxOk_C(src, stride, c->QP) ) return isHorizMinMaxOk_C(src, stride, c->QP);
return 1;
else
return 0;
}else{ }else{
return 2; return 2;
} }
...@@ -290,10 +287,7 @@ static inline int horizClassify_C(const uint8_t src[], int stride, const PPConte ...@@ -290,10 +287,7 @@ static inline int horizClassify_C(const uint8_t src[], int stride, const PPConte
static inline int vertClassify_C(const uint8_t src[], int stride, const PPContext *c) static inline int vertClassify_C(const uint8_t src[], int stride, const PPContext *c)
{ {
if( isVertDC_C(src, stride, c) ){ if( isVertDC_C(src, stride, c) ){
if( isVertMinMaxOk_C(src, stride, c->QP) ) return isVertMinMaxOk_C(src, stride, c->QP);
return 1;
else
return 0;
}else{ }else{
return 2; return 2;
} }
...@@ -704,21 +698,22 @@ pp_mode *pp_get_mode_by_name_and_quality(const char *name, int quality) ...@@ -704,21 +698,22 @@ pp_mode *pp_get_mode_by_name_and_quality(const char *name, int quality)
av_log(NULL, AV_LOG_DEBUG, "pp: %s\n", name); av_log(NULL, AV_LOG_DEBUG, "pp: %s\n", name);
for(;;){ for(;;){
char *filterName; const char *filterName;
int q= 1000000; //PP_QUALITY_MAX; int q= 1000000; //PP_QUALITY_MAX;
int chrom=-1; int chrom=-1;
int luma=-1; int luma=-1;
char *option; const char *option;
char *options[OPTIONS_ARRAY_SIZE]; const char *options[OPTIONS_ARRAY_SIZE];
int i; int i;
int filterNameOk=0; int filterNameOk=0;
int numOfUnknownOptions=0; int numOfUnknownOptions=0;
int enable=1; //does the user want us to enabled or disabled the filter int enable=1; //does the user want us to enabled or disabled the filter
char *tokstate;
filterToken= strtok(p, filterDelimiters); filterToken= av_strtok(p, filterDelimiters, &tokstate);
if(!filterToken) break; if(!filterToken) break;
p+= strlen(filterToken) + 1; // p points to next filterToken p+= strlen(filterToken) + 1; // p points to next filterToken
filterName= strtok(filterToken, optionDelimiters); filterName= av_strtok(filterToken, optionDelimiters, &tokstate);
if (!filterName) { if (!filterName) {
ppMode->error++; ppMode->error++;
break; break;
...@@ -731,7 +726,7 @@ pp_mode *pp_get_mode_by_name_and_quality(const char *name, int quality) ...@@ -731,7 +726,7 @@ pp_mode *pp_get_mode_by_name_and_quality(const char *name, int quality)
} }
for(;;){ //for all options for(;;){ //for all options
option= strtok(NULL, optionDelimiters); option= av_strtok(NULL, optionDelimiters, &tokstate);
if(!option) break; if(!option) break;
av_log(NULL, AV_LOG_DEBUG, "pp: option: %s\n", option); av_log(NULL, AV_LOG_DEBUG, "pp: option: %s\n", option);
......
...@@ -229,6 +229,9 @@ fate-filter-pad: CMD = video_filter "pad=iw*1.5:ih*1.5:iw*0.3:ih*0.2" ...@@ -229,6 +229,9 @@ fate-filter-pad: CMD = video_filter "pad=iw*1.5:ih*1.5:iw*0.3:ih*0.2"
FATE_FILTER_VSYNTH-$(CONFIG_PP_FILTER) += fate-filter-pp FATE_FILTER_VSYNTH-$(CONFIG_PP_FILTER) += fate-filter-pp
fate-filter-pp: CMD = video_filter "pp=be/hb/vb/tn/l5/al" fate-filter-pp: CMD = video_filter "pp=be/hb/vb/tn/l5/al"
FATE_FILTER_VSYNTH-$(CONFIG_PP_FILTER) += fate-filter-pp1
fate-filter-pp1: CMD = video_filter "pp=fq|4/be/hb/vb/tn/l5/al"
FATE_FILTER_VSYNTH-$(CONFIG_PP_FILTER) += fate-filter-pp2 FATE_FILTER_VSYNTH-$(CONFIG_PP_FILTER) += fate-filter-pp2
fate-filter-pp2: CMD = video_filter "pp=be/fq|16/h1/v1/lb" fate-filter-pp2: CMD = video_filter "pp=be/fq|16/h1/v1/lb"
......
pp1 cb9f884e27a5be11f72afc9b517efd10
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