Implicitly disabled by 4679a474f06c229b10976d7f0b4eee0613c2715a. Given that no one has ever complained about this, this commit removes the now dead code.
Showing the changes to libavcodec (3 of 4 files). Show all
Unified · Split
| @@ -874,8 +874,8 @@ static av_cold void bit_alloc_init(AC3EncodeContext *s) · 873 unmodified lines | ||
| 874 | 874 | /* compute real values */ |
| 875 | 875 | /* currently none of these values change during encoding, so we can just |
| 876 | 876 | set them once at initialization */ |
| 877 | − s->bit_alloc.slow_decay = ff_ac3_slow_decay_tab[s->slow_decay_code] >> s->bit_alloc.sr_shift; | |
| 878 | − s->bit_alloc.fast_decay = ff_ac3_fast_decay_tab[s->fast_decay_code] >> s->bit_alloc.sr_shift; | |
| 877 | + s->bit_alloc.slow_decay = ff_ac3_slow_decay_tab[s->slow_decay_code]; | |
| 878 | + s->bit_alloc.fast_decay = ff_ac3_fast_decay_tab[s->fast_decay_code]; | |
| 879 | 879 | s->bit_alloc.slow_gain = ff_ac3_slow_gain_tab[s->slow_gain_code]; |
| 880 | 880 | s->bit_alloc.db_per_bit = ff_ac3_db_per_bit_tab[s->db_per_bit_code]; |
| 881 | 881 | s->bit_alloc.floor = ff_ac3_floor_tab[s->floor_code]; |
| @@ -1812,8 +1812,6 @@ static void dprint_options(AC3EncodeContext *s) · 930 unmodified lines | ||
| 1812 | 1812 | switch (s->bitstream_id) { |
| 1813 | 1813 | case 6: msg = "AC-3 (alt syntax)"; break; |
| 1814 | 1814 | case 8: msg = "AC-3 (standard)"; break; |
| 1815 | − case 9: msg = "AC-3 (dnet half-rate)"; break; | |
| 1816 | − case 10: msg = "AC-3 (dnet quater-rate)"; break; | |
| 1817 | 1815 | case 16: msg = "E-AC-3 (enhanced)"; break; |
| 1818 | 1816 | default: msg = "ERROR"; |
| 1819 | 1817 | } |
| @@ -2132,18 +2130,8 @@ int ff_ac3_validate_metadata(AC3EncodeContext *s) · 312 unmodified lines | ||
| 2132 | 2130 | } |
| 2133 | 2131 | |
| 2134 | 2132 | /* set bitstream id for alternate bitstream syntax */ |
| 2135 | − if (!s->eac3 && (opt->extended_bsi_1 || opt->extended_bsi_2)) { | |
| 2136 | − if (s->bitstream_id > 8 && s->bitstream_id < 11) { | |
| 2137 | − if (!s->warned_alternate_bitstream) { | |
| 2138 | − av_log(avctx, AV_LOG_WARNING, "alternate bitstream syntax is " | |
| 2139 | − "not compatible with reduced samplerates. writing of " | |
| 2140 | − "extended bitstream information will be disabled.\n"); | |
| 2141 | − s->warned_alternate_bitstream = 1; | |
| 2142 | − } | |
| 2143 | − } else { | |
| 2144 | − s->bitstream_id = 6; | |
| 2145 | − } | |
| 2146 | − } | |
| 2133 | + if (!s->eac3 && (opt->extended_bsi_1 || opt->extended_bsi_2)) | |
| 2134 | + s->bitstream_id = 6; | |
| 2147 | 2135 | |
| 2148 | 2136 | return 0; |
| 2149 | 2137 | } |
| @@ -2233,23 +2221,19 @@ static av_cold void set_channel_info(AVCodecContext *avctx) · 83 unmodified lines | ||
| 2233 | 2221 | static av_cold int validate_options(AC3EncodeContext *s) |
| 2234 | 2222 | { |
| 2235 | 2223 | AVCodecContext *avctx = s->avctx; |
| 2236 | − int i, ret, max_sr; | |
| 2224 | + int ret; | |
| 2237 | 2225 | |
| 2238 | 2226 | set_channel_info(avctx); |
| 2239 | 2227 | |
| 2240 | − /* validate sample rate */ | |
| 2241 | − /* note: max_sr could be changed from 2 to 5 for E-AC-3 once we find a | |
| 2242 | − decoder that supports half sample rate so we can validate that | |
| 2243 | − the generated files are correct. */ | |
| 2244 | − max_sr = s->eac3 ? 2 : 8; | |
| 2245 | − for (i = 0; i <= max_sr; i++) { | |
| 2246 | − if ((ff_ac3_sample_rate_tab[i % 3] >> (i / 3)) == avctx->sample_rate) | |
| 2228 | + for (int i = 0;; i++) { | |
| 2229 | + if (ff_ac3_sample_rate_tab[i] == avctx->sample_rate) { | |
| 2230 | + s->bit_alloc.sr_code = i; | |
| 2247 | 2231 | break; |
| 2232 | + } | |
| 2233 | + av_assert1(ff_ac3_sample_rate_tab[i] != 0); | |
| 2248 | 2234 | } |
| 2249 | 2235 | s->sample_rate = avctx->sample_rate; |
| 2250 | − s->bit_alloc.sr_shift = i / 3; | |
| 2251 | − s->bit_alloc.sr_code = i % 3; | |
| 2252 | − s->bitstream_id = s->eac3 ? 16 : 8 + s->bit_alloc.sr_shift; | |
| 2236 | + s->bitstream_id = s->eac3 ? 16 : 8; | |
| 2253 | 2237 | |
| 2254 | 2238 | /* select a default bit rate if not set by the user */ |
| 2255 | 2239 | if (!avctx->bit_rate) { |
| @@ -2297,7 +2281,7 @@ static av_cold int validate_options(AC3EncodeContext *s) · 41 unmodified lines | ||
| 2297 | 2281 | parameter selection */ |
| 2298 | 2282 | min_br_code = -1; |
| 2299 | 2283 | min_br_dist = INT64_MAX; |
| 2300 | − for (i = 0; i < 19; i++) { | |
| 2284 | + for (int i = 0; i < 19; i++) { | |
| 2301 | 2285 | long long br_dist = llabs(ff_ac3_bitrate_tab[i] * 1000 - avctx->bit_rate); |
| 2302 | 2286 | if (br_dist < min_br_dist) { |
| 2303 | 2287 | min_br_dist = br_dist; |
| @@ -2313,8 +2297,8 @@ static av_cold int validate_options(AC3EncodeContext *s) · 9 unmodified lines | ||
| 2313 | 2297 | } else { |
| 2314 | 2298 | int best_br = 0, best_code = 0; |
| 2315 | 2299 | long long best_diff = INT64_MAX; |
| 2316 | − for (i = 0; i < 19; i++) { | |
| 2317 | − int br = (ff_ac3_bitrate_tab[i] >> s->bit_alloc.sr_shift) * 1000; | |
| 2300 | + for (int i = 0; i < 19; i++) { | |
| 2301 | + int br = ff_ac3_bitrate_tab[i] * 1000; | |
| 2318 | 2302 | long long diff = llabs(br - avctx->bit_rate); |
| 2319 | 2303 | if (diff < best_diff) { |
| 2320 | 2304 | best_br = br; |
| @@ -256,8 +256,6 @@ typedef struct AC3EncodeContext { · 255 unmodified lines | ||
| 256 | 256 | uint8_t *ref_bap [AC3_MAX_CHANNELS][AC3_MAX_BLOCKS]; ///< bit allocation pointers (bap) |
| 257 | 257 | int ref_bap_set; ///< indicates if ref_bap pointers have been set |
| 258 | 258 | |
| 259 | − int warned_alternate_bitstream; | |
| 260 | − | |
| 261 | 259 | /* fixed vs. float function pointers */ |
| 262 | 260 | int (*mdct_init)(struct AC3EncodeContext *s); |
| 263 | 261 | |
| @@ -134,13 +134,8 @@ void ff_eac3_output_frame_header(AC3EncodeContext *s) · 133 unmodified lines | ||
| 134 | 134 | put_bits(&s->pb, 2, 0); /* stream type = independent */ |
| 135 | 135 | put_bits(&s->pb, 3, 0); /* substream id = 0 */ |
| 136 | 136 | put_bits(&s->pb, 11, (s->frame_size / 2) - 1); /* frame size */ |
| 137 | − if (s->bit_alloc.sr_shift) { | |
| 138 | − put_bits(&s->pb, 2, 0x3); /* fscod2 */ | |
| 139 | − put_bits(&s->pb, 2, s->bit_alloc.sr_code); /* sample rate code */ | |
| 140 | − } else { | |
| 141 | − put_bits(&s->pb, 2, s->bit_alloc.sr_code); /* sample rate code */ | |
| 142 | − put_bits(&s->pb, 2, s->num_blks_code); /* number of blocks */ | |
| 143 | − } | |
| 137 | + put_bits(&s->pb, 2, s->bit_alloc.sr_code); /* sample rate code */ | |
| 138 | + put_bits(&s->pb, 2, s->num_blks_code); /* number of blocks */ | |
| 144 | 139 | put_bits(&s->pb, 3, s->channel_mode); /* audio coding mode */ |
| 145 | 140 | put_bits(&s->pb, 1, s->lfe_on); /* LFE channel indicator */ |
| 146 | 141 | put_bits(&s->pb, 5, s->bitstream_id); /* bitstream id (EAC3=16) */ |