Commit eab12d07 authored by Rostislav Pehlivanov's avatar Rostislav Pehlivanov

aacenc: do not reject AAC-Main profile

This commit permits for the use of the Main profile
in encoding. The functionality of that profile will
be added in the commits following. By itself, this
commit does not alter anything.
Signed-off-by: 's avatarRostislav Pehlivanov <atomnuker@gmail.com>
parent d1ca7142
...@@ -57,7 +57,7 @@ static void put_audio_specific_config(AVCodecContext *avctx) ...@@ -57,7 +57,7 @@ static void put_audio_specific_config(AVCodecContext *avctx)
AACEncContext *s = avctx->priv_data; AACEncContext *s = avctx->priv_data;
init_put_bits(&pb, avctx->extradata, avctx->extradata_size); init_put_bits(&pb, avctx->extradata, avctx->extradata_size);
put_bits(&pb, 5, 2); //object type - AAC-LC put_bits(&pb, 5, s->profile+1); //profile
put_bits(&pb, 4, s->samplerate_index); //sample rate index put_bits(&pb, 4, s->samplerate_index); //sample rate index
put_bits(&pb, 4, s->channels); put_bits(&pb, 4, s->channels);
//GASpecificConfig //GASpecificConfig
...@@ -748,10 +748,18 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) ...@@ -748,10 +748,18 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
"Unsupported sample rate %d\n", avctx->sample_rate); "Unsupported sample rate %d\n", avctx->sample_rate);
ERROR_IF(s->channels > AAC_MAX_CHANNELS, ERROR_IF(s->channels > AAC_MAX_CHANNELS,
"Unsupported number of channels: %d\n", s->channels); "Unsupported number of channels: %d\n", s->channels);
ERROR_IF(avctx->profile != FF_PROFILE_UNKNOWN && avctx->profile != FF_PROFILE_AAC_LOW,
"Unsupported profile %d\n", avctx->profile);
WARN_IF(1024.0 * avctx->bit_rate / avctx->sample_rate > 6144 * s->channels, WARN_IF(1024.0 * avctx->bit_rate / avctx->sample_rate > 6144 * s->channels,
"Too many bits per frame requested, clamping to max\n"); "Too many bits per frame requested, clamping to max\n");
if (avctx->profile == FF_PROFILE_AAC_MAIN) {
s->options.pred = 1;
} else if (avctx->profile == FF_PROFILE_AAC_LOW && s->options.pred) {
s->profile = 0; /* Main */
WARN_IF(1, "Prediction requested, changing profile to AAC-Main\n");
} else if (avctx->profile == FF_PROFILE_AAC_LOW) {
s->profile = 1; /* Low */
} else {
ERROR_IF(1, "Unsupported profile %d\n", avctx->profile);
}
avctx->bit_rate = (int)FFMIN( avctx->bit_rate = (int)FFMIN(
6144 * s->channels / 1024.0 * avctx->sample_rate, 6144 * s->channels / 1024.0 * avctx->sample_rate,
......
...@@ -45,6 +45,7 @@ typedef struct AACEncOptions { ...@@ -45,6 +45,7 @@ typedef struct AACEncOptions {
int stereo_mode; int stereo_mode;
int aac_coder; int aac_coder;
int pns; int pns;
int pred;
int intensity_stereo; int intensity_stereo;
} AACEncOptions; } AACEncOptions;
...@@ -77,6 +78,7 @@ typedef struct AACEncContext { ...@@ -77,6 +78,7 @@ typedef struct AACEncContext {
AVFloatDSPContext *fdsp; AVFloatDSPContext *fdsp;
float *planar_samples[6]; ///< saved preprocessed input float *planar_samples[6]; ///< saved preprocessed input
int profile; ///< copied from avctx
LPCContext lpc; ///< used by TNS LPCContext lpc; ///< used by TNS
int samplerate_index; ///< MPEG-4 samplerate index int samplerate_index; ///< MPEG-4 samplerate index
int channels; ///< channel count int channels; ///< channel count
......
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