changeset 6964:f35d05c32dd1

film/average noise cleanup remove unused vars/functions avoid statics so multiple noise filters can be used
author michael
date Sun, 11 Aug 2002 09:52:23 +0000
parents 76fee64d884a
children f8ea0af8edb0
files libmpcodecs/vf_noise.c
diffstat 1 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vf_noise.c	Sun Aug 11 09:46:50 2002 +0000
+++ b/libmpcodecs/vf_noise.c	Sun Aug 11 09:52:23 2002 +0000
@@ -43,7 +43,6 @@
 
 static inline void lineNoise_C(uint8_t *dst, uint8_t *src, int8_t *noise, int len, int shift);
 static inline void lineNoiseAvg_C(uint8_t *dst, uint8_t *src, int len, int8_t **shift);
-static inline void lineNoiseAvg_CX(uint8_t *dst, uint8_t *src, int len, int8_t **shift, int add);
 
 static void (*lineNoise)(uint8_t *dst, uint8_t *src, int8_t *noise, int len, int shift)= lineNoise_C;
 static void (*lineNoiseAvg)(uint8_t *dst, uint8_t *src, int len, int8_t **shift)= lineNoiseAvg_C;
@@ -56,6 +55,7 @@
         int averaged;
         int shiftptr;
 	int8_t *noise;
+	int8_t *prev_shift[MAX_RES][3];
 }FilterParam;
 
 struct vf_priv_s {
@@ -66,7 +66,6 @@
 };
 
 static int nonTempRandShift[MAX_RES]= {-1};
-static int8_t *prev_shift[MAX_RES][3];
 
 static int8_t *initNoise(FilterParam *fp){
 	int strength= fp->strength;
@@ -107,7 +106,7 @@
 
 	for (i = 0; i < MAX_RES; i++)
 	    for (j = 0; j < 3; j++)
-		prev_shift[i][j] = noise + (rand()&(MAX_SHIFT-1));
+		fp->prev_shift[i][j] = noise + (rand()&(MAX_SHIFT-1));
 
 	if(nonTempRandShift[0]==-1){
 		for(i=0; i<MAX_RES; i++){
@@ -194,7 +193,7 @@
 /***************************************************************************/
 
 static inline void lineNoiseAvg_C(uint8_t *dst, uint8_t *src, int len, int8_t **shift){
-	int i, j, n, v;
+	int i, j, n;
 	
 	for(i=0; i<len; i++)
 	{
@@ -235,8 +234,8 @@
 
 		if(fp->quality==0) shift&= ~7;
 		if (fp->averaged) {
-		    lineNoiseAvg(dst, src, width, prev_shift[y]);
-		    prev_shift[y][fp->shiftptr] = noise + shift;
+		    lineNoiseAvg(dst, src, width, fp->prev_shift[y]);
+		    fp->prev_shift[y][fp->shiftptr] = noise + shift;
 		} else {
 		    lineNoise(dst, src, noise, width, shift);
 		}