Browse Source

Add okayed parts for AAC encoder

Originally committed as revision 14821 to svn://svn.ffmpeg.org/ffmpeg/trunk
tags/v0.5
Kostya Shishkov 17 years ago
parent
commit
b54bf2d6eb
1 changed files with 14 additions and 4 deletions
  1. +14
    -4
      libavcodec/aacenc.c

+ 14
- 4
libavcodec/aacenc.c View File

@@ -162,6 +162,12 @@ typedef struct {
MDCTContext mdct1024; ///< long (1024 samples) frame transform context MDCTContext mdct1024; ///< long (1024 samples) frame transform context
MDCTContext mdct128; ///< short (128 samples) frame transform context MDCTContext mdct128; ///< short (128 samples) frame transform context
DSPContext dsp; 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 AACPsyContext psy; ///< psychoacoustic model context
int last_frame; int last_frame;
} AACEncContext; } AACEncContext;
@@ -221,7 +227,9 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)


s->samples = av_malloc(2 * 1024 * avctx->channels * sizeof(s->samples[0])); 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]); 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"); av_log(avctx, AV_LOG_ERROR, "Cannot initialize selected model.\n");
return -1; return -1;
} }
@@ -256,7 +264,7 @@ static void put_ics_info(AVCodecContext *avctx, IndividualChannelStream *info)
/** /**
* Encode pulse data. * 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; int i;


@@ -274,7 +282,7 @@ static void encode_pulses(AVCodecContext *avctx, AACEncContext *s, Pulse *pulse,
/** /**
* Encode spectral coefficients processed by psychoacoustic model. * 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; int start, i, w, w2, wg;


@@ -287,7 +295,9 @@ static void encode_spectral_coeffs(AVCodecContext *avctx, AACEncContext *s, Chan
continue; continue;
} }
for(w2 = w; w2 < w + cpe->ch[channel].ics.group_len[wg]; w2++){ 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]; start += cpe->ch[channel].ics.swb_sizes[i];
} }


Loading…
Cancel
Save