server: Do not fail if client does not request sideband.
[paraslash.git] / imdct.c
diff --git a/imdct.c b/imdct.c
index ba5690b04e52bdd45ea2d433822d6e6da47fc19d..d2a0681898b6497f2742e842d3b9ef1ed104621a 100644 (file)
--- a/imdct.c
+++ b/imdct.c
  * \file imdct.c Inverse modified discrete cosine transform.
  */
 
-#include <inttypes.h>
 #include <math.h>
-#include <string.h>
-#include <stdlib.h>
 #include <regex.h>
 
 #include "para.h"
@@ -58,8 +55,10 @@ struct mdct_context {
        struct fft_context fft;
 };
 
-/** cos(2 * pi * x / n) for 0 <= x <= n / 4, followed by its reverse */
-#define COSINE_TAB(n) fftsample_t cos_ ## n[n / 2] __aligned(16)
+/** \cond cosine_tabs */
+
+/* cos(2 * pi * x / n) for 0 <= x <= n / 4, followed by its reverse */
+#define COSINE_TAB(n) static fftsample_t cos_ ## n[n / 2] __a_aligned(16)
 
 COSINE_TAB(16);
 COSINE_TAB(32);
@@ -79,8 +78,9 @@ static fftsample_t *cos_tabs[] = {
        cos_16, cos_32, cos_64, cos_128, cos_256, cos_512, cos_1024, cos_2048,
        cos_4096, cos_8192, cos_16384, cos_32768, cos_65536,
 };
+/** \endcond cosine_tabs */
 
-static int split_radix_permutation(int i, int n)
+__a_const static int split_radix_permutation(int i, int n)
 {
        int m;
        if (n <= 2)
@@ -95,9 +95,6 @@ static int split_radix_permutation(int i, int n)
                return split_radix_permutation(i, m) * 4 - 1;
 }
 
-/** 1 / sqrt(2). */
-#define SQRTHALF (float)0.70710678118654752440
-
 #define BF(x, y, a, b) {\
        x = a - b;\
        y = a + b;\
@@ -209,7 +206,7 @@ static void fft8(struct fft_complex *z)
        BF(z[6].re, z[2].re, z[2].re, t7);
        BF(z[6].im, z[2].im, z[2].im, t8);
 
-       TRANSFORM(z[1], z[3], z[5], z[7], SQRTHALF, SQRTHALF);
+       TRANSFORM(z[1], z[3], z[5], z[7], M_SQRT1_2, M_SQRT1_2);
 }
 
 static void fft16(struct fft_complex *z)
@@ -221,7 +218,7 @@ static void fft16(struct fft_complex *z)
        fft4(z + 12);
 
        TRANSFORM_ZERO(z[0], z[4], z[8], z[12]);
-       TRANSFORM(z[2], z[6], z[10], z[14], SQRTHALF, SQRTHALF);
+       TRANSFORM(z[2], z[6], z[10], z[14], M_SQRT1_2, M_SQRT1_2);
        TRANSFORM(z[1], z[5], z[9], z[13], cos_16[1], cos_16[3]);
        TRANSFORM(z[3], z[7], z[11], z[15], cos_16[3], cos_16[1]);
 }
@@ -296,7 +293,6 @@ static void imdct_half(struct mdct_context *s, fftsample_t *output,
        fft(&s->fft, z);
 
        /* post rotation + reordering */
-       output += n4;
        for (k = 0; k < n8; k++) {
                fftsample_t r0, i0, r1, i1;
                CMUL(r0, i1, z[n8 - k - 1].im, z[n8 - k - 1].re,