From: Lynne via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: Lynne <dev@lynne.ee>
Subject: [FFmpeg-devel] [PATCH 2/6] aac: expose ff_aac_sample_rate_idx() in aac.h
Date: Sun, 16 Jun 2024 10:54:44 +0200
Message-ID: <20240616085454.2560973-2-dev@lynne.ee> (raw)
In-Reply-To: <20240616085454.2560973-1-dev@lynne.ee>
The rate index is a value important to both encoders and decoders.
USAC needs it as well, so put it into the shared main header.
---
libavcodec/aac.h | 16 ++++++++++++++++
libavcodec/aac/aacdec.c | 18 +-----------------
2 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/libavcodec/aac.h b/libavcodec/aac.h
index fc6d1361b2..78026a5887 100644
--- a/libavcodec/aac.h
+++ b/libavcodec/aac.h
@@ -103,4 +103,20 @@ typedef struct Pulse {
int amp[4];
} Pulse;
+static inline int ff_aac_sample_rate_idx(int rate)
+{
+ if (92017 <= rate) return 0;
+ else if (75132 <= rate) return 1;
+ else if (55426 <= rate) return 2;
+ else if (46009 <= rate) return 3;
+ else if (37566 <= rate) return 4;
+ else if (27713 <= rate) return 5;
+ else if (23004 <= rate) return 6;
+ else if (18783 <= rate) return 7;
+ else if (13856 <= rate) return 8;
+ else if (11502 <= rate) return 9;
+ else if (9391 <= rate) return 10;
+ else return 11;
+}
+
#endif /* AVCODEC_AAC_H */
diff --git a/libavcodec/aac/aacdec.c b/libavcodec/aac/aacdec.c
index eecb6d8f3d..ea2ba84a80 100644
--- a/libavcodec/aac/aacdec.c
+++ b/libavcodec/aac/aacdec.c
@@ -1095,22 +1095,6 @@ static int decode_audio_specific_config(AACDecContext *ac,
sync_extension);
}
-static int sample_rate_idx (int rate)
-{
- if (92017 <= rate) return 0;
- else if (75132 <= rate) return 1;
- else if (55426 <= rate) return 2;
- else if (46009 <= rate) return 3;
- else if (37566 <= rate) return 4;
- else if (27713 <= rate) return 5;
- else if (23004 <= rate) return 6;
- else if (18783 <= rate) return 7;
- else if (13856 <= rate) return 8;
- else if (11502 <= rate) return 9;
- else if (9391 <= rate) return 10;
- else return 11;
-}
-
static av_cold int decode_close(AVCodecContext *avctx)
{
AACDecContext *ac = avctx->priv_data;
@@ -1211,7 +1195,7 @@ av_cold int ff_aac_decode_init(AVCodecContext *avctx)
uint8_t layout_map[MAX_ELEM_ID*4][3];
int layout_map_tags;
- sr = sample_rate_idx(avctx->sample_rate);
+ sr = ff_aac_sample_rate_idx(avctx->sample_rate);
ac->oc[1].m4ac.sampling_index = sr;
ac->oc[1].m4ac.channels = avctx->ch_layout.nb_channels;
ac->oc[1].m4ac.sbr = -1;
--
2.45.1.288.g0e0cd299f1
_______________________________________________
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-06-16 8:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-16 8:54 [FFmpeg-devel] [PATCH 1/6] aacdec_usac: apply specification fix M55715 Lynne via ffmpeg-devel
2024-06-16 8:54 ` Lynne via ffmpeg-devel [this message]
2024-06-16 8:54 ` [FFmpeg-devel] [PATCH 3/6] aacdec_ac: fix an overread Lynne via ffmpeg-devel
2024-06-16 8:54 ` [FFmpeg-devel] [PATCH 4/6] aacdec_usac: rename noise_scale to noise_bands Lynne via ffmpeg-devel
2024-06-16 8:54 ` [FFmpeg-devel] [PATCH 5/6] aacdec_usac: remove custom rate_idx and use standard variable for it Lynne via ffmpeg-devel
2024-06-16 8:54 ` [FFmpeg-devel] [PATCH 6/6] aacdec_usac, aacsbr: implement SBR support for USAC Lynne via ffmpeg-devel
2024-06-17 7:35 ` Anton Khirnov
2024-06-17 19:01 ` Lynne via ffmpeg-devel
2024-06-17 19:04 ` Lynne via ffmpeg-devel
2024-06-26 7:29 ` Anton Khirnov
2024-06-20 2:12 ` Lynne via ffmpeg-devel
2024-06-23 7:11 ` Lynne via ffmpeg-devel
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=20240616085454.2560973-2-dev@lynne.ee \
--to=ffmpeg-devel@ffmpeg.org \
--cc=dev@lynne.ee \
/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