summaryrefslogtreecommitdiff
path: root/libavcodec/aacenc.c
diff options
context:
space:
mode:
authorNathan Caldwell <saintdev@gmail.com>2010-07-19 18:22:44 +0000
committerAlex Converse <alex.converse@gmail.com>2010-07-19 18:22:44 +0000
commit2bb1d0e77adf369e6e07a4f58a56b1589b0c1490 (patch)
treefdb762b400b0955c709e22999c6f3693fb3416d4 /libavcodec/aacenc.c
parent0045499deca8691f48f4edf8afa8e92d49681b5b (diff)
aacenc: Adjust array offsets for the current channel before calling ff_psy_suggest_window().
Patch by Nathan Caldwell <saintdev@gmail.com> Originally committed as revision 24332 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/aacenc.c')
-rw-r--r--libavcodec/aacenc.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index ec8f8e76e6..0fa33e87b1 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -517,20 +517,21 @@ static int aac_encode_frame(AVCodecContext *avctx,
tag = chan_map[i+1];
chans = tag == TYPE_CPE ? 2 : 1;
cpe = &s->cpe[i];
- samples2 = samples + start_ch;
- la = samples2 + (448+64) * avctx->channels + start_ch;
- if (!data)
- la = NULL;
for (j = 0; j < chans; j++) {
IndividualChannelStream *ics = &cpe->ch[j].ics;
int k;
+ int cur_channel = start_ch + j;
+ samples2 = samples + cur_channel;
+ la = samples2 + (448+64) * avctx->channels;
+ if (!data)
+ la = NULL;
if (tag == TYPE_LFE) {
wi[j].window_type[0] = ONLY_LONG_SEQUENCE;
wi[j].window_shape = 0;
wi[j].num_windows = 1;
wi[j].grouping[0] = 1;
} else {
- wi[j] = ff_psy_suggest_window(&s->psy, samples2, la, start_ch + j,
+ wi[j] = ff_psy_suggest_window(&s->psy, samples2, la, cur_channel,
ics->window_sequence[0]);
}
ics->window_sequence[1] = ics->window_sequence[0];
@@ -543,8 +544,8 @@ static int aac_encode_frame(AVCodecContext *avctx,
for (k = 0; k < ics->num_windows; k++)
ics->group_len[k] = wi[j].grouping[k];
- s->cur_channel = start_ch + j;
- apply_window_and_mdct(avctx, s, &cpe->ch[j], samples2 + j);
+ s->cur_channel = cur_channel;
+ apply_window_and_mdct(avctx, s, &cpe->ch[j], samples2);
}
start_ch += chans;
}