- out = (int16_t *)frame->data[0];
-
- if (p->cur_frame_type == ACTIVE_FRAME) {
- if (!bad_frame)
- p->erased_frames = 0;
- else if (p->erased_frames != 3)
- p->erased_frames++;
-
- ff_g723_1_inverse_quant(cur_lsp, p->prev_lsp, p->lsp_index, bad_frame);
- ff_g723_1_lsp_interpolate(lpc, cur_lsp, p->prev_lsp);
-
- /* Save the lsp_vector for the next frame */
- memcpy(p->prev_lsp, cur_lsp, LPC_ORDER * sizeof(*p->prev_lsp));
-
- /* Generate the excitation for the frame */
- memcpy(p->excitation, p->prev_excitation,
- PITCH_MAX * sizeof(*p->excitation));
- if (!p->erased_frames) {
- int16_t *vector_ptr = p->excitation + PITCH_MAX;
-
- /* Update interpolation gain memory */
- p->interp_gain = fixed_cb_gain[(p->subframe[2].amp_index +
- p->subframe[3].amp_index) >> 1];
- for (i = 0; i < SUBFRAMES; i++) {
- gen_fcb_excitation(vector_ptr, &p->subframe[i], p->cur_rate,
- p->pitch_lag[i >> 1], i);
- ff_g723_1_gen_acb_excitation(acb_vector,
- &p->excitation[SUBFRAME_LEN * i],
- p->pitch_lag[i >> 1],
- &p->subframe[i], p->cur_rate);
- /* Get the total excitation */
- for (j = 0; j < SUBFRAME_LEN; j++) {
- int v = av_clip_int16(vector_ptr[j] * 2);
- vector_ptr[j] = av_clip_int16(v + acb_vector[j]);
- }
- vector_ptr += SUBFRAME_LEN;
- }
+ for (int ch = 0; ch < avctx->channels; ch++) {
+ G723_1_ChannelContext *p = &s->ch[ch];
+ int16_t *audio = p->audio;
+
+ 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;
+ else
+ p->cur_frame_type = UNTRANSMITTED_FRAME;
+ }