From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: [FFmpeg-devel] [PATCH 12/12] avcodec/aac/aacdec_(fixed|float): Set AACDecDSP, AACDecProc directly
Date: Mon, 6 May 2024 14:14:34 +0200
Message-ID: <GV1P250MB0737EB6EC07077A3AF15355A8F1C2@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <GV1P250MB0737A4218AC17DD0A60E579C8F1C2@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM>
This is more in line with how we initialize DSP functions
and avoids tables of function pointers as well as relocations
for these.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/aac/aacdec_dsp_template.c | 43 ++++++++++++++-------------
libavcodec/aac/aacdec_fixed.c | 4 +--
libavcodec/aac/aacdec_float.c | 4 +--
libavcodec/aac/aacdec_proc_template.c | 11 ++++---
4 files changed, 34 insertions(+), 28 deletions(-)
diff --git a/libavcodec/aac/aacdec_dsp_template.c b/libavcodec/aac/aacdec_dsp_template.c
index 70f0a3cce6..621baef8ca 100644
--- a/libavcodec/aac/aacdec_dsp_template.c
+++ b/libavcodec/aac/aacdec_dsp_template.c
@@ -615,23 +615,26 @@ static void AAC_RENAME(apply_prediction)(AACDecContext *ac, SingleChannelElement
reset_all_predictors(sce->AAC_RENAME(predictor_state));
}
-static const AACDecDSP AAC_RENAME(aac_dsp) = {
- .dequant_scalefactors = &AAC_RENAME(dequant_scalefactors),
- .apply_mid_side_stereo = &AAC_RENAME(apply_mid_side_stereo),
- .apply_intensity_stereo = &AAC_RENAME(apply_intensity_stereo),
- .apply_tns = &AAC_RENAME(apply_tns),
- .apply_ltp = &AAC_RENAME(apply_ltp),
- .update_ltp = &AAC_RENAME(update_ltp),
-
- .apply_prediction = AAC_RENAME(apply_prediction),
-
- .imdct_and_windowing = AAC_RENAME(imdct_and_windowing),
- .imdct_and_windowing_960 = AAC_RENAME(imdct_and_windowing_960),
- .imdct_and_windowing_ld = AAC_RENAME(imdct_and_windowing_ld),
- .imdct_and_windowing_eld = AAC_RENAME(imdct_and_windowing_eld),
-
- .apply_dependent_coupling = AAC_RENAME(apply_dependent_coupling),
- .apply_independent_coupling = AAC_RENAME(apply_independent_coupling),
-
- .clip_output = AAC_RENAME(clip_output),
-};
+static av_cold void AAC_RENAME(aac_dsp_init)(AACDecDSP *aac_dsp)
+{
+#define SET(member) aac_dsp->member = AAC_RENAME(member)
+ SET(dequant_scalefactors);
+ SET(apply_mid_side_stereo);
+ SET(apply_intensity_stereo);
+ SET(apply_tns);
+ SET(apply_ltp);
+ SET(update_ltp);
+
+ SET(apply_prediction);
+
+ SET(imdct_and_windowing);
+ SET(imdct_and_windowing_960);
+ SET(imdct_and_windowing_ld);
+ SET(imdct_and_windowing_eld);
+
+ SET(apply_dependent_coupling);
+ SET(apply_independent_coupling);
+
+ SET(clip_output);
+#undef SET
+}
diff --git a/libavcodec/aac/aacdec_fixed.c b/libavcodec/aac/aacdec_fixed.c
index 79d35e05fb..de90880884 100644
--- a/libavcodec/aac/aacdec_fixed.c
+++ b/libavcodec/aac/aacdec_fixed.c
@@ -90,8 +90,8 @@ av_cold int ff_aac_decode_init_fixed(AVCodecContext *avctx)
ac->is_fixed = 1;
avctx->sample_fmt = AV_SAMPLE_FMT_S32P;
- ac->dsp = aac_dsp_fixed;
- ac->proc = aac_proc_fixed;
+ aac_dsp_init_fixed(&ac->dsp);
+ aac_proc_init_fixed(&ac->proc);
ac->fdsp = avpriv_alloc_fixed_dsp(avctx->flags & AV_CODEC_FLAG_BITEXACT);
if (!ac->fdsp)
diff --git a/libavcodec/aac/aacdec_float.c b/libavcodec/aac/aacdec_float.c
index d48a21eef2..885d824fa7 100644
--- a/libavcodec/aac/aacdec_float.c
+++ b/libavcodec/aac/aacdec_float.c
@@ -160,8 +160,8 @@ av_cold int ff_aac_decode_init_float(AVCodecContext *avctx)
ac->is_fixed = 0;
avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
- ac->dsp = aac_dsp;
- ac->proc = aac_proc;
+ aac_dsp_init(&ac->dsp);
+ aac_proc_init(&ac->proc);
ac->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT);
if (!ac->fdsp)
diff --git a/libavcodec/aac/aacdec_proc_template.c b/libavcodec/aac/aacdec_proc_template.c
index 1ffea2f93b..fecf228b3b 100644
--- a/libavcodec/aac/aacdec_proc_template.c
+++ b/libavcodec/aac/aacdec_proc_template.c
@@ -433,7 +433,10 @@ static int AAC_RENAME(decode_cce)(AACDecContext *ac, GetBitContext *gb, ChannelE
return 0;
}
-static const AACDecProc AAC_RENAME(aac_proc) = {
- .decode_spectrum_and_dequant = AAC_RENAME(decode_spectrum_and_dequant),
- .decode_cce = AAC_RENAME(decode_cce),
-};
+static av_cold void AAC_RENAME(aac_proc_init)(AACDecProc *aac_proc)
+{
+#define SET(member) aac_proc->member = AAC_RENAME(member)
+ SET(decode_spectrum_and_dequant);
+ SET(decode_cce);
+#undef SET
+}
--
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-05-06 12:16 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-06 9:29 [FFmpeg-devel] [PATCH 1/3] avcodec/aactab: Provide ff_ltp_coef, ff_tns_tmp2_map unconditionally Andreas Rheinhardt
2024-05-06 9:30 ` [FFmpeg-devel] [PATCH 2/3] avcodec/aacsbr: Fix type mismatch Andreas Rheinhardt
2024-05-06 17:54 ` Lynne
2024-05-06 9:30 ` [FFmpeg-devel] [PATCH 3/3] avcodec/aac/aacdec: Fix linking errors with only one decoder enabled Andreas Rheinhardt
2024-05-06 14:03 ` [FFmpeg-devel] [PATCH v2 3/12] " Andreas Rheinhardt
2024-05-06 17:53 ` [FFmpeg-devel] [PATCH 3/3] " Lynne
2024-05-06 19:39 ` Andreas Rheinhardt
2024-05-06 20:00 ` Lynne
2024-05-06 20:08 ` Andreas Rheinhardt
2024-05-06 12:14 ` [FFmpeg-devel] [PATCH 04/12] avcodec/aac/aacdec: Remove unnecessary ff_thread_once() Andreas Rheinhardt
2024-05-06 12:14 ` [FFmpeg-devel] [PATCH 05/12] avcodec/aac/aacdec: Move channel number check out of init_dsp() Andreas Rheinhardt
2024-05-06 12:14 ` [FFmpeg-devel] [PATCH 06/12] avcodec/aac/aacdec: Avoid branch to set sample_fmt Andreas Rheinhardt
2024-05-06 12:14 ` [FFmpeg-devel] [PATCH 07/12] avcodec/aac/aacdec_float: Call ff_aac_float_common_init() only once Andreas Rheinhardt
2024-05-06 12:14 ` [FFmpeg-devel] [PATCH 08/12] avcodec/aac/aacdec_(fixed|float): Avoid AAC_RENAME, INTFLOAT Andreas Rheinhardt
2024-05-06 12:14 ` [FFmpeg-devel] [PATCH 09/12] avcodec/aac/aacdec: Mark flush as cold Andreas Rheinhardt
2024-05-06 12:14 ` [FFmpeg-devel] [PATCH 10/12] avcodec/aac/aacdec: Avoid compiling latm decoder if disabled Andreas Rheinhardt
2024-05-06 12:14 ` [FFmpeg-devel] [PATCH 11/12] avcodec/aac/aacdec: Move init functions to aacdec_fixed/float Andreas Rheinhardt
2024-05-06 12:14 ` Andreas Rheinhardt [this message]
2024-05-06 17:59 ` [FFmpeg-devel] [PATCH 12/12] avcodec/aac/aacdec_(fixed|float): Set AACDecDSP, AACDecProc directly Lynne
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=GV1P250MB0737EB6EC07077A3AF15355A8F1C2@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