[FFmpeg-devel] [PATCH] remove ugliness in cel_filters.c

Ronald S. Bultje rsbultje
Mon Nov 9 20:10:39 CET 2009


Hi,

On Mon, Nov 9, 2009 at 2:06 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Mon, Nov 09, 2009 at 10:30:45AM -0500, Ronald S. Bultje wrote:
>> $attached. God invented the >= and <= instructions for us, let us be
>> thankful and use it.
[..]
>
> ok but wasnt there a third one ?

Oh yes indeed, not sure why I missed it, it's right there above it...
See attached.

Ronald
-------------- next part --------------
Index: celp_filters.c
===================================================================
--- celp_filters.c	(revision 19703)
+++ celp_filters.c	(working copy)
@@ -67,12 +67,9 @@
 {
     int i,n;
 
-    // Avoids a +1 in the inner loop.
-    filter_length++;
-
     for (n = 0; n < buffer_length; n++) {
         int sum = rounder;
-        for (i = 1; i < filter_length; i++)
+        for (i = 1; i <= filter_length; i++)
             sum -= filter_coeffs[i-1] * out[n-i];
 
         sum = (sum >> 12) + in[n];
@@ -96,12 +93,9 @@
 {
     int i,n;
 
-    // Avoids a +1 in the inner loop.
-    filter_length++;
-
     for (n = 0; n < buffer_length; n++) {
         out[n] = in[n];
-        for (i = 1; i < filter_length; i++)
+        for (i = 1; i <= filter_length; i++)
             out[n] -= filter_coeffs[i-1] * out[n-i];
     }
 }
@@ -114,12 +108,9 @@
 {
     int i,n;
 
-    // Avoids a +1 in the inner loop.
-    filter_length++;
-
     for (n = 0; n < buffer_length; n++) {
         out[n] = in[n];
-        for (i = 1; i < filter_length; i++)
+        for (i = 1; i <= filter_length; i++)
             out[n] += filter_coeffs[i-1] * in[n-i];
     }
 }



More information about the ffmpeg-devel mailing list