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;
// 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);
/* 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)
((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);
}
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 */