summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2009-05-05 23:38:12 +0000
committerJustin Ruggles <justin.ruggles@gmail.com>2009-05-05 23:38:12 +0000
commit13ec942869924c304b376b20ee2d6a64e96b3205 (patch)
tree1976ed91ce053007908f421b4bbd99d22b2b1d7f
parenta3015225c7d351a629cf0fca8662751afaf9055c (diff)
ac3dec: move channel remapping to outside of block loop
Originally committed as revision 18749 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/ac3dec.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index c142ca9bb2..56dfd8f986 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -1235,6 +1235,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
int16_t *out_samples = (int16_t *)data;
int blk, ch, err;
const uint8_t *channel_map;
+ const float *output[AC3_MAX_CHANNELS];
/* initialize the GetBitContext with the start of valid AC-3 Frame */
if (s->input_buffer) {
@@ -1326,14 +1327,13 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
/* decode the audio blocks */
channel_map = ff_ac3_dec_channel_map[s->output_mode & ~AC3_OUTPUT_LFEON][s->lfe_on];
+ for (ch = 0; ch < s->out_channels; ch++)
+ output[ch] = s->output[channel_map[ch]];
for (blk = 0; blk < s->num_blocks; blk++) {
- const float *output[s->out_channels];
if (!err && decode_audio_block(s, blk)) {
av_log(avctx, AV_LOG_ERROR, "error decoding the audio block\n");
err = 1;
}
- for (ch = 0; ch < s->out_channels; ch++)
- output[ch] = s->output[channel_map[ch]];
s->dsp.float_to_int16_interleave(out_samples, output, 256, s->out_channels);
out_samples += 256 * s->out_channels;
}