changeset 5347:59ec490fe985 libavcodec

fixpoint: move cplscales to context structure and provide hook for data format conversion
author mhoffman
date Mon, 16 Jul 2007 13:24:43 +0000
parents b41036edcf2e
children 8627a229d2d2
files cook.c
diffstat 1 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/cook.c	Mon Jul 16 12:32:41 2007 +0000
+++ b/cook.c	Mon Jul 16 13:24:43 2007 +0000
@@ -144,6 +144,8 @@
     float               decode_buffer_1[1024];
     float               decode_buffer_2[1024];
     float               decode_buffer_0[1060]; /* static allocation for joint decode */
+
+    float               *cplscales[5];
 } COOKContext;
 
 /* debug functions */
@@ -262,6 +264,18 @@
     return 0;
 }
 
+static float *maybe_reformat_buffer32 (COOKContext *q, float *ptr, int n)
+{
+    if (1)
+        return ptr;
+}
+
+static int init_cplscales_table (COOKContext *q) {
+    int i;
+    for (i=0;i<5;i++)
+        q->cplscales[i] = maybe_reformat_buffer32 (q, cplscales[i], (1<<(i+2))-1);
+}
+
 /*************** init functions end ***********/
 
 /**
@@ -843,7 +857,7 @@
     for (i=q->js_subband_start ; i<q->subbands ; i++) {
         cpl_tmp = cplband[i];
         idx -=decouple_tab[cpl_tmp];
-        cplscale = (float*)cplscales[q->js_vlc_bits-2];  //choose decoupler table
+        cplscale = q->cplscales[q->js_vlc_bits-2];  //choose decoupler table
         f1 = cplscale[decouple_tab[cpl_tmp]];
         f2 = cplscale[idx-1];
         q->decouple (q, i, f1, f2, decode_buffer, mlt_buffer1, mlt_buffer2);
@@ -1113,6 +1127,7 @@
     init_rootpow2table(q);
     init_pow2table(q);
     init_gain_table(q);
+    init_cplscales_table(q);
 
     if (init_cook_vlc_tables(q) != 0)
         return -1;