]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
wma: make ->ms_stereo local to wma_decode_block().
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 11 Jun 2017 16:25:32 +0000 (18:25 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Thu, 6 Jul 2017 19:00:36 +0000 (21:00 +0200)
mid/side stereo mode is a per-block property and thus does not
need to be stored in the private_wmadec_data structure.

wmadec_filter.c

index 7b4b1a28183d0b242eae01c7dafc8b799eb4dc17..71a7cd785c60852ba64cb3ec1bd0395071873f67 100644 (file)
@@ -99,8 +99,6 @@ struct private_wmadec_data {
        int block_len;
        /** Current position in frame. */
        int block_pos;
-       /** True if mid/side stereo mode. */
-       uint8_t ms_stereo;
        /** True if channel is coded. */
        uint8_t channel_coded[MAX_CHANNELS];
        /** log2 ratio frame/exp. length. */
@@ -798,6 +796,7 @@ static int wma_decode_block(struct private_wmadec_data *pwd)
        int ret, n, v, ch, code, bsize;
        int coef_nb_bits, total_gain;
        int nb_coefs[MAX_CHANNELS];
+       bool ms_stereo = false; /* mid/side stereo mode */
 
        /* compute current block length */
        if (pwd->ahi.use_variable_block_len) {
@@ -835,7 +834,7 @@ static int wma_decode_block(struct private_wmadec_data *pwd)
                return -E_INCOHERENT_BLOCK_LEN;
 
        if (pwd->ahi.channels == 2)
-               pwd->ms_stereo = get_bit(&pwd->gb);
+               ms_stereo = get_bit(&pwd->gb);
        v = 0;
        for (ch = 0; ch < pwd->ahi.channels; ch++) {
                int a = get_bit(&pwd->gb);
@@ -901,7 +900,7 @@ static int wma_decode_block(struct private_wmadec_data *pwd)
                 * special VLC tables are used for ms stereo because there is
                 * potentially less energy there
                 */
-               tindex = (ch == 1 && pwd->ms_stereo);
+               tindex = ch == 1 && ms_stereo;
                coef_vlc = &pwd->coef_vlc[tindex];
                run_table = pwd->run_table[tindex];
                level_table = pwd->level_table[tindex];
@@ -936,7 +935,7 @@ static int wma_decode_block(struct private_wmadec_data *pwd)
                }
        }
        compute_mdct_coefficients(pwd, bsize, total_gain, nb_coefs);
-       if (pwd->ms_stereo && pwd->channel_coded[1]) {
+       if (ms_stereo && pwd->channel_coded[1]) {
                float a, b;
                int i;
                /*
@@ -964,7 +963,7 @@ next:
                n4 = pwd->block_len / 2;
                if (pwd->channel_coded[ch])
                        imdct(pwd->mdct_ctx[bsize], pwd->output, pwd->coefs[ch]);
-               else if (!(pwd->ms_stereo && ch == 1))
+               else if (!(ms_stereo && ch == 1))
                        memset(pwd->output, 0, sizeof(pwd->output));
 
                /* multiply by the window and add in the frame */