# HG changeset patch # User kostya # Date 1219037906 0 # Node ID 681e7430fbebd08e264b9f3c7eda698f45f85773 # Parent 6250ff63990bc1f432d259452c715d4aff790cf4 Add okayed parts for AAC encoder diff -r 6250ff63990b -r 681e7430fbeb aacenc.c --- a/aacenc.c Sun Aug 17 22:47:40 2008 +0000 +++ b/aacenc.c Mon Aug 18 05:38:26 2008 +0000 @@ -162,6 +162,12 @@ MDCTContext mdct1024; ///< long (1024 samples) frame transform context MDCTContext mdct128; ///< short (128 samples) frame transform context DSPContext dsp; + DECLARE_ALIGNED_16(FFTSample, output[2048]); ///< temporary buffer for MDCT input coefficients + int16_t* samples; ///< saved preprocessed input + + int samplerate_index; ///< MPEG-4 samplerate index + + ChannelElement *cpe; ///< channel elements AACPsyContext psy; ///< psychoacoustic model context int last_frame; } AACEncContext; @@ -221,7 +227,9 @@ s->samples = av_malloc(2 * 1024 * avctx->channels * sizeof(s->samples[0])); s->cpe = av_mallocz(sizeof(ChannelElement) * aac_chan_configs[avctx->channels-1][0]); - if(ff_aac_psy_init(&s->psy, avctx, AAC_PSY_3GPP, aac_chan_configs[avctx->channels-1][0], 0, s->swb_sizes1024, s->swb_num1024, s->swb_sizes128, s->swb_num128) < 0){ + if(ff_aac_psy_init(&s->psy, avctx, AAC_PSY_3GPP, + aac_chan_configs[avctx->channels-1][0], 0, + s->swb_sizes1024, s->swb_num1024, s->swb_sizes128, s->swb_num128) < 0){ av_log(avctx, AV_LOG_ERROR, "Cannot initialize selected model.\n"); return -1; } @@ -256,7 +264,7 @@ /** * Encode pulse data. */ -static void encode_pulses(AVCodecContext *avctx, AACEncContext *s, Pulse *pulse, int channel) +static void encode_pulses(AACEncContext *s, Pulse *pulse, int channel) { int i; @@ -274,7 +282,7 @@ /** * Encode spectral coefficients processed by psychoacoustic model. */ -static void encode_spectral_coeffs(AVCodecContext *avctx, AACEncContext *s, ChannelElement *cpe, int channel) +static void encode_spectral_coeffs(AACEncContext *s, ChannelElement *cpe, int channel) { int start, i, w, w2, wg; @@ -287,7 +295,9 @@ continue; } for(w2 = w; w2 < w + cpe->ch[channel].ics.group_len[wg]; w2++){ - encode_band_coeffs(s, cpe, channel, start + w2*128, cpe->ch[channel].ics.swb_sizes[i], cpe->ch[channel].band_type[w*16 + i]); + encode_band_coeffs(s, cpe, channel, start + w2*128, + cpe->ch[channel].ics.swb_sizes[i], + cpe->ch[channel].band_type[w*16 + i]); } start += cpe->ch[channel].ics.swb_sizes[i]; }