diff options
author | Paul B Mahol <onemda@gmail.com> | 2018-12-18 18:57:18 +0100 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2018-12-18 18:58:35 +0100 |
commit | d283ee085f9aac44b5de1b09e3cab62920fa4a9a (patch) | |
tree | 1c6dcc3338bdbf5f53979d9b8f98ac276c6f98a3 | |
parent | 7a124138a719d3597aa0391711fd4e82eaaff917 (diff) | |
download | ffmpeg-d283ee085f9aac44b5de1b09e3cab62920fa4a9a.tar.gz |
avcodec/g723_1dec: improve stereo support
-rw-r--r-- | libavcodec/g723_1dec.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/libavcodec/g723_1dec.c b/libavcodec/g723_1dec.c index bc8629fbec..028cde0f37 100644 --- a/libavcodec/g723_1dec.c +++ b/libavcodec/g723_1dec.c @@ -43,7 +43,6 @@ static av_cold int g723_1_decode_init(AVCodecContext *avctx) { G723_1_Context *s = avctx->priv_data; - G723_1_ChannelContext *p = &s->ch[0]; avctx->sample_fmt = AV_SAMPLE_FMT_S16P; if (avctx->channels < 1 || avctx->channels > 2) { @@ -51,13 +50,17 @@ static av_cold int g723_1_decode_init(AVCodecContext *avctx) return AVERROR(EINVAL); } avctx->channel_layout = avctx->channels == 1 ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO; - p->pf_gain = 1 << 12; + for (int ch = 0; ch < avctx->channels; ch++) { + G723_1_ChannelContext *p = &s->ch[ch]; - memcpy(p->prev_lsp, dc_lsp, LPC_ORDER * sizeof(*p->prev_lsp)); - memcpy(p->sid_lsp, dc_lsp, LPC_ORDER * sizeof(*p->sid_lsp)); + p->pf_gain = 1 << 12; - p->cng_random_seed = CNG_RANDOM_SEED; - p->past_frame_type = SID_FRAME; + memcpy(p->prev_lsp, dc_lsp, LPC_ORDER * sizeof(*p->prev_lsp)); + memcpy(p->sid_lsp, dc_lsp, LPC_ORDER * sizeof(*p->sid_lsp)); + + p->cng_random_seed = CNG_RANDOM_SEED; + p->past_frame_type = SID_FRAME; + } return 0; } |