X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fg722enc.c;h=38432f5006c707272b9402f7565116d383114701;hb=a92193f247816a45c16c37a2f7db723a0359c24c;hp=17dde9ec809837f0d0cd290885fef23dd897257d;hpb=72db3c79dfddbeae82c540c785c680654a77b063;p=ffmpeg diff --git a/libavcodec/g722enc.c b/libavcodec/g722enc.c index 17dde9ec809..38432f5006c 100644 --- a/libavcodec/g722enc.c +++ b/libavcodec/g722enc.c @@ -120,6 +120,8 @@ static av_cold int g722_encode_init(AVCodecContext * avctx) } } + ff_g722dsp_init(&c->dsp); + return 0; error: g722_encode_close(avctx); @@ -136,12 +138,12 @@ static const int16_t low_quant[33] = { static inline void filter_samples(G722Context *c, const int16_t *samples, int *xlow, int *xhigh) { - int xout1, xout2; + int xout[2]; c->prev_samples[c->prev_samples_pos++] = samples[0]; c->prev_samples[c->prev_samples_pos++] = samples[1]; - ff_g722_apply_qmf(c->prev_samples + c->prev_samples_pos - 24, &xout1, &xout2); - *xlow = xout1 + xout2 >> 14; - *xhigh = xout1 - xout2 >> 14; + c->dsp.apply_qmf(c->prev_samples + c->prev_samples_pos - 24, xout); + *xlow = xout[0] + xout[1] >> 14; + *xhigh = xout[0] - xout[1] >> 14; if (c->prev_samples_pos >= PREV_SAMPLES_BUF_SIZE) { memmove(c->prev_samples, c->prev_samples + c->prev_samples_pos - 22, @@ -224,9 +226,9 @@ static void g722_encode_trellis(G722Context *c, int trellis, if (k < 0) continue; - decoded = av_clip((cur_node->state.scale_factor * + decoded = av_clip_intp2((cur_node->state.scale_factor * ff_g722_low_inv_quant6[k] >> 10) - + cur_node->state.s_predictor, -16384, 16383); + + cur_node->state.s_predictor, 14); dec_diff = xlow - decoded; #define STORE_NODE(index, UPDATE, VALUE)\ @@ -283,8 +285,7 @@ static void g722_encode_trellis(G722Context *c, int trellis, dhigh = cur_node->state.scale_factor * ff_g722_high_inv_quant[ihigh] >> 10; - decoded = av_clip(dhigh + cur_node->state.s_predictor, - -16384, 16383); + decoded = av_clip_intp2(dhigh + cur_node->state.s_predictor, 14); dec_diff = xhigh - decoded; STORE_NODE(1, ff_g722_update_high_predictor(&node->state, dhigh, ihigh), ihigh);