for(k = 0; k < 8; k++)
sum += ptr0[k] * ptr1[k];
sum = (sum + (out[i] << 12) + 0x800) >> 12;
- out[i] = clip(sum, -0x7FFE, 0x7FFE);
+ out[i] = av_clip(sum, -0x7FFE, 0x7FFE);
for(k = 7; k > 0; k--)
ptr0[k] = ptr0[k - 1];
ptr0[0] = out[i];
sum += ptr0[k] * t[k];
for(k = 7; k > 0; k--)
ptr0[k] = ptr0[k - 1];
- ptr0[0] = clip((sum + 0x800) >> 12, -0x7FFE, 0x7FFE);
+ ptr0[0] = av_clip((sum + 0x800) >> 12, -0x7FFE, 0x7FFE);
sum = ((ptr0[1] * (dec->filtval - (dec->filtval >> 2))) >> 4) + sum;
sum = sum - (sum >> 3);
- out[i] = clip((sum + 0x800) >> 12, -0x7FFE, 0x7FFE);
+ out[i] = av_clip((sum + 0x800) >> 12, -0x7FFE, 0x7FFE);
}
}
{
TSContext *c = avctx->priv_data;
- int i;
+ int i, j;
short *samples = data;
int consumed = 0;
int16_t out_buf[240];
+ int iterations;
if (!buf_size)
return 0;
- while (consumed < buf_size) {
+ iterations = FFMIN(buf_size / 32, *data_size / 480);
+ for(j = 0; j < iterations; j++) {
truespeech_read_frame(c, buf + consumed);
consumed += 32;
*data_size = consumed * 15;
- return buf_size;
+ return consumed;
}
AVCodec truespeech_decoder = {