diff mbox series

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

Message ID DU0PR02MB917105F56FFC398E37783E58F8D19@DU0PR02MB9171.eurprd02.prod.outlook.com
State New
Headers show
Series [FFmpeg-devel] configure: add --disable-he-aac option | expand

Checks

Context Check Description
yinshiyou/configure_loongarch64 warning Failed to apply patch
andriy/make_fate_x86 success Make fate finished
andriy/make_x86 warning New warnings during build

Commit Message

Kristofer Björkström Feb. 1, 2023, 2:32 p.m. UTC
From 6828ea418f0209dface9fbb23ff4657f66988f5e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kristofer=20Bj=C3=B6rkstr=C3=B6m?= <kristofb@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@axis.com>
---
 configure                    | 6 ++++++
 libavcodec/aacdec_template.c | 6 ++++++
 2 files changed, 12 insertions(+)

--
2.30.2

Comments

Hendrik Leppkes Feb. 1, 2023, 2:56 p.m. UTC | #1
On Wed, Feb 1, 2023 at 3:33 PM Kristofer Björkström
<Kristofer.Bjorkstrom@axis.com> wrote:
>
> From 6828ea418f0209dface9fbb23ff4657f66988f5e Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Kristofer=20Bj=C3=B6rkstr=C3=B6m?= <kristofb@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.
>

I don't feel like this adds a good precedence to our codebase. We
generally ignore patents, because every codec is littered with them.
Having options to cherry-pick which patents are enabled and which are
not is not only very ugly, but also impossible to track or make any
guarantees on, so I think we should not even start.

- Hendrik
Jean-Baptiste Kempf Feb. 1, 2023, 3:27 p.m. UTC | #2
On Wed, 1 Feb 2023, at 15:56, Hendrik Leppkes wrote:
> On Wed, Feb 1, 2023 at 3:33 PM Kristofer Björkström
> <Kristofer.Bjorkstrom@axis.com> wrote:
>>
>> Make it possible to disable HE and HEv2 support for AAC. To avoid
>> patents in HE-AAC.
>>
>
> I don't feel like this adds a good precedence to our codebase. We
> generally ignore patents, because every codec is littered with them.
> Having options to cherry-pick which patents are enabled and which are
> not is not only very ugly, but also impossible to track or make any
> guarantees on, so I think we should not even start.

I agree here.

Maybe AAC-LC and Main are patent-free, but that is a big maybe and that depends heavily on the country.

jb
diff mbox series

Patch

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);