History

avcodec/aacenc: Remove always-false check

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

Andreas Rheinhardt committed 1 year ago

Commit ab1bc2f1 parent 516bcfc4 files · +10 −12Browse files

Unified · Split

4 files
  1. libavcodec/aacenc.c +6 −7
  2. libavcodec/aacenctab.c +0 −3
  3. libavcodec/aacenctab.h +0 −2
  4. libavcodec/mpeg4audio_sample_rates.h +4 −0
libavcodec/aacenc.c+6−7
@@ -1235,14 +1235,13 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) · 1234 unmodified lines
1235 }1235 }
1236 1236
1237 /* Samplerate */1237 /* Samplerate */
1238 for (i = 0; i < 16; i++)1238 for (int i = 0;; i++) {
1239 if (avctx->sample_rate == ff_mpeg4audio_sample_rates[i])1239 av_assert1(i < 13);
1240 if (avctx->sample_rate == ff_mpeg4audio_sample_rates[i]) {
1241 s->samplerate_index = i;
1240 break;1242 break;
1241 s->samplerate_index = i;1243 }
1242 ERROR_IF(s->samplerate_index == 16 ||1244 }
1243 s->samplerate_index >= ff_aac_swb_size_1024_len ||
1244 s->samplerate_index >= ff_aac_swb_size_128_len,
1245 "Unsupported sample rate %d\n", avctx->sample_rate);
1246 1245
1247 /* Bitrate limiting */1246 /* Bitrate limiting */
1248 WARN_IF(1024.0 * avctx->bit_rate / avctx->sample_rate > 6144 * s->channels,1247 WARN_IF(1024.0 * avctx->bit_rate / avctx->sample_rate > 6144 * s->channels,
libavcodec/aacenctab.c+0−3
@@ -103,6 +103,3 @@ const uint8_t *const ff_aac_swb_size_1024[] = { · 102 unmodified lines
103 swb_size_1024_16, swb_size_1024_16, swb_size_1024_8,103 swb_size_1024_16, swb_size_1024_16, swb_size_1024_8,
104 swb_size_1024_8104 swb_size_1024_8
105};105};
106
107const int ff_aac_swb_size_128_len = FF_ARRAY_ELEMS(ff_aac_swb_size_128);
108const int ff_aac_swb_size_1024_len = FF_ARRAY_ELEMS(ff_aac_swb_size_1024);
libavcodec/aacenctab.h+0−2
@@ -41,9 +41,7 @@ · 40 unmodified lines
41#define AAC_MAX_CHANNELS 1641#define AAC_MAX_CHANNELS 16
42 42
43extern const uint8_t *const ff_aac_swb_size_1024[];43extern const uint8_t *const ff_aac_swb_size_1024[];
44extern const int ff_aac_swb_size_1024_len;
45extern const uint8_t *const ff_aac_swb_size_128[];44extern const uint8_t *const ff_aac_swb_size_128[];
46extern const int ff_aac_swb_size_128_len;
47 45
48/* Supported layouts without using a PCE */46/* Supported layouts without using a PCE */
49static const AVChannelLayout aac_normal_chan_layouts[7] = {47static const AVChannelLayout aac_normal_chan_layouts[7] = {
libavcodec/mpeg4audio_sample_rates.h+4−0
@@ -23,6 +23,10 @@ · 22 unmodified lines
23#ifndef AVCODEC_MPEG4AUDIO_SAMPLE_RATES_H23#ifndef AVCODEC_MPEG4AUDIO_SAMPLE_RATES_H
24#define AVCODEC_MPEG4AUDIO_SAMPLE_RATES_H24#define AVCODEC_MPEG4AUDIO_SAMPLE_RATES_H
25 25
26// This table contains only 13 real elements and is padded with zeroes.
27// It is used by the AAC encoder as sample rate table, so the encoder
28// needs to actually support all of these rates and it needs to have
29// a trailing zero.
26const int ff_mpeg4audio_sample_rates[16] = {30const int ff_mpeg4audio_sample_rates[16] = {
27 96000, 88200, 64000, 48000, 44100, 32000,31 96000, 88200, 64000, 48000, 44100, 32000,
28 24000, 22050, 16000, 12000, 11025, 8000, 735032 24000, 22050, 16000, 12000, 11025, 8000, 7350

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t