summaryrefslogtreecommitdiff
path: root/libavcodec/aacenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-06-30 04:20:53 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-06-30 04:32:24 +0200
commit8c0cbb0848430e4de7182dc2fa2f70262d8c77c7 (patch)
treed08758ea987f08f1d5a8caf44f082adc5586e815 /libavcodec/aacenc.c
parent623bf96678d2009d34e88ed7c2b73c00930cebae (diff)
parent812f2376eecc19c40a95ade1f7a43b762106e0f7 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: rational-test: Add proper main() declaration to fix gcc warnings. configure: Add vdpau and dxva2 to configure results output. Remove unused, never built libavutil/pca.[ch] matroskadec: forward parsing errors to caller. av_find_stream_info: simplify EAGAIN handling. aacenc: Fix determination of Mid/Side Mode. psymodel: Remove the single channel analysis function aacenc: Implement dummy channel group analysis that just calls the single channel analysis for each channel. psymodel: Add channels and channel groups to the psymodel. ARM: remove check for PLD instruction fate: move amr[nw]b test rules into separate files ogg: fix double free when finding length of small chained oggs. swscale: implement >8bit scaling support. build: fix creation of tools dir with make 3.81 build: Mark all-yes Makefile target as phony. pixfmt: fix YUV422/444 wrong endian comment build: create output directories as needed Add new yuv444 pixfmts to avcodec_align_dimensions2 Conflicts: Makefile configure libavutil/pca.c libavutil/pca.h libavutil/pixfmt.h libswscale/swscale.c libswscale/utils.c libswscale/x86/swscale_template.c tests/ref/lavfi/pixdesc tests/ref/lavfi/pixfmts_copy tests/ref/lavfi/pixfmts_null tests/ref/lavfi/pixfmts_scale tests/ref/lavfi/pixfmts_vflip Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/aacenc.c')
-rw-r--r--libavcodec/aacenc.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index 2a6dbc8ebd..b877e4eaef 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -219,7 +219,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
sizes[1] = swb_size_128[i];
lengths[0] = ff_aac_num_swb_1024[i];
lengths[1] = ff_aac_num_swb_128[i];
- ff_psy_init(&s->psy, avctx, 2, sizes, lengths);
+ ff_psy_init(&s->psy, avctx, 2, sizes, lengths, s->chan_map[0], &s->chan_map[1]);
s->psypp = ff_psy_preprocess_init(avctx);
s->coder = &ff_aac_coders[2];
@@ -373,7 +373,7 @@ static void adjust_frame_information(AACEncContext *apc, ChannelElement *cpe, in
if (msc == 0 || ics0->max_sfb == 0)
cpe->ms_mode = 0;
else
- cpe->ms_mode = msc < ics0->max_sfb ? 1 : 2;
+ cpe->ms_mode = msc < ics0->max_sfb * ics0->num_windows ? 1 : 2;
}
}
@@ -582,14 +582,17 @@ static int aac_encode_frame(AVCodecContext *avctx,
memset(chan_el_counter, 0, sizeof(chan_el_counter));
for (i = 0; i < s->chan_map[0]; i++) {
FFPsyWindowInfo* wi = windows + start_ch;
+ const float *coeffs[2];
tag = s->chan_map[i+1];
chans = tag == TYPE_CPE ? 2 : 1;
cpe = &s->cpe[i];
put_bits(&s->pb, 3, tag);
put_bits(&s->pb, 4, chan_el_counter[tag]++);
+ for (ch = 0; ch < chans; ch++)
+ coeffs[ch] = cpe->ch[ch].coeffs;
+ s->psy.model->analyze(&s->psy, start_ch, coeffs, wi);
for (ch = 0; ch < chans; ch++) {
- s->cur_channel = start_ch + ch;
- s->psy.model->analyze(&s->psy, s->cur_channel, cpe->ch[ch].coeffs, &wi[ch]);
+ s->cur_channel = start_ch * 2 + ch;
s->coder->search_for_quantizers(avctx, s, &cpe->ch[ch], s->lambda);
}
cpe->common_window = 0;
@@ -605,7 +608,7 @@ static int aac_encode_frame(AVCodecContext *avctx,
}
}
}
- s->cur_channel = start_ch;
+ s->cur_channel = start_ch * 2;
if (s->options.stereo_mode && cpe->common_window) {
if (s->options.stereo_mode > 0) {
IndividualChannelStream *ics = &cpe->ch[0].ics;