Credit Andrew - fix vorbis audio which was scratchy and ensure aging plugin does...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / boxblur.C
index 4b52221382b0d4e2d48345490e35673a3f8d41f1..31f017d8fb4d086e7db47616189e7f2c796479fd 100644 (file)
@@ -5,10 +5,12 @@ template<class dst_t, class src_t> static inline
 void blurt(dst_t *dst, int dst_step, src_t *src, int src_step,
                int len, int radius, float s)
 {
-       if( radius > len ) radius = len;
+       int n = len/2-1;
+       if( n <= 0 ) return;
+       if( radius > n ) radius = n;
        const int length = radius*2 + 1;
        const int inv = s * ((1<<16) + length/2)/length;
-       int x, n, sum = src[radius*src_step];
+       int x, sum = src[radius*src_step];
 
        for( x=0; x<radius; ++x )
                sum += src[x*src_step]<<1;