changeset 11899:c1eed9efe386 libavcodec

psdec: Simplify filter addressing by incrementing the "in" pointer.
author alexc
date Sun, 20 Jun 2010 22:08:33 +0000
parents 771f6e96ea43
children 9ee7f1655fb5
files ps.c
diffstat 1 files changed, 17 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/ps.c	Sun Jun 20 22:07:32 2010 +0000
+++ b/ps.c	Sun Jun 20 22:08:33 2010 +0000
@@ -283,14 +283,14 @@
 static void hybrid2_re(float (*in)[2], float (*out)[32][2], const float filter[7], int len, int reverse)
 {
     int i, j;
-    for (i = 0; i < len; i++) {
-        float re_in = filter[6] * in[6+i][0];        //real inphase
+    for (i = 0; i < len; i++, in++) {
+        float re_in = filter[6] * in[6][0];          //real inphase
         float re_op = 0.0f;                          //real out of phase
-        float im_in = filter[6] * in[6+i][1];        //imag inphase
+        float im_in = filter[6] * in[6][1];          //imag inphase
         float im_op = 0.0f;                          //imag out of phase
         for (j = 0; j < 6; j += 2) {
-            re_op += filter[j+1] * (in[i+j+1][0] + in[12-j-1+i][0]);
-            im_op += filter[j+1] * (in[i+j+1][1] + in[12-j-1+i][1]);
+            re_op += filter[j+1] * (in[j+1][0] + in[12-j-1][0]);
+            im_op += filter[j+1] * (in[j+1][1] + in[12-j-1][1]);
         }
         out[ reverse][i][0] = re_in + re_op;
         out[ reverse][i][1] = im_in + im_op;
@@ -306,14 +306,14 @@
     int N = 8;
     float temp[8][2];
 
-    for (i = 0; i < len; i++) {
+    for (i = 0; i < len; i++, in++) {
         for (ssb = 0; ssb < N; ssb++) {
-            float sum_re = filter[ssb][6][0] * in[i+6][0], sum_im = filter[ssb][6][0] * in[i+6][1];
+            float sum_re = filter[ssb][6][0] * in[6][0], sum_im = filter[ssb][6][0] * in[6][1];
             for (j = 0; j < 6; j++) {
-                float in0_re = in[i+j][0];
-                float in0_im = in[i+j][1];
-                float in1_re = in[i+12-j][0];
-                float in1_im = in[i+12-j][1];
+                float in0_re = in[j][0];
+                float in0_im = in[j][1];
+                float in1_re = in[12-j][0];
+                float in1_im = in[12-j][1];
                 sum_re += filter[ssb][j][0] * (in0_re + in1_re) - filter[ssb][j][1] * (in0_im - in1_im);
                 sum_im += filter[ssb][j][0] * (in0_im + in1_im) + filter[ssb][j][1] * (in0_re - in1_re);
             }
@@ -339,14 +339,14 @@
 {
     int i, j, ssb;
 
-    for (i = 0; i < len; i++) {
+    for (i = 0; i < len; i++, in++) {
         for (ssb = 0; ssb < N; ssb++) {
-            float sum_re = filter[ssb][6][0] * in[i+6][0], sum_im = filter[ssb][6][0] * in[i+6][1];
+            float sum_re = filter[ssb][6][0] * in[6][0], sum_im = filter[ssb][6][0] * in[6][1];
             for (j = 0; j < 6; j++) {
-                float in0_re = in[i+j][0];
-                float in0_im = in[i+j][1];
-                float in1_re = in[i+12-j][0];
-                float in1_im = in[i+12-j][1];
+                float in0_re = in[j][0];
+                float in0_im = in[j][1];
+                float in1_re = in[12-j][0];
+                float in1_im = in[12-j][1];
                 sum_re += filter[ssb][j][0] * (in0_re + in1_re) - filter[ssb][j][1] * (in0_im - in1_im);
                 sum_im += filter[ssb][j][0] * (in0_im + in1_im) + filter[ssb][j][1] * (in0_re - in1_re);
             }