Commit 69fc4da3 authored by Robert Swain's avatar Robert Swain

Add declarations for the sine tables used in wma.c (half window sizes: 128,

256, 512, 1024 and 2048) to mdct.c. Make them accessible via dsputil.h. Make
wma.c use these shared tables.

Originally committed as revision 14758 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent ece6b83c
...@@ -702,6 +702,12 @@ void ff_kbd_window_init(float *window, float alpha, int n); ...@@ -702,6 +702,12 @@ void ff_kbd_window_init(float *window, float alpha, int n);
* @param n size of half window * @param n size of half window
*/ */
void ff_sine_window_init(float *window, int n); void ff_sine_window_init(float *window, int n);
extern float ff_sine_128 [ 128];
extern float ff_sine_256 [ 256];
extern float ff_sine_512 [ 512];
extern float ff_sine_1024[1024];
extern float ff_sine_2048[2048];
extern float *ff_sine_windows[5];
int ff_mdct_init(MDCTContext *s, int nbits, int inverse); int ff_mdct_init(MDCTContext *s, int nbits, int inverse);
void ff_imdct_calc_c(MDCTContext *s, FFTSample *output, const FFTSample *input); void ff_imdct_calc_c(MDCTContext *s, FFTSample *output, const FFTSample *input);
......
...@@ -48,6 +48,15 @@ void ff_kbd_window_init(float *window, float alpha, int n) ...@@ -48,6 +48,15 @@ void ff_kbd_window_init(float *window, float alpha, int n)
window[i] = sqrt(local_window[i] / sum); window[i] = sqrt(local_window[i] / sum);
} }
float ff_sine_128 [ 128];
float ff_sine_256 [ 256];
float ff_sine_512 [ 512];
float ff_sine_1024[1024];
float ff_sine_2048[2048];
float *ff_sine_windows[5] = {
ff_sine_128, ff_sine_256, ff_sine_512, ff_sine_1024, ff_sine_2048,
};
// Generate a sine window. // Generate a sine window.
void ff_sine_window_init(float *window, int n) { void ff_sine_window_init(float *window, int n) {
int i; int i;
......
...@@ -66,7 +66,6 @@ int ff_wma_init(AVCodecContext * avctx, int flags2) ...@@ -66,7 +66,6 @@ int ff_wma_init(AVCodecContext * avctx, int flags2)
{ {
WMACodecContext *s = avctx->priv_data; WMACodecContext *s = avctx->priv_data;
int i; int i;
float *window;
float bps1, high_freq; float bps1, high_freq;
volatile float bps; volatile float bps;
int sample_rate1; int sample_rate1;
...@@ -303,9 +302,8 @@ int ff_wma_init(AVCodecContext * avctx, int flags2) ...@@ -303,9 +302,8 @@ int ff_wma_init(AVCodecContext * avctx, int flags2)
for(i = 0; i < s->nb_block_sizes; i++) { for(i = 0; i < s->nb_block_sizes; i++) {
int n; int n;
n = 1 << (s->frame_len_bits - i); n = 1 << (s->frame_len_bits - i);
window = av_malloc(sizeof(float) * n); ff_sine_window_init(ff_sine_windows[i], n);
ff_sine_window_init(window, n); s->windows[i] = ff_sine_windows[i];
s->windows[i] = window;
} }
s->reset_block_lengths = 1; s->reset_block_lengths = 1;
......
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