wma: Rename input/output buffer variables.
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 11 Jun 2017 14:20:01 +0000 (16:20 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Thu, 6 Jul 2017 19:00:36 +0000 (21:00 +0200)
The naming was confusing. With the new names it is clear which buffer
is used for input and which for output.

wmadec_filter.c

index 0c96dc6..13f1946 100644 (file)
@@ -1040,14 +1040,13 @@ static int wma_decode_frame(struct private_wmadec_data *pwd, int16_t *samples)
        return 0;
 }
 
-static int wma_decode_superframe(struct private_wmadec_data *pwd, void *data,
-               int *data_size, const uint8_t *buf)
+static int wma_decode_superframe(struct private_wmadec_data *pwd, void *out,
+               int *out_size, const uint8_t *in)
 {
-       int ret, buf_size = pwd->ahi.packet_size - WMA_FRAME_SKIP;
-       int16_t *samples;
+       int ret, in_size = pwd->ahi.packet_size - WMA_FRAME_SKIP;
+       int16_t *samples = out;
 
-       samples = data;
-       init_get_bits(&pwd->gb, buf, buf_size);
+       init_get_bits(&pwd->gb, in, in_size);
        if (pwd->ahi.use_bit_reservoir) {
                int i, nb_frames, bit_offset, pos, len;
                uint8_t *q;
@@ -1058,7 +1057,7 @@ static int wma_decode_superframe(struct private_wmadec_data *pwd, void *data,
                // PARA_DEBUG_LOG("have %d frames\n", nb_frames);
                ret = -E_WMA_OUTPUT_SPACE;
                if ((nb_frames + 1) * pwd->ahi.channels * pwd->frame_len
-                               * sizeof(int16_t) > *data_size)
+                               * sizeof(int16_t) > *out_size)
                        goto fail;
 
                bit_offset = get_bits(&pwd->gb, pwd->byte_offset_bits + 3);
@@ -1096,7 +1095,7 @@ static int wma_decode_superframe(struct private_wmadec_data *pwd, void *data,
 
                /* read each frame starting from bit_offset */
                pos = bit_offset + 4 + 4 + pwd->byte_offset_bits + 3;
-               init_get_bits(&pwd->gb, buf + (pos >> 3),
+               init_get_bits(&pwd->gb, in + (pos >> 3),
                        (MAX_CODED_SUPERFRAME_SIZE - (pos >> 3)));
                len = pos & 7;
                if (len > 0)
@@ -1115,16 +1114,16 @@ static int wma_decode_superframe(struct private_wmadec_data *pwd, void *data,
                        ((bit_offset + 4 + 4 + pwd->byte_offset_bits + 3) & ~7);
                pwd->last_bitoffset = pos & 7;
                pos >>= 3;
-               len = buf_size - pos;
+               len = in_size - pos;
                ret = -E_WMA_BAD_SUPERFRAME;
                if (len > MAX_CODED_SUPERFRAME_SIZE || len < 0)
                        goto fail;
                pwd->last_superframe_len = len;
-               memcpy(pwd->last_superframe, buf + pos, len);
+               memcpy(pwd->last_superframe, in + pos, len);
        } else {
                PARA_DEBUG_LOG("not using bit reservoir\n");
                ret = -E_WMA_OUTPUT_SPACE;
-               if (pwd->ahi.channels * pwd->frame_len * sizeof(int16_t) > *data_size)
+               if (pwd->ahi.channels * pwd->frame_len * sizeof(int16_t) > *out_size)
                        goto fail;
                /* single frame decode */
                ret = wma_decode_frame(pwd, samples);
@@ -1134,8 +1133,8 @@ static int wma_decode_superframe(struct private_wmadec_data *pwd, void *data,
        }
        PARA_DEBUG_LOG("frame_len: %d, block_len: %d, outbytes: %d, eaten: %d\n",
                pwd->frame_len, pwd->block_len,
-               (int)((int8_t *)samples - (int8_t *)data), pwd->ahi.block_align);
-       *data_size = (int8_t *)samples - (int8_t *)data;
+               (int)((int8_t *)samples - (int8_t *)out), pwd->ahi.block_align);
+       *out_size = (int8_t *)samples - (int8_t *)out;
        return pwd->ahi.block_align;
 fail:
        /* reset the bit reservoir on errors */