static void wma_lsp_to_curve_init(WMACodecContext *s, int frame_len);
#ifdef TRACE
-static void dump_shorts(WMADecodeContext *s, const char *name, const short *tab, int n)
+static void dump_shorts(WMACodecContext *s, const char *name, const short *tab, int n)
{
int i;
}
}
-static void dump_floats(WMADecodeContext *s, const char *name, int prec, const float *tab, int n)
+static void dump_floats(WMACodecContext *s, const char *name, int prec, const float *tab, int n)
{
int i;
/* decode a frame of frame_len samples */
static int wma_decode_frame(WMACodecContext *s, int16_t *samples)
{
- int ret, i, n, a, ch, incr;
+ int ret, i, n, ch, incr;
int16_t *ptr;
float *iptr;
iptr = s->frame_out[ch];
for(i=0;i<n;i++) {
- a = lrintf(*iptr++);
- if (a > 32767)
- a = 32767;
- else if (a < -32768)
- a = -32768;
- *ptr = a;
+ *ptr = av_clip_int16(lrintf(*iptr++));
ptr += incr;
}
/* prepare for next block */
static int wma_decode_superframe(AVCodecContext *avctx,
void *data, int *data_size,
- uint8_t *buf, int buf_size)
+ const uint8_t *buf, int buf_size)
{
WMACodecContext *s = avctx->priv_data;
int nb_frames, bit_offset, i, pos, len;
s->last_superframe_len = 0;
return 0;
}
+ if (buf_size < s->block_align)
+ return 0;
+ buf_size = s->block_align;
samples = data;
if (s->use_bit_reservoir) {
/* read super frame header */
- get_bits(&s->gb, 4); /* super frame index */
+ skip_bits(&s->gb, 4); /* super frame index */
nb_frames = get_bits(&s->gb, 4) - 1;
bit_offset = get_bits(&s->gb, s->byte_offset_bits + 3);