]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - wmadec_filter.c
Add __aligned macro to gcc-compat.h. and use this instead of DECLARE_ALIGNED.
[paraslash.git] / wmadec_filter.c
index 70b18b8627c675001c8c85bbb79d7f24a55eff4d..d40cc3eb201d808be4d98e4665038e86f221ff70 100644 (file)
@@ -24,6 +24,7 @@
 #include <math.h>
 #include <string.h>
 #include <regex.h>
+#include <sys/select.h>
 
 #include "para.h"
 #include "error.h"
@@ -130,12 +131,14 @@ struct private_wmadec_data {
 #define VLCBITS 9
 #define VLCMAX ((22 + VLCBITS - 1) / VLCBITS)
 
-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]);
+#define SINE_WINDOW(x) float ff_sine_ ## x[x] __aligned(16)
+
+SINE_WINDOW(128);
+SINE_WINDOW(256);
+SINE_WINDOW(512);
+SINE_WINDOW(1024);
+SINE_WINDOW(2048);
+SINE_WINDOW(4096);
 
 static float *ff_sine_windows[6] = {
        ff_sine_128, ff_sine_256, ff_sine_512, ff_sine_1024,
@@ -823,7 +826,7 @@ static int wma_decode_block(struct private_wmadec_data *pwd)
        /* parse spectral coefficients : just RLE encoding */
        for (ch = 0; ch < pwd->ahi.channels; ch++) {
                struct vlc *coef_vlc;
-               int level, run, sign, tindex;
+               int level, run, tindex;
                int16_t *ptr, *eptr;
                const uint16_t *level_table, *run_table;
 
@@ -856,8 +859,7 @@ static int wma_decode_block(struct private_wmadec_data *pwd)
                                run = run_table[code];
                                level = level_table[code];
                        }
-                       sign = get_bit(&pwd->gb);
-                       if (!sign)
+                       if (!get_bit(&pwd->gb))
                                level = -level;
                        ptr += run;
                        if (ptr >= eptr) {
@@ -1232,7 +1234,7 @@ static int wma_decode_superframe(struct private_wmadec_data *pwd, void *data,
                samples += pwd->ahi.channels * pwd->frame_len;
        }
        PARA_DEBUG_LOG("frame_count: %d frame_len: %d, block_len: %d, "
-               "outbytes: %d, eaten: %d\n",
+               "outbytes: %zd, eaten: %d\n",
                frame_count, pwd->frame_len, pwd->block_len,
                (int8_t *) samples - (int8_t *) data, pwd->ahi.block_align);
        *data_size = (int8_t *)samples - (int8_t *)data;
@@ -1251,6 +1253,8 @@ static ssize_t wmadec_convert(char *inbuffer, size_t len,
 
        if (out_size < 128 * 1024)
                return 0;
+       if (len <= WMA_FRAME_SKIP)
+               return 0;
        if (!pwd) {
                ret = wma_decode_init(inbuffer, len, &pwd);
                if (ret <= 0)