From 7518118a21503980c188b923f3ad10f726fd2731 Mon Sep 17 00:00:00 2001 From: Michael Goffioul Date: Thu, 3 Jun 2021 22:23:48 -0400 Subject: [PATCH] Enable compilation of deinterlace and scale filters These are used to implement deinterlacing in FFMPEG codecs. Both yadif and VA-API filters are enabled, to allow both sw-only and hw-accelerated deinterlacing/scaling. --- android/config-x86-x86.mak | 12 ++++++------ android/config-x86_64-x86_64.mak | 12 ++++++------ android/include/config-x86-x86.h | 4 ++-- android/include/config-x86.asm | 2 +- android/include/config-x86_64-x86_64.h | 4 ++-- android/include/config-x86_64.asm | 2 +- android/include/config_components.h | 8 ++++---- android/include/libavfilter/filter_list.c | 10 ++++++++++ libavfilter/Android.mk | 22 ++++++++++++++++++++++ 9 files changed, 54 insertions(+), 22 deletions(-) create mode 100644 android/include/libavfilter/filter_list.c create mode 100644 libavfilter/Android.mk diff --git a/android/config-x86-x86.mak b/android/config-x86-x86.mak index 7ae4e397a5..0941c718ca 100644 --- a/android/config-x86-x86.mak +++ b/android/config-x86-x86.mak @@ -1,6 +1,6 @@ CONFIG_ANDROID=yes avdevice_FFLIBS=avformat avcodec swresample avutil -avfilter_FFLIBS=avutil +avfilter_FFLIBS=swscale avutil swscale_FFLIBS=avutil postproc_FFLIBS=avutil avformat_FFLIBS=avcodec swresample avutil @@ -643,7 +643,7 @@ CONFIG_HWACCELS=yes CONFIG_PARSERS=yes !CONFIG_INDEVS=yes !CONFIG_OUTDEVS=yes -!CONFIG_FILTERS=yes +CONFIG_FILTERS=yes CONFIG_DEMUXERS=yes CONFIG_MUXERS=yes CONFIG_PROTOCOLS=yes @@ -1940,7 +1940,7 @@ CONFIG_XMA_PARSER=yes !CONFIG_DEFLATE_FILTER=yes !CONFIG_DEFLICKER_FILTER=yes !CONFIG_DEINTERLACE_QSV_FILTER=yes -!CONFIG_DEINTERLACE_VAAPI_FILTER=yes +CONFIG_DEINTERLACE_VAAPI_FILTER=yes !CONFIG_DEJUDDER_FILTER=yes !CONFIG_DELOGO_FILTER=yes !CONFIG_DENOISE_VAAPI_FILTER=yes @@ -2116,11 +2116,11 @@ CONFIG_XMA_PARSER=yes !CONFIG_ROBERTS_OPENCL_FILTER=yes !CONFIG_ROTATE_FILTER=yes !CONFIG_SAB_FILTER=yes -!CONFIG_SCALE_FILTER=yes +CONFIG_SCALE_FILTER=yes !CONFIG_SCALE_CUDA_FILTER=yes !CONFIG_SCALE_NPP_FILTER=yes !CONFIG_SCALE_QSV_FILTER=yes -!CONFIG_SCALE_VAAPI_FILTER=yes +CONFIG_SCALE_VAAPI_FILTER=yes !CONFIG_SCALE_VULKAN_FILTER=yes !CONFIG_SCALE2REF_FILTER=yes !CONFIG_SCALE2REF_NPP_FILTER=yes @@ -2215,7 +2215,7 @@ CONFIG_XMA_PARSER=yes !CONFIG_XFADE_OPENCL_FILTER=yes !CONFIG_XMEDIAN_FILTER=yes !CONFIG_XSTACK_FILTER=yes -!CONFIG_YADIF_FILTER=yes +CONFIG_YADIF_FILTER=yes !CONFIG_YADIF_CUDA_FILTER=yes !CONFIG_YADIF_VIDEOTOOLBOX_FILTER=yes !CONFIG_YAEPBLUR_FILTER=yes diff --git a/android/config-x86_64-x86_64.mak b/android/config-x86_64-x86_64.mak index 975ec04076..91215bb668 100644 --- a/android/config-x86_64-x86_64.mak +++ b/android/config-x86_64-x86_64.mak @@ -1,6 +1,6 @@ CONFIG_ANDROID=yes avdevice_FFLIBS=avformat avcodec swresample avutil -avfilter_FFLIBS=avutil +avfilter_FFLIBS=swscale avutil swscale_FFLIBS=avutil postproc_FFLIBS=avutil avformat_FFLIBS=avcodec swresample avutil @@ -643,7 +643,7 @@ CONFIG_HWACCELS=yes CONFIG_PARSERS=yes !CONFIG_INDEVS=yes !CONFIG_OUTDEVS=yes -!CONFIG_FILTERS=yes +CONFIG_FILTERS=yes CONFIG_DEMUXERS=yes CONFIG_MUXERS=yes CONFIG_PROTOCOLS=yes @@ -1940,7 +1940,7 @@ CONFIG_XMA_PARSER=yes !CONFIG_DEFLATE_FILTER=yes !CONFIG_DEFLICKER_FILTER=yes !CONFIG_DEINTERLACE_QSV_FILTER=yes -!CONFIG_DEINTERLACE_VAAPI_FILTER=yes +CONFIG_DEINTERLACE_VAAPI_FILTER=yes !CONFIG_DEJUDDER_FILTER=yes !CONFIG_DELOGO_FILTER=yes !CONFIG_DENOISE_VAAPI_FILTER=yes @@ -2116,11 +2116,11 @@ CONFIG_XMA_PARSER=yes !CONFIG_ROBERTS_OPENCL_FILTER=yes !CONFIG_ROTATE_FILTER=yes !CONFIG_SAB_FILTER=yes -!CONFIG_SCALE_FILTER=yes +CONFIG_SCALE_FILTER=yes !CONFIG_SCALE_CUDA_FILTER=yes !CONFIG_SCALE_NPP_FILTER=yes !CONFIG_SCALE_QSV_FILTER=yes -!CONFIG_SCALE_VAAPI_FILTER=yes +CONFIG_SCALE_VAAPI_FILTER=yes !CONFIG_SCALE_VULKAN_FILTER=yes !CONFIG_SCALE2REF_FILTER=yes !CONFIG_SCALE2REF_NPP_FILTER=yes @@ -2215,7 +2215,7 @@ CONFIG_XMA_PARSER=yes !CONFIG_XFADE_OPENCL_FILTER=yes !CONFIG_XMEDIAN_FILTER=yes !CONFIG_XSTACK_FILTER=yes -!CONFIG_YADIF_FILTER=yes +CONFIG_YADIF_FILTER=yes !CONFIG_YADIF_CUDA_FILTER=yes !CONFIG_YADIF_VIDEOTOOLBOX_FILTER=yes !CONFIG_YAEPBLUR_FILTER=yes diff --git a/android/include/config-x86-x86.h b/android/include/config-x86-x86.h index ae743c965c..d453b717b2 100644 --- a/android/include/config-x86-x86.h +++ b/android/include/config-x86-x86.h @@ -1,7 +1,7 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -#define FFMPEG_CONFIGURATION "--arch=x86 --cpu=i686 --build_suffix= --cross-prefix=/android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android31- --enable-cross-compile --target-os=android --cc=/android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android31-clang --cxx=/android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android31-clang++ --disable-static --enable-shared --enable-optimizations --disable-doc --disable-symver --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-avdevice --disable-devices --disable-filters --disable-demuxer=srt --disable-demuxer=microdvd --disable-demuxer=jacosub --disable-demuxer=sami --disable-demuxer=realtext --disable-demuxer=dts --disable-demuxer=subviewer --disable-demuxer=subviewer1 --disable-demuxer=pjs --disable-demuxer=vplayer --disable-demuxer=mpl2 --disable-decoder=ass --disable-decoder=srt --disable-decoder=subrip --disable-decoder=microdvd --disable-decoder=jacosub --disable-decoder=sami --disable-decoder=realtext --disable-decoder=movtext --disable-decoder=subviewer --disable-decoder=subviewer1 --disable-decoder=pjs --disable-decoder=vplayer --disable-decoder=mpl2 --disable-v4l2_m2m --disable-txtpages --disable-htmlpages --disable-vulkan --disable-cuda-llvm --enable-zlib --enable-pic --disable-debug --nm=/android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-nm --strip=/android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip --ar=/android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar --ranlib=/android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ranlib --x86asmexe=/android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/yasm" +#define FFMPEG_CONFIGURATION "--arch=x86 --cpu=i686 --build_suffix= --cross-prefix=/home/goffioul/Software/android-sdk-linux/ndk/23.1.7779620//toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android31- --enable-cross-compile --target-os=android --cc=/home/goffioul/Software/android-sdk-linux/ndk/23.1.7779620//toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android31-clang --cxx=/home/goffioul/Software/android-sdk-linux/ndk/23.1.7779620//toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android31-clang++ --disable-static --enable-shared --enable-optimizations --disable-doc --disable-symver --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-avdevice --disable-devices --disable-filters --disable-demuxer=srt --disable-demuxer=microdvd --disable-demuxer=jacosub --disable-demuxer=sami --disable-demuxer=realtext --disable-demuxer=dts --disable-demuxer=subviewer --disable-demuxer=subviewer1 --disable-demuxer=pjs --disable-demuxer=vplayer --disable-demuxer=mpl2 --disable-decoder=ass --disable-decoder=srt --disable-decoder=subrip --disable-decoder=microdvd --disable-decoder=jacosub --disable-decoder=sami --disable-decoder=realtext --disable-decoder=movtext --disable-decoder=subviewer --disable-decoder=subviewer1 --disable-decoder=pjs --disable-decoder=vplayer --disable-decoder=mpl2 --disable-v4l2_m2m --enable-filter=scale --enable-filter=yadif --enable-filter=scale_vaapi --enable-filter=deinterlace_vaapi --enable-zlib --enable-pic --disable-debug --nm=/home/goffioul/Software/android-sdk-linux/ndk/23.1.7779620//toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-nm --strip=/home/goffioul/Software/android-sdk-linux/ndk/23.1.7779620//toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip --ar=/home/goffioul/Software/android-sdk-linux/ndk/23.1.7779620//toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar --ranlib=/home/goffioul/Software/android-sdk-linux/ndk/23.1.7779620//toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ranlib --x86asmexe=/home/goffioul/Software/android-sdk-linux/ndk/23.1.7779620//toolchains/llvm/prebuilt/linux-x86_64/bin/yasm" #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2022 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" @@ -1841,7 +1841,7 @@ #define CONFIG_PARSERS 1 #define CONFIG_INDEVS 0 #define CONFIG_OUTDEVS 0 -#define CONFIG_FILTERS 0 +#define CONFIG_FILTERS 1 #define CONFIG_DEMUXERS 1 #define CONFIG_MUXERS 1 #define CONFIG_PROTOCOLS 1 diff --git a/android/include/config-x86.asm b/android/include/config-x86.asm index f90f46d817..4d78b07ae5 100644 --- a/android/include/config-x86.asm +++ b/android/include/config-x86.asm @@ -622,7 +622,7 @@ %define CONFIG_PARSERS 1 %define CONFIG_INDEVS 0 %define CONFIG_OUTDEVS 0 -%define CONFIG_FILTERS 0 +%define CONFIG_FILTERS 1 %define CONFIG_DEMUXERS 1 %define CONFIG_MUXERS 1 %define CONFIG_PROTOCOLS 1 diff --git a/android/include/config-x86_64-x86_64.h b/android/include/config-x86_64-x86_64.h index f65cf0f06d..34f92a5911 100644 --- a/android/include/config-x86_64-x86_64.h +++ b/android/include/config-x86_64-x86_64.h @@ -1,7 +1,7 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -#define FFMPEG_CONFIGURATION "--arch=x86_64 --cpu=generic --build_suffix= --cross-prefix=/android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android31- --enable-cross-compile --target-os=android --cc=/android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android31-clang --cxx=/android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android31-clang++ --disable-static --enable-shared --enable-optimizations --disable-doc --disable-symver --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-avdevice --disable-devices --disable-filters --disable-demuxer=srt --disable-demuxer=microdvd --disable-demuxer=jacosub --disable-demuxer=sami --disable-demuxer=realtext --disable-demuxer=dts --disable-demuxer=subviewer --disable-demuxer=subviewer1 --disable-demuxer=pjs --disable-demuxer=vplayer --disable-demuxer=mpl2 --disable-decoder=ass --disable-decoder=srt --disable-decoder=subrip --disable-decoder=microdvd --disable-decoder=jacosub --disable-decoder=sami --disable-decoder=realtext --disable-decoder=movtext --disable-decoder=subviewer --disable-decoder=subviewer1 --disable-decoder=pjs --disable-decoder=vplayer --disable-decoder=mpl2 --disable-v4l2_m2m --disable-txtpages --disable-htmlpages --disable-vulkan --disable-cuda-llvm --enable-zlib --enable-pic --disable-debug --nm=/android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-nm --strip=/android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip --ar=/android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar --ranlib=/android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ranlib --x86asmexe=/android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/yasm" +#define FFMPEG_CONFIGURATION "--arch=x86_64 --cpu=generic --build_suffix= --cross-prefix=/home/goffioul/Software/android-sdk-linux/ndk/23.1.7779620//toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android31- --enable-cross-compile --target-os=android --cc=/home/goffioul/Software/android-sdk-linux/ndk/23.1.7779620//toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android31-clang --cxx=/home/goffioul/Software/android-sdk-linux/ndk/23.1.7779620//toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android31-clang++ --disable-static --enable-shared --enable-optimizations --disable-doc --disable-symver --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-avdevice --disable-devices --disable-filters --disable-demuxer=srt --disable-demuxer=microdvd --disable-demuxer=jacosub --disable-demuxer=sami --disable-demuxer=realtext --disable-demuxer=dts --disable-demuxer=subviewer --disable-demuxer=subviewer1 --disable-demuxer=pjs --disable-demuxer=vplayer --disable-demuxer=mpl2 --disable-decoder=ass --disable-decoder=srt --disable-decoder=subrip --disable-decoder=microdvd --disable-decoder=jacosub --disable-decoder=sami --disable-decoder=realtext --disable-decoder=movtext --disable-decoder=subviewer --disable-decoder=subviewer1 --disable-decoder=pjs --disable-decoder=vplayer --disable-decoder=mpl2 --disable-v4l2_m2m --enable-filter=scale --enable-filter=yadif --enable-filter=scale_vaapi --enable-filter=deinterlace_vaapi --enable-zlib --enable-pic --disable-debug --nm=/home/goffioul/Software/android-sdk-linux/ndk/23.1.7779620//toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-nm --strip=/home/goffioul/Software/android-sdk-linux/ndk/23.1.7779620//toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip --ar=/home/goffioul/Software/android-sdk-linux/ndk/23.1.7779620//toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar --ranlib=/home/goffioul/Software/android-sdk-linux/ndk/23.1.7779620//toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ranlib --x86asmexe=/home/goffioul/Software/android-sdk-linux/ndk/23.1.7779620//toolchains/llvm/prebuilt/linux-x86_64/bin/yasm" #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2022 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" @@ -1841,7 +1841,7 @@ #define CONFIG_PARSERS 1 #define CONFIG_INDEVS 0 #define CONFIG_OUTDEVS 0 -#define CONFIG_FILTERS 0 +#define CONFIG_FILTERS 1 #define CONFIG_DEMUXERS 1 #define CONFIG_MUXERS 1 #define CONFIG_PROTOCOLS 1 diff --git a/android/include/config-x86_64.asm b/android/include/config-x86_64.asm index 827afd2634..a399da3102 100644 --- a/android/include/config-x86_64.asm +++ b/android/include/config-x86_64.asm @@ -622,7 +622,7 @@ %define CONFIG_PARSERS 1 %define CONFIG_INDEVS 0 %define CONFIG_OUTDEVS 0 -%define CONFIG_FILTERS 0 +%define CONFIG_FILTERS 1 %define CONFIG_DEMUXERS 1 %define CONFIG_MUXERS 1 %define CONFIG_PROTOCOLS 1 diff --git a/android/include/config_components.h b/android/include/config_components.h index 35366bdbce..1c3d09d329 100644 --- a/android/include/config_components.h +++ b/android/include/config_components.h @@ -1198,7 +1198,7 @@ #define CONFIG_DEFLATE_FILTER 0 #define CONFIG_DEFLICKER_FILTER 0 #define CONFIG_DEINTERLACE_QSV_FILTER 0 -#define CONFIG_DEINTERLACE_VAAPI_FILTER 0 +#define CONFIG_DEINTERLACE_VAAPI_FILTER 1 #define CONFIG_DEJUDDER_FILTER 0 #define CONFIG_DELOGO_FILTER 0 #define CONFIG_DENOISE_VAAPI_FILTER 0 @@ -1374,11 +1374,11 @@ #define CONFIG_ROBERTS_OPENCL_FILTER 0 #define CONFIG_ROTATE_FILTER 0 #define CONFIG_SAB_FILTER 0 -#define CONFIG_SCALE_FILTER 0 +#define CONFIG_SCALE_FILTER 1 #define CONFIG_SCALE_CUDA_FILTER 0 #define CONFIG_SCALE_NPP_FILTER 0 #define CONFIG_SCALE_QSV_FILTER 0 -#define CONFIG_SCALE_VAAPI_FILTER 0 +#define CONFIG_SCALE_VAAPI_FILTER 1 #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCALE2REF_NPP_FILTER 0 @@ -1473,7 +1473,7 @@ #define CONFIG_XFADE_OPENCL_FILTER 0 #define CONFIG_XMEDIAN_FILTER 0 #define CONFIG_XSTACK_FILTER 0 -#define CONFIG_YADIF_FILTER 0 +#define CONFIG_YADIF_FILTER 1 #define CONFIG_YADIF_CUDA_FILTER 0 #define CONFIG_YADIF_VIDEOTOOLBOX_FILTER 0 #define CONFIG_YAEPBLUR_FILTER 0 diff --git a/android/include/libavfilter/filter_list.c b/android/include/libavfilter/filter_list.c new file mode 100644 index 0000000000..b3812cdc8b --- /dev/null +++ b/android/include/libavfilter/filter_list.c @@ -0,0 +1,10 @@ +static const AVFilter * const filter_list[] = { + &ff_vf_deinterlace_vaapi, + &ff_vf_scale, + &ff_vf_scale_vaapi, + &ff_vf_yadif, + &ff_asrc_abuffer, + &ff_vsrc_buffer, + &ff_asink_abuffer, + &ff_vsink_buffer, + NULL }; diff --git a/libavfilter/Android.mk b/libavfilter/Android.mk new file mode 100644 index 0000000000..8241582188 --- /dev/null +++ b/libavfilter/Android.mk @@ -0,0 +1,22 @@ +LOCAL_PATH := $(call my-dir) +SRC_PATH := $(FFMPEG_DIR) + +FFMPEG_MULTILIB := 32 +include $(LOCAL_PATH)/../android/build.mk + +ifeq ($(CONFIG_VAAPI),yes) + LOCAL_SHARED_LIBRARIES += libva +endif + +LOCAL_MULTILIB := $(FFMPEG_MULTILIB) +include $(BUILD_SHARED_LIBRARY) + +FFMPEG_MULTILIB := 64 +include $(LOCAL_PATH)/../android/build.mk + +ifeq ($(CONFIG_VAAPI),yes) + LOCAL_SHARED_LIBRARIES += libva +endif + +LOCAL_MULTILIB := $(FFMPEG_MULTILIB) +include $(BUILD_SHARED_LIBRARY)