From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: [FFmpeg-devel] [PATCH 07/17] avcodec/ac3enc: Remove disabled code for RealAudio variant of AC-3
Date: Sun, 7 Apr 2024 23:09:05 +0200
Message-ID: <GV1P250MB0737A4A3B07E7347DABDD4E98F012@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <GV1P250MB073758D71A50C11C0A3C26CE8F012@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM>
Implicitly disabled by 4679a474f06c229b10976d7f0b4eee0613c2715a.
Given that no one has ever complained about this, this commit
removes the now dead code.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
doc/encoders.texi | 3 +--
libavcodec/ac3enc.c | 43 +++++++++++++------------------------------
libavcodec/ac3enc.h | 2 --
libavcodec/eac3enc.c | 9 ++-------
4 files changed, 16 insertions(+), 41 deletions(-)
diff --git a/doc/encoders.texi b/doc/encoders.texi
index 8dd709186e..c08e40ee45 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -144,8 +144,7 @@ If this option is unspecified it is set to @samp{aac_low}.
AC-3 audio encoders.
-These encoders implement part of ATSC A/52:2010 and ETSI TS 102 366, as well as
-the undocumented RealAudio 3 (a.k.a. dnet).
+These encoders implement part of ATSC A/52:2010 and ETSI TS 102 366.
The @var{ac3} encoder uses floating-point math, while the @var{ac3_fixed}
encoder only uses fixed-point integer math. This does not mean that one is
diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c
index 32aaf89ec1..12bd3b25f3 100644
--- a/libavcodec/ac3enc.c
+++ b/libavcodec/ac3enc.c
@@ -874,8 +874,8 @@ static av_cold void bit_alloc_init(AC3EncodeContext *s)
/* compute real values */
/* currently none of these values change during encoding, so we can just
set them once at initialization */
- s->bit_alloc.slow_decay = ff_ac3_slow_decay_tab[s->slow_decay_code] >> s->bit_alloc.sr_shift;
- s->bit_alloc.fast_decay = ff_ac3_fast_decay_tab[s->fast_decay_code] >> s->bit_alloc.sr_shift;
+ s->bit_alloc.slow_decay = ff_ac3_slow_decay_tab[s->slow_decay_code];
+ s->bit_alloc.fast_decay = ff_ac3_fast_decay_tab[s->fast_decay_code];
s->bit_alloc.slow_gain = ff_ac3_slow_gain_tab[s->slow_gain_code];
s->bit_alloc.db_per_bit = ff_ac3_db_per_bit_tab[s->db_per_bit_code];
s->bit_alloc.floor = ff_ac3_floor_tab[s->floor_code];
@@ -1812,8 +1812,6 @@ static void dprint_options(AC3EncodeContext *s)
switch (s->bitstream_id) {
case 6: msg = "AC-3 (alt syntax)"; break;
case 8: msg = "AC-3 (standard)"; break;
- case 9: msg = "AC-3 (dnet half-rate)"; break;
- case 10: msg = "AC-3 (dnet quater-rate)"; break;
case 16: msg = "E-AC-3 (enhanced)"; break;
default: msg = "ERROR";
}
@@ -2132,18 +2130,8 @@ int ff_ac3_validate_metadata(AC3EncodeContext *s)
}
/* set bitstream id for alternate bitstream syntax */
- if (!s->eac3 && (opt->extended_bsi_1 || opt->extended_bsi_2)) {
- if (s->bitstream_id > 8 && s->bitstream_id < 11) {
- if (!s->warned_alternate_bitstream) {
- av_log(avctx, AV_LOG_WARNING, "alternate bitstream syntax is "
- "not compatible with reduced samplerates. writing of "
- "extended bitstream information will be disabled.\n");
- s->warned_alternate_bitstream = 1;
- }
- } else {
- s->bitstream_id = 6;
- }
- }
+ if (!s->eac3 && (opt->extended_bsi_1 || opt->extended_bsi_2))
+ s->bitstream_id = 6;
return 0;
}
@@ -2233,23 +2221,18 @@ static av_cold void set_channel_info(AVCodecContext *avctx)
static av_cold int validate_options(AC3EncodeContext *s)
{
AVCodecContext *avctx = s->avctx;
- int i, ret, max_sr;
+ int ret;
set_channel_info(avctx);
- /* validate sample rate */
- /* note: max_sr could be changed from 2 to 5 for E-AC-3 once we find a
- decoder that supports half sample rate so we can validate that
- the generated files are correct. */
- max_sr = s->eac3 ? 2 : 8;
- for (i = 0; i <= max_sr; i++) {
- if ((ff_ac3_sample_rate_tab[i % 3] >> (i / 3)) == avctx->sample_rate)
+ for (int i = 0;; i++) {
+ if (ff_ac3_sample_rate_tab[i] == avctx->sample_rate) {
+ s->bit_alloc.sr_code = i;
break;
+ }
}
s->sample_rate = avctx->sample_rate;
- s->bit_alloc.sr_shift = i / 3;
- s->bit_alloc.sr_code = i % 3;
- s->bitstream_id = s->eac3 ? 16 : 8 + s->bit_alloc.sr_shift;
+ s->bitstream_id = s->eac3 ? 16 : 8;
/* select a default bit rate if not set by the user */
if (!avctx->bit_rate) {
@@ -2297,7 +2280,7 @@ static av_cold int validate_options(AC3EncodeContext *s)
parameter selection */
min_br_code = -1;
min_br_dist = INT64_MAX;
- for (i = 0; i < 19; i++) {
+ for (int i = 0; i < 19; i++) {
long long br_dist = llabs(ff_ac3_bitrate_tab[i] * 1000 - avctx->bit_rate);
if (br_dist < min_br_dist) {
min_br_dist = br_dist;
@@ -2313,8 +2296,8 @@ static av_cold int validate_options(AC3EncodeContext *s)
} else {
int best_br = 0, best_code = 0;
long long best_diff = INT64_MAX;
- for (i = 0; i < 19; i++) {
- int br = (ff_ac3_bitrate_tab[i] >> s->bit_alloc.sr_shift) * 1000;
+ for (int i = 0; i < 19; i++) {
+ int br = ff_ac3_bitrate_tab[i] * 1000;
long long diff = llabs(br - avctx->bit_rate);
if (diff < best_diff) {
best_br = br;
diff --git a/libavcodec/ac3enc.h b/libavcodec/ac3enc.h
index 1cb1aac4b2..dad53cc4bb 100644
--- a/libavcodec/ac3enc.h
+++ b/libavcodec/ac3enc.h
@@ -256,8 +256,6 @@ typedef struct AC3EncodeContext {
uint8_t *ref_bap [AC3_MAX_CHANNELS][AC3_MAX_BLOCKS]; ///< bit allocation pointers (bap)
int ref_bap_set; ///< indicates if ref_bap pointers have been set
- int warned_alternate_bitstream;
-
/* fixed vs. float function pointers */
int (*mdct_init)(struct AC3EncodeContext *s);
diff --git a/libavcodec/eac3enc.c b/libavcodec/eac3enc.c
index 527f77e33a..5deda083c3 100644
--- a/libavcodec/eac3enc.c
+++ b/libavcodec/eac3enc.c
@@ -134,13 +134,8 @@ void ff_eac3_output_frame_header(AC3EncodeContext *s)
put_bits(&s->pb, 2, 0); /* stream type = independent */
put_bits(&s->pb, 3, 0); /* substream id = 0 */
put_bits(&s->pb, 11, (s->frame_size / 2) - 1); /* frame size */
- if (s->bit_alloc.sr_shift) {
- put_bits(&s->pb, 2, 0x3); /* fscod2 */
- put_bits(&s->pb, 2, s->bit_alloc.sr_code); /* sample rate code */
- } else {
- put_bits(&s->pb, 2, s->bit_alloc.sr_code); /* sample rate code */
- put_bits(&s->pb, 2, s->num_blks_code); /* number of blocks */
- }
+ put_bits(&s->pb, 2, s->bit_alloc.sr_code); /* sample rate code */
+ put_bits(&s->pb, 2, s->num_blks_code); /* number of blocks */
put_bits(&s->pb, 3, s->channel_mode); /* audio coding mode */
put_bits(&s->pb, 1, s->lfe_on); /* LFE channel indicator */
put_bits(&s->pb, 5, s->bitstream_id); /* bitstream id (EAC3=16) */
--
2.40.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2024-04-07 21:11 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-07 20:39 [FFmpeg-devel] [PATCH 01/17] avcodec/ac3enc: Don't presume ch_layout to be AV_CHANNEL_ORDER_NATIVE Andreas Rheinhardt
2024-04-07 20:51 ` James Almer
2024-04-07 21:53 ` Andreas Rheinhardt
2024-04-07 22:21 ` James Almer
2024-04-07 22:26 ` Andreas Rheinhardt
2024-04-07 22:35 ` James Almer
2024-04-07 21:09 ` [FFmpeg-devel] [PATCH 02/17] avcodec/ac3enc: Don't overwrite AVCodecContext.ch_layout Andreas Rheinhardt
2024-04-07 21:09 ` [FFmpeg-devel] [PATCH 03/17] avcodec/ac3enc: Remove redundant channel layout checks Andreas Rheinhardt
2024-04-07 21:09 ` [FFmpeg-devel] [PATCH 04/17] avcodec/ac3enc: Use bit-operations for bit-mask Andreas Rheinhardt
2024-04-07 21:09 ` [FFmpeg-devel] [PATCH 05/17] avcodec/ac3enc: Avoid copying strings Andreas Rheinhardt
2024-04-07 21:09 ` [FFmpeg-devel] [PATCH 06/17] avcodec/ac3enc: Remove always-false sample rate check Andreas Rheinhardt
2024-04-07 21:09 ` Andreas Rheinhardt [this message]
2024-04-07 21:09 ` [FFmpeg-devel] [PATCH 08/17] avcodec/ac3enc: Use common encode_frame function Andreas Rheinhardt
2024-04-07 21:09 ` [FFmpeg-devel] [PATCH 09/17] avcodec/ac3enc: Move ff_ac3_validate_metadate() upwards Andreas Rheinhardt
2024-04-07 21:09 ` [FFmpeg-devel] [PATCH 10/17] avcodec/ac3enc: Share more code between fixed/float encoders Andreas Rheinhardt
2024-04-07 21:09 ` [FFmpeg-devel] [PATCH 11/17] avcodec/ac3enc: Deduplicate allocating buffers Andreas Rheinhardt
2024-04-07 21:09 ` [FFmpeg-devel] [PATCH 12/17] avcodec/ac3enc: Deduplicate copying input samples Andreas Rheinhardt
2024-04-07 21:09 ` [FFmpeg-devel] [PATCH 13/17] avcodec/ac3enc_float: Remove uninformative error message Andreas Rheinhardt
2024-04-07 21:09 ` [FFmpeg-devel] [PATCH 14/17] avcodec/ac3enc: Avoid function pointers to initialize MDCT Andreas Rheinhardt
2024-04-07 21:09 ` [FFmpeg-devel] [PATCH 15/17] avcodec/ac3enc: Move EAC-3 specific initialization to eac3enc.c Andreas Rheinhardt
2024-04-07 21:09 ` [FFmpeg-devel] [PATCH 16/17] avcodec/flacenc: Avoid shift where possible Andreas Rheinhardt
2024-04-07 21:09 ` [FFmpeg-devel] [PATCH 17/17] avformat/img2: Avoid relocations for ff_img_tags Andreas Rheinhardt
2024-04-08 0:56 ` [FFmpeg-devel] [PATCH 18/18] avcodec/ac3enc: Avoid calculating the CRC multiple times Andreas Rheinhardt
2024-04-10 6:16 ` [FFmpeg-devel] [PATCH 01/17] avcodec/ac3enc: Don't presume ch_layout to be AV_CHANNEL_ORDER_NATIVE Andreas Rheinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=GV1P250MB0737A4A3B07E7347DABDD4E98F012@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM \
--to=andreas.rheinhardt@outlook.com \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git