From ca6c71ac5b34a6be212add80a867c8250712dc80 Mon Sep 17 00:00:00 2001 From: michael Date: Tue, 13 Aug 2002 17:53:32 +0000 Subject: semi regular noise pattern patch by (Jindrich Makovicka ) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6991 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/vf_noise.c | 43 +++++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 10 deletions(-) (limited to 'libmpcodecs') diff --git a/libmpcodecs/vf_noise.c b/libmpcodecs/vf_noise.c index 6d36a0ac46..fb1cc90eeb 100644 --- a/libmpcodecs/vf_noise.c +++ b/libmpcodecs/vf_noise.c @@ -53,6 +53,7 @@ typedef struct FilterParam{ int temporal; int quality; int averaged; + int pattern; int shiftptr; int8_t *noise; int8_t *prev_shift[MAX_RES][3]; @@ -67,40 +68,60 @@ struct vf_priv_s { static int nonTempRandShift[MAX_RES]= {-1}; +static int patt[4] = { + -1,0,1,0 +}; + +#define RAND_N(range) ((int) ((double)range*rand()/(RAND_MAX+1.0))) static int8_t *initNoise(FilterParam *fp){ int strength= fp->strength; int uniform= fp->uniform; int averaged= fp->averaged; + int pattern= fp->pattern; int8_t *noise= memalign(16, MAX_NOISE*sizeof(int8_t)); int i, j; srand(123457); - for(i=0; i= 1.0 ); - + w = sqrt( (-2.0 * log( w ) ) / w ); y1= x1 * w; - y1*= strength / sqrt(3.0); + if (pattern) { + y1 /= 2; + y1 += patt[j%4]*strength*0.35; + } if (y1<-128) y1=-128; else if(y1> 127) y1= 127; if (averaged) y1 /= 3.0; noise[i]= (int)y1; } + if (RAND_N(6) == 0) j--; } @@ -382,6 +403,8 @@ static void parse(FilterParam *fp, char* args){ if(pos && postemporal=1; pos= strchr(args, 'h'); if(pos && posquality=1; + pos= strchr(args, 'p'); + if(pos && pospattern=1; pos= strchr(args, 'a'); if(pos && postemporal=1; -- cgit v1.2.3