Commit 3917d108 authored by alexc's avatar alexc

aacenc: Fix psy logic.

Set band info before determining scalefactors. Use the look ahead for
windowing decision.

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@23132 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 6b0e3832
...@@ -562,6 +562,7 @@ static int aac_encode_frame(AVCodecContext *avctx, ...@@ -562,6 +562,7 @@ static int aac_encode_frame(AVCodecContext *avctx,
cpe = &s->cpe[i]; cpe = &s->cpe[i];
for (j = 0; j < chans; j++) { for (j = 0; j < chans; j++) {
s->cur_channel = start_ch + j; s->cur_channel = start_ch + j;
ff_psy_set_band_info(&s->psy, s->cur_channel, cpe->ch[j].coeffs, &wi[j]);
s->coder->search_for_quantizers(avctx, s, &cpe->ch[j], s->lambda); s->coder->search_for_quantizers(avctx, s, &cpe->ch[j], s->lambda);
} }
cpe->common_window = 0; cpe->common_window = 0;
...@@ -592,7 +593,6 @@ static int aac_encode_frame(AVCodecContext *avctx, ...@@ -592,7 +593,6 @@ static int aac_encode_frame(AVCodecContext *avctx,
} }
for (j = 0; j < chans; j++) { for (j = 0; j < chans; j++) {
s->cur_channel = start_ch + j; s->cur_channel = start_ch + j;
ff_psy_set_band_info(&s->psy, s->cur_channel, cpe->ch[j].coeffs, &wi[j]);
encode_individual_channel(avctx, s, &cpe->ch[j], cpe->common_window); encode_individual_channel(avctx, s, &cpe->ch[j], cpe->common_window);
} }
start_ch += chans; start_ch += chans;
......
...@@ -195,7 +195,7 @@ static FFPsyWindowInfo psy_3gpp_window(FFPsyContext *ctx, ...@@ -195,7 +195,7 @@ static FFPsyWindowInfo psy_3gpp_window(FFPsyContext *ctx,
int attack_n = 0; int attack_n = 0;
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
for (j = 0; j < 128; j++) { for (j = 0; j < 128; j++) {
v = iir_filter(audio[(i*128+j)*ctx->avctx->channels], pch->iir_state); v = iir_filter(la[(i*128+j)*ctx->avctx->channels], pch->iir_state);
sum += v*v; sum += v*v;
} }
s[i] = sum; s[i] = sum;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment