1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

avcodec/aacenc: Remove always-false check

The sample rates have already been checked generically
via AVCodec.supported_samplerates.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2025-04-10 13:56:14 +02:00
parent 516bcfc169
commit ab1bc2f745
4 changed files with 10 additions and 12 deletions

View File

@ -1235,14 +1235,13 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
}
/* Samplerate */
for (i = 0; i < 16; i++)
if (avctx->sample_rate == ff_mpeg4audio_sample_rates[i])
break;
for (int i = 0;; i++) {
av_assert1(i < 13);
if (avctx->sample_rate == ff_mpeg4audio_sample_rates[i]) {
s->samplerate_index = i;
ERROR_IF(s->samplerate_index == 16 ||
s->samplerate_index >= ff_aac_swb_size_1024_len ||
s->samplerate_index >= ff_aac_swb_size_128_len,
"Unsupported sample rate %d\n", avctx->sample_rate);
break;
}
}
/* Bitrate limiting */
WARN_IF(1024.0 * avctx->bit_rate / avctx->sample_rate > 6144 * s->channels,

View File

@ -103,6 +103,3 @@ const uint8_t *const ff_aac_swb_size_1024[] = {
swb_size_1024_16, swb_size_1024_16, swb_size_1024_8,
swb_size_1024_8
};
const int ff_aac_swb_size_128_len = FF_ARRAY_ELEMS(ff_aac_swb_size_128);
const int ff_aac_swb_size_1024_len = FF_ARRAY_ELEMS(ff_aac_swb_size_1024);

View File

@ -41,9 +41,7 @@
#define AAC_MAX_CHANNELS 16
extern const uint8_t *const ff_aac_swb_size_1024[];
extern const int ff_aac_swb_size_1024_len;
extern const uint8_t *const ff_aac_swb_size_128[];
extern const int ff_aac_swb_size_128_len;
/* Supported layouts without using a PCE */
static const AVChannelLayout aac_normal_chan_layouts[7] = {

View File

@ -23,6 +23,10 @@
#ifndef AVCODEC_MPEG4AUDIO_SAMPLE_RATES_H
#define AVCODEC_MPEG4AUDIO_SAMPLE_RATES_H
// This table contains only 13 real elements and is padded with zeroes.
// It is used by the AAC encoder as sample rate table, so the encoder
// needs to actually support all of these rates and it needs to have
// a trailing zero.
const int ff_mpeg4audio_sample_rates[16] = {
96000, 88200, 64000, 48000, 44100, 32000,
24000, 22050, 16000, 12000, 11025, 8000, 7350