aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVitor Sessak <vitor1001@gmail.com>2009-09-15 16:18:16 +0000
committerVitor Sessak <vitor1001@gmail.com>2009-09-15 16:18:16 +0000
commit6776061b04b6f9f669d8ec59f6112e8a9b1dad92 (patch)
tree6b2e9e739877b48d5dc177ef1572c060e3137ffa
parent05db409c280acc22362c2e79ea67abe3873043a5 (diff)
downloadffmpeg-6776061b04b6f9f669d8ec59f6112e8a9b1dad92.tar.gz
Add two more sizes to ff_sine_windows[] and also pad it with NULLs so
that FF_ELEMS(ff_sine_windows[x]) == 1 << x. Fix issue 1384. Originally committed as revision 19862 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/dsputil.h4
-rw-r--r--libavcodec/mdct.c6
-rw-r--r--libavcodec/twinvq.c8
-rw-r--r--libavcodec/wma.c4
-rw-r--r--libavcodec/wmaprodec.c2
5 files changed, 15 insertions, 9 deletions
diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
index 027d1510ed..cdfdb9bd14 100644
--- a/libavcodec/dsputil.h
+++ b/libavcodec/dsputil.h
@@ -760,13 +760,15 @@ void ff_kbd_window_init(float *window, float alpha, int n);
* @param n size of half window
*/
void ff_sine_window_init(float *window, int n);
+extern float ff_sine_32 [ 32];
+extern float ff_sine_64 [ 64];
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_4096[4096];
-extern float * const ff_sine_windows[6];
+extern float * const ff_sine_windows[13];
int ff_mdct_init(MDCTContext *s, int nbits, int inverse, double scale);
void ff_imdct_calc_c(MDCTContext *s, FFTSample *output, const FFTSample *input);
diff --git a/libavcodec/mdct.c b/libavcodec/mdct.c
index b6b9093e93..cb024aceda 100644
--- a/libavcodec/mdct.c
+++ b/libavcodec/mdct.c
@@ -48,13 +48,17 @@ av_cold void ff_kbd_window_init(float *window, float alpha, int n)
window[i] = sqrt(local_window[i] / sum);
}
+DECLARE_ALIGNED(16, float, ff_sine_32 [ 32]);
+DECLARE_ALIGNED(16, float, ff_sine_64 [ 64]);
DECLARE_ALIGNED(16, float, ff_sine_128 [ 128]);
DECLARE_ALIGNED(16, float, ff_sine_256 [ 256]);
DECLARE_ALIGNED(16, float, ff_sine_512 [ 512]);
DECLARE_ALIGNED(16, float, ff_sine_1024[1024]);
DECLARE_ALIGNED(16, float, ff_sine_2048[2048]);
DECLARE_ALIGNED(16, float, ff_sine_4096[4096]);
-float * const ff_sine_windows[6] = {
+float * const ff_sine_windows[] = {
+ NULL, NULL, NULL, NULL, NULL, // unused
+ ff_sine_32 , ff_sine_64 ,
ff_sine_128, ff_sine_256, ff_sine_512, ff_sine_1024, ff_sine_2048, ff_sine_4096
};
diff --git a/libavcodec/twinvq.c b/libavcodec/twinvq.c
index 02129eb0d3..0d66d63a94 100644
--- a/libavcodec/twinvq.c
+++ b/libavcodec/twinvq.c
@@ -648,7 +648,7 @@ static void imdct_and_window(TwinContext *tctx, enum FrameType ftype, int wtype,
tctx->dsp.vector_fmul_window(out2,
prev_buf + (bsize-wsize)/2,
buf1 + bsize*j,
- ff_sine_windows[av_log2(wsize) - 7],
+ ff_sine_windows[av_log2(wsize)],
0.0,
wsize/2);
out2 += wsize;
@@ -903,9 +903,9 @@ static av_cold void init_mdct_win(TwinContext *tctx)
}
- ff_sine_window_init(ff_sine_windows[av_log2(size_m) - 7], size_m );
- ff_sine_window_init(ff_sine_windows[av_log2(size_s/2) - 7], size_s/2);
- ff_sine_window_init(ff_sine_windows[av_log2(mtab->size) - 7], mtab->size);
+ ff_sine_window_init(ff_sine_windows[av_log2(size_m) ], size_m );
+ ff_sine_window_init(ff_sine_windows[av_log2(size_s/2) ], size_s/2);
+ ff_sine_window_init(ff_sine_windows[av_log2(mtab->size)], mtab->size);
}
/**
diff --git a/libavcodec/wma.c b/libavcodec/wma.c
index 4fc492243f..7f8b3b4ac2 100644
--- a/libavcodec/wma.c
+++ b/libavcodec/wma.c
@@ -341,8 +341,8 @@ int ff_wma_init(AVCodecContext *avctx, int flags2)
for (i = 0; i < s->nb_block_sizes; i++) {
int n;
n = 1 << (s->frame_len_bits - i);
- ff_sine_window_init(ff_sine_windows[s->frame_len_bits - i - 7], n);
- s->windows[i] = ff_sine_windows[s->frame_len_bits - i - 7];
+ ff_sine_window_init(ff_sine_windows[s->frame_len_bits - i], n);
+ s->windows[i] = ff_sine_windows[s->frame_len_bits - i];
}
s->reset_block_lengths = 1;
diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index 425cc0ba75..2a45312ec0 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -426,7 +426,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
/** init MDCT windows: simple sinus window */
for (i = 0; i < WMAPRO_BLOCK_SIZES; i++) {
const int n = 1 << (WMAPRO_BLOCK_MAX_BITS - i);
- const int win_idx = WMAPRO_BLOCK_MAX_BITS - i - 7;
+ const int win_idx = WMAPRO_BLOCK_MAX_BITS - i;
ff_sine_window_init(ff_sine_windows[win_idx], n);
s->windows[WMAPRO_BLOCK_SIZES - i - 1] = ff_sine_windows[win_idx];
}