[FFmpeg-cvslog] aacdec: template mid/side stereo application separately

Lynne git at videolan.org
Tue Apr 23 09:58:29 EEST 2024


ffmpeg | branch: master | Lynne <dev at lynne.ee> | Wed Mar 13 21:59:35 2024 +0100| [9f3fa77e0dac729ca3a0bf669c502cfa811c9ae7] | committer: Lynne

aacdec: template mid/side stereo application separately

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9f3fa77e0dac729ca3a0bf669c502cfa811c9ae7
---

 libavcodec/aac/aacdec_dsp_template.c | 35 +++++++++++++++++++++++++++++++++++
 libavcodec/aacdec_template.c         | 36 +-----------------------------------
 2 files changed, 36 insertions(+), 35 deletions(-)

diff --git a/libavcodec/aac/aacdec_dsp_template.c b/libavcodec/aac/aacdec_dsp_template.c
index 9a43cb71e0..3a43e1b04e 100644
--- a/libavcodec/aac/aacdec_dsp_template.c
+++ b/libavcodec/aac/aacdec_dsp_template.c
@@ -88,6 +88,41 @@ static void AAC_RENAME(dequant_scalefactors)(SingleChannelElement *sce)
     }
 }
 
+/**
+ * Mid/Side stereo decoding; reference: 4.6.8.1.3.
+ */
+static void AAC_RENAME(apply_mid_side_stereo)(AACDecContext *ac, ChannelElement *cpe)
+{
+    const IndividualChannelStream *ics = &cpe->ch[0].ics;
+    INTFLOAT *ch0 = cpe->ch[0].AAC_RENAME(coeffs);
+    INTFLOAT *ch1 = cpe->ch[1].AAC_RENAME(coeffs);
+    int g, i, group, idx = 0;
+    const uint16_t *offsets = ics->swb_offset;
+    for (g = 0; g < ics->num_window_groups; g++) {
+        for (i = 0; i < ics->max_sfb; i++, idx++) {
+            if (cpe->ms_mask[idx] &&
+                cpe->ch[0].band_type[idx] < NOISE_BT &&
+                cpe->ch[1].band_type[idx] < NOISE_BT) {
+#if USE_FIXED
+                for (group = 0; group < ics->group_len[g]; group++) {
+                    ac->fdsp->butterflies_fixed(ch0 + group * 128 + offsets[i],
+                                                ch1 + group * 128 + offsets[i],
+                                                offsets[i+1] - offsets[i]);
+#else
+                for (group = 0; group < ics->group_len[g]; group++) {
+                    ac->fdsp->butterflies_float(ch0 + group * 128 + offsets[i],
+                                               ch1 + group * 128 + offsets[i],
+                                               offsets[i+1] - offsets[i]);
+#endif /* USE_FIXED */
+                }
+            }
+        }
+        ch0 += ics->group_len[g] * 128;
+        ch1 += ics->group_len[g] * 128;
+    }
+}
+
 const AACDecDSP AAC_RENAME(aac_dsp) = {
     .dequant_scalefactors = &AAC_RENAME(dequant_scalefactors),
+    .apply_mid_side_stereo = &AAC_RENAME(apply_mid_side_stereo),
 };
diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
index c2962a7ca2..4f7bc84395 100644
--- a/libavcodec/aacdec_template.c
+++ b/libavcodec/aacdec_template.c
@@ -2062,40 +2062,6 @@ fail:
     return ret;
 }
 
-/**
- * Mid/Side stereo decoding; reference: 4.6.8.1.3.
- */
-static void apply_mid_side_stereo(AACDecContext *ac, ChannelElement *cpe)
-{
-    const IndividualChannelStream *ics = &cpe->ch[0].ics;
-    INTFLOAT *ch0 = cpe->ch[0].AAC_RENAME(coeffs);
-    INTFLOAT *ch1 = cpe->ch[1].AAC_RENAME(coeffs);
-    int g, i, group, idx = 0;
-    const uint16_t *offsets = ics->swb_offset;
-    for (g = 0; g < ics->num_window_groups; g++) {
-        for (i = 0; i < ics->max_sfb; i++, idx++) {
-            if (cpe->ms_mask[idx] &&
-                cpe->ch[0].band_type[idx] < NOISE_BT &&
-                cpe->ch[1].band_type[idx] < NOISE_BT) {
-#if USE_FIXED
-                for (group = 0; group < ics->group_len[g]; group++) {
-                    ac->fdsp->butterflies_fixed(ch0 + group * 128 + offsets[i],
-                                                ch1 + group * 128 + offsets[i],
-                                                offsets[i+1] - offsets[i]);
-#else
-                for (group = 0; group < ics->group_len[g]; group++) {
-                    ac->fdsp->butterflies_float(ch0 + group * 128 + offsets[i],
-                                               ch1 + group * 128 + offsets[i],
-                                               offsets[i+1] - offsets[i]);
-#endif /* USE_FIXED */
-                }
-            }
-        }
-        ch0 += ics->group_len[g] * 128;
-        ch1 += ics->group_len[g] * 128;
-    }
-}
-
 /**
  * intensity stereo decoding; reference: 4.6.8.2.3
  *
@@ -2183,7 +2149,7 @@ static int decode_cpe(AACDecContext *ac, GetBitContext *gb, ChannelElement *cpe)
 
     if (common_window) {
         if (ms_present)
-            apply_mid_side_stereo(ac, cpe);
+            ac->dsp.apply_mid_side_stereo(ac, cpe);
         if (ac->oc[1].m4ac.object_type == AOT_AAC_MAIN) {
             apply_prediction(ac, &cpe->ch[0]);
             apply_prediction(ac, &cpe->ch[1]);



More information about the ffmpeg-cvslog mailing list