* For licencing details see COPYING.LIB.
*/
-/** * \file wmadec_filter.c paraslash's WMA decoder. */
+/** \file wmadec_filter.c paraslash's WMA decoder. */
/*
* This decoder handles Microsoft Windows Media Audio data version 2.
};
#define EXPVLCBITS 8
-#define EXPMAX ((19+EXPVLCBITS-1)/EXPVLCBITS)
+#define EXPMAX ((19 + EXPVLCBITS - 1) / EXPVLCBITS)
#define HGAINVLCBITS 9
-#define HGAINMAX ((13+HGAINVLCBITS-1)/HGAINVLCBITS)
+#define HGAINMAX ((13 + HGAINVLCBITS - 1) / HGAINVLCBITS)
#define VLCBITS 9
-#define VLCMAX ((22+VLCBITS-1)/VLCBITS)
+#define VLCMAX ((22 + VLCBITS - 1) / VLCBITS)
DECLARE_ALIGNED(16, float, ff_sine_128[128]);
DECLARE_ALIGNED(16, float, ff_sine_256[256]);
window[i] = sinf((i + 0.5) * (M_PI / (2.0 * n)));
}
-static int wmadec_cleanup(struct private_wmadec_data *s)
+static void wmadec_cleanup(struct private_wmadec_data *s)
{
int i;
for (i = 0; i < s->nb_block_sizes; i++)
imdct_end(s->mdct_ctx[i]);
-
if (s->use_exp_vlc)
free_vlc(&s->exp_vlc);
if (s->use_noise_coding)
free(s->level_table[i]);
free(s->int_table[i]);
}
- return 0;
}
/* XXX: use same run/length optimization as mpeg decoders */
if (nb > nb_max)
nb = nb_max;
s->nb_block_sizes = nb + 1;
- } else {
+ } else
s->nb_block_sizes = 1;
- }
/* init rate dependent parameters */
s->use_noise_coding = 1;
if ((s->block_pos + s->block_len) > s->frame_len)
return -E_INCOHERENT_BLOCK_LEN;
- if (s->ahi.channels == 2) {
+ if (s->ahi.channels == 2)
s->ms_stereo = get_bits1(&s->gb);
- }
v = 0;
for (ch = 0; ch < s->ahi.channels; ch++) {
int a = get_bits1(&s->gb);
}
/* Decode a frame of frame_len samples. */
-static int wma_decode_frame(struct private_wmadec_data *s, int16_t * samples)
+static int wma_decode_frame(struct private_wmadec_data *s, int16_t *samples)
{
int ret, i, n, ch, incr;
int16_t *ptr;
*q++ = get_bits(&s->gb, 8);
len -= 8;
}
- if (len > 0) {
+ if (len > 0)
*q++ = get_bits(&s->gb, len) << (8 - len);
- }
/* XXX: bit_offset bits into last frame */
init_get_bits(&s->gb, s->last_superframe,
pos >>= 3;
len = buf_size - pos;
ret = -E_WMA_BAD_SUPERFRAME;
- if (len > MAX_CODED_SUPERFRAME_SIZE || len < 0) {
+ if (len > MAX_CODED_SUPERFRAME_SIZE || len < 0)
goto fail;
- }
s->last_superframe_len = len;
memcpy(s->last_superframe, buf + pos, len);
} else {
static void wmadec_close(struct filter_node *fn)
{
struct private_wmadec_data *pwd = fn->private_data;
+
if (!pwd)
return;
wmadec_cleanup(pwd);