avcodec/dstdec: Use local channels variable

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2020-02-13 20:41:45 +01:00
parent c2c65d1d1f
commit 34a6a36844

View File

@ -262,7 +262,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
skip_bits1(gb);
if (get_bits(gb, 6))
return AVERROR_INVALIDDATA;
memcpy(frame->data[0], avpkt->data + 1, FFMIN(avpkt->size - 1, frame->nb_samples * avctx->channels));
memcpy(frame->data[0], avpkt->data + 1, FFMIN(avpkt->size - 1, frame->nb_samples * channels));
goto dsd;
}
@ -287,7 +287,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
same_map = get_bits1(gb);
if ((ret = read_map(gb, &s->fsets, map_ch_to_felem, avctx->channels)) < 0)
if ((ret = read_map(gb, &s->fsets, map_ch_to_felem, channels)) < 0)
return ret;
if (same_map) {
@ -295,13 +295,13 @@ static int decode_frame(AVCodecContext *avctx, void *data,
memcpy(map_ch_to_pelem, map_ch_to_felem, sizeof(map_ch_to_felem));
} else {
avpriv_request_sample(avctx, "Not Same Mapping");
if ((ret = read_map(gb, &s->probs, map_ch_to_pelem, avctx->channels)) < 0)
if ((ret = read_map(gb, &s->probs, map_ch_to_pelem, channels)) < 0)
return ret;
}
/* Half Probability (10.10) */
for (ch = 0; ch < avctx->channels; ch++)
for (ch = 0; ch < channels; ch++)
half_prob[ch] = get_bits1(gb);
/* Filter Coef Sets (10.12) */
@ -325,7 +325,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
build_filter(s->filter, &s->fsets);
memset(s->status, 0xAA, sizeof(s->status));
memset(dsd, 0, frame->nb_samples * 4 * avctx->channels);
memset(dsd, 0, frame->nb_samples * 4 * channels);
ac_get(ac, gb, prob_dst_x_bit(s->fsets.coeff[0][0]), &dst_x_bit);
@ -364,10 +364,10 @@ static int decode_frame(AVCodecContext *avctx, void *data,
}
dsd:
for (i = 0; i < avctx->channels; i++) {
for (i = 0; i < channels; i++) {
ff_dsd2pcm_translate(&s->dsdctx[i], frame->nb_samples, 0,
frame->data[0] + i * 4,
avctx->channels * 4, pcm + i, avctx->channels);
channels * 4, pcm + i, channels);
}
*got_frame_ptr = 1;