diff options
author | Anton Khirnov <anton@khirnov.net> | 2019-06-04 12:37:42 +0200 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2022-03-15 09:42:45 -0300 |
commit | 1191ffd50a756fc621b34eb8f84a583c35f3573a (patch) | |
tree | 90d5869dd156d3182693c3a2958fa5de35ce672b /libavcodec/ttaenc.c | |
parent | 0045c6dd5cc50adbcb0039924b0ac5b55da0fdeb (diff) | |
download | ffmpeg-1191ffd50a756fc621b34eb8f84a583c35f3573a.tar.gz |
tta: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/ttaenc.c')
-rw-r--r-- | libavcodec/ttaenc.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/libavcodec/ttaenc.c b/libavcodec/ttaenc.c index addaf30bb5..5717ec22d1 100644 --- a/libavcodec/ttaenc.c +++ b/libavcodec/ttaenc.c @@ -56,7 +56,7 @@ static av_cold int tta_encode_init(AVCodecContext *avctx) s->bps = avctx->bits_per_raw_sample >> 3; avctx->frame_size = 256 * avctx->sample_rate / 245; - s->ch_ctx = av_malloc_array(avctx->channels, sizeof(*s->ch_ctx)); + s->ch_ctx = av_malloc_array(avctx->ch_layout.nb_channels, sizeof(*s->ch_ctx)); if (!s->ch_ctx) return AVERROR(ENOMEM); @@ -89,7 +89,7 @@ static int tta_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, TTAEncContext *s = avctx->priv_data; PutBitContext pb; int ret, i, out_bytes, cur_chan, res, samples; - int64_t pkt_size = frame->nb_samples * 2LL * avctx->channels * s->bps; + int64_t pkt_size = frame->nb_samples * 2LL * avctx->ch_layout.nb_channels * s->bps; pkt_alloc: cur_chan = 0, res = 0, samples = 0; @@ -98,13 +98,13 @@ pkt_alloc: init_put_bits(&pb, avpkt->data, avpkt->size); // init per channel states - for (i = 0; i < avctx->channels; i++) { + for (i = 0; i < avctx->ch_layout.nb_channels; i++) { s->ch_ctx[i].predictor = 0; ff_tta_filter_init(&s->ch_ctx[i].filter, ff_tta_filter_configs[s->bps - 1]); ff_tta_rice_init(&s->ch_ctx[i].rice, 10, 10); } - for (i = 0; i < frame->nb_samples * avctx->channels; i++) { + for (i = 0; i < frame->nb_samples * avctx->ch_layout.nb_channels; i++) { TTAChannel *c = &s->ch_ctx[cur_chan]; TTAFilter *filter = &c->filter; TTARice *rice = &c->rice; @@ -113,8 +113,8 @@ pkt_alloc: value = get_sample(frame, samples++, avctx->sample_fmt); - if (avctx->channels > 1) { - if (cur_chan < avctx->channels - 1) + if (avctx->ch_layout.nb_channels > 1) { + if (cur_chan < avctx->ch_layout.nb_channels - 1) value = res = get_sample(frame, samples, avctx->sample_fmt) - value; else value -= res / 2; @@ -176,7 +176,7 @@ pkt_alloc: if (k) put_bits(&pb, k, outval & (ff_tta_shift_1[k] - 1)); - if (cur_chan < avctx->channels - 1) + if (cur_chan < avctx->ch_layout.nb_channels - 1) cur_chan++; else cur_chan = 0; |