Remove unnecessary system header includes.
[paraslash.git] / wmadec_filter.c
index e4afbb56ab2d82d8d482cf27ec1eb7f96c1e5832..6b7251ee06338d1c1b50b4cd5eb674a6958ee0c0 100644 (file)
 
 #define _XOPEN_SOURCE 600
 
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdlib.h>
 #include <math.h>
-#include <string.h>
 #include <regex.h>
 #include <sys/select.h>
 
@@ -62,17 +58,11 @@ struct private_wmadec_data {
        /** Information contained in the audio file header. */
        struct asf_header_info ahi;
        struct getbit_context gb;
-       /** Whether to use the bit reservoir. */
-       int use_bit_reservoir;
-       /** Whether to use variable block length. */
-       int use_variable_block_len;
-       /** Whether to use exponent coding. */
-       int use_exp_vlc;
        /** Whether perceptual noise is added. */
        int use_noise_coding;
        /** Depends on number of the bits per second and the frame length. */
        int byte_offset_bits;
-       /** Only used if use_exp_vlc is true. */
+       /** Only used if ahi->use_exp_vlc is true. */
        struct vlc exp_vlc;
        uint16_t exponent_bands[BLOCK_NB_SIZES][25];
        /** The index of the first coef in high band. */
@@ -96,7 +86,7 @@ struct private_wmadec_data {
        int frame_len;
        /** log2 of frame_len. */
        int frame_len_bits;
-       /** Number of block sizes. */
+       /** Number of block sizes, one if !ahi->use_variable_block_len. */
        int nb_block_sizes;
        /* block info */
        int reset_block_lengths;
@@ -180,7 +170,7 @@ static void wmadec_cleanup(struct private_wmadec_data *pwd)
 
        for (i = 0; i < pwd->nb_block_sizes; i++)
                imdct_end(pwd->mdct_ctx[i]);
-       if (pwd->use_exp_vlc)
+       if (pwd->ahi.use_exp_vlc)
                free_vlc(&pwd->exp_vlc);
        if (pwd->use_noise_coding)
                free_vlc(&pwd->hgain_vlc);
@@ -314,7 +304,7 @@ static int wma_init(struct private_wmadec_data *pwd)
        else
                pwd->frame_len_bits = 11;
        pwd->frame_len = 1 << pwd->frame_len_bits;
-       if (pwd->use_variable_block_len) {
+       if (pwd->ahi.use_variable_block_len) {
                int nb_max, nb;
                nb = ((flags2 >> 3) & 3) + 1;
                if ((ahi->bit_rate / ahi->channels) >= 32000)
@@ -395,7 +385,7 @@ static int wma_init(struct private_wmadec_data *pwd)
                pwd->frame_len, bps, bps1,
                high_freq, pwd->byte_offset_bits);
        PARA_INFO_LOG("use_noise_coding=%d use_exp_vlc=%d nb_block_sizes=%d\n",
-               pwd->use_noise_coding, pwd->use_exp_vlc, pwd->nb_block_sizes);
+               pwd->use_noise_coding, pwd->ahi.use_exp_vlc, pwd->nb_block_sizes);
 
        compute_scale_factor_band_sizes(pwd, high_freq);
        /* init MDCT windows : simple sinus window */
@@ -410,7 +400,7 @@ static int wma_init(struct private_wmadec_data *pwd)
 
        if (pwd->use_noise_coding) {
                /* init the noise generator */
-               if (pwd->use_exp_vlc)
+               if (pwd->ahi.use_exp_vlc)
                        pwd->noise_mult = 0.02;
                else
                        pwd->noise_mult = 0.04;
@@ -484,10 +474,6 @@ static int wma_decode_init(char *initial_buf, int len, struct private_wmadec_dat
                return ret;
        }
 
-       pwd->use_exp_vlc = pwd->ahi.flags2 & 0x0001;
-       pwd->use_bit_reservoir = pwd->ahi.flags2 & 0x0002;
-       pwd->use_variable_block_len = pwd->ahi.flags2 & 0x0004;
-
        ret = wma_init(pwd);
        if (ret < 0)
                return ret;
@@ -504,7 +490,7 @@ static int wma_decode_init(char *initial_buf, int len, struct private_wmadec_dat
                        wma_hgain_huffcodes, 2);
        }
 
-       if (pwd->use_exp_vlc) {
+       if (pwd->ahi.use_exp_vlc) {
                PARA_INFO_LOG("using exp_vlc\n");
                init_vlc(&pwd->exp_vlc, EXPVLCBITS, sizeof(wma_scale_huffbits),
                        wma_scale_huffbits, wma_scale_huffcodes, 4);
@@ -850,7 +836,7 @@ static int wma_decode_block(struct private_wmadec_data *pwd)
        int nb_coefs[MAX_CHANNELS];
 
        /* compute current block length */
-       if (pwd->use_variable_block_len) {
+       if (pwd->ahi.use_variable_block_len) {
                n = wma_log2(pwd->nb_block_sizes - 1) + 1;
 
                if (pwd->reset_block_lengths) {
@@ -927,7 +913,7 @@ static int wma_decode_block(struct private_wmadec_data *pwd)
        if ((pwd->block_len_bits == pwd->frame_len_bits) || get_bit(&pwd->gb)) {
                for (ch = 0; ch < pwd->ahi.channels; ch++) {
                        if (pwd->channel_coded[ch]) {
-                               if (pwd->use_exp_vlc) {
+                               if (pwd->ahi.use_exp_vlc) {
                                        ret = decode_exp_vlc(pwd, ch);
                                        if (ret < 0)
                                                return ret;
@@ -1096,7 +1082,7 @@ static int wma_decode_superframe(struct private_wmadec_data *pwd, void *data,
        buf_size = pwd->ahi.block_align;
        samples = data;
        init_get_bits(&pwd->gb, buf, buf_size);
-       if (pwd->use_bit_reservoir) {
+       if (pwd->ahi.use_bit_reservoir) {
                int i, nb_frames, bit_offset, pos, len;
                uint8_t *q;
 
@@ -1213,9 +1199,9 @@ static int wmadec_execute(struct btr_node *btrn, const char *cmd, char **result)
 
 #define WMA_OUTPUT_BUFFER_SIZE (128 * 1024)
 
-static int wmadec_post_select(__a_unused struct sched *s, struct task *t)
+static int wmadec_post_select(__a_unused struct sched *s, void *context)
 {
-       struct filter_node *fn = task_context(t);
+       struct filter_node *fn = context;
        int ret, converted, out_size;
        struct private_wmadec_data *pwd = fn->private_data;
        struct btr_node *btrn = fn->btrn;