comparison cook.c @ 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
comparison
equal deleted inserted replaced
5346:b41036edcf2e 5347:59ec490fe985
142 float mono_previous_buffer1[1024]; 142 float mono_previous_buffer1[1024];
143 float mono_previous_buffer2[1024]; 143 float mono_previous_buffer2[1024];
144 float decode_buffer_1[1024]; 144 float decode_buffer_1[1024];
145 float decode_buffer_2[1024]; 145 float decode_buffer_2[1024];
146 float decode_buffer_0[1060]; /* static allocation for joint decode */ 146 float decode_buffer_0[1060]; /* static allocation for joint decode */
147
148 float *cplscales[5];
147 } COOKContext; 149 } COOKContext;
148 150
149 /* debug functions */ 151 /* debug functions */
150 152
151 #ifdef COOKDEBUG 153 #ifdef COOKDEBUG
258 } 260 }
259 av_log(NULL,AV_LOG_DEBUG,"MDCT initialized, order = %d.\n", 261 av_log(NULL,AV_LOG_DEBUG,"MDCT initialized, order = %d.\n",
260 av_log2(mlt_size)+1); 262 av_log2(mlt_size)+1);
261 263
262 return 0; 264 return 0;
265 }
266
267 static float *maybe_reformat_buffer32 (COOKContext *q, float *ptr, int n)
268 {
269 if (1)
270 return ptr;
271 }
272
273 static int init_cplscales_table (COOKContext *q) {
274 int i;
275 for (i=0;i<5;i++)
276 q->cplscales[i] = maybe_reformat_buffer32 (q, cplscales[i], (1<<(i+2))-1);
263 } 277 }
264 278
265 /*************** init functions end ***********/ 279 /*************** init functions end ***********/
266 280
267 /** 281 /**
841 the coefficients are stored in a coupling scheme. */ 855 the coefficients are stored in a coupling scheme. */
842 idx = (1 << q->js_vlc_bits) - 1; 856 idx = (1 << q->js_vlc_bits) - 1;
843 for (i=q->js_subband_start ; i<q->subbands ; i++) { 857 for (i=q->js_subband_start ; i<q->subbands ; i++) {
844 cpl_tmp = cplband[i]; 858 cpl_tmp = cplband[i];
845 idx -=decouple_tab[cpl_tmp]; 859 idx -=decouple_tab[cpl_tmp];
846 cplscale = (float*)cplscales[q->js_vlc_bits-2]; //choose decoupler table 860 cplscale = q->cplscales[q->js_vlc_bits-2]; //choose decoupler table
847 f1 = cplscale[decouple_tab[cpl_tmp]]; 861 f1 = cplscale[decouple_tab[cpl_tmp]];
848 f2 = cplscale[idx-1]; 862 f2 = cplscale[idx-1];
849 q->decouple (q, i, f1, f2, decode_buffer, mlt_buffer1, mlt_buffer2); 863 q->decouple (q, i, f1, f2, decode_buffer, mlt_buffer1, mlt_buffer2);
850 idx = (1 << q->js_vlc_bits) - 1; 864 idx = (1 << q->js_vlc_bits) - 1;
851 } 865 }
1111 1125
1112 /* Generate tables */ 1126 /* Generate tables */
1113 init_rootpow2table(q); 1127 init_rootpow2table(q);
1114 init_pow2table(q); 1128 init_pow2table(q);
1115 init_gain_table(q); 1129 init_gain_table(q);
1130 init_cplscales_table(q);
1116 1131
1117 if (init_cook_vlc_tables(q) != 0) 1132 if (init_cook_vlc_tables(q) != 0)
1118 return -1; 1133 return -1;
1119 1134
1120 1135