changeset 11519:c091ab3b4135 libavcodec

Split DCT-II and DCT-III in different functions, they do not share any code.
author vitor
date Sun, 21 Mar 2010 11:35:05 +0000
parents c4d18d452f82
children a791382fd782
files dct.c
diffstat 1 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/dct.c	Sun Mar 21 11:31:11 2010 +0000
+++ b/dct.c	Sun Mar 21 11:35:05 2010 +0000
@@ -37,12 +37,11 @@
 /* cos((M_PI * x / (2*n)) */
 #define COS(s,n,x) (s->costab[x])
 
-static void ff_dct_calc_c(DCTContext *ctx, FFTSample *data)
+static void ff_dct_calc_III_c(DCTContext *ctx, FFTSample *data)
 {
     int n = 1 << ctx->nbits;
     int i;
 
-    if (ctx->inverse) {
         float next = data[n - 1];
         float inv_n = 1.0f / n;
 
@@ -69,7 +68,12 @@
             data[i        ] = tmp1 + csc;
             data[n - i - 1] = tmp1 - csc;
         }
-    } else {
+}
+
+static void ff_dct_calc_II_c(DCTContext *ctx, FFTSample *data)
+{
+    int n = 1 << ctx->nbits;
+    int i;
         float next;
         for (i=0; i < n/2; i++) {
             float tmp1 = data[i        ];
@@ -100,7 +104,6 @@
 
             next +=     s * inr - c * ini;
         }
-    }
 }
 
 void ff_dct_calc(DCTContext *s, FFTSample *data)
@@ -130,7 +133,10 @@
     for (i = 0; i < n/2; i++)
         s->csc2[i] = 0.5 / sin((M_PI / (2*n) * (2*i + 1)));
 
-    s->dct_calc = ff_dct_calc_c;
+    if(inverse) {
+        s->dct_calc = ff_dct_calc_III_c;
+    } else
+        s->dct_calc = ff_dct_calc_II_c;
 
     return 0;
 }