[FFmpeg-devel] [PATCH] configure: add --disable-he-aac option

Kristofer Björkström Kristofer.Bjorkstrom at axis.com
Wed Feb 1 16:32:46 EET 2023


>From 6828ea418f0209dface9fbb23ff4657f66988f5e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kristofer=20Bj=C3=B6rkstr=C3=B6m?= <kristofb at axis.com>
Date: Wed, 1 Feb 2023 15:15:14 +0100
Subject: [PATCH] configure: add --disable-he-aac option
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Make it possible to disable HE and HEv2 support for AAC. To avoid
patents in HE-AAC.

Signed-off-by: Kristofer Björkström <kristofb at axis.com>
---
 configure                    | 6 ++++++
 libavcodec/aacdec_template.c | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git a/configure b/configure
index 47790d10f5..e51dd0027a 100755
--- a/configure
+++ b/configure
@@ -145,6 +145,7 @@ Component options:
   --disable-fft            disable FFT code
   --disable-faan           disable floating point AAN (I)DCT code
   --disable-pixelutils     disable pixel utils in libavutil
+  --disable-he-aac         disable HE and HEv2 support for AAC

 Individual component options:
   --disable-everything     disable all components listed below
@@ -1989,6 +1990,7 @@ CONFIG_LIST="
     $SUBSYSTEM_LIST
     autodetect
     fontconfig
+    he_aac
     large_tests
     linux_perf
     macos_kperf
@@ -4227,6 +4229,10 @@ for e in $env; do
     eval "export $e"
 done

+if disabled he_aac; then
+    add_cflags -DHE_AAC_DISABLED
+fi
+
 if disabled autodetect; then

     # Unless iconv is explicitely disabled by the user, we still want to probe
diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
index 444dc4fa9d..3b95468067 100644
--- a/libavcodec/aacdec_template.c
+++ b/libavcodec/aacdec_template.c
@@ -1019,6 +1019,12 @@ static int decode_audio_specific_config_gb(AACContext *ac,
         *m4ac = m4ac_bak;
         return AVERROR_INVALIDDATA;
     }
+#if HE_AAC_DISABLED
+    if (m4ac->ps > 0 || m4ac->sbr > 0 || avctx->profile >= FF_PROFILE_AAC_HE) {
+        av_log(avctx, AV_LOG_ERROR, "HE-AAC is not supported\n");
+        return AVERROR_INVALIDDATA;
+    }
+#endif

     skip_bits_long(gb, i);

--
2.30.2




More information about the ffmpeg-devel mailing list