Re: [FFmpeg-devel] [PATCH 1/2] avcodec/liblc3: Add encoding/decoding support of LC3 audio codec

2024-04-04 Thread Andreas Rheinhardt
Antoine Soulier via ffmpeg-devel:
> The LC3 audio codec is the default codec of Bluetooth LE audio.
> This is a wrapper over the liblc3 library (https://github.com/google/liblc3).
> 
> Signed-off-by: Antoine Soulier 
> ---
>  Changelog |   4 +
>  configure |   6 ++
>  doc/encoders.texi |  57 +++
>  doc/general_contents.texi |  11 +-
>  libavcodec/Makefile   |   2 +
>  libavcodec/allcodecs.c|   2 +
>  libavcodec/codec_desc.c   |   7 ++
>  libavcodec/codec_id.h |   1 +
>  libavcodec/liblc3dec.c| 145 ++
>  libavcodec/liblc3enc.c| 210 ++
>  10 files changed, 444 insertions(+), 1 deletion(-)
>  create mode 100644 libavcodec/liblc3dec.c
>  create mode 100644 libavcodec/liblc3enc.c
> 
> diff --git a/Changelog b/Changelog
> index e83a00e35c..83a4cf7888 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -1,6 +1,10 @@
>  Entries are sorted chronologically from oldest to youngest within each 
> release,
>  releases are sorted from youngest to oldest.
>  
> +version :
> +- LC3/LC3plus decoding/encoding using external library liblc3
> +
> +
>  version 7.0:
>  - DXV DXT1 encoder
>  - LEAD MCMP decoder
> diff --git a/configure b/configure
> index 2d46ef0b9c..e5d9ba9f53 100755
> --- a/configure
> +++ b/configure
> @@ -244,6 +244,7 @@ External library support:
>--enable-libjxl  enable JPEG XL de/encoding via libjxl [no]
>--enable-libklvanc   enable Kernel Labs VANC processing [no]
>--enable-libkvazaar  enable HEVC encoding via libkvazaar [no]
> +  --enable-liblc3  enable LC3 de/encoding via liblc3 [no]
>--enable-liblensfun  enable lensfun lens correction [no]
>--enable-libmodplug  enable ModPlug via libmodplug [no]
>--enable-libmp3lame  enable MP3 encoding via libmp3lame [no]
> @@ -1926,6 +1927,7 @@ EXTERNAL_LIBRARY_LIST="
>  libjxl
>  libklvanc
>  libkvazaar
> +liblc3
>  libmodplug
>  libmp3lame
>  libmysofa
> @@ -3499,6 +3501,9 @@ libilbc_encoder_deps="libilbc"
>  libjxl_decoder_deps="libjxl libjxl_threads"
>  libjxl_encoder_deps="libjxl libjxl_threads"
>  libkvazaar_encoder_deps="libkvazaar"
> +liblc3_decoder_deps="liblc3"
> +liblc3_encoder_deps="liblc3"
> +liblc3_encoder_select="audio_frame_queue"
>  libmodplug_demuxer_deps="libmodplug"
>  libmp3lame_encoder_deps="libmp3lame"
>  libmp3lame_encoder_select="audio_frame_queue mpegaudioheader"
> @@ -6869,6 +6874,7 @@ enabled libjxl&& require_pkg_config libjxl 
> "libjxl >= 0.7.0" jxl/dec
>   require_pkg_config libjxl_threads 
> "libjxl_threads >= 0.7.0" jxl/thread_parallel_runner.h JxlThreadParallelRunner
>  enabled libklvanc && require libklvanc libklvanc/vanc.h 
> klvanc_context_create -lklvanc
>  enabled libkvazaar&& require_pkg_config libkvazaar "kvazaar >= 
> 2.0.0" kvazaar.h kvz_api_get
> +enabled liblc3&& require_pkg_config liblc3 "lc3 >= 1.1.0" lc3.h 
> lc3_hr_setup_encoder
>  enabled liblensfun&& require_pkg_config liblensfun lensfun lensfun.h 
> lf_db_create
>  
>  if enabled libmfx && enabled libvpl; then
> diff --git a/doc/encoders.texi b/doc/encoders.texi
> index 7c223ed74c..66847191e1 100644
> --- a/doc/encoders.texi
> +++ b/doc/encoders.texi
> @@ -814,6 +814,63 @@ ffmpeg -i input.wav -c:a libfdk_aac -profile:a aac_he 
> -b:a 64k output.m4a
>  @end example
>  @end itemize
>  
> +@anchor{liblc3-enc}
> +@section liblc3
> +
> +liblc3 LC3 (Low Complexity Communication Codec) encoder wrapper.
> +
> +Requires the presence of the liblc3 headers and library during configuration.
> +You need to explicitly configure the build with @code{--enable-liblc3}.
> +
> +This encoder has support for the Bluetooth SIG LC3 codec for the LE Audio
> +protocol, and the following features of LC3plus:
> +@itemize
> +@item
> +Frame duration of 2.5 and 5ms.
> +@item
> +High-Resolution mode, 48 KHz, and 96 kHz sampling rates.
> +@end itemize
> +
> +For more information see the liblc3 project at
> +@url{https://github.com/google/liblc3}.
> +
> +@subsection Options
> +
> +The following options are mapped on the shared FFmpeg codec options.
> +
> +@table @option
> +@item b @var{bitrate}
> +Set the bit rate in bits/s. This will determine the fixed size of the encoded
> +frames, for a selected frame duration.
> +
> +@item ar @var{frequency}
> +Set the audio sampling rate (in Hz).
> +
> +@item channels
> +Set the number of audio channels.
> +
> +@item frame_duration
> +Set the audio frame duration in milliseconds. Default value is 10ms.
> +Allowed frame durations are 2.5ms, 5ms, 7.5ms and 10ms.
> +LC3 (Bluetooth LE Audio), allows 7.5ms and 10ms; and LC3plus 2.5ms, 5ms
> +and 10ms.
> +
> +The 10ms frame duration is available in LC3 and LC3 plus standard.
> +In this mode, the produced bitstream can be referenced either as LC3 or 
> LC3plus.
> +
> +@item high_resolution @var{boolean}
> +Enable the high-resolution 

Re: [FFmpeg-devel] [PATCH 1/2] avcodec/liblc3: Add encoding/decoding support of LC3 audio codec

2024-04-04 Thread James Almer

On 4/1/2024 6:32 PM, Antoine Soulier via ffmpeg-devel wrote:

The LC3 audio codec is the default codec of Bluetooth LE audio.
This is a wrapper over the liblc3 library (https://github.com/google/liblc3).

Signed-off-by: Antoine Soulier 
---
  Changelog |   4 +
  configure |   6 ++
  doc/encoders.texi |  57 +++
  doc/general_contents.texi |  11 +-
  libavcodec/Makefile   |   2 +
  libavcodec/allcodecs.c|   2 +
  libavcodec/codec_desc.c   |   7 ++
  libavcodec/codec_id.h |   1 +
  libavcodec/liblc3dec.c| 145 ++
  libavcodec/liblc3enc.c| 210 ++
  10 files changed, 444 insertions(+), 1 deletion(-)
  create mode 100644 libavcodec/liblc3dec.c
  create mode 100644 libavcodec/liblc3enc.c

diff --git a/Changelog b/Changelog
index e83a00e35c..83a4cf7888 100644
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,10 @@
  Entries are sorted chronologically from oldest to youngest within each 
release,
  releases are sorted from youngest to oldest.
  
+version :

+- LC3/LC3plus decoding/encoding using external library liblc3
+
+
  version 7.0:
  - DXV DXT1 encoder
  - LEAD MCMP decoder
diff --git a/configure b/configure
index 2d46ef0b9c..e5d9ba9f53 100755
--- a/configure
+++ b/configure
@@ -244,6 +244,7 @@ External library support:
--enable-libjxl  enable JPEG XL de/encoding via libjxl [no]
--enable-libklvanc   enable Kernel Labs VANC processing [no]
--enable-libkvazaar  enable HEVC encoding via libkvazaar [no]
+  --enable-liblc3  enable LC3 de/encoding via liblc3 [no]
--enable-liblensfun  enable lensfun lens correction [no]
--enable-libmodplug  enable ModPlug via libmodplug [no]
--enable-libmp3lame  enable MP3 encoding via libmp3lame [no]
@@ -1926,6 +1927,7 @@ EXTERNAL_LIBRARY_LIST="
  libjxl
  libklvanc
  libkvazaar
+liblc3
  libmodplug
  libmp3lame
  libmysofa
@@ -3499,6 +3501,9 @@ libilbc_encoder_deps="libilbc"
  libjxl_decoder_deps="libjxl libjxl_threads"
  libjxl_encoder_deps="libjxl libjxl_threads"
  libkvazaar_encoder_deps="libkvazaar"
+liblc3_decoder_deps="liblc3"
+liblc3_encoder_deps="liblc3"
+liblc3_encoder_select="audio_frame_queue"
  libmodplug_demuxer_deps="libmodplug"
  libmp3lame_encoder_deps="libmp3lame"
  libmp3lame_encoder_select="audio_frame_queue mpegaudioheader"
@@ -6869,6 +6874,7 @@ enabled libjxl&& require_pkg_config libjxl "libjxl 
>= 0.7.0" jxl/dec
   require_pkg_config libjxl_threads "libjxl_threads >= 
0.7.0" jxl/thread_parallel_runner.h JxlThreadParallelRunner
  enabled libklvanc && require libklvanc libklvanc/vanc.h 
klvanc_context_create -lklvanc
  enabled libkvazaar&& require_pkg_config libkvazaar "kvazaar >= 2.0.0" 
kvazaar.h kvz_api_get
+enabled liblc3&& require_pkg_config liblc3 "lc3 >= 1.1.0" lc3.h 
lc3_hr_setup_encoder
  enabled liblensfun&& require_pkg_config liblensfun lensfun lensfun.h 
lf_db_create
  
  if enabled libmfx && enabled libvpl; then

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 7c223ed74c..66847191e1 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -814,6 +814,63 @@ ffmpeg -i input.wav -c:a libfdk_aac -profile:a aac_he -b:a 
64k output.m4a
  @end example
  @end itemize
  
+@anchor{liblc3-enc}

+@section liblc3
+
+liblc3 LC3 (Low Complexity Communication Codec) encoder wrapper.
+
+Requires the presence of the liblc3 headers and library during configuration.
+You need to explicitly configure the build with @code{--enable-liblc3}.
+
+This encoder has support for the Bluetooth SIG LC3 codec for the LE Audio
+protocol, and the following features of LC3plus:
+@itemize
+@item
+Frame duration of 2.5 and 5ms.
+@item
+High-Resolution mode, 48 KHz, and 96 kHz sampling rates.
+@end itemize
+
+For more information see the liblc3 project at
+@url{https://github.com/google/liblc3}.
+
+@subsection Options
+
+The following options are mapped on the shared FFmpeg codec options.
+
+@table @option
+@item b @var{bitrate}
+Set the bit rate in bits/s. This will determine the fixed size of the encoded
+frames, for a selected frame duration.
+
+@item ar @var{frequency}
+Set the audio sampling rate (in Hz).
+
+@item channels
+Set the number of audio channels.
+
+@item frame_duration
+Set the audio frame duration in milliseconds. Default value is 10ms.
+Allowed frame durations are 2.5ms, 5ms, 7.5ms and 10ms.
+LC3 (Bluetooth LE Audio), allows 7.5ms and 10ms; and LC3plus 2.5ms, 5ms
+and 10ms.
+
+The 10ms frame duration is available in LC3 and LC3 plus standard.
+In this mode, the produced bitstream can be referenced either as LC3 or 
LC3plus.
+
+@item high_resolution @var{boolean}
+Enable the high-resolution mode if set to 1. The high-resolution mode is
+available with all LC3plus frame durations and for a sampling rate of 48 KHz,
+and 96 KHz.
+
+The encoder automatically turns off this mode at 

Re: [FFmpeg-devel] [PATCH 1/2] avcodec/liblc3: Add encoding/decoding support of LC3 audio codec

2024-04-04 Thread Stefano Sabatini
On date Monday 2024-04-01 21:32:04 +, ffmpeg-devel Mailing List wrote:
> The LC3 audio codec is the default codec of Bluetooth LE audio.
> This is a wrapper over the liblc3 library (https://github.com/google/liblc3).
> 
> Signed-off-by: Antoine Soulier 
> ---
>  Changelog |   4 +
>  configure |   6 ++
>  doc/encoders.texi |  57 +++
>  doc/general_contents.texi |  11 +-
>  libavcodec/Makefile   |   2 +
>  libavcodec/allcodecs.c|   2 +
>  libavcodec/codec_desc.c   |   7 ++
>  libavcodec/codec_id.h |   1 +
>  libavcodec/liblc3dec.c| 145 ++
>  libavcodec/liblc3enc.c| 210 ++
>  10 files changed, 444 insertions(+), 1 deletion(-)
>  create mode 100644 libavcodec/liblc3dec.c
>  create mode 100644 libavcodec/liblc3enc.c

will apply this soon (after a rebase)

Note: I had to add the libavutil/mem.h includes to fix local
compilation.

Also, liblc3 meson will install the .pc file in
lib/x86_64-linux-gnu/pkgconfig/ which is a bit unexpected, as the
PKG_CONFIG_PATH is usually lib/pkgconfig.

Thanks.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 1/2] avcodec/liblc3: Add encoding/decoding support of LC3 audio codec

2024-04-02 Thread Stefano Sabatini
On date Friday 2024-03-29 17:30:30 +, ffmpeg-devel Mailing List wrote:
> The LC3 audio codec is the default codec of Bluetooth LE audio.
> This is a wrapper over the liblc3 library (https://github.com/google/liblc3).
> 
> Signed-off-by: Antoine Soulier 
> ---
>  Changelog |   4 +
>  configure |   6 ++
>  doc/encoders.texi |  57 
>  doc/general_contents.texi |  11 ++-
>  libavcodec/Makefile   |   2 +
>  libavcodec/allcodecs.c|   2 +
>  libavcodec/codec_desc.c   |   7 ++
>  libavcodec/codec_id.h |   1 +
>  libavcodec/liblc3dec.c| 141 
>  libavcodec/liblc3enc.c| 190 ++
>  10 files changed, 420 insertions(+), 1 deletion(-)
>  create mode 100644 libavcodec/liblc3dec.c
>  create mode 100644 libavcodec/liblc3enc.c

I don't see pending comments for this patch, so I'll apply it in
one/two days if I see no more comments.

Thanks.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 1/2] avcodec/liblc3: Add encoding/decoding support of LC3 audio codec

2024-04-01 Thread Antoine Soulier via ffmpeg-devel
The LC3 audio codec is the default codec of Bluetooth LE audio.
This is a wrapper over the liblc3 library (https://github.com/google/liblc3).

Signed-off-by: Antoine Soulier 
---
 Changelog |   4 +
 configure |   6 ++
 doc/encoders.texi |  57 +++
 doc/general_contents.texi |  11 +-
 libavcodec/Makefile   |   2 +
 libavcodec/allcodecs.c|   2 +
 libavcodec/codec_desc.c   |   7 ++
 libavcodec/codec_id.h |   1 +
 libavcodec/liblc3dec.c| 145 ++
 libavcodec/liblc3enc.c| 210 ++
 10 files changed, 444 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/liblc3dec.c
 create mode 100644 libavcodec/liblc3enc.c

diff --git a/Changelog b/Changelog
index e83a00e35c..83a4cf7888 100644
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,10 @@
 Entries are sorted chronologically from oldest to youngest within each release,
 releases are sorted from youngest to oldest.
 
+version :
+- LC3/LC3plus decoding/encoding using external library liblc3
+
+
 version 7.0:
 - DXV DXT1 encoder
 - LEAD MCMP decoder
diff --git a/configure b/configure
index 2d46ef0b9c..e5d9ba9f53 100755
--- a/configure
+++ b/configure
@@ -244,6 +244,7 @@ External library support:
   --enable-libjxl  enable JPEG XL de/encoding via libjxl [no]
   --enable-libklvanc   enable Kernel Labs VANC processing [no]
   --enable-libkvazaar  enable HEVC encoding via libkvazaar [no]
+  --enable-liblc3  enable LC3 de/encoding via liblc3 [no]
   --enable-liblensfun  enable lensfun lens correction [no]
   --enable-libmodplug  enable ModPlug via libmodplug [no]
   --enable-libmp3lame  enable MP3 encoding via libmp3lame [no]
@@ -1926,6 +1927,7 @@ EXTERNAL_LIBRARY_LIST="
 libjxl
 libklvanc
 libkvazaar
+liblc3
 libmodplug
 libmp3lame
 libmysofa
@@ -3499,6 +3501,9 @@ libilbc_encoder_deps="libilbc"
 libjxl_decoder_deps="libjxl libjxl_threads"
 libjxl_encoder_deps="libjxl libjxl_threads"
 libkvazaar_encoder_deps="libkvazaar"
+liblc3_decoder_deps="liblc3"
+liblc3_encoder_deps="liblc3"
+liblc3_encoder_select="audio_frame_queue"
 libmodplug_demuxer_deps="libmodplug"
 libmp3lame_encoder_deps="libmp3lame"
 libmp3lame_encoder_select="audio_frame_queue mpegaudioheader"
@@ -6869,6 +6874,7 @@ enabled libjxl&& require_pkg_config libjxl 
"libjxl >= 0.7.0" jxl/dec
  require_pkg_config libjxl_threads "libjxl_threads 
>= 0.7.0" jxl/thread_parallel_runner.h JxlThreadParallelRunner
 enabled libklvanc && require libklvanc libklvanc/vanc.h 
klvanc_context_create -lklvanc
 enabled libkvazaar&& require_pkg_config libkvazaar "kvazaar >= 2.0.0" 
kvazaar.h kvz_api_get
+enabled liblc3&& require_pkg_config liblc3 "lc3 >= 1.1.0" lc3.h 
lc3_hr_setup_encoder
 enabled liblensfun&& require_pkg_config liblensfun lensfun lensfun.h 
lf_db_create
 
 if enabled libmfx && enabled libvpl; then
diff --git a/doc/encoders.texi b/doc/encoders.texi
index 7c223ed74c..66847191e1 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -814,6 +814,63 @@ ffmpeg -i input.wav -c:a libfdk_aac -profile:a aac_he -b:a 
64k output.m4a
 @end example
 @end itemize
 
+@anchor{liblc3-enc}
+@section liblc3
+
+liblc3 LC3 (Low Complexity Communication Codec) encoder wrapper.
+
+Requires the presence of the liblc3 headers and library during configuration.
+You need to explicitly configure the build with @code{--enable-liblc3}.
+
+This encoder has support for the Bluetooth SIG LC3 codec for the LE Audio
+protocol, and the following features of LC3plus:
+@itemize
+@item
+Frame duration of 2.5 and 5ms.
+@item
+High-Resolution mode, 48 KHz, and 96 kHz sampling rates.
+@end itemize
+
+For more information see the liblc3 project at
+@url{https://github.com/google/liblc3}.
+
+@subsection Options
+
+The following options are mapped on the shared FFmpeg codec options.
+
+@table @option
+@item b @var{bitrate}
+Set the bit rate in bits/s. This will determine the fixed size of the encoded
+frames, for a selected frame duration.
+
+@item ar @var{frequency}
+Set the audio sampling rate (in Hz).
+
+@item channels
+Set the number of audio channels.
+
+@item frame_duration
+Set the audio frame duration in milliseconds. Default value is 10ms.
+Allowed frame durations are 2.5ms, 5ms, 7.5ms and 10ms.
+LC3 (Bluetooth LE Audio), allows 7.5ms and 10ms; and LC3plus 2.5ms, 5ms
+and 10ms.
+
+The 10ms frame duration is available in LC3 and LC3 plus standard.
+In this mode, the produced bitstream can be referenced either as LC3 or 
LC3plus.
+
+@item high_resolution @var{boolean}
+Enable the high-resolution mode if set to 1. The high-resolution mode is
+available with all LC3plus frame durations and for a sampling rate of 48 KHz,
+and 96 KHz.
+
+The encoder automatically turns off this mode at lower sampling rates and
+activates it at 96 KHz.
+
+This mode should be preferred at high bitrates. In this mode, 

Re: [FFmpeg-devel] [PATCH 1/2] avcodec/liblc3: Add encoding/decoding support of LC3 audio codec

2024-03-29 Thread Andreas Rheinhardt
Antoine Soulier via ffmpeg-devel:
> With free licensed code, I don't think that will happen; the core algorithm
> is the same.
> LC3 is like a subset of LC3plus, but also adds 7.5ms frame duration.
> I acknowledged the use of only one Codec Id, because it makes sense to me
> to distinguish both as different profiles / feature sets.
> Moreover, LC3 and LC3plus declares both the 10ms frame duration. It's
> impossible to distinguish such a stream as LC3 or LC3plus.
> The main difference between the 2 codecs are licenses:
> - LC3 will only be used, and is free to use, over Bluetooth on standard
> profile claiming it.
> - LC3plus can be used anywhere, but is under license fee.
> 
> So it makes sense to me to cover both as LC3.

Thanks for the convincing explanation.

- Andreas

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 1/2] avcodec/liblc3: Add encoding/decoding support of LC3 audio codec

2024-03-29 Thread Antoine Soulier via ffmpeg-devel
With free licensed code, I don't think that will happen; the core algorithm
is the same.
LC3 is like a subset of LC3plus, but also adds 7.5ms frame duration.
I acknowledged the use of only one Codec Id, because it makes sense to me
to distinguish both as different profiles / feature sets.
Moreover, LC3 and LC3plus declares both the 10ms frame duration. It's
impossible to distinguish such a stream as LC3 or LC3plus.
The main difference between the 2 codecs are licenses:
- LC3 will only be used, and is free to use, over Bluetooth on standard
profile claiming it.
- LC3plus can be used anywhere, but is under license fee.

So it makes sense to me to cover both as LC3.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 1/2] avcodec/liblc3: Add encoding/decoding support of LC3 audio codec

2024-03-29 Thread Andreas Rheinhardt
Antoine Soulier via ffmpeg-devel:
> The LC3 audio codec is the default codec of Bluetooth LE audio.
> This is a wrapper over the liblc3 library (https://github.com/google/liblc3).
> 
> Signed-off-by: Antoine Soulier 
> ---
>  Changelog |   4 +
>  configure |   6 ++
>  doc/encoders.texi |  57 
>  doc/general_contents.texi |  11 ++-
>  libavcodec/Makefile   |   2 +
>  libavcodec/allcodecs.c|   2 +
>  libavcodec/codec_desc.c   |   7 ++
>  libavcodec/codec_id.h |   1 +
>  libavcodec/liblc3dec.c| 141 
>  libavcodec/liblc3enc.c| 190 ++
>  10 files changed, 420 insertions(+), 1 deletion(-)
>  create mode 100644 libavcodec/liblc3dec.c
>  create mode 100644 libavcodec/liblc3enc.c
> 
> diff --git a/Changelog b/Changelog
> index e83a00e35c..83a4cf7888 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -1,6 +1,10 @@
>  Entries are sorted chronologically from oldest to youngest within each 
> release,
>  releases are sorted from youngest to oldest.
>  
> +version :
> +- LC3/LC3plus decoding/encoding using external library liblc3
> +
> +
>  version 7.0:
>  - DXV DXT1 encoder
>  - LEAD MCMP decoder
> diff --git a/configure b/configure
> index 2d46ef0b9c..e5d9ba9f53 100755
> --- a/configure
> +++ b/configure
> @@ -244,6 +244,7 @@ External library support:
>--enable-libjxl  enable JPEG XL de/encoding via libjxl [no]
>--enable-libklvanc   enable Kernel Labs VANC processing [no]
>--enable-libkvazaar  enable HEVC encoding via libkvazaar [no]
> +  --enable-liblc3  enable LC3 de/encoding via liblc3 [no]
>--enable-liblensfun  enable lensfun lens correction [no]
>--enable-libmodplug  enable ModPlug via libmodplug [no]
>--enable-libmp3lame  enable MP3 encoding via libmp3lame [no]
> @@ -1926,6 +1927,7 @@ EXTERNAL_LIBRARY_LIST="
>  libjxl
>  libklvanc
>  libkvazaar
> +liblc3
>  libmodplug
>  libmp3lame
>  libmysofa
> @@ -3499,6 +3501,9 @@ libilbc_encoder_deps="libilbc"
>  libjxl_decoder_deps="libjxl libjxl_threads"
>  libjxl_encoder_deps="libjxl libjxl_threads"
>  libkvazaar_encoder_deps="libkvazaar"
> +liblc3_decoder_deps="liblc3"
> +liblc3_encoder_deps="liblc3"
> +liblc3_encoder_select="audio_frame_queue"
>  libmodplug_demuxer_deps="libmodplug"
>  libmp3lame_encoder_deps="libmp3lame"
>  libmp3lame_encoder_select="audio_frame_queue mpegaudioheader"
> @@ -6869,6 +6874,7 @@ enabled libjxl&& require_pkg_config libjxl 
> "libjxl >= 0.7.0" jxl/dec
>   require_pkg_config libjxl_threads 
> "libjxl_threads >= 0.7.0" jxl/thread_parallel_runner.h JxlThreadParallelRunner
>  enabled libklvanc && require libklvanc libklvanc/vanc.h 
> klvanc_context_create -lklvanc
>  enabled libkvazaar&& require_pkg_config libkvazaar "kvazaar >= 
> 2.0.0" kvazaar.h kvz_api_get
> +enabled liblc3&& require_pkg_config liblc3 "lc3 >= 1.1.0" lc3.h 
> lc3_hr_setup_encoder
>  enabled liblensfun&& require_pkg_config liblensfun lensfun lensfun.h 
> lf_db_create
>  
>  if enabled libmfx && enabled libvpl; then
> diff --git a/doc/encoders.texi b/doc/encoders.texi
> index 7c223ed74c..66847191e1 100644
> --- a/doc/encoders.texi
> +++ b/doc/encoders.texi
> @@ -814,6 +814,63 @@ ffmpeg -i input.wav -c:a libfdk_aac -profile:a aac_he 
> -b:a 64k output.m4a
>  @end example
>  @end itemize
>  
> +@anchor{liblc3-enc}
> +@section liblc3
> +
> +liblc3 LC3 (Low Complexity Communication Codec) encoder wrapper.
> +
> +Requires the presence of the liblc3 headers and library during configuration.
> +You need to explicitly configure the build with @code{--enable-liblc3}.
> +
> +This encoder has support for the Bluetooth SIG LC3 codec for the LE Audio
> +protocol, and the following features of LC3plus:
> +@itemize
> +@item
> +Frame duration of 2.5 and 5ms.
> +@item
> +High-Resolution mode, 48 KHz, and 96 kHz sampling rates.
> +@end itemize
> +
> +For more information see the liblc3 project at
> +@url{https://github.com/google/liblc3}.
> +
> +@subsection Options
> +
> +The following options are mapped on the shared FFmpeg codec options.
> +
> +@table @option
> +@item b @var{bitrate}
> +Set the bit rate in bits/s. This will determine the fixed size of the encoded
> +frames, for a selected frame duration.
> +
> +@item ar @var{frequency}
> +Set the audio sampling rate (in Hz).
> +
> +@item channels
> +Set the number of audio channels.
> +
> +@item frame_duration
> +Set the audio frame duration in milliseconds. Default value is 10ms.
> +Allowed frame durations are 2.5ms, 5ms, 7.5ms and 10ms.
> +LC3 (Bluetooth LE Audio), allows 7.5ms and 10ms; and LC3plus 2.5ms, 5ms
> +and 10ms.
> +
> +The 10ms frame duration is available in LC3 and LC3 plus standard.
> +In this mode, the produced bitstream can be referenced either as LC3 or 
> LC3plus.
> +
> +@item high_resolution @var{boolean}
> +Enable the 

[FFmpeg-devel] [PATCH 1/2] avcodec/liblc3: Add encoding/decoding support of LC3 audio codec

2024-03-29 Thread Antoine Soulier via ffmpeg-devel
The LC3 audio codec is the default codec of Bluetooth LE audio.
This is a wrapper over the liblc3 library (https://github.com/google/liblc3).

Signed-off-by: Antoine Soulier 
---
 Changelog |   4 +
 configure |   6 ++
 doc/encoders.texi |  57 
 doc/general_contents.texi |  11 ++-
 libavcodec/Makefile   |   2 +
 libavcodec/allcodecs.c|   2 +
 libavcodec/codec_desc.c   |   7 ++
 libavcodec/codec_id.h |   1 +
 libavcodec/liblc3dec.c| 141 
 libavcodec/liblc3enc.c| 190 ++
 10 files changed, 420 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/liblc3dec.c
 create mode 100644 libavcodec/liblc3enc.c

diff --git a/Changelog b/Changelog
index e83a00e35c..83a4cf7888 100644
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,10 @@
 Entries are sorted chronologically from oldest to youngest within each release,
 releases are sorted from youngest to oldest.
 
+version :
+- LC3/LC3plus decoding/encoding using external library liblc3
+
+
 version 7.0:
 - DXV DXT1 encoder
 - LEAD MCMP decoder
diff --git a/configure b/configure
index 2d46ef0b9c..e5d9ba9f53 100755
--- a/configure
+++ b/configure
@@ -244,6 +244,7 @@ External library support:
   --enable-libjxl  enable JPEG XL de/encoding via libjxl [no]
   --enable-libklvanc   enable Kernel Labs VANC processing [no]
   --enable-libkvazaar  enable HEVC encoding via libkvazaar [no]
+  --enable-liblc3  enable LC3 de/encoding via liblc3 [no]
   --enable-liblensfun  enable lensfun lens correction [no]
   --enable-libmodplug  enable ModPlug via libmodplug [no]
   --enable-libmp3lame  enable MP3 encoding via libmp3lame [no]
@@ -1926,6 +1927,7 @@ EXTERNAL_LIBRARY_LIST="
 libjxl
 libklvanc
 libkvazaar
+liblc3
 libmodplug
 libmp3lame
 libmysofa
@@ -3499,6 +3501,9 @@ libilbc_encoder_deps="libilbc"
 libjxl_decoder_deps="libjxl libjxl_threads"
 libjxl_encoder_deps="libjxl libjxl_threads"
 libkvazaar_encoder_deps="libkvazaar"
+liblc3_decoder_deps="liblc3"
+liblc3_encoder_deps="liblc3"
+liblc3_encoder_select="audio_frame_queue"
 libmodplug_demuxer_deps="libmodplug"
 libmp3lame_encoder_deps="libmp3lame"
 libmp3lame_encoder_select="audio_frame_queue mpegaudioheader"
@@ -6869,6 +6874,7 @@ enabled libjxl&& require_pkg_config libjxl 
"libjxl >= 0.7.0" jxl/dec
  require_pkg_config libjxl_threads "libjxl_threads 
>= 0.7.0" jxl/thread_parallel_runner.h JxlThreadParallelRunner
 enabled libklvanc && require libklvanc libklvanc/vanc.h 
klvanc_context_create -lklvanc
 enabled libkvazaar&& require_pkg_config libkvazaar "kvazaar >= 2.0.0" 
kvazaar.h kvz_api_get
+enabled liblc3&& require_pkg_config liblc3 "lc3 >= 1.1.0" lc3.h 
lc3_hr_setup_encoder
 enabled liblensfun&& require_pkg_config liblensfun lensfun lensfun.h 
lf_db_create
 
 if enabled libmfx && enabled libvpl; then
diff --git a/doc/encoders.texi b/doc/encoders.texi
index 7c223ed74c..66847191e1 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -814,6 +814,63 @@ ffmpeg -i input.wav -c:a libfdk_aac -profile:a aac_he -b:a 
64k output.m4a
 @end example
 @end itemize
 
+@anchor{liblc3-enc}
+@section liblc3
+
+liblc3 LC3 (Low Complexity Communication Codec) encoder wrapper.
+
+Requires the presence of the liblc3 headers and library during configuration.
+You need to explicitly configure the build with @code{--enable-liblc3}.
+
+This encoder has support for the Bluetooth SIG LC3 codec for the LE Audio
+protocol, and the following features of LC3plus:
+@itemize
+@item
+Frame duration of 2.5 and 5ms.
+@item
+High-Resolution mode, 48 KHz, and 96 kHz sampling rates.
+@end itemize
+
+For more information see the liblc3 project at
+@url{https://github.com/google/liblc3}.
+
+@subsection Options
+
+The following options are mapped on the shared FFmpeg codec options.
+
+@table @option
+@item b @var{bitrate}
+Set the bit rate in bits/s. This will determine the fixed size of the encoded
+frames, for a selected frame duration.
+
+@item ar @var{frequency}
+Set the audio sampling rate (in Hz).
+
+@item channels
+Set the number of audio channels.
+
+@item frame_duration
+Set the audio frame duration in milliseconds. Default value is 10ms.
+Allowed frame durations are 2.5ms, 5ms, 7.5ms and 10ms.
+LC3 (Bluetooth LE Audio), allows 7.5ms and 10ms; and LC3plus 2.5ms, 5ms
+and 10ms.
+
+The 10ms frame duration is available in LC3 and LC3 plus standard.
+In this mode, the produced bitstream can be referenced either as LC3 or 
LC3plus.
+
+@item high_resolution @var{boolean}
+Enable the high-resolution mode if set to 1. The high-resolution mode is
+available with all LC3plus frame durations and for a sampling rate of 48 KHz,
+and 96 KHz.
+
+The encoder automatically turns off this mode at lower sampling rates and
+activates it at 96 KHz.
+
+This mode should be preferred at high bitrates. In this 

[FFmpeg-devel] [PATCH 1/2] avcodec/liblc3: Add encoding/decoding support of LC3 audio codec

2024-03-28 Thread Antoine Soulier via ffmpeg-devel
The LC3 audio codec is the default codec of Bluetooth LE audio.
This is a wrapper over the liblc3 library (https://github.com/google/liblc3).

Signed-off-by: Antoine Soulier 
---
 Changelog |   4 +
 configure |   6 ++
 doc/encoders.texi |  57 
 doc/general_contents.texi |  11 ++-
 libavcodec/Makefile   |   2 +
 libavcodec/allcodecs.c|   2 +
 libavcodec/codec_desc.c   |   7 ++
 libavcodec/codec_id.h |   1 +
 libavcodec/liblc3dec.c| 141 
 libavcodec/liblc3enc.c| 190 ++
 10 files changed, 420 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/liblc3dec.c
 create mode 100644 libavcodec/liblc3enc.c

diff --git a/Changelog b/Changelog
index e83a00e35c..83a4cf7888 100644
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,10 @@
 Entries are sorted chronologically from oldest to youngest within each release,
 releases are sorted from youngest to oldest.
 
+version :
+- LC3/LC3plus decoding/encoding using external library liblc3
+
+
 version 7.0:
 - DXV DXT1 encoder
 - LEAD MCMP decoder
diff --git a/configure b/configure
index 2d46ef0b9c..e5d9ba9f53 100755
--- a/configure
+++ b/configure
@@ -244,6 +244,7 @@ External library support:
   --enable-libjxl  enable JPEG XL de/encoding via libjxl [no]
   --enable-libklvanc   enable Kernel Labs VANC processing [no]
   --enable-libkvazaar  enable HEVC encoding via libkvazaar [no]
+  --enable-liblc3  enable LC3 de/encoding via liblc3 [no]
   --enable-liblensfun  enable lensfun lens correction [no]
   --enable-libmodplug  enable ModPlug via libmodplug [no]
   --enable-libmp3lame  enable MP3 encoding via libmp3lame [no]
@@ -1926,6 +1927,7 @@ EXTERNAL_LIBRARY_LIST="
 libjxl
 libklvanc
 libkvazaar
+liblc3
 libmodplug
 libmp3lame
 libmysofa
@@ -3499,6 +3501,9 @@ libilbc_encoder_deps="libilbc"
 libjxl_decoder_deps="libjxl libjxl_threads"
 libjxl_encoder_deps="libjxl libjxl_threads"
 libkvazaar_encoder_deps="libkvazaar"
+liblc3_decoder_deps="liblc3"
+liblc3_encoder_deps="liblc3"
+liblc3_encoder_select="audio_frame_queue"
 libmodplug_demuxer_deps="libmodplug"
 libmp3lame_encoder_deps="libmp3lame"
 libmp3lame_encoder_select="audio_frame_queue mpegaudioheader"
@@ -6869,6 +6874,7 @@ enabled libjxl&& require_pkg_config libjxl 
"libjxl >= 0.7.0" jxl/dec
  require_pkg_config libjxl_threads "libjxl_threads 
>= 0.7.0" jxl/thread_parallel_runner.h JxlThreadParallelRunner
 enabled libklvanc && require libklvanc libklvanc/vanc.h 
klvanc_context_create -lklvanc
 enabled libkvazaar&& require_pkg_config libkvazaar "kvazaar >= 2.0.0" 
kvazaar.h kvz_api_get
+enabled liblc3&& require_pkg_config liblc3 "lc3 >= 1.1.0" lc3.h 
lc3_hr_setup_encoder
 enabled liblensfun&& require_pkg_config liblensfun lensfun lensfun.h 
lf_db_create
 
 if enabled libmfx && enabled libvpl; then
diff --git a/doc/encoders.texi b/doc/encoders.texi
index 7c223ed74c..66847191e1 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -814,6 +814,63 @@ ffmpeg -i input.wav -c:a libfdk_aac -profile:a aac_he -b:a 
64k output.m4a
 @end example
 @end itemize
 
+@anchor{liblc3-enc}
+@section liblc3
+
+liblc3 LC3 (Low Complexity Communication Codec) encoder wrapper.
+
+Requires the presence of the liblc3 headers and library during configuration.
+You need to explicitly configure the build with @code{--enable-liblc3}.
+
+This encoder has support for the Bluetooth SIG LC3 codec for the LE Audio
+protocol, and the following features of LC3plus:
+@itemize
+@item
+Frame duration of 2.5 and 5ms.
+@item
+High-Resolution mode, 48 KHz, and 96 kHz sampling rates.
+@end itemize
+
+For more information see the liblc3 project at
+@url{https://github.com/google/liblc3}.
+
+@subsection Options
+
+The following options are mapped on the shared FFmpeg codec options.
+
+@table @option
+@item b @var{bitrate}
+Set the bit rate in bits/s. This will determine the fixed size of the encoded
+frames, for a selected frame duration.
+
+@item ar @var{frequency}
+Set the audio sampling rate (in Hz).
+
+@item channels
+Set the number of audio channels.
+
+@item frame_duration
+Set the audio frame duration in milliseconds. Default value is 10ms.
+Allowed frame durations are 2.5ms, 5ms, 7.5ms and 10ms.
+LC3 (Bluetooth LE Audio), allows 7.5ms and 10ms; and LC3plus 2.5ms, 5ms
+and 10ms.
+
+The 10ms frame duration is available in LC3 and LC3 plus standard.
+In this mode, the produced bitstream can be referenced either as LC3 or 
LC3plus.
+
+@item high_resolution @var{boolean}
+Enable the high-resolution mode if set to 1. The high-resolution mode is
+available with all LC3plus frame durations and for a sampling rate of 48 KHz,
+and 96 KHz.
+
+The encoder automatically turns off this mode at lower sampling rates and
+activates it at 96 KHz.
+
+This mode should be preferred at high bitrates. In this 

[FFmpeg-devel] [PATCH 1/2] avcodec/liblc3: Add encoding/decoding support of LC3 audio codec

2024-03-28 Thread Antoine Soulier via ffmpeg-devel
The LC3 audio codec is the default codec of Bluetooth LE audio.
This is a wrapper over the liblc3 library (https://github.com/google/liblc3).

Signed-off-by: Antoine Soulier 
---
 Changelog |   4 +
 configure |   6 ++
 doc/encoders.texi |  57 
 doc/general_contents.texi |  11 ++-
 libavcodec/Makefile   |   2 +
 libavcodec/allcodecs.c|   2 +
 libavcodec/codec_desc.c   |   7 ++
 libavcodec/codec_id.h |   1 +
 libavcodec/liblc3dec.c| 135 +++
 libavcodec/liblc3enc.c| 190 ++
 10 files changed, 414 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/liblc3dec.c
 create mode 100644 libavcodec/liblc3enc.c

diff --git a/Changelog b/Changelog
index e83a00e35c..83a4cf7888 100644
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,10 @@
 Entries are sorted chronologically from oldest to youngest within each release,
 releases are sorted from youngest to oldest.
 
+version :
+- LC3/LC3plus decoding/encoding using external library liblc3
+
+
 version 7.0:
 - DXV DXT1 encoder
 - LEAD MCMP decoder
diff --git a/configure b/configure
index 2d46ef0b9c..e5d9ba9f53 100755
--- a/configure
+++ b/configure
@@ -244,6 +244,7 @@ External library support:
   --enable-libjxl  enable JPEG XL de/encoding via libjxl [no]
   --enable-libklvanc   enable Kernel Labs VANC processing [no]
   --enable-libkvazaar  enable HEVC encoding via libkvazaar [no]
+  --enable-liblc3  enable LC3 de/encoding via liblc3 [no]
   --enable-liblensfun  enable lensfun lens correction [no]
   --enable-libmodplug  enable ModPlug via libmodplug [no]
   --enable-libmp3lame  enable MP3 encoding via libmp3lame [no]
@@ -1926,6 +1927,7 @@ EXTERNAL_LIBRARY_LIST="
 libjxl
 libklvanc
 libkvazaar
+liblc3
 libmodplug
 libmp3lame
 libmysofa
@@ -3499,6 +3501,9 @@ libilbc_encoder_deps="libilbc"
 libjxl_decoder_deps="libjxl libjxl_threads"
 libjxl_encoder_deps="libjxl libjxl_threads"
 libkvazaar_encoder_deps="libkvazaar"
+liblc3_decoder_deps="liblc3"
+liblc3_encoder_deps="liblc3"
+liblc3_encoder_select="audio_frame_queue"
 libmodplug_demuxer_deps="libmodplug"
 libmp3lame_encoder_deps="libmp3lame"
 libmp3lame_encoder_select="audio_frame_queue mpegaudioheader"
@@ -6869,6 +6874,7 @@ enabled libjxl&& require_pkg_config libjxl 
"libjxl >= 0.7.0" jxl/dec
  require_pkg_config libjxl_threads "libjxl_threads 
>= 0.7.0" jxl/thread_parallel_runner.h JxlThreadParallelRunner
 enabled libklvanc && require libklvanc libklvanc/vanc.h 
klvanc_context_create -lklvanc
 enabled libkvazaar&& require_pkg_config libkvazaar "kvazaar >= 2.0.0" 
kvazaar.h kvz_api_get
+enabled liblc3&& require_pkg_config liblc3 "lc3 >= 1.1.0" lc3.h 
lc3_hr_setup_encoder
 enabled liblensfun&& require_pkg_config liblensfun lensfun lensfun.h 
lf_db_create
 
 if enabled libmfx && enabled libvpl; then
diff --git a/doc/encoders.texi b/doc/encoders.texi
index 7c223ed74c..66847191e1 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -814,6 +814,63 @@ ffmpeg -i input.wav -c:a libfdk_aac -profile:a aac_he -b:a 
64k output.m4a
 @end example
 @end itemize
 
+@anchor{liblc3-enc}
+@section liblc3
+
+liblc3 LC3 (Low Complexity Communication Codec) encoder wrapper.
+
+Requires the presence of the liblc3 headers and library during configuration.
+You need to explicitly configure the build with @code{--enable-liblc3}.
+
+This encoder has support for the Bluetooth SIG LC3 codec for the LE Audio
+protocol, and the following features of LC3plus:
+@itemize
+@item
+Frame duration of 2.5 and 5ms.
+@item
+High-Resolution mode, 48 KHz, and 96 kHz sampling rates.
+@end itemize
+
+For more information see the liblc3 project at
+@url{https://github.com/google/liblc3}.
+
+@subsection Options
+
+The following options are mapped on the shared FFmpeg codec options.
+
+@table @option
+@item b @var{bitrate}
+Set the bit rate in bits/s. This will determine the fixed size of the encoded
+frames, for a selected frame duration.
+
+@item ar @var{frequency}
+Set the audio sampling rate (in Hz).
+
+@item channels
+Set the number of audio channels.
+
+@item frame_duration
+Set the audio frame duration in milliseconds. Default value is 10ms.
+Allowed frame durations are 2.5ms, 5ms, 7.5ms and 10ms.
+LC3 (Bluetooth LE Audio), allows 7.5ms and 10ms; and LC3plus 2.5ms, 5ms
+and 10ms.
+
+The 10ms frame duration is available in LC3 and LC3 plus standard.
+In this mode, the produced bitstream can be referenced either as LC3 or 
LC3plus.
+
+@item high_resolution @var{boolean}
+Enable the high-resolution mode if set to 1. The high-resolution mode is
+available with all LC3plus frame durations and for a sampling rate of 48 KHz,
+and 96 KHz.
+
+The encoder automatically turns off this mode at lower sampling rates and
+activates it at 96 KHz.
+
+This mode should be preferred at high bitrates. In this