avfilter: add SOFAlizer audio filter

Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
Paul B Mahol 2015-12-09 13:40:03 +01:00
parent 69e80d6ce4
commit 0a19538bcf
9 changed files with 1069 additions and 1 deletions

View File

@ -44,6 +44,7 @@ version <next>:
- mips32r5 option has been removed
- mips64r6 option has been removed
- DXVA2-accelerated VP9 decoding
- SOFAlizer: virtual binaural acoustics filter
version 2.8:

4
configure vendored
View File

@ -279,6 +279,7 @@ External library support:
--disable-lzma disable lzma [autodetect]
--enable-decklink enable Blackmagic DeckLink I/O support [no]
--enable-mmal enable decoding via MMAL [no]
--enable-netcdf enable NetCDF, needed for sofalizer filter [no]
--enable-nvenc enable NVIDIA NVENC support [no]
--enable-openal enable OpenAL 1.1 capture support [no]
--enable-opencl enable OpenCL code
@ -1503,6 +1504,7 @@ EXTERNAL_LIBRARY_LIST="
libzvbi
lzma
mmal
netcdf
nvenc
openal
opencl
@ -2890,6 +2892,7 @@ showfreqs_filter_deps="avcodec"
showfreqs_filter_select="fft"
showspectrum_filter_deps="avcodec"
showspectrum_filter_select="rdft"
sofalizer_filter_deps="netcdf"
spp_filter_deps="gpl avcodec"
spp_filter_select="fft idctdsp fdctdsp me_cmp pixblockdsp"
stereo3d_filter_deps="gpl"
@ -5494,6 +5497,7 @@ enabled mmal && { check_lib interface/mmal/mmal.h mmal_port_connect
check_lib interface/mmal/mmal.h mmal_port_connect ; }
check_lib interface/mmal/mmal.h mmal_port_connect ; } ||
die "ERROR: mmal not found"; }
enabled netcdf && require_pkg_config netcdf netcdf.h nc_inq_libvers
enabled nvenc && { check_header nvEncodeAPI.h || die "ERROR: nvEncodeAPI.h not found."; } &&
{ check_cpp_condition nvEncodeAPI.h "NVENCAPI_MAJOR_VERSION >= 5" ||
die "ERROR: NVENC API version 4 or older is not supported"; } &&

View File

@ -2889,6 +2889,35 @@ silenceremove=1:5:0.02
@end example
@end itemize
@section sofalizer
SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
loudspeakers around the user for binaural listening via headphones (audio
formats up to 9 channels supported).
The HRTFs are stored in SOFA files (see www.sofacoustics.org for a database).
SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
Austrian Academy of Sciences.
The filter accepts the following options:
@table @option
@item sofa
Set the SOFA file used for rendering.
@item gain
Set gain applied to audio. Value is in dB. Default is 0.
@item rotation
Set rotation of virtual loudspeakers in deg. Default is 0.
@item elevation
Set elevation of virtual speakers in deg. Default is 0.
@item radius
Set distance in meters between loudspeakers and the listener with near-field
HRTFs. Default is 1.
@end table
@section stereotools
This filter has some handy utilities to manage stereo signals, for converting

View File

@ -87,6 +87,7 @@ OBJS-$(CONFIG_SIDECHAINCOMPRESS_FILTER) += af_sidechaincompress.o
OBJS-$(CONFIG_SIDECHAINGATE_FILTER) += af_agate.o
OBJS-$(CONFIG_SILENCEDETECT_FILTER) += af_silencedetect.o
OBJS-$(CONFIG_SILENCEREMOVE_FILTER) += af_silenceremove.o
OBJS-$(CONFIG_SOFALIZER_FILTER) += af_sofalizer.o
OBJS-$(CONFIG_STEREOTOOLS_FILTER) += af_stereotools.o
OBJS-$(CONFIG_STEREOWIDEN_FILTER) += af_stereowiden.o
OBJS-$(CONFIG_TREBLE_FILTER) += af_biquads.o

1018
libavfilter/af_sofalizer.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -109,6 +109,7 @@ void avfilter_register_all(void)
REGISTER_FILTER(SIDECHAINGATE, sidechaingate, af);
REGISTER_FILTER(SILENCEDETECT, silencedetect, af);
REGISTER_FILTER(SILENCEREMOVE, silenceremove, af);
REGISTER_FILTER(SOFALIZER, sofalizer, af);
REGISTER_FILTER(STEREOTOOLS, stereotools, af);
REGISTER_FILTER(STEREOWIDEN, stereowiden, af);
REGISTER_FILTER(TREBLE, treble, af);

View File

@ -289,6 +289,17 @@ AVFilterFormats *ff_make_format_list(const int *fmts)
return formats;
}
AVFilterChannelLayouts *ff_make_formatu64_list(const uint64_t *fmts)
{
MAKE_FORMAT_LIST(AVFilterChannelLayouts,
channel_layouts, nb_channel_layouts);
if (count)
memcpy(formats->channel_layouts, fmts,
sizeof(*formats->channel_layouts) * count);
return formats;
}
AVFilterChannelLayouts *avfilter_make_format64_list(const int64_t *fmts)
{
MAKE_FORMAT_LIST(AVFilterChannelLayouts,

View File

@ -141,6 +141,9 @@ AVFilterChannelLayouts *ff_all_channel_counts(void);
av_warn_unused_result
AVFilterChannelLayouts *avfilter_make_format64_list(const int64_t *fmts);
av_warn_unused_result
AVFilterChannelLayouts *ff_make_formatu64_list(const uint64_t *fmts);
/**
* A helper for query_formats() which sets all links to the same list of channel

View File

@ -30,7 +30,7 @@
#include "libavutil/version.h"
#define LIBAVFILTER_VERSION_MAJOR 6
#define LIBAVFILTER_VERSION_MINOR 20
#define LIBAVFILTER_VERSION_MINOR 21
#define LIBAVFILTER_VERSION_MICRO 100
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \