if (p->sid_gain < 0) t = INT32_MIN;
else t = INT32_MAX;
} else
- t = p->sid_gain << shift;
+ t = p->sid_gain * (1 << shift);
+ } else if(shift < -31) {
+ t = (p->sid_gain < 0) ? -1 : 0;
}else
t = p->sid_gain >> -shift;
x = av_clipl_int32(t * (int64_t)cng_filt[0] >> 16);
G723_1_ChannelContext *p = &s->ch[ch];
int16_t *audio = p->audio;
- if (unpack_bitstream(p, buf, buf_size) < 0) {
+ if (unpack_bitstream(p, buf + ch * (buf_size / avctx->channels),
+ buf_size / avctx->channels) < 0) {
bad_frame = 1;
if (p->past_frame_type == ACTIVE_FRAME)
p->cur_frame_type = ACTIVE_FRAME;
formant_postfilter(p, lpc, p->audio, out);
} else { // if output is not postfiltered it should be scaled by 2
for (i = 0; i < FRAME_LEN; i++)
- out[i] = av_clip_int16(p->audio[LPC_ORDER + i] << 1);
+ out[i] = av_clip_int16(2 * p->audio[LPC_ORDER + i]);
}
}