changeset 3907:5f5525341673 libavcodec

Original Commit: r108 | ods15 | 2006-10-01 18:46:06 +0200 (Sun, 01 Oct 2006) | 2 lines prevent division/modulo
author ods15
date Mon, 02 Oct 2006 06:09:39 +0000
parents 5ae5224790d3
children 045c650f0951
files vorbis_enc.c
diffstat 1 files changed, 15 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/vorbis_enc.c	Mon Oct 02 06:09:36 2006 +0000
+++ b/vorbis_enc.c	Mon Oct 02 06:09:39 2006 +0000
@@ -1292,14 +1292,22 @@
                             for (l = 0; l < book->ndimentions; l++) buf[k + l] -= a[l];
                         }
                     } else {
+                        int s = rc->begin + p * psize, a1, b1;
+                        a1 = (s % real_ch) * samples;
+                        b1 =  s / real_ch;
+                        s = real_ch * samples;
                         for (k = 0; k < psize; k += book->ndimentions) {
-                            int dim = book->ndimentions, s = rc->begin + p * psize + k, l;
-                            float vec[dim], * a = vec;
-                            for (l = s; l < s + dim; l++)
-                                *a++ = coeffs[(l % real_ch) * samples + l / real_ch];
-                            a = put_vector(book, pb, vec);
-                            for (l = s; l < s + dim; l++)
-                                coeffs[(l % real_ch) * samples + l / real_ch] -= *a++;
+                            int dim, a2 = a1, b2 = b1;
+                            float vec[book->ndimentions], * pv = vec;
+                            for (dim = book->ndimentions; dim--; ) {
+                                *pv++ = coeffs[a2 + b2];
+                                if ((a2 += samples) == s) { a2=0; b2++; }
+                            }
+                            pv = put_vector(book, pb, vec);
+                            for (dim = book->ndimentions; dim--; ) {
+                                coeffs[a1 + b1] -= *pv++;
+                                if ((a1 += samples) == s) { a1=0; b1++; }
+                            }
                         }
                     }
                 }