Commit a0a58f35 authored by michael's avatar michael

Move const *pow2tab out of context.


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@13366 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 8bc98b0c
...@@ -132,8 +132,6 @@ typedef struct cook { ...@@ -132,8 +132,6 @@ typedef struct cook {
/* generatable tables and related variables */ /* generatable tables and related variables */
int gain_size_factor; int gain_size_factor;
float gain_table[23]; float gain_table[23];
float pow2tab[127];
float rootpow2tab[127];
/* data buffers */ /* data buffers */
...@@ -148,6 +146,9 @@ typedef struct cook { ...@@ -148,6 +146,9 @@ typedef struct cook {
const float *cplscales[5]; const float *cplscales[5];
} COOKContext; } COOKContext;
static float pow2tab[127];
static float rootpow2tab[127];
/* debug functions */ /* debug functions */
#ifdef COOKDEBUG #ifdef COOKDEBUG
...@@ -183,11 +184,11 @@ static void dump_short_table(short* table, int size, int delimiter) { ...@@ -183,11 +184,11 @@ static void dump_short_table(short* table, int size, int delimiter) {
/*************** init functions ***************/ /*************** init functions ***************/
/* table generator */ /* table generator */
static void init_pow2table(COOKContext *q){ static void init_pow2table(void){
int i; int i;
for (i=-63 ; i<64 ; i++){ for (i=-63 ; i<64 ; i++){
q-> pow2tab[63+i]= pow(2, i); pow2tab[63+i]= pow(2, i);
q->rootpow2tab[63+i]=sqrt(pow(2, i)); rootpow2tab[63+i]=sqrt(pow(2, i));
} }
} }
...@@ -196,7 +197,7 @@ static void init_gain_table(COOKContext *q) { ...@@ -196,7 +197,7 @@ static void init_gain_table(COOKContext *q) {
int i; int i;
q->gain_size_factor = q->samples_per_channel/8; q->gain_size_factor = q->samples_per_channel/8;
for (i=0 ; i<23 ; i++) { for (i=0 ; i<23 ; i++) {
q->gain_table[i] = pow((double)q->pow2tab[i+52] , q->gain_table[i] = pow(pow2tab[i+52] ,
(1.0/(double)q->gain_size_factor)); (1.0/(double)q->gain_size_factor));
} }
} }
...@@ -542,7 +543,7 @@ static void scalar_dequant_float(COOKContext *q, int index, int quant_index, ...@@ -542,7 +543,7 @@ static void scalar_dequant_float(COOKContext *q, int index, int quant_index,
f1 = dither_tab[index]; f1 = dither_tab[index];
if (av_random(&q->random_state) < 0x80000000) f1 = -f1; if (av_random(&q->random_state) < 0x80000000) f1 = -f1;
} }
mlt_p[i] = f1 * q->rootpow2tab[quant_index+63]; mlt_p[i] = f1 * rootpow2tab[quant_index+63];
} }
} }
/** /**
...@@ -670,7 +671,7 @@ static void interpolate_float(COOKContext *q, float* buffer, ...@@ -670,7 +671,7 @@ static void interpolate_float(COOKContext *q, float* buffer,
int gain_index, int gain_index_next){ int gain_index, int gain_index_next){
int i; int i;
float fc1, fc2; float fc1, fc2;
fc1 = q->pow2tab[gain_index+63]; fc1 = pow2tab[gain_index+63];
if(gain_index == gain_index_next){ //static gain if(gain_index == gain_index_next){ //static gain
for(i=0 ; i<q->gain_size_factor ; i++){ for(i=0 ; i<q->gain_size_factor ; i++){
...@@ -699,7 +700,7 @@ static void interpolate_float(COOKContext *q, float* buffer, ...@@ -699,7 +700,7 @@ static void interpolate_float(COOKContext *q, float* buffer,
static void imlt_window_float (COOKContext *q, float *buffer1, static void imlt_window_float (COOKContext *q, float *buffer1,
cook_gains *gains_ptr, float *previous_buffer) cook_gains *gains_ptr, float *previous_buffer)
{ {
const float fc = q->pow2tab[gains_ptr->previous[0] + 63]; const float fc = pow2tab[gains_ptr->previous[0] + 63];
int i; int i;
/* The weird thing here, is that the two halves of the time domain /* The weird thing here, is that the two halves of the time domain
* buffer are swapped. Also, the newest data, that we save away for * buffer are swapped. Also, the newest data, that we save away for
...@@ -1113,7 +1114,7 @@ static int cook_decode_init(AVCodecContext *avctx) ...@@ -1113,7 +1114,7 @@ static int cook_decode_init(AVCodecContext *avctx)
q->numvector_size = (1 << q->log2_numvector_size); q->numvector_size = (1 << q->log2_numvector_size);
/* Generate tables */ /* Generate tables */
init_pow2table(q); init_pow2table();
init_gain_table(q); init_gain_table(q);
init_cplscales_table(q); init_cplscales_table(q);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment