Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2019-06-04 14:03:50 +0300
committerJames Almer <jamrial@gmail.com>2022-03-15 15:42:45 +0300
commit3c933af4934fa7e1119b8d684d361b85530bfe31 (patch)
tree15471681eda25ce664c942d3b57e12347d5e6fb8 /libavcodec/wmadec.c
parent03ba5cf321e42e3a42c283ed717fc812b760e039 (diff)
wma: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/wmadec.c')
-rw-r--r--libavcodec/wmadec.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c
index 9955aaa7d6..8b0893c74e 100644
--- a/libavcodec/wmadec.c
+++ b/libavcodec/wmadec.c
@@ -439,6 +439,7 @@ static void wma_window(WMACodecContext *s, float *out)
*/
static int wma_decode_block(WMACodecContext *s)
{
+ int channels = s->avctx->ch_layout.nb_channels;
int n, v, a, ch, bsize;
int coef_nb_bits, total_gain;
int nb_coefs[MAX_CHANNELS];
@@ -504,10 +505,10 @@ static int wma_decode_block(WMACodecContext *s)
return -1;
}
- if (s->avctx->channels == 2)
+ if (channels == 2)
s->ms_stereo = get_bits1(&s->gb);
v = 0;
- for (ch = 0; ch < s->avctx->channels; ch++) {
+ for (ch = 0; ch < channels; ch++) {
a = get_bits1(&s->gb);
s->channel_coded[ch] = a;
v |= a;
@@ -538,12 +539,12 @@ static int wma_decode_block(WMACodecContext *s)
/* compute number of coefficients */
n = s->coefs_end[bsize] - s->coefs_start;
- for (ch = 0; ch < s->avctx->channels; ch++)
+ for (ch = 0; ch < channels; ch++)
nb_coefs[ch] = n;
/* complex coding */
if (s->use_noise_coding) {
- for (ch = 0; ch < s->avctx->channels; ch++) {
+ for (ch = 0; ch < channels; ch++) {
if (s->channel_coded[ch]) {
int i, n, a;
n = s->exponent_high_sizes[bsize];
@@ -556,7 +557,7 @@ static int wma_decode_block(WMACodecContext *s)
}
}
}
- for (ch = 0; ch < s->avctx->channels; ch++) {
+ for (ch = 0; ch < channels; ch++) {
if (s->channel_coded[ch]) {
int i, n, val;
@@ -579,7 +580,7 @@ static int wma_decode_block(WMACodecContext *s)
/* exponents can be reused in short blocks. */
if ((s->block_len_bits == s->frame_len_bits) || get_bits1(&s->gb)) {
- for (ch = 0; ch < s->avctx->channels; ch++) {
+ for (ch = 0; ch < channels; ch++) {
if (s->channel_coded[ch]) {
if (s->use_exp_vlc) {
if (decode_exp_vlc(s, ch) < 0)
@@ -593,13 +594,13 @@ static int wma_decode_block(WMACodecContext *s)
}
}
- for (ch = 0; ch < s->avctx->channels; ch++) {
+ for (ch = 0; ch < channels; ch++) {
if (s->channel_coded[ch] && !s->exponents_initialized[ch])
return AVERROR_INVALIDDATA;
}
/* parse spectral coefficients : just RLE encoding */
- for (ch = 0; ch < s->avctx->channels; ch++) {
+ for (ch = 0; ch < channels; ch++) {
if (s->channel_coded[ch]) {
int tindex;
WMACoef *ptr = &s->coefs1[ch][0];
@@ -616,7 +617,7 @@ static int wma_decode_block(WMACodecContext *s)
if (ret < 0)
return ret;
}
- if (s->version == 1 && s->avctx->channels >= 2)
+ if (s->version == 1 && channels >= 2)
align_get_bits(&s->gb);
}
@@ -629,7 +630,7 @@ static int wma_decode_block(WMACodecContext *s)
}
/* finally compute the MDCT coefficients */
- for (ch = 0; ch < s->avctx->channels; ch++) {
+ for (ch = 0; ch < channels; ch++) {
if (s->channel_coded[ch]) {
WMACoef *coefs1;
float *coefs, *exponents, mult, mult1, noise;
@@ -730,7 +731,7 @@ static int wma_decode_block(WMACodecContext *s)
}
#ifdef TRACE
- for (ch = 0; ch < s->avctx->channels; ch++) {
+ for (ch = 0; ch < channels; ch++) {
if (s->channel_coded[ch]) {
dump_floats(s, "exponents", 3, s->exponents[ch], s->block_len);
dump_floats(s, "coefs", 1, s->coefs[ch], s->block_len);
@@ -754,7 +755,7 @@ static int wma_decode_block(WMACodecContext *s)
next:
mdct = &s->mdct_ctx[bsize];
- for (ch = 0; ch < s->avctx->channels; ch++) {
+ for (ch = 0; ch < channels; ch++) {
int n4, index;
n4 = s->block_len / 2;
@@ -799,7 +800,7 @@ static int wma_decode_frame(WMACodecContext *s, float **samples,
break;
}
- for (ch = 0; ch < s->avctx->channels; ch++) {
+ for (ch = 0; ch < s->avctx->ch_layout.nb_channels; ch++) {
/* copy current block to output */
memcpy(samples[ch] + samples_offset, s->frame_out[ch],
s->frame_len * sizeof(*s->frame_out[ch]));
@@ -838,7 +839,7 @@ static int wma_decode_superframe(AVCodecContext *avctx, void *data,
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret;
- for (i = 0; i < s->avctx->channels; i++)
+ for (i = 0; i < s->avctx->ch_layout.nb_channels; i++)
memcpy(frame->extended_data[i], &s->frame_out[i][0],
frame->nb_samples * sizeof(s->frame_out[i][0]));