]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/mdct.c
Generic metadata API.
[ffmpeg] / libavcodec / mdct.c
index 069ad5b5d1d0dcc186cceb083061a8f1d7d41824..c85b82f9dbe4f8266d919c270e3fbb8159474bbd 100644 (file)
@@ -48,11 +48,20 @@ void ff_kbd_window_init(float *window, float alpha, int n)
        window[i] = sqrt(local_window[i] / sum);
 }
 
+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]);
+float *ff_sine_windows[5] = {
+    ff_sine_128, ff_sine_256, ff_sine_512, ff_sine_1024, ff_sine_2048,
+};
+
 // Generate a sine window.
 void ff_sine_window_init(float *window, int n) {
     int i;
     for(i = 0; i < n; i++)
-        window[i] = sin((i + 0.5) / (2 * n) * M_PI);
+        window[i] = sinf((i + 0.5) * (M_PI / (2.0 * n)));
 }
 
 /**
@@ -106,7 +115,7 @@ int ff_mdct_init(MDCTContext *s, int nbits, int inverse)
  * @param output N/2 samples
  * @param input N/2 samples
  */
-void ff_imdct_half(MDCTContext *s, FFTSample *output, const FFTSample *input)
+void ff_imdct_half_c(MDCTContext *s, FFTSample *output, const FFTSample *input)
 {
     int k, n8, n4, n2, n, j;
     const uint16_t *revtab = s->fft.revtab;
@@ -150,15 +159,14 @@ void ff_imdct_half(MDCTContext *s, FFTSample *output, const FFTSample *input)
  * @param input N/2 samples
  * @param tmp N/2 samples
  */
-void ff_imdct_calc(MDCTContext *s, FFTSample *output,
-                   const FFTSample *input, FFTSample *tmp)
+void ff_imdct_calc_c(MDCTContext *s, FFTSample *output, const FFTSample *input)
 {
     int k;
     int n = 1 << s->nbits;
     int n2 = n >> 1;
     int n4 = n >> 2;
 
-    ff_imdct_half(s, output+n4, input);
+    ff_imdct_half_c(s, output+n4, input);
 
     for(k = 0; k < n4; k++) {
         output[k] = -output[n2-k-1];
@@ -172,11 +180,10 @@ void ff_imdct_calc(MDCTContext *s, FFTSample *output,
  * @param out N/2 samples
  * @param tmp temporary storage of N/2 samples
  */
-void ff_mdct_calc(MDCTContext *s, FFTSample *out,
-                  const FFTSample *input, FFTSample *tmp)
+void ff_mdct_calc(MDCTContext *s, FFTSample *out, const FFTSample *input)
 {
     int i, j, n, n8, n4, n2, n3;
-    FFTSample re, im, re1, im1;
+    FFTSample re, im;
     const uint16_t *revtab = s->fft.revtab;
     const FFTSample *tcos = s->tcos;
     const FFTSample *tsin = s->tsin;