diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2022-02-02 12:21:57 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2022-02-12 08:13:00 +0000 |
commit | 606d85f2a5386472314d39923da28c70c60dc8e7 (patch) | |
tree | a8f4d7bf997f349f45605e6058259fba0630e4d7 /chromium/third_party/ffmpeg | |
parent | 5786336dda477d04fb98483dca1a5426eebde2d7 (diff) | |
download | qtwebengine-chromium-606d85f2a5386472314d39923da28c70c60dc8e7.tar.gz |
BASELINE: Update Chromium to 96.0.4664.181
Change-Id: I762cd1da89d73aa6313b4a753fe126c34833f046
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/third_party/ffmpeg')
820 files changed, 16994 insertions, 9132 deletions
diff --git a/chromium/third_party/ffmpeg/Changelog b/chromium/third_party/ffmpeg/Changelog index 10376886827..d0b1a9724e5 100644 --- a/chromium/third_party/ffmpeg/Changelog +++ b/chromium/third_party/ffmpeg/Changelog @@ -9,6 +9,17 @@ version <next>: - Argonaut Games CVG muxer - Concatf protocol - afwtdn audio filter +- audio and video segment filters +- Apple Graphics (SMC) encoder +- hsvkey and hsvhold video filters +- adecorrelate audio filter +- atilt audio filter +- grayworld video filter +- AV1 Low overhead bitstream format muxer +- swscale slice threading +- MSN Siren decoder +- scharr video filter +- apsyclip audio filter version 4.4: diff --git a/chromium/third_party/ffmpeg/Makefile b/chromium/third_party/ffmpeg/Makefile index 1e3da6271b2..26c9107237f 100644 --- a/chromium/third_party/ffmpeg/Makefile +++ b/chromium/third_party/ffmpeg/Makefile @@ -64,6 +64,8 @@ tools/target_io_dem_fuzzer$(EXESUF): tools/target_io_dem_fuzzer.o $(FF_DEP_LIBS) tools/enum_options$(EXESUF): ELIBS = $(FF_EXTRALIBS) tools/enum_options$(EXESUF): $(FF_DEP_LIBS) +tools/scale_slice_test$(EXESUF): $(FF_DEP_LIBS) +tools/scale_slice_test$(EXESUF): ELIBS = $(FF_EXTRALIBS) tools/sofa2wavs$(EXESUF): ELIBS = $(FF_EXTRALIBS) tools/uncoded_frame$(EXESUF): $(FF_DEP_LIBS) tools/uncoded_frame$(EXESUF): ELIBS = $(FF_EXTRALIBS) diff --git a/chromium/third_party/ffmpeg/README.chromium b/chromium/third_party/ffmpeg/README.chromium index edde48adcb1..b599e7ffb50 100644 --- a/chromium/third_party/ffmpeg/README.chromium +++ b/chromium/third_party/ffmpeg/README.chromium @@ -3,7 +3,7 @@ URL: http://ffmpeg.org/ License: LGPL 2.1 License File: CREDITS.chromium Upstream Git: git://source.ffmpeg.org/ffmpeg.git -Last Upstream Merge: b9176dbfb7c209f2adf1f420df74b91df56c1fb3, Jul 30 2021 +Last Upstream Merge: 3dd5a8a13510d08a4e25e8f138d718672a0fed4a, Sep 13 2021 This file documents the layout of the Chromium copy of FFmpeg, some common tasks, and how to create the build files and related configurations. diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/android/arm-neon/config.h b/chromium/third_party/ffmpeg/chromium/config/Chrome/android/arm-neon/config.h index 73a61a9cab5..425a016eb5f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/android/arm-neon/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/android/arm-neon/config.h @@ -1,7 +1,7 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --enable-small --enable-pic --cc=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --cxx=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --ld=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --enable-cross-compile --sysroot=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/arm-linux-androideabi --extra-cflags='--target=arm-linux-androideabi21' --extra-ldflags='--target=arm-linux-androideabi21' --extra-ldflags=-L/tmp/fakelinkerscripts --extra-ldflags=-L/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/arm-linux-androideabi --extra-ldflags='--gcc-toolchain=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/' --target-os=android --arch=arm --enable-armv6 --enable-armv6t2 --enable-vfp --enable-thumb --extra-cflags='-march=armv7-a' --enable-neon --extra-cflags='-mtune=generic-armv7-a' --extra-cflags='-mfloat-abi=softfp' --extra-cflags='-mfpu=neon' --enable-demuxer=aac --enable-parser=aac --enable-decoder=aac" -- elide long configuration string from binary */ +/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --enable-small --enable-pic --cc=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --cxx=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --ld=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --enable-cross-compile --sysroot=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/arm-linux-androideabi --extra-cflags='--target=arm-linux-androideabi21' --extra-ldflags='--target=arm-linux-androideabi21' --extra-ldflags=-L/tmp/fakelinkerscripts --extra-ldflags=-L/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/arm-linux-androideabi --extra-ldflags='--gcc-toolchain=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/' --target-os=android --arch=arm --enable-armv6 --enable-armv6t2 --enable-vfp --enable-thumb --extra-cflags='-march=armv7-a' --enable-neon --extra-cflags='-mtune=generic-armv7-a' --extra-cflags='-mfloat-abi=softfp' --extra-cflags='-mfpu=neon' --enable-demuxer=aac --enable-parser=aac --enable-decoder=aac" -- elide long configuration string from binary */ #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2021 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" @@ -1086,6 +1086,7 @@ #define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 +#define CONFIG_MSNSIREN_DECODER 0 #define CONFIG_NELLYMOSER_DECODER 0 #define CONFIG_ON2AVC_DECODER 0 #define CONFIG_OPUS_DECODER 0 @@ -1355,6 +1356,7 @@ #define CONFIG_RV20_ENCODER 0 #define CONFIG_S302M_ENCODER 0 #define CONFIG_SGI_ENCODER 0 +#define CONFIG_SMC_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_SPEEDHQ_ENCODER 0 #define CONFIG_SUNRAST_ENCODER 0 @@ -1678,6 +1680,7 @@ #define CONFIG_ACRUSHER_FILTER 0 #define CONFIG_ADECLICK_FILTER 0 #define CONFIG_ADECLIP_FILTER 0 +#define CONFIG_ADECORRELATE_FILTER 0 #define CONFIG_ADELAY_FILTER 0 #define CONFIG_ADENORM_FILTER 0 #define CONFIG_ADERIVATIVE_FILTER 0 @@ -1711,11 +1714,13 @@ #define CONFIG_APERMS_FILTER 0 #define CONFIG_APHASER_FILTER 0 #define CONFIG_APHASESHIFT_FILTER 0 +#define CONFIG_APSYCLIP_FILTER 0 #define CONFIG_APULSATOR_FILTER 0 #define CONFIG_AREALTIME_FILTER 0 #define CONFIG_ARESAMPLE_FILTER 0 #define CONFIG_AREVERSE_FILTER 0 #define CONFIG_ARNNDN_FILTER 0 +#define CONFIG_ASEGMENT_FILTER 0 #define CONFIG_ASELECT_FILTER 0 #define CONFIG_ASENDCMD_FILTER 0 #define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1735,6 +1740,7 @@ #define CONFIG_ASUPERPASS_FILTER 0 #define CONFIG_ASUPERSTOP_FILTER 0 #define CONFIG_ATEMPO_FILTER 0 +#define CONFIG_ATILT_FILTER 0 #define CONFIG_ATRIM_FILTER 0 #define CONFIG_AXCORRELATE_FILTER 0 #define CONFIG_AZMQ_FILTER 0 @@ -1913,6 +1919,7 @@ #define CONFIG_GEQ_FILTER 0 #define CONFIG_GRADFUN_FILTER 0 #define CONFIG_GRAPHMONITOR_FILTER 0 +#define CONFIG_GRAYWORLD_FILTER 0 #define CONFIG_GREYEDGE_FILTER 0 #define CONFIG_GUIDED_FILTER 0 #define CONFIG_HALDCLUT_FILTER 0 @@ -1922,6 +1929,8 @@ #define CONFIG_HQDN3D_FILTER 0 #define CONFIG_HQX_FILTER 0 #define CONFIG_HSTACK_FILTER 0 +#define CONFIG_HSVHOLD_FILTER 0 +#define CONFIG_HSVKEY_FILTER 0 #define CONFIG_HUE_FILTER 0 #define CONFIG_HWDOWNLOAD_FILTER 0 #define CONFIG_HWMAP_FILTER 0 @@ -2026,7 +2035,9 @@ #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCDET_FILTER 0 +#define CONFIG_SCHARR_FILTER 0 #define CONFIG_SCROLL_FILTER 0 +#define CONFIG_SEGMENT_FILTER 0 #define CONFIG_SELECT_FILTER 0 #define CONFIG_SELECTIVECOLOR_FILTER 0 #define CONFIG_SENDCMD_FILTER 0 @@ -2587,6 +2598,7 @@ #define CONFIG_MXF_OPATOM_MUXER 0 #define CONFIG_NULL_MUXER 0 #define CONFIG_NUT_MUXER 0 +#define CONFIG_OBU_MUXER 0 #define CONFIG_OGA_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/android/arm-neon/libavutil/ffversion.h b/chromium/third_party/ffmpeg/chromium/config/Chrome/android/arm-neon/libavutil/ffversion.h index d4ce7a4e6a7..f26e152f83f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/android/arm-neon/libavutil/ffversion.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/android/arm-neon/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "N-104195-g628f528751" +#define FFMPEG_VERSION "N-104707-g392d8a2d60" #endif /* AVUTIL_FFVERSION_H */ diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/android/arm64/config.h b/chromium/third_party/ffmpeg/chromium/config/Chrome/android/arm64/config.h index 0777d2ba6dd..93162258937 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/android/arm64/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/android/arm64/config.h @@ -1,7 +1,7 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --enable-small --enable-pic --cc=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --cxx=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --ld=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --enable-cross-compile --sysroot=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/aarch64-linux-android --extra-cflags='--target=aarch64-linux-android21' --extra-ldflags='--target=aarch64-linux-android21' --extra-ldflags=-L/tmp/fakelinkerscripts --extra-ldflags=-L/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/aarch64-linux-android --extra-ldflags='--gcc-toolchain=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/' --target-os=android --arch=aarch64 --enable-armv8 --extra-cflags='-march=armv8-a' --enable-demuxer=aac --enable-parser=aac --enable-decoder=aac" -- elide long configuration string from binary */ +/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --enable-small --enable-pic --cc=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --cxx=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --ld=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --enable-cross-compile --sysroot=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/aarch64-linux-android --extra-cflags='--target=aarch64-linux-android21' --extra-ldflags='--target=aarch64-linux-android21' --extra-ldflags=-L/tmp/fakelinkerscripts --extra-ldflags=-L/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/aarch64-linux-android --extra-ldflags='--gcc-toolchain=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/' --target-os=android --arch=aarch64 --enable-armv8 --extra-cflags='-march=armv8-a' --enable-demuxer=aac --enable-parser=aac --enable-decoder=aac" -- elide long configuration string from binary */ #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2021 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" @@ -1086,6 +1086,7 @@ #define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 +#define CONFIG_MSNSIREN_DECODER 0 #define CONFIG_NELLYMOSER_DECODER 0 #define CONFIG_ON2AVC_DECODER 0 #define CONFIG_OPUS_DECODER 0 @@ -1355,6 +1356,7 @@ #define CONFIG_RV20_ENCODER 0 #define CONFIG_S302M_ENCODER 0 #define CONFIG_SGI_ENCODER 0 +#define CONFIG_SMC_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_SPEEDHQ_ENCODER 0 #define CONFIG_SUNRAST_ENCODER 0 @@ -1678,6 +1680,7 @@ #define CONFIG_ACRUSHER_FILTER 0 #define CONFIG_ADECLICK_FILTER 0 #define CONFIG_ADECLIP_FILTER 0 +#define CONFIG_ADECORRELATE_FILTER 0 #define CONFIG_ADELAY_FILTER 0 #define CONFIG_ADENORM_FILTER 0 #define CONFIG_ADERIVATIVE_FILTER 0 @@ -1711,11 +1714,13 @@ #define CONFIG_APERMS_FILTER 0 #define CONFIG_APHASER_FILTER 0 #define CONFIG_APHASESHIFT_FILTER 0 +#define CONFIG_APSYCLIP_FILTER 0 #define CONFIG_APULSATOR_FILTER 0 #define CONFIG_AREALTIME_FILTER 0 #define CONFIG_ARESAMPLE_FILTER 0 #define CONFIG_AREVERSE_FILTER 0 #define CONFIG_ARNNDN_FILTER 0 +#define CONFIG_ASEGMENT_FILTER 0 #define CONFIG_ASELECT_FILTER 0 #define CONFIG_ASENDCMD_FILTER 0 #define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1735,6 +1740,7 @@ #define CONFIG_ASUPERPASS_FILTER 0 #define CONFIG_ASUPERSTOP_FILTER 0 #define CONFIG_ATEMPO_FILTER 0 +#define CONFIG_ATILT_FILTER 0 #define CONFIG_ATRIM_FILTER 0 #define CONFIG_AXCORRELATE_FILTER 0 #define CONFIG_AZMQ_FILTER 0 @@ -1913,6 +1919,7 @@ #define CONFIG_GEQ_FILTER 0 #define CONFIG_GRADFUN_FILTER 0 #define CONFIG_GRAPHMONITOR_FILTER 0 +#define CONFIG_GRAYWORLD_FILTER 0 #define CONFIG_GREYEDGE_FILTER 0 #define CONFIG_GUIDED_FILTER 0 #define CONFIG_HALDCLUT_FILTER 0 @@ -1922,6 +1929,8 @@ #define CONFIG_HQDN3D_FILTER 0 #define CONFIG_HQX_FILTER 0 #define CONFIG_HSTACK_FILTER 0 +#define CONFIG_HSVHOLD_FILTER 0 +#define CONFIG_HSVKEY_FILTER 0 #define CONFIG_HUE_FILTER 0 #define CONFIG_HWDOWNLOAD_FILTER 0 #define CONFIG_HWMAP_FILTER 0 @@ -2026,7 +2035,9 @@ #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCDET_FILTER 0 +#define CONFIG_SCHARR_FILTER 0 #define CONFIG_SCROLL_FILTER 0 +#define CONFIG_SEGMENT_FILTER 0 #define CONFIG_SELECT_FILTER 0 #define CONFIG_SELECTIVECOLOR_FILTER 0 #define CONFIG_SENDCMD_FILTER 0 @@ -2587,6 +2598,7 @@ #define CONFIG_MXF_OPATOM_MUXER 0 #define CONFIG_NULL_MUXER 0 #define CONFIG_NUT_MUXER 0 +#define CONFIG_OBU_MUXER 0 #define CONFIG_OGA_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/android/arm64/libavutil/ffversion.h b/chromium/third_party/ffmpeg/chromium/config/Chrome/android/arm64/libavutil/ffversion.h index d4ce7a4e6a7..f26e152f83f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/android/arm64/libavutil/ffversion.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/android/arm64/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "N-104195-g628f528751" +#define FFMPEG_VERSION "N-104707-g392d8a2d60" #endif /* AVUTIL_FFVERSION_H */ diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/android/ia32/config.h b/chromium/third_party/ffmpeg/chromium/config/Chrome/android/ia32/config.h index 2ec4f5dc8ef..7545539cbe6 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/android/ia32/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/android/ia32/config.h @@ -1,7 +1,7 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --enable-small --enable-pic --cc=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --cxx=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --ld=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --enable-cross-compile --sysroot=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/i686-linux-android --extra-cflags='--target=i686-linux-android21' --extra-ldflags='--target=i686-linux-android21' --extra-ldflags=-L/tmp/fakelinkerscripts --extra-ldflags=-L/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/i686-linux-android --extra-ldflags='--gcc-toolchain=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/' --target-os=android --arch=i686 --extra-cflags='\"-m32\"' --extra-ldflags='\"-m32\"' --disable-x86asm --enable-demuxer=aac --enable-parser=aac --enable-decoder=aac" -- elide long configuration string from binary */ +/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --enable-small --enable-pic --cc=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --cxx=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --ld=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --enable-cross-compile --sysroot=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/i686-linux-android --extra-cflags='--target=i686-linux-android21' --extra-ldflags='--target=i686-linux-android21' --extra-ldflags=-L/tmp/fakelinkerscripts --extra-ldflags=-L/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/i686-linux-android --extra-ldflags='--gcc-toolchain=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/' --target-os=android --arch=i686 --extra-cflags='\"-m32\"' --extra-ldflags='\"-m32\"' --disable-x86asm --enable-demuxer=aac --enable-parser=aac --enable-decoder=aac" -- elide long configuration string from binary */ #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2021 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" @@ -1086,6 +1086,7 @@ #define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 +#define CONFIG_MSNSIREN_DECODER 0 #define CONFIG_NELLYMOSER_DECODER 0 #define CONFIG_ON2AVC_DECODER 0 #define CONFIG_OPUS_DECODER 0 @@ -1355,6 +1356,7 @@ #define CONFIG_RV20_ENCODER 0 #define CONFIG_S302M_ENCODER 0 #define CONFIG_SGI_ENCODER 0 +#define CONFIG_SMC_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_SPEEDHQ_ENCODER 0 #define CONFIG_SUNRAST_ENCODER 0 @@ -1678,6 +1680,7 @@ #define CONFIG_ACRUSHER_FILTER 0 #define CONFIG_ADECLICK_FILTER 0 #define CONFIG_ADECLIP_FILTER 0 +#define CONFIG_ADECORRELATE_FILTER 0 #define CONFIG_ADELAY_FILTER 0 #define CONFIG_ADENORM_FILTER 0 #define CONFIG_ADERIVATIVE_FILTER 0 @@ -1711,11 +1714,13 @@ #define CONFIG_APERMS_FILTER 0 #define CONFIG_APHASER_FILTER 0 #define CONFIG_APHASESHIFT_FILTER 0 +#define CONFIG_APSYCLIP_FILTER 0 #define CONFIG_APULSATOR_FILTER 0 #define CONFIG_AREALTIME_FILTER 0 #define CONFIG_ARESAMPLE_FILTER 0 #define CONFIG_AREVERSE_FILTER 0 #define CONFIG_ARNNDN_FILTER 0 +#define CONFIG_ASEGMENT_FILTER 0 #define CONFIG_ASELECT_FILTER 0 #define CONFIG_ASENDCMD_FILTER 0 #define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1735,6 +1740,7 @@ #define CONFIG_ASUPERPASS_FILTER 0 #define CONFIG_ASUPERSTOP_FILTER 0 #define CONFIG_ATEMPO_FILTER 0 +#define CONFIG_ATILT_FILTER 0 #define CONFIG_ATRIM_FILTER 0 #define CONFIG_AXCORRELATE_FILTER 0 #define CONFIG_AZMQ_FILTER 0 @@ -1913,6 +1919,7 @@ #define CONFIG_GEQ_FILTER 0 #define CONFIG_GRADFUN_FILTER 0 #define CONFIG_GRAPHMONITOR_FILTER 0 +#define CONFIG_GRAYWORLD_FILTER 0 #define CONFIG_GREYEDGE_FILTER 0 #define CONFIG_GUIDED_FILTER 0 #define CONFIG_HALDCLUT_FILTER 0 @@ -1922,6 +1929,8 @@ #define CONFIG_HQDN3D_FILTER 0 #define CONFIG_HQX_FILTER 0 #define CONFIG_HSTACK_FILTER 0 +#define CONFIG_HSVHOLD_FILTER 0 +#define CONFIG_HSVKEY_FILTER 0 #define CONFIG_HUE_FILTER 0 #define CONFIG_HWDOWNLOAD_FILTER 0 #define CONFIG_HWMAP_FILTER 0 @@ -2026,7 +2035,9 @@ #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCDET_FILTER 0 +#define CONFIG_SCHARR_FILTER 0 #define CONFIG_SCROLL_FILTER 0 +#define CONFIG_SEGMENT_FILTER 0 #define CONFIG_SELECT_FILTER 0 #define CONFIG_SELECTIVECOLOR_FILTER 0 #define CONFIG_SENDCMD_FILTER 0 @@ -2587,6 +2598,7 @@ #define CONFIG_MXF_OPATOM_MUXER 0 #define CONFIG_NULL_MUXER 0 #define CONFIG_NUT_MUXER 0 +#define CONFIG_OBU_MUXER 0 #define CONFIG_OGA_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/android/ia32/libavutil/ffversion.h b/chromium/third_party/ffmpeg/chromium/config/Chrome/android/ia32/libavutil/ffversion.h index d4ce7a4e6a7..f26e152f83f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/android/ia32/libavutil/ffversion.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/android/ia32/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "N-104195-g628f528751" +#define FFMPEG_VERSION "N-104707-g392d8a2d60" #endif /* AVUTIL_FFVERSION_H */ diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/android/x64/config.asm b/chromium/third_party/ffmpeg/chromium/config/Chrome/android/x64/config.asm index 56678149aac..87677c649f1 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/android/x64/config.asm +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/android/x64/config.asm @@ -1070,6 +1070,7 @@ %define CONFIG_MP3ON4_DECODER 0 %define CONFIG_MPC7_DECODER 0 %define CONFIG_MPC8_DECODER 0 +%define CONFIG_MSNSIREN_DECODER 0 %define CONFIG_NELLYMOSER_DECODER 0 %define CONFIG_ON2AVC_DECODER 0 %define CONFIG_OPUS_DECODER 0 @@ -1339,6 +1340,7 @@ %define CONFIG_RV20_ENCODER 0 %define CONFIG_S302M_ENCODER 0 %define CONFIG_SGI_ENCODER 0 +%define CONFIG_SMC_ENCODER 0 %define CONFIG_SNOW_ENCODER 0 %define CONFIG_SPEEDHQ_ENCODER 0 %define CONFIG_SUNRAST_ENCODER 0 @@ -1662,6 +1664,7 @@ %define CONFIG_ACRUSHER_FILTER 0 %define CONFIG_ADECLICK_FILTER 0 %define CONFIG_ADECLIP_FILTER 0 +%define CONFIG_ADECORRELATE_FILTER 0 %define CONFIG_ADELAY_FILTER 0 %define CONFIG_ADENORM_FILTER 0 %define CONFIG_ADERIVATIVE_FILTER 0 @@ -1695,11 +1698,13 @@ %define CONFIG_APERMS_FILTER 0 %define CONFIG_APHASER_FILTER 0 %define CONFIG_APHASESHIFT_FILTER 0 +%define CONFIG_APSYCLIP_FILTER 0 %define CONFIG_APULSATOR_FILTER 0 %define CONFIG_AREALTIME_FILTER 0 %define CONFIG_ARESAMPLE_FILTER 0 %define CONFIG_AREVERSE_FILTER 0 %define CONFIG_ARNNDN_FILTER 0 +%define CONFIG_ASEGMENT_FILTER 0 %define CONFIG_ASELECT_FILTER 0 %define CONFIG_ASENDCMD_FILTER 0 %define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1719,6 +1724,7 @@ %define CONFIG_ASUPERPASS_FILTER 0 %define CONFIG_ASUPERSTOP_FILTER 0 %define CONFIG_ATEMPO_FILTER 0 +%define CONFIG_ATILT_FILTER 0 %define CONFIG_ATRIM_FILTER 0 %define CONFIG_AXCORRELATE_FILTER 0 %define CONFIG_AZMQ_FILTER 0 @@ -1897,6 +1903,7 @@ %define CONFIG_GEQ_FILTER 0 %define CONFIG_GRADFUN_FILTER 0 %define CONFIG_GRAPHMONITOR_FILTER 0 +%define CONFIG_GRAYWORLD_FILTER 0 %define CONFIG_GREYEDGE_FILTER 0 %define CONFIG_GUIDED_FILTER 0 %define CONFIG_HALDCLUT_FILTER 0 @@ -1906,6 +1913,8 @@ %define CONFIG_HQDN3D_FILTER 0 %define CONFIG_HQX_FILTER 0 %define CONFIG_HSTACK_FILTER 0 +%define CONFIG_HSVHOLD_FILTER 0 +%define CONFIG_HSVKEY_FILTER 0 %define CONFIG_HUE_FILTER 0 %define CONFIG_HWDOWNLOAD_FILTER 0 %define CONFIG_HWMAP_FILTER 0 @@ -2010,7 +2019,9 @@ %define CONFIG_SCALE_VULKAN_FILTER 0 %define CONFIG_SCALE2REF_FILTER 0 %define CONFIG_SCDET_FILTER 0 +%define CONFIG_SCHARR_FILTER 0 %define CONFIG_SCROLL_FILTER 0 +%define CONFIG_SEGMENT_FILTER 0 %define CONFIG_SELECT_FILTER 0 %define CONFIG_SELECTIVECOLOR_FILTER 0 %define CONFIG_SENDCMD_FILTER 0 @@ -2571,6 +2582,7 @@ %define CONFIG_MXF_OPATOM_MUXER 0 %define CONFIG_NULL_MUXER 0 %define CONFIG_NUT_MUXER 0 +%define CONFIG_OBU_MUXER 0 %define CONFIG_OGA_MUXER 0 %define CONFIG_OGG_MUXER 0 %define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/android/x64/config.h b/chromium/third_party/ffmpeg/chromium/config/Chrome/android/x64/config.h index 662d4bc44fe..05297401c3e 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/android/x64/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/android/x64/config.h @@ -1,7 +1,7 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --enable-small --enable-pic --cc=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --cxx=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --ld=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --enable-cross-compile --sysroot=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/x86_64-linux-android --extra-cflags='--target=x86_64-linux-android21' --extra-ldflags='--target=x86_64-linux-android21' --extra-ldflags=-L/tmp/fakelinkerscripts --extra-ldflags=-L/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/x86_64-linux-android --extra-ldflags='--gcc-toolchain=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/' --target-os=android --arch=x86_64 --enable-demuxer=aac --enable-parser=aac --enable-decoder=aac" -- elide long configuration string from binary */ +/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --enable-small --enable-pic --cc=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --cxx=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --ld=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --enable-cross-compile --sysroot=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/x86_64-linux-android --extra-cflags='--target=x86_64-linux-android21' --extra-ldflags='--target=x86_64-linux-android21' --extra-ldflags=-L/tmp/fakelinkerscripts --extra-ldflags=-L/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/x86_64-linux-android --extra-ldflags='--gcc-toolchain=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/' --target-os=android --arch=x86_64 --enable-demuxer=aac --enable-parser=aac --enable-decoder=aac" -- elide long configuration string from binary */ #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2021 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" @@ -1086,6 +1086,7 @@ #define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 +#define CONFIG_MSNSIREN_DECODER 0 #define CONFIG_NELLYMOSER_DECODER 0 #define CONFIG_ON2AVC_DECODER 0 #define CONFIG_OPUS_DECODER 0 @@ -1355,6 +1356,7 @@ #define CONFIG_RV20_ENCODER 0 #define CONFIG_S302M_ENCODER 0 #define CONFIG_SGI_ENCODER 0 +#define CONFIG_SMC_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_SPEEDHQ_ENCODER 0 #define CONFIG_SUNRAST_ENCODER 0 @@ -1678,6 +1680,7 @@ #define CONFIG_ACRUSHER_FILTER 0 #define CONFIG_ADECLICK_FILTER 0 #define CONFIG_ADECLIP_FILTER 0 +#define CONFIG_ADECORRELATE_FILTER 0 #define CONFIG_ADELAY_FILTER 0 #define CONFIG_ADENORM_FILTER 0 #define CONFIG_ADERIVATIVE_FILTER 0 @@ -1711,11 +1714,13 @@ #define CONFIG_APERMS_FILTER 0 #define CONFIG_APHASER_FILTER 0 #define CONFIG_APHASESHIFT_FILTER 0 +#define CONFIG_APSYCLIP_FILTER 0 #define CONFIG_APULSATOR_FILTER 0 #define CONFIG_AREALTIME_FILTER 0 #define CONFIG_ARESAMPLE_FILTER 0 #define CONFIG_AREVERSE_FILTER 0 #define CONFIG_ARNNDN_FILTER 0 +#define CONFIG_ASEGMENT_FILTER 0 #define CONFIG_ASELECT_FILTER 0 #define CONFIG_ASENDCMD_FILTER 0 #define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1735,6 +1740,7 @@ #define CONFIG_ASUPERPASS_FILTER 0 #define CONFIG_ASUPERSTOP_FILTER 0 #define CONFIG_ATEMPO_FILTER 0 +#define CONFIG_ATILT_FILTER 0 #define CONFIG_ATRIM_FILTER 0 #define CONFIG_AXCORRELATE_FILTER 0 #define CONFIG_AZMQ_FILTER 0 @@ -1913,6 +1919,7 @@ #define CONFIG_GEQ_FILTER 0 #define CONFIG_GRADFUN_FILTER 0 #define CONFIG_GRAPHMONITOR_FILTER 0 +#define CONFIG_GRAYWORLD_FILTER 0 #define CONFIG_GREYEDGE_FILTER 0 #define CONFIG_GUIDED_FILTER 0 #define CONFIG_HALDCLUT_FILTER 0 @@ -1922,6 +1929,8 @@ #define CONFIG_HQDN3D_FILTER 0 #define CONFIG_HQX_FILTER 0 #define CONFIG_HSTACK_FILTER 0 +#define CONFIG_HSVHOLD_FILTER 0 +#define CONFIG_HSVKEY_FILTER 0 #define CONFIG_HUE_FILTER 0 #define CONFIG_HWDOWNLOAD_FILTER 0 #define CONFIG_HWMAP_FILTER 0 @@ -2026,7 +2035,9 @@ #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCDET_FILTER 0 +#define CONFIG_SCHARR_FILTER 0 #define CONFIG_SCROLL_FILTER 0 +#define CONFIG_SEGMENT_FILTER 0 #define CONFIG_SELECT_FILTER 0 #define CONFIG_SELECTIVECOLOR_FILTER 0 #define CONFIG_SENDCMD_FILTER 0 @@ -2587,6 +2598,7 @@ #define CONFIG_MXF_OPATOM_MUXER 0 #define CONFIG_NULL_MUXER 0 #define CONFIG_NUT_MUXER 0 +#define CONFIG_OBU_MUXER 0 #define CONFIG_OGA_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/android/x64/libavutil/ffversion.h b/chromium/third_party/ffmpeg/chromium/config/Chrome/android/x64/libavutil/ffversion.h index d4ce7a4e6a7..f26e152f83f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/android/x64/libavutil/ffversion.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/android/x64/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "N-104195-g628f528751" +#define FFMPEG_VERSION "N-104707-g392d8a2d60" #endif /* AVUTIL_FFVERSION_H */ diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/linux-noasm/x64/config.h b/chromium/third_party/ffmpeg/chromium/config/Chrome/linux-noasm/x64/config.h index 94c795c0637..6130ba863e9 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/linux-noasm/x64/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/linux-noasm/x64/config.h @@ -1,12 +1,12 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --enable-lto --disable-asm --disable-inline-asm --enable-pic --cc=clang --cxx=clang++ --ld=clang --extra-ldflags='-fuse-ld=lld' --enable-decoder='aac,h264' --enable-demuxer=aac --enable-parser='aac,h264'" -- elide long configuration string from binary */ +/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --enable-lto --disable-asm --disable-inline-asm --enable-pic --cc=clang --cxx=clang++ --ld=clang --extra-ldflags='-fuse-ld=lld' --enable-decoder='aac,h264' --enable-demuxer=aac --enable-parser='aac,h264'" -- elide long configuration string from binary */ #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2021 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" #define AVCONV_DATADIR "/usr/local/share/ffmpeg" -#define CC_IDENT "clang version 13.0.0 (https://github.com/llvm/llvm-project/ f98ed74f6910f8b09e77497aeb30c860c433610d)" +#define CC_IDENT "clang version 14.0.0 (https://github.com/llvm/llvm-project/ 0e03450ae4358e8a8242b73d493d96efea9d3ccf)" #define OS_NAME linux #define av_restrict restrict #define EXTERN_PREFIX "" @@ -232,7 +232,7 @@ #define HAVE_TERMIOS_H 1 #define HAVE_UDPLITE_H 0 #define HAVE_UNISTD_H 1 -#define HAVE_VALGRIND_VALGRIND_H 0 /* #define HAVE_VALGRIND_VALGRIND_H 1 -- forced to 0. See https://crbug.com/590440 */ +#define HAVE_VALGRIND_VALGRIND_H 0 /* #define HAVE_VALGRIND_VALGRIND_H 0 -- forced to 0. See https://crbug.com/590440 */ #define HAVE_WINDOWS_H 0 #define HAVE_WINSOCK2_H 0 #define HAVE_INTRINSICS_NEON 0 @@ -1086,6 +1086,7 @@ #define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 +#define CONFIG_MSNSIREN_DECODER 0 #define CONFIG_NELLYMOSER_DECODER 0 #define CONFIG_ON2AVC_DECODER 0 #define CONFIG_OPUS_DECODER 0 @@ -1355,6 +1356,7 @@ #define CONFIG_RV20_ENCODER 0 #define CONFIG_S302M_ENCODER 0 #define CONFIG_SGI_ENCODER 0 +#define CONFIG_SMC_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_SPEEDHQ_ENCODER 0 #define CONFIG_SUNRAST_ENCODER 0 @@ -1678,6 +1680,7 @@ #define CONFIG_ACRUSHER_FILTER 0 #define CONFIG_ADECLICK_FILTER 0 #define CONFIG_ADECLIP_FILTER 0 +#define CONFIG_ADECORRELATE_FILTER 0 #define CONFIG_ADELAY_FILTER 0 #define CONFIG_ADENORM_FILTER 0 #define CONFIG_ADERIVATIVE_FILTER 0 @@ -1711,11 +1714,13 @@ #define CONFIG_APERMS_FILTER 0 #define CONFIG_APHASER_FILTER 0 #define CONFIG_APHASESHIFT_FILTER 0 +#define CONFIG_APSYCLIP_FILTER 0 #define CONFIG_APULSATOR_FILTER 0 #define CONFIG_AREALTIME_FILTER 0 #define CONFIG_ARESAMPLE_FILTER 0 #define CONFIG_AREVERSE_FILTER 0 #define CONFIG_ARNNDN_FILTER 0 +#define CONFIG_ASEGMENT_FILTER 0 #define CONFIG_ASELECT_FILTER 0 #define CONFIG_ASENDCMD_FILTER 0 #define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1735,6 +1740,7 @@ #define CONFIG_ASUPERPASS_FILTER 0 #define CONFIG_ASUPERSTOP_FILTER 0 #define CONFIG_ATEMPO_FILTER 0 +#define CONFIG_ATILT_FILTER 0 #define CONFIG_ATRIM_FILTER 0 #define CONFIG_AXCORRELATE_FILTER 0 #define CONFIG_AZMQ_FILTER 0 @@ -1913,6 +1919,7 @@ #define CONFIG_GEQ_FILTER 0 #define CONFIG_GRADFUN_FILTER 0 #define CONFIG_GRAPHMONITOR_FILTER 0 +#define CONFIG_GRAYWORLD_FILTER 0 #define CONFIG_GREYEDGE_FILTER 0 #define CONFIG_GUIDED_FILTER 0 #define CONFIG_HALDCLUT_FILTER 0 @@ -1922,6 +1929,8 @@ #define CONFIG_HQDN3D_FILTER 0 #define CONFIG_HQX_FILTER 0 #define CONFIG_HSTACK_FILTER 0 +#define CONFIG_HSVHOLD_FILTER 0 +#define CONFIG_HSVKEY_FILTER 0 #define CONFIG_HUE_FILTER 0 #define CONFIG_HWDOWNLOAD_FILTER 0 #define CONFIG_HWMAP_FILTER 0 @@ -2026,7 +2035,9 @@ #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCDET_FILTER 0 +#define CONFIG_SCHARR_FILTER 0 #define CONFIG_SCROLL_FILTER 0 +#define CONFIG_SEGMENT_FILTER 0 #define CONFIG_SELECT_FILTER 0 #define CONFIG_SELECTIVECOLOR_FILTER 0 #define CONFIG_SENDCMD_FILTER 0 @@ -2587,6 +2598,7 @@ #define CONFIG_MXF_OPATOM_MUXER 0 #define CONFIG_NULL_MUXER 0 #define CONFIG_NUT_MUXER 0 +#define CONFIG_OBU_MUXER 0 #define CONFIG_OGA_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/linux-noasm/x64/libavutil/ffversion.h b/chromium/third_party/ffmpeg/chromium/config/Chrome/linux-noasm/x64/libavutil/ffversion.h index d4ce7a4e6a7..f26e152f83f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/linux-noasm/x64/libavutil/ffversion.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/linux-noasm/x64/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "N-104195-g628f528751" +#define FFMPEG_VERSION "N-104707-g392d8a2d60" #endif /* AVUTIL_FFVERSION_H */ diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/arm-neon/config.h b/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/arm-neon/config.h index efdf6fbaf46..b3dd8338eaf 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/arm-neon/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/arm-neon/config.h @@ -1,12 +1,12 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --arch=arm --enable-armv6 --enable-armv6t2 --enable-vfp --enable-thumb --extra-cflags='-march=armv7-a' --enable-cross-compile --target-os=linux --extra-cflags='--target=arm-linux-gnueabihf' --extra-ldflags='--target=arm-linux-gnueabihf' --sysroot=/not_workspace/liberato/release_chrome/src/build/linux/debian_sid_arm-sysroot --extra-cflags='-mtune=cortex-a8' --extra-cflags='-mfloat-abi=hard' --extra-cflags=-O2 --enable-neon --extra-cflags='-mfpu=neon' --enable-pic --cc=clang --cxx=clang++ --ld=clang --extra-ldflags='-fuse-ld=lld' --enable-decoder='aac,h264' --enable-demuxer=aac --enable-parser='aac,h264'" -- elide long configuration string from binary */ +/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --arch=arm --enable-armv6 --enable-armv6t2 --enable-vfp --enable-thumb --extra-cflags='-march=armv7-a' --enable-cross-compile --target-os=linux --extra-cflags='--target=arm-linux-gnueabihf' --extra-ldflags='--target=arm-linux-gnueabihf' --sysroot=/usr/local/google/home/tguilbert/Code/chromium/src/build/linux/debian_sid_arm-sysroot --extra-cflags='-mtune=cortex-a8' --extra-cflags='-mfloat-abi=hard' --extra-cflags=-O2 --enable-neon --extra-cflags='-mfpu=neon' --enable-pic --cc=clang --cxx=clang++ --ld=clang --extra-ldflags='-fuse-ld=lld' --enable-decoder='aac,h264' --enable-demuxer=aac --enable-parser='aac,h264'" -- elide long configuration string from binary */ #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2021 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" #define AVCONV_DATADIR "/usr/local/share/ffmpeg" -#define CC_IDENT "clang version 13.0.0 (https://github.com/llvm/llvm-project/ f98ed74f6910f8b09e77497aeb30c860c433610d)" +#define CC_IDENT "clang version 14.0.0 (https://github.com/llvm/llvm-project/ 0e03450ae4358e8a8242b73d493d96efea9d3ccf)" #define OS_NAME linux #define av_restrict restrict #define EXTERN_PREFIX "" @@ -1086,6 +1086,7 @@ #define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 +#define CONFIG_MSNSIREN_DECODER 0 #define CONFIG_NELLYMOSER_DECODER 0 #define CONFIG_ON2AVC_DECODER 0 #define CONFIG_OPUS_DECODER 0 @@ -1355,6 +1356,7 @@ #define CONFIG_RV20_ENCODER 0 #define CONFIG_S302M_ENCODER 0 #define CONFIG_SGI_ENCODER 0 +#define CONFIG_SMC_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_SPEEDHQ_ENCODER 0 #define CONFIG_SUNRAST_ENCODER 0 @@ -1678,6 +1680,7 @@ #define CONFIG_ACRUSHER_FILTER 0 #define CONFIG_ADECLICK_FILTER 0 #define CONFIG_ADECLIP_FILTER 0 +#define CONFIG_ADECORRELATE_FILTER 0 #define CONFIG_ADELAY_FILTER 0 #define CONFIG_ADENORM_FILTER 0 #define CONFIG_ADERIVATIVE_FILTER 0 @@ -1711,11 +1714,13 @@ #define CONFIG_APERMS_FILTER 0 #define CONFIG_APHASER_FILTER 0 #define CONFIG_APHASESHIFT_FILTER 0 +#define CONFIG_APSYCLIP_FILTER 0 #define CONFIG_APULSATOR_FILTER 0 #define CONFIG_AREALTIME_FILTER 0 #define CONFIG_ARESAMPLE_FILTER 0 #define CONFIG_AREVERSE_FILTER 0 #define CONFIG_ARNNDN_FILTER 0 +#define CONFIG_ASEGMENT_FILTER 0 #define CONFIG_ASELECT_FILTER 0 #define CONFIG_ASENDCMD_FILTER 0 #define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1735,6 +1740,7 @@ #define CONFIG_ASUPERPASS_FILTER 0 #define CONFIG_ASUPERSTOP_FILTER 0 #define CONFIG_ATEMPO_FILTER 0 +#define CONFIG_ATILT_FILTER 0 #define CONFIG_ATRIM_FILTER 0 #define CONFIG_AXCORRELATE_FILTER 0 #define CONFIG_AZMQ_FILTER 0 @@ -1913,6 +1919,7 @@ #define CONFIG_GEQ_FILTER 0 #define CONFIG_GRADFUN_FILTER 0 #define CONFIG_GRAPHMONITOR_FILTER 0 +#define CONFIG_GRAYWORLD_FILTER 0 #define CONFIG_GREYEDGE_FILTER 0 #define CONFIG_GUIDED_FILTER 0 #define CONFIG_HALDCLUT_FILTER 0 @@ -1922,6 +1929,8 @@ #define CONFIG_HQDN3D_FILTER 0 #define CONFIG_HQX_FILTER 0 #define CONFIG_HSTACK_FILTER 0 +#define CONFIG_HSVHOLD_FILTER 0 +#define CONFIG_HSVKEY_FILTER 0 #define CONFIG_HUE_FILTER 0 #define CONFIG_HWDOWNLOAD_FILTER 0 #define CONFIG_HWMAP_FILTER 0 @@ -2026,7 +2035,9 @@ #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCDET_FILTER 0 +#define CONFIG_SCHARR_FILTER 0 #define CONFIG_SCROLL_FILTER 0 +#define CONFIG_SEGMENT_FILTER 0 #define CONFIG_SELECT_FILTER 0 #define CONFIG_SELECTIVECOLOR_FILTER 0 #define CONFIG_SENDCMD_FILTER 0 @@ -2587,6 +2598,7 @@ #define CONFIG_MXF_OPATOM_MUXER 0 #define CONFIG_NULL_MUXER 0 #define CONFIG_NUT_MUXER 0 +#define CONFIG_OBU_MUXER 0 #define CONFIG_OGA_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/arm-neon/libavutil/ffversion.h b/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/arm-neon/libavutil/ffversion.h index d4ce7a4e6a7..f26e152f83f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/arm-neon/libavutil/ffversion.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/arm-neon/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "N-104195-g628f528751" +#define FFMPEG_VERSION "N-104707-g392d8a2d60" #endif /* AVUTIL_FFVERSION_H */ diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/arm/config.h b/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/arm/config.h index 1bb7d417f0a..5e0c1cc147a 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/arm/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/arm/config.h @@ -1,12 +1,12 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --arch=arm --enable-armv6 --enable-armv6t2 --enable-vfp --enable-thumb --extra-cflags='-march=armv7-a' --enable-cross-compile --target-os=linux --extra-cflags='--target=arm-linux-gnueabihf' --extra-ldflags='--target=arm-linux-gnueabihf' --sysroot=/not_workspace/liberato/release_chrome/src/build/linux/debian_sid_arm-sysroot --extra-cflags='-mtune=cortex-a8' --extra-cflags='-mfloat-abi=hard' --extra-cflags=-O2 --disable-neon --extra-cflags='-mfpu=vfpv3-d16' --enable-pic --cc=clang --cxx=clang++ --ld=clang --extra-ldflags='-fuse-ld=lld' --enable-decoder='aac,h264' --enable-demuxer=aac --enable-parser='aac,h264'" -- elide long configuration string from binary */ +/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --arch=arm --enable-armv6 --enable-armv6t2 --enable-vfp --enable-thumb --extra-cflags='-march=armv7-a' --enable-cross-compile --target-os=linux --extra-cflags='--target=arm-linux-gnueabihf' --extra-ldflags='--target=arm-linux-gnueabihf' --sysroot=/usr/local/google/home/tguilbert/Code/chromium/src/build/linux/debian_sid_arm-sysroot --extra-cflags='-mtune=cortex-a8' --extra-cflags='-mfloat-abi=hard' --extra-cflags=-O2 --disable-neon --extra-cflags='-mfpu=vfpv3-d16' --enable-pic --cc=clang --cxx=clang++ --ld=clang --extra-ldflags='-fuse-ld=lld' --enable-decoder='aac,h264' --enable-demuxer=aac --enable-parser='aac,h264'" -- elide long configuration string from binary */ #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2021 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" #define AVCONV_DATADIR "/usr/local/share/ffmpeg" -#define CC_IDENT "clang version 13.0.0 (https://github.com/llvm/llvm-project/ f98ed74f6910f8b09e77497aeb30c860c433610d)" +#define CC_IDENT "clang version 14.0.0 (https://github.com/llvm/llvm-project/ 0e03450ae4358e8a8242b73d493d96efea9d3ccf)" #define OS_NAME linux #define av_restrict restrict #define EXTERN_PREFIX "" @@ -1086,6 +1086,7 @@ #define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 +#define CONFIG_MSNSIREN_DECODER 0 #define CONFIG_NELLYMOSER_DECODER 0 #define CONFIG_ON2AVC_DECODER 0 #define CONFIG_OPUS_DECODER 0 @@ -1355,6 +1356,7 @@ #define CONFIG_RV20_ENCODER 0 #define CONFIG_S302M_ENCODER 0 #define CONFIG_SGI_ENCODER 0 +#define CONFIG_SMC_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_SPEEDHQ_ENCODER 0 #define CONFIG_SUNRAST_ENCODER 0 @@ -1678,6 +1680,7 @@ #define CONFIG_ACRUSHER_FILTER 0 #define CONFIG_ADECLICK_FILTER 0 #define CONFIG_ADECLIP_FILTER 0 +#define CONFIG_ADECORRELATE_FILTER 0 #define CONFIG_ADELAY_FILTER 0 #define CONFIG_ADENORM_FILTER 0 #define CONFIG_ADERIVATIVE_FILTER 0 @@ -1711,11 +1714,13 @@ #define CONFIG_APERMS_FILTER 0 #define CONFIG_APHASER_FILTER 0 #define CONFIG_APHASESHIFT_FILTER 0 +#define CONFIG_APSYCLIP_FILTER 0 #define CONFIG_APULSATOR_FILTER 0 #define CONFIG_AREALTIME_FILTER 0 #define CONFIG_ARESAMPLE_FILTER 0 #define CONFIG_AREVERSE_FILTER 0 #define CONFIG_ARNNDN_FILTER 0 +#define CONFIG_ASEGMENT_FILTER 0 #define CONFIG_ASELECT_FILTER 0 #define CONFIG_ASENDCMD_FILTER 0 #define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1735,6 +1740,7 @@ #define CONFIG_ASUPERPASS_FILTER 0 #define CONFIG_ASUPERSTOP_FILTER 0 #define CONFIG_ATEMPO_FILTER 0 +#define CONFIG_ATILT_FILTER 0 #define CONFIG_ATRIM_FILTER 0 #define CONFIG_AXCORRELATE_FILTER 0 #define CONFIG_AZMQ_FILTER 0 @@ -1913,6 +1919,7 @@ #define CONFIG_GEQ_FILTER 0 #define CONFIG_GRADFUN_FILTER 0 #define CONFIG_GRAPHMONITOR_FILTER 0 +#define CONFIG_GRAYWORLD_FILTER 0 #define CONFIG_GREYEDGE_FILTER 0 #define CONFIG_GUIDED_FILTER 0 #define CONFIG_HALDCLUT_FILTER 0 @@ -1922,6 +1929,8 @@ #define CONFIG_HQDN3D_FILTER 0 #define CONFIG_HQX_FILTER 0 #define CONFIG_HSTACK_FILTER 0 +#define CONFIG_HSVHOLD_FILTER 0 +#define CONFIG_HSVKEY_FILTER 0 #define CONFIG_HUE_FILTER 0 #define CONFIG_HWDOWNLOAD_FILTER 0 #define CONFIG_HWMAP_FILTER 0 @@ -2026,7 +2035,9 @@ #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCDET_FILTER 0 +#define CONFIG_SCHARR_FILTER 0 #define CONFIG_SCROLL_FILTER 0 +#define CONFIG_SEGMENT_FILTER 0 #define CONFIG_SELECT_FILTER 0 #define CONFIG_SELECTIVECOLOR_FILTER 0 #define CONFIG_SENDCMD_FILTER 0 @@ -2587,6 +2598,7 @@ #define CONFIG_MXF_OPATOM_MUXER 0 #define CONFIG_NULL_MUXER 0 #define CONFIG_NUT_MUXER 0 +#define CONFIG_OBU_MUXER 0 #define CONFIG_OGA_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/arm/libavutil/ffversion.h b/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/arm/libavutil/ffversion.h index d4ce7a4e6a7..f26e152f83f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/arm/libavutil/ffversion.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/arm/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "N-104195-g628f528751" +#define FFMPEG_VERSION "N-104707-g392d8a2d60" #endif /* AVUTIL_FFVERSION_H */ diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/arm64/config.h b/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/arm64/config.h index 1733df55f3a..35ed5ee0e88 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/arm64/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/arm64/config.h @@ -1,12 +1,12 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --enable-cross-compile --cross-prefix=/usr/bin/aarch64-linux-gnu- --target-os=linux --extra-cflags='--target=aarch64-linux-gnu' --extra-ldflags='--target=aarch64-linux-gnu' --sysroot=/not_workspace/liberato/release_chrome/src/build/linux/debian_sid_arm64-sysroot --arch=aarch64 --enable-armv8 --extra-cflags='-march=armv8-a' --enable-pic --cc=clang --cxx=clang++ --ld=clang --extra-ldflags='-fuse-ld=lld' --enable-decoder='aac,h264' --enable-demuxer=aac --enable-parser='aac,h264'" -- elide long configuration string from binary */ +/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --enable-cross-compile --cross-prefix=/usr/bin/aarch64-linux-gnu- --target-os=linux --extra-cflags='--target=aarch64-linux-gnu' --extra-ldflags='--target=aarch64-linux-gnu' --sysroot=/usr/local/google/home/tguilbert/Code/chromium/src/build/linux/debian_sid_arm64-sysroot --arch=aarch64 --enable-armv8 --extra-cflags='-march=armv8-a' --enable-pic --cc=clang --cxx=clang++ --ld=clang --extra-ldflags='-fuse-ld=lld' --enable-decoder='aac,h264' --enable-demuxer=aac --enable-parser='aac,h264'" -- elide long configuration string from binary */ #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2021 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" #define AVCONV_DATADIR "/usr/local/share/ffmpeg" -#define CC_IDENT "clang version 13.0.0 (https://github.com/llvm/llvm-project/ f98ed74f6910f8b09e77497aeb30c860c433610d)" +#define CC_IDENT "clang version 14.0.0 (https://github.com/llvm/llvm-project/ 0e03450ae4358e8a8242b73d493d96efea9d3ccf)" #define OS_NAME linux #define av_restrict restrict #define EXTERN_PREFIX "" @@ -1086,6 +1086,7 @@ #define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 +#define CONFIG_MSNSIREN_DECODER 0 #define CONFIG_NELLYMOSER_DECODER 0 #define CONFIG_ON2AVC_DECODER 0 #define CONFIG_OPUS_DECODER 0 @@ -1355,6 +1356,7 @@ #define CONFIG_RV20_ENCODER 0 #define CONFIG_S302M_ENCODER 0 #define CONFIG_SGI_ENCODER 0 +#define CONFIG_SMC_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_SPEEDHQ_ENCODER 0 #define CONFIG_SUNRAST_ENCODER 0 @@ -1678,6 +1680,7 @@ #define CONFIG_ACRUSHER_FILTER 0 #define CONFIG_ADECLICK_FILTER 0 #define CONFIG_ADECLIP_FILTER 0 +#define CONFIG_ADECORRELATE_FILTER 0 #define CONFIG_ADELAY_FILTER 0 #define CONFIG_ADENORM_FILTER 0 #define CONFIG_ADERIVATIVE_FILTER 0 @@ -1711,11 +1714,13 @@ #define CONFIG_APERMS_FILTER 0 #define CONFIG_APHASER_FILTER 0 #define CONFIG_APHASESHIFT_FILTER 0 +#define CONFIG_APSYCLIP_FILTER 0 #define CONFIG_APULSATOR_FILTER 0 #define CONFIG_AREALTIME_FILTER 0 #define CONFIG_ARESAMPLE_FILTER 0 #define CONFIG_AREVERSE_FILTER 0 #define CONFIG_ARNNDN_FILTER 0 +#define CONFIG_ASEGMENT_FILTER 0 #define CONFIG_ASELECT_FILTER 0 #define CONFIG_ASENDCMD_FILTER 0 #define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1735,6 +1740,7 @@ #define CONFIG_ASUPERPASS_FILTER 0 #define CONFIG_ASUPERSTOP_FILTER 0 #define CONFIG_ATEMPO_FILTER 0 +#define CONFIG_ATILT_FILTER 0 #define CONFIG_ATRIM_FILTER 0 #define CONFIG_AXCORRELATE_FILTER 0 #define CONFIG_AZMQ_FILTER 0 @@ -1913,6 +1919,7 @@ #define CONFIG_GEQ_FILTER 0 #define CONFIG_GRADFUN_FILTER 0 #define CONFIG_GRAPHMONITOR_FILTER 0 +#define CONFIG_GRAYWORLD_FILTER 0 #define CONFIG_GREYEDGE_FILTER 0 #define CONFIG_GUIDED_FILTER 0 #define CONFIG_HALDCLUT_FILTER 0 @@ -1922,6 +1929,8 @@ #define CONFIG_HQDN3D_FILTER 0 #define CONFIG_HQX_FILTER 0 #define CONFIG_HSTACK_FILTER 0 +#define CONFIG_HSVHOLD_FILTER 0 +#define CONFIG_HSVKEY_FILTER 0 #define CONFIG_HUE_FILTER 0 #define CONFIG_HWDOWNLOAD_FILTER 0 #define CONFIG_HWMAP_FILTER 0 @@ -2026,7 +2035,9 @@ #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCDET_FILTER 0 +#define CONFIG_SCHARR_FILTER 0 #define CONFIG_SCROLL_FILTER 0 +#define CONFIG_SEGMENT_FILTER 0 #define CONFIG_SELECT_FILTER 0 #define CONFIG_SELECTIVECOLOR_FILTER 0 #define CONFIG_SENDCMD_FILTER 0 @@ -2587,6 +2598,7 @@ #define CONFIG_MXF_OPATOM_MUXER 0 #define CONFIG_NULL_MUXER 0 #define CONFIG_NUT_MUXER 0 +#define CONFIG_OBU_MUXER 0 #define CONFIG_OGA_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/arm64/libavutil/ffversion.h b/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/arm64/libavutil/ffversion.h index d4ce7a4e6a7..f26e152f83f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/arm64/libavutil/ffversion.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/arm64/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "N-104195-g628f528751" +#define FFMPEG_VERSION "N-104707-g392d8a2d60" #endif /* AVUTIL_FFVERSION_H */ diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/ia32/config.asm b/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/ia32/config.asm index ead8b3bf2e4..213a3af663f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/ia32/config.asm +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/ia32/config.asm @@ -216,7 +216,7 @@ %define HAVE_TERMIOS_H 1 %define HAVE_UDPLITE_H 0 %define HAVE_UNISTD_H 1 -%define HAVE_VALGRIND_VALGRIND_H 0 ; %define HAVE_VALGRIND_VALGRIND_H 1 -- forced to 0. See https://crbug.com/590440 +%define HAVE_VALGRIND_VALGRIND_H 0 ; %define HAVE_VALGRIND_VALGRIND_H 0 -- forced to 0. See https://crbug.com/590440 %define HAVE_WINDOWS_H 0 %define HAVE_WINSOCK2_H 0 %define HAVE_INTRINSICS_NEON 0 @@ -1070,6 +1070,7 @@ %define CONFIG_MP3ON4_DECODER 0 %define CONFIG_MPC7_DECODER 0 %define CONFIG_MPC8_DECODER 0 +%define CONFIG_MSNSIREN_DECODER 0 %define CONFIG_NELLYMOSER_DECODER 0 %define CONFIG_ON2AVC_DECODER 0 %define CONFIG_OPUS_DECODER 0 @@ -1339,6 +1340,7 @@ %define CONFIG_RV20_ENCODER 0 %define CONFIG_S302M_ENCODER 0 %define CONFIG_SGI_ENCODER 0 +%define CONFIG_SMC_ENCODER 0 %define CONFIG_SNOW_ENCODER 0 %define CONFIG_SPEEDHQ_ENCODER 0 %define CONFIG_SUNRAST_ENCODER 0 @@ -1662,6 +1664,7 @@ %define CONFIG_ACRUSHER_FILTER 0 %define CONFIG_ADECLICK_FILTER 0 %define CONFIG_ADECLIP_FILTER 0 +%define CONFIG_ADECORRELATE_FILTER 0 %define CONFIG_ADELAY_FILTER 0 %define CONFIG_ADENORM_FILTER 0 %define CONFIG_ADERIVATIVE_FILTER 0 @@ -1695,11 +1698,13 @@ %define CONFIG_APERMS_FILTER 0 %define CONFIG_APHASER_FILTER 0 %define CONFIG_APHASESHIFT_FILTER 0 +%define CONFIG_APSYCLIP_FILTER 0 %define CONFIG_APULSATOR_FILTER 0 %define CONFIG_AREALTIME_FILTER 0 %define CONFIG_ARESAMPLE_FILTER 0 %define CONFIG_AREVERSE_FILTER 0 %define CONFIG_ARNNDN_FILTER 0 +%define CONFIG_ASEGMENT_FILTER 0 %define CONFIG_ASELECT_FILTER 0 %define CONFIG_ASENDCMD_FILTER 0 %define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1719,6 +1724,7 @@ %define CONFIG_ASUPERPASS_FILTER 0 %define CONFIG_ASUPERSTOP_FILTER 0 %define CONFIG_ATEMPO_FILTER 0 +%define CONFIG_ATILT_FILTER 0 %define CONFIG_ATRIM_FILTER 0 %define CONFIG_AXCORRELATE_FILTER 0 %define CONFIG_AZMQ_FILTER 0 @@ -1897,6 +1903,7 @@ %define CONFIG_GEQ_FILTER 0 %define CONFIG_GRADFUN_FILTER 0 %define CONFIG_GRAPHMONITOR_FILTER 0 +%define CONFIG_GRAYWORLD_FILTER 0 %define CONFIG_GREYEDGE_FILTER 0 %define CONFIG_GUIDED_FILTER 0 %define CONFIG_HALDCLUT_FILTER 0 @@ -1906,6 +1913,8 @@ %define CONFIG_HQDN3D_FILTER 0 %define CONFIG_HQX_FILTER 0 %define CONFIG_HSTACK_FILTER 0 +%define CONFIG_HSVHOLD_FILTER 0 +%define CONFIG_HSVKEY_FILTER 0 %define CONFIG_HUE_FILTER 0 %define CONFIG_HWDOWNLOAD_FILTER 0 %define CONFIG_HWMAP_FILTER 0 @@ -2010,7 +2019,9 @@ %define CONFIG_SCALE_VULKAN_FILTER 0 %define CONFIG_SCALE2REF_FILTER 0 %define CONFIG_SCDET_FILTER 0 +%define CONFIG_SCHARR_FILTER 0 %define CONFIG_SCROLL_FILTER 0 +%define CONFIG_SEGMENT_FILTER 0 %define CONFIG_SELECT_FILTER 0 %define CONFIG_SELECTIVECOLOR_FILTER 0 %define CONFIG_SENDCMD_FILTER 0 @@ -2571,6 +2582,7 @@ %define CONFIG_MXF_OPATOM_MUXER 0 %define CONFIG_NULL_MUXER 0 %define CONFIG_NUT_MUXER 0 +%define CONFIG_OBU_MUXER 0 %define CONFIG_OGA_MUXER 0 %define CONFIG_OGG_MUXER 0 %define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/ia32/config.h b/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/ia32/config.h index ef2e09b8dcb..512c5a37315 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/ia32/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/ia32/config.h @@ -1,12 +1,12 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --arch=i686 --extra-cflags='\"-m32\"' --extra-ldflags='\"-m32\"' --enable-pic --cc=clang --cxx=clang++ --ld=clang --enable-decoder='aac,h264' --enable-demuxer=aac --enable-parser='aac,h264'" -- elide long configuration string from binary */ +/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --arch=i686 --extra-cflags='\"-m32\"' --extra-ldflags='\"-m32\"' --enable-pic --cc=clang --cxx=clang++ --ld=clang --enable-decoder='aac,h264' --enable-demuxer=aac --enable-parser='aac,h264'" -- elide long configuration string from binary */ #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2021 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" #define AVCONV_DATADIR "/usr/local/share/ffmpeg" -#define CC_IDENT "clang version 13.0.0 (https://github.com/llvm/llvm-project/ f98ed74f6910f8b09e77497aeb30c860c433610d)" +#define CC_IDENT "clang version 14.0.0 (https://github.com/llvm/llvm-project/ 0e03450ae4358e8a8242b73d493d96efea9d3ccf)" #define OS_NAME linux #define av_restrict restrict #define EXTERN_PREFIX "" @@ -232,7 +232,7 @@ #define HAVE_TERMIOS_H 1 #define HAVE_UDPLITE_H 0 #define HAVE_UNISTD_H 1 -#define HAVE_VALGRIND_VALGRIND_H 0 /* #define HAVE_VALGRIND_VALGRIND_H 1 -- forced to 0. See https://crbug.com/590440 */ +#define HAVE_VALGRIND_VALGRIND_H 0 /* #define HAVE_VALGRIND_VALGRIND_H 0 -- forced to 0. See https://crbug.com/590440 */ #define HAVE_WINDOWS_H 0 #define HAVE_WINSOCK2_H 0 #define HAVE_INTRINSICS_NEON 0 @@ -1086,6 +1086,7 @@ #define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 +#define CONFIG_MSNSIREN_DECODER 0 #define CONFIG_NELLYMOSER_DECODER 0 #define CONFIG_ON2AVC_DECODER 0 #define CONFIG_OPUS_DECODER 0 @@ -1355,6 +1356,7 @@ #define CONFIG_RV20_ENCODER 0 #define CONFIG_S302M_ENCODER 0 #define CONFIG_SGI_ENCODER 0 +#define CONFIG_SMC_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_SPEEDHQ_ENCODER 0 #define CONFIG_SUNRAST_ENCODER 0 @@ -1678,6 +1680,7 @@ #define CONFIG_ACRUSHER_FILTER 0 #define CONFIG_ADECLICK_FILTER 0 #define CONFIG_ADECLIP_FILTER 0 +#define CONFIG_ADECORRELATE_FILTER 0 #define CONFIG_ADELAY_FILTER 0 #define CONFIG_ADENORM_FILTER 0 #define CONFIG_ADERIVATIVE_FILTER 0 @@ -1711,11 +1714,13 @@ #define CONFIG_APERMS_FILTER 0 #define CONFIG_APHASER_FILTER 0 #define CONFIG_APHASESHIFT_FILTER 0 +#define CONFIG_APSYCLIP_FILTER 0 #define CONFIG_APULSATOR_FILTER 0 #define CONFIG_AREALTIME_FILTER 0 #define CONFIG_ARESAMPLE_FILTER 0 #define CONFIG_AREVERSE_FILTER 0 #define CONFIG_ARNNDN_FILTER 0 +#define CONFIG_ASEGMENT_FILTER 0 #define CONFIG_ASELECT_FILTER 0 #define CONFIG_ASENDCMD_FILTER 0 #define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1735,6 +1740,7 @@ #define CONFIG_ASUPERPASS_FILTER 0 #define CONFIG_ASUPERSTOP_FILTER 0 #define CONFIG_ATEMPO_FILTER 0 +#define CONFIG_ATILT_FILTER 0 #define CONFIG_ATRIM_FILTER 0 #define CONFIG_AXCORRELATE_FILTER 0 #define CONFIG_AZMQ_FILTER 0 @@ -1913,6 +1919,7 @@ #define CONFIG_GEQ_FILTER 0 #define CONFIG_GRADFUN_FILTER 0 #define CONFIG_GRAPHMONITOR_FILTER 0 +#define CONFIG_GRAYWORLD_FILTER 0 #define CONFIG_GREYEDGE_FILTER 0 #define CONFIG_GUIDED_FILTER 0 #define CONFIG_HALDCLUT_FILTER 0 @@ -1922,6 +1929,8 @@ #define CONFIG_HQDN3D_FILTER 0 #define CONFIG_HQX_FILTER 0 #define CONFIG_HSTACK_FILTER 0 +#define CONFIG_HSVHOLD_FILTER 0 +#define CONFIG_HSVKEY_FILTER 0 #define CONFIG_HUE_FILTER 0 #define CONFIG_HWDOWNLOAD_FILTER 0 #define CONFIG_HWMAP_FILTER 0 @@ -2026,7 +2035,9 @@ #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCDET_FILTER 0 +#define CONFIG_SCHARR_FILTER 0 #define CONFIG_SCROLL_FILTER 0 +#define CONFIG_SEGMENT_FILTER 0 #define CONFIG_SELECT_FILTER 0 #define CONFIG_SELECTIVECOLOR_FILTER 0 #define CONFIG_SENDCMD_FILTER 0 @@ -2587,6 +2598,7 @@ #define CONFIG_MXF_OPATOM_MUXER 0 #define CONFIG_NULL_MUXER 0 #define CONFIG_NUT_MUXER 0 +#define CONFIG_OBU_MUXER 0 #define CONFIG_OGA_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/ia32/libavutil/ffversion.h b/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/ia32/libavutil/ffversion.h index d4ce7a4e6a7..f26e152f83f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/ia32/libavutil/ffversion.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/ia32/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "N-104195-g628f528751" +#define FFMPEG_VERSION "N-104707-g392d8a2d60" #endif /* AVUTIL_FFVERSION_H */ diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/x64/config.asm b/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/x64/config.asm index 6b6d43498af..3ac771090b2 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/x64/config.asm +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/x64/config.asm @@ -216,7 +216,7 @@ %define HAVE_TERMIOS_H 1 %define HAVE_UDPLITE_H 0 %define HAVE_UNISTD_H 1 -%define HAVE_VALGRIND_VALGRIND_H 0 ; %define HAVE_VALGRIND_VALGRIND_H 1 -- forced to 0. See https://crbug.com/590440 +%define HAVE_VALGRIND_VALGRIND_H 0 ; %define HAVE_VALGRIND_VALGRIND_H 0 -- forced to 0. See https://crbug.com/590440 %define HAVE_WINDOWS_H 0 %define HAVE_WINSOCK2_H 0 %define HAVE_INTRINSICS_NEON 0 @@ -1070,6 +1070,7 @@ %define CONFIG_MP3ON4_DECODER 0 %define CONFIG_MPC7_DECODER 0 %define CONFIG_MPC8_DECODER 0 +%define CONFIG_MSNSIREN_DECODER 0 %define CONFIG_NELLYMOSER_DECODER 0 %define CONFIG_ON2AVC_DECODER 0 %define CONFIG_OPUS_DECODER 0 @@ -1339,6 +1340,7 @@ %define CONFIG_RV20_ENCODER 0 %define CONFIG_S302M_ENCODER 0 %define CONFIG_SGI_ENCODER 0 +%define CONFIG_SMC_ENCODER 0 %define CONFIG_SNOW_ENCODER 0 %define CONFIG_SPEEDHQ_ENCODER 0 %define CONFIG_SUNRAST_ENCODER 0 @@ -1662,6 +1664,7 @@ %define CONFIG_ACRUSHER_FILTER 0 %define CONFIG_ADECLICK_FILTER 0 %define CONFIG_ADECLIP_FILTER 0 +%define CONFIG_ADECORRELATE_FILTER 0 %define CONFIG_ADELAY_FILTER 0 %define CONFIG_ADENORM_FILTER 0 %define CONFIG_ADERIVATIVE_FILTER 0 @@ -1695,11 +1698,13 @@ %define CONFIG_APERMS_FILTER 0 %define CONFIG_APHASER_FILTER 0 %define CONFIG_APHASESHIFT_FILTER 0 +%define CONFIG_APSYCLIP_FILTER 0 %define CONFIG_APULSATOR_FILTER 0 %define CONFIG_AREALTIME_FILTER 0 %define CONFIG_ARESAMPLE_FILTER 0 %define CONFIG_AREVERSE_FILTER 0 %define CONFIG_ARNNDN_FILTER 0 +%define CONFIG_ASEGMENT_FILTER 0 %define CONFIG_ASELECT_FILTER 0 %define CONFIG_ASENDCMD_FILTER 0 %define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1719,6 +1724,7 @@ %define CONFIG_ASUPERPASS_FILTER 0 %define CONFIG_ASUPERSTOP_FILTER 0 %define CONFIG_ATEMPO_FILTER 0 +%define CONFIG_ATILT_FILTER 0 %define CONFIG_ATRIM_FILTER 0 %define CONFIG_AXCORRELATE_FILTER 0 %define CONFIG_AZMQ_FILTER 0 @@ -1897,6 +1903,7 @@ %define CONFIG_GEQ_FILTER 0 %define CONFIG_GRADFUN_FILTER 0 %define CONFIG_GRAPHMONITOR_FILTER 0 +%define CONFIG_GRAYWORLD_FILTER 0 %define CONFIG_GREYEDGE_FILTER 0 %define CONFIG_GUIDED_FILTER 0 %define CONFIG_HALDCLUT_FILTER 0 @@ -1906,6 +1913,8 @@ %define CONFIG_HQDN3D_FILTER 0 %define CONFIG_HQX_FILTER 0 %define CONFIG_HSTACK_FILTER 0 +%define CONFIG_HSVHOLD_FILTER 0 +%define CONFIG_HSVKEY_FILTER 0 %define CONFIG_HUE_FILTER 0 %define CONFIG_HWDOWNLOAD_FILTER 0 %define CONFIG_HWMAP_FILTER 0 @@ -2010,7 +2019,9 @@ %define CONFIG_SCALE_VULKAN_FILTER 0 %define CONFIG_SCALE2REF_FILTER 0 %define CONFIG_SCDET_FILTER 0 +%define CONFIG_SCHARR_FILTER 0 %define CONFIG_SCROLL_FILTER 0 +%define CONFIG_SEGMENT_FILTER 0 %define CONFIG_SELECT_FILTER 0 %define CONFIG_SELECTIVECOLOR_FILTER 0 %define CONFIG_SENDCMD_FILTER 0 @@ -2571,6 +2582,7 @@ %define CONFIG_MXF_OPATOM_MUXER 0 %define CONFIG_NULL_MUXER 0 %define CONFIG_NUT_MUXER 0 +%define CONFIG_OBU_MUXER 0 %define CONFIG_OGA_MUXER 0 %define CONFIG_OGG_MUXER 0 %define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/x64/config.h b/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/x64/config.h index f189f61a82a..fdd6405f36f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/x64/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/x64/config.h @@ -1,12 +1,12 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --enable-lto --enable-pic --cc=clang --cxx=clang++ --ld=clang --extra-ldflags='-fuse-ld=lld' --enable-decoder='aac,h264' --enable-demuxer=aac --enable-parser='aac,h264'" -- elide long configuration string from binary */ +/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --enable-lto --enable-pic --cc=clang --cxx=clang++ --ld=clang --extra-ldflags='-fuse-ld=lld' --enable-decoder='aac,h264' --enable-demuxer=aac --enable-parser='aac,h264'" -- elide long configuration string from binary */ #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2021 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" #define AVCONV_DATADIR "/usr/local/share/ffmpeg" -#define CC_IDENT "clang version 13.0.0 (https://github.com/llvm/llvm-project/ f98ed74f6910f8b09e77497aeb30c860c433610d)" +#define CC_IDENT "clang version 14.0.0 (https://github.com/llvm/llvm-project/ 0e03450ae4358e8a8242b73d493d96efea9d3ccf)" #define OS_NAME linux #define av_restrict restrict #define EXTERN_PREFIX "" @@ -232,7 +232,7 @@ #define HAVE_TERMIOS_H 1 #define HAVE_UDPLITE_H 0 #define HAVE_UNISTD_H 1 -#define HAVE_VALGRIND_VALGRIND_H 0 /* #define HAVE_VALGRIND_VALGRIND_H 1 -- forced to 0. See https://crbug.com/590440 */ +#define HAVE_VALGRIND_VALGRIND_H 0 /* #define HAVE_VALGRIND_VALGRIND_H 0 -- forced to 0. See https://crbug.com/590440 */ #define HAVE_WINDOWS_H 0 #define HAVE_WINSOCK2_H 0 #define HAVE_INTRINSICS_NEON 0 @@ -1086,6 +1086,7 @@ #define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 +#define CONFIG_MSNSIREN_DECODER 0 #define CONFIG_NELLYMOSER_DECODER 0 #define CONFIG_ON2AVC_DECODER 0 #define CONFIG_OPUS_DECODER 0 @@ -1355,6 +1356,7 @@ #define CONFIG_RV20_ENCODER 0 #define CONFIG_S302M_ENCODER 0 #define CONFIG_SGI_ENCODER 0 +#define CONFIG_SMC_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_SPEEDHQ_ENCODER 0 #define CONFIG_SUNRAST_ENCODER 0 @@ -1678,6 +1680,7 @@ #define CONFIG_ACRUSHER_FILTER 0 #define CONFIG_ADECLICK_FILTER 0 #define CONFIG_ADECLIP_FILTER 0 +#define CONFIG_ADECORRELATE_FILTER 0 #define CONFIG_ADELAY_FILTER 0 #define CONFIG_ADENORM_FILTER 0 #define CONFIG_ADERIVATIVE_FILTER 0 @@ -1711,11 +1714,13 @@ #define CONFIG_APERMS_FILTER 0 #define CONFIG_APHASER_FILTER 0 #define CONFIG_APHASESHIFT_FILTER 0 +#define CONFIG_APSYCLIP_FILTER 0 #define CONFIG_APULSATOR_FILTER 0 #define CONFIG_AREALTIME_FILTER 0 #define CONFIG_ARESAMPLE_FILTER 0 #define CONFIG_AREVERSE_FILTER 0 #define CONFIG_ARNNDN_FILTER 0 +#define CONFIG_ASEGMENT_FILTER 0 #define CONFIG_ASELECT_FILTER 0 #define CONFIG_ASENDCMD_FILTER 0 #define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1735,6 +1740,7 @@ #define CONFIG_ASUPERPASS_FILTER 0 #define CONFIG_ASUPERSTOP_FILTER 0 #define CONFIG_ATEMPO_FILTER 0 +#define CONFIG_ATILT_FILTER 0 #define CONFIG_ATRIM_FILTER 0 #define CONFIG_AXCORRELATE_FILTER 0 #define CONFIG_AZMQ_FILTER 0 @@ -1913,6 +1919,7 @@ #define CONFIG_GEQ_FILTER 0 #define CONFIG_GRADFUN_FILTER 0 #define CONFIG_GRAPHMONITOR_FILTER 0 +#define CONFIG_GRAYWORLD_FILTER 0 #define CONFIG_GREYEDGE_FILTER 0 #define CONFIG_GUIDED_FILTER 0 #define CONFIG_HALDCLUT_FILTER 0 @@ -1922,6 +1929,8 @@ #define CONFIG_HQDN3D_FILTER 0 #define CONFIG_HQX_FILTER 0 #define CONFIG_HSTACK_FILTER 0 +#define CONFIG_HSVHOLD_FILTER 0 +#define CONFIG_HSVKEY_FILTER 0 #define CONFIG_HUE_FILTER 0 #define CONFIG_HWDOWNLOAD_FILTER 0 #define CONFIG_HWMAP_FILTER 0 @@ -2026,7 +2035,9 @@ #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCDET_FILTER 0 +#define CONFIG_SCHARR_FILTER 0 #define CONFIG_SCROLL_FILTER 0 +#define CONFIG_SEGMENT_FILTER 0 #define CONFIG_SELECT_FILTER 0 #define CONFIG_SELECTIVECOLOR_FILTER 0 #define CONFIG_SENDCMD_FILTER 0 @@ -2587,6 +2598,7 @@ #define CONFIG_MXF_OPATOM_MUXER 0 #define CONFIG_NULL_MUXER 0 #define CONFIG_NUT_MUXER 0 +#define CONFIG_OBU_MUXER 0 #define CONFIG_OGA_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/x64/libavutil/ffversion.h b/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/x64/libavutil/ffversion.h index d4ce7a4e6a7..f26e152f83f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/x64/libavutil/ffversion.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/linux/x64/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "N-104195-g628f528751" +#define FFMPEG_VERSION "N-104707-g392d8a2d60" #endif /* AVUTIL_FFVERSION_H */ diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/mac/arm64/config.h b/chromium/third_party/ffmpeg/chromium/config/Chrome/mac/arm64/config.h index 63d1e7b8147..af9e1e72b46 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/mac/arm64/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/mac/arm64/config.h @@ -1,12 +1,12 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --enable-pic --cc=clang --cxx=clang++ --ld=clang --enable-cross-compile --cc=clang --ld=ld64.lld --nm=llvm-nm --ar=llvm-ar --target-os=darwin --extra-cflags='--target=arm64-apple-macosx' --extra-cflags=-F/not_workspace/liberato/release_chrome/src/build/mac_files/xcode_binaries/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks --extra-cflags='-mmacosx-version-min=10.10' --extra-cflags=-fblocks --extra-cflags=-nostdinc --extra-cflags=-isystem/not_workspace/liberato/release_chrome/src/build/mac_files/xcode_binaries/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include --extra-cflags=-isystem/not_workspace/liberato/release_chrome/src/third_party/llvm-build/Release+Asserts/lib/clang/13.0.0/include --extra-ldflags=-syslibroot --extra-ldflags=/not_workspace/liberato/release_chrome/src/build/mac_files/xcode_binaries/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk --extra-ldflags=-L/not_workspace/liberato/release_chrome/src/build/mac_files/xcode_binaries/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib --extra-ldflags=-lSystem --extra-ldflags=-macosx_version_min --extra-ldflags=10.10 --extra-ldflags=-sdk_version --extra-ldflags=10.10 --extra-ldflags=-platform_version --extra-ldflags=macos --extra-ldflags=10.10 --extra-ldflags=10.10 --arch=arm64 --extra-cflags='-arch arm64' --extra-ldflags='-arch arm64' --enable-decoder='aac,h264' --enable-demuxer=aac --enable-parser='aac,h264'" -- elide long configuration string from binary */ +/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --enable-pic --cc=clang --cxx=clang++ --ld=clang --enable-cross-compile --cc=clang --ld=ld64.lld --nm=llvm-nm --ar=llvm-ar --target-os=darwin --extra-cflags='--target=arm64-apple-macosx' --extra-cflags=-F/usr/local/google/home/tguilbert/Code/chromium/src/build/mac_files/xcode_binaries/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks --extra-cflags='-mmacosx-version-min=10.10' --extra-cflags=-fblocks --extra-cflags=-nostdinc --extra-cflags=-isystem/usr/local/google/home/tguilbert/Code/chromium/src/build/mac_files/xcode_binaries/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include --extra-cflags=-isystem/usr/local/google/home/tguilbert/Code/chromium/src/third_party/llvm-build/Release+Asserts/lib/clang/14.0.0/include --extra-ldflags=-syslibroot --extra-ldflags=/usr/local/google/home/tguilbert/Code/chromium/src/build/mac_files/xcode_binaries/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk --extra-ldflags=-L/usr/local/google/home/tguilbert/Code/chromium/src/build/mac_files/xcode_binaries/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib --extra-ldflags=-lSystem --extra-ldflags=-macosx_version_min --extra-ldflags=10.10 --extra-ldflags=-sdk_version --extra-ldflags=10.10 --extra-ldflags=-platform_version --extra-ldflags=macos --extra-ldflags=10.10 --extra-ldflags=10.10 --arch=arm64 --extra-cflags='-arch arm64' --extra-ldflags='-arch arm64' --enable-decoder='aac,h264' --enable-demuxer=aac --enable-parser='aac,h264'" -- elide long configuration string from binary */ #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2021 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" #define AVCONV_DATADIR "/usr/local/share/ffmpeg" -#define CC_IDENT "clang version 13.0.0 (https://github.com/llvm/llvm-project/ f98ed74f6910f8b09e77497aeb30c860c433610d)" +#define CC_IDENT "clang version 14.0.0 (https://github.com/llvm/llvm-project/ 0e03450ae4358e8a8242b73d493d96efea9d3ccf)" #define OS_NAME darwin #define av_restrict restrict #define EXTERN_PREFIX "_" @@ -1086,6 +1086,7 @@ #define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 +#define CONFIG_MSNSIREN_DECODER 0 #define CONFIG_NELLYMOSER_DECODER 0 #define CONFIG_ON2AVC_DECODER 0 #define CONFIG_OPUS_DECODER 0 @@ -1355,6 +1356,7 @@ #define CONFIG_RV20_ENCODER 0 #define CONFIG_S302M_ENCODER 0 #define CONFIG_SGI_ENCODER 0 +#define CONFIG_SMC_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_SPEEDHQ_ENCODER 0 #define CONFIG_SUNRAST_ENCODER 0 @@ -1678,6 +1680,7 @@ #define CONFIG_ACRUSHER_FILTER 0 #define CONFIG_ADECLICK_FILTER 0 #define CONFIG_ADECLIP_FILTER 0 +#define CONFIG_ADECORRELATE_FILTER 0 #define CONFIG_ADELAY_FILTER 0 #define CONFIG_ADENORM_FILTER 0 #define CONFIG_ADERIVATIVE_FILTER 0 @@ -1711,11 +1714,13 @@ #define CONFIG_APERMS_FILTER 0 #define CONFIG_APHASER_FILTER 0 #define CONFIG_APHASESHIFT_FILTER 0 +#define CONFIG_APSYCLIP_FILTER 0 #define CONFIG_APULSATOR_FILTER 0 #define CONFIG_AREALTIME_FILTER 0 #define CONFIG_ARESAMPLE_FILTER 0 #define CONFIG_AREVERSE_FILTER 0 #define CONFIG_ARNNDN_FILTER 0 +#define CONFIG_ASEGMENT_FILTER 0 #define CONFIG_ASELECT_FILTER 0 #define CONFIG_ASENDCMD_FILTER 0 #define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1735,6 +1740,7 @@ #define CONFIG_ASUPERPASS_FILTER 0 #define CONFIG_ASUPERSTOP_FILTER 0 #define CONFIG_ATEMPO_FILTER 0 +#define CONFIG_ATILT_FILTER 0 #define CONFIG_ATRIM_FILTER 0 #define CONFIG_AXCORRELATE_FILTER 0 #define CONFIG_AZMQ_FILTER 0 @@ -1913,6 +1919,7 @@ #define CONFIG_GEQ_FILTER 0 #define CONFIG_GRADFUN_FILTER 0 #define CONFIG_GRAPHMONITOR_FILTER 0 +#define CONFIG_GRAYWORLD_FILTER 0 #define CONFIG_GREYEDGE_FILTER 0 #define CONFIG_GUIDED_FILTER 0 #define CONFIG_HALDCLUT_FILTER 0 @@ -1922,6 +1929,8 @@ #define CONFIG_HQDN3D_FILTER 0 #define CONFIG_HQX_FILTER 0 #define CONFIG_HSTACK_FILTER 0 +#define CONFIG_HSVHOLD_FILTER 0 +#define CONFIG_HSVKEY_FILTER 0 #define CONFIG_HUE_FILTER 0 #define CONFIG_HWDOWNLOAD_FILTER 0 #define CONFIG_HWMAP_FILTER 0 @@ -2026,7 +2035,9 @@ #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCDET_FILTER 0 +#define CONFIG_SCHARR_FILTER 0 #define CONFIG_SCROLL_FILTER 0 +#define CONFIG_SEGMENT_FILTER 0 #define CONFIG_SELECT_FILTER 0 #define CONFIG_SELECTIVECOLOR_FILTER 0 #define CONFIG_SENDCMD_FILTER 0 @@ -2587,6 +2598,7 @@ #define CONFIG_MXF_OPATOM_MUXER 0 #define CONFIG_NULL_MUXER 0 #define CONFIG_NUT_MUXER 0 +#define CONFIG_OBU_MUXER 0 #define CONFIG_OGA_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/mac/arm64/libavutil/ffversion.h b/chromium/third_party/ffmpeg/chromium/config/Chrome/mac/arm64/libavutil/ffversion.h index d4ce7a4e6a7..f26e152f83f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/mac/arm64/libavutil/ffversion.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/mac/arm64/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "N-104195-g628f528751" +#define FFMPEG_VERSION "N-104707-g392d8a2d60" #endif /* AVUTIL_FFVERSION_H */ diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/mac/x64/config.asm b/chromium/third_party/ffmpeg/chromium/config/Chrome/mac/x64/config.asm index 6a1a1c2cc88..7f53cf6476d 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/mac/x64/config.asm +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/mac/x64/config.asm @@ -1070,6 +1070,7 @@ %define CONFIG_MP3ON4_DECODER 0 %define CONFIG_MPC7_DECODER 0 %define CONFIG_MPC8_DECODER 0 +%define CONFIG_MSNSIREN_DECODER 0 %define CONFIG_NELLYMOSER_DECODER 0 %define CONFIG_ON2AVC_DECODER 0 %define CONFIG_OPUS_DECODER 0 @@ -1339,6 +1340,7 @@ %define CONFIG_RV20_ENCODER 0 %define CONFIG_S302M_ENCODER 0 %define CONFIG_SGI_ENCODER 0 +%define CONFIG_SMC_ENCODER 0 %define CONFIG_SNOW_ENCODER 0 %define CONFIG_SPEEDHQ_ENCODER 0 %define CONFIG_SUNRAST_ENCODER 0 @@ -1662,6 +1664,7 @@ %define CONFIG_ACRUSHER_FILTER 0 %define CONFIG_ADECLICK_FILTER 0 %define CONFIG_ADECLIP_FILTER 0 +%define CONFIG_ADECORRELATE_FILTER 0 %define CONFIG_ADELAY_FILTER 0 %define CONFIG_ADENORM_FILTER 0 %define CONFIG_ADERIVATIVE_FILTER 0 @@ -1695,11 +1698,13 @@ %define CONFIG_APERMS_FILTER 0 %define CONFIG_APHASER_FILTER 0 %define CONFIG_APHASESHIFT_FILTER 0 +%define CONFIG_APSYCLIP_FILTER 0 %define CONFIG_APULSATOR_FILTER 0 %define CONFIG_AREALTIME_FILTER 0 %define CONFIG_ARESAMPLE_FILTER 0 %define CONFIG_AREVERSE_FILTER 0 %define CONFIG_ARNNDN_FILTER 0 +%define CONFIG_ASEGMENT_FILTER 0 %define CONFIG_ASELECT_FILTER 0 %define CONFIG_ASENDCMD_FILTER 0 %define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1719,6 +1724,7 @@ %define CONFIG_ASUPERPASS_FILTER 0 %define CONFIG_ASUPERSTOP_FILTER 0 %define CONFIG_ATEMPO_FILTER 0 +%define CONFIG_ATILT_FILTER 0 %define CONFIG_ATRIM_FILTER 0 %define CONFIG_AXCORRELATE_FILTER 0 %define CONFIG_AZMQ_FILTER 0 @@ -1897,6 +1903,7 @@ %define CONFIG_GEQ_FILTER 0 %define CONFIG_GRADFUN_FILTER 0 %define CONFIG_GRAPHMONITOR_FILTER 0 +%define CONFIG_GRAYWORLD_FILTER 0 %define CONFIG_GREYEDGE_FILTER 0 %define CONFIG_GUIDED_FILTER 0 %define CONFIG_HALDCLUT_FILTER 0 @@ -1906,6 +1913,8 @@ %define CONFIG_HQDN3D_FILTER 0 %define CONFIG_HQX_FILTER 0 %define CONFIG_HSTACK_FILTER 0 +%define CONFIG_HSVHOLD_FILTER 0 +%define CONFIG_HSVKEY_FILTER 0 %define CONFIG_HUE_FILTER 0 %define CONFIG_HWDOWNLOAD_FILTER 0 %define CONFIG_HWMAP_FILTER 0 @@ -2010,7 +2019,9 @@ %define CONFIG_SCALE_VULKAN_FILTER 0 %define CONFIG_SCALE2REF_FILTER 0 %define CONFIG_SCDET_FILTER 0 +%define CONFIG_SCHARR_FILTER 0 %define CONFIG_SCROLL_FILTER 0 +%define CONFIG_SEGMENT_FILTER 0 %define CONFIG_SELECT_FILTER 0 %define CONFIG_SELECTIVECOLOR_FILTER 0 %define CONFIG_SENDCMD_FILTER 0 @@ -2571,6 +2582,7 @@ %define CONFIG_MXF_OPATOM_MUXER 0 %define CONFIG_NULL_MUXER 0 %define CONFIG_NUT_MUXER 0 +%define CONFIG_OBU_MUXER 0 %define CONFIG_OGA_MUXER 0 %define CONFIG_OGG_MUXER 0 %define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/mac/x64/config.h b/chromium/third_party/ffmpeg/chromium/config/Chrome/mac/x64/config.h index 3463a724c8c..21fd12664f6 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/mac/x64/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/mac/x64/config.h @@ -1,12 +1,12 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --enable-pic --cc=clang --cxx=clang++ --ld=clang --enable-cross-compile --cc=clang --ld=ld64.lld --nm=llvm-nm --ar=llvm-ar --target-os=darwin --extra-cflags='--target=x86_64-apple-macosx' --extra-cflags=-F/not_workspace/liberato/release_chrome/src/build/mac_files/xcode_binaries/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks --extra-cflags='-mmacosx-version-min=10.10' --extra-cflags=-fblocks --extra-cflags=-nostdinc --extra-cflags=-isystem/not_workspace/liberato/release_chrome/src/build/mac_files/xcode_binaries/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include --extra-cflags=-isystem/not_workspace/liberato/release_chrome/src/third_party/llvm-build/Release+Asserts/lib/clang/13.0.0/include --extra-ldflags=-syslibroot --extra-ldflags=/not_workspace/liberato/release_chrome/src/build/mac_files/xcode_binaries/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk --extra-ldflags=-L/not_workspace/liberato/release_chrome/src/build/mac_files/xcode_binaries/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib --extra-ldflags=-lSystem --extra-ldflags=-macosx_version_min --extra-ldflags=10.10 --extra-ldflags=-sdk_version --extra-ldflags=10.10 --extra-ldflags=-platform_version --extra-ldflags=macos --extra-ldflags=10.10 --extra-ldflags=10.10 --arch=x86_64 --extra-cflags=-m64 --extra-ldflags='-arch x86_64' --enable-decoder='aac,h264' --enable-demuxer=aac --enable-parser='aac,h264'" -- elide long configuration string from binary */ +/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --enable-pic --cc=clang --cxx=clang++ --ld=clang --enable-cross-compile --cc=clang --ld=ld64.lld --nm=llvm-nm --ar=llvm-ar --target-os=darwin --extra-cflags='--target=x86_64-apple-macosx' --extra-cflags=-F/usr/local/google/home/tguilbert/Code/chromium/src/build/mac_files/xcode_binaries/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks --extra-cflags='-mmacosx-version-min=10.10' --extra-cflags=-fblocks --extra-cflags=-nostdinc --extra-cflags=-isystem/usr/local/google/home/tguilbert/Code/chromium/src/build/mac_files/xcode_binaries/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include --extra-cflags=-isystem/usr/local/google/home/tguilbert/Code/chromium/src/third_party/llvm-build/Release+Asserts/lib/clang/14.0.0/include --extra-ldflags=-syslibroot --extra-ldflags=/usr/local/google/home/tguilbert/Code/chromium/src/build/mac_files/xcode_binaries/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk --extra-ldflags=-L/usr/local/google/home/tguilbert/Code/chromium/src/build/mac_files/xcode_binaries/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib --extra-ldflags=-lSystem --extra-ldflags=-macosx_version_min --extra-ldflags=10.10 --extra-ldflags=-sdk_version --extra-ldflags=10.10 --extra-ldflags=-platform_version --extra-ldflags=macos --extra-ldflags=10.10 --extra-ldflags=10.10 --arch=x86_64 --extra-cflags=-m64 --extra-ldflags='-arch x86_64' --enable-decoder='aac,h264' --enable-demuxer=aac --enable-parser='aac,h264'" -- elide long configuration string from binary */ #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2021 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" #define AVCONV_DATADIR "/usr/local/share/ffmpeg" -#define CC_IDENT "clang version 13.0.0 (https://github.com/llvm/llvm-project/ f98ed74f6910f8b09e77497aeb30c860c433610d)" +#define CC_IDENT "clang version 14.0.0 (https://github.com/llvm/llvm-project/ 0e03450ae4358e8a8242b73d493d96efea9d3ccf)" #define OS_NAME darwin #define av_restrict restrict #define EXTERN_PREFIX "_" @@ -1086,6 +1086,7 @@ #define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 +#define CONFIG_MSNSIREN_DECODER 0 #define CONFIG_NELLYMOSER_DECODER 0 #define CONFIG_ON2AVC_DECODER 0 #define CONFIG_OPUS_DECODER 0 @@ -1355,6 +1356,7 @@ #define CONFIG_RV20_ENCODER 0 #define CONFIG_S302M_ENCODER 0 #define CONFIG_SGI_ENCODER 0 +#define CONFIG_SMC_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_SPEEDHQ_ENCODER 0 #define CONFIG_SUNRAST_ENCODER 0 @@ -1678,6 +1680,7 @@ #define CONFIG_ACRUSHER_FILTER 0 #define CONFIG_ADECLICK_FILTER 0 #define CONFIG_ADECLIP_FILTER 0 +#define CONFIG_ADECORRELATE_FILTER 0 #define CONFIG_ADELAY_FILTER 0 #define CONFIG_ADENORM_FILTER 0 #define CONFIG_ADERIVATIVE_FILTER 0 @@ -1711,11 +1714,13 @@ #define CONFIG_APERMS_FILTER 0 #define CONFIG_APHASER_FILTER 0 #define CONFIG_APHASESHIFT_FILTER 0 +#define CONFIG_APSYCLIP_FILTER 0 #define CONFIG_APULSATOR_FILTER 0 #define CONFIG_AREALTIME_FILTER 0 #define CONFIG_ARESAMPLE_FILTER 0 #define CONFIG_AREVERSE_FILTER 0 #define CONFIG_ARNNDN_FILTER 0 +#define CONFIG_ASEGMENT_FILTER 0 #define CONFIG_ASELECT_FILTER 0 #define CONFIG_ASENDCMD_FILTER 0 #define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1735,6 +1740,7 @@ #define CONFIG_ASUPERPASS_FILTER 0 #define CONFIG_ASUPERSTOP_FILTER 0 #define CONFIG_ATEMPO_FILTER 0 +#define CONFIG_ATILT_FILTER 0 #define CONFIG_ATRIM_FILTER 0 #define CONFIG_AXCORRELATE_FILTER 0 #define CONFIG_AZMQ_FILTER 0 @@ -1913,6 +1919,7 @@ #define CONFIG_GEQ_FILTER 0 #define CONFIG_GRADFUN_FILTER 0 #define CONFIG_GRAPHMONITOR_FILTER 0 +#define CONFIG_GRAYWORLD_FILTER 0 #define CONFIG_GREYEDGE_FILTER 0 #define CONFIG_GUIDED_FILTER 0 #define CONFIG_HALDCLUT_FILTER 0 @@ -1922,6 +1929,8 @@ #define CONFIG_HQDN3D_FILTER 0 #define CONFIG_HQX_FILTER 0 #define CONFIG_HSTACK_FILTER 0 +#define CONFIG_HSVHOLD_FILTER 0 +#define CONFIG_HSVKEY_FILTER 0 #define CONFIG_HUE_FILTER 0 #define CONFIG_HWDOWNLOAD_FILTER 0 #define CONFIG_HWMAP_FILTER 0 @@ -2026,7 +2035,9 @@ #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCDET_FILTER 0 +#define CONFIG_SCHARR_FILTER 0 #define CONFIG_SCROLL_FILTER 0 +#define CONFIG_SEGMENT_FILTER 0 #define CONFIG_SELECT_FILTER 0 #define CONFIG_SELECTIVECOLOR_FILTER 0 #define CONFIG_SENDCMD_FILTER 0 @@ -2587,6 +2598,7 @@ #define CONFIG_MXF_OPATOM_MUXER 0 #define CONFIG_NULL_MUXER 0 #define CONFIG_NUT_MUXER 0 +#define CONFIG_OBU_MUXER 0 #define CONFIG_OGA_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/mac/x64/libavutil/ffversion.h b/chromium/third_party/ffmpeg/chromium/config/Chrome/mac/x64/libavutil/ffversion.h index d4ce7a4e6a7..f26e152f83f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/mac/x64/libavutil/ffversion.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/mac/x64/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "N-104195-g628f528751" +#define FFMPEG_VERSION "N-104707-g392d8a2d60" #endif /* AVUTIL_FFVERSION_H */ diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/win/arm64/config.h b/chromium/third_party/ffmpeg/chromium/config/Chrome/win/arm64/config.h index 5f0bd27768b..5bba0fa3e74 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/win/arm64/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/win/arm64/config.h @@ -1,12 +1,12 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --toolchain=msvc --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/ffmpeg/chromium/include/win --enable-cross-compile --cc=clang-cl --ld=lld-link --nm=llvm-nm --ar=llvm-ar --extra-cflags=-O2 --arch=aarch64 --as=clang-cl --extra-cflags='--target=arm64-windows' --extra-cflags=/winsysroot/not_workspace/liberato/release_chrome/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e --extra-ldflags='-libpath:/not_workspace/liberato/release_chrome/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/VC/Tools/MSVC/14.26.28801/atlmfc/lib/arm64' --extra-ldflags='-libpath:/workspace/tmp/windows_build_ffmpeg3zWISo' --extra-ldflags='-libpath:/workspace/tmp/windows_build_ffmpegislnhB' --extra-ldflags='-libpath:/not_workspace/liberato/release_chrome/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/VC/Tools/MSVC/14.26.28801/lib/arm64' --enable-decoder='aac,h264' --enable-demuxer=aac --enable-parser='aac,h264'" -- elide long configuration string from binary */ +/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --toolchain=msvc --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/ffmpeg/chromium/include/win --enable-cross-compile --cc=clang-cl --ld=lld-link --nm=llvm-nm --ar=llvm-ar --extra-cflags=-O2 --arch=aarch64 --as=clang-cl --extra-cflags='--target=arm64-windows' --extra-cflags=/winsysroot/usr/local/google/home/tguilbert/Code/chromium/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e --extra-ldflags='-libpath:/usr/local/google/home/tguilbert/Code/chromium/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/VC/Tools/MSVC/14.26.28801/atlmfc/lib/arm64' --extra-ldflags='-libpath:/tmp/windows_build_ffmpegZqNUos' --extra-ldflags='-libpath:/tmp/windows_build_ffmpeg9dTHEA' --extra-ldflags='-libpath:/usr/local/google/home/tguilbert/Code/chromium/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/VC/Tools/MSVC/14.26.28801/lib/arm64' --enable-decoder='aac,h264' --enable-demuxer=aac --enable-parser='aac,h264'" -- elide long configuration string from binary */ #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2021 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" #define AVCONV_DATADIR "/usr/local/share/ffmpeg" -#define CC_IDENT "clang version 13.0.0 (https://github.com/llvm/llvm-project/ f98ed74f6910f8b09e77497aeb30c860c433610d)" +#define CC_IDENT "clang version 14.0.0 (https://github.com/llvm/llvm-project/ 0e03450ae4358e8a8242b73d493d96efea9d3ccf)" #define OS_NAME win32 #define av_restrict restrict #define EXTERN_PREFIX "" @@ -1086,6 +1086,7 @@ #define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 +#define CONFIG_MSNSIREN_DECODER 0 #define CONFIG_NELLYMOSER_DECODER 0 #define CONFIG_ON2AVC_DECODER 0 #define CONFIG_OPUS_DECODER 0 @@ -1355,6 +1356,7 @@ #define CONFIG_RV20_ENCODER 0 #define CONFIG_S302M_ENCODER 0 #define CONFIG_SGI_ENCODER 0 +#define CONFIG_SMC_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_SPEEDHQ_ENCODER 0 #define CONFIG_SUNRAST_ENCODER 0 @@ -1678,6 +1680,7 @@ #define CONFIG_ACRUSHER_FILTER 0 #define CONFIG_ADECLICK_FILTER 0 #define CONFIG_ADECLIP_FILTER 0 +#define CONFIG_ADECORRELATE_FILTER 0 #define CONFIG_ADELAY_FILTER 0 #define CONFIG_ADENORM_FILTER 0 #define CONFIG_ADERIVATIVE_FILTER 0 @@ -1711,11 +1714,13 @@ #define CONFIG_APERMS_FILTER 0 #define CONFIG_APHASER_FILTER 0 #define CONFIG_APHASESHIFT_FILTER 0 +#define CONFIG_APSYCLIP_FILTER 0 #define CONFIG_APULSATOR_FILTER 0 #define CONFIG_AREALTIME_FILTER 0 #define CONFIG_ARESAMPLE_FILTER 0 #define CONFIG_AREVERSE_FILTER 0 #define CONFIG_ARNNDN_FILTER 0 +#define CONFIG_ASEGMENT_FILTER 0 #define CONFIG_ASELECT_FILTER 0 #define CONFIG_ASENDCMD_FILTER 0 #define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1735,6 +1740,7 @@ #define CONFIG_ASUPERPASS_FILTER 0 #define CONFIG_ASUPERSTOP_FILTER 0 #define CONFIG_ATEMPO_FILTER 0 +#define CONFIG_ATILT_FILTER 0 #define CONFIG_ATRIM_FILTER 0 #define CONFIG_AXCORRELATE_FILTER 0 #define CONFIG_AZMQ_FILTER 0 @@ -1913,6 +1919,7 @@ #define CONFIG_GEQ_FILTER 0 #define CONFIG_GRADFUN_FILTER 0 #define CONFIG_GRAPHMONITOR_FILTER 0 +#define CONFIG_GRAYWORLD_FILTER 0 #define CONFIG_GREYEDGE_FILTER 0 #define CONFIG_GUIDED_FILTER 0 #define CONFIG_HALDCLUT_FILTER 0 @@ -1922,6 +1929,8 @@ #define CONFIG_HQDN3D_FILTER 0 #define CONFIG_HQX_FILTER 0 #define CONFIG_HSTACK_FILTER 0 +#define CONFIG_HSVHOLD_FILTER 0 +#define CONFIG_HSVKEY_FILTER 0 #define CONFIG_HUE_FILTER 0 #define CONFIG_HWDOWNLOAD_FILTER 0 #define CONFIG_HWMAP_FILTER 0 @@ -2026,7 +2035,9 @@ #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCDET_FILTER 0 +#define CONFIG_SCHARR_FILTER 0 #define CONFIG_SCROLL_FILTER 0 +#define CONFIG_SEGMENT_FILTER 0 #define CONFIG_SELECT_FILTER 0 #define CONFIG_SELECTIVECOLOR_FILTER 0 #define CONFIG_SENDCMD_FILTER 0 @@ -2587,6 +2598,7 @@ #define CONFIG_MXF_OPATOM_MUXER 0 #define CONFIG_NULL_MUXER 0 #define CONFIG_NUT_MUXER 0 +#define CONFIG_OBU_MUXER 0 #define CONFIG_OGA_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/win/arm64/libavutil/ffversion.h b/chromium/third_party/ffmpeg/chromium/config/Chrome/win/arm64/libavutil/ffversion.h index d4ce7a4e6a7..f26e152f83f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/win/arm64/libavutil/ffversion.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/win/arm64/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "N-104195-g628f528751" +#define FFMPEG_VERSION "N-104707-g392d8a2d60" #endif /* AVUTIL_FFVERSION_H */ diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/win/ia32/config.asm b/chromium/third_party/ffmpeg/chromium/config/Chrome/win/ia32/config.asm index 184370c2459..aad744f5c35 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/win/ia32/config.asm +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/win/ia32/config.asm @@ -1070,6 +1070,7 @@ %define CONFIG_MP3ON4_DECODER 0 %define CONFIG_MPC7_DECODER 0 %define CONFIG_MPC8_DECODER 0 +%define CONFIG_MSNSIREN_DECODER 0 %define CONFIG_NELLYMOSER_DECODER 0 %define CONFIG_ON2AVC_DECODER 0 %define CONFIG_OPUS_DECODER 0 @@ -1339,6 +1340,7 @@ %define CONFIG_RV20_ENCODER 0 %define CONFIG_S302M_ENCODER 0 %define CONFIG_SGI_ENCODER 0 +%define CONFIG_SMC_ENCODER 0 %define CONFIG_SNOW_ENCODER 0 %define CONFIG_SPEEDHQ_ENCODER 0 %define CONFIG_SUNRAST_ENCODER 0 @@ -1662,6 +1664,7 @@ %define CONFIG_ACRUSHER_FILTER 0 %define CONFIG_ADECLICK_FILTER 0 %define CONFIG_ADECLIP_FILTER 0 +%define CONFIG_ADECORRELATE_FILTER 0 %define CONFIG_ADELAY_FILTER 0 %define CONFIG_ADENORM_FILTER 0 %define CONFIG_ADERIVATIVE_FILTER 0 @@ -1695,11 +1698,13 @@ %define CONFIG_APERMS_FILTER 0 %define CONFIG_APHASER_FILTER 0 %define CONFIG_APHASESHIFT_FILTER 0 +%define CONFIG_APSYCLIP_FILTER 0 %define CONFIG_APULSATOR_FILTER 0 %define CONFIG_AREALTIME_FILTER 0 %define CONFIG_ARESAMPLE_FILTER 0 %define CONFIG_AREVERSE_FILTER 0 %define CONFIG_ARNNDN_FILTER 0 +%define CONFIG_ASEGMENT_FILTER 0 %define CONFIG_ASELECT_FILTER 0 %define CONFIG_ASENDCMD_FILTER 0 %define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1719,6 +1724,7 @@ %define CONFIG_ASUPERPASS_FILTER 0 %define CONFIG_ASUPERSTOP_FILTER 0 %define CONFIG_ATEMPO_FILTER 0 +%define CONFIG_ATILT_FILTER 0 %define CONFIG_ATRIM_FILTER 0 %define CONFIG_AXCORRELATE_FILTER 0 %define CONFIG_AZMQ_FILTER 0 @@ -1897,6 +1903,7 @@ %define CONFIG_GEQ_FILTER 0 %define CONFIG_GRADFUN_FILTER 0 %define CONFIG_GRAPHMONITOR_FILTER 0 +%define CONFIG_GRAYWORLD_FILTER 0 %define CONFIG_GREYEDGE_FILTER 0 %define CONFIG_GUIDED_FILTER 0 %define CONFIG_HALDCLUT_FILTER 0 @@ -1906,6 +1913,8 @@ %define CONFIG_HQDN3D_FILTER 0 %define CONFIG_HQX_FILTER 0 %define CONFIG_HSTACK_FILTER 0 +%define CONFIG_HSVHOLD_FILTER 0 +%define CONFIG_HSVKEY_FILTER 0 %define CONFIG_HUE_FILTER 0 %define CONFIG_HWDOWNLOAD_FILTER 0 %define CONFIG_HWMAP_FILTER 0 @@ -2010,7 +2019,9 @@ %define CONFIG_SCALE_VULKAN_FILTER 0 %define CONFIG_SCALE2REF_FILTER 0 %define CONFIG_SCDET_FILTER 0 +%define CONFIG_SCHARR_FILTER 0 %define CONFIG_SCROLL_FILTER 0 +%define CONFIG_SEGMENT_FILTER 0 %define CONFIG_SELECT_FILTER 0 %define CONFIG_SELECTIVECOLOR_FILTER 0 %define CONFIG_SENDCMD_FILTER 0 @@ -2571,6 +2582,7 @@ %define CONFIG_MXF_OPATOM_MUXER 0 %define CONFIG_NULL_MUXER 0 %define CONFIG_NUT_MUXER 0 +%define CONFIG_OBU_MUXER 0 %define CONFIG_OGA_MUXER 0 %define CONFIG_OGG_MUXER 0 %define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/win/ia32/config.h b/chromium/third_party/ffmpeg/chromium/config/Chrome/win/ia32/config.h index 0bedaa458d7..5c20baa4942 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/win/ia32/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/win/ia32/config.h @@ -1,12 +1,12 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --toolchain=msvc --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/ffmpeg/chromium/include/win --enable-cross-compile --cc=clang-cl --ld=lld-link --nm=llvm-nm --ar=llvm-ar --extra-cflags=-O2 --extra-cflags=-m32 --extra-cflags=/winsysroot/not_workspace/liberato/release_chrome/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e --extra-ldflags='-libpath:/not_workspace/liberato/release_chrome/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/VC/Tools/MSVC/14.26.28801/atlmfc/lib/x86' --extra-ldflags='-libpath:/workspace/tmp/windows_build_ffmpegGeWVF5' --extra-ldflags='-libpath:/workspace/tmp/windows_build_ffmpeg1Zay0u' --extra-ldflags='-libpath:/not_workspace/liberato/release_chrome/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/VC/Tools/MSVC/14.26.28801/lib/x86' --enable-decoder='aac,h264' --enable-demuxer=aac --enable-parser='aac,h264'" -- elide long configuration string from binary */ +/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --toolchain=msvc --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/ffmpeg/chromium/include/win --enable-cross-compile --cc=clang-cl --ld=lld-link --nm=llvm-nm --ar=llvm-ar --extra-cflags=-O2 --extra-cflags=-m32 --extra-cflags=/winsysroot/usr/local/google/home/tguilbert/Code/chromium/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e --extra-ldflags='-libpath:/usr/local/google/home/tguilbert/Code/chromium/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/VC/Tools/MSVC/14.26.28801/atlmfc/lib/x86' --extra-ldflags='-libpath:/tmp/windows_build_ffmpeglWSOQk' --extra-ldflags='-libpath:/tmp/windows_build_ffmpegII3pXV' --extra-ldflags='-libpath:/usr/local/google/home/tguilbert/Code/chromium/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/VC/Tools/MSVC/14.26.28801/lib/x86' --enable-decoder='aac,h264' --enable-demuxer=aac --enable-parser='aac,h264'" -- elide long configuration string from binary */ #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2021 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" #define AVCONV_DATADIR "/usr/local/share/ffmpeg" -#define CC_IDENT "clang version 13.0.0 (https://github.com/llvm/llvm-project/ f98ed74f6910f8b09e77497aeb30c860c433610d)" +#define CC_IDENT "clang version 14.0.0 (https://github.com/llvm/llvm-project/ 0e03450ae4358e8a8242b73d493d96efea9d3ccf)" #define OS_NAME win32 #define av_restrict restrict #define EXTERN_PREFIX "_" @@ -1086,6 +1086,7 @@ #define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 +#define CONFIG_MSNSIREN_DECODER 0 #define CONFIG_NELLYMOSER_DECODER 0 #define CONFIG_ON2AVC_DECODER 0 #define CONFIG_OPUS_DECODER 0 @@ -1355,6 +1356,7 @@ #define CONFIG_RV20_ENCODER 0 #define CONFIG_S302M_ENCODER 0 #define CONFIG_SGI_ENCODER 0 +#define CONFIG_SMC_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_SPEEDHQ_ENCODER 0 #define CONFIG_SUNRAST_ENCODER 0 @@ -1678,6 +1680,7 @@ #define CONFIG_ACRUSHER_FILTER 0 #define CONFIG_ADECLICK_FILTER 0 #define CONFIG_ADECLIP_FILTER 0 +#define CONFIG_ADECORRELATE_FILTER 0 #define CONFIG_ADELAY_FILTER 0 #define CONFIG_ADENORM_FILTER 0 #define CONFIG_ADERIVATIVE_FILTER 0 @@ -1711,11 +1714,13 @@ #define CONFIG_APERMS_FILTER 0 #define CONFIG_APHASER_FILTER 0 #define CONFIG_APHASESHIFT_FILTER 0 +#define CONFIG_APSYCLIP_FILTER 0 #define CONFIG_APULSATOR_FILTER 0 #define CONFIG_AREALTIME_FILTER 0 #define CONFIG_ARESAMPLE_FILTER 0 #define CONFIG_AREVERSE_FILTER 0 #define CONFIG_ARNNDN_FILTER 0 +#define CONFIG_ASEGMENT_FILTER 0 #define CONFIG_ASELECT_FILTER 0 #define CONFIG_ASENDCMD_FILTER 0 #define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1735,6 +1740,7 @@ #define CONFIG_ASUPERPASS_FILTER 0 #define CONFIG_ASUPERSTOP_FILTER 0 #define CONFIG_ATEMPO_FILTER 0 +#define CONFIG_ATILT_FILTER 0 #define CONFIG_ATRIM_FILTER 0 #define CONFIG_AXCORRELATE_FILTER 0 #define CONFIG_AZMQ_FILTER 0 @@ -1913,6 +1919,7 @@ #define CONFIG_GEQ_FILTER 0 #define CONFIG_GRADFUN_FILTER 0 #define CONFIG_GRAPHMONITOR_FILTER 0 +#define CONFIG_GRAYWORLD_FILTER 0 #define CONFIG_GREYEDGE_FILTER 0 #define CONFIG_GUIDED_FILTER 0 #define CONFIG_HALDCLUT_FILTER 0 @@ -1922,6 +1929,8 @@ #define CONFIG_HQDN3D_FILTER 0 #define CONFIG_HQX_FILTER 0 #define CONFIG_HSTACK_FILTER 0 +#define CONFIG_HSVHOLD_FILTER 0 +#define CONFIG_HSVKEY_FILTER 0 #define CONFIG_HUE_FILTER 0 #define CONFIG_HWDOWNLOAD_FILTER 0 #define CONFIG_HWMAP_FILTER 0 @@ -2026,7 +2035,9 @@ #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCDET_FILTER 0 +#define CONFIG_SCHARR_FILTER 0 #define CONFIG_SCROLL_FILTER 0 +#define CONFIG_SEGMENT_FILTER 0 #define CONFIG_SELECT_FILTER 0 #define CONFIG_SELECTIVECOLOR_FILTER 0 #define CONFIG_SENDCMD_FILTER 0 @@ -2587,6 +2598,7 @@ #define CONFIG_MXF_OPATOM_MUXER 0 #define CONFIG_NULL_MUXER 0 #define CONFIG_NUT_MUXER 0 +#define CONFIG_OBU_MUXER 0 #define CONFIG_OGA_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/win/ia32/libavutil/ffversion.h b/chromium/third_party/ffmpeg/chromium/config/Chrome/win/ia32/libavutil/ffversion.h index d4ce7a4e6a7..f26e152f83f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/win/ia32/libavutil/ffversion.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/win/ia32/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "N-104195-g628f528751" +#define FFMPEG_VERSION "N-104707-g392d8a2d60" #endif /* AVUTIL_FFVERSION_H */ diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/win/x64/config.asm b/chromium/third_party/ffmpeg/chromium/config/Chrome/win/x64/config.asm index 51a19fd97eb..2cb3c2ed49e 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/win/x64/config.asm +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/win/x64/config.asm @@ -1070,6 +1070,7 @@ %define CONFIG_MP3ON4_DECODER 0 %define CONFIG_MPC7_DECODER 0 %define CONFIG_MPC8_DECODER 0 +%define CONFIG_MSNSIREN_DECODER 0 %define CONFIG_NELLYMOSER_DECODER 0 %define CONFIG_ON2AVC_DECODER 0 %define CONFIG_OPUS_DECODER 0 @@ -1339,6 +1340,7 @@ %define CONFIG_RV20_ENCODER 0 %define CONFIG_S302M_ENCODER 0 %define CONFIG_SGI_ENCODER 0 +%define CONFIG_SMC_ENCODER 0 %define CONFIG_SNOW_ENCODER 0 %define CONFIG_SPEEDHQ_ENCODER 0 %define CONFIG_SUNRAST_ENCODER 0 @@ -1662,6 +1664,7 @@ %define CONFIG_ACRUSHER_FILTER 0 %define CONFIG_ADECLICK_FILTER 0 %define CONFIG_ADECLIP_FILTER 0 +%define CONFIG_ADECORRELATE_FILTER 0 %define CONFIG_ADELAY_FILTER 0 %define CONFIG_ADENORM_FILTER 0 %define CONFIG_ADERIVATIVE_FILTER 0 @@ -1695,11 +1698,13 @@ %define CONFIG_APERMS_FILTER 0 %define CONFIG_APHASER_FILTER 0 %define CONFIG_APHASESHIFT_FILTER 0 +%define CONFIG_APSYCLIP_FILTER 0 %define CONFIG_APULSATOR_FILTER 0 %define CONFIG_AREALTIME_FILTER 0 %define CONFIG_ARESAMPLE_FILTER 0 %define CONFIG_AREVERSE_FILTER 0 %define CONFIG_ARNNDN_FILTER 0 +%define CONFIG_ASEGMENT_FILTER 0 %define CONFIG_ASELECT_FILTER 0 %define CONFIG_ASENDCMD_FILTER 0 %define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1719,6 +1724,7 @@ %define CONFIG_ASUPERPASS_FILTER 0 %define CONFIG_ASUPERSTOP_FILTER 0 %define CONFIG_ATEMPO_FILTER 0 +%define CONFIG_ATILT_FILTER 0 %define CONFIG_ATRIM_FILTER 0 %define CONFIG_AXCORRELATE_FILTER 0 %define CONFIG_AZMQ_FILTER 0 @@ -1897,6 +1903,7 @@ %define CONFIG_GEQ_FILTER 0 %define CONFIG_GRADFUN_FILTER 0 %define CONFIG_GRAPHMONITOR_FILTER 0 +%define CONFIG_GRAYWORLD_FILTER 0 %define CONFIG_GREYEDGE_FILTER 0 %define CONFIG_GUIDED_FILTER 0 %define CONFIG_HALDCLUT_FILTER 0 @@ -1906,6 +1913,8 @@ %define CONFIG_HQDN3D_FILTER 0 %define CONFIG_HQX_FILTER 0 %define CONFIG_HSTACK_FILTER 0 +%define CONFIG_HSVHOLD_FILTER 0 +%define CONFIG_HSVKEY_FILTER 0 %define CONFIG_HUE_FILTER 0 %define CONFIG_HWDOWNLOAD_FILTER 0 %define CONFIG_HWMAP_FILTER 0 @@ -2010,7 +2019,9 @@ %define CONFIG_SCALE_VULKAN_FILTER 0 %define CONFIG_SCALE2REF_FILTER 0 %define CONFIG_SCDET_FILTER 0 +%define CONFIG_SCHARR_FILTER 0 %define CONFIG_SCROLL_FILTER 0 +%define CONFIG_SEGMENT_FILTER 0 %define CONFIG_SELECT_FILTER 0 %define CONFIG_SELECTIVECOLOR_FILTER 0 %define CONFIG_SENDCMD_FILTER 0 @@ -2571,6 +2582,7 @@ %define CONFIG_MXF_OPATOM_MUXER 0 %define CONFIG_NULL_MUXER 0 %define CONFIG_NUT_MUXER 0 +%define CONFIG_OBU_MUXER 0 %define CONFIG_OGA_MUXER 0 %define CONFIG_OGG_MUXER 0 %define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/win/x64/config.h b/chromium/third_party/ffmpeg/chromium/config/Chrome/win/x64/config.h index 8373db4acef..8edcdcbf1a7 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/win/x64/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/win/x64/config.h @@ -1,12 +1,12 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --toolchain=msvc --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/ffmpeg/chromium/include/win --target-os=win64 --enable-cross-compile --cc=clang-cl --ld=lld-link --nm=llvm-nm --ar=llvm-ar --extra-cflags=-O2 --extra-cflags=/winsysroot/not_workspace/liberato/release_chrome/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e --extra-ldflags='-libpath:/not_workspace/liberato/release_chrome/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/VC/Tools/MSVC/14.26.28801/atlmfc/lib/x64' --extra-ldflags='-libpath:/workspace/tmp/windows_build_ffmpeg_24b_S' --extra-ldflags='-libpath:/workspace/tmp/windows_build_ffmpegNkECDH' --extra-ldflags='-libpath:/not_workspace/liberato/release_chrome/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/VC/Tools/MSVC/14.26.28801/lib/x64' --enable-decoder='aac,h264' --enable-demuxer=aac --enable-parser='aac,h264'" -- elide long configuration string from binary */ +/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --toolchain=msvc --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/ffmpeg/chromium/include/win --target-os=win64 --enable-cross-compile --cc=clang-cl --ld=lld-link --nm=llvm-nm --ar=llvm-ar --extra-cflags=-O2 --extra-cflags=/winsysroot/usr/local/google/home/tguilbert/Code/chromium/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e --extra-ldflags='-libpath:/usr/local/google/home/tguilbert/Code/chromium/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/VC/Tools/MSVC/14.26.28801/atlmfc/lib/x64' --extra-ldflags='-libpath:/tmp/windows_build_ffmpeg7dIrkR' --extra-ldflags='-libpath:/tmp/windows_build_ffmpegho6ssp' --extra-ldflags='-libpath:/usr/local/google/home/tguilbert/Code/chromium/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/VC/Tools/MSVC/14.26.28801/lib/x64' --enable-decoder='aac,h264' --enable-demuxer=aac --enable-parser='aac,h264'" -- elide long configuration string from binary */ #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2021 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" #define AVCONV_DATADIR "/usr/local/share/ffmpeg" -#define CC_IDENT "clang version 13.0.0 (https://github.com/llvm/llvm-project/ f98ed74f6910f8b09e77497aeb30c860c433610d)" +#define CC_IDENT "clang version 14.0.0 (https://github.com/llvm/llvm-project/ 0e03450ae4358e8a8242b73d493d96efea9d3ccf)" #define OS_NAME win64 #define av_restrict restrict #define EXTERN_PREFIX "" @@ -1086,6 +1086,7 @@ #define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 +#define CONFIG_MSNSIREN_DECODER 0 #define CONFIG_NELLYMOSER_DECODER 0 #define CONFIG_ON2AVC_DECODER 0 #define CONFIG_OPUS_DECODER 0 @@ -1355,6 +1356,7 @@ #define CONFIG_RV20_ENCODER 0 #define CONFIG_S302M_ENCODER 0 #define CONFIG_SGI_ENCODER 0 +#define CONFIG_SMC_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_SPEEDHQ_ENCODER 0 #define CONFIG_SUNRAST_ENCODER 0 @@ -1678,6 +1680,7 @@ #define CONFIG_ACRUSHER_FILTER 0 #define CONFIG_ADECLICK_FILTER 0 #define CONFIG_ADECLIP_FILTER 0 +#define CONFIG_ADECORRELATE_FILTER 0 #define CONFIG_ADELAY_FILTER 0 #define CONFIG_ADENORM_FILTER 0 #define CONFIG_ADERIVATIVE_FILTER 0 @@ -1711,11 +1714,13 @@ #define CONFIG_APERMS_FILTER 0 #define CONFIG_APHASER_FILTER 0 #define CONFIG_APHASESHIFT_FILTER 0 +#define CONFIG_APSYCLIP_FILTER 0 #define CONFIG_APULSATOR_FILTER 0 #define CONFIG_AREALTIME_FILTER 0 #define CONFIG_ARESAMPLE_FILTER 0 #define CONFIG_AREVERSE_FILTER 0 #define CONFIG_ARNNDN_FILTER 0 +#define CONFIG_ASEGMENT_FILTER 0 #define CONFIG_ASELECT_FILTER 0 #define CONFIG_ASENDCMD_FILTER 0 #define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1735,6 +1740,7 @@ #define CONFIG_ASUPERPASS_FILTER 0 #define CONFIG_ASUPERSTOP_FILTER 0 #define CONFIG_ATEMPO_FILTER 0 +#define CONFIG_ATILT_FILTER 0 #define CONFIG_ATRIM_FILTER 0 #define CONFIG_AXCORRELATE_FILTER 0 #define CONFIG_AZMQ_FILTER 0 @@ -1913,6 +1919,7 @@ #define CONFIG_GEQ_FILTER 0 #define CONFIG_GRADFUN_FILTER 0 #define CONFIG_GRAPHMONITOR_FILTER 0 +#define CONFIG_GRAYWORLD_FILTER 0 #define CONFIG_GREYEDGE_FILTER 0 #define CONFIG_GUIDED_FILTER 0 #define CONFIG_HALDCLUT_FILTER 0 @@ -1922,6 +1929,8 @@ #define CONFIG_HQDN3D_FILTER 0 #define CONFIG_HQX_FILTER 0 #define CONFIG_HSTACK_FILTER 0 +#define CONFIG_HSVHOLD_FILTER 0 +#define CONFIG_HSVKEY_FILTER 0 #define CONFIG_HUE_FILTER 0 #define CONFIG_HWDOWNLOAD_FILTER 0 #define CONFIG_HWMAP_FILTER 0 @@ -2026,7 +2035,9 @@ #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCDET_FILTER 0 +#define CONFIG_SCHARR_FILTER 0 #define CONFIG_SCROLL_FILTER 0 +#define CONFIG_SEGMENT_FILTER 0 #define CONFIG_SELECT_FILTER 0 #define CONFIG_SELECTIVECOLOR_FILTER 0 #define CONFIG_SENDCMD_FILTER 0 @@ -2587,6 +2598,7 @@ #define CONFIG_MXF_OPATOM_MUXER 0 #define CONFIG_NULL_MUXER 0 #define CONFIG_NUT_MUXER 0 +#define CONFIG_OBU_MUXER 0 #define CONFIG_OGA_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/win/x64/libavutil/ffversion.h b/chromium/third_party/ffmpeg/chromium/config/Chrome/win/x64/libavutil/ffversion.h index d4ce7a4e6a7..f26e152f83f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/win/x64/libavutil/ffversion.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/win/x64/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "N-104195-g628f528751" +#define FFMPEG_VERSION "N-104707-g392d8a2d60" #endif /* AVUTIL_FFVERSION_H */ diff --git a/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux-noasm/x64/config.h b/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux-noasm/x64/config.h index 7fea798f87e..f9329fa52b0 100644 --- a/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux-noasm/x64/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux-noasm/x64/config.h @@ -1,12 +1,12 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --enable-lto --disable-asm --disable-inline-asm --enable-pic --cc=clang --cxx=clang++ --ld=clang --extra-ldflags='-fuse-ld=lld' --enable-decoder='aac,h264' --enable-demuxer=aac --enable-parser='aac,h264' --enable-decoder=mpeg4 --enable-parser='h263,mpeg4video' --enable-demuxer=avi --enable-demuxer=amr --enable-decoder='amrnb,amrwb' --enable-decoder=gsm_ms --enable-parser=gsm" -- elide long configuration string from binary */ +/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --enable-lto --disable-asm --disable-inline-asm --enable-pic --cc=clang --cxx=clang++ --ld=clang --extra-ldflags='-fuse-ld=lld' --enable-decoder='aac,h264' --enable-demuxer=aac --enable-parser='aac,h264' --enable-decoder=mpeg4 --enable-parser='h263,mpeg4video' --enable-demuxer=avi --enable-demuxer=amr --enable-decoder='amrnb,amrwb' --enable-decoder=gsm_ms --enable-parser=gsm" -- elide long configuration string from binary */ #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2021 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" #define AVCONV_DATADIR "/usr/local/share/ffmpeg" -#define CC_IDENT "clang version 13.0.0 (https://github.com/llvm/llvm-project/ f98ed74f6910f8b09e77497aeb30c860c433610d)" +#define CC_IDENT "clang version 14.0.0 (https://github.com/llvm/llvm-project/ 0e03450ae4358e8a8242b73d493d96efea9d3ccf)" #define OS_NAME linux #define av_restrict restrict #define EXTERN_PREFIX "" @@ -232,7 +232,7 @@ #define HAVE_TERMIOS_H 1 #define HAVE_UDPLITE_H 0 #define HAVE_UNISTD_H 1 -#define HAVE_VALGRIND_VALGRIND_H 0 /* #define HAVE_VALGRIND_VALGRIND_H 1 -- forced to 0. See https://crbug.com/590440 */ +#define HAVE_VALGRIND_VALGRIND_H 0 /* #define HAVE_VALGRIND_VALGRIND_H 0 -- forced to 0. See https://crbug.com/590440 */ #define HAVE_WINDOWS_H 0 #define HAVE_WINSOCK2_H 0 #define HAVE_INTRINSICS_NEON 0 @@ -1086,6 +1086,7 @@ #define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 +#define CONFIG_MSNSIREN_DECODER 0 #define CONFIG_NELLYMOSER_DECODER 0 #define CONFIG_ON2AVC_DECODER 0 #define CONFIG_OPUS_DECODER 0 @@ -1355,6 +1356,7 @@ #define CONFIG_RV20_ENCODER 0 #define CONFIG_S302M_ENCODER 0 #define CONFIG_SGI_ENCODER 0 +#define CONFIG_SMC_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_SPEEDHQ_ENCODER 0 #define CONFIG_SUNRAST_ENCODER 0 @@ -1678,6 +1680,7 @@ #define CONFIG_ACRUSHER_FILTER 0 #define CONFIG_ADECLICK_FILTER 0 #define CONFIG_ADECLIP_FILTER 0 +#define CONFIG_ADECORRELATE_FILTER 0 #define CONFIG_ADELAY_FILTER 0 #define CONFIG_ADENORM_FILTER 0 #define CONFIG_ADERIVATIVE_FILTER 0 @@ -1711,11 +1714,13 @@ #define CONFIG_APERMS_FILTER 0 #define CONFIG_APHASER_FILTER 0 #define CONFIG_APHASESHIFT_FILTER 0 +#define CONFIG_APSYCLIP_FILTER 0 #define CONFIG_APULSATOR_FILTER 0 #define CONFIG_AREALTIME_FILTER 0 #define CONFIG_ARESAMPLE_FILTER 0 #define CONFIG_AREVERSE_FILTER 0 #define CONFIG_ARNNDN_FILTER 0 +#define CONFIG_ASEGMENT_FILTER 0 #define CONFIG_ASELECT_FILTER 0 #define CONFIG_ASENDCMD_FILTER 0 #define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1735,6 +1740,7 @@ #define CONFIG_ASUPERPASS_FILTER 0 #define CONFIG_ASUPERSTOP_FILTER 0 #define CONFIG_ATEMPO_FILTER 0 +#define CONFIG_ATILT_FILTER 0 #define CONFIG_ATRIM_FILTER 0 #define CONFIG_AXCORRELATE_FILTER 0 #define CONFIG_AZMQ_FILTER 0 @@ -1913,6 +1919,7 @@ #define CONFIG_GEQ_FILTER 0 #define CONFIG_GRADFUN_FILTER 0 #define CONFIG_GRAPHMONITOR_FILTER 0 +#define CONFIG_GRAYWORLD_FILTER 0 #define CONFIG_GREYEDGE_FILTER 0 #define CONFIG_GUIDED_FILTER 0 #define CONFIG_HALDCLUT_FILTER 0 @@ -1922,6 +1929,8 @@ #define CONFIG_HQDN3D_FILTER 0 #define CONFIG_HQX_FILTER 0 #define CONFIG_HSTACK_FILTER 0 +#define CONFIG_HSVHOLD_FILTER 0 +#define CONFIG_HSVKEY_FILTER 0 #define CONFIG_HUE_FILTER 0 #define CONFIG_HWDOWNLOAD_FILTER 0 #define CONFIG_HWMAP_FILTER 0 @@ -2026,7 +2035,9 @@ #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCDET_FILTER 0 +#define CONFIG_SCHARR_FILTER 0 #define CONFIG_SCROLL_FILTER 0 +#define CONFIG_SEGMENT_FILTER 0 #define CONFIG_SELECT_FILTER 0 #define CONFIG_SELECTIVECOLOR_FILTER 0 #define CONFIG_SENDCMD_FILTER 0 @@ -2587,6 +2598,7 @@ #define CONFIG_MXF_OPATOM_MUXER 0 #define CONFIG_NULL_MUXER 0 #define CONFIG_NUT_MUXER 0 +#define CONFIG_OBU_MUXER 0 #define CONFIG_OGA_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux-noasm/x64/libavutil/ffversion.h b/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux-noasm/x64/libavutil/ffversion.h index d4ce7a4e6a7..f26e152f83f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux-noasm/x64/libavutil/ffversion.h +++ b/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux-noasm/x64/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "N-104195-g628f528751" +#define FFMPEG_VERSION "N-104707-g392d8a2d60" #endif /* AVUTIL_FFVERSION_H */ diff --git a/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/arm-neon/config.h b/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/arm-neon/config.h index 246659235ae..ab37ecc1899 100644 --- a/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/arm-neon/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/arm-neon/config.h @@ -1,12 +1,12 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --arch=arm --enable-armv6 --enable-armv6t2 --enable-vfp --enable-thumb --extra-cflags='-march=armv7-a' --enable-cross-compile --target-os=linux --extra-cflags='--target=arm-linux-gnueabihf' --extra-ldflags='--target=arm-linux-gnueabihf' --sysroot=/not_workspace/liberato/release_chrome/src/build/linux/debian_sid_arm-sysroot --extra-cflags='-mtune=cortex-a8' --extra-cflags='-mfloat-abi=hard' --extra-cflags=-O2 --enable-neon --extra-cflags='-mfpu=neon' --enable-pic --cc=clang --cxx=clang++ --ld=clang --extra-ldflags='-fuse-ld=lld' --enable-decoder='aac,h264' --enable-demuxer=aac --enable-parser='aac,h264' --enable-decoder=mpeg4 --enable-parser='h263,mpeg4video' --enable-demuxer=avi --enable-demuxer=amr --enable-decoder='amrnb,amrwb' --enable-decoder=gsm_ms --enable-parser=gsm" -- elide long configuration string from binary */ +/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --arch=arm --enable-armv6 --enable-armv6t2 --enable-vfp --enable-thumb --extra-cflags='-march=armv7-a' --enable-cross-compile --target-os=linux --extra-cflags='--target=arm-linux-gnueabihf' --extra-ldflags='--target=arm-linux-gnueabihf' --sysroot=/usr/local/google/home/tguilbert/Code/chromium/src/build/linux/debian_sid_arm-sysroot --extra-cflags='-mtune=cortex-a8' --extra-cflags='-mfloat-abi=hard' --extra-cflags=-O2 --enable-neon --extra-cflags='-mfpu=neon' --enable-pic --cc=clang --cxx=clang++ --ld=clang --extra-ldflags='-fuse-ld=lld' --enable-decoder='aac,h264' --enable-demuxer=aac --enable-parser='aac,h264' --enable-decoder=mpeg4 --enable-parser='h263,mpeg4video' --enable-demuxer=avi --enable-demuxer=amr --enable-decoder='amrnb,amrwb' --enable-decoder=gsm_ms --enable-parser=gsm" -- elide long configuration string from binary */ #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2021 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" #define AVCONV_DATADIR "/usr/local/share/ffmpeg" -#define CC_IDENT "clang version 13.0.0 (https://github.com/llvm/llvm-project/ f98ed74f6910f8b09e77497aeb30c860c433610d)" +#define CC_IDENT "clang version 14.0.0 (https://github.com/llvm/llvm-project/ 0e03450ae4358e8a8242b73d493d96efea9d3ccf)" #define OS_NAME linux #define av_restrict restrict #define EXTERN_PREFIX "" @@ -1086,6 +1086,7 @@ #define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 +#define CONFIG_MSNSIREN_DECODER 0 #define CONFIG_NELLYMOSER_DECODER 0 #define CONFIG_ON2AVC_DECODER 0 #define CONFIG_OPUS_DECODER 0 @@ -1355,6 +1356,7 @@ #define CONFIG_RV20_ENCODER 0 #define CONFIG_S302M_ENCODER 0 #define CONFIG_SGI_ENCODER 0 +#define CONFIG_SMC_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_SPEEDHQ_ENCODER 0 #define CONFIG_SUNRAST_ENCODER 0 @@ -1678,6 +1680,7 @@ #define CONFIG_ACRUSHER_FILTER 0 #define CONFIG_ADECLICK_FILTER 0 #define CONFIG_ADECLIP_FILTER 0 +#define CONFIG_ADECORRELATE_FILTER 0 #define CONFIG_ADELAY_FILTER 0 #define CONFIG_ADENORM_FILTER 0 #define CONFIG_ADERIVATIVE_FILTER 0 @@ -1711,11 +1714,13 @@ #define CONFIG_APERMS_FILTER 0 #define CONFIG_APHASER_FILTER 0 #define CONFIG_APHASESHIFT_FILTER 0 +#define CONFIG_APSYCLIP_FILTER 0 #define CONFIG_APULSATOR_FILTER 0 #define CONFIG_AREALTIME_FILTER 0 #define CONFIG_ARESAMPLE_FILTER 0 #define CONFIG_AREVERSE_FILTER 0 #define CONFIG_ARNNDN_FILTER 0 +#define CONFIG_ASEGMENT_FILTER 0 #define CONFIG_ASELECT_FILTER 0 #define CONFIG_ASENDCMD_FILTER 0 #define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1735,6 +1740,7 @@ #define CONFIG_ASUPERPASS_FILTER 0 #define CONFIG_ASUPERSTOP_FILTER 0 #define CONFIG_ATEMPO_FILTER 0 +#define CONFIG_ATILT_FILTER 0 #define CONFIG_ATRIM_FILTER 0 #define CONFIG_AXCORRELATE_FILTER 0 #define CONFIG_AZMQ_FILTER 0 @@ -1913,6 +1919,7 @@ #define CONFIG_GEQ_FILTER 0 #define CONFIG_GRADFUN_FILTER 0 #define CONFIG_GRAPHMONITOR_FILTER 0 +#define CONFIG_GRAYWORLD_FILTER 0 #define CONFIG_GREYEDGE_FILTER 0 #define CONFIG_GUIDED_FILTER 0 #define CONFIG_HALDCLUT_FILTER 0 @@ -1922,6 +1929,8 @@ #define CONFIG_HQDN3D_FILTER 0 #define CONFIG_HQX_FILTER 0 #define CONFIG_HSTACK_FILTER 0 +#define CONFIG_HSVHOLD_FILTER 0 +#define CONFIG_HSVKEY_FILTER 0 #define CONFIG_HUE_FILTER 0 #define CONFIG_HWDOWNLOAD_FILTER 0 #define CONFIG_HWMAP_FILTER 0 @@ -2026,7 +2035,9 @@ #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCDET_FILTER 0 +#define CONFIG_SCHARR_FILTER 0 #define CONFIG_SCROLL_FILTER 0 +#define CONFIG_SEGMENT_FILTER 0 #define CONFIG_SELECT_FILTER 0 #define CONFIG_SELECTIVECOLOR_FILTER 0 #define CONFIG_SENDCMD_FILTER 0 @@ -2587,6 +2598,7 @@ #define CONFIG_MXF_OPATOM_MUXER 0 #define CONFIG_NULL_MUXER 0 #define CONFIG_NUT_MUXER 0 +#define CONFIG_OBU_MUXER 0 #define CONFIG_OGA_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/arm-neon/libavutil/ffversion.h b/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/arm-neon/libavutil/ffversion.h index d4ce7a4e6a7..f26e152f83f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/arm-neon/libavutil/ffversion.h +++ b/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/arm-neon/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "N-104195-g628f528751" +#define FFMPEG_VERSION "N-104707-g392d8a2d60" #endif /* AVUTIL_FFVERSION_H */ diff --git a/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/arm/config.h b/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/arm/config.h index 2b7dc3df5be..38f711cce12 100644 --- a/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/arm/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/arm/config.h @@ -1,12 +1,12 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --arch=arm --enable-armv6 --enable-armv6t2 --enable-vfp --enable-thumb --extra-cflags='-march=armv7-a' --enable-cross-compile --target-os=linux --extra-cflags='--target=arm-linux-gnueabihf' --extra-ldflags='--target=arm-linux-gnueabihf' --sysroot=/not_workspace/liberato/release_chrome/src/build/linux/debian_sid_arm-sysroot --extra-cflags='-mtune=cortex-a8' --extra-cflags='-mfloat-abi=hard' --extra-cflags=-O2 --disable-neon --extra-cflags='-mfpu=vfpv3-d16' --enable-pic --cc=clang --cxx=clang++ --ld=clang --extra-ldflags='-fuse-ld=lld' --enable-decoder='aac,h264' --enable-demuxer=aac --enable-parser='aac,h264' --enable-decoder=mpeg4 --enable-parser='h263,mpeg4video' --enable-demuxer=avi --enable-demuxer=amr --enable-decoder='amrnb,amrwb' --enable-decoder=gsm_ms --enable-parser=gsm" -- elide long configuration string from binary */ +/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --arch=arm --enable-armv6 --enable-armv6t2 --enable-vfp --enable-thumb --extra-cflags='-march=armv7-a' --enable-cross-compile --target-os=linux --extra-cflags='--target=arm-linux-gnueabihf' --extra-ldflags='--target=arm-linux-gnueabihf' --sysroot=/usr/local/google/home/tguilbert/Code/chromium/src/build/linux/debian_sid_arm-sysroot --extra-cflags='-mtune=cortex-a8' --extra-cflags='-mfloat-abi=hard' --extra-cflags=-O2 --disable-neon --extra-cflags='-mfpu=vfpv3-d16' --enable-pic --cc=clang --cxx=clang++ --ld=clang --extra-ldflags='-fuse-ld=lld' --enable-decoder='aac,h264' --enable-demuxer=aac --enable-parser='aac,h264' --enable-decoder=mpeg4 --enable-parser='h263,mpeg4video' --enable-demuxer=avi --enable-demuxer=amr --enable-decoder='amrnb,amrwb' --enable-decoder=gsm_ms --enable-parser=gsm" -- elide long configuration string from binary */ #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2021 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" #define AVCONV_DATADIR "/usr/local/share/ffmpeg" -#define CC_IDENT "clang version 13.0.0 (https://github.com/llvm/llvm-project/ f98ed74f6910f8b09e77497aeb30c860c433610d)" +#define CC_IDENT "clang version 14.0.0 (https://github.com/llvm/llvm-project/ 0e03450ae4358e8a8242b73d493d96efea9d3ccf)" #define OS_NAME linux #define av_restrict restrict #define EXTERN_PREFIX "" @@ -1086,6 +1086,7 @@ #define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 +#define CONFIG_MSNSIREN_DECODER 0 #define CONFIG_NELLYMOSER_DECODER 0 #define CONFIG_ON2AVC_DECODER 0 #define CONFIG_OPUS_DECODER 0 @@ -1355,6 +1356,7 @@ #define CONFIG_RV20_ENCODER 0 #define CONFIG_S302M_ENCODER 0 #define CONFIG_SGI_ENCODER 0 +#define CONFIG_SMC_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_SPEEDHQ_ENCODER 0 #define CONFIG_SUNRAST_ENCODER 0 @@ -1678,6 +1680,7 @@ #define CONFIG_ACRUSHER_FILTER 0 #define CONFIG_ADECLICK_FILTER 0 #define CONFIG_ADECLIP_FILTER 0 +#define CONFIG_ADECORRELATE_FILTER 0 #define CONFIG_ADELAY_FILTER 0 #define CONFIG_ADENORM_FILTER 0 #define CONFIG_ADERIVATIVE_FILTER 0 @@ -1711,11 +1714,13 @@ #define CONFIG_APERMS_FILTER 0 #define CONFIG_APHASER_FILTER 0 #define CONFIG_APHASESHIFT_FILTER 0 +#define CONFIG_APSYCLIP_FILTER 0 #define CONFIG_APULSATOR_FILTER 0 #define CONFIG_AREALTIME_FILTER 0 #define CONFIG_ARESAMPLE_FILTER 0 #define CONFIG_AREVERSE_FILTER 0 #define CONFIG_ARNNDN_FILTER 0 +#define CONFIG_ASEGMENT_FILTER 0 #define CONFIG_ASELECT_FILTER 0 #define CONFIG_ASENDCMD_FILTER 0 #define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1735,6 +1740,7 @@ #define CONFIG_ASUPERPASS_FILTER 0 #define CONFIG_ASUPERSTOP_FILTER 0 #define CONFIG_ATEMPO_FILTER 0 +#define CONFIG_ATILT_FILTER 0 #define CONFIG_ATRIM_FILTER 0 #define CONFIG_AXCORRELATE_FILTER 0 #define CONFIG_AZMQ_FILTER 0 @@ -1913,6 +1919,7 @@ #define CONFIG_GEQ_FILTER 0 #define CONFIG_GRADFUN_FILTER 0 #define CONFIG_GRAPHMONITOR_FILTER 0 +#define CONFIG_GRAYWORLD_FILTER 0 #define CONFIG_GREYEDGE_FILTER 0 #define CONFIG_GUIDED_FILTER 0 #define CONFIG_HALDCLUT_FILTER 0 @@ -1922,6 +1929,8 @@ #define CONFIG_HQDN3D_FILTER 0 #define CONFIG_HQX_FILTER 0 #define CONFIG_HSTACK_FILTER 0 +#define CONFIG_HSVHOLD_FILTER 0 +#define CONFIG_HSVKEY_FILTER 0 #define CONFIG_HUE_FILTER 0 #define CONFIG_HWDOWNLOAD_FILTER 0 #define CONFIG_HWMAP_FILTER 0 @@ -2026,7 +2035,9 @@ #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCDET_FILTER 0 +#define CONFIG_SCHARR_FILTER 0 #define CONFIG_SCROLL_FILTER 0 +#define CONFIG_SEGMENT_FILTER 0 #define CONFIG_SELECT_FILTER 0 #define CONFIG_SELECTIVECOLOR_FILTER 0 #define CONFIG_SENDCMD_FILTER 0 @@ -2587,6 +2598,7 @@ #define CONFIG_MXF_OPATOM_MUXER 0 #define CONFIG_NULL_MUXER 0 #define CONFIG_NUT_MUXER 0 +#define CONFIG_OBU_MUXER 0 #define CONFIG_OGA_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/arm/libavutil/ffversion.h b/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/arm/libavutil/ffversion.h index d4ce7a4e6a7..f26e152f83f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/arm/libavutil/ffversion.h +++ b/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/arm/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "N-104195-g628f528751" +#define FFMPEG_VERSION "N-104707-g392d8a2d60" #endif /* AVUTIL_FFVERSION_H */ diff --git a/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/arm64/config.h b/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/arm64/config.h index 312d4263db0..a3c48034b26 100644 --- a/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/arm64/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/arm64/config.h @@ -1,12 +1,12 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --enable-cross-compile --cross-prefix=/usr/bin/aarch64-linux-gnu- --target-os=linux --extra-cflags='--target=aarch64-linux-gnu' --extra-ldflags='--target=aarch64-linux-gnu' --sysroot=/not_workspace/liberato/release_chrome/src/build/linux/debian_sid_arm64-sysroot --arch=aarch64 --enable-armv8 --extra-cflags='-march=armv8-a' --enable-pic --cc=clang --cxx=clang++ --ld=clang --extra-ldflags='-fuse-ld=lld' --enable-decoder='aac,h264' --enable-demuxer=aac --enable-parser='aac,h264' --enable-decoder=mpeg4 --enable-parser='h263,mpeg4video' --enable-demuxer=avi --enable-demuxer=amr --enable-decoder='amrnb,amrwb' --enable-decoder=gsm_ms --enable-parser=gsm" -- elide long configuration string from binary */ +/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --enable-cross-compile --cross-prefix=/usr/bin/aarch64-linux-gnu- --target-os=linux --extra-cflags='--target=aarch64-linux-gnu' --extra-ldflags='--target=aarch64-linux-gnu' --sysroot=/usr/local/google/home/tguilbert/Code/chromium/src/build/linux/debian_sid_arm64-sysroot --arch=aarch64 --enable-armv8 --extra-cflags='-march=armv8-a' --enable-pic --cc=clang --cxx=clang++ --ld=clang --extra-ldflags='-fuse-ld=lld' --enable-decoder='aac,h264' --enable-demuxer=aac --enable-parser='aac,h264' --enable-decoder=mpeg4 --enable-parser='h263,mpeg4video' --enable-demuxer=avi --enable-demuxer=amr --enable-decoder='amrnb,amrwb' --enable-decoder=gsm_ms --enable-parser=gsm" -- elide long configuration string from binary */ #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2021 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" #define AVCONV_DATADIR "/usr/local/share/ffmpeg" -#define CC_IDENT "clang version 13.0.0 (https://github.com/llvm/llvm-project/ f98ed74f6910f8b09e77497aeb30c860c433610d)" +#define CC_IDENT "clang version 14.0.0 (https://github.com/llvm/llvm-project/ 0e03450ae4358e8a8242b73d493d96efea9d3ccf)" #define OS_NAME linux #define av_restrict restrict #define EXTERN_PREFIX "" @@ -1086,6 +1086,7 @@ #define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 +#define CONFIG_MSNSIREN_DECODER 0 #define CONFIG_NELLYMOSER_DECODER 0 #define CONFIG_ON2AVC_DECODER 0 #define CONFIG_OPUS_DECODER 0 @@ -1355,6 +1356,7 @@ #define CONFIG_RV20_ENCODER 0 #define CONFIG_S302M_ENCODER 0 #define CONFIG_SGI_ENCODER 0 +#define CONFIG_SMC_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_SPEEDHQ_ENCODER 0 #define CONFIG_SUNRAST_ENCODER 0 @@ -1678,6 +1680,7 @@ #define CONFIG_ACRUSHER_FILTER 0 #define CONFIG_ADECLICK_FILTER 0 #define CONFIG_ADECLIP_FILTER 0 +#define CONFIG_ADECORRELATE_FILTER 0 #define CONFIG_ADELAY_FILTER 0 #define CONFIG_ADENORM_FILTER 0 #define CONFIG_ADERIVATIVE_FILTER 0 @@ -1711,11 +1714,13 @@ #define CONFIG_APERMS_FILTER 0 #define CONFIG_APHASER_FILTER 0 #define CONFIG_APHASESHIFT_FILTER 0 +#define CONFIG_APSYCLIP_FILTER 0 #define CONFIG_APULSATOR_FILTER 0 #define CONFIG_AREALTIME_FILTER 0 #define CONFIG_ARESAMPLE_FILTER 0 #define CONFIG_AREVERSE_FILTER 0 #define CONFIG_ARNNDN_FILTER 0 +#define CONFIG_ASEGMENT_FILTER 0 #define CONFIG_ASELECT_FILTER 0 #define CONFIG_ASENDCMD_FILTER 0 #define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1735,6 +1740,7 @@ #define CONFIG_ASUPERPASS_FILTER 0 #define CONFIG_ASUPERSTOP_FILTER 0 #define CONFIG_ATEMPO_FILTER 0 +#define CONFIG_ATILT_FILTER 0 #define CONFIG_ATRIM_FILTER 0 #define CONFIG_AXCORRELATE_FILTER 0 #define CONFIG_AZMQ_FILTER 0 @@ -1913,6 +1919,7 @@ #define CONFIG_GEQ_FILTER 0 #define CONFIG_GRADFUN_FILTER 0 #define CONFIG_GRAPHMONITOR_FILTER 0 +#define CONFIG_GRAYWORLD_FILTER 0 #define CONFIG_GREYEDGE_FILTER 0 #define CONFIG_GUIDED_FILTER 0 #define CONFIG_HALDCLUT_FILTER 0 @@ -1922,6 +1929,8 @@ #define CONFIG_HQDN3D_FILTER 0 #define CONFIG_HQX_FILTER 0 #define CONFIG_HSTACK_FILTER 0 +#define CONFIG_HSVHOLD_FILTER 0 +#define CONFIG_HSVKEY_FILTER 0 #define CONFIG_HUE_FILTER 0 #define CONFIG_HWDOWNLOAD_FILTER 0 #define CONFIG_HWMAP_FILTER 0 @@ -2026,7 +2035,9 @@ #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCDET_FILTER 0 +#define CONFIG_SCHARR_FILTER 0 #define CONFIG_SCROLL_FILTER 0 +#define CONFIG_SEGMENT_FILTER 0 #define CONFIG_SELECT_FILTER 0 #define CONFIG_SELECTIVECOLOR_FILTER 0 #define CONFIG_SENDCMD_FILTER 0 @@ -2587,6 +2598,7 @@ #define CONFIG_MXF_OPATOM_MUXER 0 #define CONFIG_NULL_MUXER 0 #define CONFIG_NUT_MUXER 0 +#define CONFIG_OBU_MUXER 0 #define CONFIG_OGA_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/arm64/libavutil/ffversion.h b/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/arm64/libavutil/ffversion.h index d4ce7a4e6a7..f26e152f83f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/arm64/libavutil/ffversion.h +++ b/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/arm64/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "N-104195-g628f528751" +#define FFMPEG_VERSION "N-104707-g392d8a2d60" #endif /* AVUTIL_FFVERSION_H */ diff --git a/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/ia32/config.asm b/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/ia32/config.asm index 98b27fd9abe..33245a245d5 100644 --- a/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/ia32/config.asm +++ b/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/ia32/config.asm @@ -216,7 +216,7 @@ %define HAVE_TERMIOS_H 1 %define HAVE_UDPLITE_H 0 %define HAVE_UNISTD_H 1 -%define HAVE_VALGRIND_VALGRIND_H 0 ; %define HAVE_VALGRIND_VALGRIND_H 1 -- forced to 0. See https://crbug.com/590440 +%define HAVE_VALGRIND_VALGRIND_H 0 ; %define HAVE_VALGRIND_VALGRIND_H 0 -- forced to 0. See https://crbug.com/590440 %define HAVE_WINDOWS_H 0 %define HAVE_WINSOCK2_H 0 %define HAVE_INTRINSICS_NEON 0 @@ -1070,6 +1070,7 @@ %define CONFIG_MP3ON4_DECODER 0 %define CONFIG_MPC7_DECODER 0 %define CONFIG_MPC8_DECODER 0 +%define CONFIG_MSNSIREN_DECODER 0 %define CONFIG_NELLYMOSER_DECODER 0 %define CONFIG_ON2AVC_DECODER 0 %define CONFIG_OPUS_DECODER 0 @@ -1339,6 +1340,7 @@ %define CONFIG_RV20_ENCODER 0 %define CONFIG_S302M_ENCODER 0 %define CONFIG_SGI_ENCODER 0 +%define CONFIG_SMC_ENCODER 0 %define CONFIG_SNOW_ENCODER 0 %define CONFIG_SPEEDHQ_ENCODER 0 %define CONFIG_SUNRAST_ENCODER 0 @@ -1662,6 +1664,7 @@ %define CONFIG_ACRUSHER_FILTER 0 %define CONFIG_ADECLICK_FILTER 0 %define CONFIG_ADECLIP_FILTER 0 +%define CONFIG_ADECORRELATE_FILTER 0 %define CONFIG_ADELAY_FILTER 0 %define CONFIG_ADENORM_FILTER 0 %define CONFIG_ADERIVATIVE_FILTER 0 @@ -1695,11 +1698,13 @@ %define CONFIG_APERMS_FILTER 0 %define CONFIG_APHASER_FILTER 0 %define CONFIG_APHASESHIFT_FILTER 0 +%define CONFIG_APSYCLIP_FILTER 0 %define CONFIG_APULSATOR_FILTER 0 %define CONFIG_AREALTIME_FILTER 0 %define CONFIG_ARESAMPLE_FILTER 0 %define CONFIG_AREVERSE_FILTER 0 %define CONFIG_ARNNDN_FILTER 0 +%define CONFIG_ASEGMENT_FILTER 0 %define CONFIG_ASELECT_FILTER 0 %define CONFIG_ASENDCMD_FILTER 0 %define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1719,6 +1724,7 @@ %define CONFIG_ASUPERPASS_FILTER 0 %define CONFIG_ASUPERSTOP_FILTER 0 %define CONFIG_ATEMPO_FILTER 0 +%define CONFIG_ATILT_FILTER 0 %define CONFIG_ATRIM_FILTER 0 %define CONFIG_AXCORRELATE_FILTER 0 %define CONFIG_AZMQ_FILTER 0 @@ -1897,6 +1903,7 @@ %define CONFIG_GEQ_FILTER 0 %define CONFIG_GRADFUN_FILTER 0 %define CONFIG_GRAPHMONITOR_FILTER 0 +%define CONFIG_GRAYWORLD_FILTER 0 %define CONFIG_GREYEDGE_FILTER 0 %define CONFIG_GUIDED_FILTER 0 %define CONFIG_HALDCLUT_FILTER 0 @@ -1906,6 +1913,8 @@ %define CONFIG_HQDN3D_FILTER 0 %define CONFIG_HQX_FILTER 0 %define CONFIG_HSTACK_FILTER 0 +%define CONFIG_HSVHOLD_FILTER 0 +%define CONFIG_HSVKEY_FILTER 0 %define CONFIG_HUE_FILTER 0 %define CONFIG_HWDOWNLOAD_FILTER 0 %define CONFIG_HWMAP_FILTER 0 @@ -2010,7 +2019,9 @@ %define CONFIG_SCALE_VULKAN_FILTER 0 %define CONFIG_SCALE2REF_FILTER 0 %define CONFIG_SCDET_FILTER 0 +%define CONFIG_SCHARR_FILTER 0 %define CONFIG_SCROLL_FILTER 0 +%define CONFIG_SEGMENT_FILTER 0 %define CONFIG_SELECT_FILTER 0 %define CONFIG_SELECTIVECOLOR_FILTER 0 %define CONFIG_SENDCMD_FILTER 0 @@ -2571,6 +2582,7 @@ %define CONFIG_MXF_OPATOM_MUXER 0 %define CONFIG_NULL_MUXER 0 %define CONFIG_NUT_MUXER 0 +%define CONFIG_OBU_MUXER 0 %define CONFIG_OGA_MUXER 0 %define CONFIG_OGG_MUXER 0 %define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/ia32/config.h b/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/ia32/config.h index 0d3110c808a..1427cefbb03 100644 --- a/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/ia32/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/ia32/config.h @@ -1,12 +1,12 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --arch=i686 --extra-cflags='\"-m32\"' --extra-ldflags='\"-m32\"' --enable-pic --cc=clang --cxx=clang++ --ld=clang --enable-decoder='aac,h264' --enable-demuxer=aac --enable-parser='aac,h264' --enable-decoder=mpeg4 --enable-parser='h263,mpeg4video' --enable-demuxer=avi --enable-demuxer=amr --enable-decoder='amrnb,amrwb' --enable-decoder=gsm_ms --enable-parser=gsm" -- elide long configuration string from binary */ +/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --arch=i686 --extra-cflags='\"-m32\"' --extra-ldflags='\"-m32\"' --enable-pic --cc=clang --cxx=clang++ --ld=clang --enable-decoder='aac,h264' --enable-demuxer=aac --enable-parser='aac,h264' --enable-decoder=mpeg4 --enable-parser='h263,mpeg4video' --enable-demuxer=avi --enable-demuxer=amr --enable-decoder='amrnb,amrwb' --enable-decoder=gsm_ms --enable-parser=gsm" -- elide long configuration string from binary */ #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2021 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" #define AVCONV_DATADIR "/usr/local/share/ffmpeg" -#define CC_IDENT "clang version 13.0.0 (https://github.com/llvm/llvm-project/ f98ed74f6910f8b09e77497aeb30c860c433610d)" +#define CC_IDENT "clang version 14.0.0 (https://github.com/llvm/llvm-project/ 0e03450ae4358e8a8242b73d493d96efea9d3ccf)" #define OS_NAME linux #define av_restrict restrict #define EXTERN_PREFIX "" @@ -232,7 +232,7 @@ #define HAVE_TERMIOS_H 1 #define HAVE_UDPLITE_H 0 #define HAVE_UNISTD_H 1 -#define HAVE_VALGRIND_VALGRIND_H 0 /* #define HAVE_VALGRIND_VALGRIND_H 1 -- forced to 0. See https://crbug.com/590440 */ +#define HAVE_VALGRIND_VALGRIND_H 0 /* #define HAVE_VALGRIND_VALGRIND_H 0 -- forced to 0. See https://crbug.com/590440 */ #define HAVE_WINDOWS_H 0 #define HAVE_WINSOCK2_H 0 #define HAVE_INTRINSICS_NEON 0 @@ -1086,6 +1086,7 @@ #define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 +#define CONFIG_MSNSIREN_DECODER 0 #define CONFIG_NELLYMOSER_DECODER 0 #define CONFIG_ON2AVC_DECODER 0 #define CONFIG_OPUS_DECODER 0 @@ -1355,6 +1356,7 @@ #define CONFIG_RV20_ENCODER 0 #define CONFIG_S302M_ENCODER 0 #define CONFIG_SGI_ENCODER 0 +#define CONFIG_SMC_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_SPEEDHQ_ENCODER 0 #define CONFIG_SUNRAST_ENCODER 0 @@ -1678,6 +1680,7 @@ #define CONFIG_ACRUSHER_FILTER 0 #define CONFIG_ADECLICK_FILTER 0 #define CONFIG_ADECLIP_FILTER 0 +#define CONFIG_ADECORRELATE_FILTER 0 #define CONFIG_ADELAY_FILTER 0 #define CONFIG_ADENORM_FILTER 0 #define CONFIG_ADERIVATIVE_FILTER 0 @@ -1711,11 +1714,13 @@ #define CONFIG_APERMS_FILTER 0 #define CONFIG_APHASER_FILTER 0 #define CONFIG_APHASESHIFT_FILTER 0 +#define CONFIG_APSYCLIP_FILTER 0 #define CONFIG_APULSATOR_FILTER 0 #define CONFIG_AREALTIME_FILTER 0 #define CONFIG_ARESAMPLE_FILTER 0 #define CONFIG_AREVERSE_FILTER 0 #define CONFIG_ARNNDN_FILTER 0 +#define CONFIG_ASEGMENT_FILTER 0 #define CONFIG_ASELECT_FILTER 0 #define CONFIG_ASENDCMD_FILTER 0 #define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1735,6 +1740,7 @@ #define CONFIG_ASUPERPASS_FILTER 0 #define CONFIG_ASUPERSTOP_FILTER 0 #define CONFIG_ATEMPO_FILTER 0 +#define CONFIG_ATILT_FILTER 0 #define CONFIG_ATRIM_FILTER 0 #define CONFIG_AXCORRELATE_FILTER 0 #define CONFIG_AZMQ_FILTER 0 @@ -1913,6 +1919,7 @@ #define CONFIG_GEQ_FILTER 0 #define CONFIG_GRADFUN_FILTER 0 #define CONFIG_GRAPHMONITOR_FILTER 0 +#define CONFIG_GRAYWORLD_FILTER 0 #define CONFIG_GREYEDGE_FILTER 0 #define CONFIG_GUIDED_FILTER 0 #define CONFIG_HALDCLUT_FILTER 0 @@ -1922,6 +1929,8 @@ #define CONFIG_HQDN3D_FILTER 0 #define CONFIG_HQX_FILTER 0 #define CONFIG_HSTACK_FILTER 0 +#define CONFIG_HSVHOLD_FILTER 0 +#define CONFIG_HSVKEY_FILTER 0 #define CONFIG_HUE_FILTER 0 #define CONFIG_HWDOWNLOAD_FILTER 0 #define CONFIG_HWMAP_FILTER 0 @@ -2026,7 +2035,9 @@ #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCDET_FILTER 0 +#define CONFIG_SCHARR_FILTER 0 #define CONFIG_SCROLL_FILTER 0 +#define CONFIG_SEGMENT_FILTER 0 #define CONFIG_SELECT_FILTER 0 #define CONFIG_SELECTIVECOLOR_FILTER 0 #define CONFIG_SENDCMD_FILTER 0 @@ -2587,6 +2598,7 @@ #define CONFIG_MXF_OPATOM_MUXER 0 #define CONFIG_NULL_MUXER 0 #define CONFIG_NUT_MUXER 0 +#define CONFIG_OBU_MUXER 0 #define CONFIG_OGA_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/ia32/libavutil/ffversion.h b/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/ia32/libavutil/ffversion.h index d4ce7a4e6a7..f26e152f83f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/ia32/libavutil/ffversion.h +++ b/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/ia32/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "N-104195-g628f528751" +#define FFMPEG_VERSION "N-104707-g392d8a2d60" #endif /* AVUTIL_FFVERSION_H */ diff --git a/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/x64/config.asm b/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/x64/config.asm index 9bf1fe4a44e..e6dac506fdd 100644 --- a/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/x64/config.asm +++ b/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/x64/config.asm @@ -216,7 +216,7 @@ %define HAVE_TERMIOS_H 1 %define HAVE_UDPLITE_H 0 %define HAVE_UNISTD_H 1 -%define HAVE_VALGRIND_VALGRIND_H 0 ; %define HAVE_VALGRIND_VALGRIND_H 1 -- forced to 0. See https://crbug.com/590440 +%define HAVE_VALGRIND_VALGRIND_H 0 ; %define HAVE_VALGRIND_VALGRIND_H 0 -- forced to 0. See https://crbug.com/590440 %define HAVE_WINDOWS_H 0 %define HAVE_WINSOCK2_H 0 %define HAVE_INTRINSICS_NEON 0 @@ -1070,6 +1070,7 @@ %define CONFIG_MP3ON4_DECODER 0 %define CONFIG_MPC7_DECODER 0 %define CONFIG_MPC8_DECODER 0 +%define CONFIG_MSNSIREN_DECODER 0 %define CONFIG_NELLYMOSER_DECODER 0 %define CONFIG_ON2AVC_DECODER 0 %define CONFIG_OPUS_DECODER 0 @@ -1339,6 +1340,7 @@ %define CONFIG_RV20_ENCODER 0 %define CONFIG_S302M_ENCODER 0 %define CONFIG_SGI_ENCODER 0 +%define CONFIG_SMC_ENCODER 0 %define CONFIG_SNOW_ENCODER 0 %define CONFIG_SPEEDHQ_ENCODER 0 %define CONFIG_SUNRAST_ENCODER 0 @@ -1662,6 +1664,7 @@ %define CONFIG_ACRUSHER_FILTER 0 %define CONFIG_ADECLICK_FILTER 0 %define CONFIG_ADECLIP_FILTER 0 +%define CONFIG_ADECORRELATE_FILTER 0 %define CONFIG_ADELAY_FILTER 0 %define CONFIG_ADENORM_FILTER 0 %define CONFIG_ADERIVATIVE_FILTER 0 @@ -1695,11 +1698,13 @@ %define CONFIG_APERMS_FILTER 0 %define CONFIG_APHASER_FILTER 0 %define CONFIG_APHASESHIFT_FILTER 0 +%define CONFIG_APSYCLIP_FILTER 0 %define CONFIG_APULSATOR_FILTER 0 %define CONFIG_AREALTIME_FILTER 0 %define CONFIG_ARESAMPLE_FILTER 0 %define CONFIG_AREVERSE_FILTER 0 %define CONFIG_ARNNDN_FILTER 0 +%define CONFIG_ASEGMENT_FILTER 0 %define CONFIG_ASELECT_FILTER 0 %define CONFIG_ASENDCMD_FILTER 0 %define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1719,6 +1724,7 @@ %define CONFIG_ASUPERPASS_FILTER 0 %define CONFIG_ASUPERSTOP_FILTER 0 %define CONFIG_ATEMPO_FILTER 0 +%define CONFIG_ATILT_FILTER 0 %define CONFIG_ATRIM_FILTER 0 %define CONFIG_AXCORRELATE_FILTER 0 %define CONFIG_AZMQ_FILTER 0 @@ -1897,6 +1903,7 @@ %define CONFIG_GEQ_FILTER 0 %define CONFIG_GRADFUN_FILTER 0 %define CONFIG_GRAPHMONITOR_FILTER 0 +%define CONFIG_GRAYWORLD_FILTER 0 %define CONFIG_GREYEDGE_FILTER 0 %define CONFIG_GUIDED_FILTER 0 %define CONFIG_HALDCLUT_FILTER 0 @@ -1906,6 +1913,8 @@ %define CONFIG_HQDN3D_FILTER 0 %define CONFIG_HQX_FILTER 0 %define CONFIG_HSTACK_FILTER 0 +%define CONFIG_HSVHOLD_FILTER 0 +%define CONFIG_HSVKEY_FILTER 0 %define CONFIG_HUE_FILTER 0 %define CONFIG_HWDOWNLOAD_FILTER 0 %define CONFIG_HWMAP_FILTER 0 @@ -2010,7 +2019,9 @@ %define CONFIG_SCALE_VULKAN_FILTER 0 %define CONFIG_SCALE2REF_FILTER 0 %define CONFIG_SCDET_FILTER 0 +%define CONFIG_SCHARR_FILTER 0 %define CONFIG_SCROLL_FILTER 0 +%define CONFIG_SEGMENT_FILTER 0 %define CONFIG_SELECT_FILTER 0 %define CONFIG_SELECTIVECOLOR_FILTER 0 %define CONFIG_SENDCMD_FILTER 0 @@ -2571,6 +2582,7 @@ %define CONFIG_MXF_OPATOM_MUXER 0 %define CONFIG_NULL_MUXER 0 %define CONFIG_NUT_MUXER 0 +%define CONFIG_OBU_MUXER 0 %define CONFIG_OGA_MUXER 0 %define CONFIG_OGG_MUXER 0 %define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/x64/config.h b/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/x64/config.h index caa74b8a31b..0f0ab625312 100644 --- a/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/x64/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/x64/config.h @@ -1,12 +1,12 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --enable-lto --enable-pic --cc=clang --cxx=clang++ --ld=clang --extra-ldflags='-fuse-ld=lld' --enable-decoder='aac,h264' --enable-demuxer=aac --enable-parser='aac,h264' --enable-decoder=mpeg4 --enable-parser='h263,mpeg4video' --enable-demuxer=avi --enable-demuxer=amr --enable-decoder='amrnb,amrwb' --enable-decoder=gsm_ms --enable-parser=gsm" -- elide long configuration string from binary */ +/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --enable-lto --enable-pic --cc=clang --cxx=clang++ --ld=clang --extra-ldflags='-fuse-ld=lld' --enable-decoder='aac,h264' --enable-demuxer=aac --enable-parser='aac,h264' --enable-decoder=mpeg4 --enable-parser='h263,mpeg4video' --enable-demuxer=avi --enable-demuxer=amr --enable-decoder='amrnb,amrwb' --enable-decoder=gsm_ms --enable-parser=gsm" -- elide long configuration string from binary */ #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2021 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" #define AVCONV_DATADIR "/usr/local/share/ffmpeg" -#define CC_IDENT "clang version 13.0.0 (https://github.com/llvm/llvm-project/ f98ed74f6910f8b09e77497aeb30c860c433610d)" +#define CC_IDENT "clang version 14.0.0 (https://github.com/llvm/llvm-project/ 0e03450ae4358e8a8242b73d493d96efea9d3ccf)" #define OS_NAME linux #define av_restrict restrict #define EXTERN_PREFIX "" @@ -232,7 +232,7 @@ #define HAVE_TERMIOS_H 1 #define HAVE_UDPLITE_H 0 #define HAVE_UNISTD_H 1 -#define HAVE_VALGRIND_VALGRIND_H 0 /* #define HAVE_VALGRIND_VALGRIND_H 1 -- forced to 0. See https://crbug.com/590440 */ +#define HAVE_VALGRIND_VALGRIND_H 0 /* #define HAVE_VALGRIND_VALGRIND_H 0 -- forced to 0. See https://crbug.com/590440 */ #define HAVE_WINDOWS_H 0 #define HAVE_WINSOCK2_H 0 #define HAVE_INTRINSICS_NEON 0 @@ -1086,6 +1086,7 @@ #define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 +#define CONFIG_MSNSIREN_DECODER 0 #define CONFIG_NELLYMOSER_DECODER 0 #define CONFIG_ON2AVC_DECODER 0 #define CONFIG_OPUS_DECODER 0 @@ -1355,6 +1356,7 @@ #define CONFIG_RV20_ENCODER 0 #define CONFIG_S302M_ENCODER 0 #define CONFIG_SGI_ENCODER 0 +#define CONFIG_SMC_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_SPEEDHQ_ENCODER 0 #define CONFIG_SUNRAST_ENCODER 0 @@ -1678,6 +1680,7 @@ #define CONFIG_ACRUSHER_FILTER 0 #define CONFIG_ADECLICK_FILTER 0 #define CONFIG_ADECLIP_FILTER 0 +#define CONFIG_ADECORRELATE_FILTER 0 #define CONFIG_ADELAY_FILTER 0 #define CONFIG_ADENORM_FILTER 0 #define CONFIG_ADERIVATIVE_FILTER 0 @@ -1711,11 +1714,13 @@ #define CONFIG_APERMS_FILTER 0 #define CONFIG_APHASER_FILTER 0 #define CONFIG_APHASESHIFT_FILTER 0 +#define CONFIG_APSYCLIP_FILTER 0 #define CONFIG_APULSATOR_FILTER 0 #define CONFIG_AREALTIME_FILTER 0 #define CONFIG_ARESAMPLE_FILTER 0 #define CONFIG_AREVERSE_FILTER 0 #define CONFIG_ARNNDN_FILTER 0 +#define CONFIG_ASEGMENT_FILTER 0 #define CONFIG_ASELECT_FILTER 0 #define CONFIG_ASENDCMD_FILTER 0 #define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1735,6 +1740,7 @@ #define CONFIG_ASUPERPASS_FILTER 0 #define CONFIG_ASUPERSTOP_FILTER 0 #define CONFIG_ATEMPO_FILTER 0 +#define CONFIG_ATILT_FILTER 0 #define CONFIG_ATRIM_FILTER 0 #define CONFIG_AXCORRELATE_FILTER 0 #define CONFIG_AZMQ_FILTER 0 @@ -1913,6 +1919,7 @@ #define CONFIG_GEQ_FILTER 0 #define CONFIG_GRADFUN_FILTER 0 #define CONFIG_GRAPHMONITOR_FILTER 0 +#define CONFIG_GRAYWORLD_FILTER 0 #define CONFIG_GREYEDGE_FILTER 0 #define CONFIG_GUIDED_FILTER 0 #define CONFIG_HALDCLUT_FILTER 0 @@ -1922,6 +1929,8 @@ #define CONFIG_HQDN3D_FILTER 0 #define CONFIG_HQX_FILTER 0 #define CONFIG_HSTACK_FILTER 0 +#define CONFIG_HSVHOLD_FILTER 0 +#define CONFIG_HSVKEY_FILTER 0 #define CONFIG_HUE_FILTER 0 #define CONFIG_HWDOWNLOAD_FILTER 0 #define CONFIG_HWMAP_FILTER 0 @@ -2026,7 +2035,9 @@ #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCDET_FILTER 0 +#define CONFIG_SCHARR_FILTER 0 #define CONFIG_SCROLL_FILTER 0 +#define CONFIG_SEGMENT_FILTER 0 #define CONFIG_SELECT_FILTER 0 #define CONFIG_SELECTIVECOLOR_FILTER 0 #define CONFIG_SENDCMD_FILTER 0 @@ -2587,6 +2598,7 @@ #define CONFIG_MXF_OPATOM_MUXER 0 #define CONFIG_NULL_MUXER 0 #define CONFIG_NUT_MUXER 0 +#define CONFIG_OBU_MUXER 0 #define CONFIG_OGA_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/x64/libavutil/ffversion.h b/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/x64/libavutil/ffversion.h index d4ce7a4e6a7..f26e152f83f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/x64/libavutil/ffversion.h +++ b/chromium/third_party/ffmpeg/chromium/config/ChromeOS/linux/x64/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "N-104195-g628f528751" +#define FFMPEG_VERSION "N-104707-g392d8a2d60" #endif /* AVUTIL_FFVERSION_H */ diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/android/arm-neon/config.h b/chromium/third_party/ffmpeg/chromium/config/Chromium/android/arm-neon/config.h index 6cacdc65544..efab37d0409 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/android/arm-neon/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/android/arm-neon/config.h @@ -1,7 +1,7 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --enable-small --enable-pic --cc=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --cxx=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --ld=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --enable-cross-compile --sysroot=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/arm-linux-androideabi --extra-cflags='--target=arm-linux-androideabi21' --extra-ldflags='--target=arm-linux-androideabi21' --extra-ldflags=-L/tmp/fakelinkerscripts --extra-ldflags=-L/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/arm-linux-androideabi --extra-ldflags='--gcc-toolchain=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/' --target-os=android --arch=arm --enable-armv6 --enable-armv6t2 --enable-vfp --enable-thumb --extra-cflags='-march=armv7-a' --enable-neon --extra-cflags='-mtune=generic-armv7-a' --extra-cflags='-mfloat-abi=softfp' --extra-cflags='-mfpu=neon'" -- elide long configuration string from binary */ +/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --enable-small --enable-pic --cc=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --cxx=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --ld=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --enable-cross-compile --sysroot=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/arm-linux-androideabi --extra-cflags='--target=arm-linux-androideabi21' --extra-ldflags='--target=arm-linux-androideabi21' --extra-ldflags=-L/tmp/fakelinkerscripts --extra-ldflags=-L/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/arm-linux-androideabi --extra-ldflags='--gcc-toolchain=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/' --target-os=android --arch=arm --enable-armv6 --enable-armv6t2 --enable-vfp --enable-thumb --extra-cflags='-march=armv7-a' --enable-neon --extra-cflags='-mtune=generic-armv7-a' --extra-cflags='-mfloat-abi=softfp' --extra-cflags='-mfpu=neon'" -- elide long configuration string from binary */ #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2021 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" @@ -1086,6 +1086,7 @@ #define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 +#define CONFIG_MSNSIREN_DECODER 0 #define CONFIG_NELLYMOSER_DECODER 0 #define CONFIG_ON2AVC_DECODER 0 #define CONFIG_OPUS_DECODER 0 @@ -1355,6 +1356,7 @@ #define CONFIG_RV20_ENCODER 0 #define CONFIG_S302M_ENCODER 0 #define CONFIG_SGI_ENCODER 0 +#define CONFIG_SMC_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_SPEEDHQ_ENCODER 0 #define CONFIG_SUNRAST_ENCODER 0 @@ -1678,6 +1680,7 @@ #define CONFIG_ACRUSHER_FILTER 0 #define CONFIG_ADECLICK_FILTER 0 #define CONFIG_ADECLIP_FILTER 0 +#define CONFIG_ADECORRELATE_FILTER 0 #define CONFIG_ADELAY_FILTER 0 #define CONFIG_ADENORM_FILTER 0 #define CONFIG_ADERIVATIVE_FILTER 0 @@ -1711,11 +1714,13 @@ #define CONFIG_APERMS_FILTER 0 #define CONFIG_APHASER_FILTER 0 #define CONFIG_APHASESHIFT_FILTER 0 +#define CONFIG_APSYCLIP_FILTER 0 #define CONFIG_APULSATOR_FILTER 0 #define CONFIG_AREALTIME_FILTER 0 #define CONFIG_ARESAMPLE_FILTER 0 #define CONFIG_AREVERSE_FILTER 0 #define CONFIG_ARNNDN_FILTER 0 +#define CONFIG_ASEGMENT_FILTER 0 #define CONFIG_ASELECT_FILTER 0 #define CONFIG_ASENDCMD_FILTER 0 #define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1735,6 +1740,7 @@ #define CONFIG_ASUPERPASS_FILTER 0 #define CONFIG_ASUPERSTOP_FILTER 0 #define CONFIG_ATEMPO_FILTER 0 +#define CONFIG_ATILT_FILTER 0 #define CONFIG_ATRIM_FILTER 0 #define CONFIG_AXCORRELATE_FILTER 0 #define CONFIG_AZMQ_FILTER 0 @@ -1913,6 +1919,7 @@ #define CONFIG_GEQ_FILTER 0 #define CONFIG_GRADFUN_FILTER 0 #define CONFIG_GRAPHMONITOR_FILTER 0 +#define CONFIG_GRAYWORLD_FILTER 0 #define CONFIG_GREYEDGE_FILTER 0 #define CONFIG_GUIDED_FILTER 0 #define CONFIG_HALDCLUT_FILTER 0 @@ -1922,6 +1929,8 @@ #define CONFIG_HQDN3D_FILTER 0 #define CONFIG_HQX_FILTER 0 #define CONFIG_HSTACK_FILTER 0 +#define CONFIG_HSVHOLD_FILTER 0 +#define CONFIG_HSVKEY_FILTER 0 #define CONFIG_HUE_FILTER 0 #define CONFIG_HWDOWNLOAD_FILTER 0 #define CONFIG_HWMAP_FILTER 0 @@ -2026,7 +2035,9 @@ #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCDET_FILTER 0 +#define CONFIG_SCHARR_FILTER 0 #define CONFIG_SCROLL_FILTER 0 +#define CONFIG_SEGMENT_FILTER 0 #define CONFIG_SELECT_FILTER 0 #define CONFIG_SELECTIVECOLOR_FILTER 0 #define CONFIG_SENDCMD_FILTER 0 @@ -2587,6 +2598,7 @@ #define CONFIG_MXF_OPATOM_MUXER 0 #define CONFIG_NULL_MUXER 0 #define CONFIG_NUT_MUXER 0 +#define CONFIG_OBU_MUXER 0 #define CONFIG_OGA_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/android/arm-neon/libavutil/ffversion.h b/chromium/third_party/ffmpeg/chromium/config/Chromium/android/arm-neon/libavutil/ffversion.h index d4ce7a4e6a7..f26e152f83f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/android/arm-neon/libavutil/ffversion.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/android/arm-neon/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "N-104195-g628f528751" +#define FFMPEG_VERSION "N-104707-g392d8a2d60" #endif /* AVUTIL_FFVERSION_H */ diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/android/arm64/config.h b/chromium/third_party/ffmpeg/chromium/config/Chromium/android/arm64/config.h index 30111d6289a..35e1291db07 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/android/arm64/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/android/arm64/config.h @@ -1,7 +1,7 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --enable-small --enable-pic --cc=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --cxx=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --ld=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --enable-cross-compile --sysroot=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/aarch64-linux-android --extra-cflags='--target=aarch64-linux-android21' --extra-ldflags='--target=aarch64-linux-android21' --extra-ldflags=-L/tmp/fakelinkerscripts --extra-ldflags=-L/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/aarch64-linux-android --extra-ldflags='--gcc-toolchain=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/' --target-os=android --arch=aarch64 --enable-armv8 --extra-cflags='-march=armv8-a'" -- elide long configuration string from binary */ +/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --enable-small --enable-pic --cc=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --cxx=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --ld=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --enable-cross-compile --sysroot=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/aarch64-linux-android --extra-cflags='--target=aarch64-linux-android21' --extra-ldflags='--target=aarch64-linux-android21' --extra-ldflags=-L/tmp/fakelinkerscripts --extra-ldflags=-L/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/aarch64-linux-android --extra-ldflags='--gcc-toolchain=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/' --target-os=android --arch=aarch64 --enable-armv8 --extra-cflags='-march=armv8-a'" -- elide long configuration string from binary */ #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2021 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" @@ -1086,6 +1086,7 @@ #define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 +#define CONFIG_MSNSIREN_DECODER 0 #define CONFIG_NELLYMOSER_DECODER 0 #define CONFIG_ON2AVC_DECODER 0 #define CONFIG_OPUS_DECODER 0 @@ -1355,6 +1356,7 @@ #define CONFIG_RV20_ENCODER 0 #define CONFIG_S302M_ENCODER 0 #define CONFIG_SGI_ENCODER 0 +#define CONFIG_SMC_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_SPEEDHQ_ENCODER 0 #define CONFIG_SUNRAST_ENCODER 0 @@ -1678,6 +1680,7 @@ #define CONFIG_ACRUSHER_FILTER 0 #define CONFIG_ADECLICK_FILTER 0 #define CONFIG_ADECLIP_FILTER 0 +#define CONFIG_ADECORRELATE_FILTER 0 #define CONFIG_ADELAY_FILTER 0 #define CONFIG_ADENORM_FILTER 0 #define CONFIG_ADERIVATIVE_FILTER 0 @@ -1711,11 +1714,13 @@ #define CONFIG_APERMS_FILTER 0 #define CONFIG_APHASER_FILTER 0 #define CONFIG_APHASESHIFT_FILTER 0 +#define CONFIG_APSYCLIP_FILTER 0 #define CONFIG_APULSATOR_FILTER 0 #define CONFIG_AREALTIME_FILTER 0 #define CONFIG_ARESAMPLE_FILTER 0 #define CONFIG_AREVERSE_FILTER 0 #define CONFIG_ARNNDN_FILTER 0 +#define CONFIG_ASEGMENT_FILTER 0 #define CONFIG_ASELECT_FILTER 0 #define CONFIG_ASENDCMD_FILTER 0 #define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1735,6 +1740,7 @@ #define CONFIG_ASUPERPASS_FILTER 0 #define CONFIG_ASUPERSTOP_FILTER 0 #define CONFIG_ATEMPO_FILTER 0 +#define CONFIG_ATILT_FILTER 0 #define CONFIG_ATRIM_FILTER 0 #define CONFIG_AXCORRELATE_FILTER 0 #define CONFIG_AZMQ_FILTER 0 @@ -1913,6 +1919,7 @@ #define CONFIG_GEQ_FILTER 0 #define CONFIG_GRADFUN_FILTER 0 #define CONFIG_GRAPHMONITOR_FILTER 0 +#define CONFIG_GRAYWORLD_FILTER 0 #define CONFIG_GREYEDGE_FILTER 0 #define CONFIG_GUIDED_FILTER 0 #define CONFIG_HALDCLUT_FILTER 0 @@ -1922,6 +1929,8 @@ #define CONFIG_HQDN3D_FILTER 0 #define CONFIG_HQX_FILTER 0 #define CONFIG_HSTACK_FILTER 0 +#define CONFIG_HSVHOLD_FILTER 0 +#define CONFIG_HSVKEY_FILTER 0 #define CONFIG_HUE_FILTER 0 #define CONFIG_HWDOWNLOAD_FILTER 0 #define CONFIG_HWMAP_FILTER 0 @@ -2026,7 +2035,9 @@ #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCDET_FILTER 0 +#define CONFIG_SCHARR_FILTER 0 #define CONFIG_SCROLL_FILTER 0 +#define CONFIG_SEGMENT_FILTER 0 #define CONFIG_SELECT_FILTER 0 #define CONFIG_SELECTIVECOLOR_FILTER 0 #define CONFIG_SENDCMD_FILTER 0 @@ -2587,6 +2598,7 @@ #define CONFIG_MXF_OPATOM_MUXER 0 #define CONFIG_NULL_MUXER 0 #define CONFIG_NUT_MUXER 0 +#define CONFIG_OBU_MUXER 0 #define CONFIG_OGA_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/android/arm64/libavutil/ffversion.h b/chromium/third_party/ffmpeg/chromium/config/Chromium/android/arm64/libavutil/ffversion.h index d4ce7a4e6a7..f26e152f83f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/android/arm64/libavutil/ffversion.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/android/arm64/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "N-104195-g628f528751" +#define FFMPEG_VERSION "N-104707-g392d8a2d60" #endif /* AVUTIL_FFVERSION_H */ diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/android/ia32/config.h b/chromium/third_party/ffmpeg/chromium/config/Chromium/android/ia32/config.h index 9a4476fac10..e620a672072 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/android/ia32/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/android/ia32/config.h @@ -1,7 +1,7 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --enable-small --enable-pic --cc=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --cxx=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --ld=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --enable-cross-compile --sysroot=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/i686-linux-android --extra-cflags='--target=i686-linux-android21' --extra-ldflags='--target=i686-linux-android21' --extra-ldflags=-L/tmp/fakelinkerscripts --extra-ldflags=-L/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/i686-linux-android --extra-ldflags='--gcc-toolchain=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/' --target-os=android --arch=i686 --extra-cflags='\"-m32\"' --extra-ldflags='\"-m32\"' --disable-x86asm" -- elide long configuration string from binary */ +/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --enable-small --enable-pic --cc=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --cxx=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --ld=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --enable-cross-compile --sysroot=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/i686-linux-android --extra-cflags='--target=i686-linux-android21' --extra-ldflags='--target=i686-linux-android21' --extra-ldflags=-L/tmp/fakelinkerscripts --extra-ldflags=-L/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/i686-linux-android --extra-ldflags='--gcc-toolchain=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/' --target-os=android --arch=i686 --extra-cflags='\"-m32\"' --extra-ldflags='\"-m32\"' --disable-x86asm" -- elide long configuration string from binary */ #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2021 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" @@ -1086,6 +1086,7 @@ #define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 +#define CONFIG_MSNSIREN_DECODER 0 #define CONFIG_NELLYMOSER_DECODER 0 #define CONFIG_ON2AVC_DECODER 0 #define CONFIG_OPUS_DECODER 0 @@ -1355,6 +1356,7 @@ #define CONFIG_RV20_ENCODER 0 #define CONFIG_S302M_ENCODER 0 #define CONFIG_SGI_ENCODER 0 +#define CONFIG_SMC_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_SPEEDHQ_ENCODER 0 #define CONFIG_SUNRAST_ENCODER 0 @@ -1678,6 +1680,7 @@ #define CONFIG_ACRUSHER_FILTER 0 #define CONFIG_ADECLICK_FILTER 0 #define CONFIG_ADECLIP_FILTER 0 +#define CONFIG_ADECORRELATE_FILTER 0 #define CONFIG_ADELAY_FILTER 0 #define CONFIG_ADENORM_FILTER 0 #define CONFIG_ADERIVATIVE_FILTER 0 @@ -1711,11 +1714,13 @@ #define CONFIG_APERMS_FILTER 0 #define CONFIG_APHASER_FILTER 0 #define CONFIG_APHASESHIFT_FILTER 0 +#define CONFIG_APSYCLIP_FILTER 0 #define CONFIG_APULSATOR_FILTER 0 #define CONFIG_AREALTIME_FILTER 0 #define CONFIG_ARESAMPLE_FILTER 0 #define CONFIG_AREVERSE_FILTER 0 #define CONFIG_ARNNDN_FILTER 0 +#define CONFIG_ASEGMENT_FILTER 0 #define CONFIG_ASELECT_FILTER 0 #define CONFIG_ASENDCMD_FILTER 0 #define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1735,6 +1740,7 @@ #define CONFIG_ASUPERPASS_FILTER 0 #define CONFIG_ASUPERSTOP_FILTER 0 #define CONFIG_ATEMPO_FILTER 0 +#define CONFIG_ATILT_FILTER 0 #define CONFIG_ATRIM_FILTER 0 #define CONFIG_AXCORRELATE_FILTER 0 #define CONFIG_AZMQ_FILTER 0 @@ -1913,6 +1919,7 @@ #define CONFIG_GEQ_FILTER 0 #define CONFIG_GRADFUN_FILTER 0 #define CONFIG_GRAPHMONITOR_FILTER 0 +#define CONFIG_GRAYWORLD_FILTER 0 #define CONFIG_GREYEDGE_FILTER 0 #define CONFIG_GUIDED_FILTER 0 #define CONFIG_HALDCLUT_FILTER 0 @@ -1922,6 +1929,8 @@ #define CONFIG_HQDN3D_FILTER 0 #define CONFIG_HQX_FILTER 0 #define CONFIG_HSTACK_FILTER 0 +#define CONFIG_HSVHOLD_FILTER 0 +#define CONFIG_HSVKEY_FILTER 0 #define CONFIG_HUE_FILTER 0 #define CONFIG_HWDOWNLOAD_FILTER 0 #define CONFIG_HWMAP_FILTER 0 @@ -2026,7 +2035,9 @@ #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCDET_FILTER 0 +#define CONFIG_SCHARR_FILTER 0 #define CONFIG_SCROLL_FILTER 0 +#define CONFIG_SEGMENT_FILTER 0 #define CONFIG_SELECT_FILTER 0 #define CONFIG_SELECTIVECOLOR_FILTER 0 #define CONFIG_SENDCMD_FILTER 0 @@ -2587,6 +2598,7 @@ #define CONFIG_MXF_OPATOM_MUXER 0 #define CONFIG_NULL_MUXER 0 #define CONFIG_NUT_MUXER 0 +#define CONFIG_OBU_MUXER 0 #define CONFIG_OGA_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/android/ia32/libavutil/ffversion.h b/chromium/third_party/ffmpeg/chromium/config/Chromium/android/ia32/libavutil/ffversion.h index d4ce7a4e6a7..f26e152f83f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/android/ia32/libavutil/ffversion.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/android/ia32/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "N-104195-g628f528751" +#define FFMPEG_VERSION "N-104707-g392d8a2d60" #endif /* AVUTIL_FFVERSION_H */ diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/android/x64/config.asm b/chromium/third_party/ffmpeg/chromium/config/Chromium/android/x64/config.asm index 34cea7d7434..234c2503f55 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/android/x64/config.asm +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/android/x64/config.asm @@ -1070,6 +1070,7 @@ %define CONFIG_MP3ON4_DECODER 0 %define CONFIG_MPC7_DECODER 0 %define CONFIG_MPC8_DECODER 0 +%define CONFIG_MSNSIREN_DECODER 0 %define CONFIG_NELLYMOSER_DECODER 0 %define CONFIG_ON2AVC_DECODER 0 %define CONFIG_OPUS_DECODER 0 @@ -1339,6 +1340,7 @@ %define CONFIG_RV20_ENCODER 0 %define CONFIG_S302M_ENCODER 0 %define CONFIG_SGI_ENCODER 0 +%define CONFIG_SMC_ENCODER 0 %define CONFIG_SNOW_ENCODER 0 %define CONFIG_SPEEDHQ_ENCODER 0 %define CONFIG_SUNRAST_ENCODER 0 @@ -1662,6 +1664,7 @@ %define CONFIG_ACRUSHER_FILTER 0 %define CONFIG_ADECLICK_FILTER 0 %define CONFIG_ADECLIP_FILTER 0 +%define CONFIG_ADECORRELATE_FILTER 0 %define CONFIG_ADELAY_FILTER 0 %define CONFIG_ADENORM_FILTER 0 %define CONFIG_ADERIVATIVE_FILTER 0 @@ -1695,11 +1698,13 @@ %define CONFIG_APERMS_FILTER 0 %define CONFIG_APHASER_FILTER 0 %define CONFIG_APHASESHIFT_FILTER 0 +%define CONFIG_APSYCLIP_FILTER 0 %define CONFIG_APULSATOR_FILTER 0 %define CONFIG_AREALTIME_FILTER 0 %define CONFIG_ARESAMPLE_FILTER 0 %define CONFIG_AREVERSE_FILTER 0 %define CONFIG_ARNNDN_FILTER 0 +%define CONFIG_ASEGMENT_FILTER 0 %define CONFIG_ASELECT_FILTER 0 %define CONFIG_ASENDCMD_FILTER 0 %define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1719,6 +1724,7 @@ %define CONFIG_ASUPERPASS_FILTER 0 %define CONFIG_ASUPERSTOP_FILTER 0 %define CONFIG_ATEMPO_FILTER 0 +%define CONFIG_ATILT_FILTER 0 %define CONFIG_ATRIM_FILTER 0 %define CONFIG_AXCORRELATE_FILTER 0 %define CONFIG_AZMQ_FILTER 0 @@ -1897,6 +1903,7 @@ %define CONFIG_GEQ_FILTER 0 %define CONFIG_GRADFUN_FILTER 0 %define CONFIG_GRAPHMONITOR_FILTER 0 +%define CONFIG_GRAYWORLD_FILTER 0 %define CONFIG_GREYEDGE_FILTER 0 %define CONFIG_GUIDED_FILTER 0 %define CONFIG_HALDCLUT_FILTER 0 @@ -1906,6 +1913,8 @@ %define CONFIG_HQDN3D_FILTER 0 %define CONFIG_HQX_FILTER 0 %define CONFIG_HSTACK_FILTER 0 +%define CONFIG_HSVHOLD_FILTER 0 +%define CONFIG_HSVKEY_FILTER 0 %define CONFIG_HUE_FILTER 0 %define CONFIG_HWDOWNLOAD_FILTER 0 %define CONFIG_HWMAP_FILTER 0 @@ -2010,7 +2019,9 @@ %define CONFIG_SCALE_VULKAN_FILTER 0 %define CONFIG_SCALE2REF_FILTER 0 %define CONFIG_SCDET_FILTER 0 +%define CONFIG_SCHARR_FILTER 0 %define CONFIG_SCROLL_FILTER 0 +%define CONFIG_SEGMENT_FILTER 0 %define CONFIG_SELECT_FILTER 0 %define CONFIG_SELECTIVECOLOR_FILTER 0 %define CONFIG_SENDCMD_FILTER 0 @@ -2571,6 +2582,7 @@ %define CONFIG_MXF_OPATOM_MUXER 0 %define CONFIG_NULL_MUXER 0 %define CONFIG_NUT_MUXER 0 +%define CONFIG_OBU_MUXER 0 %define CONFIG_OGA_MUXER 0 %define CONFIG_OGG_MUXER 0 %define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/android/x64/config.h b/chromium/third_party/ffmpeg/chromium/config/Chromium/android/x64/config.h index 2feb6973769..4e927ca61a6 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/android/x64/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/android/x64/config.h @@ -1,7 +1,7 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --enable-small --enable-pic --cc=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --cxx=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --ld=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --enable-cross-compile --sysroot=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/x86_64-linux-android --extra-cflags='--target=x86_64-linux-android21' --extra-ldflags='--target=x86_64-linux-android21' --extra-ldflags=-L/tmp/fakelinkerscripts --extra-ldflags=-L/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/x86_64-linux-android --extra-ldflags='--gcc-toolchain=/not_workspace/liberato/release_chrome/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/' --target-os=android --arch=x86_64" -- elide long configuration string from binary */ +/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --enable-small --enable-pic --cc=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --cxx=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --ld=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --enable-cross-compile --sysroot=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/x86_64-linux-android --extra-cflags='--target=x86_64-linux-android21' --extra-ldflags='--target=x86_64-linux-android21' --extra-ldflags=-L/tmp/fakelinkerscripts --extra-ldflags=-L/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/x86_64-linux-android --extra-ldflags='--gcc-toolchain=/usr/local/google/home/tguilbert/Code/chromium/src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/' --target-os=android --arch=x86_64" -- elide long configuration string from binary */ #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2021 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" @@ -1086,6 +1086,7 @@ #define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 +#define CONFIG_MSNSIREN_DECODER 0 #define CONFIG_NELLYMOSER_DECODER 0 #define CONFIG_ON2AVC_DECODER 0 #define CONFIG_OPUS_DECODER 0 @@ -1355,6 +1356,7 @@ #define CONFIG_RV20_ENCODER 0 #define CONFIG_S302M_ENCODER 0 #define CONFIG_SGI_ENCODER 0 +#define CONFIG_SMC_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_SPEEDHQ_ENCODER 0 #define CONFIG_SUNRAST_ENCODER 0 @@ -1678,6 +1680,7 @@ #define CONFIG_ACRUSHER_FILTER 0 #define CONFIG_ADECLICK_FILTER 0 #define CONFIG_ADECLIP_FILTER 0 +#define CONFIG_ADECORRELATE_FILTER 0 #define CONFIG_ADELAY_FILTER 0 #define CONFIG_ADENORM_FILTER 0 #define CONFIG_ADERIVATIVE_FILTER 0 @@ -1711,11 +1714,13 @@ #define CONFIG_APERMS_FILTER 0 #define CONFIG_APHASER_FILTER 0 #define CONFIG_APHASESHIFT_FILTER 0 +#define CONFIG_APSYCLIP_FILTER 0 #define CONFIG_APULSATOR_FILTER 0 #define CONFIG_AREALTIME_FILTER 0 #define CONFIG_ARESAMPLE_FILTER 0 #define CONFIG_AREVERSE_FILTER 0 #define CONFIG_ARNNDN_FILTER 0 +#define CONFIG_ASEGMENT_FILTER 0 #define CONFIG_ASELECT_FILTER 0 #define CONFIG_ASENDCMD_FILTER 0 #define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1735,6 +1740,7 @@ #define CONFIG_ASUPERPASS_FILTER 0 #define CONFIG_ASUPERSTOP_FILTER 0 #define CONFIG_ATEMPO_FILTER 0 +#define CONFIG_ATILT_FILTER 0 #define CONFIG_ATRIM_FILTER 0 #define CONFIG_AXCORRELATE_FILTER 0 #define CONFIG_AZMQ_FILTER 0 @@ -1913,6 +1919,7 @@ #define CONFIG_GEQ_FILTER 0 #define CONFIG_GRADFUN_FILTER 0 #define CONFIG_GRAPHMONITOR_FILTER 0 +#define CONFIG_GRAYWORLD_FILTER 0 #define CONFIG_GREYEDGE_FILTER 0 #define CONFIG_GUIDED_FILTER 0 #define CONFIG_HALDCLUT_FILTER 0 @@ -1922,6 +1929,8 @@ #define CONFIG_HQDN3D_FILTER 0 #define CONFIG_HQX_FILTER 0 #define CONFIG_HSTACK_FILTER 0 +#define CONFIG_HSVHOLD_FILTER 0 +#define CONFIG_HSVKEY_FILTER 0 #define CONFIG_HUE_FILTER 0 #define CONFIG_HWDOWNLOAD_FILTER 0 #define CONFIG_HWMAP_FILTER 0 @@ -2026,7 +2035,9 @@ #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCDET_FILTER 0 +#define CONFIG_SCHARR_FILTER 0 #define CONFIG_SCROLL_FILTER 0 +#define CONFIG_SEGMENT_FILTER 0 #define CONFIG_SELECT_FILTER 0 #define CONFIG_SELECTIVECOLOR_FILTER 0 #define CONFIG_SENDCMD_FILTER 0 @@ -2587,6 +2598,7 @@ #define CONFIG_MXF_OPATOM_MUXER 0 #define CONFIG_NULL_MUXER 0 #define CONFIG_NUT_MUXER 0 +#define CONFIG_OBU_MUXER 0 #define CONFIG_OGA_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/android/x64/libavutil/ffversion.h b/chromium/third_party/ffmpeg/chromium/config/Chromium/android/x64/libavutil/ffversion.h index d4ce7a4e6a7..f26e152f83f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/android/x64/libavutil/ffversion.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/android/x64/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "N-104195-g628f528751" +#define FFMPEG_VERSION "N-104707-g392d8a2d60" #endif /* AVUTIL_FFVERSION_H */ diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/linux-noasm/x64/config.h b/chromium/third_party/ffmpeg/chromium/config/Chromium/linux-noasm/x64/config.h index 007a38c9a91..fe42426f07f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/linux-noasm/x64/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/linux-noasm/x64/config.h @@ -1,12 +1,12 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --enable-lto --disable-asm --disable-inline-asm --enable-pic --cc=clang --cxx=clang++ --ld=clang --extra-ldflags='-fuse-ld=lld'" -- elide long configuration string from binary */ +/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --enable-lto --disable-asm --disable-inline-asm --enable-pic --cc=clang --cxx=clang++ --ld=clang --extra-ldflags='-fuse-ld=lld'" -- elide long configuration string from binary */ #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2021 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" #define AVCONV_DATADIR "/usr/local/share/ffmpeg" -#define CC_IDENT "clang version 13.0.0 (https://github.com/llvm/llvm-project/ f98ed74f6910f8b09e77497aeb30c860c433610d)" +#define CC_IDENT "clang version 14.0.0 (https://github.com/llvm/llvm-project/ 0e03450ae4358e8a8242b73d493d96efea9d3ccf)" #define OS_NAME linux #define av_restrict restrict #define EXTERN_PREFIX "" @@ -232,7 +232,7 @@ #define HAVE_TERMIOS_H 1 #define HAVE_UDPLITE_H 0 #define HAVE_UNISTD_H 1 -#define HAVE_VALGRIND_VALGRIND_H 0 /* #define HAVE_VALGRIND_VALGRIND_H 1 -- forced to 0. See https://crbug.com/590440 */ +#define HAVE_VALGRIND_VALGRIND_H 0 /* #define HAVE_VALGRIND_VALGRIND_H 0 -- forced to 0. See https://crbug.com/590440 */ #define HAVE_WINDOWS_H 0 #define HAVE_WINSOCK2_H 0 #define HAVE_INTRINSICS_NEON 0 @@ -1086,6 +1086,7 @@ #define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 +#define CONFIG_MSNSIREN_DECODER 0 #define CONFIG_NELLYMOSER_DECODER 0 #define CONFIG_ON2AVC_DECODER 0 #define CONFIG_OPUS_DECODER 0 @@ -1355,6 +1356,7 @@ #define CONFIG_RV20_ENCODER 0 #define CONFIG_S302M_ENCODER 0 #define CONFIG_SGI_ENCODER 0 +#define CONFIG_SMC_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_SPEEDHQ_ENCODER 0 #define CONFIG_SUNRAST_ENCODER 0 @@ -1678,6 +1680,7 @@ #define CONFIG_ACRUSHER_FILTER 0 #define CONFIG_ADECLICK_FILTER 0 #define CONFIG_ADECLIP_FILTER 0 +#define CONFIG_ADECORRELATE_FILTER 0 #define CONFIG_ADELAY_FILTER 0 #define CONFIG_ADENORM_FILTER 0 #define CONFIG_ADERIVATIVE_FILTER 0 @@ -1711,11 +1714,13 @@ #define CONFIG_APERMS_FILTER 0 #define CONFIG_APHASER_FILTER 0 #define CONFIG_APHASESHIFT_FILTER 0 +#define CONFIG_APSYCLIP_FILTER 0 #define CONFIG_APULSATOR_FILTER 0 #define CONFIG_AREALTIME_FILTER 0 #define CONFIG_ARESAMPLE_FILTER 0 #define CONFIG_AREVERSE_FILTER 0 #define CONFIG_ARNNDN_FILTER 0 +#define CONFIG_ASEGMENT_FILTER 0 #define CONFIG_ASELECT_FILTER 0 #define CONFIG_ASENDCMD_FILTER 0 #define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1735,6 +1740,7 @@ #define CONFIG_ASUPERPASS_FILTER 0 #define CONFIG_ASUPERSTOP_FILTER 0 #define CONFIG_ATEMPO_FILTER 0 +#define CONFIG_ATILT_FILTER 0 #define CONFIG_ATRIM_FILTER 0 #define CONFIG_AXCORRELATE_FILTER 0 #define CONFIG_AZMQ_FILTER 0 @@ -1913,6 +1919,7 @@ #define CONFIG_GEQ_FILTER 0 #define CONFIG_GRADFUN_FILTER 0 #define CONFIG_GRAPHMONITOR_FILTER 0 +#define CONFIG_GRAYWORLD_FILTER 0 #define CONFIG_GREYEDGE_FILTER 0 #define CONFIG_GUIDED_FILTER 0 #define CONFIG_HALDCLUT_FILTER 0 @@ -1922,6 +1929,8 @@ #define CONFIG_HQDN3D_FILTER 0 #define CONFIG_HQX_FILTER 0 #define CONFIG_HSTACK_FILTER 0 +#define CONFIG_HSVHOLD_FILTER 0 +#define CONFIG_HSVKEY_FILTER 0 #define CONFIG_HUE_FILTER 0 #define CONFIG_HWDOWNLOAD_FILTER 0 #define CONFIG_HWMAP_FILTER 0 @@ -2026,7 +2035,9 @@ #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCDET_FILTER 0 +#define CONFIG_SCHARR_FILTER 0 #define CONFIG_SCROLL_FILTER 0 +#define CONFIG_SEGMENT_FILTER 0 #define CONFIG_SELECT_FILTER 0 #define CONFIG_SELECTIVECOLOR_FILTER 0 #define CONFIG_SENDCMD_FILTER 0 @@ -2587,6 +2598,7 @@ #define CONFIG_MXF_OPATOM_MUXER 0 #define CONFIG_NULL_MUXER 0 #define CONFIG_NUT_MUXER 0 +#define CONFIG_OBU_MUXER 0 #define CONFIG_OGA_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/linux-noasm/x64/libavutil/ffversion.h b/chromium/third_party/ffmpeg/chromium/config/Chromium/linux-noasm/x64/libavutil/ffversion.h index d4ce7a4e6a7..f26e152f83f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/linux-noasm/x64/libavutil/ffversion.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/linux-noasm/x64/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "N-104195-g628f528751" +#define FFMPEG_VERSION "N-104707-g392d8a2d60" #endif /* AVUTIL_FFVERSION_H */ diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/arm-neon/config.h b/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/arm-neon/config.h index 42657fad5a6..0e4c5b0193b 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/arm-neon/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/arm-neon/config.h @@ -1,12 +1,12 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --arch=arm --enable-armv6 --enable-armv6t2 --enable-vfp --enable-thumb --extra-cflags='-march=armv7-a' --enable-cross-compile --target-os=linux --extra-cflags='--target=arm-linux-gnueabihf' --extra-ldflags='--target=arm-linux-gnueabihf' --sysroot=/not_workspace/liberato/release_chrome/src/build/linux/debian_sid_arm-sysroot --extra-cflags='-mtune=cortex-a8' --extra-cflags='-mfloat-abi=hard' --extra-cflags=-O2 --enable-neon --extra-cflags='-mfpu=neon' --enable-pic --cc=clang --cxx=clang++ --ld=clang --extra-ldflags='-fuse-ld=lld'" -- elide long configuration string from binary */ +/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --arch=arm --enable-armv6 --enable-armv6t2 --enable-vfp --enable-thumb --extra-cflags='-march=armv7-a' --enable-cross-compile --target-os=linux --extra-cflags='--target=arm-linux-gnueabihf' --extra-ldflags='--target=arm-linux-gnueabihf' --sysroot=/usr/local/google/home/tguilbert/Code/chromium/src/build/linux/debian_sid_arm-sysroot --extra-cflags='-mtune=cortex-a8' --extra-cflags='-mfloat-abi=hard' --extra-cflags=-O2 --enable-neon --extra-cflags='-mfpu=neon' --enable-pic --cc=clang --cxx=clang++ --ld=clang --extra-ldflags='-fuse-ld=lld'" -- elide long configuration string from binary */ #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2021 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" #define AVCONV_DATADIR "/usr/local/share/ffmpeg" -#define CC_IDENT "clang version 13.0.0 (https://github.com/llvm/llvm-project/ f98ed74f6910f8b09e77497aeb30c860c433610d)" +#define CC_IDENT "clang version 14.0.0 (https://github.com/llvm/llvm-project/ 0e03450ae4358e8a8242b73d493d96efea9d3ccf)" #define OS_NAME linux #define av_restrict restrict #define EXTERN_PREFIX "" @@ -1086,6 +1086,7 @@ #define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 +#define CONFIG_MSNSIREN_DECODER 0 #define CONFIG_NELLYMOSER_DECODER 0 #define CONFIG_ON2AVC_DECODER 0 #define CONFIG_OPUS_DECODER 0 @@ -1355,6 +1356,7 @@ #define CONFIG_RV20_ENCODER 0 #define CONFIG_S302M_ENCODER 0 #define CONFIG_SGI_ENCODER 0 +#define CONFIG_SMC_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_SPEEDHQ_ENCODER 0 #define CONFIG_SUNRAST_ENCODER 0 @@ -1678,6 +1680,7 @@ #define CONFIG_ACRUSHER_FILTER 0 #define CONFIG_ADECLICK_FILTER 0 #define CONFIG_ADECLIP_FILTER 0 +#define CONFIG_ADECORRELATE_FILTER 0 #define CONFIG_ADELAY_FILTER 0 #define CONFIG_ADENORM_FILTER 0 #define CONFIG_ADERIVATIVE_FILTER 0 @@ -1711,11 +1714,13 @@ #define CONFIG_APERMS_FILTER 0 #define CONFIG_APHASER_FILTER 0 #define CONFIG_APHASESHIFT_FILTER 0 +#define CONFIG_APSYCLIP_FILTER 0 #define CONFIG_APULSATOR_FILTER 0 #define CONFIG_AREALTIME_FILTER 0 #define CONFIG_ARESAMPLE_FILTER 0 #define CONFIG_AREVERSE_FILTER 0 #define CONFIG_ARNNDN_FILTER 0 +#define CONFIG_ASEGMENT_FILTER 0 #define CONFIG_ASELECT_FILTER 0 #define CONFIG_ASENDCMD_FILTER 0 #define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1735,6 +1740,7 @@ #define CONFIG_ASUPERPASS_FILTER 0 #define CONFIG_ASUPERSTOP_FILTER 0 #define CONFIG_ATEMPO_FILTER 0 +#define CONFIG_ATILT_FILTER 0 #define CONFIG_ATRIM_FILTER 0 #define CONFIG_AXCORRELATE_FILTER 0 #define CONFIG_AZMQ_FILTER 0 @@ -1913,6 +1919,7 @@ #define CONFIG_GEQ_FILTER 0 #define CONFIG_GRADFUN_FILTER 0 #define CONFIG_GRAPHMONITOR_FILTER 0 +#define CONFIG_GRAYWORLD_FILTER 0 #define CONFIG_GREYEDGE_FILTER 0 #define CONFIG_GUIDED_FILTER 0 #define CONFIG_HALDCLUT_FILTER 0 @@ -1922,6 +1929,8 @@ #define CONFIG_HQDN3D_FILTER 0 #define CONFIG_HQX_FILTER 0 #define CONFIG_HSTACK_FILTER 0 +#define CONFIG_HSVHOLD_FILTER 0 +#define CONFIG_HSVKEY_FILTER 0 #define CONFIG_HUE_FILTER 0 #define CONFIG_HWDOWNLOAD_FILTER 0 #define CONFIG_HWMAP_FILTER 0 @@ -2026,7 +2035,9 @@ #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCDET_FILTER 0 +#define CONFIG_SCHARR_FILTER 0 #define CONFIG_SCROLL_FILTER 0 +#define CONFIG_SEGMENT_FILTER 0 #define CONFIG_SELECT_FILTER 0 #define CONFIG_SELECTIVECOLOR_FILTER 0 #define CONFIG_SENDCMD_FILTER 0 @@ -2587,6 +2598,7 @@ #define CONFIG_MXF_OPATOM_MUXER 0 #define CONFIG_NULL_MUXER 0 #define CONFIG_NUT_MUXER 0 +#define CONFIG_OBU_MUXER 0 #define CONFIG_OGA_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/arm-neon/libavutil/ffversion.h b/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/arm-neon/libavutil/ffversion.h index d4ce7a4e6a7..f26e152f83f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/arm-neon/libavutil/ffversion.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/arm-neon/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "N-104195-g628f528751" +#define FFMPEG_VERSION "N-104707-g392d8a2d60" #endif /* AVUTIL_FFVERSION_H */ diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/arm/config.h b/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/arm/config.h index e6108168cb1..507d136a913 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/arm/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/arm/config.h @@ -1,12 +1,12 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --arch=arm --enable-armv6 --enable-armv6t2 --enable-vfp --enable-thumb --extra-cflags='-march=armv7-a' --enable-cross-compile --target-os=linux --extra-cflags='--target=arm-linux-gnueabihf' --extra-ldflags='--target=arm-linux-gnueabihf' --sysroot=/not_workspace/liberato/release_chrome/src/build/linux/debian_sid_arm-sysroot --extra-cflags='-mtune=cortex-a8' --extra-cflags='-mfloat-abi=hard' --extra-cflags=-O2 --disable-neon --extra-cflags='-mfpu=vfpv3-d16' --enable-pic --cc=clang --cxx=clang++ --ld=clang --extra-ldflags='-fuse-ld=lld'" -- elide long configuration string from binary */ +/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --arch=arm --enable-armv6 --enable-armv6t2 --enable-vfp --enable-thumb --extra-cflags='-march=armv7-a' --enable-cross-compile --target-os=linux --extra-cflags='--target=arm-linux-gnueabihf' --extra-ldflags='--target=arm-linux-gnueabihf' --sysroot=/usr/local/google/home/tguilbert/Code/chromium/src/build/linux/debian_sid_arm-sysroot --extra-cflags='-mtune=cortex-a8' --extra-cflags='-mfloat-abi=hard' --extra-cflags=-O2 --disable-neon --extra-cflags='-mfpu=vfpv3-d16' --enable-pic --cc=clang --cxx=clang++ --ld=clang --extra-ldflags='-fuse-ld=lld'" -- elide long configuration string from binary */ #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2021 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" #define AVCONV_DATADIR "/usr/local/share/ffmpeg" -#define CC_IDENT "clang version 13.0.0 (https://github.com/llvm/llvm-project/ f98ed74f6910f8b09e77497aeb30c860c433610d)" +#define CC_IDENT "clang version 14.0.0 (https://github.com/llvm/llvm-project/ 0e03450ae4358e8a8242b73d493d96efea9d3ccf)" #define OS_NAME linux #define av_restrict restrict #define EXTERN_PREFIX "" @@ -1086,6 +1086,7 @@ #define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 +#define CONFIG_MSNSIREN_DECODER 0 #define CONFIG_NELLYMOSER_DECODER 0 #define CONFIG_ON2AVC_DECODER 0 #define CONFIG_OPUS_DECODER 0 @@ -1355,6 +1356,7 @@ #define CONFIG_RV20_ENCODER 0 #define CONFIG_S302M_ENCODER 0 #define CONFIG_SGI_ENCODER 0 +#define CONFIG_SMC_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_SPEEDHQ_ENCODER 0 #define CONFIG_SUNRAST_ENCODER 0 @@ -1678,6 +1680,7 @@ #define CONFIG_ACRUSHER_FILTER 0 #define CONFIG_ADECLICK_FILTER 0 #define CONFIG_ADECLIP_FILTER 0 +#define CONFIG_ADECORRELATE_FILTER 0 #define CONFIG_ADELAY_FILTER 0 #define CONFIG_ADENORM_FILTER 0 #define CONFIG_ADERIVATIVE_FILTER 0 @@ -1711,11 +1714,13 @@ #define CONFIG_APERMS_FILTER 0 #define CONFIG_APHASER_FILTER 0 #define CONFIG_APHASESHIFT_FILTER 0 +#define CONFIG_APSYCLIP_FILTER 0 #define CONFIG_APULSATOR_FILTER 0 #define CONFIG_AREALTIME_FILTER 0 #define CONFIG_ARESAMPLE_FILTER 0 #define CONFIG_AREVERSE_FILTER 0 #define CONFIG_ARNNDN_FILTER 0 +#define CONFIG_ASEGMENT_FILTER 0 #define CONFIG_ASELECT_FILTER 0 #define CONFIG_ASENDCMD_FILTER 0 #define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1735,6 +1740,7 @@ #define CONFIG_ASUPERPASS_FILTER 0 #define CONFIG_ASUPERSTOP_FILTER 0 #define CONFIG_ATEMPO_FILTER 0 +#define CONFIG_ATILT_FILTER 0 #define CONFIG_ATRIM_FILTER 0 #define CONFIG_AXCORRELATE_FILTER 0 #define CONFIG_AZMQ_FILTER 0 @@ -1913,6 +1919,7 @@ #define CONFIG_GEQ_FILTER 0 #define CONFIG_GRADFUN_FILTER 0 #define CONFIG_GRAPHMONITOR_FILTER 0 +#define CONFIG_GRAYWORLD_FILTER 0 #define CONFIG_GREYEDGE_FILTER 0 #define CONFIG_GUIDED_FILTER 0 #define CONFIG_HALDCLUT_FILTER 0 @@ -1922,6 +1929,8 @@ #define CONFIG_HQDN3D_FILTER 0 #define CONFIG_HQX_FILTER 0 #define CONFIG_HSTACK_FILTER 0 +#define CONFIG_HSVHOLD_FILTER 0 +#define CONFIG_HSVKEY_FILTER 0 #define CONFIG_HUE_FILTER 0 #define CONFIG_HWDOWNLOAD_FILTER 0 #define CONFIG_HWMAP_FILTER 0 @@ -2026,7 +2035,9 @@ #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCDET_FILTER 0 +#define CONFIG_SCHARR_FILTER 0 #define CONFIG_SCROLL_FILTER 0 +#define CONFIG_SEGMENT_FILTER 0 #define CONFIG_SELECT_FILTER 0 #define CONFIG_SELECTIVECOLOR_FILTER 0 #define CONFIG_SENDCMD_FILTER 0 @@ -2587,6 +2598,7 @@ #define CONFIG_MXF_OPATOM_MUXER 0 #define CONFIG_NULL_MUXER 0 #define CONFIG_NUT_MUXER 0 +#define CONFIG_OBU_MUXER 0 #define CONFIG_OGA_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/arm/libavutil/ffversion.h b/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/arm/libavutil/ffversion.h index d4ce7a4e6a7..f26e152f83f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/arm/libavutil/ffversion.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/arm/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "N-104195-g628f528751" +#define FFMPEG_VERSION "N-104707-g392d8a2d60" #endif /* AVUTIL_FFVERSION_H */ diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/arm64/config.h b/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/arm64/config.h index 264f028ba6e..47ec0ad5c18 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/arm64/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/arm64/config.h @@ -1,12 +1,12 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --enable-cross-compile --cross-prefix=/usr/bin/aarch64-linux-gnu- --target-os=linux --extra-cflags='--target=aarch64-linux-gnu' --extra-ldflags='--target=aarch64-linux-gnu' --sysroot=/not_workspace/liberato/release_chrome/src/build/linux/debian_sid_arm64-sysroot --arch=aarch64 --enable-armv8 --extra-cflags='-march=armv8-a' --enable-pic --cc=clang --cxx=clang++ --ld=clang --extra-ldflags='-fuse-ld=lld'" -- elide long configuration string from binary */ +/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --enable-cross-compile --cross-prefix=/usr/bin/aarch64-linux-gnu- --target-os=linux --extra-cflags='--target=aarch64-linux-gnu' --extra-ldflags='--target=aarch64-linux-gnu' --sysroot=/usr/local/google/home/tguilbert/Code/chromium/src/build/linux/debian_sid_arm64-sysroot --arch=aarch64 --enable-armv8 --extra-cflags='-march=armv8-a' --enable-pic --cc=clang --cxx=clang++ --ld=clang --extra-ldflags='-fuse-ld=lld'" -- elide long configuration string from binary */ #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2021 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" #define AVCONV_DATADIR "/usr/local/share/ffmpeg" -#define CC_IDENT "clang version 13.0.0 (https://github.com/llvm/llvm-project/ f98ed74f6910f8b09e77497aeb30c860c433610d)" +#define CC_IDENT "clang version 14.0.0 (https://github.com/llvm/llvm-project/ 0e03450ae4358e8a8242b73d493d96efea9d3ccf)" #define OS_NAME linux #define av_restrict restrict #define EXTERN_PREFIX "" @@ -1086,6 +1086,7 @@ #define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 +#define CONFIG_MSNSIREN_DECODER 0 #define CONFIG_NELLYMOSER_DECODER 0 #define CONFIG_ON2AVC_DECODER 0 #define CONFIG_OPUS_DECODER 0 @@ -1355,6 +1356,7 @@ #define CONFIG_RV20_ENCODER 0 #define CONFIG_S302M_ENCODER 0 #define CONFIG_SGI_ENCODER 0 +#define CONFIG_SMC_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_SPEEDHQ_ENCODER 0 #define CONFIG_SUNRAST_ENCODER 0 @@ -1678,6 +1680,7 @@ #define CONFIG_ACRUSHER_FILTER 0 #define CONFIG_ADECLICK_FILTER 0 #define CONFIG_ADECLIP_FILTER 0 +#define CONFIG_ADECORRELATE_FILTER 0 #define CONFIG_ADELAY_FILTER 0 #define CONFIG_ADENORM_FILTER 0 #define CONFIG_ADERIVATIVE_FILTER 0 @@ -1711,11 +1714,13 @@ #define CONFIG_APERMS_FILTER 0 #define CONFIG_APHASER_FILTER 0 #define CONFIG_APHASESHIFT_FILTER 0 +#define CONFIG_APSYCLIP_FILTER 0 #define CONFIG_APULSATOR_FILTER 0 #define CONFIG_AREALTIME_FILTER 0 #define CONFIG_ARESAMPLE_FILTER 0 #define CONFIG_AREVERSE_FILTER 0 #define CONFIG_ARNNDN_FILTER 0 +#define CONFIG_ASEGMENT_FILTER 0 #define CONFIG_ASELECT_FILTER 0 #define CONFIG_ASENDCMD_FILTER 0 #define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1735,6 +1740,7 @@ #define CONFIG_ASUPERPASS_FILTER 0 #define CONFIG_ASUPERSTOP_FILTER 0 #define CONFIG_ATEMPO_FILTER 0 +#define CONFIG_ATILT_FILTER 0 #define CONFIG_ATRIM_FILTER 0 #define CONFIG_AXCORRELATE_FILTER 0 #define CONFIG_AZMQ_FILTER 0 @@ -1913,6 +1919,7 @@ #define CONFIG_GEQ_FILTER 0 #define CONFIG_GRADFUN_FILTER 0 #define CONFIG_GRAPHMONITOR_FILTER 0 +#define CONFIG_GRAYWORLD_FILTER 0 #define CONFIG_GREYEDGE_FILTER 0 #define CONFIG_GUIDED_FILTER 0 #define CONFIG_HALDCLUT_FILTER 0 @@ -1922,6 +1929,8 @@ #define CONFIG_HQDN3D_FILTER 0 #define CONFIG_HQX_FILTER 0 #define CONFIG_HSTACK_FILTER 0 +#define CONFIG_HSVHOLD_FILTER 0 +#define CONFIG_HSVKEY_FILTER 0 #define CONFIG_HUE_FILTER 0 #define CONFIG_HWDOWNLOAD_FILTER 0 #define CONFIG_HWMAP_FILTER 0 @@ -2026,7 +2035,9 @@ #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCDET_FILTER 0 +#define CONFIG_SCHARR_FILTER 0 #define CONFIG_SCROLL_FILTER 0 +#define CONFIG_SEGMENT_FILTER 0 #define CONFIG_SELECT_FILTER 0 #define CONFIG_SELECTIVECOLOR_FILTER 0 #define CONFIG_SENDCMD_FILTER 0 @@ -2587,6 +2598,7 @@ #define CONFIG_MXF_OPATOM_MUXER 0 #define CONFIG_NULL_MUXER 0 #define CONFIG_NUT_MUXER 0 +#define CONFIG_OBU_MUXER 0 #define CONFIG_OGA_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/arm64/libavutil/ffversion.h b/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/arm64/libavutil/ffversion.h index d4ce7a4e6a7..f26e152f83f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/arm64/libavutil/ffversion.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/arm64/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "N-104195-g628f528751" +#define FFMPEG_VERSION "N-104707-g392d8a2d60" #endif /* AVUTIL_FFVERSION_H */ diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/ia32/config.asm b/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/ia32/config.asm index 67503a715a4..1afd3fa50ea 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/ia32/config.asm +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/ia32/config.asm @@ -216,7 +216,7 @@ %define HAVE_TERMIOS_H 1 %define HAVE_UDPLITE_H 0 %define HAVE_UNISTD_H 1 -%define HAVE_VALGRIND_VALGRIND_H 0 ; %define HAVE_VALGRIND_VALGRIND_H 1 -- forced to 0. See https://crbug.com/590440 +%define HAVE_VALGRIND_VALGRIND_H 0 ; %define HAVE_VALGRIND_VALGRIND_H 0 -- forced to 0. See https://crbug.com/590440 %define HAVE_WINDOWS_H 0 %define HAVE_WINSOCK2_H 0 %define HAVE_INTRINSICS_NEON 0 @@ -1070,6 +1070,7 @@ %define CONFIG_MP3ON4_DECODER 0 %define CONFIG_MPC7_DECODER 0 %define CONFIG_MPC8_DECODER 0 +%define CONFIG_MSNSIREN_DECODER 0 %define CONFIG_NELLYMOSER_DECODER 0 %define CONFIG_ON2AVC_DECODER 0 %define CONFIG_OPUS_DECODER 0 @@ -1339,6 +1340,7 @@ %define CONFIG_RV20_ENCODER 0 %define CONFIG_S302M_ENCODER 0 %define CONFIG_SGI_ENCODER 0 +%define CONFIG_SMC_ENCODER 0 %define CONFIG_SNOW_ENCODER 0 %define CONFIG_SPEEDHQ_ENCODER 0 %define CONFIG_SUNRAST_ENCODER 0 @@ -1662,6 +1664,7 @@ %define CONFIG_ACRUSHER_FILTER 0 %define CONFIG_ADECLICK_FILTER 0 %define CONFIG_ADECLIP_FILTER 0 +%define CONFIG_ADECORRELATE_FILTER 0 %define CONFIG_ADELAY_FILTER 0 %define CONFIG_ADENORM_FILTER 0 %define CONFIG_ADERIVATIVE_FILTER 0 @@ -1695,11 +1698,13 @@ %define CONFIG_APERMS_FILTER 0 %define CONFIG_APHASER_FILTER 0 %define CONFIG_APHASESHIFT_FILTER 0 +%define CONFIG_APSYCLIP_FILTER 0 %define CONFIG_APULSATOR_FILTER 0 %define CONFIG_AREALTIME_FILTER 0 %define CONFIG_ARESAMPLE_FILTER 0 %define CONFIG_AREVERSE_FILTER 0 %define CONFIG_ARNNDN_FILTER 0 +%define CONFIG_ASEGMENT_FILTER 0 %define CONFIG_ASELECT_FILTER 0 %define CONFIG_ASENDCMD_FILTER 0 %define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1719,6 +1724,7 @@ %define CONFIG_ASUPERPASS_FILTER 0 %define CONFIG_ASUPERSTOP_FILTER 0 %define CONFIG_ATEMPO_FILTER 0 +%define CONFIG_ATILT_FILTER 0 %define CONFIG_ATRIM_FILTER 0 %define CONFIG_AXCORRELATE_FILTER 0 %define CONFIG_AZMQ_FILTER 0 @@ -1897,6 +1903,7 @@ %define CONFIG_GEQ_FILTER 0 %define CONFIG_GRADFUN_FILTER 0 %define CONFIG_GRAPHMONITOR_FILTER 0 +%define CONFIG_GRAYWORLD_FILTER 0 %define CONFIG_GREYEDGE_FILTER 0 %define CONFIG_GUIDED_FILTER 0 %define CONFIG_HALDCLUT_FILTER 0 @@ -1906,6 +1913,8 @@ %define CONFIG_HQDN3D_FILTER 0 %define CONFIG_HQX_FILTER 0 %define CONFIG_HSTACK_FILTER 0 +%define CONFIG_HSVHOLD_FILTER 0 +%define CONFIG_HSVKEY_FILTER 0 %define CONFIG_HUE_FILTER 0 %define CONFIG_HWDOWNLOAD_FILTER 0 %define CONFIG_HWMAP_FILTER 0 @@ -2010,7 +2019,9 @@ %define CONFIG_SCALE_VULKAN_FILTER 0 %define CONFIG_SCALE2REF_FILTER 0 %define CONFIG_SCDET_FILTER 0 +%define CONFIG_SCHARR_FILTER 0 %define CONFIG_SCROLL_FILTER 0 +%define CONFIG_SEGMENT_FILTER 0 %define CONFIG_SELECT_FILTER 0 %define CONFIG_SELECTIVECOLOR_FILTER 0 %define CONFIG_SENDCMD_FILTER 0 @@ -2571,6 +2582,7 @@ %define CONFIG_MXF_OPATOM_MUXER 0 %define CONFIG_NULL_MUXER 0 %define CONFIG_NUT_MUXER 0 +%define CONFIG_OBU_MUXER 0 %define CONFIG_OGA_MUXER 0 %define CONFIG_OGG_MUXER 0 %define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/ia32/config.h b/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/ia32/config.h index d1d3604db07..369bdfa2fd9 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/ia32/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/ia32/config.h @@ -1,12 +1,12 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --arch=i686 --extra-cflags='\"-m32\"' --extra-ldflags='\"-m32\"' --enable-pic --cc=clang --cxx=clang++ --ld=clang" -- elide long configuration string from binary */ +/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --arch=i686 --extra-cflags='\"-m32\"' --extra-ldflags='\"-m32\"' --enable-pic --cc=clang --cxx=clang++ --ld=clang" -- elide long configuration string from binary */ #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2021 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" #define AVCONV_DATADIR "/usr/local/share/ffmpeg" -#define CC_IDENT "clang version 13.0.0 (https://github.com/llvm/llvm-project/ f98ed74f6910f8b09e77497aeb30c860c433610d)" +#define CC_IDENT "clang version 14.0.0 (https://github.com/llvm/llvm-project/ 0e03450ae4358e8a8242b73d493d96efea9d3ccf)" #define OS_NAME linux #define av_restrict restrict #define EXTERN_PREFIX "" @@ -232,7 +232,7 @@ #define HAVE_TERMIOS_H 1 #define HAVE_UDPLITE_H 0 #define HAVE_UNISTD_H 1 -#define HAVE_VALGRIND_VALGRIND_H 0 /* #define HAVE_VALGRIND_VALGRIND_H 1 -- forced to 0. See https://crbug.com/590440 */ +#define HAVE_VALGRIND_VALGRIND_H 0 /* #define HAVE_VALGRIND_VALGRIND_H 0 -- forced to 0. See https://crbug.com/590440 */ #define HAVE_WINDOWS_H 0 #define HAVE_WINSOCK2_H 0 #define HAVE_INTRINSICS_NEON 0 @@ -1086,6 +1086,7 @@ #define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 +#define CONFIG_MSNSIREN_DECODER 0 #define CONFIG_NELLYMOSER_DECODER 0 #define CONFIG_ON2AVC_DECODER 0 #define CONFIG_OPUS_DECODER 0 @@ -1355,6 +1356,7 @@ #define CONFIG_RV20_ENCODER 0 #define CONFIG_S302M_ENCODER 0 #define CONFIG_SGI_ENCODER 0 +#define CONFIG_SMC_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_SPEEDHQ_ENCODER 0 #define CONFIG_SUNRAST_ENCODER 0 @@ -1678,6 +1680,7 @@ #define CONFIG_ACRUSHER_FILTER 0 #define CONFIG_ADECLICK_FILTER 0 #define CONFIG_ADECLIP_FILTER 0 +#define CONFIG_ADECORRELATE_FILTER 0 #define CONFIG_ADELAY_FILTER 0 #define CONFIG_ADENORM_FILTER 0 #define CONFIG_ADERIVATIVE_FILTER 0 @@ -1711,11 +1714,13 @@ #define CONFIG_APERMS_FILTER 0 #define CONFIG_APHASER_FILTER 0 #define CONFIG_APHASESHIFT_FILTER 0 +#define CONFIG_APSYCLIP_FILTER 0 #define CONFIG_APULSATOR_FILTER 0 #define CONFIG_AREALTIME_FILTER 0 #define CONFIG_ARESAMPLE_FILTER 0 #define CONFIG_AREVERSE_FILTER 0 #define CONFIG_ARNNDN_FILTER 0 +#define CONFIG_ASEGMENT_FILTER 0 #define CONFIG_ASELECT_FILTER 0 #define CONFIG_ASENDCMD_FILTER 0 #define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1735,6 +1740,7 @@ #define CONFIG_ASUPERPASS_FILTER 0 #define CONFIG_ASUPERSTOP_FILTER 0 #define CONFIG_ATEMPO_FILTER 0 +#define CONFIG_ATILT_FILTER 0 #define CONFIG_ATRIM_FILTER 0 #define CONFIG_AXCORRELATE_FILTER 0 #define CONFIG_AZMQ_FILTER 0 @@ -1913,6 +1919,7 @@ #define CONFIG_GEQ_FILTER 0 #define CONFIG_GRADFUN_FILTER 0 #define CONFIG_GRAPHMONITOR_FILTER 0 +#define CONFIG_GRAYWORLD_FILTER 0 #define CONFIG_GREYEDGE_FILTER 0 #define CONFIG_GUIDED_FILTER 0 #define CONFIG_HALDCLUT_FILTER 0 @@ -1922,6 +1929,8 @@ #define CONFIG_HQDN3D_FILTER 0 #define CONFIG_HQX_FILTER 0 #define CONFIG_HSTACK_FILTER 0 +#define CONFIG_HSVHOLD_FILTER 0 +#define CONFIG_HSVKEY_FILTER 0 #define CONFIG_HUE_FILTER 0 #define CONFIG_HWDOWNLOAD_FILTER 0 #define CONFIG_HWMAP_FILTER 0 @@ -2026,7 +2035,9 @@ #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCDET_FILTER 0 +#define CONFIG_SCHARR_FILTER 0 #define CONFIG_SCROLL_FILTER 0 +#define CONFIG_SEGMENT_FILTER 0 #define CONFIG_SELECT_FILTER 0 #define CONFIG_SELECTIVECOLOR_FILTER 0 #define CONFIG_SENDCMD_FILTER 0 @@ -2587,6 +2598,7 @@ #define CONFIG_MXF_OPATOM_MUXER 0 #define CONFIG_NULL_MUXER 0 #define CONFIG_NUT_MUXER 0 +#define CONFIG_OBU_MUXER 0 #define CONFIG_OGA_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/ia32/libavutil/ffversion.h b/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/ia32/libavutil/ffversion.h index d4ce7a4e6a7..f26e152f83f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/ia32/libavutil/ffversion.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/ia32/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "N-104195-g628f528751" +#define FFMPEG_VERSION "N-104707-g392d8a2d60" #endif /* AVUTIL_FFVERSION_H */ diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/x64/config.asm b/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/x64/config.asm index e62e13ade66..69148e5a058 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/x64/config.asm +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/x64/config.asm @@ -216,7 +216,7 @@ %define HAVE_TERMIOS_H 1 %define HAVE_UDPLITE_H 0 %define HAVE_UNISTD_H 1 -%define HAVE_VALGRIND_VALGRIND_H 0 ; %define HAVE_VALGRIND_VALGRIND_H 1 -- forced to 0. See https://crbug.com/590440 +%define HAVE_VALGRIND_VALGRIND_H 0 ; %define HAVE_VALGRIND_VALGRIND_H 0 -- forced to 0. See https://crbug.com/590440 %define HAVE_WINDOWS_H 0 %define HAVE_WINSOCK2_H 0 %define HAVE_INTRINSICS_NEON 0 @@ -1070,6 +1070,7 @@ %define CONFIG_MP3ON4_DECODER 0 %define CONFIG_MPC7_DECODER 0 %define CONFIG_MPC8_DECODER 0 +%define CONFIG_MSNSIREN_DECODER 0 %define CONFIG_NELLYMOSER_DECODER 0 %define CONFIG_ON2AVC_DECODER 0 %define CONFIG_OPUS_DECODER 0 @@ -1339,6 +1340,7 @@ %define CONFIG_RV20_ENCODER 0 %define CONFIG_S302M_ENCODER 0 %define CONFIG_SGI_ENCODER 0 +%define CONFIG_SMC_ENCODER 0 %define CONFIG_SNOW_ENCODER 0 %define CONFIG_SPEEDHQ_ENCODER 0 %define CONFIG_SUNRAST_ENCODER 0 @@ -1662,6 +1664,7 @@ %define CONFIG_ACRUSHER_FILTER 0 %define CONFIG_ADECLICK_FILTER 0 %define CONFIG_ADECLIP_FILTER 0 +%define CONFIG_ADECORRELATE_FILTER 0 %define CONFIG_ADELAY_FILTER 0 %define CONFIG_ADENORM_FILTER 0 %define CONFIG_ADERIVATIVE_FILTER 0 @@ -1695,11 +1698,13 @@ %define CONFIG_APERMS_FILTER 0 %define CONFIG_APHASER_FILTER 0 %define CONFIG_APHASESHIFT_FILTER 0 +%define CONFIG_APSYCLIP_FILTER 0 %define CONFIG_APULSATOR_FILTER 0 %define CONFIG_AREALTIME_FILTER 0 %define CONFIG_ARESAMPLE_FILTER 0 %define CONFIG_AREVERSE_FILTER 0 %define CONFIG_ARNNDN_FILTER 0 +%define CONFIG_ASEGMENT_FILTER 0 %define CONFIG_ASELECT_FILTER 0 %define CONFIG_ASENDCMD_FILTER 0 %define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1719,6 +1724,7 @@ %define CONFIG_ASUPERPASS_FILTER 0 %define CONFIG_ASUPERSTOP_FILTER 0 %define CONFIG_ATEMPO_FILTER 0 +%define CONFIG_ATILT_FILTER 0 %define CONFIG_ATRIM_FILTER 0 %define CONFIG_AXCORRELATE_FILTER 0 %define CONFIG_AZMQ_FILTER 0 @@ -1897,6 +1903,7 @@ %define CONFIG_GEQ_FILTER 0 %define CONFIG_GRADFUN_FILTER 0 %define CONFIG_GRAPHMONITOR_FILTER 0 +%define CONFIG_GRAYWORLD_FILTER 0 %define CONFIG_GREYEDGE_FILTER 0 %define CONFIG_GUIDED_FILTER 0 %define CONFIG_HALDCLUT_FILTER 0 @@ -1906,6 +1913,8 @@ %define CONFIG_HQDN3D_FILTER 0 %define CONFIG_HQX_FILTER 0 %define CONFIG_HSTACK_FILTER 0 +%define CONFIG_HSVHOLD_FILTER 0 +%define CONFIG_HSVKEY_FILTER 0 %define CONFIG_HUE_FILTER 0 %define CONFIG_HWDOWNLOAD_FILTER 0 %define CONFIG_HWMAP_FILTER 0 @@ -2010,7 +2019,9 @@ %define CONFIG_SCALE_VULKAN_FILTER 0 %define CONFIG_SCALE2REF_FILTER 0 %define CONFIG_SCDET_FILTER 0 +%define CONFIG_SCHARR_FILTER 0 %define CONFIG_SCROLL_FILTER 0 +%define CONFIG_SEGMENT_FILTER 0 %define CONFIG_SELECT_FILTER 0 %define CONFIG_SELECTIVECOLOR_FILTER 0 %define CONFIG_SENDCMD_FILTER 0 @@ -2571,6 +2582,7 @@ %define CONFIG_MXF_OPATOM_MUXER 0 %define CONFIG_NULL_MUXER 0 %define CONFIG_NUT_MUXER 0 +%define CONFIG_OBU_MUXER 0 %define CONFIG_OGA_MUXER 0 %define CONFIG_OGG_MUXER 0 %define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/x64/config.h b/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/x64/config.h index c1416c3d76e..43219bdb852 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/x64/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/x64/config.h @@ -1,12 +1,12 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --enable-lto --enable-pic --cc=clang --cxx=clang++ --ld=clang --extra-ldflags='-fuse-ld=lld'" -- elide long configuration string from binary */ +/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --enable-lto --enable-pic --cc=clang --cxx=clang++ --ld=clang --extra-ldflags='-fuse-ld=lld'" -- elide long configuration string from binary */ #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2021 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" #define AVCONV_DATADIR "/usr/local/share/ffmpeg" -#define CC_IDENT "clang version 13.0.0 (https://github.com/llvm/llvm-project/ f98ed74f6910f8b09e77497aeb30c860c433610d)" +#define CC_IDENT "clang version 14.0.0 (https://github.com/llvm/llvm-project/ 0e03450ae4358e8a8242b73d493d96efea9d3ccf)" #define OS_NAME linux #define av_restrict restrict #define EXTERN_PREFIX "" @@ -232,7 +232,7 @@ #define HAVE_TERMIOS_H 1 #define HAVE_UDPLITE_H 0 #define HAVE_UNISTD_H 1 -#define HAVE_VALGRIND_VALGRIND_H 0 /* #define HAVE_VALGRIND_VALGRIND_H 1 -- forced to 0. See https://crbug.com/590440 */ +#define HAVE_VALGRIND_VALGRIND_H 0 /* #define HAVE_VALGRIND_VALGRIND_H 0 -- forced to 0. See https://crbug.com/590440 */ #define HAVE_WINDOWS_H 0 #define HAVE_WINSOCK2_H 0 #define HAVE_INTRINSICS_NEON 0 @@ -1086,6 +1086,7 @@ #define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 +#define CONFIG_MSNSIREN_DECODER 0 #define CONFIG_NELLYMOSER_DECODER 0 #define CONFIG_ON2AVC_DECODER 0 #define CONFIG_OPUS_DECODER 0 @@ -1355,6 +1356,7 @@ #define CONFIG_RV20_ENCODER 0 #define CONFIG_S302M_ENCODER 0 #define CONFIG_SGI_ENCODER 0 +#define CONFIG_SMC_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_SPEEDHQ_ENCODER 0 #define CONFIG_SUNRAST_ENCODER 0 @@ -1678,6 +1680,7 @@ #define CONFIG_ACRUSHER_FILTER 0 #define CONFIG_ADECLICK_FILTER 0 #define CONFIG_ADECLIP_FILTER 0 +#define CONFIG_ADECORRELATE_FILTER 0 #define CONFIG_ADELAY_FILTER 0 #define CONFIG_ADENORM_FILTER 0 #define CONFIG_ADERIVATIVE_FILTER 0 @@ -1711,11 +1714,13 @@ #define CONFIG_APERMS_FILTER 0 #define CONFIG_APHASER_FILTER 0 #define CONFIG_APHASESHIFT_FILTER 0 +#define CONFIG_APSYCLIP_FILTER 0 #define CONFIG_APULSATOR_FILTER 0 #define CONFIG_AREALTIME_FILTER 0 #define CONFIG_ARESAMPLE_FILTER 0 #define CONFIG_AREVERSE_FILTER 0 #define CONFIG_ARNNDN_FILTER 0 +#define CONFIG_ASEGMENT_FILTER 0 #define CONFIG_ASELECT_FILTER 0 #define CONFIG_ASENDCMD_FILTER 0 #define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1735,6 +1740,7 @@ #define CONFIG_ASUPERPASS_FILTER 0 #define CONFIG_ASUPERSTOP_FILTER 0 #define CONFIG_ATEMPO_FILTER 0 +#define CONFIG_ATILT_FILTER 0 #define CONFIG_ATRIM_FILTER 0 #define CONFIG_AXCORRELATE_FILTER 0 #define CONFIG_AZMQ_FILTER 0 @@ -1913,6 +1919,7 @@ #define CONFIG_GEQ_FILTER 0 #define CONFIG_GRADFUN_FILTER 0 #define CONFIG_GRAPHMONITOR_FILTER 0 +#define CONFIG_GRAYWORLD_FILTER 0 #define CONFIG_GREYEDGE_FILTER 0 #define CONFIG_GUIDED_FILTER 0 #define CONFIG_HALDCLUT_FILTER 0 @@ -1922,6 +1929,8 @@ #define CONFIG_HQDN3D_FILTER 0 #define CONFIG_HQX_FILTER 0 #define CONFIG_HSTACK_FILTER 0 +#define CONFIG_HSVHOLD_FILTER 0 +#define CONFIG_HSVKEY_FILTER 0 #define CONFIG_HUE_FILTER 0 #define CONFIG_HWDOWNLOAD_FILTER 0 #define CONFIG_HWMAP_FILTER 0 @@ -2026,7 +2035,9 @@ #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCDET_FILTER 0 +#define CONFIG_SCHARR_FILTER 0 #define CONFIG_SCROLL_FILTER 0 +#define CONFIG_SEGMENT_FILTER 0 #define CONFIG_SELECT_FILTER 0 #define CONFIG_SELECTIVECOLOR_FILTER 0 #define CONFIG_SENDCMD_FILTER 0 @@ -2587,6 +2598,7 @@ #define CONFIG_MXF_OPATOM_MUXER 0 #define CONFIG_NULL_MUXER 0 #define CONFIG_NUT_MUXER 0 +#define CONFIG_OBU_MUXER 0 #define CONFIG_OGA_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/x64/libavutil/ffversion.h b/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/x64/libavutil/ffversion.h index d4ce7a4e6a7..f26e152f83f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/x64/libavutil/ffversion.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/linux/x64/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "N-104195-g628f528751" +#define FFMPEG_VERSION "N-104707-g392d8a2d60" #endif /* AVUTIL_FFVERSION_H */ diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/mac/arm64/config.h b/chromium/third_party/ffmpeg/chromium/config/Chromium/mac/arm64/config.h index 50bda42dc51..2533e0b797b 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/mac/arm64/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/mac/arm64/config.h @@ -1,12 +1,12 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --enable-pic --cc=clang --cxx=clang++ --ld=clang --enable-cross-compile --cc=clang --ld=ld64.lld --nm=llvm-nm --ar=llvm-ar --target-os=darwin --extra-cflags='--target=arm64-apple-macosx' --extra-cflags=-F/not_workspace/liberato/release_chrome/src/build/mac_files/xcode_binaries/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks --extra-cflags='-mmacosx-version-min=10.10' --extra-cflags=-fblocks --extra-cflags=-nostdinc --extra-cflags=-isystem/not_workspace/liberato/release_chrome/src/build/mac_files/xcode_binaries/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include --extra-cflags=-isystem/not_workspace/liberato/release_chrome/src/third_party/llvm-build/Release+Asserts/lib/clang/13.0.0/include --extra-ldflags=-syslibroot --extra-ldflags=/not_workspace/liberato/release_chrome/src/build/mac_files/xcode_binaries/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk --extra-ldflags=-L/not_workspace/liberato/release_chrome/src/build/mac_files/xcode_binaries/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib --extra-ldflags=-lSystem --extra-ldflags=-macosx_version_min --extra-ldflags=10.10 --extra-ldflags=-sdk_version --extra-ldflags=10.10 --extra-ldflags=-platform_version --extra-ldflags=macos --extra-ldflags=10.10 --extra-ldflags=10.10 --arch=arm64 --extra-cflags='-arch arm64' --extra-ldflags='-arch arm64'" -- elide long configuration string from binary */ +/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --enable-pic --cc=clang --cxx=clang++ --ld=clang --enable-cross-compile --cc=clang --ld=ld64.lld --nm=llvm-nm --ar=llvm-ar --target-os=darwin --extra-cflags='--target=arm64-apple-macosx' --extra-cflags=-F/usr/local/google/home/tguilbert/Code/chromium/src/build/mac_files/xcode_binaries/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks --extra-cflags='-mmacosx-version-min=10.10' --extra-cflags=-fblocks --extra-cflags=-nostdinc --extra-cflags=-isystem/usr/local/google/home/tguilbert/Code/chromium/src/build/mac_files/xcode_binaries/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include --extra-cflags=-isystem/usr/local/google/home/tguilbert/Code/chromium/src/third_party/llvm-build/Release+Asserts/lib/clang/14.0.0/include --extra-ldflags=-syslibroot --extra-ldflags=/usr/local/google/home/tguilbert/Code/chromium/src/build/mac_files/xcode_binaries/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk --extra-ldflags=-L/usr/local/google/home/tguilbert/Code/chromium/src/build/mac_files/xcode_binaries/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib --extra-ldflags=-lSystem --extra-ldflags=-macosx_version_min --extra-ldflags=10.10 --extra-ldflags=-sdk_version --extra-ldflags=10.10 --extra-ldflags=-platform_version --extra-ldflags=macos --extra-ldflags=10.10 --extra-ldflags=10.10 --arch=arm64 --extra-cflags='-arch arm64' --extra-ldflags='-arch arm64'" -- elide long configuration string from binary */ #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2021 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" #define AVCONV_DATADIR "/usr/local/share/ffmpeg" -#define CC_IDENT "clang version 13.0.0 (https://github.com/llvm/llvm-project/ f98ed74f6910f8b09e77497aeb30c860c433610d)" +#define CC_IDENT "clang version 14.0.0 (https://github.com/llvm/llvm-project/ 0e03450ae4358e8a8242b73d493d96efea9d3ccf)" #define OS_NAME darwin #define av_restrict restrict #define EXTERN_PREFIX "_" @@ -1086,6 +1086,7 @@ #define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 +#define CONFIG_MSNSIREN_DECODER 0 #define CONFIG_NELLYMOSER_DECODER 0 #define CONFIG_ON2AVC_DECODER 0 #define CONFIG_OPUS_DECODER 0 @@ -1355,6 +1356,7 @@ #define CONFIG_RV20_ENCODER 0 #define CONFIG_S302M_ENCODER 0 #define CONFIG_SGI_ENCODER 0 +#define CONFIG_SMC_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_SPEEDHQ_ENCODER 0 #define CONFIG_SUNRAST_ENCODER 0 @@ -1678,6 +1680,7 @@ #define CONFIG_ACRUSHER_FILTER 0 #define CONFIG_ADECLICK_FILTER 0 #define CONFIG_ADECLIP_FILTER 0 +#define CONFIG_ADECORRELATE_FILTER 0 #define CONFIG_ADELAY_FILTER 0 #define CONFIG_ADENORM_FILTER 0 #define CONFIG_ADERIVATIVE_FILTER 0 @@ -1711,11 +1714,13 @@ #define CONFIG_APERMS_FILTER 0 #define CONFIG_APHASER_FILTER 0 #define CONFIG_APHASESHIFT_FILTER 0 +#define CONFIG_APSYCLIP_FILTER 0 #define CONFIG_APULSATOR_FILTER 0 #define CONFIG_AREALTIME_FILTER 0 #define CONFIG_ARESAMPLE_FILTER 0 #define CONFIG_AREVERSE_FILTER 0 #define CONFIG_ARNNDN_FILTER 0 +#define CONFIG_ASEGMENT_FILTER 0 #define CONFIG_ASELECT_FILTER 0 #define CONFIG_ASENDCMD_FILTER 0 #define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1735,6 +1740,7 @@ #define CONFIG_ASUPERPASS_FILTER 0 #define CONFIG_ASUPERSTOP_FILTER 0 #define CONFIG_ATEMPO_FILTER 0 +#define CONFIG_ATILT_FILTER 0 #define CONFIG_ATRIM_FILTER 0 #define CONFIG_AXCORRELATE_FILTER 0 #define CONFIG_AZMQ_FILTER 0 @@ -1913,6 +1919,7 @@ #define CONFIG_GEQ_FILTER 0 #define CONFIG_GRADFUN_FILTER 0 #define CONFIG_GRAPHMONITOR_FILTER 0 +#define CONFIG_GRAYWORLD_FILTER 0 #define CONFIG_GREYEDGE_FILTER 0 #define CONFIG_GUIDED_FILTER 0 #define CONFIG_HALDCLUT_FILTER 0 @@ -1922,6 +1929,8 @@ #define CONFIG_HQDN3D_FILTER 0 #define CONFIG_HQX_FILTER 0 #define CONFIG_HSTACK_FILTER 0 +#define CONFIG_HSVHOLD_FILTER 0 +#define CONFIG_HSVKEY_FILTER 0 #define CONFIG_HUE_FILTER 0 #define CONFIG_HWDOWNLOAD_FILTER 0 #define CONFIG_HWMAP_FILTER 0 @@ -2026,7 +2035,9 @@ #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCDET_FILTER 0 +#define CONFIG_SCHARR_FILTER 0 #define CONFIG_SCROLL_FILTER 0 +#define CONFIG_SEGMENT_FILTER 0 #define CONFIG_SELECT_FILTER 0 #define CONFIG_SELECTIVECOLOR_FILTER 0 #define CONFIG_SENDCMD_FILTER 0 @@ -2587,6 +2598,7 @@ #define CONFIG_MXF_OPATOM_MUXER 0 #define CONFIG_NULL_MUXER 0 #define CONFIG_NUT_MUXER 0 +#define CONFIG_OBU_MUXER 0 #define CONFIG_OGA_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/mac/arm64/libavutil/ffversion.h b/chromium/third_party/ffmpeg/chromium/config/Chromium/mac/arm64/libavutil/ffversion.h index d4ce7a4e6a7..f26e152f83f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/mac/arm64/libavutil/ffversion.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/mac/arm64/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "N-104195-g628f528751" +#define FFMPEG_VERSION "N-104707-g392d8a2d60" #endif /* AVUTIL_FFVERSION_H */ diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/mac/x64/config.asm b/chromium/third_party/ffmpeg/chromium/config/Chromium/mac/x64/config.asm index 40184b5acdb..2dc511f3b95 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/mac/x64/config.asm +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/mac/x64/config.asm @@ -1070,6 +1070,7 @@ %define CONFIG_MP3ON4_DECODER 0 %define CONFIG_MPC7_DECODER 0 %define CONFIG_MPC8_DECODER 0 +%define CONFIG_MSNSIREN_DECODER 0 %define CONFIG_NELLYMOSER_DECODER 0 %define CONFIG_ON2AVC_DECODER 0 %define CONFIG_OPUS_DECODER 0 @@ -1339,6 +1340,7 @@ %define CONFIG_RV20_ENCODER 0 %define CONFIG_S302M_ENCODER 0 %define CONFIG_SGI_ENCODER 0 +%define CONFIG_SMC_ENCODER 0 %define CONFIG_SNOW_ENCODER 0 %define CONFIG_SPEEDHQ_ENCODER 0 %define CONFIG_SUNRAST_ENCODER 0 @@ -1662,6 +1664,7 @@ %define CONFIG_ACRUSHER_FILTER 0 %define CONFIG_ADECLICK_FILTER 0 %define CONFIG_ADECLIP_FILTER 0 +%define CONFIG_ADECORRELATE_FILTER 0 %define CONFIG_ADELAY_FILTER 0 %define CONFIG_ADENORM_FILTER 0 %define CONFIG_ADERIVATIVE_FILTER 0 @@ -1695,11 +1698,13 @@ %define CONFIG_APERMS_FILTER 0 %define CONFIG_APHASER_FILTER 0 %define CONFIG_APHASESHIFT_FILTER 0 +%define CONFIG_APSYCLIP_FILTER 0 %define CONFIG_APULSATOR_FILTER 0 %define CONFIG_AREALTIME_FILTER 0 %define CONFIG_ARESAMPLE_FILTER 0 %define CONFIG_AREVERSE_FILTER 0 %define CONFIG_ARNNDN_FILTER 0 +%define CONFIG_ASEGMENT_FILTER 0 %define CONFIG_ASELECT_FILTER 0 %define CONFIG_ASENDCMD_FILTER 0 %define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1719,6 +1724,7 @@ %define CONFIG_ASUPERPASS_FILTER 0 %define CONFIG_ASUPERSTOP_FILTER 0 %define CONFIG_ATEMPO_FILTER 0 +%define CONFIG_ATILT_FILTER 0 %define CONFIG_ATRIM_FILTER 0 %define CONFIG_AXCORRELATE_FILTER 0 %define CONFIG_AZMQ_FILTER 0 @@ -1897,6 +1903,7 @@ %define CONFIG_GEQ_FILTER 0 %define CONFIG_GRADFUN_FILTER 0 %define CONFIG_GRAPHMONITOR_FILTER 0 +%define CONFIG_GRAYWORLD_FILTER 0 %define CONFIG_GREYEDGE_FILTER 0 %define CONFIG_GUIDED_FILTER 0 %define CONFIG_HALDCLUT_FILTER 0 @@ -1906,6 +1913,8 @@ %define CONFIG_HQDN3D_FILTER 0 %define CONFIG_HQX_FILTER 0 %define CONFIG_HSTACK_FILTER 0 +%define CONFIG_HSVHOLD_FILTER 0 +%define CONFIG_HSVKEY_FILTER 0 %define CONFIG_HUE_FILTER 0 %define CONFIG_HWDOWNLOAD_FILTER 0 %define CONFIG_HWMAP_FILTER 0 @@ -2010,7 +2019,9 @@ %define CONFIG_SCALE_VULKAN_FILTER 0 %define CONFIG_SCALE2REF_FILTER 0 %define CONFIG_SCDET_FILTER 0 +%define CONFIG_SCHARR_FILTER 0 %define CONFIG_SCROLL_FILTER 0 +%define CONFIG_SEGMENT_FILTER 0 %define CONFIG_SELECT_FILTER 0 %define CONFIG_SELECTIVECOLOR_FILTER 0 %define CONFIG_SENDCMD_FILTER 0 @@ -2571,6 +2582,7 @@ %define CONFIG_MXF_OPATOM_MUXER 0 %define CONFIG_NULL_MUXER 0 %define CONFIG_NUT_MUXER 0 +%define CONFIG_OBU_MUXER 0 %define CONFIG_OGA_MUXER 0 %define CONFIG_OGG_MUXER 0 %define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/mac/x64/config.h b/chromium/third_party/ffmpeg/chromium/config/Chromium/mac/x64/config.h index 18cdc3761a8..3f36e3f9028 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/mac/x64/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/mac/x64/config.h @@ -1,12 +1,12 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --enable-pic --cc=clang --cxx=clang++ --ld=clang --enable-cross-compile --cc=clang --ld=ld64.lld --nm=llvm-nm --ar=llvm-ar --target-os=darwin --extra-cflags='--target=x86_64-apple-macosx' --extra-cflags=-F/not_workspace/liberato/release_chrome/src/build/mac_files/xcode_binaries/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks --extra-cflags='-mmacosx-version-min=10.10' --extra-cflags=-fblocks --extra-cflags=-nostdinc --extra-cflags=-isystem/not_workspace/liberato/release_chrome/src/build/mac_files/xcode_binaries/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include --extra-cflags=-isystem/not_workspace/liberato/release_chrome/src/third_party/llvm-build/Release+Asserts/lib/clang/13.0.0/include --extra-ldflags=-syslibroot --extra-ldflags=/not_workspace/liberato/release_chrome/src/build/mac_files/xcode_binaries/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk --extra-ldflags=-L/not_workspace/liberato/release_chrome/src/build/mac_files/xcode_binaries/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib --extra-ldflags=-lSystem --extra-ldflags=-macosx_version_min --extra-ldflags=10.10 --extra-ldflags=-sdk_version --extra-ldflags=10.10 --extra-ldflags=-platform_version --extra-ldflags=macos --extra-ldflags=10.10 --extra-ldflags=10.10 --arch=x86_64 --extra-cflags=-m64 --extra-ldflags='-arch x86_64'" -- elide long configuration string from binary */ +/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --enable-pic --cc=clang --cxx=clang++ --ld=clang --enable-cross-compile --cc=clang --ld=ld64.lld --nm=llvm-nm --ar=llvm-ar --target-os=darwin --extra-cflags='--target=x86_64-apple-macosx' --extra-cflags=-F/usr/local/google/home/tguilbert/Code/chromium/src/build/mac_files/xcode_binaries/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks --extra-cflags='-mmacosx-version-min=10.10' --extra-cflags=-fblocks --extra-cflags=-nostdinc --extra-cflags=-isystem/usr/local/google/home/tguilbert/Code/chromium/src/build/mac_files/xcode_binaries/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include --extra-cflags=-isystem/usr/local/google/home/tguilbert/Code/chromium/src/third_party/llvm-build/Release+Asserts/lib/clang/14.0.0/include --extra-ldflags=-syslibroot --extra-ldflags=/usr/local/google/home/tguilbert/Code/chromium/src/build/mac_files/xcode_binaries/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk --extra-ldflags=-L/usr/local/google/home/tguilbert/Code/chromium/src/build/mac_files/xcode_binaries/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib --extra-ldflags=-lSystem --extra-ldflags=-macosx_version_min --extra-ldflags=10.10 --extra-ldflags=-sdk_version --extra-ldflags=10.10 --extra-ldflags=-platform_version --extra-ldflags=macos --extra-ldflags=10.10 --extra-ldflags=10.10 --arch=x86_64 --extra-cflags=-m64 --extra-ldflags='-arch x86_64'" -- elide long configuration string from binary */ #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2021 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" #define AVCONV_DATADIR "/usr/local/share/ffmpeg" -#define CC_IDENT "clang version 13.0.0 (https://github.com/llvm/llvm-project/ f98ed74f6910f8b09e77497aeb30c860c433610d)" +#define CC_IDENT "clang version 14.0.0 (https://github.com/llvm/llvm-project/ 0e03450ae4358e8a8242b73d493d96efea9d3ccf)" #define OS_NAME darwin #define av_restrict restrict #define EXTERN_PREFIX "_" @@ -1086,6 +1086,7 @@ #define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 +#define CONFIG_MSNSIREN_DECODER 0 #define CONFIG_NELLYMOSER_DECODER 0 #define CONFIG_ON2AVC_DECODER 0 #define CONFIG_OPUS_DECODER 0 @@ -1355,6 +1356,7 @@ #define CONFIG_RV20_ENCODER 0 #define CONFIG_S302M_ENCODER 0 #define CONFIG_SGI_ENCODER 0 +#define CONFIG_SMC_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_SPEEDHQ_ENCODER 0 #define CONFIG_SUNRAST_ENCODER 0 @@ -1678,6 +1680,7 @@ #define CONFIG_ACRUSHER_FILTER 0 #define CONFIG_ADECLICK_FILTER 0 #define CONFIG_ADECLIP_FILTER 0 +#define CONFIG_ADECORRELATE_FILTER 0 #define CONFIG_ADELAY_FILTER 0 #define CONFIG_ADENORM_FILTER 0 #define CONFIG_ADERIVATIVE_FILTER 0 @@ -1711,11 +1714,13 @@ #define CONFIG_APERMS_FILTER 0 #define CONFIG_APHASER_FILTER 0 #define CONFIG_APHASESHIFT_FILTER 0 +#define CONFIG_APSYCLIP_FILTER 0 #define CONFIG_APULSATOR_FILTER 0 #define CONFIG_AREALTIME_FILTER 0 #define CONFIG_ARESAMPLE_FILTER 0 #define CONFIG_AREVERSE_FILTER 0 #define CONFIG_ARNNDN_FILTER 0 +#define CONFIG_ASEGMENT_FILTER 0 #define CONFIG_ASELECT_FILTER 0 #define CONFIG_ASENDCMD_FILTER 0 #define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1735,6 +1740,7 @@ #define CONFIG_ASUPERPASS_FILTER 0 #define CONFIG_ASUPERSTOP_FILTER 0 #define CONFIG_ATEMPO_FILTER 0 +#define CONFIG_ATILT_FILTER 0 #define CONFIG_ATRIM_FILTER 0 #define CONFIG_AXCORRELATE_FILTER 0 #define CONFIG_AZMQ_FILTER 0 @@ -1913,6 +1919,7 @@ #define CONFIG_GEQ_FILTER 0 #define CONFIG_GRADFUN_FILTER 0 #define CONFIG_GRAPHMONITOR_FILTER 0 +#define CONFIG_GRAYWORLD_FILTER 0 #define CONFIG_GREYEDGE_FILTER 0 #define CONFIG_GUIDED_FILTER 0 #define CONFIG_HALDCLUT_FILTER 0 @@ -1922,6 +1929,8 @@ #define CONFIG_HQDN3D_FILTER 0 #define CONFIG_HQX_FILTER 0 #define CONFIG_HSTACK_FILTER 0 +#define CONFIG_HSVHOLD_FILTER 0 +#define CONFIG_HSVKEY_FILTER 0 #define CONFIG_HUE_FILTER 0 #define CONFIG_HWDOWNLOAD_FILTER 0 #define CONFIG_HWMAP_FILTER 0 @@ -2026,7 +2035,9 @@ #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCDET_FILTER 0 +#define CONFIG_SCHARR_FILTER 0 #define CONFIG_SCROLL_FILTER 0 +#define CONFIG_SEGMENT_FILTER 0 #define CONFIG_SELECT_FILTER 0 #define CONFIG_SELECTIVECOLOR_FILTER 0 #define CONFIG_SENDCMD_FILTER 0 @@ -2587,6 +2598,7 @@ #define CONFIG_MXF_OPATOM_MUXER 0 #define CONFIG_NULL_MUXER 0 #define CONFIG_NUT_MUXER 0 +#define CONFIG_OBU_MUXER 0 #define CONFIG_OGA_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/mac/x64/libavutil/ffversion.h b/chromium/third_party/ffmpeg/chromium/config/Chromium/mac/x64/libavutil/ffversion.h index d4ce7a4e6a7..f26e152f83f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/mac/x64/libavutil/ffversion.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/mac/x64/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "N-104195-g628f528751" +#define FFMPEG_VERSION "N-104707-g392d8a2d60" #endif /* AVUTIL_FFVERSION_H */ diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/win/arm64/config.h b/chromium/third_party/ffmpeg/chromium/config/Chromium/win/arm64/config.h index ad54d7f023b..8158ab0f349 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/win/arm64/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/win/arm64/config.h @@ -1,12 +1,12 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --toolchain=msvc --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/ffmpeg/chromium/include/win --enable-cross-compile --cc=clang-cl --ld=lld-link --nm=llvm-nm --ar=llvm-ar --extra-cflags=-O2 --arch=aarch64 --as=clang-cl --extra-cflags='--target=arm64-windows' --extra-cflags=/winsysroot/not_workspace/liberato/release_chrome/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e --extra-ldflags='-libpath:/not_workspace/liberato/release_chrome/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/VC/Tools/MSVC/14.26.28801/atlmfc/lib/arm64' --extra-ldflags='-libpath:/workspace/tmp/windows_build_ffmpeg3zWISo' --extra-ldflags='-libpath:/workspace/tmp/windows_build_ffmpegislnhB' --extra-ldflags='-libpath:/not_workspace/liberato/release_chrome/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/VC/Tools/MSVC/14.26.28801/lib/arm64'" -- elide long configuration string from binary */ +/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --toolchain=msvc --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/ffmpeg/chromium/include/win --enable-cross-compile --cc=clang-cl --ld=lld-link --nm=llvm-nm --ar=llvm-ar --extra-cflags=-O2 --arch=aarch64 --as=clang-cl --extra-cflags='--target=arm64-windows' --extra-cflags=/winsysroot/usr/local/google/home/tguilbert/Code/chromium/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e --extra-ldflags='-libpath:/usr/local/google/home/tguilbert/Code/chromium/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/VC/Tools/MSVC/14.26.28801/atlmfc/lib/arm64' --extra-ldflags='-libpath:/tmp/windows_build_ffmpegZqNUos' --extra-ldflags='-libpath:/tmp/windows_build_ffmpeg9dTHEA' --extra-ldflags='-libpath:/usr/local/google/home/tguilbert/Code/chromium/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/VC/Tools/MSVC/14.26.28801/lib/arm64'" -- elide long configuration string from binary */ #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2021 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" #define AVCONV_DATADIR "/usr/local/share/ffmpeg" -#define CC_IDENT "clang version 13.0.0 (https://github.com/llvm/llvm-project/ f98ed74f6910f8b09e77497aeb30c860c433610d)" +#define CC_IDENT "clang version 14.0.0 (https://github.com/llvm/llvm-project/ 0e03450ae4358e8a8242b73d493d96efea9d3ccf)" #define OS_NAME win32 #define av_restrict restrict #define EXTERN_PREFIX "" @@ -1086,6 +1086,7 @@ #define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 +#define CONFIG_MSNSIREN_DECODER 0 #define CONFIG_NELLYMOSER_DECODER 0 #define CONFIG_ON2AVC_DECODER 0 #define CONFIG_OPUS_DECODER 0 @@ -1355,6 +1356,7 @@ #define CONFIG_RV20_ENCODER 0 #define CONFIG_S302M_ENCODER 0 #define CONFIG_SGI_ENCODER 0 +#define CONFIG_SMC_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_SPEEDHQ_ENCODER 0 #define CONFIG_SUNRAST_ENCODER 0 @@ -1678,6 +1680,7 @@ #define CONFIG_ACRUSHER_FILTER 0 #define CONFIG_ADECLICK_FILTER 0 #define CONFIG_ADECLIP_FILTER 0 +#define CONFIG_ADECORRELATE_FILTER 0 #define CONFIG_ADELAY_FILTER 0 #define CONFIG_ADENORM_FILTER 0 #define CONFIG_ADERIVATIVE_FILTER 0 @@ -1711,11 +1714,13 @@ #define CONFIG_APERMS_FILTER 0 #define CONFIG_APHASER_FILTER 0 #define CONFIG_APHASESHIFT_FILTER 0 +#define CONFIG_APSYCLIP_FILTER 0 #define CONFIG_APULSATOR_FILTER 0 #define CONFIG_AREALTIME_FILTER 0 #define CONFIG_ARESAMPLE_FILTER 0 #define CONFIG_AREVERSE_FILTER 0 #define CONFIG_ARNNDN_FILTER 0 +#define CONFIG_ASEGMENT_FILTER 0 #define CONFIG_ASELECT_FILTER 0 #define CONFIG_ASENDCMD_FILTER 0 #define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1735,6 +1740,7 @@ #define CONFIG_ASUPERPASS_FILTER 0 #define CONFIG_ASUPERSTOP_FILTER 0 #define CONFIG_ATEMPO_FILTER 0 +#define CONFIG_ATILT_FILTER 0 #define CONFIG_ATRIM_FILTER 0 #define CONFIG_AXCORRELATE_FILTER 0 #define CONFIG_AZMQ_FILTER 0 @@ -1913,6 +1919,7 @@ #define CONFIG_GEQ_FILTER 0 #define CONFIG_GRADFUN_FILTER 0 #define CONFIG_GRAPHMONITOR_FILTER 0 +#define CONFIG_GRAYWORLD_FILTER 0 #define CONFIG_GREYEDGE_FILTER 0 #define CONFIG_GUIDED_FILTER 0 #define CONFIG_HALDCLUT_FILTER 0 @@ -1922,6 +1929,8 @@ #define CONFIG_HQDN3D_FILTER 0 #define CONFIG_HQX_FILTER 0 #define CONFIG_HSTACK_FILTER 0 +#define CONFIG_HSVHOLD_FILTER 0 +#define CONFIG_HSVKEY_FILTER 0 #define CONFIG_HUE_FILTER 0 #define CONFIG_HWDOWNLOAD_FILTER 0 #define CONFIG_HWMAP_FILTER 0 @@ -2026,7 +2035,9 @@ #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCDET_FILTER 0 +#define CONFIG_SCHARR_FILTER 0 #define CONFIG_SCROLL_FILTER 0 +#define CONFIG_SEGMENT_FILTER 0 #define CONFIG_SELECT_FILTER 0 #define CONFIG_SELECTIVECOLOR_FILTER 0 #define CONFIG_SENDCMD_FILTER 0 @@ -2587,6 +2598,7 @@ #define CONFIG_MXF_OPATOM_MUXER 0 #define CONFIG_NULL_MUXER 0 #define CONFIG_NUT_MUXER 0 +#define CONFIG_OBU_MUXER 0 #define CONFIG_OGA_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/win/arm64/libavutil/ffversion.h b/chromium/third_party/ffmpeg/chromium/config/Chromium/win/arm64/libavutil/ffversion.h index d4ce7a4e6a7..f26e152f83f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/win/arm64/libavutil/ffversion.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/win/arm64/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "N-104195-g628f528751" +#define FFMPEG_VERSION "N-104707-g392d8a2d60" #endif /* AVUTIL_FFVERSION_H */ diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/win/ia32/config.asm b/chromium/third_party/ffmpeg/chromium/config/Chromium/win/ia32/config.asm index bdf08a88610..061c10759d3 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/win/ia32/config.asm +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/win/ia32/config.asm @@ -1070,6 +1070,7 @@ %define CONFIG_MP3ON4_DECODER 0 %define CONFIG_MPC7_DECODER 0 %define CONFIG_MPC8_DECODER 0 +%define CONFIG_MSNSIREN_DECODER 0 %define CONFIG_NELLYMOSER_DECODER 0 %define CONFIG_ON2AVC_DECODER 0 %define CONFIG_OPUS_DECODER 0 @@ -1339,6 +1340,7 @@ %define CONFIG_RV20_ENCODER 0 %define CONFIG_S302M_ENCODER 0 %define CONFIG_SGI_ENCODER 0 +%define CONFIG_SMC_ENCODER 0 %define CONFIG_SNOW_ENCODER 0 %define CONFIG_SPEEDHQ_ENCODER 0 %define CONFIG_SUNRAST_ENCODER 0 @@ -1662,6 +1664,7 @@ %define CONFIG_ACRUSHER_FILTER 0 %define CONFIG_ADECLICK_FILTER 0 %define CONFIG_ADECLIP_FILTER 0 +%define CONFIG_ADECORRELATE_FILTER 0 %define CONFIG_ADELAY_FILTER 0 %define CONFIG_ADENORM_FILTER 0 %define CONFIG_ADERIVATIVE_FILTER 0 @@ -1695,11 +1698,13 @@ %define CONFIG_APERMS_FILTER 0 %define CONFIG_APHASER_FILTER 0 %define CONFIG_APHASESHIFT_FILTER 0 +%define CONFIG_APSYCLIP_FILTER 0 %define CONFIG_APULSATOR_FILTER 0 %define CONFIG_AREALTIME_FILTER 0 %define CONFIG_ARESAMPLE_FILTER 0 %define CONFIG_AREVERSE_FILTER 0 %define CONFIG_ARNNDN_FILTER 0 +%define CONFIG_ASEGMENT_FILTER 0 %define CONFIG_ASELECT_FILTER 0 %define CONFIG_ASENDCMD_FILTER 0 %define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1719,6 +1724,7 @@ %define CONFIG_ASUPERPASS_FILTER 0 %define CONFIG_ASUPERSTOP_FILTER 0 %define CONFIG_ATEMPO_FILTER 0 +%define CONFIG_ATILT_FILTER 0 %define CONFIG_ATRIM_FILTER 0 %define CONFIG_AXCORRELATE_FILTER 0 %define CONFIG_AZMQ_FILTER 0 @@ -1897,6 +1903,7 @@ %define CONFIG_GEQ_FILTER 0 %define CONFIG_GRADFUN_FILTER 0 %define CONFIG_GRAPHMONITOR_FILTER 0 +%define CONFIG_GRAYWORLD_FILTER 0 %define CONFIG_GREYEDGE_FILTER 0 %define CONFIG_GUIDED_FILTER 0 %define CONFIG_HALDCLUT_FILTER 0 @@ -1906,6 +1913,8 @@ %define CONFIG_HQDN3D_FILTER 0 %define CONFIG_HQX_FILTER 0 %define CONFIG_HSTACK_FILTER 0 +%define CONFIG_HSVHOLD_FILTER 0 +%define CONFIG_HSVKEY_FILTER 0 %define CONFIG_HUE_FILTER 0 %define CONFIG_HWDOWNLOAD_FILTER 0 %define CONFIG_HWMAP_FILTER 0 @@ -2010,7 +2019,9 @@ %define CONFIG_SCALE_VULKAN_FILTER 0 %define CONFIG_SCALE2REF_FILTER 0 %define CONFIG_SCDET_FILTER 0 +%define CONFIG_SCHARR_FILTER 0 %define CONFIG_SCROLL_FILTER 0 +%define CONFIG_SEGMENT_FILTER 0 %define CONFIG_SELECT_FILTER 0 %define CONFIG_SELECTIVECOLOR_FILTER 0 %define CONFIG_SENDCMD_FILTER 0 @@ -2571,6 +2582,7 @@ %define CONFIG_MXF_OPATOM_MUXER 0 %define CONFIG_NULL_MUXER 0 %define CONFIG_NUT_MUXER 0 +%define CONFIG_OBU_MUXER 0 %define CONFIG_OGA_MUXER 0 %define CONFIG_OGG_MUXER 0 %define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/win/ia32/config.h b/chromium/third_party/ffmpeg/chromium/config/Chromium/win/ia32/config.h index 4e3654c9dab..985488092d3 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/win/ia32/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/win/ia32/config.h @@ -1,12 +1,12 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --toolchain=msvc --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/ffmpeg/chromium/include/win --enable-cross-compile --cc=clang-cl --ld=lld-link --nm=llvm-nm --ar=llvm-ar --extra-cflags=-O2 --extra-cflags=-m32 --extra-cflags=/winsysroot/not_workspace/liberato/release_chrome/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e --extra-ldflags='-libpath:/not_workspace/liberato/release_chrome/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/VC/Tools/MSVC/14.26.28801/atlmfc/lib/x86' --extra-ldflags='-libpath:/workspace/tmp/windows_build_ffmpegGeWVF5' --extra-ldflags='-libpath:/workspace/tmp/windows_build_ffmpeg1Zay0u' --extra-ldflags='-libpath:/not_workspace/liberato/release_chrome/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/VC/Tools/MSVC/14.26.28801/lib/x86'" -- elide long configuration string from binary */ +/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --toolchain=msvc --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/ffmpeg/chromium/include/win --enable-cross-compile --cc=clang-cl --ld=lld-link --nm=llvm-nm --ar=llvm-ar --extra-cflags=-O2 --extra-cflags=-m32 --extra-cflags=/winsysroot/usr/local/google/home/tguilbert/Code/chromium/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e --extra-ldflags='-libpath:/usr/local/google/home/tguilbert/Code/chromium/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/VC/Tools/MSVC/14.26.28801/atlmfc/lib/x86' --extra-ldflags='-libpath:/tmp/windows_build_ffmpeglWSOQk' --extra-ldflags='-libpath:/tmp/windows_build_ffmpegII3pXV' --extra-ldflags='-libpath:/usr/local/google/home/tguilbert/Code/chromium/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/VC/Tools/MSVC/14.26.28801/lib/x86'" -- elide long configuration string from binary */ #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2021 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" #define AVCONV_DATADIR "/usr/local/share/ffmpeg" -#define CC_IDENT "clang version 13.0.0 (https://github.com/llvm/llvm-project/ f98ed74f6910f8b09e77497aeb30c860c433610d)" +#define CC_IDENT "clang version 14.0.0 (https://github.com/llvm/llvm-project/ 0e03450ae4358e8a8242b73d493d96efea9d3ccf)" #define OS_NAME win32 #define av_restrict restrict #define EXTERN_PREFIX "_" @@ -1086,6 +1086,7 @@ #define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 +#define CONFIG_MSNSIREN_DECODER 0 #define CONFIG_NELLYMOSER_DECODER 0 #define CONFIG_ON2AVC_DECODER 0 #define CONFIG_OPUS_DECODER 0 @@ -1355,6 +1356,7 @@ #define CONFIG_RV20_ENCODER 0 #define CONFIG_S302M_ENCODER 0 #define CONFIG_SGI_ENCODER 0 +#define CONFIG_SMC_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_SPEEDHQ_ENCODER 0 #define CONFIG_SUNRAST_ENCODER 0 @@ -1678,6 +1680,7 @@ #define CONFIG_ACRUSHER_FILTER 0 #define CONFIG_ADECLICK_FILTER 0 #define CONFIG_ADECLIP_FILTER 0 +#define CONFIG_ADECORRELATE_FILTER 0 #define CONFIG_ADELAY_FILTER 0 #define CONFIG_ADENORM_FILTER 0 #define CONFIG_ADERIVATIVE_FILTER 0 @@ -1711,11 +1714,13 @@ #define CONFIG_APERMS_FILTER 0 #define CONFIG_APHASER_FILTER 0 #define CONFIG_APHASESHIFT_FILTER 0 +#define CONFIG_APSYCLIP_FILTER 0 #define CONFIG_APULSATOR_FILTER 0 #define CONFIG_AREALTIME_FILTER 0 #define CONFIG_ARESAMPLE_FILTER 0 #define CONFIG_AREVERSE_FILTER 0 #define CONFIG_ARNNDN_FILTER 0 +#define CONFIG_ASEGMENT_FILTER 0 #define CONFIG_ASELECT_FILTER 0 #define CONFIG_ASENDCMD_FILTER 0 #define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1735,6 +1740,7 @@ #define CONFIG_ASUPERPASS_FILTER 0 #define CONFIG_ASUPERSTOP_FILTER 0 #define CONFIG_ATEMPO_FILTER 0 +#define CONFIG_ATILT_FILTER 0 #define CONFIG_ATRIM_FILTER 0 #define CONFIG_AXCORRELATE_FILTER 0 #define CONFIG_AZMQ_FILTER 0 @@ -1913,6 +1919,7 @@ #define CONFIG_GEQ_FILTER 0 #define CONFIG_GRADFUN_FILTER 0 #define CONFIG_GRAPHMONITOR_FILTER 0 +#define CONFIG_GRAYWORLD_FILTER 0 #define CONFIG_GREYEDGE_FILTER 0 #define CONFIG_GUIDED_FILTER 0 #define CONFIG_HALDCLUT_FILTER 0 @@ -1922,6 +1929,8 @@ #define CONFIG_HQDN3D_FILTER 0 #define CONFIG_HQX_FILTER 0 #define CONFIG_HSTACK_FILTER 0 +#define CONFIG_HSVHOLD_FILTER 0 +#define CONFIG_HSVKEY_FILTER 0 #define CONFIG_HUE_FILTER 0 #define CONFIG_HWDOWNLOAD_FILTER 0 #define CONFIG_HWMAP_FILTER 0 @@ -2026,7 +2035,9 @@ #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCDET_FILTER 0 +#define CONFIG_SCHARR_FILTER 0 #define CONFIG_SCROLL_FILTER 0 +#define CONFIG_SEGMENT_FILTER 0 #define CONFIG_SELECT_FILTER 0 #define CONFIG_SELECTIVECOLOR_FILTER 0 #define CONFIG_SENDCMD_FILTER 0 @@ -2587,6 +2598,7 @@ #define CONFIG_MXF_OPATOM_MUXER 0 #define CONFIG_NULL_MUXER 0 #define CONFIG_NUT_MUXER 0 +#define CONFIG_OBU_MUXER 0 #define CONFIG_OGA_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/win/ia32/libavutil/ffversion.h b/chromium/third_party/ffmpeg/chromium/config/Chromium/win/ia32/libavutil/ffversion.h index d4ce7a4e6a7..f26e152f83f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/win/ia32/libavutil/ffversion.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/win/ia32/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "N-104195-g628f528751" +#define FFMPEG_VERSION "N-104707-g392d8a2d60" #endif /* AVUTIL_FFVERSION_H */ diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/win/x64/config.asm b/chromium/third_party/ffmpeg/chromium/config/Chromium/win/x64/config.asm index bc137f9f14a..756ed571606 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/win/x64/config.asm +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/win/x64/config.asm @@ -1070,6 +1070,7 @@ %define CONFIG_MP3ON4_DECODER 0 %define CONFIG_MPC7_DECODER 0 %define CONFIG_MPC8_DECODER 0 +%define CONFIG_MSNSIREN_DECODER 0 %define CONFIG_NELLYMOSER_DECODER 0 %define CONFIG_ON2AVC_DECODER 0 %define CONFIG_OPUS_DECODER 0 @@ -1339,6 +1340,7 @@ %define CONFIG_RV20_ENCODER 0 %define CONFIG_S302M_ENCODER 0 %define CONFIG_SGI_ENCODER 0 +%define CONFIG_SMC_ENCODER 0 %define CONFIG_SNOW_ENCODER 0 %define CONFIG_SPEEDHQ_ENCODER 0 %define CONFIG_SUNRAST_ENCODER 0 @@ -1662,6 +1664,7 @@ %define CONFIG_ACRUSHER_FILTER 0 %define CONFIG_ADECLICK_FILTER 0 %define CONFIG_ADECLIP_FILTER 0 +%define CONFIG_ADECORRELATE_FILTER 0 %define CONFIG_ADELAY_FILTER 0 %define CONFIG_ADENORM_FILTER 0 %define CONFIG_ADERIVATIVE_FILTER 0 @@ -1695,11 +1698,13 @@ %define CONFIG_APERMS_FILTER 0 %define CONFIG_APHASER_FILTER 0 %define CONFIG_APHASESHIFT_FILTER 0 +%define CONFIG_APSYCLIP_FILTER 0 %define CONFIG_APULSATOR_FILTER 0 %define CONFIG_AREALTIME_FILTER 0 %define CONFIG_ARESAMPLE_FILTER 0 %define CONFIG_AREVERSE_FILTER 0 %define CONFIG_ARNNDN_FILTER 0 +%define CONFIG_ASEGMENT_FILTER 0 %define CONFIG_ASELECT_FILTER 0 %define CONFIG_ASENDCMD_FILTER 0 %define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1719,6 +1724,7 @@ %define CONFIG_ASUPERPASS_FILTER 0 %define CONFIG_ASUPERSTOP_FILTER 0 %define CONFIG_ATEMPO_FILTER 0 +%define CONFIG_ATILT_FILTER 0 %define CONFIG_ATRIM_FILTER 0 %define CONFIG_AXCORRELATE_FILTER 0 %define CONFIG_AZMQ_FILTER 0 @@ -1897,6 +1903,7 @@ %define CONFIG_GEQ_FILTER 0 %define CONFIG_GRADFUN_FILTER 0 %define CONFIG_GRAPHMONITOR_FILTER 0 +%define CONFIG_GRAYWORLD_FILTER 0 %define CONFIG_GREYEDGE_FILTER 0 %define CONFIG_GUIDED_FILTER 0 %define CONFIG_HALDCLUT_FILTER 0 @@ -1906,6 +1913,8 @@ %define CONFIG_HQDN3D_FILTER 0 %define CONFIG_HQX_FILTER 0 %define CONFIG_HSTACK_FILTER 0 +%define CONFIG_HSVHOLD_FILTER 0 +%define CONFIG_HSVKEY_FILTER 0 %define CONFIG_HUE_FILTER 0 %define CONFIG_HWDOWNLOAD_FILTER 0 %define CONFIG_HWMAP_FILTER 0 @@ -2010,7 +2019,9 @@ %define CONFIG_SCALE_VULKAN_FILTER 0 %define CONFIG_SCALE2REF_FILTER 0 %define CONFIG_SCDET_FILTER 0 +%define CONFIG_SCHARR_FILTER 0 %define CONFIG_SCROLL_FILTER 0 +%define CONFIG_SEGMENT_FILTER 0 %define CONFIG_SELECT_FILTER 0 %define CONFIG_SELECTIVECOLOR_FILTER 0 %define CONFIG_SENDCMD_FILTER 0 @@ -2571,6 +2582,7 @@ %define CONFIG_MXF_OPATOM_MUXER 0 %define CONFIG_NULL_MUXER 0 %define CONFIG_NUT_MUXER 0 +%define CONFIG_OBU_MUXER 0 %define CONFIG_OGA_MUXER 0 %define CONFIG_OGG_MUXER 0 %define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/win/x64/config.h b/chromium/third_party/ffmpeg/chromium/config/Chromium/win/x64/config.h index bdf88b6aa03..79fa5e2fbf3 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/win/x64/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/win/x64/config.h @@ -1,12 +1,12 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_H #define FFMPEG_CONFIG_H -/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --toolchain=msvc --extra-cflags=-I/not_workspace/liberato/release_chrome/src/third_party/ffmpeg/chromium/include/win --target-os=win64 --enable-cross-compile --cc=clang-cl --ld=lld-link --nm=llvm-nm --ar=llvm-ar --extra-cflags=-O2 --extra-cflags=/winsysroot/not_workspace/liberato/release_chrome/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e --extra-ldflags='-libpath:/not_workspace/liberato/release_chrome/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/VC/Tools/MSVC/14.26.28801/atlmfc/lib/x64' --extra-ldflags='-libpath:/workspace/tmp/windows_build_ffmpeg_24b_S' --extra-ldflags='-libpath:/workspace/tmp/windows_build_ffmpegNkECDH' --extra-ldflags='-libpath:/not_workspace/liberato/release_chrome/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/VC/Tools/MSVC/14.26.28801/lib/x64'" -- elide long configuration string from binary */ +/* #define FFMPEG_CONFIGURATION "--disable-everything --disable-all --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-avcodec --enable-avformat --enable-avutil --enable-fft --enable-rdft --enable-static --enable-libopus --disable-debug --disable-bzlib --disable-error-resilience --disable-iconv --disable-lzo --disable-network --disable-schannel --disable-sdl2 --disable-symver --disable-xlib --disable-zlib --disable-securetransport --disable-faan --disable-alsa --disable-autodetect --enable-decoder='vorbis,libopus,flac' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_s32le,pcm_f32le,mp3' --enable-decoder='pcm_s16be,pcm_s24be,pcm_mulaw,pcm_alaw' --enable-demuxer='ogg,matroska,wav,flac,mp3,mov' --enable-parser='opus,vorbis,flac,mpegaudio,vp9' --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/opus/src/include --disable-linux-perf --x86asmexe=nasm --optflags='\"-O2\"' --enable-decoder='theora,vp8' --enable-parser='vp3,vp8' --toolchain=msvc --extra-cflags=-I/usr/local/google/home/tguilbert/Code/chromium/src/third_party/ffmpeg/chromium/include/win --target-os=win64 --enable-cross-compile --cc=clang-cl --ld=lld-link --nm=llvm-nm --ar=llvm-ar --extra-cflags=-O2 --extra-cflags=/winsysroot/usr/local/google/home/tguilbert/Code/chromium/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e --extra-ldflags='-libpath:/usr/local/google/home/tguilbert/Code/chromium/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/VC/Tools/MSVC/14.26.28801/atlmfc/lib/x64' --extra-ldflags='-libpath:/tmp/windows_build_ffmpeg7dIrkR' --extra-ldflags='-libpath:/tmp/windows_build_ffmpegho6ssp' --extra-ldflags='-libpath:/usr/local/google/home/tguilbert/Code/chromium/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/VC/Tools/MSVC/14.26.28801/lib/x64'" -- elide long configuration string from binary */ #define FFMPEG_LICENSE "LGPL version 2.1 or later" #define CONFIG_THIS_YEAR 2021 #define FFMPEG_DATADIR "/usr/local/share/ffmpeg" #define AVCONV_DATADIR "/usr/local/share/ffmpeg" -#define CC_IDENT "clang version 13.0.0 (https://github.com/llvm/llvm-project/ f98ed74f6910f8b09e77497aeb30c860c433610d)" +#define CC_IDENT "clang version 14.0.0 (https://github.com/llvm/llvm-project/ 0e03450ae4358e8a8242b73d493d96efea9d3ccf)" #define OS_NAME win64 #define av_restrict restrict #define EXTERN_PREFIX "" @@ -1086,6 +1086,7 @@ #define CONFIG_MP3ON4_DECODER 0 #define CONFIG_MPC7_DECODER 0 #define CONFIG_MPC8_DECODER 0 +#define CONFIG_MSNSIREN_DECODER 0 #define CONFIG_NELLYMOSER_DECODER 0 #define CONFIG_ON2AVC_DECODER 0 #define CONFIG_OPUS_DECODER 0 @@ -1355,6 +1356,7 @@ #define CONFIG_RV20_ENCODER 0 #define CONFIG_S302M_ENCODER 0 #define CONFIG_SGI_ENCODER 0 +#define CONFIG_SMC_ENCODER 0 #define CONFIG_SNOW_ENCODER 0 #define CONFIG_SPEEDHQ_ENCODER 0 #define CONFIG_SUNRAST_ENCODER 0 @@ -1678,6 +1680,7 @@ #define CONFIG_ACRUSHER_FILTER 0 #define CONFIG_ADECLICK_FILTER 0 #define CONFIG_ADECLIP_FILTER 0 +#define CONFIG_ADECORRELATE_FILTER 0 #define CONFIG_ADELAY_FILTER 0 #define CONFIG_ADENORM_FILTER 0 #define CONFIG_ADERIVATIVE_FILTER 0 @@ -1711,11 +1714,13 @@ #define CONFIG_APERMS_FILTER 0 #define CONFIG_APHASER_FILTER 0 #define CONFIG_APHASESHIFT_FILTER 0 +#define CONFIG_APSYCLIP_FILTER 0 #define CONFIG_APULSATOR_FILTER 0 #define CONFIG_AREALTIME_FILTER 0 #define CONFIG_ARESAMPLE_FILTER 0 #define CONFIG_AREVERSE_FILTER 0 #define CONFIG_ARNNDN_FILTER 0 +#define CONFIG_ASEGMENT_FILTER 0 #define CONFIG_ASELECT_FILTER 0 #define CONFIG_ASENDCMD_FILTER 0 #define CONFIG_ASETNSAMPLES_FILTER 0 @@ -1735,6 +1740,7 @@ #define CONFIG_ASUPERPASS_FILTER 0 #define CONFIG_ASUPERSTOP_FILTER 0 #define CONFIG_ATEMPO_FILTER 0 +#define CONFIG_ATILT_FILTER 0 #define CONFIG_ATRIM_FILTER 0 #define CONFIG_AXCORRELATE_FILTER 0 #define CONFIG_AZMQ_FILTER 0 @@ -1913,6 +1919,7 @@ #define CONFIG_GEQ_FILTER 0 #define CONFIG_GRADFUN_FILTER 0 #define CONFIG_GRAPHMONITOR_FILTER 0 +#define CONFIG_GRAYWORLD_FILTER 0 #define CONFIG_GREYEDGE_FILTER 0 #define CONFIG_GUIDED_FILTER 0 #define CONFIG_HALDCLUT_FILTER 0 @@ -1922,6 +1929,8 @@ #define CONFIG_HQDN3D_FILTER 0 #define CONFIG_HQX_FILTER 0 #define CONFIG_HSTACK_FILTER 0 +#define CONFIG_HSVHOLD_FILTER 0 +#define CONFIG_HSVKEY_FILTER 0 #define CONFIG_HUE_FILTER 0 #define CONFIG_HWDOWNLOAD_FILTER 0 #define CONFIG_HWMAP_FILTER 0 @@ -2026,7 +2035,9 @@ #define CONFIG_SCALE_VULKAN_FILTER 0 #define CONFIG_SCALE2REF_FILTER 0 #define CONFIG_SCDET_FILTER 0 +#define CONFIG_SCHARR_FILTER 0 #define CONFIG_SCROLL_FILTER 0 +#define CONFIG_SEGMENT_FILTER 0 #define CONFIG_SELECT_FILTER 0 #define CONFIG_SELECTIVECOLOR_FILTER 0 #define CONFIG_SENDCMD_FILTER 0 @@ -2587,6 +2598,7 @@ #define CONFIG_MXF_OPATOM_MUXER 0 #define CONFIG_NULL_MUXER 0 #define CONFIG_NUT_MUXER 0 +#define CONFIG_OBU_MUXER 0 #define CONFIG_OGA_MUXER 0 #define CONFIG_OGG_MUXER 0 #define CONFIG_OGV_MUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/win/x64/libavutil/ffversion.h b/chromium/third_party/ffmpeg/chromium/config/Chromium/win/x64/libavutil/ffversion.h index d4ce7a4e6a7..f26e152f83f 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/win/x64/libavutil/ffversion.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/win/x64/libavutil/ffversion.h @@ -1,5 +1,5 @@ /* Automatically generated by version.sh, do not manually edit! */ #ifndef AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H -#define FFMPEG_VERSION "N-104195-g628f528751" +#define FFMPEG_VERSION "N-104707-g392d8a2d60" #endif /* AVUTIL_FFVERSION_H */ diff --git a/chromium/third_party/ffmpeg/chromium/patches/README b/chromium/third_party/ffmpeg/chromium/patches/README index e96e5f3b7c2..a067535bb38 100644 --- a/chromium/third_party/ffmpeg/chromium/patches/README +++ b/chromium/third_party/ffmpeg/chromium/patches/README @@ -1051,29 +1051,41 @@ Affects: libavcodec/h263dec.c ------------------------------------------------------------------ -commit 628f5287515a4359354922763fabb93f86c00324 +commit b4d520ca6786368a829b38147364f22096f284fa Author: liberato@chromium.org <liberato@chromium.org> -Date: Fri Jul 30 14:56:01 2021 -0700 +Date: Fri Jul 30 18:46:38 2021 -0700 - Delete GPL'd macos_kperf.* before merge with chromium + M94 FFmpeg roll. + + Bug: 1227259 + Change-Id: I53e21333100fc603d814806a9f6f807fede2adb6 + Reviewed-on: https://chromium-review.googlesource.com/c/chromium/third_party/ffmpeg/+/3063817 + Reviewed-by: Ted Meyer <tmathmeyer@chromium.org> Affects: + libavformat/oggparsevorbis.c libavutil/macos_kperf.c libavutil/macos_kperf.h ------------------------------------------------------------------ -commit d67214044b87280d6537d60717de1f20ba2d0741 -Author: liberato@chromium.org <liberato@chromium.org> -Date: Fri Jul 30 18:40:25 2021 -0700 +commit 47273666537556c923cc4f4a03d9d42666931876 +Author: Thomas Guilbert <tguilbert@chromium.org> +Date: Wed Sep 15 15:44:40 2021 -0700 - Un-fix ogg vorbis to match previous behavior. + Fix macro expansion error - Rather than change chrome's longstanding behavior as part of the m94 - roll, undo (comment out) the small patch that causes it. We can - revisit this behavior change separately from the roll. + This CL fixes an issue that results from the CHROMIUM_NO_LOGGING macro. + When it is defined, av_log(...) expands to nothing, which causes this + expansion: + ff_dlog(ctx, ...) --> do { if (0) av_log(...) ; } while (0) - Bug: 1234960 + to cause a -Wempty-statement error, due to the empty `if (0) ;`. + + Bug: 1249257 + Change-Id: I0011ae8e50c8931ac64517fa604775a9838ac8a1 + Reviewed-on: https://chromium-review.googlesource.com/c/chromium/third_party/ffmpeg/+/3163777 + Reviewed-by: John Rummell <jrummell@chromium.org> Affects: - libavformat/oggparsevorbis.c + libavutil/internal.h diff --git a/chromium/third_party/ffmpeg/chromium/patches/config_flag_changes.txt b/chromium/third_party/ffmpeg/chromium/patches/config_flag_changes.txt index 30c1c05e634..338416e44e1 100644 --- a/chromium/third_party/ffmpeg/chromium/patches/config_flag_changes.txt +++ b/chromium/third_party/ffmpeg/chromium/patches/config_flag_changes.txt @@ -1,3 +1,14 @@ -+ CONFIG_AFWTDN_FILTER 0 -+ CONFIG_MACOS_KPERF 0 -+ HAVE_XMLLINT 1 ++ CONFIG_ADECORRELATE_FILTER 0 ++ CONFIG_APSYCLIP_FILTER 0 ++ CONFIG_ASEGMENT_FILTER 0 ++ CONFIG_ATILT_FILTER 0 ++ CONFIG_GRAYWORLD_FILTER 0 ++ CONFIG_HSVHOLD_FILTER 0 ++ CONFIG_HSVKEY_FILTER 0 ++ CONFIG_MSNSIREN_DECODER 0 ++ CONFIG_OBU_MUXER 0 ++ CONFIG_SCHARR_FILTER 0 ++ CONFIG_SEGMENT_FILTER 0 ++ CONFIG_SMC_ENCODER 0 ++ HAVE_VALGRIND_VALGRIND_H 0 ; HAVE_VALGRIND_VALGRIND_H 0 -- forced to 0. See https://crbug.com/590440 +- HAVE_VALGRIND_VALGRIND_H 0 ; HAVE_VALGRIND_VALGRIND_H 1 -- forced to 0. See https://crbug.com/590440 diff --git a/chromium/third_party/ffmpeg/chromium/scripts/robo_branch.py b/chromium/third_party/ffmpeg/chromium/scripts/robo_branch.py index f6c1119bf29..23d8a986f17 100644 --- a/chromium/third_party/ffmpeg/chromium/scripts/robo_branch.py +++ b/chromium/third_party/ffmpeg/chromium/scripts/robo_branch.py @@ -280,11 +280,20 @@ def IsUploadedForReviewAndLanded(robo_configuration): if not IsUploadedForReview(robo_configuration): shell.log("Is not uploaded for review") return False + # Make sure we're up-to-date with origin, to fetch the (hopefully) landed + # sushi branch. + if robo_configuration.Call(["git", "fetch", "origin"]): + raise Exception("Could not fetch from origin") + + branch_name = robo_configuration.sushi_branch_name() # See if origin/sushi and local/sushi are the same. This check by itself # isn't sufficient, since it would return true any time the two are in sync. diff = shell.output_or_error(["git", "diff", - "origin/" + robo_configuration.sushi_branch_name(), - robo_configuration.sushi_branch_name()]) + "origin/" + branch_name, branch_name]) + if diff: + print("WARNING: Local and origin branches differ. Run `git diff origin/" + + branch_name + " " + branch_name + "` to see how.") + return not diff @RequiresCleanWorkingDirectory @@ -298,6 +307,26 @@ def UploadForReview(robo_configuration): os.system("git cl upload") @RequiresCleanWorkingDirectory +def MergeBackToOriginMaster(robo_configuration): + """Once the sushi branch has landed in origin after review, merge it back + to origin/master locally and push it.""" + robo_configuration.chdir_to_ffmpeg_home(); + if not IsUploadedForReviewAndLanded(robo_configuration): + raise Exception("The CL must be reviewed and landed before proceeding.") + # TODO: check if the merge has already been done, and fail. Also, add a + # skip_fn to the step in robosushi, so we skip this step cleanly. + + # TODO: actually do stuff. + raise Exception("Robosushi can't automativally merge back to master yet. " \ + "Please see go/robosushi for what to do next.") + # create local_merge_branch tracking origin/master + # check out local_merge_branch # does this make us forget our sushi branch? + # git merge sushsi_branch + # git push origin local_branch_name + # git checkout origin/master (or sushi?) + # git branch -R local_merge_branch + +@RequiresCleanWorkingDirectory def TryFakeDepsRoll(robo_configuration): """Start a deps roll against the sushi branch, and -1 it.""" shell.log("Considering starting a fake deps roll") @@ -318,4 +347,4 @@ def TryFakeDepsRoll(robo_configuration): # doing this every time we're run. # TODO: get mad otherwise. shell.output_or_error(["roll-deps.py", "third_party/ffmpeg", sha1]) - # TODO: -1 it. + # TODO: -1 it.
\ No newline at end of file diff --git a/chromium/third_party/ffmpeg/chromium/scripts/robosushi.py b/chromium/third_party/ffmpeg/chromium/scripts/robosushi.py index 19a07beffb9..c73b376dab4 100755 --- a/chromium/third_party/ffmpeg/chromium/scripts/robosushi.py +++ b/chromium/third_party/ffmpeg/chromium/scripts/robosushi.py @@ -118,6 +118,10 @@ steps = { "skip_fn": robo_branch.IsUploadedForReview, "do_fn": robo_branch.UploadForReview }, + "merge_back_to_origin": + { "desc": "Once sushi has landed after review, merge/push to origin", + "do_fn": robo_branch.MergeBackToOriginMaster }, + # This is a WIP, present in case you're feeling particularly brave. :) "start_fake_deps_roll": { "desc": "Try a test deps roll against the sushi (not master) branch", @@ -141,6 +145,7 @@ steps = { # to do is to upload the gn config / patches for review and land it. "run_tests", "upload_for_review", + "merge_back_to_origin", ]) }, } diff --git a/chromium/third_party/ffmpeg/compat/cuda/cuda_runtime.h b/chromium/third_party/ffmpeg/compat/cuda/cuda_runtime.h index c5450b25424..30cd085e489 100644 --- a/chromium/third_party/ffmpeg/compat/cuda/cuda_runtime.h +++ b/chromium/third_party/ffmpeg/compat/cuda/cuda_runtime.h @@ -184,5 +184,6 @@ static inline __device__ double fabs(double a) { return __builtin_fabs(a); } static inline __device__ float __sinf(float a) { return __nvvm_sin_approx_f(a); } static inline __device__ float __cosf(float a) { return __nvvm_cos_approx_f(a); } +static inline __device__ float __expf(float a) { return __nvvm_ex2_approx_f(a * (float)__builtin_log2(__builtin_exp(1))); } #endif /* COMPAT_CUDA_CUDA_RUNTIME_H */ diff --git a/chromium/third_party/ffmpeg/configure b/chromium/third_party/ffmpeg/configure index 7cdc4ba75f6..1df4e11dd6c 100755 --- a/chromium/third_party/ffmpeg/configure +++ b/chromium/third_party/ffmpeg/configure @@ -3388,6 +3388,7 @@ mxf_opatom_muxer_select="mxf_muxer" nut_muxer_select="riffenc" nuv_demuxer_select="riffdec" obu_demuxer_select="av1_frame_merge_bsf av1_parser" +obu_muxer_select="av1_metadata_bsf" oga_muxer_select="ogg_muxer" ogg_demuxer_select="dirac_parse" ogv_muxer_select="ogg_muxer" @@ -3542,14 +3543,11 @@ libzmq_protocol_deps="libzmq" libzmq_protocol_select="network" # filters -afftfilt_filter_deps="avcodec" -afftfilt_filter_select="fft" afir_filter_deps="avcodec" afir_filter_select="rdft" ametadata_filter_deps="avformat" amovie_filter_deps="avcodec avformat" aresample_filter_deps="swresample" -asoftclip_filter_deps="swresample" asr_filter_deps="pocketsphinx" ass_filter_deps="libass" atempo_filter_deps="avcodec" @@ -3567,16 +3565,12 @@ chromaber_vulkan_filter_deps="vulkan_lib libglslang" colorkey_opencl_filter_deps="opencl" colormatrix_filter_deps="gpl" convolution_opencl_filter_deps="opencl" -convolve_filter_deps="avcodec" -convolve_filter_select="fft" coreimage_filter_deps="coreimage appkit" coreimage_filter_extralibs="-framework OpenGL" coreimagesrc_filter_deps="coreimage appkit" coreimagesrc_filter_extralibs="-framework OpenGL" cover_rect_filter_deps="avcodec avformat gpl" cropdetect_filter_deps="gpl" -deconvolve_filter_deps="avcodec" -deconvolve_filter_select="fft" deinterlace_qsv_filter_deps="libmfx" deinterlace_vaapi_filter_deps="vaapi" delogo_filter_deps="gpl" @@ -3662,8 +3656,6 @@ sinc_filter_select="rdft" smartblur_filter_deps="gpl swscale" sobel_opencl_filter_deps="opencl" sofalizer_filter_deps="libmysofa" -spectrumsynth_filter_deps="avcodec" -spectrumsynth_filter_select="fft" spp_filter_deps="gpl avcodec" spp_filter_select="fft idctdsp fdctdsp me_cmp pixblockdsp" sr_filter_deps="avformat swscale" @@ -5961,7 +5953,7 @@ elif enabled mips; then enabled loongson3 && check_inline_asm loongson3 '"gsldxc1 $f0, 0($2, $3)"' '-mloongson-ext' && append MMIFLAGS '-mloongson-ext' # MMI can be detected at runtime too - enabled mmi && check_inline_asm mmi '"punpcklhw $f0, $f0, $f0"' '-mloongson-mmi' && append MMIFLAGS '-mloongson-mmi' + enabled mmi && check_inline_asm mmi '"pxor $f0, $f0, $f0"' '-mloongson-mmi' && append MMIFLAGS '-mloongson-mmi' if enabled bigendian && enabled msa; then disable msa @@ -6401,7 +6393,7 @@ enabled avisynth && require_headers "avisynth/avisynth_c.h" enabled cuda_nvcc && { check_nvcc cuda_nvcc || die "ERROR: failed checking for nvcc."; } enabled chromaprint && require chromaprint chromaprint.h chromaprint_get_version -lchromaprint enabled decklink && { require_headers DeckLinkAPI.h && - { test_cpp_condition DeckLinkAPIVersion.h "BLACKMAGIC_DECKLINK_API_VERSION >= 0x0a0a0000" || die "ERROR: Decklink API version must be >= 10.10"; } } + { test_cpp_condition DeckLinkAPIVersion.h "BLACKMAGIC_DECKLINK_API_VERSION >= 0x0a0b0000" || die "ERROR: Decklink API version must be >= 10.11"; } } enabled frei0r && require_headers "frei0r.h dlfcn.h" enabled gmp && require gmp gmp.h mpz_export -lgmp enabled gnutls && require_pkg_config gnutls gnutls gnutls/gnutls.h gnutls_global_init @@ -7267,15 +7259,12 @@ done enabled zlib && add_cppflags -DZLIB_CONST # conditional library dependencies, in any order -enabled afftfilt_filter && prepend avfilter_deps "avcodec" enabled afir_filter && prepend avfilter_deps "avcodec" enabled amovie_filter && prepend avfilter_deps "avformat avcodec" enabled aresample_filter && prepend avfilter_deps "swresample" enabled atempo_filter && prepend avfilter_deps "avcodec" enabled bm3d_filter && prepend avfilter_deps "avcodec" enabled cover_rect_filter && prepend avfilter_deps "avformat avcodec" -enabled convolve_filter && prepend avfilter_deps "avcodec" -enabled deconvolve_filter && prepend avfilter_deps "avcodec" enabled ebur128_filter && enabled swresample && prepend avfilter_deps "swresample" enabled elbg_filter && prepend avfilter_deps "avcodec" enabled fftfilt_filter && prepend avfilter_deps "avcodec" @@ -7292,7 +7281,6 @@ enabled scale2ref_filter && prepend avfilter_deps "swscale" enabled showcqt_filter && prepend avfilter_deps "avformat swscale" enabled signature_filter && prepend avfilter_deps "avcodec avformat" enabled smartblur_filter && prepend avfilter_deps "swscale" -enabled spectrumsynth_filter && prepend avfilter_deps "avcodec" enabled spp_filter && prepend avfilter_deps "avcodec" enabled sr_filter && prepend avfilter_deps "avformat swscale" enabled subtitles_filter && prepend avfilter_deps "avformat avcodec" diff --git a/chromium/third_party/ffmpeg/doc/APIchanges b/chromium/third_party/ffmpeg/doc/APIchanges index cd1902179f8..d03e3233ba0 100644 --- a/chromium/third_party/ffmpeg/doc/APIchanges +++ b/chromium/third_party/ffmpeg/doc/APIchanges @@ -14,6 +14,38 @@ libavutil: 2021-04-27 API changes, most recent first: +2021-09-08 - xxxxxxxxxx - lavu 57.5.100 - hwcontext_d3d11va.h + Add AVD3D11VAFramesContext.texture_infos + +2021-09-06 - xxxxxxxxxx - lsws 6.1.100 - swscale.h + Add AVFrame-based scaling API: + - sws_scale_frame() + - sws_frame_start() + - sws_frame_end() + - sws_send_slice() + - sws_receive_slice() + - sws_receive_slice_alignment() + +2021-09-02 - xxxxxxxxxx - lavc 59.7.100 - avcodec.h + Incremented the number of elements of AVCodecParser.codec_ids to seven. + +2021-08-24 - xxxxxxxxxx - lavc 59.6.100 - avcodec.h + Add FF_CODEC_PROPERTY_FILM_GRAIN + +2021-08-20 - xxxxxxxxxx - lavfi 8.3.100 - avfilter.H + Add avfilter_filter_pad_count() as a replacement for avfilter_pad_count(). + Deprecate avfilter_pad_count(). + +2021-08-17 - xxxxxxxxxx - lavu 57.4.101 - opt.h + av_opt_copy() now guarantees that allocated src and dst options + don't alias each other even on error. + +2021-08-14 - xxxxxxxxxx - lavu 57.4.100 - imgutils.h + Add av_image_copy_plane_uc_from() + +2021-08-02 - xxxxxxxxxx - lavc 59.4.100 - packet.h + Add AVPacket.opaque, AVPacket.opaque_ref, AVPacket.time_base. + 2021-07-23 - xxxxxxxxxx - lavu 57.3.100 - common.h macros.h Move several macros (AV_NE, FFDIFFSIGN, FFMAX, FFMAX3, FFMIN, FFMIN3, FFSWAP, FF_ARRAY_ELEMS, MKTAG, MKBETAG) from common.h to macros.h. diff --git a/chromium/third_party/ffmpeg/doc/demuxers.texi b/chromium/third_party/ffmpeg/doc/demuxers.texi index 5b8cf1bfea5..eb3351833a4 100644 --- a/chromium/third_party/ffmpeg/doc/demuxers.texi +++ b/chromium/third_party/ffmpeg/doc/demuxers.texi @@ -96,8 +96,7 @@ backslash or single quotes. All subsequent file-related directives apply to that file. @item @code{ffconcat version 1.0} -Identify the script type and version. It also sets the @option{safe} option -to 1 if it was -1. +Identify the script type and version. To make FFmpeg recognize the format automatically, this directive must appear exactly as is (no extra space or byte-order-mark) on the very first @@ -152,6 +151,10 @@ Metadata of the packets of the file. The specified metadata will be set for each file packet. You can specify this directive multiple times to add multiple metadata entries. +@item @code{option @var{key} @var{value}} +Option to access, open and probe the file. +Can be present multiple times. + @item @code{stream} Introduce a stream in the virtual file. All subsequent stream-related directives apply to the last introduced @@ -177,7 +180,8 @@ This demuxer accepts the following option: @table @option @item safe -If set to 1, reject unsafe file paths. A file path is considered safe if it +If set to 1, reject unsafe file paths and directives. +A file path is considered safe if it does not contain a protocol specification and is relative and all components only contain characters from the portable character set (letters, digits, period, underscore and hyphen) and have no period at the beginning of a @@ -187,9 +191,6 @@ If set to 0, any file name is accepted. The default is 1. --1 is equivalent to 1 if the format was automatically -probed and 0 otherwise. - @item auto_convert If set to 1, try to perform automatic conversions on packet data to make the streams concatenable. diff --git a/chromium/third_party/ffmpeg/doc/examples/encode_video.c b/chromium/third_party/ffmpeg/doc/examples/encode_video.c index 908eb203d52..939ed68324e 100644 --- a/chromium/third_party/ffmpeg/doc/examples/encode_video.c +++ b/chromium/third_party/ffmpeg/doc/examples/encode_video.c @@ -155,12 +155,25 @@ int main(int argc, char **argv) for (i = 0; i < 25; i++) { fflush(stdout); - /* make sure the frame data is writable */ + /* Make sure the frame data is writable. + On the first round, the frame is fresh from av_frame_get_buffer() + and therefore we know it is writable. + But on the next rounds, encode() will have called + avcodec_send_frame(), and the codec may have kept a reference to + the frame in its internal structures, that makes the frame + unwritable. + av_frame_make_writable() checks that and allocates a new buffer + for the frame only if necessary. + */ ret = av_frame_make_writable(frame); if (ret < 0) exit(1); - /* prepare a dummy image */ + /* Prepare a dummy image. + In real code, this is where you would have your own logic for + filling the frame. FFmpeg does not care what you put in the + frame. + */ /* Y */ for (y = 0; y < c->height; y++) { for (x = 0; x < c->width; x++) { @@ -185,7 +198,12 @@ int main(int argc, char **argv) /* flush the encoder */ encode(c, NULL, pkt, f); - /* add sequence end code to have a real MPEG file */ + /* Add sequence end code to have a real MPEG file. + It makes only sense because this tiny examples writes packets + directly. This is called "elementary stream" and only works for some + codecs. To create a valid file, you usually need to write packets + into a proper file format or protocol; see muxing.c. + */ if (codec->id == AV_CODEC_ID_MPEG1VIDEO || codec->id == AV_CODEC_ID_MPEG2VIDEO) fwrite(endcode, 1, sizeof(endcode), f); fclose(f); diff --git a/chromium/third_party/ffmpeg/doc/examples/qsvdec.c b/chromium/third_party/ffmpeg/doc/examples/qsvdec.c index 7415eefca5b..571d868f935 100644 --- a/chromium/third_party/ffmpeg/doc/examples/qsvdec.c +++ b/chromium/third_party/ffmpeg/doc/examples/qsvdec.c @@ -44,38 +44,10 @@ #include "libavutil/hwcontext_qsv.h" #include "libavutil/mem.h" -typedef struct DecodeContext { - AVBufferRef *hw_device_ref; -} DecodeContext; - static int get_format(AVCodecContext *avctx, const enum AVPixelFormat *pix_fmts) { while (*pix_fmts != AV_PIX_FMT_NONE) { if (*pix_fmts == AV_PIX_FMT_QSV) { - DecodeContext *decode = avctx->opaque; - AVHWFramesContext *frames_ctx; - AVQSVFramesContext *frames_hwctx; - int ret; - - /* create a pool of surfaces to be used by the decoder */ - avctx->hw_frames_ctx = av_hwframe_ctx_alloc(decode->hw_device_ref); - if (!avctx->hw_frames_ctx) - return AV_PIX_FMT_NONE; - frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data; - frames_hwctx = frames_ctx->hwctx; - - frames_ctx->format = AV_PIX_FMT_QSV; - frames_ctx->sw_format = avctx->sw_pix_fmt; - frames_ctx->width = FFALIGN(avctx->coded_width, 32); - frames_ctx->height = FFALIGN(avctx->coded_height, 32); - frames_ctx->initial_pool_size = 32; - - frames_hwctx->frame_type = MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET; - - ret = av_hwframe_ctx_init(avctx->hw_frames_ctx); - if (ret < 0) - return AV_PIX_FMT_NONE; - return AV_PIX_FMT_QSV; } @@ -87,7 +59,7 @@ static int get_format(AVCodecContext *avctx, const enum AVPixelFormat *pix_fmts) return AV_PIX_FMT_NONE; } -static int decode_packet(DecodeContext *decode, AVCodecContext *decoder_ctx, +static int decode_packet(AVCodecContext *decoder_ctx, AVFrame *frame, AVFrame *sw_frame, AVPacket *pkt, AVIOContext *output_ctx) { @@ -144,12 +116,12 @@ int main(int argc, char **argv) AVPacket pkt = { 0 }; AVFrame *frame = NULL, *sw_frame = NULL; - DecodeContext decode = { NULL }; - AVIOContext *output_ctx = NULL; int ret, i; + AVBufferRef *device_ref = NULL; + if (argc < 3) { fprintf(stderr, "Usage: %s <input file> <output file>\n", argv[0]); return 1; @@ -177,7 +149,7 @@ int main(int argc, char **argv) } /* open the hardware device */ - ret = av_hwdevice_ctx_create(&decode.hw_device_ref, AV_HWDEVICE_TYPE_QSV, + ret = av_hwdevice_ctx_create(&device_ref, AV_HWDEVICE_TYPE_QSV, "auto", NULL, 0); if (ret < 0) { fprintf(stderr, "Cannot open the hardware device\n"); @@ -209,7 +181,8 @@ int main(int argc, char **argv) decoder_ctx->extradata_size = video_st->codecpar->extradata_size; } - decoder_ctx->opaque = &decode; + + decoder_ctx->hw_device_ctx = av_buffer_ref(device_ref); decoder_ctx->get_format = get_format; ret = avcodec_open2(decoder_ctx, NULL, NULL); @@ -239,7 +212,7 @@ int main(int argc, char **argv) break; if (pkt.stream_index == video_st->index) - ret = decode_packet(&decode, decoder_ctx, frame, sw_frame, &pkt, output_ctx); + ret = decode_packet(decoder_ctx, frame, sw_frame, &pkt, output_ctx); av_packet_unref(&pkt); } @@ -247,7 +220,7 @@ int main(int argc, char **argv) /* flush the decoder */ pkt.data = NULL; pkt.size = 0; - ret = decode_packet(&decode, decoder_ctx, frame, sw_frame, &pkt, output_ctx); + ret = decode_packet(decoder_ctx, frame, sw_frame, &pkt, output_ctx); finish: if (ret < 0) { @@ -263,7 +236,7 @@ finish: avcodec_free_context(&decoder_ctx); - av_buffer_unref(&decode.hw_device_ref); + av_buffer_unref(&device_ref); avio_close(output_ctx); diff --git a/chromium/third_party/ffmpeg/doc/ffmpeg.texi b/chromium/third_party/ffmpeg/doc/ffmpeg.texi index c896aede3bc..62d9703b7ab 100644 --- a/chromium/third_party/ffmpeg/doc/ffmpeg.texi +++ b/chromium/third_party/ffmpeg/doc/ffmpeg.texi @@ -1104,6 +1104,9 @@ device type: @item dxva2 @var{device} is the number of the Direct3D 9 display adapter. +@item d3d11va +@var{device} is the number of the Direct3D 11 display adapter. + @item vaapi @var{device} is either an X11 display name or a DRM render node. If not specified, it will attempt to open the default X11 display (@emph{$DISPLAY}) @@ -1127,9 +1130,21 @@ If not specified, it will attempt to open the default X11 display (@emph{$DISPLA @end table If not specified, @samp{auto_any} is used. (Note that it may be easier to achieve the desired result for QSV by creating the -platform-appropriate subdevice (@samp{dxva2} or @samp{vaapi}) and then deriving a +platform-appropriate subdevice (@samp{dxva2} or @samp{d3d11va} or @samp{vaapi}) and then deriving a QSV device from that.) +Alternatively, @samp{child_device_type} helps to choose platform-appropriate subdevice type. +On Windows @samp{d3d11va} is used as default subdevice type. + +Examples: +@table @emph +@item -init_hw_device qsv:hw,child_device_type=d3d11va +Choose the GPU subdevice with type @samp{d3d11va} and create QSV device with @samp{MFX_IMPL_HARDWARE}. + +@item -init_hw_device qsv:hw,child_device_type=dxva2 +Choose the GPU subdevice with type @samp{dxva2} and create QSV device with @samp{MFX_IMPL_HARDWARE}. +@end table + @item opencl @var{device} selects the platform and device as @emph{platform_index.device_index}. @@ -1232,6 +1247,9 @@ Use VDPAU (Video Decode and Presentation API for Unix) hardware acceleration. @item dxva2 Use DXVA2 (DirectX Video Acceleration) hardware acceleration. +@item d3d11va +Use D3D11VA (DirectX Video Acceleration) hardware acceleration. + @item vaapi Use VAAPI (Video Acceleration API) hardware acceleration. diff --git a/chromium/third_party/ffmpeg/doc/ffprobe.xsd b/chromium/third_party/ffmpeg/doc/ffprobe.xsd index 250de8cd5c8..79784b51466 100644 --- a/chromium/third_party/ffmpeg/doc/ffprobe.xsd +++ b/chromium/third_party/ffmpeg/doc/ffprobe.xsd @@ -86,8 +86,6 @@ <xsd:attribute name="key_frame" type="xsd:int" use="required"/> <xsd:attribute name="pts" type="xsd:long" /> <xsd:attribute name="pts_time" type="xsd:float"/> - <xsd:attribute name="pkt_pts" type="xsd:long" /> - <xsd:attribute name="pkt_pts_time" type="xsd:float"/> <xsd:attribute name="pkt_dts" type="xsd:long" /> <xsd:attribute name="pkt_dts_time" type="xsd:float"/> <xsd:attribute name="best_effort_timestamp" type="xsd:long" /> @@ -225,6 +223,7 @@ <xsd:attribute name="coded_width" type="xsd:int"/> <xsd:attribute name="coded_height" type="xsd:int"/> <xsd:attribute name="closed_captions" type="xsd:boolean"/> + <xsd:attribute name="film_grain" type="xsd:boolean"/> <xsd:attribute name="has_b_frames" type="xsd:int"/> <xsd:attribute name="sample_aspect_ratio" type="xsd:string"/> <xsd:attribute name="display_aspect_ratio" type="xsd:string"/> diff --git a/chromium/third_party/ffmpeg/doc/filters.texi b/chromium/third_party/ffmpeg/doc/filters.texi index 66c0f87e47f..8f20ccf8c6e 100644 --- a/chromium/third_party/ffmpeg/doc/filters.texi +++ b/chromium/third_party/ffmpeg/doc/filters.texi @@ -745,6 +745,20 @@ Select overlap-save method. Not interpolated samples remain unchanged. Default value is @code{a}. @end table +@section adecorrelate +Apply decorrelation to input audio stream. + +The filter accepts the following options: + +@table @option +@item stages +Set decorrelation stages of filtering. Allowed +range is from 1 to 16. Default value is 6. + +@item seed +Set random seed used for setting delay in samples across channels. +@end table + @section adelay Delay one or more audio channels. @@ -1487,6 +1501,10 @@ Default value is 0.0. @item level Set output gain applied to final output. Allowed range is from 0.0 to 1.0. Default value is 1.0. + +@item order +Set filter order used for filtering. Allowed range is from 1 to 16. +Default value is 8. @end table @subsection Commands @@ -2335,6 +2353,46 @@ Default value is 0.0. @item level Set output gain applied to final output. Allowed range is from 0.0 to 1.0. Default value is 1.0. + +@item order +Set filter order used for filtering. Allowed range is from 1 to 16. +Default value is 8. +@end table + +@subsection Commands + +This filter supports the all above options as @ref{commands}. + +@section apsyclip +Apply Psychoacoustic clipper to input audio stream. + +The filter accepts the following options: + +@table @option +@item level_in +Set input gain. By default it is 1. Range is [0.015625 - 64]. + +@item level_out +Set output gain. By default it is 1. Range is [0.015625 - 64]. + +@item clip +Set the clipping start value. Default value is 0dBFS or 1. + +@item diff +Output only difference samples, useful to hear introduced distortions. +By default is disabled. + +@item adaptive +Set strenght of adaptive distortion applied. Default value is 0.5. +Allowed range is from 0 to 1. + +@item iterations +Set number of iterations of psychoacoustic clipper. +Allowed range is from 1 to 20. Default value is 10. + +@item level +Auto level output signal. Default is disabled. +This normalizes audio back to 0dBFS if enabled. @end table @subsection Commands @@ -2647,7 +2705,7 @@ It accepts the following option: @table @option @item length Short window length in seconds, used for peak and trough RMS measurement. -Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}. +Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0 - 10]}. @item metadata @@ -2671,6 +2729,7 @@ Flat_factor Peak_count Noise_floor Noise_floor_count +Entropy Bit_depth Dynamic_range Zero_crossings @@ -2695,6 +2754,7 @@ Flat_factor Peak_count Noise_floor Noise_floor_count +Entropy Bit_depth Number_of_samples Number_of_NaNs @@ -2773,6 +2833,9 @@ Minimum local peak measured in dBFS over a short window. Number of occasions (not the number of samples) that the signal attained @var{Noise floor}. +@item Entropy +Entropy measured across whole audio. Entropy of value near 1.0 is typically measured for white noise. + @item Bit depth Overall bit depth of audio. Number of bits used for each sample. @@ -2967,6 +3030,35 @@ Change filter tempo scale factor. Syntax for the command is : "@var{tempo}" @end table +@section atilt +Apply spectral tilt filter to audio stream. + +This filter apply any spectral roll-off slope over any specified frequency band. + +The filter accepts the following options: + +@table @option +@item freq +Set central frequency of tilt in Hz. Default is 10000 Hz. + +@item slope +Set slope direction of tilt. Default is 0. Allowed range is from -1 to 1. + +@item width +Set width of tilt. Default is 1000. Allowed range is from 100 to 10000. + +@item order +Set order of tilt filter. + +@item level +Set input volume level. Allowed range is from 0 to 4. +Defalt is 1. +@end table + +@subsection Commands + +This filter supports the all above options as @ref{commands}. + @section atrim Trim the input so that the output contains one continuous subpart of the input. @@ -8224,6 +8316,19 @@ Default value is 0. @item saturation Set the amount of saturation. Allowed range is from -3.0 to 3.0. Default value is 1. + +@item analyze +If set to anything other than @code{manual} it will analyze every frame and use derived +parameters for filtering output frame. + +Possible values are: +@table @samp +@item manual +@item average +@item minmax +@item median +@end table +Default value is @code{manual}. @end table @subsection Commands @@ -9969,7 +10074,7 @@ Note that different backends use different file formats. TensorFlow and native backend can load files for only its format. @end table -It can also be finished with @ref{dnn_processing} filter. +To get full functionality (such as async execution), please use the @ref{dnn_processing} filter. @section deshake @@ -10270,11 +10375,8 @@ and the second line is the name of label id 1, etc. The label id is considered as name if the label file is not provided. @item backend_configs -Set the configs to be passed into backend - -@item async -use DNN async execution if set (default: set), -roll back to sync execution if the backend does not support async. +Set the configs to be passed into backend. To use async execution, set async (default: set). +Roll back to sync execution if the backend does not support async. @end table @@ -10326,15 +10428,12 @@ Set the input name of the dnn network. Set the output name of the dnn network. @item backend_configs -Set the configs to be passed into backend +Set the configs to be passed into backend. To use async execution, set async (default: set). +Roll back to sync execution if the backend does not support async. For tensorflow backend, you can set its configs with @option{sess_config} options, please use tools/python/tf_sess_config.py to get the configs of TensorFlow backend for your system. -@item async -use DNN async execution if set (default: set), -roll back to sync execution if the backend does not support async. - @end table @subsection Examples @@ -13020,6 +13119,12 @@ Display video frame rate or sample rate in case of audio used by filter link. @item eof Display link output status. + +@item sample_count_in +Display number of samples taken from filter. + +@item sample_count_out +Display number of samples given out from filter. @end table @item rate, r @@ -13027,6 +13132,18 @@ Set upper limit for video rate of output stream, Default value is @var{25}. This guarantee that output video frame rate will not be higher than this value. @end table +@section grayworld +A color constancy filter that applies color correction based on the grayworld assumption + +See: @url{https://www.researchgate.net/publication/275213614_A_New_Color_Correction_Method_for_Underwater_Imaging} + +The algorithm uses linear light, so input +data should be linearized beforehand (and possibly correctly tagged). + +@example +ffmpeg -i INPUT -vf zscale=transfer=linear,grayworld,zscale=transfer=bt709,format=yuv420p OUTPUT +@end example + @section greyedge A color constancy variation filter which estimates scene illumination via grey edge algorithm and corrects the scene colors accordingly. @@ -13500,6 +13617,82 @@ If set to 1, force the output to terminate when the shortest input terminates. Default value is 0. @end table +@section hsvhold +Turns a certain HSV range into gray values. + +This filter measures color difference between set HSV color in options +and ones measured in video stream. Depending on options, output +colors can be changed to be gray or not. + +The filter accepts the following options: + +@table @option +@item hue +Set the hue value which will be used if color difference calculation. +Allowed range is from -360 to 360. Default value is 0. + +@item sat +Set the saturation value which will be used if color difference calculation. +Allowed range is from -1 to 1. Default value is 0. + +@item val +Set the value which will be used if color difference calculation. +Allowed range is from -1 to 1. Default value is 0. + +@item similarity +Set similarity percentage with the key color. +Allowed range is from 0 to 1. Default value is 0.01. + +0.00001 matches only the exact key color, while 1.0 matches everything. + +@item blend +Blend percentage. +Allowed range is from 0 to 1. Default value is 0. + +0.0 makes pixels either fully gray, or not gray at all. + +Higher values result in more gray pixels, with a higher gray pixel +the more similar the pixels color is to the key color. +@end table + +@section hsvkey +Turns a certain HSV range into transparency. + +This filter measures color difference between set HSV color in options +and ones measured in video stream. Depending on options, output +colors can be changed to transparent by adding alpha channel. + +The filter accepts the following options: + +@table @option +@item hue +Set the hue value which will be used if color difference calculation. +Allowed range is from -360 to 360. Default value is 0. + +@item sat +Set the saturation value which will be used if color difference calculation. +Allowed range is from -1 to 1. Default value is 0. + +@item val +Set the value which will be used if color difference calculation. +Allowed range is from -1 to 1. Default value is 0. + +@item similarity +Set similarity percentage with the key color. +Allowed range is from 0 to 1. Default value is 0.01. + +0.00001 matches only the exact key color, while 1.0 matches everything. + +@item blend +Blend percentage. +Allowed range is from 0 to 1. Default value is 0. + +0.0 makes pixels either fully transparent, or not transparent at all. + +Higher values result in semi-transparent pixels, with a higher transparency +the more similar the pixels color is to the key color. +@end table + @section hue Modify the hue and/or the saturation of the input. @@ -17155,7 +17348,7 @@ This filter supports the all above options as @ref{commands}. @item Output a csv with presentation time and the first two lines of identified EIA-608 captioning data. @example -ffprobe -f lavfi -i movie=captioned_video.mov,readeia608 -show_entries frame=pkt_pts_time:frame_tags=lavfi.readeia608.0.cc,lavfi.readeia608.1.cc -of csv +ffprobe -f lavfi -i movie=captioned_video.mov,readeia608 -show_entries frame=pts_time:frame_tags=lavfi.readeia608.0.cc,lavfi.readeia608.1.cc -of csv @end example @end itemize @@ -18197,6 +18390,27 @@ If the specified expression is not valid, it is kept at its current value. @end table +@section scharr +Apply scharr operator to input video stream. + +The filter accepts the following option: + +@table @option +@item planes +Set which planes will be processed, unprocessed planes will be copied. +By default value 0xf, all planes will be processed. + +@item scale +Set value which will be multiplied with filtered result. + +@item delta +Set value which will be added to filtered result. +@end table + +@subsection Commands + +This filter supports the all above options as @ref{commands}. + @section scroll Scroll input video horizontally and/or vertically by constant speed. @@ -19258,7 +19472,7 @@ Default value is @code{2}. Scale factor is necessary for SRCNN model, because it input upscaled using bicubic upscaling with proper scale factor. @end table -This feature can also be finished with @ref{dnn_processing} filter. +To get full functionality (such as async execution), please use the @ref{dnn_processing} filter. @section ssim @@ -22104,6 +22318,19 @@ Set background opacity. Set tint for output. Only used with lowpass filter and when display is not overlay and input pixel formats are not RGB. + +@item fitmode, fm +Set sample aspect ratio of video output frames. +Can be used to configure waveform so it is not +streched too much in one of directions. + +@table @samp +@item none +Set sample aspect ration to 1/1. +@item size +Set sample aspect ratio to match input size of video +@end table +Default is @samp{none}. @end table @section weave, doubleweave @@ -22213,6 +22440,7 @@ Set one of available transition effects: @item wipebr @item squeezeh @item squeezev +@item zoomin @end table Default transition effect is fade. @@ -25659,6 +25887,43 @@ A processing speed faster than what is possible without these filters cannot be achieved. @end table +@section segment, asegment + +Split single input stream into multiple streams. + +This filter does opposite of concat filters. + +@code{segment} works on video frames, @code{asegment} on audio samples. + +This filter accepts the following options: + +@table @option +@item timestamps +Timestamps of output segments separated by '|'. The first segment will run +from the beginning of the input stream. The last segment will run until +the end of the input stream + +@item frames, samples +Exact frame/sample count to split the segments. +@end table + +In all cases, prefixing an each segment with '+' will make it relative to the +previous segment. + +@subsection Examples + +@itemize + +@item +Split input audio stream into three output audio streams, starting at start of input audio stream +and storing that in 1st output audio stream, then following at 60th second and storing than in 2nd +output audio stream, and last after 150th second of input audio stream store in 3rd output audio stream: +@example +asegment=timestamps="60|150" +@end example + +@end itemize + @anchor{select} @section select, aselect @@ -26749,6 +27014,8 @@ the samples scroll from right to left frames are only produced when the samples reach the right @item rscroll the samples scroll from left to right +@item lreplace +the samples start again on the right when they reach the left @end table Default value is @code{replace}. @@ -26889,7 +27156,8 @@ Set scale gain for calculating intensity color values. Default value is @code{1}. @item data -Set which data to display. Can be @code{magnitude}, default or @code{phase}. +Set which data to display. Can be @code{magnitude}, default or @code{phase}, +or unwrapped phase: @code{uphase}. @item rotation Set color rotation, must be in [-1.0, 1.0] range. @@ -26906,6 +27174,14 @@ Set upper frame rate limit. Default is @code{auto}, unlimited. @item legend Draw time and frequency axes and legends. Default is disabled. + +@item drange +Set dynamic range used to calculate intensity color values. Default is 120 dBFS. +Allowed range is from 10 to 200. + +@item limit +Set upper limit of input audio samples volume in dBFS. Default is 0 dBFS. +Allowed range is from -100 to 100. @end table The usage is very similar to the showwaves filter; see the examples in that @@ -27079,6 +27355,14 @@ Set start frequency from which to display spectrogram. Default is @code{0}. @item stop Set stop frequency to which to display spectrogram. Default is @code{0}. + +@item drange +Set dynamic range used to calculate intensity color values. Default is 120 dBFS. +Allowed range is from 10 to 200. + +@item limit +Set upper limit of input audio samples volume in dBFS. Default is 0 dBFS. +Allowed range is from -100 to 100. @end table @subsection Examples diff --git a/chromium/third_party/ffmpeg/doc/general_contents.texi b/chromium/third_party/ffmpeg/doc/general_contents.texi index f3f4feab70b..ce5fd4639da 100644 --- a/chromium/third_party/ffmpeg/doc/general_contents.texi +++ b/chromium/third_party/ffmpeg/doc/general_contents.texi @@ -599,6 +599,7 @@ library: @item raw NULL @tab X @tab @item raw video @tab X @tab X @item raw id RoQ @tab X @tab +@item raw OBU @tab X @tab X @item raw SBC @tab X @tab X @item raw Shorten @tab @tab X @item raw TAK @tab @tab X @@ -1018,7 +1019,7 @@ following image formats are supported: @item QuickTime 8BPS video @tab @tab X @item QuickTime Animation (RLE) video @tab X @tab X @tab fourcc: 'rle ' -@item QuickTime Graphics (SMC) @tab @tab X +@item QuickTime Graphics (SMC) @tab X @tab X @tab fourcc: 'smc ' @item QuickTime video (RPZA) @tab X @tab X @tab fourcc: rpza diff --git a/chromium/third_party/ffmpeg/doc/git-howto.texi b/chromium/third_party/ffmpeg/doc/git-howto.texi index 2b4fb802332..874afabbbc3 100644 --- a/chromium/third_party/ffmpeg/doc/git-howto.texi +++ b/chromium/third_party/ffmpeg/doc/git-howto.texi @@ -217,16 +217,46 @@ git config --global core.editor or set by one of the following environment variables: @var{GIT_EDITOR}, @var{VISUAL} or @var{EDITOR}. -Log messages should be concise but descriptive. Explain why you made a change, -what you did will be obvious from the changes themselves most of the time. -Saying just "bug fix" or "10l" is bad. Remember that people of varying skill -levels look at and educate themselves while reading through your code. Don't -include filenames in log messages, Git provides that information. - -Possibly make the commit message have a terse, descriptive first line, an -empty line and then a full description. The first line will be used to name +@section Writing a commit message + +Log messages should be concise but descriptive. + +The first line must contain the context, a colon and a very short +summary of what the commit does. Details can be added, if necessary, +separated by an empty line. These details should not exceed 60-72 characters +per line, except when containing code. + +Example of a good commit message: + +@example +avcodec/cbs: add a helper to read extradata within packet side data + +Using ff_cbs_read() on the raw buffer will not parse it as extradata, +resulting in parsing errors for example when handling ISOBMFF avcC. +This helper works around that. +@end example + +@example +ptr might be NULL +@end example + +If the summary on the first line is not enough, in the body of the message, +explain why you made a change, what you did will be obvious from the changes +themselves most of the time. Saying just "bug fix" or "10l" is bad. Remember +that people of varying skill levels look at and educate themselves while +reading through your code. Don't include filenames in log messages except in +the context, Git provides that information. + +If the commit fixes a registered issue, state it in a separate line of the +body: @code{Fix Trac ticket #42.} + +The first line will be used to name the patch by @command{git format-patch}. +Common mistakes for the first line, as seen in @command{git log --oneline} +include: missing context at the beginning; description of what the code did +before the patch; line too long or wrapped to the second line. + @section Preparing a patchset @example diff --git a/chromium/third_party/ffmpeg/doc/indevs.texi b/chromium/third_party/ffmpeg/doc/indevs.texi index b377924c2fc..5be647f70aa 100644 --- a/chromium/third_party/ffmpeg/doc/indevs.texi +++ b/chromium/third_party/ffmpeg/doc/indevs.texi @@ -344,9 +344,23 @@ Defines number of audio channels to capture. Must be @samp{2}, @samp{8} or @samp Defaults to @samp{2}. @item duplex_mode -Sets the decklink device duplex mode. Must be @samp{unset}, @samp{half} or @samp{full}. +Sets the decklink device duplex/profile mode. Must be @samp{unset}, @samp{half}, @samp{full}, +@samp{one_sub_device_full}, @samp{one_sub_device_half}, @samp{two_sub_device_full}, +@samp{four_sub_device_half} Defaults to @samp{unset}. +Note: DeckLink SDK 11.0 have replaced the duplex property by a profile property. +For the DeckLink Duo 2 and DeckLink Quad 2, a profile is shared between any 2 +sub-devices that utilize the same connectors. For the DeckLink 8K Pro, a profile +is shared between all 4 sub-devices. So DeckLink 8K Pro support four profiles. + +Valid profile modes for DeckLink 8K Pro(with DeckLink SDK >= 11.0): +@samp{one_sub_device_full}, @samp{one_sub_device_half}, @samp{two_sub_device_full}, +@samp{four_sub_device_half} + +Valid profile modes for DeckLink Quad 2 and DeckLink Duo 2: +@samp{half}, @samp{full} + @item timecode_format Timecode type to include in the frame and video stream metadata. Must be @samp{none}, @samp{rp188vitc}, @samp{rp188vitc2}, @samp{rp188ltc}, diff --git a/chromium/third_party/ffmpeg/doc/muxers.texi b/chromium/third_party/ffmpeg/doc/muxers.texi index 0972bbfd5c4..7338e8d5d32 100644 --- a/chromium/third_party/ffmpeg/doc/muxers.texi +++ b/chromium/third_party/ffmpeg/doc/muxers.texi @@ -1564,15 +1564,15 @@ have no effect if it is not. @item default_mode This option controls how the FlagDefault of the output tracks will be set. It influences which tracks players should play by default. The default mode -is @samp{infer}. +is @samp{passthrough}. @table @samp @item infer -In this mode, for each type of track (audio, video or subtitle), if there is -a track with disposition default of this type, then the first such track -(i.e. the one with the lowest index) will be marked as default; if no such -track exists, the first track of this type will be marked as default instead -(if existing). This ensures that the default flag is set in a sensible way even -if the input originated from containers that lack the concept of default tracks. +Every track with disposition default will have the FlagDefault set. +Additionally, for each type of track (audio, video or subtitle), if no track +with disposition default of this type exists, then the first track of this type +will be marked as default (if existing). This ensures that the default flag +is set in a sensible way even if the input originated from containers that +lack the concept of default tracks. @item infer_no_subs This mode is the same as infer except that if no subtitle track with disposition default exists, no subtitle track will be marked as default. @@ -2169,6 +2169,10 @@ ITU-T H.262 / MPEG-2 Part 2 video. Extensions: m2v +@subsection obu + +AV1 low overhead Open Bitstream Units muxer. Temporal delimiter OBUs will be inserted in all temporal units of the stream. + @subsection rawvideo Raw uncompressed video. diff --git a/chromium/third_party/ffmpeg/doc/outdevs.texi b/chromium/third_party/ffmpeg/doc/outdevs.texi index aaf247995cc..aa41e295230 100644 --- a/chromium/third_party/ffmpeg/doc/outdevs.texi +++ b/chromium/third_party/ffmpeg/doc/outdevs.texi @@ -198,13 +198,43 @@ Amount of time to preroll video in seconds. Defaults to @option{0.5}. @item duplex_mode -Sets the decklink device duplex mode. Must be @samp{unset}, @samp{half} or @samp{full}. +Sets the decklink device duplex/profile mode. Must be @samp{unset}, @samp{half}, @samp{full}, +@samp{one_sub_device_full}, @samp{one_sub_device_half}, @samp{two_sub_device_full}, +@samp{four_sub_device_half} Defaults to @samp{unset}. +Note: DeckLink SDK 11.0 have replaced the duplex property by a profile property. +For the DeckLink Duo 2 and DeckLink Quad 2, a profile is shared between any 2 +sub-devices that utilize the same connectors. For the DeckLink 8K Pro, a profile +is shared between all 4 sub-devices. So DeckLink 8K Pro support four profiles. + +Valid profile modes for DeckLink 8K Pro(with DeckLink SDK >= 11.0): +@samp{one_sub_device_full}, @samp{one_sub_device_half}, @samp{two_sub_device_full}, +@samp{four_sub_device_half} + +Valid profile modes for DeckLink Quad 2 and DeckLink Duo 2: +@samp{half}, @samp{full} + @item timing_offset Sets the genlock timing pixel offset on the used output. Defaults to @samp{unset}. +@item link +Sets the SDI video link configuration on the used output. Must be +@samp{unset}, @samp{single} link SDI, @samp{dual} link SDI or @samp{quad} link +SDI. +Defaults to @samp{unset}. + +@item sqd +Enable Square Division Quad Split mode for Quad-link SDI output. +Must be @samp{unset}, @samp{true} or @samp{false}. +Defaults to @option{unset}. + +@item level_a +Enable SMPTE Level A mode on the used output. +Must be @samp{unset}, @samp{true} or @samp{false}. +Defaults to @option{unset}. + @end table @subsection Examples diff --git a/chromium/third_party/ffmpeg/ffmpeg_generated.gni b/chromium/third_party/ffmpeg/ffmpeg_generated.gni index f4270818aee..fb4887a2b2e 100644 --- a/chromium/third_party/ffmpeg/ffmpeg_generated.gni +++ b/chromium/third_party/ffmpeg/ffmpeg_generated.gni @@ -24,7 +24,7 @@ if ((is_android && current_cpu == "arm" && arm_use_neon) || (is_android && curre "libavcodec/autorename_libavcodec_flacdsp.c", "libavcodec/autorename_libavcodec_mpegaudiodsp.c", "libavcodec/autorename_libavcodec_options.c", - "libavcodec/autorename_libavcodec_utils.c", + "libavcodec/autorename_libavcodec_pcm.c", "libavcodec/autorename_libavcodec_vorbisdsp.c", "libavcodec/avcodec.c", "libavcodec/avdct.c", @@ -76,7 +76,6 @@ if ((is_android && current_cpu == "arm" && arm_use_neon) || (is_android && curre "libavcodec/opustab.c", "libavcodec/parser.c", "libavcodec/parsers.c", - "libavcodec/pcm.c", "libavcodec/profiles.c", "libavcodec/pthread.c", "libavcodec/pthread_frame.c", @@ -84,6 +83,7 @@ if ((is_android && current_cpu == "arm" && arm_use_neon) || (is_android && curre "libavcodec/qsv_api.c", "libavcodec/raw.c", "libavcodec/rdft.c", + "libavcodec/utils.c", "libavcodec/vorbis.c", "libavcodec/vorbis_data.c", "libavcodec/vorbis_parser.c", @@ -91,7 +91,6 @@ if ((is_android && current_cpu == "arm" && arm_use_neon) || (is_android && curre "libavcodec/vp9_parser.c", "libavcodec/xiph.c", "libavformat/allformats.c", - "libavformat/autorename_libavformat_pcm.c", "libavformat/autorename_libavformat_utils.c", "libavformat/avio.c", "libavformat/aviobuf.c", @@ -121,6 +120,7 @@ if ((is_android && current_cpu == "arm" && arm_use_neon) || (is_android && curre "libavformat/oggparsevp8.c", "libavformat/options.c", "libavformat/os_support.c", + "libavformat/pcm.c", "libavformat/protocols.c", "libavformat/qtpalette.c", "libavformat/rawdec.c", @@ -138,6 +138,7 @@ if ((is_android && current_cpu == "arm" && arm_use_neon) || (is_android && curre "libavutil/autorename_libavutil_float_dsp.c", "libavutil/autorename_libavutil_imgutils.c", "libavutil/autorename_libavutil_tx_float.c", + "libavutil/autorename_libavutil_utils.c", "libavutil/avsscanf.c", "libavutil/avstring.c", "libavutil/base64.c", @@ -190,7 +191,6 @@ if ((is_android && current_cpu == "arm" && arm_use_neon) || (is_android && curre "libavutil/tx.c", "libavutil/tx_double.c", "libavutil/tx_int32.c", - "libavutil/utils.c", "libavutil/video_enc_params.c", ] } @@ -272,6 +272,7 @@ if ((is_mac && ffmpeg_branding == "Chrome") || (is_win && ffmpeg_branding == "Ch "libavcodec/h264dsp.c", "libavcodec/h264idct.c", "libavcodec/h264qpel.c", + "libavcodec/h274.c", "libavcodec/startcode.c", ] } @@ -394,26 +395,6 @@ if ((is_mac && current_cpu == "x64" && ffmpeg_branding == "Chrome") || (is_win & ] } -if ((use_linux_config && current_cpu == "arm" && arm_use_neon) || (use_linux_config && current_cpu == "arm")) { - ffmpeg_c_sources += [ - "libavcodec/arm/h264pred_init_arm.c", - "libavcodec/arm/hpeldsp_init_arm.c", - "libavcodec/arm/hpeldsp_init_armv6.c", - "libavcodec/arm/videodsp_init_arm.c", - "libavcodec/arm/videodsp_init_armv5te.c", - "libavcodec/arm/vp3dsp_init_arm.c", - "libavcodec/arm/vp8dsp_init_arm.c", - "libavcodec/arm/vp8dsp_init_armv6.c", - ] - ffmpeg_gas_sources += [ - "libavcodec/arm/hpeldsp_arm.S", - "libavcodec/arm/hpeldsp_armv6.S", - "libavcodec/arm/videodsp_armv5te.S", - "libavcodec/arm/vp8_armv6.S", - "libavcodec/arm/vp8dsp_armv6.S", - ] -} - if ((is_mac && current_cpu == "arm64") || (is_win && current_cpu == "arm64") || (use_linux_config && current_cpu == "arm64")) { ffmpeg_c_sources += [ "libavcodec/aarch64/h264pred_init.c", @@ -429,6 +410,31 @@ if ((is_mac && current_cpu == "arm64") || (is_win && current_cpu == "arm64") || ] } +if ((current_cpu == "arm64" && ffmpeg_branding == "Chrome") || (use_linux_config && current_cpu == "arm64" && ffmpeg_branding == "ChromeOS")) { + ffmpeg_c_sources += [ + "libavcodec/aarch64/aacpsdsp_init_aarch64.c", + "libavcodec/aarch64/sbrdsp_init_aarch64.c", + ] + ffmpeg_gas_sources += [ + "libavcodec/aarch64/autorename_libavcodec_aarch64_aacpsdsp_neon.S", + "libavcodec/aarch64/autorename_libavcodec_aarch64_sbrdsp_neon.S", + ] +} + +if ((is_mac && current_cpu == "arm64" && ffmpeg_branding == "Chrome") || (is_win && current_cpu == "arm64" && ffmpeg_branding == "Chrome") || (use_linux_config && current_cpu == "arm64" && ffmpeg_branding == "Chrome") || (use_linux_config && current_cpu == "arm64" && ffmpeg_branding == "ChromeOS")) { + ffmpeg_c_sources += [ + "libavcodec/aarch64/h264chroma_init_aarch64.c", + "libavcodec/aarch64/h264dsp_init_aarch64.c", + "libavcodec/aarch64/h264qpel_init_aarch64.c", + ] + ffmpeg_gas_sources += [ + "libavcodec/aarch64/autorename_libavcodec_aarch64_h264cmc_neon.S", + "libavcodec/aarch64/autorename_libavcodec_aarch64_h264dsp_neon.S", + "libavcodec/aarch64/autorename_libavcodec_aarch64_h264idct_neon.S", + "libavcodec/aarch64/autorename_libavcodec_aarch64_h264qpel_neon.S", + ] +} + if (use_linux_config && ffmpeg_branding == "ChromeOS") { ffmpeg_c_sources += [ "libavcodec/acelp_filters.c", @@ -479,35 +485,41 @@ if (use_linux_config && ffmpeg_branding == "ChromeOS") { ] } -if ((current_cpu == "arm64" && ffmpeg_branding == "Chrome") || (use_linux_config && current_cpu == "arm64" && ffmpeg_branding == "ChromeOS")) { +if ((use_linux_config && current_cpu == "arm" && arm_use_neon) || (use_linux_config && current_cpu == "arm")) { ffmpeg_c_sources += [ - "libavcodec/aarch64/aacpsdsp_init_aarch64.c", - "libavcodec/aarch64/sbrdsp_init_aarch64.c", + "libavcodec/arm/h264pred_init_arm.c", + "libavcodec/arm/hpeldsp_init_arm.c", + "libavcodec/arm/hpeldsp_init_armv6.c", + "libavcodec/arm/videodsp_init_arm.c", + "libavcodec/arm/videodsp_init_armv5te.c", + "libavcodec/arm/vp3dsp_init_arm.c", + "libavcodec/arm/vp8dsp_init_arm.c", + "libavcodec/arm/vp8dsp_init_armv6.c", ] ffmpeg_gas_sources += [ - "libavcodec/aarch64/autorename_libavcodec_aarch64_aacpsdsp_neon.S", - "libavcodec/aarch64/autorename_libavcodec_aarch64_sbrdsp_neon.S", + "libavcodec/arm/hpeldsp_arm.S", + "libavcodec/arm/hpeldsp_armv6.S", + "libavcodec/arm/videodsp_armv5te.S", + "libavcodec/arm/vp8_armv6.S", + "libavcodec/arm/vp8dsp_armv6.S", ] } -if ((is_mac && current_cpu == "arm64" && ffmpeg_branding == "Chrome") || (is_win && current_cpu == "arm64" && ffmpeg_branding == "Chrome") || (use_linux_config && current_cpu == "arm64" && ffmpeg_branding == "Chrome") || (use_linux_config && current_cpu == "arm64" && ffmpeg_branding == "ChromeOS")) { +if ((is_android && current_cpu == "arm" && arm_use_neon && ffmpeg_branding == "Chrome") || (use_linux_config && current_cpu == "arm" && arm_use_neon && ffmpeg_branding == "Chrome") || (use_linux_config && current_cpu == "arm" && arm_use_neon && ffmpeg_branding == "ChromeOS") || (use_linux_config && current_cpu == "arm" && ffmpeg_branding == "Chrome") || (use_linux_config && current_cpu == "arm" && ffmpeg_branding == "ChromeOS")) { ffmpeg_c_sources += [ - "libavcodec/aarch64/h264chroma_init_aarch64.c", - "libavcodec/aarch64/h264dsp_init_aarch64.c", - "libavcodec/aarch64/h264qpel_init_aarch64.c", - ] - ffmpeg_gas_sources += [ - "libavcodec/aarch64/autorename_libavcodec_aarch64_h264cmc_neon.S", - "libavcodec/aarch64/autorename_libavcodec_aarch64_h264dsp_neon.S", - "libavcodec/aarch64/autorename_libavcodec_aarch64_h264idct_neon.S", - "libavcodec/aarch64/autorename_libavcodec_aarch64_h264qpel_neon.S", + "libavcodec/arm/aacpsdsp_init_arm.c", + "libavcodec/arm/sbrdsp_init_arm.c", ] } -if ((is_android && current_cpu == "arm" && arm_use_neon && ffmpeg_branding == "Chrome") || (use_linux_config && current_cpu == "arm" && arm_use_neon && ffmpeg_branding == "Chrome") || (use_linux_config && current_cpu == "arm" && arm_use_neon && ffmpeg_branding == "ChromeOS") || (use_linux_config && current_cpu == "arm" && ffmpeg_branding == "Chrome") || (use_linux_config && current_cpu == "arm" && ffmpeg_branding == "ChromeOS")) { +if ((use_linux_config && current_cpu == "arm" && arm_use_neon && ffmpeg_branding == "Chrome") || (use_linux_config && current_cpu == "arm" && arm_use_neon && ffmpeg_branding == "ChromeOS") || (use_linux_config && current_cpu == "arm" && ffmpeg_branding == "Chrome") || (use_linux_config && current_cpu == "arm" && ffmpeg_branding == "ChromeOS")) { ffmpeg_c_sources += [ - "libavcodec/arm/aacpsdsp_init_arm.c", - "libavcodec/arm/sbrdsp_init_arm.c", + "libavcodec/arm/h264chroma_init_arm.c", + "libavcodec/arm/h264dsp_init_arm.c", + "libavcodec/arm/h264qpel_init_arm.c", + ] + ffmpeg_gas_sources += [ + "libavcodec/arm/startcode_armv6.S", ] } @@ -524,17 +536,6 @@ if ((is_android && current_cpu == "arm" && arm_use_neon) || (use_linux_config && ] } -if ((use_linux_config && current_cpu == "arm" && arm_use_neon && ffmpeg_branding == "Chrome") || (use_linux_config && current_cpu == "arm" && arm_use_neon && ffmpeg_branding == "ChromeOS") || (use_linux_config && current_cpu == "arm" && ffmpeg_branding == "Chrome") || (use_linux_config && current_cpu == "arm" && ffmpeg_branding == "ChromeOS")) { - ffmpeg_c_sources += [ - "libavcodec/arm/h264chroma_init_arm.c", - "libavcodec/arm/h264dsp_init_arm.c", - "libavcodec/arm/h264qpel_init_arm.c", - ] - ffmpeg_gas_sources += [ - "libavcodec/arm/startcode_armv6.S", - ] -} - if ((use_linux_config && current_cpu == "x64" && ffmpeg_branding == "ChromeOS") || (use_linux_config && current_cpu == "x86" && ffmpeg_branding == "ChromeOS")) { ffmpeg_c_sources += [ "libavcodec/x86/autorename_libavcodec_x86_mpegvideo.c", @@ -562,6 +563,13 @@ if ((use_linux_config && current_cpu == "x64" && ffmpeg_branding == "ChromeOS") ] } +if ((is_android && current_cpu == "arm" && arm_use_neon && ffmpeg_branding == "Chrome") || (use_linux_config && current_cpu == "arm" && arm_use_neon && ffmpeg_branding == "Chrome") || (use_linux_config && current_cpu == "arm" && arm_use_neon && ffmpeg_branding == "ChromeOS")) { + ffmpeg_gas_sources += [ + "libavcodec/arm/aacpsdsp_neon.S", + "libavcodec/arm/sbrdsp_neon.S", + ] +} + if (use_linux_config && current_cpu == "arm" && arm_use_neon) { ffmpeg_c_sources += [ "libavcodec/arm/hpeldsp_init_neon.c", @@ -575,10 +583,9 @@ if (use_linux_config && current_cpu == "arm" && arm_use_neon) { ] } -if ((is_android && current_cpu == "arm" && arm_use_neon && ffmpeg_branding == "Chrome") || (use_linux_config && current_cpu == "arm" && arm_use_neon && ffmpeg_branding == "Chrome") || (use_linux_config && current_cpu == "arm" && arm_use_neon && ffmpeg_branding == "ChromeOS")) { - ffmpeg_gas_sources += [ - "libavcodec/arm/aacpsdsp_neon.S", - "libavcodec/arm/sbrdsp_neon.S", +if ((use_linux_config && current_cpu == "arm" && arm_use_neon && ffmpeg_branding == "ChromeOS") || (use_linux_config && current_cpu == "arm64" && ffmpeg_branding == "ChromeOS")) { + ffmpeg_c_sources += [ + "libavcodec/neon/mpegvideo.c", ] } @@ -606,12 +613,6 @@ if ((use_linux_config && current_cpu == "arm" && arm_use_neon && ffmpeg_branding ] } -if ((use_linux_config && current_cpu == "arm" && arm_use_neon && ffmpeg_branding == "ChromeOS") || (use_linux_config && current_cpu == "arm64" && ffmpeg_branding == "ChromeOS")) { - ffmpeg_c_sources += [ - "libavcodec/neon/mpegvideo.c", - ] -} - if ((use_linux_config && current_cpu == "arm" && arm_use_neon && ffmpeg_branding == "Chrome") || (use_linux_config && current_cpu == "arm" && arm_use_neon && ffmpeg_branding == "ChromeOS")) { ffmpeg_gas_sources += [ "libavcodec/arm/h264cmc_neon.S", diff --git a/chromium/third_party/ffmpeg/fftools/Makefile b/chromium/third_party/ffmpeg/fftools/Makefile index 5affaa3f56e..5234932ab0e 100644 --- a/chromium/third_party/ffmpeg/fftools/Makefile +++ b/chromium/third_party/ffmpeg/fftools/Makefile @@ -10,7 +10,6 @@ ALLAVPROGS = $(AVBASENAMES:%=%$(PROGSSUF)$(EXESUF)) ALLAVPROGS_G = $(AVBASENAMES:%=%$(PROGSSUF)_g$(EXESUF)) OBJS-ffmpeg += fftools/ffmpeg_opt.o fftools/ffmpeg_filter.o fftools/ffmpeg_hw.o -OBJS-ffmpeg-$(CONFIG_LIBMFX) += fftools/ffmpeg_qsv.o ifndef CONFIG_VIDEOTOOLBOX OBJS-ffmpeg-$(CONFIG_VDA) += fftools/ffmpeg_videotoolbox.o endif diff --git a/chromium/third_party/ffmpeg/fftools/cmdutils.c b/chromium/third_party/ffmpeg/fftools/cmdutils.c index 0b1ef03a256..ac172dbd655 100644 --- a/chromium/third_party/ffmpeg/fftools/cmdutils.c +++ b/chromium/third_party/ffmpeg/fftools/cmdutils.c @@ -68,12 +68,11 @@ static int init_report(const char *env); AVDictionary *sws_dict; AVDictionary *swr_opts; -AVDictionary *format_opts, *codec_opts, *resample_opts; +AVDictionary *format_opts, *codec_opts; static FILE *report_file; static int report_file_level = AV_LOG_DEBUG; int hide_banner = 0; -int cpu_count = -1; enum show_muxdemuxers { SHOW_DEFAULT, @@ -81,18 +80,12 @@ enum show_muxdemuxers { SHOW_MUXERS, }; -void init_opts(void) -{ - av_dict_set(&sws_dict, "flags", "bicubic", 0); -} - void uninit_opts(void) { av_dict_free(&swr_opts); av_dict_free(&sws_dict); av_dict_free(&format_opts); av_dict_free(&codec_opts); - av_dict_free(&resample_opts); } void log_callback_help(void *ptr, int level, const char *fmt, va_list vl) @@ -663,14 +656,11 @@ static void finish_group(OptionParseContext *octx, int group_idx, g->swr_opts = swr_opts; g->codec_opts = codec_opts; g->format_opts = format_opts; - g->resample_opts = resample_opts; codec_opts = NULL; format_opts = NULL; - resample_opts = NULL; sws_dict = NULL; swr_opts = NULL; - init_opts(); memset(&octx->cur_group, 0, sizeof(octx->cur_group)); } @@ -708,8 +698,6 @@ static void init_parse_context(OptionParseContext *octx, octx->global_opts.group_def = &global_group; octx->global_opts.arg = ""; - - init_opts(); } void uninit_parse_context(OptionParseContext *octx) @@ -723,7 +711,6 @@ void uninit_parse_context(OptionParseContext *octx) av_freep(&l->groups[j].opts); av_dict_free(&l->groups[j].codec_opts); av_dict_free(&l->groups[j].format_opts); - av_dict_free(&l->groups[j].resample_opts); av_dict_free(&l->groups[j].sws_dict); av_dict_free(&l->groups[j].swr_opts); @@ -835,7 +822,7 @@ do { \ return AVERROR_OPTION_NOT_FOUND; } - if (octx->cur_group.nb_opts || codec_opts || format_opts || resample_opts) + if (octx->cur_group.nb_opts || codec_opts || format_opts) av_log(NULL, AV_LOG_WARNING, "Trailing option(s) found in the " "command: may be ignored.\n"); @@ -862,7 +849,7 @@ int opt_cpucount(void *optctx, const char *opt, const char *arg) int count; static const AVOption opts[] = { - {"count", NULL, 0, AV_OPT_TYPE_INT, { .i64 = -1}, -1, INT_MAX, NULL}, + {"count", NULL, 0, AV_OPT_TYPE_INT, { .i64 = -1}, -1, INT_MAX}, {NULL}, }; static const AVClass class = { @@ -912,20 +899,18 @@ int opt_loglevel(void *optctx, const char *opt, const char *arg) if (!i && !cmd) { flags = 0; /* missing relative prefix, build absolute value */ } - if (!strncmp(token, "repeat", 6)) { + if (av_strstart(token, "repeat", &arg)) { if (cmd == '-') { flags |= AV_LOG_SKIP_REPEATED; } else { flags &= ~AV_LOG_SKIP_REPEATED; } - arg = token + 6; - } else if (!strncmp(token, "level", 5)) { + } else if (av_strstart(token, "level", &arg)) { if (cmd == '-') { flags &= ~AV_LOG_PRINT_LEVEL; } else { flags |= AV_LOG_PRINT_LEVEL; } - arg = token + 5; } else { break; } @@ -1360,9 +1345,9 @@ static int show_formats_devices(void *optctx, const char *opt, const char *arg, break; last_name = name; - printf(" %s%s %-15s %s\n", - decode ? "D" : " ", - encode ? "E" : " ", + printf(" %c%c %-15s %s\n", + decode ? 'D' : ' ', + encode ? 'E' : ' ', name, long_name ? long_name:" "); } @@ -1718,12 +1703,14 @@ int show_filters(void *optctx, const char *opt, const char *arg) while ((filter = av_filter_iterate(&opaque))) { descr_cur = descr; for (i = 0; i < 2; i++) { + unsigned nb_pads; if (i) { *(descr_cur++) = '-'; *(descr_cur++) = '>'; } pad = i ? filter->outputs : filter->inputs; - for (j = 0; pad && avfilter_pad_get_name(pad, j); j++) { + nb_pads = avfilter_filter_pad_count(filter, i); + for (j = 0; j < nb_pads; j++) { if (descr_cur >= descr + sizeof(descr) - 4) break; *(descr_cur++) = get_media_type_char(avfilter_pad_get_type(pad, j)); @@ -1958,7 +1945,7 @@ static void show_help_filter(const char *name) printf(" slice threading supported\n"); printf(" Inputs:\n"); - count = avfilter_pad_count(f->inputs); + count = avfilter_filter_pad_count(f, 0); for (i = 0; i < count; i++) { printf(" #%d: %s (%s)\n", i, avfilter_pad_get_name(f->inputs, i), media_type_string(avfilter_pad_get_type(f->inputs, i))); @@ -1969,7 +1956,7 @@ static void show_help_filter(const char *name) printf(" none (source filter)\n"); printf(" Outputs:\n"); - count = avfilter_pad_count(f->outputs); + count = avfilter_filter_pad_count(f, 1); for (i = 0; i < count; i++) { printf(" #%d: %s (%s)\n", i, avfilter_pad_get_name(f->outputs, i), media_type_string(avfilter_pad_get_type(f->outputs, i))); @@ -2243,19 +2230,13 @@ static int print_device_sources(const AVInputFormat *fmt, AVDictionary *opts) return AVERROR(EINVAL); printf("Auto-detected sources for %s:\n", fmt->name); - if (!fmt->get_device_list) { - ret = AVERROR(ENOSYS); - printf("Cannot list sources. Not implemented.\n"); - goto fail; - } - if ((ret = avdevice_list_input_sources(fmt, NULL, opts, &device_list)) < 0) { - printf("Cannot list sources.\n"); + printf("Cannot list sources: %s\n", av_err2str(ret)); goto fail; } for (i = 0; i < device_list->nb_devices; i++) { - printf("%s %s [%s]\n", device_list->default_device == i ? "*" : " ", + printf("%c %s [%s]\n", device_list->default_device == i ? '*' : ' ', device_list->devices[i]->device_name, device_list->devices[i]->device_description); } @@ -2273,19 +2254,13 @@ static int print_device_sinks(const AVOutputFormat *fmt, AVDictionary *opts) return AVERROR(EINVAL); printf("Auto-detected sinks for %s:\n", fmt->name); - if (!fmt->get_device_list) { - ret = AVERROR(ENOSYS); - printf("Cannot list sinks. Not implemented.\n"); - goto fail; - } - if ((ret = avdevice_list_output_sinks(fmt, NULL, opts, &device_list)) < 0) { - printf("Cannot list sinks.\n"); + printf("Cannot list sinks: %s\n", av_err2str(ret)); goto fail; } for (i = 0; i < device_list->nb_devices; i++) { - printf("%s %s [%s]\n", device_list->default_device == i ? "*" : " ", + printf("%c %s [%s]\n", device_list->default_device == i ? '*' : ' ', device_list->devices[i]->device_name, device_list->devices[i]->device_description); } diff --git a/chromium/third_party/ffmpeg/fftools/cmdutils.h b/chromium/third_party/ffmpeg/fftools/cmdutils.h index d1d1257b8b1..9caad018657 100644 --- a/chromium/third_party/ffmpeg/fftools/cmdutils.h +++ b/chromium/third_party/ffmpeg/fftools/cmdutils.h @@ -48,9 +48,8 @@ extern AVCodecContext *avcodec_opts[AVMEDIA_TYPE_NB]; extern AVFormatContext *avformat_opts; extern AVDictionary *sws_dict; extern AVDictionary *swr_opts; -extern AVDictionary *format_opts, *codec_opts, *resample_opts; +extern AVDictionary *format_opts, *codec_opts; extern int hide_banner; -extern int cpu_count; /** * Register a program-specific cleanup routine. @@ -324,7 +323,6 @@ typedef struct OptionGroup { AVDictionary *codec_opts; AVDictionary *format_opts; - AVDictionary *resample_opts; AVDictionary *sws_dict; AVDictionary *swr_opts; } OptionGroup; diff --git a/chromium/third_party/ffmpeg/fftools/ffmpeg.c b/chromium/third_party/ffmpeg/fftools/ffmpeg.c index b0ce7c7c32b..a9bb9d964de 100644 --- a/chromium/third_party/ffmpeg/fftools/ffmpeg.c +++ b/chromium/third_party/ffmpeg/fftools/ffmpeg.c @@ -653,6 +653,7 @@ static void ffmpeg_cleanup(int ret) av_err2str(AVERROR(errno))); } av_freep(&vstats_filename); + av_freep(&filter_nbthreads); av_freep(&input_streams); av_freep(&input_files); @@ -3571,11 +3572,6 @@ static int init_output_stream(OutputStream *ost, AVFrame *frame, } if (!av_dict_get(ost->encoder_opts, "threads", NULL, 0)) av_dict_set(&ost->encoder_opts, "threads", "auto", 0); - if (ost->enc->type == AVMEDIA_TYPE_AUDIO && - !codec->defaults && - !av_dict_get(ost->encoder_opts, "b", NULL, 0) && - !av_dict_get(ost->encoder_opts, "ab", NULL, 0)) - av_dict_set(&ost->encoder_opts, "b", "128000", 0); ret = hw_device_setup_for_encode(ost); if (ret < 0) { @@ -4926,7 +4922,6 @@ static int transcode(void) av_dict_free(&ost->encoder_opts); av_dict_free(&ost->sws_dict); av_dict_free(&ost->swr_opts); - av_dict_free(&ost->resample_opts); } } } diff --git a/chromium/third_party/ffmpeg/fftools/ffmpeg.h b/chromium/third_party/ffmpeg/fftools/ffmpeg.h index d9c0628657c..1194bb0caeb 100644 --- a/chromium/third_party/ffmpeg/fftools/ffmpeg.h +++ b/chromium/third_party/ffmpeg/fftools/ffmpeg.h @@ -61,7 +61,6 @@ enum HWAccelID { HWACCEL_AUTO, HWACCEL_GENERIC, HWACCEL_VIDEOTOOLBOX, - HWACCEL_QSV, }; typedef struct HWAccel { @@ -361,8 +360,6 @@ typedef struct InputStream { unsigned int initialize; ///< marks if sub2video_update should force an initialization } sub2video; - int dr1; - /* decoded data from this stream goes into all those filters * currently video and audio only */ InputFilter **filters; @@ -414,7 +411,6 @@ typedef struct InputFile { int64_t ts_offset; int64_t last_ts; int64_t start_time; /* user-specified start time in AV_TIME_BASE or AV_NOPTS_VALUE */ - int seek_timestamp; int64_t recording_time; int nb_streams; /* number of stream that ffmpeg is aware of; may be different from ctx.nb_streams if new streams appear during av_read_frame() */ @@ -524,7 +520,6 @@ typedef struct OutputStream { AVDictionary *encoder_opts; AVDictionary *sws_dict; AVDictionary *swr_opts; - AVDictionary *resample_opts; char *apad; OSTFinished finished; /* no more packets should be written for this stream */ int unavailable; /* true if the steram is unavailable (possibly temporarily) */ @@ -634,7 +629,7 @@ extern AVIOContext *progress_avio; extern float max_error_rate; extern char *videotoolbox_pixfmt; -extern int filter_nbthreads; +extern char *filter_nbthreads; extern int filter_complex_nbthreads; extern int vstats_version; extern int auto_conversion_filters; diff --git a/chromium/third_party/ffmpeg/fftools/ffmpeg_filter.c b/chromium/third_party/ffmpeg/fftools/ffmpeg_filter.c index 958d74f008d..6b7b6ca1b31 100644 --- a/chromium/third_party/ffmpeg/fftools/ffmpeg_filter.c +++ b/chromium/third_party/ffmpeg/fftools/ffmpeg_filter.c @@ -628,7 +628,7 @@ static int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter, switch (avfilter_pad_get_type(out->filter_ctx->output_pads, out->pad_idx)) { case AVMEDIA_TYPE_VIDEO: return configure_output_video_filter(fg, ofilter, out); case AVMEDIA_TYPE_AUDIO: return configure_output_audio_filter(fg, ofilter, out); - default: av_assert0(0); + default: av_assert0(0); return 0; } } @@ -938,7 +938,7 @@ static int configure_input_filter(FilterGraph *fg, InputFilter *ifilter, switch (avfilter_pad_get_type(in->filter_ctx->input_pads, in->pad_idx)) { case AVMEDIA_TYPE_VIDEO: return configure_input_video_filter(fg, ifilter, in); case AVMEDIA_TYPE_AUDIO: return configure_input_audio_filter(fg, ifilter, in); - default: av_assert0(0); + default: av_assert0(0); return 0; } } @@ -968,18 +968,29 @@ int configure_filtergraph(FilterGraph *fg) char args[512]; AVDictionaryEntry *e = NULL; - fg->graph->nb_threads = filter_nbthreads; + if (filter_nbthreads) { + ret = av_opt_set(fg->graph, "threads", filter_nbthreads, 0); + if (ret < 0) + goto fail; + } else { + e = av_dict_get(ost->encoder_opts, "threads", NULL, 0); + if (e) + av_opt_set(fg->graph, "threads", e->value, 0); + } args[0] = 0; + e = NULL; while ((e = av_dict_get(ost->sws_dict, "", e, AV_DICT_IGNORE_SUFFIX))) { av_strlcatf(args, sizeof(args), "%s=%s:", e->key, e->value); } - if (strlen(args)) + if (strlen(args)) { args[strlen(args)-1] = 0; - fg->graph->scale_sws_opts = av_strdup(args); + fg->graph->scale_sws_opts = av_strdup(args); + } args[0] = 0; + e = NULL; while ((e = av_dict_get(ost->swr_opts, "", e, AV_DICT_IGNORE_SUFFIX))) { av_strlcatf(args, sizeof(args), "%s=%s:", e->key, e->value); @@ -987,18 +998,6 @@ int configure_filtergraph(FilterGraph *fg) if (strlen(args)) args[strlen(args)-1] = 0; av_opt_set(fg->graph, "aresample_swr_opts", args, 0); - - args[0] = '\0'; - while ((e = av_dict_get(fg->outputs[0]->ost->resample_opts, "", e, - AV_DICT_IGNORE_SUFFIX))) { - av_strlcatf(args, sizeof(args), "%s=%s:", e->key, e->value); - } - if (strlen(args)) - args[strlen(args) - 1] = '\0'; - - e = av_dict_get(ost->encoder_opts, "threads", NULL, 0); - if (e) - av_opt_set(fg->graph, "threads", e->value, 0); } else { fg->graph->nb_threads = filter_complex_nbthreads; } diff --git a/chromium/third_party/ffmpeg/fftools/ffmpeg_hw.c b/chromium/third_party/ffmpeg/fftools/ffmpeg_hw.c index fc4a5d31d6a..14e702bd921 100644 --- a/chromium/third_party/ffmpeg/fftools/ffmpeg_hw.c +++ b/chromium/third_party/ffmpeg/fftools/ffmpeg_hw.c @@ -93,6 +93,8 @@ static char *hw_device_default_name(enum AVHWDeviceType type) int hw_device_init_from_string(const char *arg, HWDevice **dev_out) { + // "type=name" + // "type=name,key=value,key2=value2" // "type=name:device,key=value,key2=value2" // "type:device,key=value,key2=value2" // -> av_hwdevice_ctx_create() @@ -124,7 +126,7 @@ int hw_device_init_from_string(const char *arg, HWDevice **dev_out) } if (*p == '=') { - k = strcspn(p + 1, ":@"); + k = strcspn(p + 1, ":@,"); name = av_strndup(p + 1, k); if (!name) { @@ -190,6 +192,18 @@ int hw_device_init_from_string(const char *arg, HWDevice **dev_out) src->device_ref, 0); if (err < 0) goto fail; + } else if (*p == ',') { + err = av_dict_parse_string(&options, p + 1, "=", ",", 0); + + if (err < 0) { + errmsg = "failed to parse options"; + goto invalid; + } + + err = av_hwdevice_ctx_create(&device_ref, type, + NULL, options, 0); + if (err < 0) + goto fail; } else { errmsg = "parse error"; goto invalid; @@ -339,6 +353,18 @@ int hw_device_setup_for_decode(InputStream *ist) } else if (ist->hwaccel_id == HWACCEL_GENERIC) { type = ist->hwaccel_device_type; dev = hw_device_get_by_type(type); + + // When "-qsv_device device" is used, an internal QSV device named + // as "__qsv_device" is created. Another QSV device is created too + // if "-init_hw_device qsv=name:device" is used. There are 2 QSV devices + // if both "-qsv_device device" and "-init_hw_device qsv=name:device" + // are used, hw_device_get_by_type(AV_HWDEVICE_TYPE_QSV) returns NULL. + // To keep back-compatibility with the removed ad-hoc libmfx setup code, + // call hw_device_get_by_name("__qsv_device") to select the internal QSV + // device. + if (!dev && type == AV_HWDEVICE_TYPE_QSV) + dev = hw_device_get_by_name("__qsv_device"); + if (!dev) err = hw_device_init_from_type(type, NULL, &dev); } else { @@ -527,15 +553,21 @@ int hw_device_setup_for_filter(FilterGraph *fg) HWDevice *dev; int i; - // If the user has supplied exactly one hardware device then just - // give it straight to every filter for convenience. If more than - // one device is available then the user needs to pick one explcitly - // with the filter_hw_device option. + // Pick the last hardware device if the user doesn't pick the device for + // filters explicitly with the filter_hw_device option. if (filter_hw_device) dev = filter_hw_device; - else if (nb_hw_devices == 1) - dev = hw_devices[0]; - else + else if (nb_hw_devices > 0) { + dev = hw_devices[nb_hw_devices - 1]; + + if (nb_hw_devices > 1) + av_log(NULL, AV_LOG_WARNING, "There are %d hardware devices. device " + "%s of type %s is picked for filters by default. Set hardware " + "device explicitly with the filter_hw_device option if device " + "%s is not usable for filters.\n", + nb_hw_devices, dev->name, + av_hwdevice_get_type_name(dev->type), dev->name); + } else dev = NULL; if (dev) { diff --git a/chromium/third_party/ffmpeg/fftools/ffmpeg_opt.c b/chromium/third_party/ffmpeg/fftools/ffmpeg_opt.c index 1b43bab9fc5..6ca28cf9747 100644 --- a/chromium/third_party/ffmpeg/fftools/ffmpeg_opt.c +++ b/chromium/third_party/ffmpeg/fftools/ffmpeg_opt.c @@ -138,9 +138,6 @@ const HWAccel hwaccels[] = { #if CONFIG_VIDEOTOOLBOX { "videotoolbox", videotoolbox_init, HWACCEL_VIDEOTOOLBOX, AV_PIX_FMT_VIDEOTOOLBOX }, #endif -#if CONFIG_LIBMFX - { "qsv", qsv_init, HWACCEL_QSV, AV_PIX_FMT_QSV }, -#endif { 0 }, }; HWDevice *filter_hw_device; @@ -172,7 +169,7 @@ int qp_hist = 0; int stdin_interaction = 1; int frame_bits_per_raw_sample = 0; float max_error_rate = 2.0/3; -int filter_nbthreads = 0; +char *filter_nbthreads; int filter_complex_nbthreads = 0; int vstats_version = 2; int auto_conversion_filters = 1; @@ -267,6 +264,13 @@ static AVDictionary *strip_specifiers(AVDictionary *dict) return ret; } +static int opt_filter_threads(void *optctx, const char *opt, const char *arg) +{ + av_free(filter_nbthreads); + filter_nbthreads = av_strdup(arg); + return 0; +} + static int opt_abort_on(void *optctx, const char *opt, const char *arg) { static const AVOption opts[] = { @@ -571,6 +575,23 @@ static int opt_vaapi_device(void *optctx, const char *opt, const char *arg) } #endif +#if CONFIG_QSV +static int opt_qsv_device(void *optctx, const char *opt, const char *arg) +{ + const char *prefix = "qsv=__qsv_device:hw_any,child_device="; + int err; + char *tmp = av_asprintf("%s%s", prefix, arg); + + if (!tmp) + return AVERROR(ENOMEM); + + err = hw_device_init_from_string(tmp, NULL); + av_free(tmp); + + return err; +} +#endif + static int opt_init_hw_device(void *optctx, const char *opt, const char *arg) { if (!strcmp(arg, "list")) { @@ -898,6 +919,12 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic) "with old commandlines. This behaviour is DEPRECATED and will be removed " "in the future. Please explicitly set \"-hwaccel_output_format cuda\".\n"); ist->hwaccel_output_format = AV_PIX_FMT_CUDA; + } else if (!hwaccel_output_format && hwaccel && !strcmp(hwaccel, "qsv")) { + av_log(NULL, AV_LOG_WARNING, + "WARNING: defaulting hwaccel_output_format to qsv for compatibility " + "with old commandlines. This behaviour is DEPRECATED and will be removed " + "in the future. Please explicitly set \"-hwaccel_output_format qsv\".\n"); + ist->hwaccel_output_format = AV_PIX_FMT_QSV; } else if (hwaccel_output_format) { ist->hwaccel_output_format = av_get_pix_fmt(hwaccel_output_format); if (ist->hwaccel_output_format == AV_PIX_FMT_NONE) { @@ -1608,8 +1635,6 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e if (ost->enc && av_get_exact_bits_per_sample(ost->enc->id) == 24) av_dict_set(&ost->swr_opts, "output_sample_bits", "24", 0); - av_dict_copy(&ost->resample_opts, o->g->resample_opts, 0); - ost->source_index = source_index; if (source_index >= 0) { ost->sync_ist = input_streams[source_index]; @@ -2260,23 +2285,35 @@ static int open_output_file(OptionsContext *o, const char *filename) if (!o->video_disable && av_guess_codec(oc->oformat, NULL, filename, NULL, AVMEDIA_TYPE_VIDEO) != AV_CODEC_ID_NONE) { int best_score = 0, idx = -1; int qcr = avformat_query_codec(oc->oformat, oc->oformat->video_codec, 0); - for (i = 0; i < nb_input_streams; i++) { - int score; - ist = input_streams[i]; - score = ist->st->codecpar->width * ist->st->codecpar->height - + 100000000 * !!(ist->st->event_flags & AVSTREAM_EVENT_FLAG_NEW_PACKETS) - + 5000000*!!(ist->st->disposition & AV_DISPOSITION_DEFAULT); - if (ist->user_set_discard == AVDISCARD_ALL) - continue; - if((qcr!=MKTAG('A', 'P', 'I', 'C')) && (ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC)) - score = 1; - if (ist->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && - score > best_score) { - if((qcr==MKTAG('A', 'P', 'I', 'C')) && !(ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC)) + for (j = 0; j < nb_input_files; j++) { + InputFile *ifile = input_files[j]; + int file_best_score = 0, file_best_idx = -1; + for (i = 0; i < ifile->nb_streams; i++) { + int score; + ist = input_streams[ifile->ist_index + i]; + score = ist->st->codecpar->width * ist->st->codecpar->height + + 100000000 * !!(ist->st->event_flags & AVSTREAM_EVENT_FLAG_NEW_PACKETS) + + 5000000*!!(ist->st->disposition & AV_DISPOSITION_DEFAULT); + if (ist->user_set_discard == AVDISCARD_ALL) continue; - best_score = score; - idx = i; + if((qcr!=MKTAG('A', 'P', 'I', 'C')) && (ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC)) + score = 1; + if (ist->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && + score > file_best_score) { + if((qcr==MKTAG('A', 'P', 'I', 'C')) && !(ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC)) + continue; + file_best_score = score; + file_best_idx = ifile->ist_index + i; + } } + if (file_best_idx >= 0) { + if((qcr == MKTAG('A', 'P', 'I', 'C')) || !(ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC)) + file_best_score -= 5000000*!!(input_streams[file_best_idx]->st->disposition & AV_DISPOSITION_DEFAULT); + if (file_best_score > best_score) { + best_score = file_best_score; + idx = file_best_idx; + } + } } if (idx >= 0) new_video_stream(o, oc, idx); @@ -2285,19 +2322,30 @@ static int open_output_file(OptionsContext *o, const char *filename) /* audio: most channels */ if (!o->audio_disable && av_guess_codec(oc->oformat, NULL, filename, NULL, AVMEDIA_TYPE_AUDIO) != AV_CODEC_ID_NONE) { int best_score = 0, idx = -1; - for (i = 0; i < nb_input_streams; i++) { - int score; - ist = input_streams[i]; - score = ist->st->codecpar->channels - + 100000000 * !!(ist->st->event_flags & AVSTREAM_EVENT_FLAG_NEW_PACKETS) - + 5000000*!!(ist->st->disposition & AV_DISPOSITION_DEFAULT); - if (ist->user_set_discard == AVDISCARD_ALL) - continue; - if (ist->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && - score > best_score) { - best_score = score; - idx = i; + for (j = 0; j < nb_input_files; j++) { + InputFile *ifile = input_files[j]; + int file_best_score = 0, file_best_idx = -1; + for (i = 0; i < ifile->nb_streams; i++) { + int score; + ist = input_streams[ifile->ist_index + i]; + score = ist->st->codecpar->channels + + 100000000 * !!(ist->st->event_flags & AVSTREAM_EVENT_FLAG_NEW_PACKETS) + + 5000000*!!(ist->st->disposition & AV_DISPOSITION_DEFAULT); + if (ist->user_set_discard == AVDISCARD_ALL) + continue; + if (ist->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && + score > file_best_score) { + file_best_score = score; + file_best_idx = ifile->ist_index + i; + } } + if (file_best_idx >= 0) { + file_best_score -= 5000000*!!(input_streams[file_best_idx]->st->disposition & AV_DISPOSITION_DEFAULT); + if (file_best_score > best_score) { + best_score = file_best_score; + idx = file_best_idx; + } + } } if (idx >= 0) new_audio_stream(o, oc, idx); @@ -3577,7 +3625,7 @@ const OptionDef options[] = { "set profile", "profile" }, { "filter", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(filters) }, "set stream filtergraph", "filter_graph" }, - { "filter_threads", HAS_ARG | OPT_INT, { &filter_nbthreads }, + { "filter_threads", HAS_ARG, { .func_arg = opt_filter_threads }, "number of non-complex filter threads" }, { "filter_script", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(filter_scripts) }, "read stream filtergraph description from a file", "filename" }, @@ -3825,7 +3873,7 @@ const OptionDef options[] = { #endif #if CONFIG_QSV - { "qsv_device", HAS_ARG | OPT_STRING | OPT_EXPERT, { &qsv_device }, + { "qsv_device", HAS_ARG | OPT_EXPERT, { .func_arg = opt_qsv_device }, "set QSV hardware device (DirectX adapter index, DRM path or X11 display name)", "device"}, #endif diff --git a/chromium/third_party/ffmpeg/fftools/ffmpeg_qsv.c b/chromium/third_party/ffmpeg/fftools/ffmpeg_qsv.c deleted file mode 100644 index 7bd999d3102..00000000000 --- a/chromium/third_party/ffmpeg/fftools/ffmpeg_qsv.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include <mfx/mfxvideo.h> -#include <stdlib.h> - -#include "libavutil/dict.h" -#include "libavutil/hwcontext.h" -#include "libavutil/hwcontext_qsv.h" -#include "libavutil/opt.h" -#include "libavcodec/qsv.h" - -#include "ffmpeg.h" - -static AVBufferRef *hw_device_ctx; -char *qsv_device = NULL; - -static int qsv_get_buffer(AVCodecContext *s, AVFrame *frame, int flags) -{ - InputStream *ist = s->opaque; - - return av_hwframe_get_buffer(ist->hw_frames_ctx, frame, 0); -} - -static void qsv_uninit(AVCodecContext *s) -{ - InputStream *ist = s->opaque; - av_buffer_unref(&ist->hw_frames_ctx); -} - -static int qsv_device_init(InputStream *ist) -{ - int err; - AVDictionary *dict = NULL; - - if (qsv_device) { - err = av_dict_set(&dict, "child_device", qsv_device, 0); - if (err < 0) - return err; - } - - err = av_hwdevice_ctx_create(&hw_device_ctx, AV_HWDEVICE_TYPE_QSV, - ist->hwaccel_device, dict, 0); - if (err < 0) { - av_log(NULL, AV_LOG_ERROR, "Error creating a QSV device\n"); - goto err_out; - } - -err_out: - if (dict) - av_dict_free(&dict); - - return err; -} - -int qsv_init(AVCodecContext *s) -{ - InputStream *ist = s->opaque; - AVHWFramesContext *frames_ctx; - AVQSVFramesContext *frames_hwctx; - int ret; - - if (!hw_device_ctx) { - ret = qsv_device_init(ist); - if (ret < 0) - return ret; - } - - av_buffer_unref(&ist->hw_frames_ctx); - ist->hw_frames_ctx = av_hwframe_ctx_alloc(hw_device_ctx); - if (!ist->hw_frames_ctx) - return AVERROR(ENOMEM); - - frames_ctx = (AVHWFramesContext*)ist->hw_frames_ctx->data; - frames_hwctx = frames_ctx->hwctx; - - frames_ctx->width = FFALIGN(s->coded_width, 32); - frames_ctx->height = FFALIGN(s->coded_height, 32); - frames_ctx->format = AV_PIX_FMT_QSV; - frames_ctx->sw_format = s->sw_pix_fmt; - frames_ctx->initial_pool_size = 64 + s->extra_hw_frames; - frames_hwctx->frame_type = MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET; - - ret = av_hwframe_ctx_init(ist->hw_frames_ctx); - if (ret < 0) { - av_log(NULL, AV_LOG_ERROR, "Error initializing a QSV frame pool\n"); - return ret; - } - - ist->hwaccel_get_buffer = qsv_get_buffer; - ist->hwaccel_uninit = qsv_uninit; - - return 0; -} diff --git a/chromium/third_party/ffmpeg/fftools/ffplay.c b/chromium/third_party/ffmpeg/fftools/ffplay.c index 6b19574eae8..46758b9f552 100644 --- a/chromium/third_party/ffmpeg/fftools/ffplay.c +++ b/chromium/third_party/ffmpeg/fftools/ffplay.c @@ -3695,8 +3695,6 @@ int main(int argc, char **argv) #endif avformat_network_init(); - init_opts(); - signal(SIGINT , sigterm_handler); /* Interrupt (ANSI). */ signal(SIGTERM, sigterm_handler); /* Termination (ANSI). */ diff --git a/chromium/third_party/ffmpeg/fftools/ffprobe.c b/chromium/third_party/ffmpeg/fftools/ffprobe.c index f411ba35b57..acfec096561 100644 --- a/chromium/third_party/ffmpeg/fftools/ffprobe.c +++ b/chromium/third_party/ffmpeg/fftools/ffprobe.c @@ -2032,7 +2032,7 @@ static void print_pkt_side_data(WriterContext *w, print_int("dv_bl_signal_compatibility_id", dovi->dv_bl_signal_compatibility_id); } else if (sd->type == AV_PKT_DATA_AUDIO_SERVICE_TYPE) { enum AVAudioServiceType *t = (enum AVAudioServiceType *)sd->data; - print_int("type", *t); + print_int("service_type", *t); } else if (sd->type == AV_PKT_DATA_MPEGTS_STREAM_ID) { print_int("id", *sd->data); } else if (sd->type == AV_PKT_DATA_CPB_PROPERTIES) { @@ -2248,8 +2248,8 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream, else print_str_opt("media_type", "unknown"); print_int("stream_index", stream->index); print_int("key_frame", frame->key_frame); - print_ts ("pkt_pts", frame->pts); - print_time("pkt_pts_time", frame->pts, &stream->time_base); + print_ts ("pts", frame->pts); + print_time("pts_time", frame->pts, &stream->time_base); print_ts ("pkt_dts", frame->pkt_dts); print_time("pkt_dts_time", frame->pkt_dts, &stream->time_base); print_ts ("best_effort_timestamp", frame->best_effort_timestamp); @@ -2656,6 +2656,7 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id print_int("coded_width", dec_ctx->coded_width); print_int("coded_height", dec_ctx->coded_height); print_int("closed_captions", !!(dec_ctx->properties & FF_CODEC_PROPERTY_CLOSED_CAPTIONS)); + print_int("film_grain", !!(dec_ctx->properties & FF_CODEC_PROPERTY_FILM_GRAIN)); } print_int("has_b_frames", par->video_delay); sar = av_guess_sample_aspect_ratio(fmt_ctx, stream, NULL); @@ -3721,7 +3722,6 @@ int main(int argc, char **argv) options = real_options; parse_loglevel(argc, argv, options); avformat_network_init(); - init_opts(); #if CONFIG_AVDEVICE avdevice_register_all(); #endif diff --git a/chromium/third_party/ffmpeg/libavcodec/Makefile b/chromium/third_party/ffmpeg/libavcodec/Makefile index be64c82c66c..11873eecae7 100644 --- a/chromium/third_party/ffmpeg/libavcodec/Makefile +++ b/chromium/third_party/ffmpeg/libavcodec/Makefile @@ -367,7 +367,7 @@ OBJS-$(CONFIG_H264_DECODER) += h264dec.o h264_cabac.o h264_cavlc.o \ h264_direct.o h264_loopfilter.o \ h264_mb.o h264_picture.o \ h264_refs.o h264_sei.o \ - h264_slice.o h264data.o + h264_slice.o h264data.o h274.o OBJS-$(CONFIG_H264_AMF_ENCODER) += amfenc_h264.o OBJS-$(CONFIG_H264_CUVID_DECODER) += cuviddec.o OBJS-$(CONFIG_H264_MEDIACODEC_DECODER) += mediacodecdec.o @@ -508,6 +508,7 @@ OBJS-$(CONFIG_MSMPEG4V2_DECODER) += msmpeg4dec.o msmpeg4.o msmpeg4data.o OBJS-$(CONFIG_MSMPEG4V2_ENCODER) += msmpeg4enc.o msmpeg4.o msmpeg4data.o OBJS-$(CONFIG_MSMPEG4V3_DECODER) += msmpeg4dec.o msmpeg4.o msmpeg4data.o OBJS-$(CONFIG_MSMPEG4V3_ENCODER) += msmpeg4enc.o msmpeg4.o msmpeg4data.o +OBJS-$(CONFIG_MSNSIREN_DECODER) += siren.o OBJS-$(CONFIG_MSP2_DECODER) += msp2dec.o OBJS-$(CONFIG_MSRLE_DECODER) += msrle.o msrledec.o OBJS-$(CONFIG_MSS1_DECODER) += mss1.o mss12.o @@ -621,6 +622,7 @@ OBJS-$(CONFIG_SIMBIOSIS_IMX_DECODER) += imx.o OBJS-$(CONFIG_SMACKAUD_DECODER) += smacker.o OBJS-$(CONFIG_SMACKER_DECODER) += smacker.o OBJS-$(CONFIG_SMC_DECODER) += smc.o +OBJS-$(CONFIG_SMC_ENCODER) += smcenc.o OBJS-$(CONFIG_SNOW_DECODER) += snowdec.o snow.o snow_dwt.o OBJS-$(CONFIG_SNOW_ENCODER) += snowenc.o snow.o snow_dwt.o \ h263.o h263data.o ituh263enc.o @@ -1181,7 +1183,6 @@ SLIBOBJS-$(HAVE_GNU_WINDRES) += avcodecres.o SKIPHEADERS += %_tablegen.h \ %_tables.h \ - fft-internal.h \ tableprint.h \ tableprint_vlc.h \ aaccoder_twoloop.h \ diff --git a/chromium/third_party/ffmpeg/libavcodec/aac_defines.h b/chromium/third_party/ffmpeg/libavcodec/aac_defines.h index e94475ac54d..a3c680b65cd 100644 --- a/chromium/third_party/ffmpeg/libavcodec/aac_defines.h +++ b/chromium/third_party/ffmpeg/libavcodec/aac_defines.h @@ -30,7 +30,6 @@ #include "libavutil/softfloat.h" #define FFT_FLOAT 0 -#define FFT_FIXED_32 1 #define AAC_RENAME(x) x ## _fixed #define AAC_RENAME_32(x) x ## _fixed_32 @@ -80,7 +79,6 @@ typedef int AAC_SIGNE; #else #define FFT_FLOAT 1 -#define FFT_FIXED_32 0 #define AAC_RENAME(x) x #define AAC_RENAME_32(x) x diff --git a/chromium/third_party/ffmpeg/libavcodec/aaccoder.c b/chromium/third_party/ffmpeg/libavcodec/aaccoder.c index baa82489b19..11b0559e1cd 100644 --- a/chromium/third_party/ffmpeg/libavcodec/aaccoder.c +++ b/chromium/third_party/ffmpeg/libavcodec/aaccoder.c @@ -843,25 +843,25 @@ static void search_for_ms(AACEncContext *s, ChannelElement *cpe) sce0->ics.swb_sizes[g], sce0->sf_idx[w*16+g], sce0->band_type[w*16+g], - lambda / band0->threshold, INFINITY, &b1, NULL, 0); + lambda / (band0->threshold + FLT_MIN), INFINITY, &b1, NULL, 0); dist1 += quantize_band_cost(s, &sce1->coeffs[start + (w+w2)*128], R34, sce1->ics.swb_sizes[g], sce1->sf_idx[w*16+g], sce1->band_type[w*16+g], - lambda / band1->threshold, INFINITY, &b2, NULL, 0); + lambda / (band1->threshold + FLT_MIN), INFINITY, &b2, NULL, 0); dist2 += quantize_band_cost(s, M, M34, sce0->ics.swb_sizes[g], mididx, midcb, - lambda / minthr, INFINITY, &b3, NULL, 0); + lambda / (minthr + FLT_MIN), INFINITY, &b3, NULL, 0); dist2 += quantize_band_cost(s, S, S34, sce1->ics.swb_sizes[g], sididx, sidcb, - mslambda / (minthr * bmax), INFINITY, &b4, NULL, 0); + mslambda / (minthr * bmax + FLT_MIN), INFINITY, &b4, NULL, 0); B0 += b1+b2; B1 += b3+b4; dist1 -= b1+b2; diff --git a/chromium/third_party/ffmpeg/libavcodec/aacdec.c b/chromium/third_party/ffmpeg/libavcodec/aacdec.c index 3ce5330c06f..4dfb38ac830 100644 --- a/chromium/third_party/ffmpeg/libavcodec/aacdec.c +++ b/chromium/third_party/ffmpeg/libavcodec/aacdec.c @@ -33,7 +33,6 @@ */ #define FFT_FLOAT 1 -#define FFT_FIXED_32 0 #define USE_FIXED 0 #include "libavutil/float_dsp.h" diff --git a/chromium/third_party/ffmpeg/libavcodec/aacdec_fixed.c b/chromium/third_party/ffmpeg/libavcodec/aacdec_fixed.c index 00257a54786..cad2fd6adcf 100644 --- a/chromium/third_party/ffmpeg/libavcodec/aacdec_fixed.c +++ b/chromium/third_party/ffmpeg/libavcodec/aacdec_fixed.c @@ -59,7 +59,6 @@ */ #define FFT_FLOAT 0 -#define FFT_FIXED_32 1 #define USE_FIXED 1 #include "libavutil/fixed_dsp.h" diff --git a/chromium/third_party/ffmpeg/libavcodec/aacps.c b/chromium/third_party/ffmpeg/libavcodec/aacps.c index 6c7a33fea89..655e8fe5b46 100644 --- a/chromium/third_party/ffmpeg/libavcodec/aacps.c +++ b/chromium/third_party/ffmpeg/libavcodec/aacps.c @@ -51,7 +51,8 @@ static void ipdopd_reset(int8_t *ipd_hist, int8_t *opd_hist) /** Split one subband into 2 subsubbands with a symmetric real filter. * The filter must have its non-center even coefficients equal to zero. */ -static void hybrid2_re(INTFLOAT (*in)[2], INTFLOAT (*out)[32][2], const INTFLOAT filter[8], int len, int reverse) +static void hybrid2_re(INTFLOAT (*in)[2], INTFLOAT (*out)[32][2], + const INTFLOAT filter[7], int len, int reverse) { int i, j; for (i = 0; i < len; i++, in++) { diff --git a/chromium/third_party/ffmpeg/libavcodec/aarch64/h264dsp_init_aarch64.c b/chromium/third_party/ffmpeg/libavcodec/aarch64/h264dsp_init_aarch64.c index d5baccf2355..6bf3ecb8a1e 100644 --- a/chromium/third_party/ffmpeg/libavcodec/aarch64/h264dsp_init_aarch64.c +++ b/chromium/third_party/ffmpeg/libavcodec/aarch64/h264dsp_init_aarch64.c @@ -69,19 +69,42 @@ void ff_h264_idct_add_neon(uint8_t *dst, int16_t *block, int stride); void ff_h264_idct_dc_add_neon(uint8_t *dst, int16_t *block, int stride); void ff_h264_idct_add16_neon(uint8_t *dst, const int *block_offset, int16_t *block, int stride, - const uint8_t nnzc[6*8]); + const uint8_t nnzc[5 * 8]); void ff_h264_idct_add16intra_neon(uint8_t *dst, const int *block_offset, int16_t *block, int stride, - const uint8_t nnzc[6*8]); + const uint8_t nnzc[5 * 8]); void ff_h264_idct_add8_neon(uint8_t **dest, const int *block_offset, int16_t *block, int stride, - const uint8_t nnzc[6*8]); + const uint8_t nnzc[15 * 8]); void ff_h264_idct8_add_neon(uint8_t *dst, int16_t *block, int stride); void ff_h264_idct8_dc_add_neon(uint8_t *dst, int16_t *block, int stride); void ff_h264_idct8_add4_neon(uint8_t *dst, const int *block_offset, int16_t *block, int stride, - const uint8_t nnzc[6*8]); + const uint8_t nnzc[5 * 8]); + +void ff_h264_v_loop_filter_luma_neon_10(uint8_t *pix, ptrdiff_t stride, int alpha, + int beta, int8_t *tc0); +void ff_h264_h_loop_filter_luma_neon_10(uint8_t *pix, ptrdiff_t stride, int alpha, + int beta, int8_t *tc0); +void ff_h264_v_loop_filter_luma_intra_neon_10(uint8_t *pix, ptrdiff_t stride, int alpha, + int beta); +void ff_h264_h_loop_filter_luma_intra_neon_10(uint8_t *pix, ptrdiff_t stride, int alpha, + int beta); +void ff_h264_v_loop_filter_chroma_neon_10(uint8_t *pix, ptrdiff_t stride, int alpha, + int beta, int8_t *tc0); +void ff_h264_h_loop_filter_chroma_neon_10(uint8_t *pix, ptrdiff_t stride, int alpha, + int beta, int8_t *tc0); +void ff_h264_h_loop_filter_chroma422_neon_10(uint8_t *pix, ptrdiff_t stride, int alpha, + int beta, int8_t *tc0); +void ff_h264_v_loop_filter_chroma_intra_neon_10(uint8_t *pix, ptrdiff_t stride, + int alpha, int beta); +void ff_h264_h_loop_filter_chroma_intra_neon_10(uint8_t *pix, ptrdiff_t stride, + int alpha, int beta); +void ff_h264_h_loop_filter_chroma422_intra_neon_10(uint8_t *pix, ptrdiff_t stride, + int alpha, int beta); +void ff_h264_h_loop_filter_chroma_mbaff_intra_neon_10(uint8_t *pix, ptrdiff_t stride, + int alpha, int beta); av_cold void ff_h264dsp_init_aarch64(H264DSPContext *c, const int bit_depth, const int chroma_format_idc) @@ -125,5 +148,19 @@ av_cold void ff_h264dsp_init_aarch64(H264DSPContext *c, const int bit_depth, c->h264_idct8_add = ff_h264_idct8_add_neon; c->h264_idct8_dc_add = ff_h264_idct8_dc_add_neon; c->h264_idct8_add4 = ff_h264_idct8_add4_neon; + } else if (have_neon(cpu_flags) && bit_depth == 10) { + c->h264_v_loop_filter_chroma = ff_h264_v_loop_filter_chroma_neon_10; + c->h264_v_loop_filter_chroma_intra = ff_h264_v_loop_filter_chroma_intra_neon_10; + + if (chroma_format_idc <= 1) { + c->h264_h_loop_filter_chroma = ff_h264_h_loop_filter_chroma_neon_10; + c->h264_h_loop_filter_chroma_intra = ff_h264_h_loop_filter_chroma_intra_neon_10; + c->h264_h_loop_filter_chroma_mbaff_intra = ff_h264_h_loop_filter_chroma_mbaff_intra_neon_10; + } else { + c->h264_h_loop_filter_chroma = ff_h264_h_loop_filter_chroma422_neon_10; + c->h264_h_loop_filter_chroma_mbaff = ff_h264_h_loop_filter_chroma_neon_10; + c->h264_h_loop_filter_chroma_intra = ff_h264_h_loop_filter_chroma422_intra_neon_10; + c->h264_h_loop_filter_chroma_mbaff_intra = ff_h264_h_loop_filter_chroma_intra_neon_10; + } } } diff --git a/chromium/third_party/ffmpeg/libavcodec/aarch64/h264dsp_neon.S b/chromium/third_party/ffmpeg/libavcodec/aarch64/h264dsp_neon.S index fbb8ecc463b..000ff762a3e 100644 --- a/chromium/third_party/ffmpeg/libavcodec/aarch64/h264dsp_neon.S +++ b/chromium/third_party/ffmpeg/libavcodec/aarch64/h264dsp_neon.S @@ -110,7 +110,6 @@ function ff_h264_v_loop_filter_luma_neon, export=1 h264_loop_filter_start - sxtw x1, w1 ld1 {v0.16B}, [x0], x1 ld1 {v2.16B}, [x0], x1 @@ -134,7 +133,6 @@ endfunc function ff_h264_h_loop_filter_luma_neon, export=1 h264_loop_filter_start - sxtw x1, w1 sub x0, x0, #4 ld1 {v6.8B}, [x0], x1 @@ -184,199 +182,198 @@ endfunc .macro h264_loop_filter_start_intra - orr w4, w2, w3 - cbnz w4, 1f - ret + orr w4, w2, w3 + cbnz w4, 1f + ret 1: - sxtw x1, w1 - dup v30.16b, w2 // alpha - dup v31.16b, w3 // beta + dup v30.16b, w2 // alpha + dup v31.16b, w3 // beta .endm .macro h264_loop_filter_luma_intra - uabd v16.16b, v7.16b, v0.16b // abs(p0 - q0) - uabd v17.16b, v6.16b, v7.16b // abs(p1 - p0) - uabd v18.16b, v1.16b, v0.16b // abs(q1 - q0) - cmhi v19.16b, v30.16b, v16.16b // < alpha - cmhi v17.16b, v31.16b, v17.16b // < beta - cmhi v18.16b, v31.16b, v18.16b // < beta - - movi v29.16b, #2 - ushr v30.16b, v30.16b, #2 // alpha >> 2 - add v30.16b, v30.16b, v29.16b // (alpha >> 2) + 2 - cmhi v16.16b, v30.16b, v16.16b // < (alpha >> 2) + 2 - - and v19.16b, v19.16b, v17.16b - and v19.16b, v19.16b, v18.16b - shrn v20.8b, v19.8h, #4 - mov x4, v20.d[0] - cbz x4, 9f - - ushll v20.8h, v6.8b, #1 - ushll v22.8h, v1.8b, #1 - ushll2 v21.8h, v6.16b, #1 - ushll2 v23.8h, v1.16b, #1 - uaddw v20.8h, v20.8h, v7.8b - uaddw v22.8h, v22.8h, v0.8b - uaddw2 v21.8h, v21.8h, v7.16b - uaddw2 v23.8h, v23.8h, v0.16b - uaddw v20.8h, v20.8h, v1.8b - uaddw v22.8h, v22.8h, v6.8b - uaddw2 v21.8h, v21.8h, v1.16b - uaddw2 v23.8h, v23.8h, v6.16b - - rshrn v24.8b, v20.8h, #2 // p0'_1 - rshrn v25.8b, v22.8h, #2 // q0'_1 - rshrn2 v24.16b, v21.8h, #2 // p0'_1 - rshrn2 v25.16b, v23.8h, #2 // q0'_1 - - uabd v17.16b, v5.16b, v7.16b // abs(p2 - p0) - uabd v18.16b, v2.16b, v0.16b // abs(q2 - q0) - cmhi v17.16b, v31.16b, v17.16b // < beta - cmhi v18.16b, v31.16b, v18.16b // < beta - - and v17.16b, v16.16b, v17.16b // if_2 && if_3 - and v18.16b, v16.16b, v18.16b // if_2 && if_4 - - not v30.16b, v17.16b - not v31.16b, v18.16b - - and v30.16b, v30.16b, v19.16b // if_1 && !(if_2 && if_3) - and v31.16b, v31.16b, v19.16b // if_1 && !(if_2 && if_4) - - and v17.16b, v19.16b, v17.16b // if_1 && if_2 && if_3 - and v18.16b, v19.16b, v18.16b // if_1 && if_2 && if_4 - - //calc p, v7, v6, v5, v4, v17, v7, v6, v5, v4 - uaddl v26.8h, v5.8b, v7.8b - uaddl2 v27.8h, v5.16b, v7.16b - uaddw v26.8h, v26.8h, v0.8b - uaddw2 v27.8h, v27.8h, v0.16b - add v20.8h, v20.8h, v26.8h - add v21.8h, v21.8h, v27.8h - uaddw v20.8h, v20.8h, v0.8b - uaddw2 v21.8h, v21.8h, v0.16b - rshrn v20.8b, v20.8h, #3 // p0'_2 - rshrn2 v20.16b, v21.8h, #3 // p0'_2 - uaddw v26.8h, v26.8h, v6.8b - uaddw2 v27.8h, v27.8h, v6.16b - rshrn v21.8b, v26.8h, #2 // p1'_2 - rshrn2 v21.16b, v27.8h, #2 // p1'_2 - uaddl v28.8h, v4.8b, v5.8b - uaddl2 v29.8h, v4.16b, v5.16b - shl v28.8h, v28.8h, #1 - shl v29.8h, v29.8h, #1 - add v28.8h, v28.8h, v26.8h - add v29.8h, v29.8h, v27.8h - rshrn v19.8b, v28.8h, #3 // p2'_2 - rshrn2 v19.16b, v29.8h, #3 // p2'_2 - - //calc q, v0, v1, v2, v3, v18, v0, v1, v2, v3 - uaddl v26.8h, v2.8b, v0.8b - uaddl2 v27.8h, v2.16b, v0.16b - uaddw v26.8h, v26.8h, v7.8b - uaddw2 v27.8h, v27.8h, v7.16b - add v22.8h, v22.8h, v26.8h - add v23.8h, v23.8h, v27.8h - uaddw v22.8h, v22.8h, v7.8b - uaddw2 v23.8h, v23.8h, v7.16b - rshrn v22.8b, v22.8h, #3 // q0'_2 - rshrn2 v22.16b, v23.8h, #3 // q0'_2 - uaddw v26.8h, v26.8h, v1.8b - uaddw2 v27.8h, v27.8h, v1.16b - rshrn v23.8b, v26.8h, #2 // q1'_2 - rshrn2 v23.16b, v27.8h, #2 // q1'_2 - uaddl v28.8h, v2.8b, v3.8b - uaddl2 v29.8h, v2.16b, v3.16b - shl v28.8h, v28.8h, #1 - shl v29.8h, v29.8h, #1 - add v28.8h, v28.8h, v26.8h - add v29.8h, v29.8h, v27.8h - rshrn v26.8b, v28.8h, #3 // q2'_2 - rshrn2 v26.16b, v29.8h, #3 // q2'_2 - - bit v7.16b, v24.16b, v30.16b // p0'_1 - bit v0.16b, v25.16b, v31.16b // q0'_1 - bit v7.16b, v20.16b, v17.16b // p0'_2 - bit v6.16b, v21.16b, v17.16b // p1'_2 - bit v5.16b, v19.16b, v17.16b // p2'_2 - bit v0.16b, v22.16b, v18.16b // q0'_2 - bit v1.16b, v23.16b, v18.16b // q1'_2 - bit v2.16b, v26.16b, v18.16b // q2'_2 + uabd v16.16b, v7.16b, v0.16b // abs(p0 - q0) + uabd v17.16b, v6.16b, v7.16b // abs(p1 - p0) + uabd v18.16b, v1.16b, v0.16b // abs(q1 - q0) + cmhi v19.16b, v30.16b, v16.16b // < alpha + cmhi v17.16b, v31.16b, v17.16b // < beta + cmhi v18.16b, v31.16b, v18.16b // < beta + + movi v29.16b, #2 + ushr v30.16b, v30.16b, #2 // alpha >> 2 + add v30.16b, v30.16b, v29.16b // (alpha >> 2) + 2 + cmhi v16.16b, v30.16b, v16.16b // < (alpha >> 2) + 2 + + and v19.16b, v19.16b, v17.16b + and v19.16b, v19.16b, v18.16b + shrn v20.8b, v19.8h, #4 + mov x4, v20.d[0] + cbz x4, 9f + + ushll v20.8h, v6.8b, #1 + ushll v22.8h, v1.8b, #1 + ushll2 v21.8h, v6.16b, #1 + ushll2 v23.8h, v1.16b, #1 + uaddw v20.8h, v20.8h, v7.8b + uaddw v22.8h, v22.8h, v0.8b + uaddw2 v21.8h, v21.8h, v7.16b + uaddw2 v23.8h, v23.8h, v0.16b + uaddw v20.8h, v20.8h, v1.8b + uaddw v22.8h, v22.8h, v6.8b + uaddw2 v21.8h, v21.8h, v1.16b + uaddw2 v23.8h, v23.8h, v6.16b + + rshrn v24.8b, v20.8h, #2 // p0'_1 + rshrn v25.8b, v22.8h, #2 // q0'_1 + rshrn2 v24.16b, v21.8h, #2 // p0'_1 + rshrn2 v25.16b, v23.8h, #2 // q0'_1 + + uabd v17.16b, v5.16b, v7.16b // abs(p2 - p0) + uabd v18.16b, v2.16b, v0.16b // abs(q2 - q0) + cmhi v17.16b, v31.16b, v17.16b // < beta + cmhi v18.16b, v31.16b, v18.16b // < beta + + and v17.16b, v16.16b, v17.16b // if_2 && if_3 + and v18.16b, v16.16b, v18.16b // if_2 && if_4 + + not v30.16b, v17.16b + not v31.16b, v18.16b + + and v30.16b, v30.16b, v19.16b // if_1 && !(if_2 && if_3) + and v31.16b, v31.16b, v19.16b // if_1 && !(if_2 && if_4) + + and v17.16b, v19.16b, v17.16b // if_1 && if_2 && if_3 + and v18.16b, v19.16b, v18.16b // if_1 && if_2 && if_4 + + //calc p, v7, v6, v5, v4, v17, v7, v6, v5, v4 + uaddl v26.8h, v5.8b, v7.8b + uaddl2 v27.8h, v5.16b, v7.16b + uaddw v26.8h, v26.8h, v0.8b + uaddw2 v27.8h, v27.8h, v0.16b + add v20.8h, v20.8h, v26.8h + add v21.8h, v21.8h, v27.8h + uaddw v20.8h, v20.8h, v0.8b + uaddw2 v21.8h, v21.8h, v0.16b + rshrn v20.8b, v20.8h, #3 // p0'_2 + rshrn2 v20.16b, v21.8h, #3 // p0'_2 + uaddw v26.8h, v26.8h, v6.8b + uaddw2 v27.8h, v27.8h, v6.16b + rshrn v21.8b, v26.8h, #2 // p1'_2 + rshrn2 v21.16b, v27.8h, #2 // p1'_2 + uaddl v28.8h, v4.8b, v5.8b + uaddl2 v29.8h, v4.16b, v5.16b + shl v28.8h, v28.8h, #1 + shl v29.8h, v29.8h, #1 + add v28.8h, v28.8h, v26.8h + add v29.8h, v29.8h, v27.8h + rshrn v19.8b, v28.8h, #3 // p2'_2 + rshrn2 v19.16b, v29.8h, #3 // p2'_2 + + //calc q, v0, v1, v2, v3, v18, v0, v1, v2, v3 + uaddl v26.8h, v2.8b, v0.8b + uaddl2 v27.8h, v2.16b, v0.16b + uaddw v26.8h, v26.8h, v7.8b + uaddw2 v27.8h, v27.8h, v7.16b + add v22.8h, v22.8h, v26.8h + add v23.8h, v23.8h, v27.8h + uaddw v22.8h, v22.8h, v7.8b + uaddw2 v23.8h, v23.8h, v7.16b + rshrn v22.8b, v22.8h, #3 // q0'_2 + rshrn2 v22.16b, v23.8h, #3 // q0'_2 + uaddw v26.8h, v26.8h, v1.8b + uaddw2 v27.8h, v27.8h, v1.16b + rshrn v23.8b, v26.8h, #2 // q1'_2 + rshrn2 v23.16b, v27.8h, #2 // q1'_2 + uaddl v28.8h, v2.8b, v3.8b + uaddl2 v29.8h, v2.16b, v3.16b + shl v28.8h, v28.8h, #1 + shl v29.8h, v29.8h, #1 + add v28.8h, v28.8h, v26.8h + add v29.8h, v29.8h, v27.8h + rshrn v26.8b, v28.8h, #3 // q2'_2 + rshrn2 v26.16b, v29.8h, #3 // q2'_2 + + bit v7.16b, v24.16b, v30.16b // p0'_1 + bit v0.16b, v25.16b, v31.16b // q0'_1 + bit v7.16b, v20.16b, v17.16b // p0'_2 + bit v6.16b, v21.16b, v17.16b // p1'_2 + bit v5.16b, v19.16b, v17.16b // p2'_2 + bit v0.16b, v22.16b, v18.16b // q0'_2 + bit v1.16b, v23.16b, v18.16b // q1'_2 + bit v2.16b, v26.16b, v18.16b // q2'_2 .endm function ff_h264_v_loop_filter_luma_intra_neon, export=1 - h264_loop_filter_start_intra - - ld1 {v0.16b}, [x0], x1 // q0 - ld1 {v1.16b}, [x0], x1 // q1 - ld1 {v2.16b}, [x0], x1 // q2 - ld1 {v3.16b}, [x0], x1 // q3 - sub x0, x0, x1, lsl #3 - ld1 {v4.16b}, [x0], x1 // p3 - ld1 {v5.16b}, [x0], x1 // p2 - ld1 {v6.16b}, [x0], x1 // p1 - ld1 {v7.16b}, [x0] // p0 - - h264_loop_filter_luma_intra - - sub x0, x0, x1, lsl #1 - st1 {v5.16b}, [x0], x1 // p2 - st1 {v6.16b}, [x0], x1 // p1 - st1 {v7.16b}, [x0], x1 // p0 - st1 {v0.16b}, [x0], x1 // q0 - st1 {v1.16b}, [x0], x1 // q1 - st1 {v2.16b}, [x0] // q2 + h264_loop_filter_start_intra + + ld1 {v0.16b}, [x0], x1 // q0 + ld1 {v1.16b}, [x0], x1 // q1 + ld1 {v2.16b}, [x0], x1 // q2 + ld1 {v3.16b}, [x0], x1 // q3 + sub x0, x0, x1, lsl #3 + ld1 {v4.16b}, [x0], x1 // p3 + ld1 {v5.16b}, [x0], x1 // p2 + ld1 {v6.16b}, [x0], x1 // p1 + ld1 {v7.16b}, [x0] // p0 + + h264_loop_filter_luma_intra + + sub x0, x0, x1, lsl #1 + st1 {v5.16b}, [x0], x1 // p2 + st1 {v6.16b}, [x0], x1 // p1 + st1 {v7.16b}, [x0], x1 // p0 + st1 {v0.16b}, [x0], x1 // q0 + st1 {v1.16b}, [x0], x1 // q1 + st1 {v2.16b}, [x0] // q2 9: - ret + ret endfunc function ff_h264_h_loop_filter_luma_intra_neon, export=1 - h264_loop_filter_start_intra - - sub x0, x0, #4 - ld1 {v4.8b}, [x0], x1 - ld1 {v5.8b}, [x0], x1 - ld1 {v6.8b}, [x0], x1 - ld1 {v7.8b}, [x0], x1 - ld1 {v0.8b}, [x0], x1 - ld1 {v1.8b}, [x0], x1 - ld1 {v2.8b}, [x0], x1 - ld1 {v3.8b}, [x0], x1 - ld1 {v4.d}[1], [x0], x1 - ld1 {v5.d}[1], [x0], x1 - ld1 {v6.d}[1], [x0], x1 - ld1 {v7.d}[1], [x0], x1 - ld1 {v0.d}[1], [x0], x1 - ld1 {v1.d}[1], [x0], x1 - ld1 {v2.d}[1], [x0], x1 - ld1 {v3.d}[1], [x0], x1 - - transpose_8x16B v4, v5, v6, v7, v0, v1, v2, v3, v21, v23 - - h264_loop_filter_luma_intra - - transpose_8x16B v4, v5, v6, v7, v0, v1, v2, v3, v21, v23 - - sub x0, x0, x1, lsl #4 - st1 {v4.8b}, [x0], x1 - st1 {v5.8b}, [x0], x1 - st1 {v6.8b}, [x0], x1 - st1 {v7.8b}, [x0], x1 - st1 {v0.8b}, [x0], x1 - st1 {v1.8b}, [x0], x1 - st1 {v2.8b}, [x0], x1 - st1 {v3.8b}, [x0], x1 - st1 {v4.d}[1], [x0], x1 - st1 {v5.d}[1], [x0], x1 - st1 {v6.d}[1], [x0], x1 - st1 {v7.d}[1], [x0], x1 - st1 {v0.d}[1], [x0], x1 - st1 {v1.d}[1], [x0], x1 - st1 {v2.d}[1], [x0], x1 - st1 {v3.d}[1], [x0], x1 + h264_loop_filter_start_intra + + sub x0, x0, #4 + ld1 {v4.8b}, [x0], x1 + ld1 {v5.8b}, [x0], x1 + ld1 {v6.8b}, [x0], x1 + ld1 {v7.8b}, [x0], x1 + ld1 {v0.8b}, [x0], x1 + ld1 {v1.8b}, [x0], x1 + ld1 {v2.8b}, [x0], x1 + ld1 {v3.8b}, [x0], x1 + ld1 {v4.d}[1], [x0], x1 + ld1 {v5.d}[1], [x0], x1 + ld1 {v6.d}[1], [x0], x1 + ld1 {v7.d}[1], [x0], x1 + ld1 {v0.d}[1], [x0], x1 + ld1 {v1.d}[1], [x0], x1 + ld1 {v2.d}[1], [x0], x1 + ld1 {v3.d}[1], [x0], x1 + + transpose_8x16B v4, v5, v6, v7, v0, v1, v2, v3, v21, v23 + + h264_loop_filter_luma_intra + + transpose_8x16B v4, v5, v6, v7, v0, v1, v2, v3, v21, v23 + + sub x0, x0, x1, lsl #4 + st1 {v4.8b}, [x0], x1 + st1 {v5.8b}, [x0], x1 + st1 {v6.8b}, [x0], x1 + st1 {v7.8b}, [x0], x1 + st1 {v0.8b}, [x0], x1 + st1 {v1.8b}, [x0], x1 + st1 {v2.8b}, [x0], x1 + st1 {v3.8b}, [x0], x1 + st1 {v4.d}[1], [x0], x1 + st1 {v5.d}[1], [x0], x1 + st1 {v6.d}[1], [x0], x1 + st1 {v7.d}[1], [x0], x1 + st1 {v0.d}[1], [x0], x1 + st1 {v1.d}[1], [x0], x1 + st1 {v2.d}[1], [x0], x1 + st1 {v3.d}[1], [x0], x1 9: - ret + ret endfunc .macro h264_loop_filter_chroma @@ -414,7 +411,6 @@ endfunc function ff_h264_v_loop_filter_chroma_neon, export=1 h264_loop_filter_start - sxtw x1, w1 sub x0, x0, x1, lsl #1 ld1 {v18.8B}, [x0], x1 @@ -433,7 +429,6 @@ endfunc function ff_h264_h_loop_filter_chroma_neon, export=1 h264_loop_filter_start - sxtw x1, w1 sub x0, x0, #2 h_loop_filter_chroma420: @@ -466,7 +461,6 @@ h_loop_filter_chroma420: endfunc function ff_h264_h_loop_filter_chroma422_neon, export=1 - sxtw x1, w1 h264_loop_filter_start add x5, x0, x1 sub x0, x0, #2 @@ -480,113 +474,113 @@ function ff_h264_h_loop_filter_chroma422_neon, export=1 endfunc .macro h264_loop_filter_chroma_intra - uabd v26.8b, v16.8b, v17.8b // abs(p0 - q0) - uabd v27.8b, v18.8b, v16.8b // abs(p1 - p0) - uabd v28.8b, v19.8b, v17.8b // abs(q1 - q0) - cmhi v26.8b, v30.8b, v26.8b // < alpha - cmhi v27.8b, v31.8b, v27.8b // < beta - cmhi v28.8b, v31.8b, v28.8b // < beta - and v26.8b, v26.8b, v27.8b - and v26.8b, v26.8b, v28.8b - mov x2, v26.d[0] - - ushll v4.8h, v18.8b, #1 - ushll v6.8h, v19.8b, #1 - cbz x2, 9f - uaddl v20.8h, v16.8b, v19.8b - uaddl v22.8h, v17.8b, v18.8b - add v20.8h, v20.8h, v4.8h - add v22.8h, v22.8h, v6.8h - uqrshrn v24.8b, v20.8h, #2 - uqrshrn v25.8b, v22.8h, #2 - bit v16.8b, v24.8b, v26.8b - bit v17.8b, v25.8b, v26.8b + uabd v26.8b, v16.8b, v17.8b // abs(p0 - q0) + uabd v27.8b, v18.8b, v16.8b // abs(p1 - p0) + uabd v28.8b, v19.8b, v17.8b // abs(q1 - q0) + cmhi v26.8b, v30.8b, v26.8b // < alpha + cmhi v27.8b, v31.8b, v27.8b // < beta + cmhi v28.8b, v31.8b, v28.8b // < beta + and v26.8b, v26.8b, v27.8b + and v26.8b, v26.8b, v28.8b + mov x2, v26.d[0] + + ushll v4.8h, v18.8b, #1 + ushll v6.8h, v19.8b, #1 + cbz x2, 9f + uaddl v20.8h, v16.8b, v19.8b + uaddl v22.8h, v17.8b, v18.8b + add v20.8h, v20.8h, v4.8h + add v22.8h, v22.8h, v6.8h + uqrshrn v24.8b, v20.8h, #2 + uqrshrn v25.8b, v22.8h, #2 + bit v16.8b, v24.8b, v26.8b + bit v17.8b, v25.8b, v26.8b .endm function ff_h264_v_loop_filter_chroma_intra_neon, export=1 - h264_loop_filter_start_intra + h264_loop_filter_start_intra - sub x0, x0, x1, lsl #1 - ld1 {v18.8b}, [x0], x1 - ld1 {v16.8b}, [x0], x1 - ld1 {v17.8b}, [x0], x1 - ld1 {v19.8b}, [x0] + sub x0, x0, x1, lsl #1 + ld1 {v18.8b}, [x0], x1 + ld1 {v16.8b}, [x0], x1 + ld1 {v17.8b}, [x0], x1 + ld1 {v19.8b}, [x0] - h264_loop_filter_chroma_intra + h264_loop_filter_chroma_intra - sub x0, x0, x1, lsl #1 - st1 {v16.8b}, [x0], x1 - st1 {v17.8b}, [x0], x1 + sub x0, x0, x1, lsl #1 + st1 {v16.8b}, [x0], x1 + st1 {v17.8b}, [x0], x1 9: - ret + ret endfunc function ff_h264_h_loop_filter_chroma_mbaff_intra_neon, export=1 - h264_loop_filter_start_intra + h264_loop_filter_start_intra - sub x4, x0, #2 - sub x0, x0, #1 - ld1 {v18.8b}, [x4], x1 - ld1 {v16.8b}, [x4], x1 - ld1 {v17.8b}, [x4], x1 - ld1 {v19.8b}, [x4], x1 + sub x4, x0, #2 + sub x0, x0, #1 + ld1 {v18.8b}, [x4], x1 + ld1 {v16.8b}, [x4], x1 + ld1 {v17.8b}, [x4], x1 + ld1 {v19.8b}, [x4], x1 - transpose_4x8B v18, v16, v17, v19, v26, v27, v28, v29 + transpose_4x8B v18, v16, v17, v19, v26, v27, v28, v29 - h264_loop_filter_chroma_intra + h264_loop_filter_chroma_intra - st2 {v16.b,v17.b}[0], [x0], x1 - st2 {v16.b,v17.b}[1], [x0], x1 - st2 {v16.b,v17.b}[2], [x0], x1 - st2 {v16.b,v17.b}[3], [x0], x1 + st2 {v16.b,v17.b}[0], [x0], x1 + st2 {v16.b,v17.b}[1], [x0], x1 + st2 {v16.b,v17.b}[2], [x0], x1 + st2 {v16.b,v17.b}[3], [x0], x1 9: - ret + ret endfunc function ff_h264_h_loop_filter_chroma_intra_neon, export=1 - h264_loop_filter_start_intra + h264_loop_filter_start_intra - sub x4, x0, #2 - sub x0, x0, #1 + sub x4, x0, #2 + sub x0, x0, #1 h_loop_filter_chroma420_intra: - ld1 {v18.8b}, [x4], x1 - ld1 {v16.8b}, [x4], x1 - ld1 {v17.8b}, [x4], x1 - ld1 {v19.8b}, [x4], x1 - ld1 {v18.s}[1], [x4], x1 - ld1 {v16.s}[1], [x4], x1 - ld1 {v17.s}[1], [x4], x1 - ld1 {v19.s}[1], [x4], x1 - - transpose_4x8B v18, v16, v17, v19, v26, v27, v28, v29 - - h264_loop_filter_chroma_intra - - st2 {v16.b,v17.b}[0], [x0], x1 - st2 {v16.b,v17.b}[1], [x0], x1 - st2 {v16.b,v17.b}[2], [x0], x1 - st2 {v16.b,v17.b}[3], [x0], x1 - st2 {v16.b,v17.b}[4], [x0], x1 - st2 {v16.b,v17.b}[5], [x0], x1 - st2 {v16.b,v17.b}[6], [x0], x1 - st2 {v16.b,v17.b}[7], [x0], x1 + ld1 {v18.8b}, [x4], x1 + ld1 {v16.8b}, [x4], x1 + ld1 {v17.8b}, [x4], x1 + ld1 {v19.8b}, [x4], x1 + ld1 {v18.s}[1], [x4], x1 + ld1 {v16.s}[1], [x4], x1 + ld1 {v17.s}[1], [x4], x1 + ld1 {v19.s}[1], [x4], x1 + + transpose_4x8B v18, v16, v17, v19, v26, v27, v28, v29 + + h264_loop_filter_chroma_intra + + st2 {v16.b,v17.b}[0], [x0], x1 + st2 {v16.b,v17.b}[1], [x0], x1 + st2 {v16.b,v17.b}[2], [x0], x1 + st2 {v16.b,v17.b}[3], [x0], x1 + st2 {v16.b,v17.b}[4], [x0], x1 + st2 {v16.b,v17.b}[5], [x0], x1 + st2 {v16.b,v17.b}[6], [x0], x1 + st2 {v16.b,v17.b}[7], [x0], x1 9: - ret + ret endfunc function ff_h264_h_loop_filter_chroma422_intra_neon, export=1 - h264_loop_filter_start_intra - sub x4, x0, #2 - add x5, x0, x1, lsl #3 - sub x0, x0, #1 - mov x7, x30 - bl h_loop_filter_chroma420_intra - sub x0, x5, #1 - mov x30, x7 - b h_loop_filter_chroma420_intra + h264_loop_filter_start_intra + sub x4, x0, #2 + add x5, x0, x1, lsl #3 + sub x0, x0, #1 + mov x7, x30 + bl h_loop_filter_chroma420_intra + sub x0, x5, #1 + mov x30, x7 + b h_loop_filter_chroma420_intra endfunc .macro biweight_16 macs, macd @@ -691,7 +685,6 @@ endfunc .macro biweight_func w function ff_biweight_h264_pixels_\w\()_neon, export=1 - sxtw x2, w2 lsr w8, w5, #31 add w7, w7, #1 eor w8, w8, w6, lsr #30 @@ -800,7 +793,6 @@ endfunc .macro weight_func w function ff_weight_h264_pixels_\w\()_neon, export=1 - sxtw x1, w1 cmp w3, #1 mov w6, #1 lsl w5, w5, w3 @@ -827,3 +819,258 @@ endfunc weight_func 16 weight_func 8 weight_func 4 + +.macro h264_loop_filter_start_10 + cmp w2, #0 + ldr w6, [x4] + ccmp w3, #0, #0, ne + lsl w2, w2, #2 + mov v24.S[0], w6 + lsl w3, w3, #2 + and w8, w6, w6, lsl #16 + b.eq 1f + ands w8, w8, w8, lsl #8 + b.ge 2f +1: + ret +2: +.endm + +.macro h264_loop_filter_start_intra_10 + orr w4, w2, w3 + cbnz w4, 1f + ret +1: + lsl w2, w2, #2 + lsl w3, w3, #2 + dup v30.8h, w2 // alpha + dup v31.8h, w3 // beta +.endm + +.macro h264_loop_filter_chroma_10 + dup v22.8h, w2 // alpha + dup v23.8h, w3 // beta + uxtl v24.8h, v24.8b // tc0 + + uabd v26.8h, v16.8h, v0.8h // abs(p0 - q0) + uabd v28.8h, v18.8h, v16.8h // abs(p1 - p0) + uabd v30.8h, v2.8h, v0.8h // abs(q1 - q0) + cmhi v26.8h, v22.8h, v26.8h // < alpha + cmhi v28.8h, v23.8h, v28.8h // < beta + cmhi v30.8h, v23.8h, v30.8h // < beta + + and v26.16b, v26.16b, v28.16b + mov v4.16b, v0.16b + sub v4.8h, v4.8h, v16.8h + and v26.16b, v26.16b, v30.16b + shl v4.8h, v4.8h, #2 + mov x8, v26.d[0] + mov x9, v26.d[1] + sli v24.8h, v24.8h, #8 + uxtl v24.8h, v24.8b + add v4.8h, v4.8h, v18.8h + adds x8, x8, x9 + shl v24.8h, v24.8h, #2 + + b.eq 9f + + movi v31.8h, #3 // (tc0 - 1) << (BIT_DEPTH - 8)) + 1 + uqsub v24.8h, v24.8h, v31.8h + sub v4.8h, v4.8h, v2.8h + srshr v4.8h, v4.8h, #3 + smin v4.8h, v4.8h, v24.8h + neg v25.8h, v24.8h + smax v4.8h, v4.8h, v25.8h + and v4.16b, v4.16b, v26.16b + add v16.8h, v16.8h, v4.8h + sub v0.8h, v0.8h, v4.8h + + mvni v4.8h, #0xFC, lsl #8 // 1023 for clipping + movi v5.8h, #0 + smin v0.8h, v0.8h, v4.8h + smin v16.8h, v16.8h, v4.8h + smax v0.8h, v0.8h, v5.8h + smax v16.8h, v16.8h, v5.8h +.endm + +function ff_h264_v_loop_filter_chroma_neon_10, export=1 + h264_loop_filter_start_10 + + mov x10, x0 + sub x0, x0, x1, lsl #1 + ld1 {v18.8h}, [x0 ], x1 + ld1 {v0.8h}, [x10], x1 + ld1 {v16.8h}, [x0 ], x1 + ld1 {v2.8h}, [x10] + + h264_loop_filter_chroma_10 + + sub x0, x10, x1, lsl #1 + st1 {v16.8h}, [x0], x1 + st1 {v0.8h}, [x0], x1 +9: + ret +endfunc + +function ff_h264_h_loop_filter_chroma_neon_10, export=1 + h264_loop_filter_start_10 + + sub x0, x0, #4 // access the 2nd left pixel +h_loop_filter_chroma420_10: + add x10, x0, x1, lsl #2 + ld1 {v18.d}[0], [x0 ], x1 + ld1 {v18.d}[1], [x10], x1 + ld1 {v16.d}[0], [x0 ], x1 + ld1 {v16.d}[1], [x10], x1 + ld1 {v0.d}[0], [x0 ], x1 + ld1 {v0.d}[1], [x10], x1 + ld1 {v2.d}[0], [x0 ], x1 + ld1 {v2.d}[1], [x10], x1 + + transpose_4x8H v18, v16, v0, v2, v28, v29, v30, v31 + + h264_loop_filter_chroma_10 + + transpose_4x8H v18, v16, v0, v2, v28, v29, v30, v31 + + sub x0, x10, x1, lsl #3 + st1 {v18.d}[0], [x0], x1 + st1 {v16.d}[0], [x0], x1 + st1 {v0.d}[0], [x0], x1 + st1 {v2.d}[0], [x0], x1 + st1 {v18.d}[1], [x0], x1 + st1 {v16.d}[1], [x0], x1 + st1 {v0.d}[1], [x0], x1 + st1 {v2.d}[1], [x0], x1 +9: + ret +endfunc + +function ff_h264_h_loop_filter_chroma422_neon_10, export=1 + h264_loop_filter_start_10 + add x5, x0, x1 + sub x0, x0, #4 + add x1, x1, x1 + mov x7, x30 + bl h_loop_filter_chroma420_10 + mov x30, x7 + sub x0, x5, #4 + mov v24.s[0], w6 + b h_loop_filter_chroma420_10 +endfunc + +.macro h264_loop_filter_chroma_intra_10 + uabd v26.8h, v16.8h, v17.8h // abs(p0 - q0) + uabd v27.8h, v18.8h, v16.8h // abs(p1 - p0) + uabd v28.8h, v19.8h, v17.8h // abs(q1 - q0) + cmhi v26.8h, v30.8h, v26.8h // < alpha + cmhi v27.8h, v31.8h, v27.8h // < beta + cmhi v28.8h, v31.8h, v28.8h // < beta + and v26.16b, v26.16b, v27.16b + and v26.16b, v26.16b, v28.16b + mov x2, v26.d[0] + mov x3, v26.d[1] + + shl v4.8h, v18.8h, #1 + shl v6.8h, v19.8h, #1 + + adds x2, x2, x3 + b.eq 9f + + add v20.8h, v16.8h, v19.8h + add v22.8h, v17.8h, v18.8h + add v20.8h, v20.8h, v4.8h + add v22.8h, v22.8h, v6.8h + urshr v24.8h, v20.8h, #2 + urshr v25.8h, v22.8h, #2 + bit v16.16b, v24.16b, v26.16b + bit v17.16b, v25.16b, v26.16b +.endm + +function ff_h264_v_loop_filter_chroma_intra_neon_10, export=1 + h264_loop_filter_start_intra_10 + mov x9, x0 + sub x0, x0, x1, lsl #1 + ld1 {v18.8h}, [x0], x1 + ld1 {v17.8h}, [x9], x1 + ld1 {v16.8h}, [x0], x1 + ld1 {v19.8h}, [x9] + + h264_loop_filter_chroma_intra_10 + + sub x0, x9, x1, lsl #1 + st1 {v16.8h}, [x0], x1 + st1 {v17.8h}, [x0], x1 + +9: + ret +endfunc + +function ff_h264_h_loop_filter_chroma_mbaff_intra_neon_10, export=1 + h264_loop_filter_start_intra_10 + + sub x4, x0, #4 + sub x0, x0, #2 + add x9, x4, x1, lsl #1 + ld1 {v18.8h}, [x4], x1 + ld1 {v17.8h}, [x9], x1 + ld1 {v16.8h}, [x4], x1 + ld1 {v19.8h}, [x9], x1 + + transpose_4x8H v18, v16, v17, v19, v26, v27, v28, v29 + + h264_loop_filter_chroma_intra_10 + + st2 {v16.h,v17.h}[0], [x0], x1 + st2 {v16.h,v17.h}[1], [x0], x1 + st2 {v16.h,v17.h}[2], [x0], x1 + st2 {v16.h,v17.h}[3], [x0], x1 + +9: + ret +endfunc + +function ff_h264_h_loop_filter_chroma_intra_neon_10, export=1 + h264_loop_filter_start_intra_10 + sub x4, x0, #4 + sub x0, x0, #2 +h_loop_filter_chroma420_intra_10: + add x9, x4, x1, lsl #2 + ld1 {v18.4h}, [x4], x1 + ld1 {v18.d}[1], [x9], x1 + ld1 {v16.4h}, [x4], x1 + ld1 {v16.d}[1], [x9], x1 + ld1 {v17.4h}, [x4], x1 + ld1 {v17.d}[1], [x9], x1 + ld1 {v19.4h}, [x4], x1 + ld1 {v19.d}[1], [x9], x1 + + transpose_4x8H v18, v16, v17, v19, v26, v27, v28, v29 + + h264_loop_filter_chroma_intra_10 + + st2 {v16.h,v17.h}[0], [x0], x1 + st2 {v16.h,v17.h}[1], [x0], x1 + st2 {v16.h,v17.h}[2], [x0], x1 + st2 {v16.h,v17.h}[3], [x0], x1 + st2 {v16.h,v17.h}[4], [x0], x1 + st2 {v16.h,v17.h}[5], [x0], x1 + st2 {v16.h,v17.h}[6], [x0], x1 + st2 {v16.h,v17.h}[7], [x0], x1 + +9: + ret +endfunc + +function ff_h264_h_loop_filter_chroma422_intra_neon_10, export=1 + h264_loop_filter_start_intra_10 + sub x4, x0, #4 + add x5, x0, x1, lsl #3 + sub x0, x0, #2 + mov x7, x30 + bl h_loop_filter_chroma420_intra_10 + mov x4, x9 + sub x0, x5, #2 + mov x30, x7 + b h_loop_filter_chroma420_intra_10 +endfunc diff --git a/chromium/third_party/ffmpeg/libavcodec/aarch64/h264pred_init.c b/chromium/third_party/ffmpeg/libavcodec/aarch64/h264pred_init.c index 325a86bfcde..0ae8f70d239 100644 --- a/chromium/third_party/ffmpeg/libavcodec/aarch64/h264pred_init.c +++ b/chromium/third_party/ffmpeg/libavcodec/aarch64/h264pred_init.c @@ -45,10 +45,23 @@ void ff_pred8x8_0lt_dc_neon(uint8_t *src, ptrdiff_t stride); void ff_pred8x8_l00_dc_neon(uint8_t *src, ptrdiff_t stride); void ff_pred8x8_0l0_dc_neon(uint8_t *src, ptrdiff_t stride); -void ff_pred16x16_top_dc_neon_10(uint8_t *src, ptrdiff_t stride); -void ff_pred16x16_dc_neon_10(uint8_t *src, ptrdiff_t stride); -void ff_pred16x16_hor_neon_10(uint8_t *src, ptrdiff_t stride); void ff_pred16x16_vert_neon_10(uint8_t *src, ptrdiff_t stride); +void ff_pred16x16_hor_neon_10(uint8_t *src, ptrdiff_t stride); +void ff_pred16x16_plane_neon_10(uint8_t *src, ptrdiff_t stride); +void ff_pred16x16_dc_neon_10(uint8_t *src, ptrdiff_t stride); +void ff_pred16x16_top_dc_neon_10(uint8_t *src, ptrdiff_t stride); + +void ff_pred8x8_vert_neon_10(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_hor_neon_10(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_plane_neon_10(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_dc_neon_10(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_128_dc_neon_10(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_left_dc_neon_10(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_top_dc_neon_10(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_l0t_dc_neon_10(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_0lt_dc_neon_10(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_l00_dc_neon_10(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_0l0_dc_neon_10(uint8_t *src, ptrdiff_t stride); static av_cold void h264_pred_init_neon(H264PredContext *h, int codec_id, const int bit_depth, @@ -84,10 +97,31 @@ static av_cold void h264_pred_init_neon(H264PredContext *h, int codec_id, h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_neon; } if (bit_depth == 10) { + if (chroma_format_idc <= 1) { + h->pred8x8[VERT_PRED8x8 ] = ff_pred8x8_vert_neon_10; + h->pred8x8[HOR_PRED8x8 ] = ff_pred8x8_hor_neon_10; + if (codec_id != AV_CODEC_ID_VP7 && codec_id != AV_CODEC_ID_VP8) + h->pred8x8[PLANE_PRED8x8] = ff_pred8x8_plane_neon_10; + h->pred8x8[DC_128_PRED8x8 ] = ff_pred8x8_128_dc_neon_10; + if (codec_id != AV_CODEC_ID_RV40 && codec_id != AV_CODEC_ID_VP7 && + codec_id != AV_CODEC_ID_VP8) { + h->pred8x8[DC_PRED8x8 ] = ff_pred8x8_dc_neon_10; + h->pred8x8[LEFT_DC_PRED8x8] = ff_pred8x8_left_dc_neon_10; + h->pred8x8[TOP_DC_PRED8x8 ] = ff_pred8x8_top_dc_neon_10; + h->pred8x8[ALZHEIMER_DC_L0T_PRED8x8] = ff_pred8x8_l0t_dc_neon_10; + h->pred8x8[ALZHEIMER_DC_0LT_PRED8x8] = ff_pred8x8_0lt_dc_neon_10; + h->pred8x8[ALZHEIMER_DC_L00_PRED8x8] = ff_pred8x8_l00_dc_neon_10; + h->pred8x8[ALZHEIMER_DC_0L0_PRED8x8] = ff_pred8x8_0l0_dc_neon_10; + } + } + h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_neon_10; h->pred16x16[VERT_PRED8x8 ] = ff_pred16x16_vert_neon_10; h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_hor_neon_10; h->pred16x16[TOP_DC_PRED8x8 ] = ff_pred16x16_top_dc_neon_10; + if (codec_id != AV_CODEC_ID_SVQ3 && codec_id != AV_CODEC_ID_RV40 && + codec_id != AV_CODEC_ID_VP7 && codec_id != AV_CODEC_ID_VP8) + h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_neon_10; } } diff --git a/chromium/third_party/ffmpeg/libavcodec/aarch64/h264pred_neon.S b/chromium/third_party/ffmpeg/libavcodec/aarch64/h264pred_neon.S index e40bdc8d53e..ea37689f34c 100644 --- a/chromium/third_party/ffmpeg/libavcodec/aarch64/h264pred_neon.S +++ b/chromium/third_party/ffmpeg/libavcodec/aarch64/h264pred_neon.S @@ -361,15 +361,13 @@ function ff_pred8x8_0l0_dc_neon, export=1 endfunc .macro ldcol.16 rd, rs, rt, n=4, hi=0 -.if \n >= 4 || \hi == 0 +.if \n >= 4 && \hi == 0 ld1 {\rd\().h}[0], [\rs], \rt ld1 {\rd\().h}[1], [\rs], \rt -.endif -.if \n >= 4 || \hi == 1 ld1 {\rd\().h}[2], [\rs], \rt ld1 {\rd\().h}[3], [\rs], \rt .endif -.if \n == 8 +.if \n == 8 || \hi == 1 ld1 {\rd\().h}[4], [\rs], \rt ld1 {\rd\().h}[5], [\rs], \rt ld1 {\rd\().h}[6], [\rs], \rt @@ -467,3 +465,301 @@ function ff_pred16x16_vert_neon_10, export=1 b.ne 1b ret endfunc + +function ff_pred16x16_plane_neon_10, export=1 + sub x3, x0, x1 + movrel x4, p16weight + add x2, x3, #16 + sub x3, x3, #2 + ld1 {v0.8h}, [x3] + ld1 {v2.8h}, [x2], x1 + ldcol.16 v1, x3, x1, 8 + add x3, x3, x1 + ldcol.16 v3, x3, x1, 8 + + rev64 v16.8h, v0.8h + rev64 v17.8h, v1.8h + ext v0.16b, v16.16b, v16.16b, #8 + ext v1.16b, v17.16b, v17.16b, #8 + + add v7.8h, v2.8h, v3.8h + sub v2.8h, v2.8h, v0.8h + sub v3.8h, v3.8h, v1.8h + ld1 {v0.8h}, [x4] + mul v2.8h, v2.8h, v0.8h + mul v3.8h, v3.8h, v0.8h + addp v2.8h, v2.8h, v3.8h + addp v2.8h, v2.8h, v2.8h + addp v2.4h, v2.4h, v2.4h + sshll v3.4s, v2.4h, #2 + saddw v2.4s, v3.4s, v2.4h + rshrn v4.4h, v2.4s, #6 + trn2 v5.4h, v4.4h, v4.4h + add v2.4h, v4.4h, v5.4h + shl v3.4h, v2.4h, #3 + ext v7.16b, v7.16b, v7.16b, #14 + sub v3.4h, v3.4h, v2.4h // 7 * (b + c) + add v7.4h, v7.4h, v0.4h + shl v2.4h, v7.4h, #4 + ssubl v2.4s, v2.4h, v3.4h + shl v3.4h, v4.4h, #4 + ext v0.16b, v0.16b, v0.16b, #14 + ssubl v6.4s, v5.4h, v3.4h + + mov v0.h[0], wzr + mul v0.8h, v0.8h, v4.h[0] + dup v16.4s, v2.s[0] + dup v17.4s, v2.s[0] + dup v2.8h, v4.h[0] + dup v3.4s, v6.s[0] + shl v2.8h, v2.8h, #3 + saddw v16.4s, v16.4s, v0.4h + saddw2 v17.4s, v17.4s, v0.8h + saddw v3.4s, v3.4s, v2.4h + + mov w3, #16 + mvni v4.8h, #0xFC, lsl #8 // 1023 for clipping +1: + sqshrun v0.4h, v16.4s, #5 + sqshrun2 v0.8h, v17.4s, #5 + saddw v16.4s, v16.4s, v2.4h + saddw v17.4s, v17.4s, v2.4h + sqshrun v1.4h, v16.4s, #5 + sqshrun2 v1.8h, v17.4s, #5 + add v16.4s, v16.4s, v3.4s + add v17.4s, v17.4s, v3.4s + + subs w3, w3, #1 + + smin v0.8h, v0.8h, v4.8h + smin v1.8h, v1.8h, v4.8h + + st1 {v0.8h, v1.8h}, [x0], x1 + b.ne 1b + ret +endfunc + +function ff_pred8x8_hor_neon_10, export=1 + sub x2, x0, #2 + mov w3, #8 + +1: ld1r {v0.8h}, [x2], x1 + subs w3, w3, #1 + st1 {v0.8h}, [x0], x1 + b.ne 1b + ret +endfunc + +function ff_pred8x8_vert_neon_10, export=1 + sub x2, x0, x1 + lsl x1, x1, #1 + + ld1 {v0.8h}, [x2], x1 + mov w3, #4 +1: subs w3, w3, #1 + st1 {v0.8h}, [x0], x1 + st1 {v0.8h}, [x2], x1 + b.ne 1b + ret +endfunc + +function ff_pred8x8_plane_neon_10, export=1 + sub x3, x0, x1 + movrel x4, p8weight + movrel x5, p16weight + add x2, x3, #8 + sub x3, x3, #2 + ld1 {v0.d}[0], [x3] + ld1 {v2.d}[0], [x2], x1 + ldcol.16 v0, x3, x1, hi=1 + add x3, x3, x1 + ldcol.16 v3, x3, x1, 4 + add v7.8h, v2.8h, v3.8h + rev64 v0.8h, v0.8h + trn1 v2.2d, v2.2d, v3.2d + sub v2.8h, v2.8h, v0.8h + ld1 {v6.8h}, [x4] + mul v2.8h, v2.8h, v6.8h + ld1 {v0.8h}, [x5] + saddlp v2.4s, v2.8h + addp v2.4s, v2.4s, v2.4s + shl v3.4s, v2.4s, #4 + add v2.4s, v3.4s, v2.4s + rshrn v5.4h, v2.4s, #5 + addp v2.4h, v5.4h, v5.4h + shl v3.4h, v2.4h, #1 + add v3.4h, v3.4h, v2.4h + rev64 v7.4h, v7.4h + add v7.4h, v7.4h, v0.4h + shl v2.4h, v7.4h, #4 + ssubl v2.4s, v2.4h, v3.4h + ext v0.16b, v0.16b, v0.16b, #14 + mov v0.h[0], wzr + mul v0.8h, v0.8h, v5.h[0] + dup v1.4s, v2.s[0] + dup v2.4s, v2.s[0] + dup v3.8h, v5.h[1] + saddw v1.4s, v1.4s, v0.4h + saddw2 v2.4s, v2.4s, v0.8h + mov w3, #8 + mvni v4.8h, #0xFC, lsl #8 // 1023 for clipping +1: + sqshrun v0.4h, v1.4s, #5 + sqshrun2 v0.8h, v2.4s, #5 + + saddw v1.4s, v1.4s, v3.4h + saddw v2.4s, v2.4s, v3.4h + + subs w3, w3, #1 + + smin v0.8h, v0.8h, v4.8h + + st1 {v0.8h}, [x0], x1 + b.ne 1b + ret +endfunc + +function ff_pred8x8_128_dc_neon_10, export=1 + movi v0.8h, #2, lsl #8 // 512, 1 << (bit_depth - 1) + movi v1.8h, #2, lsl #8 + b .L_pred8x8_dc_10_end +endfunc + +function ff_pred8x8_top_dc_neon_10, export=1 + sub x2, x0, x1 + ld1 {v0.8h}, [x2] + + addp v0.8h, v0.8h, v0.8h + addp v0.4h, v0.4h, v0.4h + zip1 v0.4h, v0.4h, v0.4h + urshr v2.4h, v0.4h, #2 + zip1 v0.8h, v2.8h, v2.8h + zip1 v1.8h, v2.8h, v2.8h + b .L_pred8x8_dc_10_end +endfunc + +function ff_pred8x8_left_dc_neon_10, export=1 + sub x2, x0, #2 + ldcol.16 v0, x2, x1, 8 + + addp v0.8h, v0.8h, v0.8h + addp v0.4h, v0.4h, v0.4h + urshr v2.4h, v0.4h, #2 + dup v1.8h, v2.h[1] + dup v0.8h, v2.h[0] + b .L_pred8x8_dc_10_end +endfunc + +function ff_pred8x8_dc_neon_10, export=1 + sub x2, x0, x1 + sub x3, x0, #2 + + ld1 {v0.8h}, [x2] + ldcol.16 v1, x3, x1, 8 + + addp v0.8h, v0.8h, v0.8h + addp v1.8h, v1.8h, v1.8h + trn1 v2.2s, v0.2s, v1.2s + trn2 v3.2s, v0.2s, v1.2s + addp v4.4h, v2.4h, v3.4h + addp v5.4h, v4.4h, v4.4h + urshr v6.4h, v5.4h, #3 + urshr v7.4h, v4.4h, #2 + dup v0.8h, v6.h[0] + dup v2.8h, v7.h[2] + dup v1.8h, v7.h[3] + dup v3.8h, v6.h[1] + zip1 v0.2d, v0.2d, v2.2d + zip1 v1.2d, v1.2d, v3.2d +.L_pred8x8_dc_10_end: + mov w3, #4 + add x2, x0, x1, lsl #2 + +6: st1 {v0.8h}, [x0], x1 + subs w3, w3, #1 + st1 {v1.8h}, [x2], x1 + b.ne 6b + ret +endfunc + +function ff_pred8x8_l0t_dc_neon_10, export=1 + sub x2, x0, x1 + sub x3, x0, #2 + + ld1 {v0.8h}, [x2] + ldcol.16 v1, x3, x1, 4 + + addp v0.8h, v0.8h, v0.8h + addp v1.4h, v1.4h, v1.4h + addp v0.4h, v0.4h, v0.4h + addp v1.4h, v1.4h, v1.4h + add v1.4h, v1.4h, v0.4h + + urshr v2.4h, v0.4h, #2 + urshr v3.4h, v1.4h, #3 // the pred4x4 part + + dup v4.4h, v3.h[0] + dup v5.4h, v2.h[0] + dup v6.4h, v2.h[1] + + zip1 v0.2d, v4.2d, v6.2d + zip1 v1.2d, v5.2d, v6.2d + b .L_pred8x8_dc_10_end +endfunc + +function ff_pred8x8_l00_dc_neon_10, export=1 + sub x2, x0, #2 + + ldcol.16 v0, x2, x1, 4 + + addp v0.4h, v0.4h, v0.4h + addp v0.4h, v0.4h, v0.4h + urshr v0.4h, v0.4h, #2 + + movi v1.8h, #2, lsl #8 // 512 + dup v0.8h, v0.h[0] + b .L_pred8x8_dc_10_end +endfunc + +function ff_pred8x8_0lt_dc_neon_10, export=1 + add x3, x0, x1, lsl #2 + sub x2, x0, x1 + sub x3, x3, #2 + + ld1 {v0.8h}, [x2] + ldcol.16 v1, x3, x1, hi=1 + + addp v0.8h, v0.8h, v0.8h + addp v1.8h, v1.8h, v1.8h + addp v0.4h, v0.4h, v0.4h + addp v1.4h, v1.4h, v1.4h + zip1 v0.2s, v0.2s, v1.2s + add v1.4h, v0.4h, v1.4h + + urshr v2.4h, v0.4h, #2 + urshr v3.4h, v1.4h, #3 + + dup v4.4h, v2.h[0] + dup v5.4h, v2.h[3] + dup v6.4h, v2.h[1] + dup v7.4h, v3.h[1] + + zip1 v0.2d, v4.2d, v6.2d + zip1 v1.2d, v5.2d, v7.2d + b .L_pred8x8_dc_10_end +endfunc + +function ff_pred8x8_0l0_dc_neon_10, export=1 + add x2, x0, x1, lsl #2 + sub x2, x2, #2 + + ldcol.16 v1, x2, x1, 4 + + addp v2.8h, v1.8h, v1.8h + addp v2.4h, v2.4h, v2.4h + urshr v1.4h, v2.4h, #2 + + movi v0.8h, #2, lsl #8 // 512 + dup v1.8h, v1.h[0] + b .L_pred8x8_dc_10_end +endfunc diff --git a/chromium/third_party/ffmpeg/libavcodec/aarch64/neon.S b/chromium/third_party/ffmpeg/libavcodec/aarch64/neon.S index 0fddbecae30..1ad32c359d4 100644 --- a/chromium/third_party/ffmpeg/libavcodec/aarch64/neon.S +++ b/chromium/third_party/ffmpeg/libavcodec/aarch64/neon.S @@ -109,12 +109,25 @@ trn2 \r5\().4H, \r0\().4H, \r1\().4H trn1 \r6\().4H, \r2\().4H, \r3\().4H trn2 \r7\().4H, \r2\().4H, \r3\().4H + trn1 \r0\().2S, \r4\().2S, \r6\().2S trn2 \r2\().2S, \r4\().2S, \r6\().2S trn1 \r1\().2S, \r5\().2S, \r7\().2S trn2 \r3\().2S, \r5\().2S, \r7\().2S .endm +.macro transpose_4x8H r0, r1, r2, r3, t4, t5, t6, t7 + trn1 \t4\().8H, \r0\().8H, \r1\().8H + trn2 \t5\().8H, \r0\().8H, \r1\().8H + trn1 \t6\().8H, \r2\().8H, \r3\().8H + trn2 \t7\().8H, \r2\().8H, \r3\().8H + + trn1 \r0\().4S, \t4\().4S, \t6\().4S + trn2 \r2\().4S, \t4\().4S, \t6\().4S + trn1 \r1\().4S, \t5\().4S, \t7\().4S + trn2 \r3\().4S, \t5\().4S, \t7\().4S +.endm + .macro transpose_8x8H r0, r1, r2, r3, r4, r5, r6, r7, r8, r9 trn1 \r8\().8H, \r0\().8H, \r1\().8H trn2 \r9\().8H, \r0\().8H, \r1\().8H diff --git a/chromium/third_party/ffmpeg/libavcodec/aarch64/vp9lpf_16bpp_neon.S b/chromium/third_party/ffmpeg/libavcodec/aarch64/vp9lpf_16bpp_neon.S index 9075f3d4061..9869614a295 100644 --- a/chromium/third_party/ffmpeg/libavcodec/aarch64/vp9lpf_16bpp_neon.S +++ b/chromium/third_party/ffmpeg/libavcodec/aarch64/vp9lpf_16bpp_neon.S @@ -22,18 +22,6 @@ #include "neon.S" -.macro transpose_4x8H r0, r1, r2, r3, t4, t5, t6, t7 - trn1 \t4\().8h, \r0\().8h, \r1\().8h - trn2 \t5\().8h, \r0\().8h, \r1\().8h - trn1 \t6\().8h, \r2\().8h, \r3\().8h - trn2 \t7\().8h, \r2\().8h, \r3\().8h - - trn1 \r0\().4s, \t4\().4s, \t6\().4s - trn2 \r2\().4s, \t4\().4s, \t6\().4s - trn1 \r1\().4s, \t5\().4s, \t7\().4s - trn2 \r3\().4s, \t5\().4s, \t7\().4s -.endm - // The input to and output from this macro is in the registers v16-v31, // and v0-v7 are used as scratch registers. // p7 = v16 .. p3 = v20, p0 = v23, q0 = v24, q3 = v27, q7 = v31 diff --git a/chromium/third_party/ffmpeg/libavcodec/ac3dec_fixed.c b/chromium/third_party/ffmpeg/libavcodec/ac3dec_fixed.c index f6c2810ce55..86459526217 100644 --- a/chromium/third_party/ffmpeg/libavcodec/ac3dec_fixed.c +++ b/chromium/third_party/ffmpeg/libavcodec/ac3dec_fixed.c @@ -49,7 +49,6 @@ #define FFT_FLOAT 0 #define USE_FIXED 1 -#define FFT_FIXED_32 1 #include "ac3dec.h" diff --git a/chromium/third_party/ffmpeg/libavcodec/ac3enc_fixed.c b/chromium/third_party/ffmpeg/libavcodec/ac3enc_fixed.c index c7632d78e10..80aa98c6917 100644 --- a/chromium/third_party/ffmpeg/libavcodec/ac3enc_fixed.c +++ b/chromium/third_party/ffmpeg/libavcodec/ac3enc_fixed.c @@ -28,7 +28,6 @@ #define AC3ENC_FLOAT 0 #define FFT_FLOAT 0 -#define FFT_FIXED_32 1 #include "internal.h" #include "audiodsp.h" #include "ac3enc.h" diff --git a/chromium/third_party/ffmpeg/libavcodec/acelp_vectors.c b/chromium/third_party/ffmpeg/libavcodec/acelp_vectors.c index 0d4de0e4c33..8adea683c1f 100644 --- a/chromium/third_party/ffmpeg/libavcodec/acelp_vectors.c +++ b/chromium/third_party/ffmpeg/libavcodec/acelp_vectors.c @@ -229,13 +229,14 @@ void ff_set_fixed_vector(float *out, const AMRFixed *in, float scale, int size) int x = in->x[i], repeats = !((in->no_repeat_mask >> i) & 1); float y = in->y[i] * scale; - if (in->pitch_lag > 0) + if (in->pitch_lag > 0) { av_assert0(x < size); do { out[x] += y; y *= in->pitch_fac; x += in->pitch_lag; } while (x < size && repeats); + } } } diff --git a/chromium/third_party/ffmpeg/libavcodec/allcodecs.c b/chromium/third_party/ffmpeg/libavcodec/allcodecs.c index 71bc21aa05b..c42aba140d0 100644 --- a/chromium/third_party/ffmpeg/libavcodec/allcodecs.c +++ b/chromium/third_party/ffmpeg/libavcodec/allcodecs.c @@ -299,6 +299,7 @@ extern const AVCodec ff_sgirle_decoder; extern const AVCodec ff_sheervideo_decoder; extern const AVCodec ff_simbiosis_imx_decoder; extern const AVCodec ff_smacker_decoder; +extern const AVCodec ff_smc_encoder; extern const AVCodec ff_smc_decoder; extern const AVCodec ff_smvjpeg_decoder; extern const AVCodec ff_snow_encoder; @@ -478,6 +479,7 @@ extern const AVCodec ff_mp3on4float_decoder; extern const AVCodec ff_mp3on4_decoder; extern const AVCodec ff_mpc7_decoder; extern const AVCodec ff_mpc8_decoder; +extern const AVCodec ff_msnsiren_decoder; extern const AVCodec ff_nellymoser_encoder; extern const AVCodec ff_nellymoser_decoder; extern const AVCodec ff_on2avc_decoder; diff --git a/chromium/third_party/ffmpeg/libavcodec/apedec.c b/chromium/third_party/ffmpeg/libavcodec/apedec.c index 022a6f9398c..bf481ba3549 100644 --- a/chromium/third_party/ffmpeg/libavcodec/apedec.c +++ b/chromium/third_party/ffmpeg/libavcodec/apedec.c @@ -909,8 +909,8 @@ static av_always_inline int filter_3800(APEPredictor *p, return predictionA; } d2 = p->buf[delayA]; - d1 = (p->buf[delayA] - p->buf[delayA - 1]) * 2U; - d0 = p->buf[delayA] + ((p->buf[delayA - 2] - p->buf[delayA - 1]) * 8U); + d1 = (p->buf[delayA] - (unsigned)p->buf[delayA - 1]) * 2; + d0 = p->buf[delayA] + ((p->buf[delayA - 2] - (unsigned)p->buf[delayA - 1]) * 8); d3 = p->buf[delayB] * 2U - p->buf[delayB - 1]; d4 = p->buf[delayB]; diff --git a/chromium/third_party/ffmpeg/libavcodec/argo.c b/chromium/third_party/ffmpeg/libavcodec/argo.c index bbdb6ae15f5..66f3d964802 100644 --- a/chromium/third_party/ffmpeg/libavcodec/argo.c +++ b/chromium/third_party/ffmpeg/libavcodec/argo.c @@ -58,7 +58,7 @@ static int decode_pal8(AVCodecContext *avctx, uint32_t *pal) return AVERROR_INVALIDDATA; for (int i = 0; i < count; i++) - pal[start + i] = (0xFF << 24U) | bytestream2_get_be24u(gb); + pal[start + i] = (0xFFU << 24) | bytestream2_get_be24u(gb); return 0; } @@ -684,6 +684,11 @@ static av_cold int decode_init(AVCodecContext *avctx) return AVERROR_PATCHWELCOME; } + if (avctx->width % 2 || avctx->height % 2) { + avpriv_request_sample(s, "Odd dimensions\n"); + return AVERROR_PATCHWELCOME; + } + s->frame = av_frame_alloc(); if (!s->frame) return AVERROR(ENOMEM); diff --git a/chromium/third_party/ffmpeg/libavcodec/arm/h264dsp_init_arm.c b/chromium/third_party/ffmpeg/libavcodec/arm/h264dsp_init_arm.c index 54e1e38c937..13d499fda2f 100644 --- a/chromium/third_party/ffmpeg/libavcodec/arm/h264dsp_init_arm.c +++ b/chromium/third_party/ffmpeg/libavcodec/arm/h264dsp_init_arm.c @@ -57,19 +57,19 @@ void ff_h264_idct_add_neon(uint8_t *dst, int16_t *block, int stride); void ff_h264_idct_dc_add_neon(uint8_t *dst, int16_t *block, int stride); void ff_h264_idct_add16_neon(uint8_t *dst, const int *block_offset, int16_t *block, int stride, - const uint8_t nnzc[6*8]); + const uint8_t nnzc[5 * 8]); void ff_h264_idct_add16intra_neon(uint8_t *dst, const int *block_offset, int16_t *block, int stride, - const uint8_t nnzc[6*8]); + const uint8_t nnzc[5 * 8]); void ff_h264_idct_add8_neon(uint8_t **dest, const int *block_offset, int16_t *block, int stride, - const uint8_t nnzc[6*8]); + const uint8_t nnzc[15 * 8]); void ff_h264_idct8_add_neon(uint8_t *dst, int16_t *block, int stride); void ff_h264_idct8_dc_add_neon(uint8_t *dst, int16_t *block, int stride); void ff_h264_idct8_add4_neon(uint8_t *dst, const int *block_offset, int16_t *block, int stride, - const uint8_t nnzc[6*8]); + const uint8_t nnzc[5 * 8]); static av_cold void h264dsp_init_neon(H264DSPContext *c, const int bit_depth, const int chroma_format_idc) diff --git a/chromium/third_party/ffmpeg/libavcodec/arm/hevcdsp_qpel_neon.S b/chromium/third_party/ffmpeg/libavcodec/arm/hevcdsp_qpel_neon.S index caa6efa7664..f71bec05eda 100644 --- a/chromium/third_party/ffmpeg/libavcodec/arm/hevcdsp_qpel_neon.S +++ b/chromium/third_party/ffmpeg/libavcodec/arm/hevcdsp_qpel_neon.S @@ -237,7 +237,7 @@ vld1.8 {d23}, [r2], r3 bne 8b subs r5, #8 - beq 99f + ble 99f mov r4, r12 add r6, #16 mov r0, r6 @@ -280,7 +280,7 @@ vld1.8 {d23}, [r2], r3 bne 8b subs r5, #8 - beq 99f + ble 99f mov r4, r12 add r6, #8 mov r0, r6 @@ -310,7 +310,7 @@ vld1.8 {d23}, [r2], r3 bne 8b subs r5, #8 - beq 99f + ble 99f mov r4, r12 add r6, #8 mov r0, r6 @@ -377,7 +377,7 @@ endfunc vst1.16 {q7}, [r0], r1 bne 8b subs r5, #8 - beq 99f + ble 99f mov r4, r12 add r6, #16 mov r0, r6 @@ -417,7 +417,7 @@ endfunc vst1.8 d0, [r0], r1 bne 8b subs r5, #8 - beq 99f + ble 99f mov r4, r12 add r6, #8 mov r0, r6 @@ -446,7 +446,7 @@ endfunc vst1.8 d0, [r0], r1 bne 8b subs r5, #8 - beq 99f + ble 99f mov r4, r12 add r6, #8 add r10, #16 @@ -533,7 +533,7 @@ endfunc \filterh q7 bne 8b subs r5, #8 - beq 99f + ble 99f mov r4, r12 add r6, #16 mov r0, r6 @@ -594,7 +594,7 @@ endfunc \filterh q7 bne 8b subs r5, #8 - beq 99f + ble 99f mov r4, r12 add r6, #8 mov r0, r6 @@ -641,7 +641,7 @@ endfunc \filterh q7 bne 8b subs r5, #8 - beq 99f + ble 99f mov r4, r12 add r6, #8 mov r0, r6 diff --git a/chromium/third_party/ffmpeg/libavcodec/ass_split.c b/chromium/third_party/ffmpeg/libavcodec/ass_split.c index 85cadcb7a97..05c5453e53c 100644 --- a/chromium/third_party/ffmpeg/libavcodec/ass_split.c +++ b/chromium/third_party/ffmpeg/libavcodec/ass_split.c @@ -412,25 +412,6 @@ static void free_section(ASSSplitContext *ctx, const ASSSection *section) av_freep((uint8_t *)&ctx->ass + section->offset); } -ASSDialog *ff_ass_split_dialog(ASSSplitContext *ctx, const char *buf, - int cache, int *number) -{ - ASSDialog *dialog = NULL; - int i, count; - if (!cache) - for (i=0; i<FF_ARRAY_ELEMS(ass_sections); i++) - if (!strcmp(ass_sections[i].section, "Events")) { - free_section(ctx, &ass_sections[i]); - break; - } - count = ctx->ass.dialogs_count; - if (ass_split(ctx, buf) == 0) - dialog = ctx->ass.dialogs + count; - if (number) - *number = ctx->ass.dialogs_count - count; - return dialog; -} - void ff_ass_free_dialog(ASSDialog **dialogp) { ASSDialog *dialog = *dialogp; @@ -443,7 +424,7 @@ void ff_ass_free_dialog(ASSDialog **dialogp) av_freep(dialogp); } -ASSDialog *ff_ass_split_dialog2(ASSSplitContext *ctx, const char *buf) +ASSDialog *ff_ass_split_dialog(ASSSplitContext *ctx, const char *buf) { int i; static const ASSFields fields[] = { diff --git a/chromium/third_party/ffmpeg/libavcodec/ass_split.h b/chromium/third_party/ffmpeg/libavcodec/ass_split.h index 30ce77250cd..a45fb9b8a11 100644 --- a/chromium/third_party/ffmpeg/libavcodec/ass_split.h +++ b/chromium/third_party/ffmpeg/libavcodec/ass_split.h @@ -110,23 +110,7 @@ typedef struct ASSSplitContext ASSSplitContext; ASSSplitContext *ff_ass_split(const char *buf); /** - * Split one or several ASS "Dialogue" lines from a string buffer and store - * them in an already initialized context. - * - * @param ctx Context previously initialized by ff_ass_split(). - * @param buf String containing the ASS "Dialogue" lines. - * @param cache Set to 1 to keep all the previously split ASSDialog in - * the context, or set to 0 to free all the previously split - * ASSDialog. - * @param number If not NULL, the pointed integer will be set to the number - * of split ASSDialog. - * @return Pointer to the first split ASSDialog. - */ -ASSDialog *ff_ass_split_dialog(ASSSplitContext *ctx, const char *buf, - int cache, int *number); - -/** - * Free a dialogue obtained from ff_ass_split_dialog2(). + * Free a dialogue obtained from ff_ass_split_dialog(). */ void ff_ass_free_dialog(ASSDialog **dialogp); @@ -137,7 +121,7 @@ void ff_ass_free_dialog(ASSDialog **dialogp); * @param buf String containing the ASS "Dialogue" line. * @return Pointer to the split ASSDialog. Must be freed with ff_ass_free_dialog() */ -ASSDialog *ff_ass_split_dialog2(ASSSplitContext *ctx, const char *buf); +ASSDialog *ff_ass_split_dialog(ASSSplitContext *ctx, const char *buf); /** * Free all the memory allocated for an ASSSplitContext. diff --git a/chromium/third_party/ffmpeg/libavformat/autorename_libavformat_pcm.c b/chromium/third_party/ffmpeg/libavcodec/autorename_libavcodec_pcm.c index 1b334e77ab8..1b334e77ab8 100644 --- a/chromium/third_party/ffmpeg/libavformat/autorename_libavformat_pcm.c +++ b/chromium/third_party/ffmpeg/libavcodec/autorename_libavcodec_pcm.c diff --git a/chromium/third_party/ffmpeg/libavcodec/av1_frame_merge_bsf.c b/chromium/third_party/ffmpeg/libavcodec/av1_frame_merge_bsf.c index fce5bdb67e7..19b9cd01a81 100644 --- a/chromium/third_party/ffmpeg/libavcodec/av1_frame_merge_bsf.c +++ b/chromium/third_party/ffmpeg/libavcodec/av1_frame_merge_bsf.c @@ -103,10 +103,15 @@ eof: err = AVERROR(EAGAIN); } - // Buffer packets with timestamps. There should be at most one per TU, be it split or not. - if (!buffer_pkt->data && in->pts != AV_NOPTS_VALUE) + /* Buffer packets with timestamps (there should be at most one per TU) + * or any packet if buffer_pkt is empty. The latter is needed to + * passthrough positions in case there are no timestamps like with + * the raw OBU demuxer. */ + if (!buffer_pkt->data || + in->pts != AV_NOPTS_VALUE && buffer_pkt->pts == AV_NOPTS_VALUE) { + av_packet_unref(buffer_pkt); av_packet_move_ref(buffer_pkt, in); - else + } else av_packet_unref(in); ff_cbs_fragment_reset(&ctx->frag[ctx->idx]); diff --git a/chromium/third_party/ffmpeg/libavcodec/av1dec.c b/chromium/third_party/ffmpeg/libavcodec/av1dec.c index 1dda0f91601..a69808f7b67 100644 --- a/chromium/third_party/ffmpeg/libavcodec/av1dec.c +++ b/chromium/third_party/ffmpeg/libavcodec/av1dec.c @@ -575,6 +575,11 @@ static int set_context_with_sequence(AVCodecContext *avctx, break; } + if (seq->film_grain_params_present) + avctx->properties |= FF_CODEC_PROPERTY_FILM_GRAIN; + else + avctx->properties &= ~FF_CODEC_PROPERTY_FILM_GRAIN; + if (avctx->width != width || avctx->height != height) { int ret = ff_set_dimensions(avctx, width, height); if (ret < 0) diff --git a/chromium/third_party/ffmpeg/libavcodec/avcodec.c b/chromium/third_party/ffmpeg/libavcodec/avcodec.c index 6d60026c074..2dd7dd84e05 100644 --- a/chromium/third_party/ffmpeg/libavcodec/avcodec.c +++ b/chromium/third_party/ffmpeg/libavcodec/avcodec.c @@ -658,6 +658,8 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) } else { if (enc->properties & FF_CODEC_PROPERTY_CLOSED_CAPTIONS) av_bprintf(&bprint, ", Closed Captions"); + if (enc->properties & FF_CODEC_PROPERTY_FILM_GRAIN) + av_bprintf(&bprint, ", Film Grain"); if (enc->properties & FF_CODEC_PROPERTY_LOSSLESS) av_bprintf(&bprint, ", lossless"); } diff --git a/chromium/third_party/ffmpeg/libavcodec/avcodec.h b/chromium/third_party/ffmpeg/libavcodec/avcodec.h index 5e32c5b0bf5..ffd58c333f3 100644 --- a/chromium/third_party/ffmpeg/libavcodec/avcodec.h +++ b/chromium/third_party/ffmpeg/libavcodec/avcodec.h @@ -1818,6 +1818,7 @@ typedef struct AVCodecContext { unsigned properties; #define FF_CODEC_PROPERTY_LOSSLESS 0x00000001 #define FF_CODEC_PROPERTY_CLOSED_CAPTIONS 0x00000002 +#define FF_CODEC_PROPERTY_FILM_GRAIN 0x00000004 /** * Additional data associated with the entire coded stream. @@ -2926,7 +2927,7 @@ typedef struct AVCodecParserContext { } AVCodecParserContext; typedef struct AVCodecParser { - int codec_ids[5]; /* several codec IDs are permitted */ + int codec_ids[7]; /* several codec IDs are permitted */ int priv_data_size; int (*parser_init)(AVCodecParserContext *s); /* This callback never returns an error, a negative value means that diff --git a/chromium/third_party/ffmpeg/libavcodec/avpacket.c b/chromium/third_party/ffmpeg/libavcodec/avpacket.c index 800bee3489a..d8d8fef3b9e 100644 --- a/chromium/third_party/ffmpeg/libavcodec/avpacket.c +++ b/chromium/third_party/ffmpeg/libavcodec/avpacket.c @@ -26,6 +26,7 @@ #include "libavutil/internal.h" #include "libavutil/mathematics.h" #include "libavutil/mem.h" +#include "libavutil/rational.h" #include "bytestream.h" #include "internal.h" @@ -44,6 +45,9 @@ void av_init_packet(AVPacket *pkt) pkt->buf = NULL; pkt->side_data = NULL; pkt->side_data_elems = 0; + pkt->opaque = NULL; + pkt->opaque_ref = NULL; + pkt->time_base = av_make_q(0, 1); } #endif @@ -54,6 +58,7 @@ static void get_packet_defaults(AVPacket *pkt) pkt->pts = AV_NOPTS_VALUE; pkt->dts = AV_NOPTS_VALUE; pkt->pos = -1; + pkt->time_base = av_make_q(0, 1); } AVPacket *av_packet_alloc(void) @@ -374,7 +379,7 @@ int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type, int av_packet_copy_props(AVPacket *dst, const AVPacket *src) { - int i; + int i, ret; dst->pts = src->pts; dst->dts = src->dts; @@ -382,9 +387,16 @@ int av_packet_copy_props(AVPacket *dst, const AVPacket *src) dst->duration = src->duration; dst->flags = src->flags; dst->stream_index = src->stream_index; - + dst->opaque = src->opaque; + dst->time_base = src->time_base; + dst->opaque_ref = NULL; dst->side_data = NULL; dst->side_data_elems = 0; + + ret = av_buffer_replace(&dst->opaque_ref, src->opaque_ref); + if (ret < 0) + return ret; + for (i = 0; i < src->side_data_elems; i++) { enum AVPacketSideDataType type = src->side_data[i].type; size_t size = src->side_data[i].size; @@ -392,6 +404,7 @@ int av_packet_copy_props(AVPacket *dst, const AVPacket *src) uint8_t *dst_data = av_packet_new_side_data(dst, type, size); if (!dst_data) { + av_buffer_unref(&dst->opaque_ref); av_packet_free_side_data(dst); return AVERROR(ENOMEM); } @@ -404,6 +417,7 @@ int av_packet_copy_props(AVPacket *dst, const AVPacket *src) void av_packet_unref(AVPacket *pkt) { av_packet_free_side_data(pkt); + av_buffer_unref(&pkt->opaque_ref); av_buffer_unref(&pkt->buf); get_packet_defaults(pkt); } diff --git a/chromium/third_party/ffmpeg/libavcodec/bsf.c b/chromium/third_party/ffmpeg/libavcodec/bsf.c index 0305244f8d7..d9c8395260d 100644 --- a/chromium/third_party/ffmpeg/libavcodec/bsf.c +++ b/chromium/third_party/ffmpeg/libavcodec/bsf.c @@ -32,29 +32,35 @@ #define IS_EMPTY(pkt) (!(pkt)->data && !(pkt)->side_data_elems) -struct AVBSFInternal { +typedef struct FFBSFContext { + AVBSFContext pub; AVPacket *buffer_pkt; int eof; -}; +} FFBSFContext; + +static av_always_inline FFBSFContext *ffbsfcontext(AVBSFContext *ctx) +{ + return (FFBSFContext *)ctx; +} void av_bsf_free(AVBSFContext **pctx) { AVBSFContext *ctx; + FFBSFContext *bsfi; if (!pctx || !*pctx) return; - ctx = *pctx; + ctx = *pctx; + bsfi = ffbsfcontext(ctx); - if (ctx->internal) { + if (ctx->priv_data) { if (ctx->filter->close) ctx->filter->close(ctx); - av_packet_free(&ctx->internal->buffer_pkt); - av_freep(&ctx->internal); + if (ctx->filter->priv_class) + av_opt_free(ctx->priv_data); + av_freep(&ctx->priv_data); } - if (ctx->filter->priv_class && ctx->priv_data) - av_opt_free(ctx->priv_data); - - av_freep(&ctx->priv_data); + av_packet_free(&bsfi->buffer_pkt); avcodec_parameters_free(&ctx->par_in); avcodec_parameters_free(&ctx->par_out); @@ -92,12 +98,13 @@ const AVClass *av_bsf_get_class(void) int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **pctx) { AVBSFContext *ctx; - AVBSFInternal *bsfi; + FFBSFContext *bsfi; int ret; - ctx = av_mallocz(sizeof(*ctx)); - if (!ctx) + bsfi = av_mallocz(sizeof(*bsfi)); + if (!bsfi) return AVERROR(ENOMEM); + ctx = &bsfi->pub; ctx->av_class = &bsf_class; ctx->filter = filter; @@ -120,15 +127,6 @@ int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **pctx) av_opt_set_defaults(ctx->priv_data); } } - /* Allocate AVBSFInternal; must happen after priv_data has been allocated - * so that a filter->close needing priv_data is never called without. */ - bsfi = av_mallocz(sizeof(*bsfi)); - if (!bsfi) { - ret = AVERROR(ENOMEM); - goto fail; - } - ctx->internal = bsfi; - bsfi->buffer_pkt = av_packet_alloc(); if (!bsfi->buffer_pkt) { ret = AVERROR(ENOMEM); @@ -185,7 +183,7 @@ int av_bsf_init(AVBSFContext *ctx) void av_bsf_flush(AVBSFContext *ctx) { - AVBSFInternal *bsfi = ctx->internal; + FFBSFContext *const bsfi = ffbsfcontext(ctx); bsfi->eof = 0; @@ -197,7 +195,7 @@ void av_bsf_flush(AVBSFContext *ctx) int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt) { - AVBSFInternal *bsfi = ctx->internal; + FFBSFContext *const bsfi = ffbsfcontext(ctx); int ret; if (!pkt || IS_EMPTY(pkt)) { @@ -228,7 +226,7 @@ int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt) int ff_bsf_get_packet(AVBSFContext *ctx, AVPacket **pkt) { - AVBSFInternal *bsfi = ctx->internal; + FFBSFContext *const bsfi = ffbsfcontext(ctx); AVPacket *tmp_pkt; if (bsfi->eof) @@ -249,7 +247,7 @@ int ff_bsf_get_packet(AVBSFContext *ctx, AVPacket **pkt) int ff_bsf_get_packet_ref(AVBSFContext *ctx, AVPacket *pkt) { - AVBSFInternal *bsfi = ctx->internal; + FFBSFContext *const bsfi = ffbsfcontext(ctx); if (bsfi->eof) return AVERROR_EOF; @@ -396,7 +394,7 @@ static const AVClass bsf_list_class = { .version = LIBAVUTIL_VERSION_INT, }; -const AVBitStreamFilter ff_list_bsf = { +static const AVBitStreamFilter list_bsf = { .name = "bsf_list", .priv_data_size = sizeof(BSFListContext), .priv_class = &bsf_list_class, @@ -492,7 +490,7 @@ int av_bsf_list_finalize(AVBSFList **lst, AVBSFContext **bsf) goto end; } - ret = av_bsf_alloc(&ff_list_bsf, bsf); + ret = av_bsf_alloc(&list_bsf, bsf); if (ret < 0) return ret; @@ -546,5 +544,5 @@ end: int av_bsf_get_null_filter(AVBSFContext **bsf) { - return av_bsf_alloc(&ff_list_bsf, bsf); + return av_bsf_alloc(&list_bsf, bsf); } diff --git a/chromium/third_party/ffmpeg/libavcodec/bsf.h b/chromium/third_party/ffmpeg/libavcodec/bsf.h index 3b5faa85cb5..8c5355d1866 100644 --- a/chromium/third_party/ffmpeg/libavcodec/bsf.h +++ b/chromium/third_party/ffmpeg/libavcodec/bsf.h @@ -34,8 +34,6 @@ * @{ */ -typedef struct AVBSFInternal AVBSFInternal; - /** * The bitstream filter state. * @@ -58,12 +56,6 @@ typedef struct AVBSFContext { const struct AVBitStreamFilter *filter; /** - * Opaque libavcodec internal data. Must not be touched by the caller in any - * way. - */ - AVBSFInternal *internal; - - /** * Opaque filter-specific private data. If filter->priv_class is non-NULL, * this is an AVOptions-enabled struct. */ diff --git a/chromium/third_party/ffmpeg/libavcodec/cbs.c b/chromium/third_party/ffmpeg/libavcodec/cbs.c index 8d50ea14327..d7aa67c3af1 100644 --- a/chromium/third_party/ffmpeg/libavcodec/cbs.c +++ b/chromium/third_party/ffmpeg/libavcodec/cbs.c @@ -294,6 +294,19 @@ int ff_cbs_read_packet(CodedBitstreamContext *ctx, pkt->data, pkt->size, 0); } +int ff_cbs_read_packet_side_data(CodedBitstreamContext *ctx, + CodedBitstreamFragment *frag, + const AVPacket *pkt) +{ + size_t side_data_size; + const uint8_t *side_data = + av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, + &side_data_size); + + return cbs_read_data(ctx, frag, NULL, + side_data, side_data_size, 1); +} + int ff_cbs_read(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, const uint8_t *data, size_t size) @@ -302,6 +315,28 @@ int ff_cbs_read(CodedBitstreamContext *ctx, data, size, 0); } +/** + * Allocate a new internal data buffer of the given size in the unit. + * + * The data buffer will have input padding. + */ +static int cbs_alloc_unit_data(CodedBitstreamUnit *unit, + size_t size) +{ + av_assert0(!unit->data && !unit->data_ref); + + unit->data_ref = av_buffer_alloc(size + AV_INPUT_BUFFER_PADDING_SIZE); + if (!unit->data_ref) + return AVERROR(ENOMEM); + + unit->data = unit->data_ref->data; + unit->data_size = size; + + memset(unit->data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE); + + return 0; +} + static int cbs_write_unit_data(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit) { @@ -347,7 +382,7 @@ static int cbs_write_unit_data(CodedBitstreamContext *ctx, flush_put_bits(&pbc); - ret = ff_cbs_alloc_unit_data(unit, put_bytes_output(&pbc)); + ret = cbs_alloc_unit_data(unit, put_bytes_output(&pbc)); if (ret < 0) return ret; @@ -680,23 +715,6 @@ int ff_cbs_alloc_unit_content(CodedBitstreamUnit *unit, return 0; } -int ff_cbs_alloc_unit_data(CodedBitstreamUnit *unit, - size_t size) -{ - av_assert0(!unit->data && !unit->data_ref); - - unit->data_ref = av_buffer_alloc(size + AV_INPUT_BUFFER_PADDING_SIZE); - if (!unit->data_ref) - return AVERROR(ENOMEM); - - unit->data = unit->data_ref->data; - unit->data_size = size; - - memset(unit->data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE); - - return 0; -} - static int cbs_insert_unit(CodedBitstreamFragment *frag, int position) { diff --git a/chromium/third_party/ffmpeg/libavcodec/cbs.h b/chromium/third_party/ffmpeg/libavcodec/cbs.h index b7acf983475..87ea14cd074 100644 --- a/chromium/third_party/ffmpeg/libavcodec/cbs.h +++ b/chromium/third_party/ffmpeg/libavcodec/cbs.h @@ -276,6 +276,10 @@ int ff_cbs_read_extradata_from_codec(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, const struct AVCodecContext *avctx); +int ff_cbs_read_packet_side_data(CodedBitstreamContext *ctx, + CodedBitstreamFragment *frag, + const AVPacket *pkt); + /** * Read the data bitstream from a packet into a fragment, then * split into units and decompose. @@ -376,15 +380,6 @@ int ff_cbs_alloc_unit_content(CodedBitstreamUnit *unit, int ff_cbs_alloc_unit_content2(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit); - -/** - * Allocate a new internal data buffer of the given size in the unit. - * - * The data buffer will have input padding. - */ -int ff_cbs_alloc_unit_data(CodedBitstreamUnit *unit, - size_t size); - /** * Insert a new unit into a fragment with the given content. * diff --git a/chromium/third_party/ffmpeg/libavcodec/cbs_bsf.c b/chromium/third_party/ffmpeg/libavcodec/cbs_bsf.c index 86ec3f2a4d9..069f6e99186 100644 --- a/chromium/third_party/ffmpeg/libavcodec/cbs_bsf.c +++ b/chromium/third_party/ffmpeg/libavcodec/cbs_bsf.c @@ -25,15 +25,12 @@ static int cbs_bsf_update_side_data(AVBSFContext *bsf, AVPacket *pkt) CBSBSFContext *ctx = bsf->priv_data; CodedBitstreamFragment *frag = &ctx->fragment; uint8_t *side_data; - size_t side_data_size; int err; - side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, - &side_data_size); - if (!side_data_size) + if (!av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, NULL)) return 0; - err = ff_cbs_read(ctx->input, frag, side_data, side_data_size); + err = ff_cbs_read_packet_side_data(ctx->input, frag, pkt); if (err < 0) { av_log(bsf, AV_LOG_ERROR, "Failed to read extradata from packet side data.\n"); diff --git a/chromium/third_party/ffmpeg/libavcodec/cbs_h2645.c b/chromium/third_party/ffmpeg/libavcodec/cbs_h2645.c index 61c1e13cf70..3396c059c93 100644 --- a/chromium/third_party/ffmpeg/libavcodec/cbs_h2645.c +++ b/chromium/third_party/ffmpeg/libavcodec/cbs_h2645.c @@ -1611,6 +1611,12 @@ static const SEIMessageTypeDescriptor cbs_sei_h265_types[] = { SEI_MESSAGE_RW(h265, sei_recovery_point), }, { + SEI_TYPE_FILM_GRAIN_CHARACTERISTICS, + 1, 0, + sizeof(H265RawFilmGrainCharacteristics), + SEI_MESSAGE_RW(h265, film_grain_characteristics), + }, + { SEI_TYPE_DISPLAY_ORIENTATION, 1, 0, sizeof(H265RawSEIDisplayOrientation), diff --git a/chromium/third_party/ffmpeg/libavcodec/cbs_h265.h b/chromium/third_party/ffmpeg/libavcodec/cbs_h265.h index f7753f1206a..f7cbd4970d0 100644 --- a/chromium/third_party/ffmpeg/libavcodec/cbs_h265.h +++ b/chromium/third_party/ffmpeg/libavcodec/cbs_h265.h @@ -594,6 +594,27 @@ typedef struct H265RawSEIRecoveryPoint { uint8_t broken_link_flag; } H265RawSEIRecoveryPoint; +typedef struct H265RawFilmGrainCharacteristics { + uint8_t film_grain_characteristics_cancel_flag; + uint8_t film_grain_model_id; + uint8_t separate_colour_description_present_flag; + uint8_t film_grain_bit_depth_luma_minus8; + uint8_t film_grain_bit_depth_chroma_minus8; + uint8_t film_grain_full_range_flag; + uint8_t film_grain_colour_primaries; + uint8_t film_grain_transfer_characteristics; + uint8_t film_grain_matrix_coeffs; + uint8_t blending_mode_id; + uint8_t log2_scale_factor; + uint8_t comp_model_present_flag[3]; + uint8_t num_intensity_intervals_minus1[3]; + uint8_t num_model_values_minus1[3]; + uint8_t intensity_interval_lower_bound[3][256]; + uint8_t intensity_interval_upper_bound[3][256]; + int16_t comp_model_value[3][256][6]; + uint8_t film_grain_characteristics_persistence_flag; +} H265RawFilmGrainCharacteristics; + typedef struct H265RawSEIDisplayOrientation { uint8_t display_orientation_cancel_flag; uint8_t hor_flip; diff --git a/chromium/third_party/ffmpeg/libavcodec/cbs_h265_syntax_template.c b/chromium/third_party/ffmpeg/libavcodec/cbs_h265_syntax_template.c index 5d216aad365..67bc77f9751 100644 --- a/chromium/third_party/ffmpeg/libavcodec/cbs_h265_syntax_template.c +++ b/chromium/third_party/ffmpeg/libavcodec/cbs_h265_syntax_template.c @@ -1844,6 +1844,71 @@ static int FUNC(sei_recovery_point) return 0; } +static int FUNC(film_grain_characteristics)(CodedBitstreamContext *ctx, RWContext *rw, + H265RawFilmGrainCharacteristics *current, + SEIMessageState *state) +{ + CodedBitstreamH265Context *h265 = ctx->priv_data; + const H265RawSPS *sps = h265->active_sps; + int err, c, i, j; + + HEADER("Film Grain Characteristics"); + + flag(film_grain_characteristics_cancel_flag); + if (!current->film_grain_characteristics_cancel_flag) { + int filmGrainBitDepth[3]; + + u(2, film_grain_model_id, 0, 1); + flag(separate_colour_description_present_flag); + if (current->separate_colour_description_present_flag) { + ub(3, film_grain_bit_depth_luma_minus8); + ub(3, film_grain_bit_depth_chroma_minus8); + flag(film_grain_full_range_flag); + ub(8, film_grain_colour_primaries); + ub(8, film_grain_transfer_characteristics); + ub(8, film_grain_matrix_coeffs); + } else { + if (!sps) { + av_log(ctx->log_ctx, AV_LOG_ERROR, + "No active SPS for film_grain_characteristics.\n"); + return AVERROR_INVALIDDATA; + } + infer(film_grain_bit_depth_luma_minus8, sps->bit_depth_luma_minus8); + infer(film_grain_bit_depth_chroma_minus8, sps->bit_depth_chroma_minus8); + infer(film_grain_full_range_flag, sps->vui.video_full_range_flag); + infer(film_grain_colour_primaries, sps->vui.colour_primaries); + infer(film_grain_transfer_characteristics, sps->vui.transfer_characteristics); + infer(film_grain_matrix_coeffs, sps->vui.matrix_coefficients); + } + + filmGrainBitDepth[0] = current->film_grain_bit_depth_luma_minus8 + 8; + filmGrainBitDepth[1] = + filmGrainBitDepth[2] = current->film_grain_bit_depth_chroma_minus8 + 8; + + u(2, blending_mode_id, 0, 1); + ub(4, log2_scale_factor); + for (c = 0; c < 3; c++) + flags(comp_model_present_flag[c], 1, c); + for (c = 0; c < 3; c++) { + if (current->comp_model_present_flag[c]) { + ubs(8, num_intensity_intervals_minus1[c], 1, c); + us(3, num_model_values_minus1[c], 0, 5, 1, c); + for (i = 0; i <= current->num_intensity_intervals_minus1[c]; i++) { + ubs(8, intensity_interval_lower_bound[c][i], 2, c, i); + ubs(8, intensity_interval_upper_bound[c][i], 2, c, i); + for (j = 0; j <= current->num_model_values_minus1[c]; j++) + ses(comp_model_value[c][i][j], 0 - current->film_grain_model_id * (1 << (filmGrainBitDepth[c] - 1)), + ((1 << filmGrainBitDepth[c]) - 1) - current->film_grain_model_id * (1 << (filmGrainBitDepth[c] - 1)), + 3, c, i, j); + } + } + } + flag(film_grain_characteristics_persistence_flag); + } + + return 0; +} + static int FUNC(sei_display_orientation) (CodedBitstreamContext *ctx, RWContext *rw, H265RawSEIDisplayOrientation *current, SEIMessageState *sei) diff --git a/chromium/third_party/ffmpeg/libavcodec/codec.h b/chromium/third_party/ffmpeg/libavcodec/codec.h index cedd1069532..8f127050668 100644 --- a/chromium/third_party/ffmpeg/libavcodec/codec.h +++ b/chromium/third_party/ffmpeg/libavcodec/codec.h @@ -214,12 +214,12 @@ typedef struct AVCodec { * see AV_CODEC_CAP_* */ int capabilities; + uint8_t max_lowres; ///< maximum value for lowres supported by the decoder const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0} const enum AVPixelFormat *pix_fmts; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1 const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0 const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1 const uint64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0 - uint8_t max_lowres; ///< maximum value for lowres supported by the decoder const AVClass *priv_class; ///< AVClass for the private context const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN} @@ -242,6 +242,12 @@ typedef struct AVCodec { * New public fields should be added right above. ***************************************************************** */ + /** + * Internal codec capabilities. + * See FF_CODEC_CAP_* in internal.h + */ + int caps_internal; + int priv_data_size; /** * @name Frame-level threading support functions @@ -323,11 +329,6 @@ typedef struct AVCodec { * Will be called when seeking */ void (*flush)(struct AVCodecContext *); - /** - * Internal codec capabilities. - * See FF_CODEC_CAP_* in internal.h - */ - int caps_internal; /** * Decoding only, a comma-separated list of bitstream filters to apply to diff --git a/chromium/third_party/ffmpeg/libavcodec/codec_desc.c b/chromium/third_party/ffmpeg/libavcodec/codec_desc.c index 674f4bf8c3d..a06992fce81 100644 --- a/chromium/third_party/ffmpeg/libavcodec/codec_desc.c +++ b/chromium/third_party/ffmpeg/libavcodec/codec_desc.c @@ -3222,6 +3222,13 @@ static const AVCodecDescriptor codec_descriptors[] = { .long_name = NULL_IF_CONFIG_SMALL("MobiClip FastAudio"), .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, + { + .id = AV_CODEC_ID_MSNSIREN, + .type = AVMEDIA_TYPE_AUDIO, + .name = "msnsiren", + .long_name = NULL_IF_CONFIG_SMALL("MSN Siren"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, + }, /* subtitle codecs */ { diff --git a/chromium/third_party/ffmpeg/libavcodec/codec_id.h b/chromium/third_party/ffmpeg/libavcodec/codec_id.h index d49f9af36c0..446bb2c2fba 100644 --- a/chromium/third_party/ffmpeg/libavcodec/codec_id.h +++ b/chromium/third_party/ffmpeg/libavcodec/codec_id.h @@ -514,6 +514,7 @@ enum AVCodecID { AV_CODEC_ID_SIREN, AV_CODEC_ID_HCA, AV_CODEC_ID_FASTAUDIO, + AV_CODEC_ID_MSNSIREN, /* subtitle codecs */ AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs. diff --git a/chromium/third_party/ffmpeg/libavcodec/dcaenc.c b/chromium/third_party/ffmpeg/libavcodec/dcaenc.c index 71a76bc356f..884ac896d3a 100644 --- a/chromium/third_party/ffmpeg/libavcodec/dcaenc.c +++ b/chromium/third_party/ffmpeg/libavcodec/dcaenc.c @@ -22,7 +22,6 @@ */ #define FFT_FLOAT 0 -#define FFT_FIXED_32 1 #include "libavutil/avassert.h" #include "libavutil/channel_layout.h" diff --git a/chromium/third_party/ffmpeg/libavcodec/dnxhddec.c b/chromium/third_party/ffmpeg/libavcodec/dnxhddec.c index 26fa6788ea8..b4162a2eb70 100644 --- a/chromium/third_party/ffmpeg/libavcodec/dnxhddec.c +++ b/chromium/third_party/ffmpeg/libavcodec/dnxhddec.c @@ -111,6 +111,7 @@ static av_cold int dnxhd_decode_init(AVCodecContext *avctx) static int dnxhd_init_vlc(DNXHDContext *ctx, uint32_t cid, int bitdepth) { + int ret; if (cid != ctx->cid) { const CIDEntry *cid_table = ff_dnxhd_get_cid_table(cid); @@ -131,19 +132,26 @@ static int dnxhd_init_vlc(DNXHDContext *ctx, uint32_t cid, int bitdepth) ff_free_vlc(&ctx->dc_vlc); ff_free_vlc(&ctx->run_vlc); - init_vlc(&ctx->ac_vlc, DNXHD_VLC_BITS, 257, + if ((ret = init_vlc(&ctx->ac_vlc, DNXHD_VLC_BITS, 257, ctx->cid_table->ac_bits, 1, 1, - ctx->cid_table->ac_codes, 2, 2, 0); - init_vlc(&ctx->dc_vlc, DNXHD_DC_VLC_BITS, bitdepth > 8 ? 14 : 12, + ctx->cid_table->ac_codes, 2, 2, 0)) < 0) + goto out; + if ((ret = init_vlc(&ctx->dc_vlc, DNXHD_DC_VLC_BITS, bitdepth > 8 ? 14 : 12, ctx->cid_table->dc_bits, 1, 1, - ctx->cid_table->dc_codes, 1, 1, 0); - init_vlc(&ctx->run_vlc, DNXHD_VLC_BITS, 62, + ctx->cid_table->dc_codes, 1, 1, 0)) < 0) + goto out; + if ((ret = init_vlc(&ctx->run_vlc, DNXHD_VLC_BITS, 62, ctx->cid_table->run_bits, 1, 1, - ctx->cid_table->run_codes, 2, 2, 0); + ctx->cid_table->run_codes, 2, 2, 0)) < 0) + goto out; ctx->cid = cid; } - return 0; + ret = 0; +out: + if (ret < 0) + av_log(ctx->avctx, AV_LOG_ERROR, "init_vlc failed\n"); + return ret; } static int dnxhd_get_profile(int cid) @@ -184,7 +192,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame, return AVERROR_INVALIDDATA; } if (buf[5] & 2) { /* interlaced */ - ctx->cur_field = buf[5] & 1; + ctx->cur_field = first_field ? buf[5] & 1 : !ctx->cur_field; frame->interlaced_frame = 1; frame->top_field_first = first_field ^ ctx->cur_field; av_log(ctx->avctx, AV_LOG_DEBUG, diff --git a/chromium/third_party/ffmpeg/libavcodec/exr.c b/chromium/third_party/ffmpeg/libavcodec/exr.c index f7d59c8241e..67340c892da 100644 --- a/chromium/third_party/ffmpeg/libavcodec/exr.c +++ b/chromium/third_party/ffmpeg/libavcodec/exr.c @@ -1014,7 +1014,9 @@ static int dwa_uncompress(EXRContext *s, const uint8_t *src, int compressed_size dc_count = AV_RL64(src + 72); ac_compression = AV_RL64(src + 80); - if (compressed_size < (uint64_t)(lo_size | ac_size | dc_size | rle_csize) || compressed_size < 88LL + lo_size + ac_size + dc_size + rle_csize) + if ( compressed_size < (uint64_t)(lo_size | ac_size | dc_size | rle_csize) || compressed_size < 88LL + lo_size + ac_size + dc_size + rle_csize + || ac_count > (uint64_t)INT_MAX/2 + ) return AVERROR_INVALIDDATA; bytestream2_init(&gb, src + 88, compressed_size - 88); diff --git a/chromium/third_party/ffmpeg/libavcodec/faxcompr.c b/chromium/third_party/ffmpeg/libavcodec/faxcompr.c index 44c1f6f6b97..b283831dae7 100644 --- a/chromium/third_party/ffmpeg/libavcodec/faxcompr.c +++ b/chromium/third_party/ffmpeg/libavcodec/faxcompr.c @@ -283,6 +283,8 @@ static int decode_group3_2d_line(AVCodecContext *avctx, GetBitContext *gb, for (k = 0; k < 2; k++) { run = 0; for (;;) { + if (get_bits_left(gb) <= 0) + return AVERROR_INVALIDDATA; t = get_vlc2(gb, ccitt_vlc[mode].table, 9, 2); if (t == -1) { av_log(avctx, AV_LOG_ERROR, "Incorrect code\n"); diff --git a/chromium/third_party/ffmpeg/libavcodec/fft-internal.h b/chromium/third_party/ffmpeg/libavcodec/fft-internal.h index 3bd5a1123d8..d89a3e38ca6 100644 --- a/chromium/third_party/ffmpeg/libavcodec/fft-internal.h +++ b/chromium/third_party/ffmpeg/libavcodec/fft-internal.h @@ -19,6 +19,9 @@ #ifndef AVCODEC_FFT_INTERNAL_H #define AVCODEC_FFT_INTERNAL_H +#include "libavutil/mathematics.h" +#include "fft.h" + #if FFT_FLOAT #define FIX15(v) (v) @@ -36,10 +39,6 @@ #else /* FFT_FLOAT */ -#define SCALE_FLOAT(a, bits) lrint((a) * (double)(1 << (bits))) - -#if FFT_FIXED_32 - #define CMUL(dre, dim, are, aim, bre, bim) do { \ int64_t accu; \ (accu) = (int64_t)(bre) * (are); \ @@ -50,10 +49,6 @@ (dim) = (int)(((accu) + 0x40000000) >> 31); \ } while (0) -#define FIX15(a) av_clip(SCALE_FLOAT(a, 31), -2147483647, 2147483647) - -#endif /* FFT_FIXED_32 */ - #endif /* FFT_FLOAT */ #define ff_imdct_calc_c FFT_NAME(ff_imdct_calc_c) diff --git a/chromium/third_party/ffmpeg/libavcodec/fft.h b/chromium/third_party/ffmpeg/libavcodec/fft.h index e03ca01abfd..706c9d07f50 100644 --- a/chromium/third_party/ffmpeg/libavcodec/fft.h +++ b/chromium/third_party/ffmpeg/libavcodec/fft.h @@ -26,10 +26,6 @@ #define FFT_FLOAT 1 #endif -#ifndef FFT_FIXED_32 -#define FFT_FIXED_32 0 -#endif - #include <stdint.h> #include "config.h" @@ -45,15 +41,11 @@ typedef float FFTDouble; #else -#if FFT_FIXED_32 - #define Q31(x) (int)((x)*2147483648.0 + 0.5) #define FFT_NAME(x) x ## _fixed_32 typedef int32_t FFTSample; -#endif /* FFT_FIXED_32 */ - typedef struct FFTComplex { FFTSample re, im; } FFTComplex; diff --git a/chromium/third_party/ffmpeg/libavcodec/fft_fixed_32.c b/chromium/third_party/ffmpeg/libavcodec/fft_fixed_32.c index fbdbf847e23..e18dc83891e 100644 --- a/chromium/third_party/ffmpeg/libavcodec/fft_fixed_32.c +++ b/chromium/third_party/ffmpeg/libavcodec/fft_fixed_32.c @@ -48,5 +48,4 @@ */ #define FFT_FLOAT 0 -#define FFT_FIXED_32 1 #include "fft_template.c" diff --git a/chromium/third_party/ffmpeg/libavcodec/fft_float.c b/chromium/third_party/ffmpeg/libavcodec/fft_float.c index 73cc98d0d4b..a9fd01978de 100644 --- a/chromium/third_party/ffmpeg/libavcodec/fft_float.c +++ b/chromium/third_party/ffmpeg/libavcodec/fft_float.c @@ -17,5 +17,4 @@ */ #define FFT_FLOAT 1 -#define FFT_FIXED_32 0 #include "fft_template.c" diff --git a/chromium/third_party/ffmpeg/libavcodec/fft_template.c b/chromium/third_party/ffmpeg/libavcodec/fft_template.c index 3012372a74b..0bd64192cdf 100644 --- a/chromium/third_party/ffmpeg/libavcodec/fft_template.c +++ b/chromium/third_party/ffmpeg/libavcodec/fft_template.c @@ -33,9 +33,9 @@ #include "fft.h" #include "fft-internal.h" -#if FFT_FIXED_32 +#if !FFT_FLOAT #include "fft_table.h" -#else /* FFT_FIXED_32 */ +#else /* !FFT_FLOAT */ /* cos(2*pi*x/n) for 0<=x<=n/4, followed by its reverse */ #if !CONFIG_HARDCODED_TABLES @@ -136,7 +136,7 @@ COSTABLE_CONST FFTSample * const FFT_NAME(ff_cos_tabs)[] = { FFT_NAME(ff_cos_131072), }; -#endif /* FFT_FIXED_32 */ +#endif /* FFT_FLOAT */ static void fft_permute_c(FFTContext *s, FFTComplex *z); static void fft_calc_c(FFTContext *s, FFTComplex *z); @@ -226,20 +226,18 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse) s->mdct_calc = ff_mdct_calc_c; #endif -#if FFT_FIXED_32 - ff_fft_lut_init(); -#else /* FFT_FIXED_32 */ #if FFT_FLOAT if (ARCH_AARCH64) ff_fft_init_aarch64(s); if (ARCH_ARM) ff_fft_init_arm(s); if (ARCH_PPC) ff_fft_init_ppc(s); if (ARCH_X86) ff_fft_init_x86(s); if (HAVE_MIPSFPU) ff_fft_init_mips(s); -#endif for(j=4; j<=nbits; j++) { ff_init_ff_cos_tabs(j); } -#endif /* FFT_FIXED_32 */ +#else /* FFT_FLOAT */ + ff_fft_lut_init(); +#endif if (ARCH_X86 && FFT_FLOAT && s->fft_permutation == FF_FFT_PERM_AVX) { @@ -312,7 +310,7 @@ av_cold void ff_fft_end(FFTContext *s) av_freep(&s->tmp_buf); } -#if FFT_FIXED_32 +#if !FFT_FLOAT static void fft_calc_c(FFTContext *s, FFTComplex *z) { @@ -470,7 +468,7 @@ static void fft_calc_c(FFTContext *s, FFTComplex *z) { } } -#else /* FFT_FIXED_32 */ +#else /* !FFT_FLOAT */ #define BUTTERFLIES(a0,a1,a2,a3) {\ BF(t3, t5, t5, t1);\ @@ -620,4 +618,4 @@ static void fft_calc_c(FFTContext *s, FFTComplex *z) { fft_dispatch[s->nbits-2](z); } -#endif /* FFT_FIXED_32 */ +#endif /* !FFT_FLOAT */ diff --git a/chromium/third_party/ffmpeg/libavcodec/frame_thread_encoder.c b/chromium/third_party/ffmpeg/libavcodec/frame_thread_encoder.c index 9cabfc495f4..d4f86f7418f 100644 --- a/chromium/third_party/ffmpeg/libavcodec/frame_thread_encoder.c +++ b/chromium/third_party/ffmpeg/libavcodec/frame_thread_encoder.c @@ -29,6 +29,7 @@ #include "libavutil/thread.h" #include "avcodec.h" #include "internal.h" +#include "pthread_internal.h" #include "thread.h" #define MAX_THREADS 64 @@ -52,6 +53,7 @@ typedef struct{ pthread_mutex_t task_fifo_mutex; /* Used to guard (next_)task_index */ pthread_cond_t task_fifo_cond; + unsigned pthread_init_cnt; unsigned max_tasks; Task tasks[BUFFER_SIZE]; pthread_mutex_t finished_task_mutex; /* Guards tasks[i].finished */ @@ -65,6 +67,12 @@ typedef struct{ atomic_int exit; } ThreadContext; +#define OFF(member) offsetof(ThreadContext, member) +DEFINE_OFFSET_ARRAY(ThreadContext, thread_ctx, pthread_init_cnt, + (OFF(buffer_mutex), OFF(task_fifo_mutex), OFF(finished_task_mutex)), + (OFF(task_fifo_cond), OFF(finished_task_cond))); +#undef OFF + static void * attribute_align_arg worker(void *v){ AVCodecContext *avctx = v; ThreadContext *c = avctx->internal->frame_thread_encoder; @@ -122,11 +130,12 @@ end: return NULL; } -int ff_frame_thread_encoder_init(AVCodecContext *avctx) +av_cold int ff_frame_thread_encoder_init(AVCodecContext *avctx) { int i=0; ThreadContext *c; - + AVCodecContext *thread_avctx = NULL; + int ret; if( !(avctx->thread_type & FF_THREAD_FRAME) || !(avctx->codec->capabilities & AV_CODEC_CAP_FRAME_THREADS)) @@ -185,46 +194,49 @@ int ff_frame_thread_encoder_init(AVCodecContext *avctx) c->parent_avctx = avctx; - pthread_mutex_init(&c->task_fifo_mutex, NULL); - pthread_mutex_init(&c->finished_task_mutex, NULL); - pthread_mutex_init(&c->buffer_mutex, NULL); - pthread_cond_init(&c->task_fifo_cond, NULL); - pthread_cond_init(&c->finished_task_cond, NULL); + ret = ff_pthread_init(c, thread_ctx_offsets); + if (ret < 0) + goto fail; atomic_init(&c->exit, 0); c->max_tasks = avctx->thread_count + 2; - for (unsigned i = 0; i < c->max_tasks; i++) { - if (!(c->tasks[i].indata = av_frame_alloc()) || - !(c->tasks[i].outdata = av_packet_alloc())) + for (unsigned j = 0; j < c->max_tasks; j++) { + if (!(c->tasks[j].indata = av_frame_alloc()) || + !(c->tasks[j].outdata = av_packet_alloc())) { + ret = AVERROR(ENOMEM); goto fail; + } } for(i=0; i<avctx->thread_count ; i++){ - int ret; void *tmpv; - AVCodecContext *thread_avctx = avcodec_alloc_context3(avctx->codec); - if(!thread_avctx) + thread_avctx = avcodec_alloc_context3(avctx->codec); + if (!thread_avctx) { + ret = AVERROR(ENOMEM); goto fail; + } tmpv = thread_avctx->priv_data; *thread_avctx = *avctx; + thread_avctx->priv_data = tmpv; + thread_avctx->internal = NULL; + thread_avctx->hw_frames_ctx = NULL; ret = av_opt_copy(thread_avctx, avctx); if (ret < 0) goto fail; - thread_avctx->priv_data = tmpv; - thread_avctx->internal = NULL; if (avctx->codec->priv_class) { - int ret = av_opt_copy(thread_avctx->priv_data, avctx->priv_data); + ret = av_opt_copy(thread_avctx->priv_data, avctx->priv_data); if (ret < 0) goto fail; } thread_avctx->thread_count = 1; thread_avctx->active_thread_type &= ~FF_THREAD_FRAME; - if (avcodec_open2(thread_avctx, avctx->codec, NULL) < 0) + if ((ret = avcodec_open2(thread_avctx, avctx->codec, NULL)) < 0) goto fail; av_assert0(!thread_avctx->internal->frame_thread_encoder); thread_avctx->internal->frame_thread_encoder = c; - if(pthread_create(&c->worker[i], NULL, worker, thread_avctx)) { + if ((ret = pthread_create(&c->worker[i], NULL, worker, thread_avctx))) { + ret = AVERROR(ret); goto fail; } } @@ -233,23 +245,29 @@ int ff_frame_thread_encoder_init(AVCodecContext *avctx) return 0; fail: + avcodec_close(thread_avctx); + av_freep(&thread_avctx); avctx->thread_count = i; av_log(avctx, AV_LOG_ERROR, "ff_frame_thread_encoder_init failed\n"); ff_frame_thread_encoder_free(avctx); - return -1; + return ret; } -void ff_frame_thread_encoder_free(AVCodecContext *avctx){ - int i; +av_cold void ff_frame_thread_encoder_free(AVCodecContext *avctx) +{ ThreadContext *c= avctx->internal->frame_thread_encoder; - pthread_mutex_lock(&c->task_fifo_mutex); - atomic_store(&c->exit, 1); - pthread_cond_broadcast(&c->task_fifo_cond); - pthread_mutex_unlock(&c->task_fifo_mutex); + /* In case initializing the mutexes/condition variables failed, + * they must not be used. In this case the thread_count is zero + * as no thread has been initialized yet. */ + if (avctx->thread_count > 0) { + pthread_mutex_lock(&c->task_fifo_mutex); + atomic_store(&c->exit, 1); + pthread_cond_broadcast(&c->task_fifo_cond); + pthread_mutex_unlock(&c->task_fifo_mutex); - for (i=0; i<avctx->thread_count; i++) { - pthread_join(c->worker[i], NULL); + for (int i = 0; i < avctx->thread_count; i++) + pthread_join(c->worker[i], NULL); } for (unsigned i = 0; i < c->max_tasks; i++) { @@ -257,11 +275,7 @@ void ff_frame_thread_encoder_free(AVCodecContext *avctx){ av_packet_free(&c->tasks[i].outdata); } - pthread_mutex_destroy(&c->task_fifo_mutex); - pthread_mutex_destroy(&c->finished_task_mutex); - pthread_mutex_destroy(&c->buffer_mutex); - pthread_cond_destroy(&c->task_fifo_cond); - pthread_cond_destroy(&c->finished_task_cond); + ff_pthread_free(c, thread_ctx_offsets); av_freep(&avctx->internal->frame_thread_encoder); } diff --git a/chromium/third_party/ffmpeg/libavcodec/frame_thread_encoder.h b/chromium/third_party/ffmpeg/libavcodec/frame_thread_encoder.h index 2cdc40a830b..201cba2a8f1 100644 --- a/chromium/third_party/ffmpeg/libavcodec/frame_thread_encoder.h +++ b/chromium/third_party/ffmpeg/libavcodec/frame_thread_encoder.h @@ -23,6 +23,10 @@ #include "avcodec.h" +/** + * Initialize frame thread encoder. + * @note hardware encoders are not supported + */ int ff_frame_thread_encoder_init(AVCodecContext *avctx); void ff_frame_thread_encoder_free(AVCodecContext *avctx); int ff_thread_video_encode_frame(AVCodecContext *avctx, AVPacket *pkt, diff --git a/chromium/third_party/ffmpeg/libavcodec/h263dec.c b/chromium/third_party/ffmpeg/libavcodec/h263dec.c index 213bbe1306f..817e9944dd5 100644 --- a/chromium/third_party/ffmpeg/libavcodec/h263dec.c +++ b/chromium/third_party/ffmpeg/libavcodec/h263dec.c @@ -745,7 +745,7 @@ const enum AVPixelFormat ff_h263_hwaccel_pixfmt_list_420[] = { AV_PIX_FMT_NONE }; -const AVCodecHWConfigInternal *const ff_h263_hw_config_list[] = { +static const AVCodecHWConfigInternal *const h263_hw_config_list[] = { #if CONFIG_H263_VAAPI_HWACCEL HWACCEL_VAAPI(h263), #endif @@ -776,7 +776,7 @@ const AVCodec ff_h263_decoder = { .flush = ff_mpeg_flush, .max_lowres = 3, .pix_fmts = ff_h263_hwaccel_pixfmt_list_420, - .hw_configs = ff_h263_hw_config_list, + .hw_configs = h263_hw_config_list, }; const AVCodec ff_h263p_decoder = { @@ -794,5 +794,5 @@ const AVCodec ff_h263p_decoder = { .flush = ff_mpeg_flush, .max_lowres = 3, .pix_fmts = ff_h263_hwaccel_pixfmt_list_420, - .hw_configs = ff_h263_hw_config_list, + .hw_configs = h263_hw_config_list, }; diff --git a/chromium/third_party/ffmpeg/libavcodec/h264_levels.h b/chromium/third_party/ffmpeg/libavcodec/h264_levels.h index 6bba2e86245..310d79e51a2 100644 --- a/chromium/third_party/ffmpeg/libavcodec/h264_levels.h +++ b/chromium/third_party/ffmpeg/libavcodec/h264_levels.h @@ -23,7 +23,7 @@ #include <stdint.h> typedef struct H264LevelDescriptor { - const char *name; + char name[4]; // Large enough for all current levels like "4.1" uint8_t level_idc; uint8_t constraint_set3_flag; uint32_t max_mbps; diff --git a/chromium/third_party/ffmpeg/libavcodec/h264_parser.c b/chromium/third_party/ffmpeg/libavcodec/h264_parser.c index 606b3f67d17..e71b1d125e9 100644 --- a/chromium/third_party/ffmpeg/libavcodec/h264_parser.c +++ b/chromium/third_party/ffmpeg/libavcodec/h264_parser.c @@ -81,12 +81,13 @@ static int h264_find_frame_end(H264ParseContext *p, const uint8_t *buf, for (i = 0; i < buf_size; i++) { if (i >= next_avc) { - int nalsize = 0; + int64_t nalsize = 0; i = next_avc; for (j = 0; j < p->nal_length_size; j++) nalsize = (nalsize << 8) | buf[i++]; - if (nalsize <= 0 || nalsize > buf_size - i) { - av_log(logctx, AV_LOG_ERROR, "AVC-parser: nal size %d remaining %d\n", nalsize, buf_size - i); + if (!nalsize || nalsize > buf_size - i) { + av_log(logctx, AV_LOG_ERROR, "AVC-parser: nal size %"PRId64" " + "remaining %d\n", nalsize, buf_size - i); return buf_size; } next_avc = i + nalsize; diff --git a/chromium/third_party/ffmpeg/libavcodec/h264_picture.c b/chromium/third_party/ffmpeg/libavcodec/h264_picture.c index eec5e9fb9a0..5944798394e 100644 --- a/chromium/third_party/ffmpeg/libavcodec/h264_picture.c +++ b/chromium/third_party/ffmpeg/libavcodec/h264_picture.c @@ -43,13 +43,14 @@ void ff_h264_unref_picture(H264Context *h, H264Picture *pic) { - int off = offsetof(H264Picture, tf) + sizeof(pic->tf); + int off = offsetof(H264Picture, tf_grain) + sizeof(pic->tf_grain); int i; if (!pic->f || !pic->f->buf[0]) return; ff_thread_release_buffer(h->avctx, &pic->tf); + ff_thread_release_buffer(h->avctx, &pic->tf_grain); av_buffer_unref(&pic->hwaccel_priv_buf); av_buffer_unref(&pic->qscale_table_buf); @@ -63,6 +64,39 @@ void ff_h264_unref_picture(H264Context *h, H264Picture *pic) memset((uint8_t*)pic + off, 0, sizeof(*pic) - off); } +static void h264_copy_picture_params(H264Picture *dst, const H264Picture *src) +{ + dst->qscale_table = src->qscale_table; + dst->mb_type = src->mb_type; + dst->pps = src->pps; + + for (int i = 0; i < 2; i++) { + dst->motion_val[i] = src->motion_val[i]; + dst->ref_index[i] = src->ref_index[i]; + } + + for (int i = 0; i < 2; i++) + dst->field_poc[i] = src->field_poc[i]; + + memcpy(dst->ref_poc, src->ref_poc, sizeof(src->ref_poc)); + memcpy(dst->ref_count, src->ref_count, sizeof(src->ref_count)); + + dst->poc = src->poc; + dst->frame_num = src->frame_num; + dst->mmco_reset = src->mmco_reset; + dst->long_ref = src->long_ref; + dst->mbaff = src->mbaff; + dst->field_picture = src->field_picture; + dst->reference = src->reference; + dst->recovered = src->recovered; + dst->invalid_gap = src->invalid_gap; + dst->sei_recovery_frame_cnt = src->sei_recovery_frame_cnt; + dst->mb_width = src->mb_width; + dst->mb_height = src->mb_height; + dst->mb_stride = src->mb_stride; + dst->needs_fg = src->needs_fg; +} + int ff_h264_ref_picture(H264Context *h, H264Picture *dst, H264Picture *src) { int ret, i; @@ -76,6 +110,14 @@ int ff_h264_ref_picture(H264Context *h, H264Picture *dst, H264Picture *src) if (ret < 0) goto fail; + if (src->needs_fg) { + av_assert0(src->tf_grain.f == src->f_grain); + dst->tf_grain.f = dst->f_grain; + ret = ff_thread_ref_frame(&dst->tf_grain, &src->tf_grain); + if (ret < 0) + goto fail; + } + dst->qscale_table_buf = av_buffer_ref(src->qscale_table_buf); dst->mb_type_buf = av_buffer_ref(src->mb_type_buf); dst->pps_buf = av_buffer_ref(src->pps_buf); @@ -83,9 +125,6 @@ int ff_h264_ref_picture(H264Context *h, H264Picture *dst, H264Picture *src) ret = AVERROR(ENOMEM); goto fail; } - dst->qscale_table = src->qscale_table; - dst->mb_type = src->mb_type; - dst->pps = src->pps; for (i = 0; i < 2; i++) { dst->motion_val_buf[i] = av_buffer_ref(src->motion_val_buf[i]); @@ -94,8 +133,6 @@ int ff_h264_ref_picture(H264Context *h, H264Picture *dst, H264Picture *src) ret = AVERROR(ENOMEM); goto fail; } - dst->motion_val[i] = src->motion_val[i]; - dst->ref_index[i] = src->ref_index[i]; } if (src->hwaccel_picture_private) { @@ -107,25 +144,60 @@ int ff_h264_ref_picture(H264Context *h, H264Picture *dst, H264Picture *src) dst->hwaccel_picture_private = dst->hwaccel_priv_buf->data; } - for (i = 0; i < 2; i++) - dst->field_poc[i] = src->field_poc[i]; + h264_copy_picture_params(dst, src); - memcpy(dst->ref_poc, src->ref_poc, sizeof(src->ref_poc)); - memcpy(dst->ref_count, src->ref_count, sizeof(src->ref_count)); + return 0; +fail: + ff_h264_unref_picture(h, dst); + return ret; +} - dst->poc = src->poc; - dst->frame_num = src->frame_num; - dst->mmco_reset = src->mmco_reset; - dst->long_ref = src->long_ref; - dst->mbaff = src->mbaff; - dst->field_picture = src->field_picture; - dst->reference = src->reference; - dst->recovered = src->recovered; - dst->invalid_gap = src->invalid_gap; - dst->sei_recovery_frame_cnt = src->sei_recovery_frame_cnt; - dst->mb_width = src->mb_width; - dst->mb_height = src->mb_height; - dst->mb_stride = src->mb_stride; +int ff_h264_replace_picture(H264Context *h, H264Picture *dst, const H264Picture *src) +{ + int ret, i; + + if (!src->f || !src->f->buf[0]) { + ff_h264_unref_picture(h, dst); + return 0; + } + + av_assert0(src->tf.f == src->f); + + dst->tf.f = dst->f; + ff_thread_release_buffer(h->avctx, &dst->tf); + ret = ff_thread_ref_frame(&dst->tf, &src->tf); + if (ret < 0) + goto fail; + + if (src->needs_fg) { + av_assert0(src->tf_grain.f == src->f_grain); + dst->tf_grain.f = dst->f_grain; + ff_thread_release_buffer(h->avctx, &dst->tf_grain); + ret = ff_thread_ref_frame(&dst->tf_grain, &src->tf_grain); + if (ret < 0) + goto fail; + } + + ret = av_buffer_replace(&dst->qscale_table_buf, src->qscale_table_buf); + ret |= av_buffer_replace(&dst->mb_type_buf, src->mb_type_buf); + ret |= av_buffer_replace(&dst->pps_buf, src->pps_buf); + if (ret < 0) + goto fail; + + for (i = 0; i < 2; i++) { + ret = av_buffer_replace(&dst->motion_val_buf[i], src->motion_val_buf[i]); + ret |= av_buffer_replace(&dst->ref_index_buf[i], src->ref_index_buf[i]); + if (ret < 0) + goto fail; + } + + ret = av_buffer_replace(&dst->hwaccel_priv_buf, src->hwaccel_priv_buf); + if (ret < 0) + goto fail; + + dst->hwaccel_picture_private = src->hwaccel_picture_private; + + h264_copy_picture_params(dst, src); return 0; fail: @@ -159,6 +231,7 @@ void ff_h264_set_erpic(ERPicture *dst, H264Picture *src) int ff_h264_field_end(H264Context *h, H264SliceContext *sl, int in_setup) { AVCodecContext *const avctx = h->avctx; + H264Picture *cur = h->cur_pic_ptr; int err = 0; h->mb_y = 0; @@ -177,10 +250,21 @@ int ff_h264_field_end(H264Context *h, H264SliceContext *sl, int in_setup) if (err < 0) av_log(avctx, AV_LOG_ERROR, "hardware accelerator failed to decode picture\n"); + } else if (!in_setup && cur->needs_fg) { + AVFrameSideData *sd = av_frame_get_side_data(cur->f, AV_FRAME_DATA_FILM_GRAIN_PARAMS); + av_assert0(sd); // always present if `cur->needs_fg` + err = ff_h274_apply_film_grain(cur->f_grain, cur->f, &h->h274db, + (AVFilmGrainParams *) sd->data); + if (err < 0) { + av_log(h->avctx, AV_LOG_WARNING, "Failed synthesizing film " + "grain, ignoring: %s\n", av_err2str(err)); + cur->needs_fg = 0; + err = 0; + } } if (!in_setup && !h->droppable) - ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, + ff_thread_report_progress(&cur->tf, INT_MAX, h->picture_structure == PICT_BOTTOM_FIELD); emms_c(); diff --git a/chromium/third_party/ffmpeg/libavcodec/h264_sei.c b/chromium/third_party/ffmpeg/libavcodec/h264_sei.c index 7797f24650b..329c2ea4f24 100644 --- a/chromium/third_party/ffmpeg/libavcodec/h264_sei.c +++ b/chromium/third_party/ffmpeg/libavcodec/h264_sei.c @@ -424,7 +424,7 @@ static int decode_film_grain_characteristics(H264SEIFilmGrainCharacteristics *h, if (h->present) { memset(h, 0, sizeof(*h)); - h->model_id = get_bits(gb, 8); + h->model_id = get_bits(gb, 2); h->separate_colour_description_present_flag = get_bits1(gb); if (h->separate_colour_description_present_flag) { h->bit_depth_luma = get_bits(gb, 3) + 8; diff --git a/chromium/third_party/ffmpeg/libavcodec/h264_slice.c b/chromium/third_party/ffmpeg/libavcodec/h264_slice.c index 41338fbcb69..201b22455cf 100644 --- a/chromium/third_party/ffmpeg/libavcodec/h264_slice.c +++ b/chromium/third_party/ffmpeg/libavcodec/h264_slice.c @@ -197,6 +197,16 @@ static int alloc_picture(H264Context *h, H264Picture *pic) if (ret < 0) goto fail; + if (pic->needs_fg) { + pic->tf_grain.f = pic->f_grain; + pic->f_grain->format = pic->f->format; + pic->f_grain->width = pic->f->width; + pic->f_grain->height = pic->f->height; + ret = ff_thread_get_buffer(h->avctx, &pic->tf_grain, 0); + if (ret < 0) + goto fail; + } + if (h->avctx->hwaccel) { const AVHWAccel *hwaccel = h->avctx->hwaccel; av_assert0(!pic->hwaccel_picture_private); @@ -379,19 +389,15 @@ int ff_h264_update_thread_context(AVCodecContext *dst, h->droppable = h1->droppable; for (i = 0; i < H264_MAX_PICTURE_COUNT; i++) { - ff_h264_unref_picture(h, &h->DPB[i]); - if (h1->DPB[i].f->buf[0] && - (ret = ff_h264_ref_picture(h, &h->DPB[i], &h1->DPB[i])) < 0) + ret = ff_h264_replace_picture(h, &h->DPB[i], &h1->DPB[i]); + if (ret < 0) return ret; } h->cur_pic_ptr = REBASE_PICTURE(h1->cur_pic_ptr, h, h1); - ff_h264_unref_picture(h, &h->cur_pic); - if (h1->cur_pic.f->buf[0]) { - ret = ff_h264_ref_picture(h, &h->cur_pic, &h1->cur_pic); - if (ret < 0) - return ret; - } + ret = ff_h264_replace_picture(h, &h->cur_pic, &h1->cur_pic); + if (ret < 0) + return ret; h->enable_er = h1->enable_er; h->workaround_bugs = h1->workaround_bugs; @@ -410,6 +416,7 @@ int ff_h264_update_thread_context(AVCodecContext *dst, h->next_output_pic = h1->next_output_pic; h->next_outputed_poc = h1->next_outputed_poc; + h->poc_offset = h1->poc_offset; memcpy(h->mmco, h1->mmco, sizeof(h->mmco)); h->nb_mmco = h1->nb_mmco; @@ -520,6 +527,9 @@ static int h264_frame_start(H264Context *h) pic->f->crop_top = h->crop_top; pic->f->crop_bottom = h->crop_bottom; + pic->needs_fg = h->sei.film_grain_characteristics.present && !h->avctx->hwaccel && + !(h->avctx->export_side_data & AV_CODEC_EXPORT_DATA_FILM_GRAIN); + if ((ret = alloc_picture(h, pic)) < 0) return ret; @@ -1331,14 +1341,14 @@ static int h264_export_frame_props(H264Context *h) } h->sei.unregistered.nb_buf_ref = 0; - if (h->sei.film_grain_characteristics.present && - (h->avctx->export_side_data & AV_CODEC_EXPORT_DATA_FILM_GRAIN)) { + if (h->sei.film_grain_characteristics.present) { H264SEIFilmGrainCharacteristics *fgc = &h->sei.film_grain_characteristics; AVFilmGrainParams *fgp = av_film_grain_params_create_side_data(out); if (!fgp) return AVERROR(ENOMEM); fgp->type = AV_FILM_GRAIN_PARAMS_H274; + fgp->seed = cur->poc + (h->poc_offset << 5); fgp->codec.h274.model_id = fgc->model_id; if (fgc->separate_colour_description_present_flag) { @@ -1382,6 +1392,8 @@ static int h264_export_frame_props(H264Context *h) sizeof(fgp->codec.h274.comp_model_value)); fgc->present = !!fgc->repetition_period; + + h->avctx->properties |= FF_CODEC_PROPERTY_FILM_GRAIN; } if (h->sei.picture_timing.timecode_cnt > 0) { @@ -1547,6 +1559,11 @@ static int h264_field_start(H264Context *h, const H264SliceContext *sl, h->poc.delta_poc[0] = sl->delta_poc[0]; h->poc.delta_poc[1] = sl->delta_poc[1]; + if (nal->type == H264_NAL_IDR_SLICE) + h->poc_offset = sl->idr_pic_id; + else if (h->picture_intra_only) + h->poc_offset = 0; + /* Shorten frame num gaps so we don't have to allocate reference * frames just to throw them away */ if (h->poc.frame_num != h->poc.prev_frame_num) { @@ -1895,8 +1912,10 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, } if (nal->type == H264_NAL_IDR_SLICE) - get_ue_golomb_long(&sl->gb); /* idr_pic_id */ + sl->idr_pic_id = get_ue_golomb_long(&sl->gb); + sl->poc_lsb = 0; + sl->delta_poc_bottom = 0; if (sps->poc_type == 0) { sl->poc_lsb = get_bits(&sl->gb, sps->log2_max_poc_lsb); @@ -1904,6 +1923,7 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl, sl->delta_poc_bottom = get_se_golomb(&sl->gb); } + sl->delta_poc[0] = sl->delta_poc[1] = 0; if (sps->poc_type == 1 && !sps->delta_pic_order_always_zero_flag) { sl->delta_poc[0] = get_se_golomb(&sl->gb); diff --git a/chromium/third_party/ffmpeg/libavcodec/h264dec.c b/chromium/third_party/ffmpeg/libavcodec/h264dec.c index 4d1f2fcd6bb..1cd833fde1b 100644 --- a/chromium/third_party/ffmpeg/libavcodec/h264dec.c +++ b/chromium/third_party/ffmpeg/libavcodec/h264dec.c @@ -273,9 +273,22 @@ int ff_h264_slice_context_init(H264Context *h, H264SliceContext *sl) return 0; } +static int h264_init_pic(H264Picture *pic) +{ + pic->f = av_frame_alloc(); + if (!pic->f) + return AVERROR(ENOMEM); + + pic->f_grain = av_frame_alloc(); + if (!pic->f_grain) + return AVERROR(ENOMEM); + + return 0; +} + static int h264_init_context(AVCodecContext *avctx, H264Context *h) { - int i; + int i, ret; h->avctx = avctx; h->cur_chroma_format_idc = -1; @@ -306,18 +319,15 @@ static int h264_init_context(AVCodecContext *avctx, H264Context *h) } for (i = 0; i < H264_MAX_PICTURE_COUNT; i++) { - h->DPB[i].f = av_frame_alloc(); - if (!h->DPB[i].f) - return AVERROR(ENOMEM); + if ((ret = h264_init_pic(&h->DPB[i])) < 0) + return ret; } - h->cur_pic.f = av_frame_alloc(); - if (!h->cur_pic.f) - return AVERROR(ENOMEM); + if ((ret = h264_init_pic(&h->cur_pic)) < 0) + return ret; - h->last_pic_for_ec.f = av_frame_alloc(); - if (!h->last_pic_for_ec.f) - return AVERROR(ENOMEM); + if ((ret = h264_init_pic(&h->last_pic_for_ec)) < 0) + return ret; for (i = 0; i < h->nb_slice_ctx; i++) h->slice_ctx[i].h264 = h; @@ -325,6 +335,13 @@ static int h264_init_context(AVCodecContext *avctx, H264Context *h) return 0; } +static void h264_free_pic(H264Context *h, H264Picture *pic) +{ + ff_h264_unref_picture(h, pic); + av_frame_free(&pic->f); + av_frame_free(&pic->f_grain); +} + static av_cold int h264_decode_end(AVCodecContext *avctx) { H264Context *h = avctx->priv_data; @@ -334,8 +351,7 @@ static av_cold int h264_decode_end(AVCodecContext *avctx) ff_h264_free_tables(h); for (i = 0; i < H264_MAX_PICTURE_COUNT; i++) { - ff_h264_unref_picture(h, &h->DPB[i]); - av_frame_free(&h->DPB[i].f); + h264_free_pic(h, &h->DPB[i]); } memset(h->delayed_pic, 0, sizeof(h->delayed_pic)); @@ -349,10 +365,8 @@ static av_cold int h264_decode_end(AVCodecContext *avctx) ff_h2645_packet_uninit(&h->pkt); - ff_h264_unref_picture(h, &h->cur_pic); - av_frame_free(&h->cur_pic.f); - ff_h264_unref_picture(h, &h->last_pic_for_ec); - av_frame_free(&h->last_pic_for_ec.f); + h264_free_pic(h, &h->cur_pic); + h264_free_pic(h, &h->last_pic_for_ec); return 0; } @@ -483,6 +497,8 @@ static void h264_decode_flush(AVCodecContext *avctx) static int get_last_needed_nal(H264Context *h) { int nals_needed = 0; + int slice_type = 0; + int picture_intra_only = 1; int first_slice = 0; int i, ret; @@ -514,11 +530,21 @@ static int get_last_needed_nal(H264Context *h) !first_slice || first_slice != nal->type) nals_needed = i; + slice_type = get_ue_golomb_31(&gb); + if (slice_type > 9) + slice_type = 0; + if (slice_type > 4) + slice_type -= 5; + + slice_type = ff_h264_golomb_to_pict_type[slice_type]; + picture_intra_only &= (slice_type & 3) == AV_PICTURE_TYPE_I; if (!first_slice) first_slice = nal->type; } } + h->picture_intra_only = picture_intra_only; + return nals_needed; } @@ -821,13 +847,15 @@ static int h264_export_enc_params(AVFrame *f, H264Picture *p) static int output_frame(H264Context *h, AVFrame *dst, H264Picture *srcp) { - AVFrame *src = srcp->f; int ret; - ret = av_frame_ref(dst, src); + ret = av_frame_ref(dst, srcp->needs_fg ? srcp->f_grain : srcp->f); if (ret < 0) return ret; + if (srcp->needs_fg && (ret = av_frame_copy_props(dst, srcp->f)) < 0) + return ret; + av_dict_set(&dst->metadata, "stereo_mode", ff_h264_sei_stereo_mode(&h->sei.frame_packing), 0); if (srcp->sei_recovery_frame_cnt == 0) @@ -839,6 +867,9 @@ static int output_frame(H264Context *h, AVFrame *dst, H264Picture *srcp) goto fail; } + if (!(h->avctx->export_side_data & AV_CODEC_EXPORT_DATA_FILM_GRAIN)) + av_frame_remove_side_data(dst, AV_FRAME_DATA_FILM_GRAIN_PARAMS); + return 0; fail: av_frame_unref(dst); @@ -916,7 +947,7 @@ static int finalize_frame(H264Context *h, AVFrame *dst, H264Picture *out, int *g out->qscale_table, out->motion_val, NULL, - h->mb_width, h->mb_height, h->mb_stride, 1); + out->mb_width, out->mb_height, out->mb_stride, 1); } } diff --git a/chromium/third_party/ffmpeg/libavcodec/h264dec.h b/chromium/third_party/ffmpeg/libavcodec/h264dec.h index 8954b747956..87c4e4e5396 100644 --- a/chromium/third_party/ffmpeg/libavcodec/h264dec.h +++ b/chromium/third_party/ffmpeg/libavcodec/h264dec.h @@ -43,6 +43,7 @@ #include "h264dsp.h" #include "h264pred.h" #include "h264qpel.h" +#include "h274.h" #include "internal.h" #include "mpegutils.h" #include "parser.h" @@ -130,6 +131,9 @@ typedef struct H264Picture { AVFrame *f; ThreadFrame tf; + AVFrame *f_grain; + ThreadFrame tf_grain; + AVBufferRef *qscale_table_buf; int8_t *qscale_table; @@ -162,6 +166,7 @@ typedef struct H264Picture { int recovered; ///< picture at IDR or recovery point + recovery count int invalid_gap; int sei_recovery_frame_cnt; + int needs_fg; ///< whether picture needs film grain synthesis (see `f_grain`) AVBufferRef *pps_buf; const PPS *pps; @@ -331,6 +336,7 @@ typedef struct H264SliceContext { int explicit_ref_marking; int frame_num; + int idr_pic_id; int poc_lsb; int delta_poc_bottom; int delta_poc[2]; @@ -348,6 +354,7 @@ typedef struct H264Context { H264DSPContext h264dsp; H264ChromaContext h264chroma; H264QpelContext h264qpel; + H274FilmGrainDatabase h274db; H264Picture DPB[H264_MAX_PICTURE_COUNT]; H264Picture *cur_pic_ptr; @@ -384,6 +391,11 @@ typedef struct H264Context { */ int picture_idr; + /* + * Set to 1 when the current picture contains only I slices, 0 otherwise. + */ + int picture_intra_only; + int crop_left; int crop_right; int crop_top; @@ -473,6 +485,7 @@ typedef struct H264Context { int last_pocs[MAX_DELAYED_PIC_COUNT]; H264Picture *next_output_pic; int next_outputed_poc; + int poc_offset; ///< PicOrderCnt_offset from SMPTE RDD-2006 /** * memory management control operations buffer. @@ -833,6 +846,7 @@ static inline int find_start_code(const uint8_t *buf, int buf_size, int ff_h264_field_end(H264Context *h, H264SliceContext *sl, int in_setup); int ff_h264_ref_picture(H264Context *h, H264Picture *dst, H264Picture *src); +int ff_h264_replace_picture(H264Context *h, H264Picture *dst, const H264Picture *src); void ff_h264_unref_picture(H264Context *h, H264Picture *pic); int ff_h264_slice_context_init(H264Context *h, H264SliceContext *sl); diff --git a/chromium/third_party/ffmpeg/libavcodec/h264dsp.h b/chromium/third_party/ffmpeg/libavcodec/h264dsp.h index cbea3173c6a..850d4471fd3 100644 --- a/chromium/third_party/ffmpeg/libavcodec/h264dsp.h +++ b/chromium/third_party/ffmpeg/libavcodec/h264dsp.h @@ -89,16 +89,16 @@ typedef struct H264DSPContext { void (*h264_idct_add16)(uint8_t *dst /*align 16*/, const int *blockoffset, int16_t *block /*align 16*/, int stride, - const uint8_t nnzc[15 * 8]); + const uint8_t nnzc[5 * 8]); void (*h264_idct8_add4)(uint8_t *dst /*align 16*/, const int *blockoffset, int16_t *block /*align 16*/, int stride, - const uint8_t nnzc[15 * 8]); + const uint8_t nnzc[5 * 8]); void (*h264_idct_add8)(uint8_t **dst /*align 16*/, const int *blockoffset, int16_t *block /*align 16*/, int stride, const uint8_t nnzc[15 * 8]); void (*h264_idct_add16intra)(uint8_t *dst /*align 16*/, const int *blockoffset, int16_t *block /*align 16*/, - int stride, const uint8_t nnzc[15 * 8]); + int stride, const uint8_t nnzc[5 * 8]); void (*h264_luma_dc_dequant_idct)(int16_t *output, int16_t *input /*align 16*/, int qmul); void (*h264_chroma_dc_dequant_idct)(int16_t *block, int qmul); diff --git a/chromium/third_party/ffmpeg/libavcodec/h264idct.h b/chromium/third_party/ffmpeg/libavcodec/h264idct.h index 17e0051497b..6f18df9e5f3 100644 --- a/chromium/third_party/ffmpeg/libavcodec/h264idct.h +++ b/chromium/third_party/ffmpeg/libavcodec/h264idct.h @@ -26,11 +26,11 @@ void ff_h264_idct8_add_ ## depth ## _c(uint8_t *dst, int16_t *block, int stride) void ff_h264_idct_add_ ## depth ## _c(uint8_t *dst, int16_t *block, int stride);\ void ff_h264_idct8_dc_add_ ## depth ## _c(uint8_t *dst, int16_t *block, int stride);\ void ff_h264_idct_dc_add_ ## depth ## _c(uint8_t *dst, int16_t *block, int stride);\ -void ff_h264_idct_add16_ ## depth ## _c(uint8_t *dst, const int *blockoffset, int16_t *block, int stride, const uint8_t nnzc[6*8]);\ -void ff_h264_idct_add16intra_ ## depth ## _c(uint8_t *dst, const int *blockoffset, int16_t *block, int stride, const uint8_t nnzc[6*8]);\ -void ff_h264_idct8_add4_ ## depth ## _c(uint8_t *dst, const int *blockoffset, int16_t *block, int stride, const uint8_t nnzc[6*8]);\ -void ff_h264_idct_add8_422_ ## depth ## _c(uint8_t **dest, const int *blockoffset, int16_t *block, int stride, const uint8_t nnzc[6*8]);\ -void ff_h264_idct_add8_ ## depth ## _c(uint8_t **dest, const int *blockoffset, int16_t *block, int stride, const uint8_t nnzc[6*8]);\ +void ff_h264_idct_add16_ ## depth ## _c(uint8_t *dst, const int *blockoffset, int16_t *block, int stride, const uint8_t nnzc[5 * 8]);\ +void ff_h264_idct_add16intra_ ## depth ## _c(uint8_t *dst, const int *blockoffset, int16_t *block, int stride, const uint8_t nnzc[5 * 8]);\ +void ff_h264_idct8_add4_ ## depth ## _c(uint8_t *dst, const int *blockoffset, int16_t *block, int stride, const uint8_t nnzc[5 * 8]);\ +void ff_h264_idct_add8_422_ ## depth ## _c(uint8_t **dest, const int *blockoffset, int16_t *block, int stride, const uint8_t nnzc[15 * 8]);\ +void ff_h264_idct_add8_ ## depth ## _c(uint8_t **dest, const int *blockoffset, int16_t *block, int stride, const uint8_t nnzc[15 * 8]);\ void ff_h264_luma_dc_dequant_idct_ ## depth ## _c(int16_t *output, int16_t *input, int qmul);\ void ff_h264_chroma422_dc_dequant_idct_ ## depth ## _c(int16_t *block, int qmul);\ void ff_h264_chroma_dc_dequant_idct_ ## depth ## _c(int16_t *block, int qmul); diff --git a/chromium/third_party/ffmpeg/libavcodec/h264idct_template.c b/chromium/third_party/ffmpeg/libavcodec/h264idct_template.c index ce66ed3ab88..ec0b428c275 100644 --- a/chromium/third_party/ffmpeg/libavcodec/h264idct_template.c +++ b/chromium/third_party/ffmpeg/libavcodec/h264idct_template.c @@ -171,7 +171,10 @@ void FUNCC(ff_h264_idct8_dc_add)(uint8_t *_dst, int16_t *_block, int stride){ } } -void FUNCC(ff_h264_idct_add16)(uint8_t *dst, const int *block_offset, int16_t *block, int stride, const uint8_t nnzc[15*8]){ +void FUNCC(ff_h264_idct_add16)(uint8_t *dst, const int *block_offset, + int16_t *block, int stride, + const uint8_t nnzc[5 * 8]) +{ int i; for(i=0; i<16; i++){ int nnz = nnzc[ scan8[i] ]; @@ -182,7 +185,10 @@ void FUNCC(ff_h264_idct_add16)(uint8_t *dst, const int *block_offset, int16_t *b } } -void FUNCC(ff_h264_idct_add16intra)(uint8_t *dst, const int *block_offset, int16_t *block, int stride, const uint8_t nnzc[15*8]){ +void FUNCC(ff_h264_idct_add16intra)(uint8_t *dst, const int *block_offset, + int16_t *block, int stride, + const uint8_t nnzc[5 * 8]) +{ int i; for(i=0; i<16; i++){ if(nnzc[ scan8[i] ]) FUNCC(ff_h264_idct_add )(dst + block_offset[i], block + i*16*sizeof(pixel), stride); @@ -190,7 +196,10 @@ void FUNCC(ff_h264_idct_add16intra)(uint8_t *dst, const int *block_offset, int16 } } -void FUNCC(ff_h264_idct8_add4)(uint8_t *dst, const int *block_offset, int16_t *block, int stride, const uint8_t nnzc[15*8]){ +void FUNCC(ff_h264_idct8_add4)(uint8_t *dst, const int *block_offset, + int16_t *block, int stride, + const uint8_t nnzc[5 * 8]) +{ int i; for(i=0; i<16; i+=4){ int nnz = nnzc[ scan8[i] ]; diff --git a/chromium/third_party/ffmpeg/libavcodec/h265_profile_level.h b/chromium/third_party/ffmpeg/libavcodec/h265_profile_level.h index f1a11f51dc3..cd30ac5c504 100644 --- a/chromium/third_party/ffmpeg/libavcodec/h265_profile_level.h +++ b/chromium/third_party/ffmpeg/libavcodec/h265_profile_level.h @@ -25,7 +25,7 @@ typedef struct H265LevelDescriptor { - const char *name; + char name[4]; // Large enough for all current levels like "4.1" uint8_t level_idc; // Table A.6. diff --git a/chromium/third_party/ffmpeg/libavcodec/h274.c b/chromium/third_party/ffmpeg/libavcodec/h274.c new file mode 100644 index 00000000000..262106733ce --- /dev/null +++ b/chromium/third_party/ffmpeg/libavcodec/h274.c @@ -0,0 +1,792 @@ +/* + * H.274 film grain synthesis + * Copyright (c) 2021 Niklas Haas <ffmpeg@haasn.xyz> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * H.274 film grain synthesis. + * @author Niklas Haas <ffmpeg@haasn.xyz> + */ + +#include "libavutil/avassert.h" +#include "libavutil/imgutils.h" + +#include "h274.h" + +static const int8_t Gaussian_LUT[2048+4]; +static const uint32_t Seed_LUT[256]; +static const int8_t R64T[64][64]; + +static void prng_shift(uint32_t *state) +{ + // Primitive polynomial x^31 + x^3 + 1 (modulo 2) + uint32_t x = *state; + uint8_t feedback = (x >> 2) ^ (x >> 30); + *state = (x << 1) | (feedback & 1u); +} + +static void init_slice_c(int8_t out[64][64], uint8_t h, uint8_t v, + int16_t tmp[64][64]) +{ + static const uint8_t deblock_factors[13] = { + 64, 71, 77, 84, 90, 96, 103, 109, 116, 122, 128, 128, 128 + }; + + const uint8_t deblock_coeff = deblock_factors[v]; + const uint8_t freq_h = ((h + 3) << 2) - 1; + const uint8_t freq_v = ((v + 3) << 2) - 1; + uint32_t seed = Seed_LUT[h + v * 13]; + + // Initialize with random gaussian values, using the output array as a + // temporary buffer for these intermediate values. + // + // Note: To make the subsequent matrix multiplication cache friendlier, we + // store each *column* of the starting image in a *row* of `out` + for (int y = 0; y <= freq_v; y++) { + for (int x = 0; x <= freq_h; x += 4) { + uint16_t offset = seed % 2048; + out[x + 0][y] = Gaussian_LUT[offset + 0]; + out[x + 1][y] = Gaussian_LUT[offset + 1]; + out[x + 2][y] = Gaussian_LUT[offset + 2]; + out[x + 3][y] = Gaussian_LUT[offset + 3]; + prng_shift(&seed); + } + } + + out[0][0] = 0; + + // 64x64 inverse integer transform + for (int y = 0; y < 64; y++) { + for (int x = 0; x <= freq_h; x++) { + int32_t sum = 0; + for (int p = 0; p <= freq_v; p++) + sum += R64T[y][p] * out[x][p]; + tmp[y][x] = (sum + 128) >> 8; + } + } + + for (int y = 0; y < 64; y++) { + for (int x = 0; x < 64; x++) { + int32_t sum = 0; + for (int p = 0; p <= freq_h; p++) + sum += tmp[y][p] * R64T[x][p]; // R64T^T = R64 + // Renormalize and clip to [-127, 127] + out[y][x] = av_clip((sum + 128) >> 8, -127, 127); + } + } + + // Deblock horizontal edges by simple attentuation of values + for (int y = 0; y < 64; y += 8) { + for (int x = 0; x < 64; x++) { + out[y + 0][x] = (out[y + 0][x] * deblock_coeff) >> 7; + out[y + 7][x] = (out[y + 7][x] * deblock_coeff) >> 7; + } + } +} + +static void init_slice(H274FilmGrainDatabase *database, uint8_t h, uint8_t v) +{ + if (database->residency[h] & (1 << v)) + return; + + database->residency[h] |= (1 << v); + init_slice_c(database->db[h][v], h, v, database->slice_tmp); +} + +// Computes the average of an 8x8 block, right-shifted by 6 +static uint16_t avg_8x8_c(const uint8_t *in, int in_stride) +{ + uint16_t avg[8] = {0}; // summing over an array vectorizes better + + for (int y = 0; y < 8; y++) { + for (int x = 0; x < 8; x++) + avg[x] += in[x]; + in += in_stride; + } + + return (avg[0] + avg[1] + avg[2] + avg[3] + + avg[4] + avg[5] + avg[6] + avg[7]) >> 6; +} + +// Synthesize an 8x8 block of film grain by copying the pattern from `db` +static void synth_grain_8x8_c(int8_t *out, const int out_stride, + const int16_t scale, const uint8_t shift, + const int8_t *db) +{ + for (int y = 0; y < 8; y++) { + for (int x = 0; x < 8; x++) + out[x] = (scale * db[x]) >> shift; + + out += out_stride; + db += 64; + } +} + +// Deblock vertical edges of an 8x8 block, mixing with the previous block +static void deblock_8x8_c(int8_t *out, const int out_stride) +{ + for (int y = 0; y < 8; y++) { + const int8_t l1 = out[-2], l0 = out[-1]; + const int8_t r0 = out[0], r1 = out[1]; + out[0] = (l0 + (r0 << 1) + r1) >> 2; + out[-1] = (r0 + (l0 << 1) + l1) >> 2; + out += out_stride; + } +} + +// Generates a single 8x8 block of grain, optionally also applying the +// deblocking step (note that this implies writing to the previous block). +static av_always_inline void generate(int8_t *out, int out_stride, + const uint8_t *in, int in_stride, + H274FilmGrainDatabase *database, + const AVFilmGrainH274Params *h274, + int c, int invert, int deblock, + int y_offset, int x_offset) +{ + const uint8_t shift = h274->log2_scale_factor + 6; + const uint16_t avg = avg_8x8_c(in, in_stride); + int16_t scale; + uint8_t h, v; + int8_t s = -1; + + // FIXME: This logic only generates grain with a single + // intensity interval. Strictly speaking, the H.274 specification allows + // for overlapping intensity intervals, however SMPTE RDD 5-2006 (which + // concerns the implementation of H.274 for H.264) forbids this as it + // requires a nontrivial grain synthesis process (FFT). + // + // In principle, we should detect this possibility ahead of time and warn + // the user that the output is unlikely to be correct, or alternatively + // return an AVERROR_PATCHWELCOME. + for (int i = 0; i < h274->num_intensity_intervals[c]; i++) { + if (avg >= h274->intensity_interval_lower_bound[c][i] && + avg <= h274->intensity_interval_upper_bound[c][i]) + { + s = i; + break; + } + } + + if (s < 0) { + // No matching intensity interval, synthesize blank film grain + for (int y = 0; y < 8; y++) + memset(out + y * out_stride, 0, sizeof(int8_t[8])); + return; + } + + h = av_clip(h274->comp_model_value[c][s][1], 2, 14) - 2; + v = av_clip(h274->comp_model_value[c][s][2], 2, 14) - 2; + init_slice(database, h, v); + + scale = h274->comp_model_value[c][s][0]; + if (invert) + scale = -scale; + + synth_grain_8x8_c(out, out_stride, scale, shift, + &database->db[h][v][y_offset][x_offset]); + + if (deblock) + deblock_8x8_c(out, out_stride); +} + +// Saturating 8-bit sum of a+b +static void add_8x8_clip_c(uint8_t *out, const uint8_t *a, const int8_t *b, + int n) +{ + for (int i = 0; i < n; i++) + out[i] = av_clip_uint8(a[i] + b[i]); +} + +int ff_h274_apply_film_grain(AVFrame *out_frame, const AVFrame *in_frame, + H274FilmGrainDatabase *database, + const AVFilmGrainParams *params) +{ + AVFilmGrainH274Params h274 = params->codec.h274; + av_assert1(params->type == AV_FILM_GRAIN_PARAMS_H274); + if (h274.model_id != 0) + return AVERROR_PATCHWELCOME; + + av_assert1(out_frame->format == in_frame->format); + if (in_frame->format != AV_PIX_FMT_YUV420P) + return AVERROR_PATCHWELCOME; + + for (int c = 0; c < 3; c++) { + static const uint8_t color_offset[3] = { 0, 85, 170 }; + uint32_t seed = Seed_LUT[(params->seed + color_offset[c]) % 256]; + const int width = c > 0 ? AV_CEIL_RSHIFT(out_frame->width, 1) : out_frame->width; + const int height = c > 0 ? AV_CEIL_RSHIFT(out_frame->height, 1) : out_frame->height; + + uint8_t * const out = out_frame->data[c]; + const int out_stride = out_frame->linesize[c]; + int8_t * const grain = out_frame->data[c]; // re-use output buffer for grain + const int grain_stride = out_stride; + const uint8_t * const in = in_frame->data[c]; + const int in_stride = in_frame->linesize[c]; + + if (!h274.component_model_present[c]) { + av_image_copy_plane(out, out_stride, in, in_stride, + width * sizeof(uint8_t), height); + continue; + } + + if (c > 0) { + // Adaptation for 4:2:0 chroma subsampling + for (int i = 0; i < h274.num_intensity_intervals[c]; i++) { + h274.comp_model_value[c][i][0] >>= 1; + h274.comp_model_value[c][i][1] <<= 1; + h274.comp_model_value[c][i][2] <<= 1; + } + } + + // Film grain synthesis is done in 8x8 blocks, but the PRNG state is + // only advanced in 16x16 blocks, so use a nested loop + for (int y = 0; y < height; y += 16) { + for (int x = 0; x < width; x += 16) { + uint16_t y_offset = (seed >> 16) % 52; + uint16_t x_offset = (seed & 0xFFFF) % 56; + const int invert = (seed & 0x1); + y_offset &= 0xFFFC; + x_offset &= 0xFFF8; + prng_shift(&seed); + + for (int yy = 0; yy < 16 && y+yy < height; yy += 8) { + for (int xx = 0; xx < 16 && x+xx < width; xx += 8) { + generate(grain + (y+yy) * grain_stride + (x+xx), grain_stride, + in + (y+yy) * in_stride + (x+xx), in_stride, + database, &h274, c, invert, (x+xx) > 0, + y_offset + yy, x_offset + xx); + } + } + } + } + + // Final output blend pass, done after grain synthesis is complete + // because deblocking depends on previous grain values + for (int y = 0; y < height; y++) { + add_8x8_clip_c(out + y * out_stride, in + y * in_stride, + grain + y * grain_stride, width); + } + } + + return 0; +} + +// These tables are all taken from the SMPTE RDD 5-2006 specification +static const int8_t Gaussian_LUT[2048+4] = { + -11, 12, 103, -11, 42, -35, 12, 59, 77, 98, -87, 3, 65, -78, 45, 56, -51, 21, + 13, -11, -20, -19, 33, -127, 17, -6, -105, 18, 19, 71, 48, -10, -38, 42, + -2, 75, -67, 52, -90, 33, -47, 21, -3, -56, 49, 1, -57, -42, -1, 120, -127, + -108, -49, 9, 14, 127, 122, 109, 52, 127, 2, 7, 114, 19, 30, 12, 77, 112, + 82, -61, -127, 111, -52, -29, 2, -49, -24, 58, -29, -73, 12, 112, 67, 79, + -3, -114, -87, -6, -5, 40, 58, -81, 49, -27, -31, -34, -105, 50, 16, -24, + -35, -14, -15, -127, -55, -22, -55, -127, -112, 5, -26, -72, 127, 127, -2, + 41, 87, -65, -16, 55, 19, 91, -81, -65, -64, 35, -7, -54, 99, -7, 88, 125, + -26, 91, 0, 63, 60, -14, -23, 113, -33, 116, 14, 26, 51, -16, 107, -8, 53, + 38, -34, 17, -7, 4, -91, 6, 63, 63, -15, 39, -36, 19, 55, 17, -51, 40, 33, + -37, 126, -39, -118, 17, -30, 0, 19, 98, 60, 101, -12, -73, -17, -52, 98, + 3, 3, 60, 33, -3, -2, 10, -42, -106, -38, 14, 127, 16, -127, -31, -86, -39, + -56, 46, -41, 75, 23, -19, -22, -70, 74, -54, -2, 32, -45, 17, -92, 59, + -64, -67, 56, -102, -29, -87, -34, -92, 68, 5, -74, -61, 93, -43, 14, -26, + -38, -126, -17, 16, -127, 64, 34, 31, 93, 17, -51, -59, 71, 77, 81, 127, + 127, 61, 33, -106, -93, 0, 0, 75, -69, 71, 127, -19, -111, 30, 23, 15, 2, + 39, 92, 5, 42, 2, -6, 38, 15, 114, -30, -37, 50, 44, 106, 27, 119, 7, -80, + 25, -68, -21, 92, -11, -1, 18, 41, -50, 79, -127, -43, 127, 18, 11, -21, + 32, -52, 27, -88, -90, -39, -19, -10, 24, -118, 72, -24, -44, 2, 12, 86, + -107, 39, -33, -127, 47, 51, -24, -22, 46, 0, 15, -35, -69, -2, -74, 24, + -6, 0, 29, -3, 45, 32, -32, 117, -45, 79, -24, -17, -109, -10, -70, 88, + -48, 24, -91, 120, -37, 50, -127, 58, 32, -82, -10, -17, -7, 46, -127, -15, + 89, 127, 17, 98, -39, -33, 37, 42, -40, -32, -21, 105, -19, 19, 19, -59, + -9, 30, 0, -127, 34, 127, -84, 75, 24, -40, -49, -127, -107, -14, 45, -75, + 1, 30, -20, 41, -68, -40, 12, 127, -3, 5, 20, -73, -59, -127, -3, -3, -53, + -6, -119, 93, 120, -80, -50, 0, 20, -46, 67, 78, -12, -22, -127, 36, -41, + 56, 119, -5, -116, -22, 68, -14, -90, 24, -82, -44, -127, 107, -25, -37, + 40, -7, -7, -82, 5, -87, 44, -34, 9, -127, 39, 70, 49, -63, 74, -49, 109, + -27, -89, -47, -39, 44, 49, -4, 60, -42, 80, 9, -127, -9, -56, -49, 125, + -66, 47, 36, 117, 15, -11, -96, 109, 94, -17, -56, 70, 8, -14, -5, 50, 37, + -45, 120, -30, -76, 40, -46, 6, 3, 69, 17, -78, 1, -79, 6, 127, 43, 26, + 127, -127, 28, -55, -26, 55, 112, 48, 107, -1, -77, -1, 53, -9, -22, -43, + 123, 108, 127, 102, 68, 46, 5, 1, 123, -13, -55, -34, -49, 89, 65, -105, + -5, 94, -53, 62, 45, 30, 46, 18, -35, 15, 41, 47, -98, -24, 94, -75, 127, + -114, 127, -68, 1, -17, 51, -95, 47, 12, 34, -45, -75, 89, -107, -9, -58, + -29, -109, -24, 127, -61, -13, 77, -45, 17, 19, 83, -24, 9, 127, -66, 54, + 4, 26, 13, 111, 43, -113, -22, 10, -24, 83, 67, -14, 75, -123, 59, 127, + -12, 99, -19, 64, -38, 54, 9, 7, 61, -56, 3, -57, 113, -104, -59, 3, -9, + -47, 74, 85, -55, -34, 12, 118, 28, 93, -72, 13, -99, -72, -20, 30, 72, + -94, 19, -54, 64, -12, -63, -25, 65, 72, -10, 127, 0, -127, 103, -20, -73, + -112, -103, -6, 28, -42, -21, -59, -29, -26, 19, -4, -51, 94, -58, -95, + -37, 35, 20, -69, 127, -19, -127, -22, -120, -53, 37, 74, -127, -1, -12, + -119, -53, -28, 38, 69, 17, 16, -114, 89, 62, 24, 37, -23, 49, -101, -32, + -9, -95, -53, 5, 93, -23, -49, -8, 51, 3, -75, -90, -10, -39, 127, -86, + -22, 20, 20, 113, 75, 52, -31, 92, -63, 7, -12, 46, 36, 101, -43, -17, -53, + -7, -38, -76, -31, -21, 62, 31, 62, 20, -127, 31, 64, 36, 102, -85, -10, + 77, 80, 58, -79, -8, 35, 8, 80, -24, -9, 3, -17, 72, 127, 83, -87, 55, 18, + -119, -123, 36, 10, 127, 56, -55, 113, 13, 26, 32, -13, -48, 22, -13, 5, + 58, 27, 24, 26, -11, -36, 37, -92, 78, 81, 9, 51, 14, 67, -13, 0, 32, 45, + -76, 32, -39, -22, -49, -127, -27, 31, -9, 36, 14, 71, 13, 57, 12, -53, + -86, 53, -44, -35, 2, 127, 12, -66, -44, 46, -115, 3, 10, 56, -35, 119, + -19, -61, 52, -59, -127, -49, -23, 4, -5, 17, -82, -6, 127, 25, 79, 67, 64, + -25, 14, -64, -37, -127, -28, 21, -63, 66, -53, -41, 109, -62, 15, -22, 13, + 29, -63, 20, 27, 95, -44, -59, -116, -10, 79, -49, 22, -43, -16, 46, -47, + -120, -36, -29, -52, -44, 29, 127, -13, 49, -9, -127, 75, -28, -23, 88, 59, + 11, -95, 81, -59, 58, 60, -26, 40, -92, -3, -22, -58, -45, -59, -22, -53, + 71, -29, 66, -32, -23, 14, -17, -66, -24, -28, -62, 47, 38, 17, 16, -37, + -24, -11, 8, -27, -19, 59, 45, -49, -47, -4, -22, -81, 30, -67, -127, 74, + 102, 5, -18, 98, 34, -66, 42, -52, 7, -59, 24, -58, -19, -24, -118, -73, + 91, 15, -16, 79, -32, -79, -127, -36, 41, 77, -83, 2, 56, 22, -75, 127, + -16, -21, 12, 31, 56, -113, -127, 90, 55, 61, 12, 55, -14, -113, -14, 32, + 49, -67, -17, 91, -10, 1, 21, 69, -70, 99, -19, -112, 66, -90, -10, -9, + -71, 127, 50, -81, -49, 24, 61, -61, -111, 7, -41, 127, 88, -66, 108, -127, + -6, 36, -14, 41, -50, 14, 14, 73, -101, -28, 77, 127, -8, -100, 88, 38, + 121, 88, -125, -60, 13, -94, -115, 20, -67, -87, -94, -119, 44, -28, -30, + 18, 5, -53, -61, 20, -43, 11, -77, -60, 13, 29, 3, 6, -72, 38, -60, -11, + 108, -53, 41, 66, -12, -127, -127, -49, 24, 29, 46, 36, 91, 34, -33, 116, + -51, -34, -52, 91, 7, -83, 73, -26, -103, 24, -10, 76, 84, 5, 68, -80, -13, + -17, -32, -48, 20, 50, 26, 10, 63, -104, -14, 37, 127, 114, 97, 35, 1, -33, + -55, 127, -124, -33, 61, -7, 119, -32, -127, -53, -42, 63, 3, -5, -26, 70, + -58, -33, -44, -43, 34, -56, -127, 127, 25, -35, -11, 16, -81, 29, -58, 40, + -127, -127, 20, -47, -11, -36, -63, -52, -32, -82, 78, -76, -73, 8, 27, + -72, -9, -74, -85, -86, -57, 25, 78, -10, -97, 35, -65, 8, -59, 14, 1, -42, + 32, -88, -44, 17, -3, -9, 59, 40, 12, -108, -40, 24, 34, 18, -28, 2, 51, + -110, -4, 100, 1, 65, 22, 0, 127, 61, 45, 25, -31, 6, 9, -7, -48, 99, 16, + 44, -2, -40, 32, -39, -52, 10, -110, -19, 56, -127, 69, 26, 51, 92, 40, 61, + -52, 45, -38, 13, 85, 122, 27, 66, 45, -111, -83, -3, 31, 37, 19, -36, 58, + 71, 39, -78, -47, 58, -78, 8, -62, -36, -14, 61, 42, -127, 71, -4, 24, -54, + 52, -127, 67, -4, -42, 30, -63, 59, -3, -1, -18, -46, -92, -81, -96, -14, + -53, -10, -11, -77, 13, 1, 8, -67, -127, 127, -28, 26, -14, 18, -13, -26, + 2, 10, -46, -32, -15, 27, -31, -59, 59, 77, -121, 28, 40, -54, -62, -31, + -21, -37, -32, -6, -127, -25, -60, 70, -127, 112, -127, 127, 88, -7, 116, + 110, 53, 87, -127, 3, 16, 23, 74, -106, -51, 3, 74, -82, -112, -74, 65, 81, + 25, 53, 127, -45, -50, -103, -41, -65, -29, 79, -67, 64, -33, -30, -8, 127, + 0, -13, -51, 67, -14, 5, -92, 29, -35, -8, -90, -57, -3, 36, 43, 44, -31, + -69, -7, 36, 39, -51, 43, -81, 58, 6, 127, 12, 57, 66, 46, 59, -43, -42, + 41, -15, -120, 24, 3, -11, 19, -13, 51, 28, 3, 55, -48, -12, -1, 2, 97, + -19, 29, 42, 13, 43, 78, -44, 56, -108, -43, -19, 127, 15, -11, -18, -81, + 83, -37, 77, -109, 15, 65, -50, 43, 12, 13, 27, 28, 61, 57, 30, 26, 106, + -18, 56, 13, 97, 4, -8, -62, -103, 94, 108, -44, 52, 27, -47, -9, 105, -53, + 46, 89, 103, -33, 38, -34, 55, 51, 70, -94, -35, -87, -107, -19, -31, 9, + -19, 79, -14, 77, 5, -19, -107, 85, 21, -45, -39, -42, 9, -29, 74, 47, -75, + 60, -127, 120, -112, -57, -32, 41, 7, 79, 76, 66, 57, 41, -25, 31, 37, -47, + -36, 43, -73, -37, 63, 127, -69, -52, 90, -33, -61, 60, -55, 44, 15, 4, + -67, 13, -92, 64, 29, -39, -3, 83, -2, -38, -85, -86, 58, 35, -69, -61, 29, + -37, -95, -78, 4, 30, -4, -32, -80, -22, -9, -77, 46, 7, -93, -71, 65, 9, + -50, 127, -70, 26, -12, -39, -114, 63, -127, -100, 4, -32, 111, 22, -60, + 65, -101, 26, -42, 21, -59, -27, -74, 2, -94, 6, 126, 5, 76, -88, -9, -43, + -101, 127, 1, 125, 92, -63, 52, 56, 4, 81, -127, 127, 80, 127, -29, 30, + 116, -74, -17, -57, 105, 48, 45, 25, -72, 48, -38, -108, 31, -34, 4, -11, + 41, -127, 52, -104, -43, -37, 52, 2, 47, 87, -9, 77, 27, -41, -25, 90, 86, + -56, 75, 10, 33, 78, 58, 127, 127, -7, -73, 49, -33, -106, -35, 38, 57, 53, + -17, -4, 83, 52, -108, 54, -125, 28, 23, 56, -43, -88, -17, -6, 47, 23, -9, + 0, -13, 111, 75, 27, -52, -38, -34, 39, 30, 66, 39, 38, -64, 38, 3, 21, + -32, -51, -28, 54, -38, -87, 20, 52, 115, 18, -81, -70, 0, -14, -46, -46, + -3, 125, 16, -14, 23, -82, -84, -69, -20, -65, -127, 9, 81, -49, 61, 7, + -36, -45, -42, 57, -26, 47, 20, -85, 46, -13, 41, -37, -75, -60, 86, -78, + -127, 12, 50, 2, -3, 13, 47, 5, 19, -78, -55, -27, 65, -71, 12, -108, 20, + -16, 11, -31, 63, -55, 37, 75, -17, 127, -73, -33, -28, -120, 105, 68, 106, + -103, -106, 71, 61, 2, 23, -3, 33, -5, -15, -67, -15, -23, -54, 15, -63, + 76, 58, -110, 1, 83, -27, 22, 75, -39, -17, -11, 64, -17, -127, -54, -66, + 31, 96, 116, 3, -114, -7, -108, -63, 97, 9, 50, 8, 75, -28, 72, 112, -36, + -112, 95, -50, 23, -13, -19, 55, 21, 23, 92, 91, 22, -49, 16, -75, 23, 9, + -49, -97, -37, 49, -36, 36, -127, -86, 43, 127, -24, -24, 84, 83, -35, -34, + -12, 109, 102, -38, 51, -68, 34, 19, -22, 49, -32, 127, 40, 24, -93, -4, + -3, 105, 3, -58, -18, 8, 127, -18, 125, 68, 69, -62, 30, -36, 54, -57, -24, + 17, 43, -36, -27, -57, -67, -21, -10, -49, 68, 12, 65, 4, 48, 55, 127, -75, + 44, 89, -66, -13, -78, -82, -91, 22, 30, 33, -40, -87, -34, 96, -91, 39, + 10, -64, -3, -12, 127, -50, -37, -56, 23, -35, -36, -54, 90, -91, 2, 50, + 77, -6, -127, 16, 46, -5, -73, 0, -56, -18, -72, 28, 93, 60, 49, 20, 18, + 111, -111, 32, -83, 47, 47, -10, 35, -88, 43, 57, -98, 127, -17, 0, 1, -39, + -127, -2, 0, 63, 93, 0, 36, -66, -61, -19, 39, -127, 58, 50, -17, 127, 88, + -43, -108, -51, -16, 7, -36, 68, 46, -14, 107, 40, 57, 7, 19, 8, 3, 88, + -90, -92, -18, -21, -24, 13, 7, -4, -78, -91, -4, 8, -35, -5, 19, 2, -111, + 4, -66, -81, 122, -20, -34, -37, -84, 127, 68, 46, 17, 47, + + // Repeat the beginning of the array to allow wrapping reads + -11, 12, 103, -11, +}; + +static const uint32_t Seed_LUT[256] = { + 747538460, 1088979410, 1744950180, 1767011913, 1403382928, + 521866116, 1060417601, 2110622736, 1557184770, 105289385, 585624216, + 1827676546, 1191843873, 1018104344, 1123590530, 663361569, 2023850500, + 76561770, 1226763489, 80325252, 1992581442, 502705249, 740409860, + 516219202, 557974537, 1883843076, 720112066, 1640137737, 1820967556, + 40667586, 155354121, 1820967557, 1115949072, 1631803309, 98284748, + 287433856, 2119719977, 988742797, 1827432592, 579378475, 1017745956, + 1309377032, 1316535465, 2074315269, 1923385360, 209722667, 1546228260, + 168102420, 135274561, 355958469, 248291472, 2127839491, 146920100, + 585982612, 1611702337, 696506029, 1386498192, 1258072451, 1212240548, + 1043171860, 1217404993, 1090770605, 1386498193, 169093201, 541098240, + 1468005469, 456510673, 1578687785, 1838217424, 2010752065, 2089828354, + 1362717428, 970073673, 854129835, 714793201, 1266069081, 1047060864, + 1991471829, 1098097741, 913883585, 1669598224, 1337918685, 1219264706, + 1799741108, 1834116681, 683417731, 1120274457, 1073098457, 1648396544, + 176642749, 31171789, 718317889, 1266977808, 1400892508, 549749008, + 1808010512, 67112961, 1005669825, 903663673, 1771104465, 1277749632, + 1229754427, 950632997, 1979371465, 2074373264, 305357524, 1049387408, + 1171033360, 1686114305, 2147468765, 1941195985, 117709841, 809550080, + 991480851, 1816248997, 1561503561, 329575568, 780651196, 1659144592, + 1910793616, 604016641, 1665084765, 1530186961, 1870928913, 809550081, + 2079346113, 71307521, 876663040, 1073807360, 832356664, 1573927377, + 204073344, 2026918147, 1702476788, 2043881033, 57949587, 2001393952, + 1197426649, 1186508931, 332056865, 950043140, 890043474, 349099312, + 148914948, 236204097, 2022643605, 1441981517, 498130129, 1443421481, + 924216797, 1817491777, 1913146664, 1411989632, 929068432, 495735097, + 1684636033, 1284520017, 432816184, 1344884865, 210843729, 676364544, + 234449232, 12112337, 1350619139, 1753272996, 2037118872, 1408560528, + 533334916, 1043640385, 357326099, 201376421, 110375493, 541106497, + 416159637, 242512193, 777294080, 1614872576, 1535546636, 870600145, + 910810409, 1821440209, 1605432464, 1145147393, 951695441, 1758494976, + 1506656568, 1557150160, 608221521, 1073840384, 217672017, 684818688, + 1750138880, 16777217, 677990609, 953274371, 1770050213, 1359128393, + 1797602707, 1984616737, 1865815816, 2120835200, 2051677060, 1772234061, + 1579794881, 1652821009, 1742099468, 1887260865, 46468113, 1011925248, + 1134107920, 881643832, 1354774993, 472508800, 1892499769, 1752793472, + 1962502272, 687898625, 883538000, 1354355153, 1761673473, 944820481, + 2020102353, 22020353, 961597696, 1342242816, 964808962, 1355809701, + 17016649, 1386540177, 647682692, 1849012289, 751668241, 1557184768, + 127374604, 1927564752, 1045744913, 1614921984, 43588881, 1016185088, + 1544617984, 1090519041, 136122424, 215038417, 1563027841, 2026918145, + 1688778833, 701530369, 1372639488, 1342242817, 2036945104, 953274369, + 1750192384, 16842753, 964808960, 1359020032, 1358954497 +}; + +// Note: This is pre-transposed, i.e. stored column-major order +static const int8_t R64T[64][64] = { + { + 32, 45, 45, 45, 45, 45, 45, 45, 44, 44, 44, 44, 43, 43, 43, 42, + 42, 41, 41, 40, 40, 39, 39, 38, 38, 37, 36, 36, 35, 34, 34, 33, + 32, 31, 30, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, + 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 4, 3, 2, 1, + }, { + 32, 45, 45, 44, 43, 42, 41, 39, 38, 36, 34, 31, 29, 26, 23, 20, + 17, 14, 11, 8, 4, 1, -2, -6, -9, -12, -15, -18, -21, -24, -27, -30, + -32, -34, -36, -38, -40, -41, -43, -44, -44, -45, -45, -45, -45, -45, -44, -43, + -42, -40, -39, -37, -35, -33, -30, -28, -25, -22, -19, -16, -13, -10, -7, -3, + }, { + 32, 45, 44, 42, 40, 37, 34, 30, 25, 20, 15, 10, 4, -1, -7, -12, + -17, -22, -27, -31, -35, -38, -41, -43, -44, -45, -45, -45, -43, -41, -39, -36, + -32, -28, -23, -18, -13, -8, -2, 3, 9, 14, 19, 24, 29, 33, 36, 39, + 42, 44, 45, 45, 45, 44, 43, 40, 38, 34, 30, 26, 21, 16, 11, 6, + }, { + 32, 45, 43, 39, 35, 30, 23, 16, 9, 1, -7, -14, -21, -28, -34, -38, + -42, -44, -45, -45, -43, -40, -36, -31, -25, -18, -11, -3, 4, 12, 19, 26, + 32, 37, 41, 44, 45, 45, 44, 41, 38, 33, 27, 20, 13, 6, -2, -10, + -17, -24, -30, -36, -40, -43, -45, -45, -44, -42, -39, -34, -29, -22, -15, -8, + }, { + 32, 44, 41, 36, 29, 20, 11, 1, -9, -18, -27, -34, -40, -44, -45, -45, + -42, -37, -30, -22, -13, -3, 7, 16, 25, 33, 39, 43, 45, 45, 43, 38, + 32, 24, 15, 6, -4, -14, -23, -31, -38, -42, -45, -45, -43, -39, -34, -26, + -17, -8, 2, 12, 21, 30, 36, 41, 44, 45, 44, 40, 35, 28, 19, 10, + }, { + 32, 44, 39, 31, 21, 10, -2, -14, -25, -34, -41, -45, -45, -42, -36, -28, + -17, -6, 7, 18, 29, 37, 43, 45, 44, 40, 34, 24, 13, 1, -11, -22, + -32, -39, -44, -45, -43, -38, -30, -20, -9, 3, 15, 26, 35, 41, 45, 45, + 42, 36, 27, 16, 4, -8, -19, -30, -38, -43, -45, -44, -40, -33, -23, -12, + }, { + 32, 43, 36, 26, 13, -1, -15, -28, -38, -44, -45, -42, -35, -24, -11, 3, + 17, 30, 39, 44, 45, 41, 34, 22, 9, -6, -19, -31, -40, -45, -45, -40, + -32, -20, -7, 8, 21, 33, 41, 45, 44, 39, 30, 18, 4, -10, -23, -34, + -42, -45, -44, -38, -29, -16, -2, 12, 25, 36, 43, 45, 43, 37, 27, 14, + }, { + 32, 42, 34, 20, 4, -12, -27, -38, -44, -45, -39, -28, -13, 3, 19, 33, + 42, 45, 43, 34, 21, 6, -11, -26, -38, -44, -45, -39, -29, -14, 2, 18, + 32, 41, 45, 43, 35, 22, 7, -10, -25, -37, -44, -45, -40, -30, -15, 1, + 17, 31, 41, 45, 43, 36, 23, 8, -9, -24, -36, -44, -45, -40, -30, -16, + }, { + 32, 41, 30, 14, -4, -22, -36, -44, -44, -37, -23, -6, 13, 30, 41, 45, + 42, 31, 15, -3, -21, -36, -44, -45, -38, -24, -7, 12, 29, 40, 45, 42, + 32, 16, -2, -20, -35, -44, -45, -38, -25, -8, 11, 28, 40, 45, 43, 33, + 17, -1, -19, -34, -43, -45, -39, -26, -9, 10, 27, 39, 45, 43, 34, 18, + }, { + 32, 40, 27, 8, -13, -31, -43, -45, -38, -22, -2, 18, 35, 44, 44, 34, + 17, -3, -23, -38, -45, -42, -30, -12, 9, 28, 41, 45, 40, 26, 7, -14, + -32, -43, -45, -37, -21, -1, 19, 36, 44, 44, 34, 16, -4, -24, -39, -45, + -42, -30, -11, 10, 29, 41, 45, 39, 25, 6, -15, -33, -43, -45, -36, -20, + }, { + 32, 39, 23, 1, -21, -38, -45, -40, -25, -3, 19, 37, 45, 41, 27, 6, + -17, -36, -45, -42, -29, -8, 15, 34, 44, 43, 30, 10, -13, -33, -44, -44, + -32, -12, 11, 31, 43, 44, 34, 14, -9, -30, -43, -45, -35, -16, 7, 28, + 42, 45, 36, 18, -4, -26, -41, -45, -38, -20, 2, 24, 40, 45, 39, 22, + }, { + 32, 38, 19, -6, -29, -43, -44, -31, -9, 16, 36, 45, 40, 22, -2, -26, + -42, -45, -34, -12, 13, 34, 45, 41, 25, 1, -23, -40, -45, -36, -15, 10, + 32, 44, 43, 28, 4, -20, -39, -45, -38, -18, 7, 30, 43, 44, 30, 8, + -17, -37, -45, -39, -21, 3, 27, 42, 44, 33, 11, -14, -35, -45, -41, -24, + }, { + 32, 37, 15, -12, -35, -45, -39, -18, 9, 33, 45, 40, 21, -6, -30, -44, + -42, -24, 2, 28, 43, 43, 27, 1, -25, -42, -44, -30, -4, 22, 41, 45, + 32, 8, -19, -39, -45, -34, -11, 16, 38, 45, 36, 14, -13, -36, -45, -38, + -17, 10, 34, 45, 40, 20, -7, -31, -44, -41, -23, 3, 29, 44, 43, 26, + }, { + 32, 36, 11, -18, -40, -45, -30, -3, 25, 43, 43, 24, -4, -31, -45, -39, + -17, 12, 36, 45, 35, 10, -19, -40, -44, -30, -2, 26, 43, 42, 23, -6, + -32, -45, -39, -16, 13, 37, 45, 34, 9, -20, -41, -44, -29, -1, 27, 44, + 42, 22, -7, -33, -45, -38, -15, 14, 38, 45, 34, 8, -21, -41, -44, -28, + }, { + 32, 34, 7, -24, -43, -41, -19, 12, 38, 45, 30, 1, -29, -45, -39, -14, + 17, 40, 44, 26, -4, -33, -45, -36, -9, 22, 43, 42, 21, -10, -36, -45, + -32, -3, 27, 44, 40, 16, -15, -39, -44, -28, 2, 31, 45, 37, 11, -20, + -42, -43, -23, 8, 35, 45, 34, 6, -25, -44, -41, -18, 13, 38, 45, 30, + }, { + 32, 33, 2, -30, -45, -36, -7, 26, 44, 38, 11, -22, -43, -40, -15, 18, + 42, 42, 19, -14, -40, -44, -23, 10, 38, 45, 27, -6, -35, -45, -30, 1, + 32, 45, 34, 3, -29, -45, -36, -8, 25, 44, 39, 12, -21, -43, -41, -16, + 17, 41, 43, 20, -13, -39, -44, -24, 9, 37, 45, 28, -4, -34, -45, -31, + }, { + 32, 31, -2, -34, -45, -28, 7, 37, 44, 24, -11, -39, -43, -20, 15, 41, + 42, 16, -19, -43, -40, -12, 23, 44, 38, 8, -27, -45, -35, -3, 30, 45, + 32, -1, -34, -45, -29, 6, 36, 45, 25, -10, -39, -44, -21, 14, 41, 42, + 17, -18, -43, -40, -13, 22, 44, 38, 9, -26, -45, -36, -4, 30, 45, 33, + }, { + 32, 30, -7, -38, -43, -18, 19, 44, 38, 6, -30, -45, -29, 8, 39, 43, + 17, -20, -44, -37, -4, 31, 45, 28, -9, -39, -43, -16, 21, 44, 36, 3, + -32, -45, -27, 10, 40, 42, 15, -22, -44, -36, -2, 33, 45, 26, -11, -40, + -42, -14, 23, 45, 35, 1, -34, -45, -25, 12, 41, 41, 13, -24, -45, -34, + }, { + 32, 28, -11, -41, -40, -8, 30, 45, 25, -14, -43, -38, -4, 33, 45, 22, + -17, -44, -36, -1, 35, 44, 19, -20, -44, -34, 2, 37, 43, 16, -23, -45, + -32, 6, 39, 42, 13, -26, -45, -30, 9, 40, 41, 10, -29, -45, -27, 12, + 42, 39, 7, -31, -45, -24, 15, 43, 38, 3, -34, -45, -21, 18, 44, 36, + }, { + 32, 26, -15, -44, -35, 3, 39, 41, 9, -31, -45, -20, 21, 45, 30, -10, + -42, -38, -2, 36, 43, 14, -27, -45, -25, 16, 44, 34, -4, -39, -41, -8, + 32, 45, 19, -22, -45, -30, 11, 42, 38, 1, -36, -43, -13, 28, 45, 24, + -17, -44, -34, 6, 40, 40, 7, -33, -44, -18, 23, 45, 29, -12, -43, -37, + }, { + 32, 24, -19, -45, -29, 14, 44, 33, -9, -42, -36, 3, 40, 39, 2, -37, + -42, -8, 34, 44, 13, -30, -45, -18, 25, 45, 23, -20, -45, -28, 15, 44, + 32, -10, -43, -36, 4, 40, 39, 1, -38, -41, -7, 34, 43, 12, -30, -45, + -17, 26, 45, 22, -21, -45, -27, 16, 44, 31, -11, -43, -35, 6, 41, 38, + }, { + 32, 22, -23, -45, -21, 24, 45, 20, -25, -45, -19, 26, 45, 18, -27, -45, + -17, 28, 45, 16, -29, -45, -15, 30, 44, 14, -30, -44, -13, 31, 44, 12, + -32, -44, -11, 33, 43, 10, -34, -43, -9, 34, 43, 8, -35, -42, -7, 36, + 42, 6, -36, -41, -4, 37, 41, 3, -38, -40, -2, 38, 40, 1, -39, -39, + }, { + 32, 20, -27, -45, -13, 33, 43, 6, -38, -39, 2, 41, 35, -10, -44, -30, + 17, 45, 23, -24, -45, -16, 30, 44, 9, -36, -41, -1, 40, 37, -7, -43, + -32, 14, 45, 26, -21, -45, -19, 28, 44, 12, -34, -42, -4, 38, 39, -3, + -42, -34, 11, 44, 29, -18, -45, -22, 25, 45, 15, -31, -43, -8, 36, 40, + }, { + 32, 18, -30, -43, -4, 39, 36, -10, -44, -26, 23, 45, 13, -34, -41, 1, + 42, 33, -15, -45, -21, 28, 44, 8, -38, -38, 7, 44, 29, -20, -45, -16, + 32, 42, 2, -40, -35, 12, 45, 24, -25, -45, -11, 36, 40, -3, -43, -31, + 17, 45, 19, -30, -43, -6, 39, 37, -9, -44, -27, 22, 45, 14, -34, -41, + }, { + 32, 16, -34, -40, 4, 44, 27, -24, -44, -8, 39, 36, -13, -45, -19, 31, + 42, -1, -43, -30, 21, 45, 11, -37, -38, 10, 45, 22, -29, -43, -2, 41, + 32, -18, -45, -14, 35, 39, -7, -44, -25, 26, 44, 6, -40, -34, 15, 45, + 17, -33, -41, 3, 43, 28, -23, -45, -9, 38, 36, -12, -45, -20, 30, 42, + }, { + 32, 14, -36, -37, 13, 45, 15, -36, -38, 12, 45, 16, -35, -38, 11, 45, + 17, -34, -39, 10, 45, 18, -34, -39, 9, 45, 19, -33, -40, 8, 45, 20, + -32, -40, 7, 45, 21, -31, -41, 6, 44, 22, -30, -41, 4, 44, 23, -30, + -42, 3, 44, 24, -29, -42, 2, 44, 25, -28, -43, 1, 43, 26, -27, -43, + }, { + 32, 12, -39, -33, 21, 44, 2, -43, -25, 30, 41, -8, -45, -16, 36, 36, + -17, -45, -7, 41, 29, -26, -43, 3, 44, 20, -34, -38, 13, 45, 11, -39, + -32, 22, 44, 1, -43, -24, 30, 40, -9, -45, -15, 37, 35, -18, -45, -6, + 42, 28, -27, -42, 4, 45, 19, -34, -38, 14, 45, 10, -40, -31, 23, 44, + }, { + 32, 10, -41, -28, 29, 40, -11, -45, -9, 41, 27, -30, -40, 12, 45, 8, + -42, -26, 30, 39, -13, -45, -7, 42, 25, -31, -39, 14, 45, 6, -43, -24, + 32, 38, -15, -45, -4, 43, 23, -33, -38, 16, 45, 3, -43, -22, 34, 37, + -17, -45, -2, 44, 21, -34, -36, 18, 44, 1, -44, -20, 35, 36, -19, -44, + }, { + 32, 8, -43, -22, 35, 34, -23, -42, 9, 45, 7, -43, -21, 36, 34, -24, + -42, 10, 45, 6, -43, -20, 36, 33, -25, -41, 11, 45, 4, -44, -19, 37, + 32, -26, -41, 12, 45, 3, -44, -18, 38, 31, -27, -40, 13, 45, 2, -44, + -17, 38, 30, -28, -40, 14, 45, 1, -44, -16, 39, 30, -29, -39, 15, 45, + }, { + 32, 6, -44, -16, 40, 26, -34, -34, 25, 40, -15, -44, 4, 45, 7, -44, + -17, 39, 27, -33, -35, 24, 41, -14, -44, 3, 45, 8, -43, -18, 39, 28, + -32, -36, 23, 41, -13, -45, 2, 45, 9, -43, -19, 38, 29, -31, -36, 22, + 42, -12, -45, 1, 45, 10, -43, -20, 38, 30, -30, -37, 21, 42, -11, -45, + }, { + 32, 3, -45, -10, 43, 16, -41, -22, 38, 28, -34, -33, 29, 37, -23, -40, + 17, 43, -11, -45, 4, 45, 2, -45, -9, 44, 15, -41, -21, 38, 27, -34, + -32, 30, 36, -24, -40, 18, 43, -12, -44, 6, 45, 1, -45, -8, 44, 14, + -42, -20, 39, 26, -35, -31, 30, 36, -25, -39, 19, 42, -13, -44, 7, 45, + }, { + 32, 1, -45, -3, 45, 6, -45, -8, 44, 10, -44, -12, 43, 14, -43, -16, + 42, 18, -41, -20, 40, 22, -39, -24, 38, 26, -36, -28, 35, 30, -34, -31, + 32, 33, -30, -34, 29, 36, -27, -37, 25, 38, -23, -39, 21, 40, -19, -41, + 17, 42, -15, -43, 13, 44, -11, -44, 9, 45, -7, -45, 4, 45, -2, -45, + }, { + 32, -1, -45, 3, 45, -6, -45, 8, 44, -10, -44, 12, 43, -14, -43, 16, + 42, -18, -41, 20, 40, -22, -39, 24, 38, -26, -36, 28, 35, -30, -34, 31, + 32, -33, -30, 34, 29, -36, -27, 37, 25, -38, -23, 39, 21, -40, -19, 41, + 17, -42, -15, 43, 13, -44, -11, 44, 9, -45, -7, 45, 4, -45, -2, 45, + }, { + 32, -3, -45, 10, 43, -16, -41, 22, 38, -28, -34, 33, 29, -37, -23, 40, + 17, -43, -11, 45, 4, -45, 2, 45, -9, -44, 15, 41, -21, -38, 27, 34, + -32, -30, 36, 24, -40, -18, 43, 12, -44, -6, 45, -1, -45, 8, 44, -14, + -42, 20, 39, -26, -35, 31, 30, -36, -25, 39, 19, -42, -13, 44, 7, -45, + }, { + 32, -6, -44, 16, 40, -26, -34, 34, 25, -40, -15, 44, 4, -45, 7, 44, + -17, -39, 27, 33, -35, -24, 41, 14, -44, -3, 45, -8, -43, 18, 39, -28, + -32, 36, 23, -41, -13, 45, 2, -45, 9, 43, -19, -38, 29, 31, -36, -22, + 42, 12, -45, -1, 45, -10, -43, 20, 38, -30, -30, 37, 21, -42, -11, 45, + }, { + 32, -8, -43, 22, 35, -34, -23, 42, 9, -45, 7, 43, -21, -36, 34, 24, + -42, -10, 45, -6, -43, 20, 36, -33, -25, 41, 11, -45, 4, 44, -19, -37, + 32, 26, -41, -12, 45, -3, -44, 18, 38, -31, -27, 40, 13, -45, 2, 44, + -17, -38, 30, 28, -40, -14, 45, -1, -44, 16, 39, -30, -29, 39, 15, -45, + }, { + 32, -10, -41, 28, 29, -40, -11, 45, -9, -41, 27, 30, -40, -12, 45, -8, + -42, 26, 30, -39, -13, 45, -7, -42, 25, 31, -39, -14, 45, -6, -43, 24, + 32, -38, -15, 45, -4, -43, 23, 33, -38, -16, 45, -3, -43, 22, 34, -37, + -17, 45, -2, -44, 21, 34, -36, -18, 44, -1, -44, 20, 35, -36, -19, 44, + }, { + 32, -12, -39, 33, 21, -44, 2, 43, -25, -30, 41, 8, -45, 16, 36, -36, + -17, 45, -7, -41, 29, 26, -43, -3, 44, -20, -34, 38, 13, -45, 11, 39, + -32, -22, 44, -1, -43, 24, 30, -40, -9, 45, -15, -37, 35, 18, -45, 6, + 42, -28, -27, 42, 4, -45, 19, 34, -38, -14, 45, -10, -40, 31, 23, -44, + }, { + 32, -14, -36, 37, 13, -45, 15, 36, -38, -12, 45, -16, -35, 38, 11, -45, + 17, 34, -39, -10, 45, -18, -34, 39, 9, -45, 19, 33, -40, -8, 45, -20, + -32, 40, 7, -45, 21, 31, -41, -6, 44, -22, -30, 41, 4, -44, 23, 30, + -42, -3, 44, -24, -29, 42, 2, -44, 25, 28, -43, -1, 43, -26, -27, 43, + }, { + 32, -16, -34, 40, 4, -44, 27, 24, -44, 8, 39, -36, -13, 45, -19, -31, + 42, 1, -43, 30, 21, -45, 11, 37, -38, -10, 45, -22, -29, 43, -2, -41, + 32, 18, -45, 14, 35, -39, -7, 44, -25, -26, 44, -6, -40, 34, 15, -45, + 17, 33, -41, -3, 43, -28, -23, 45, -9, -38, 36, 12, -45, 20, 30, -42, + }, { + 32, -18, -30, 43, -4, -39, 36, 10, -44, 26, 23, -45, 13, 34, -41, -1, + 42, -33, -15, 45, -21, -28, 44, -8, -38, 38, 7, -44, 29, 20, -45, 16, + 32, -42, 2, 40, -35, -12, 45, -24, -25, 45, -11, -36, 40, 3, -43, 31, + 17, -45, 19, 30, -43, 6, 39, -37, -9, 44, -27, -22, 45, -14, -34, 41, + }, { + 32, -20, -27, 45, -13, -33, 43, -6, -38, 39, 2, -41, 35, 10, -44, 30, + 17, -45, 23, 24, -45, 16, 30, -44, 9, 36, -41, 1, 40, -37, -7, 43, + -32, -14, 45, -26, -21, 45, -19, -28, 44, -12, -34, 42, -4, -38, 39, 3, + -42, 34, 11, -44, 29, 18, -45, 22, 25, -45, 15, 31, -43, 8, 36, -40, + }, { + 32, -22, -23, 45, -21, -24, 45, -20, -25, 45, -19, -26, 45, -18, -27, 45, + -17, -28, 45, -16, -29, 45, -15, -30, 44, -14, -30, 44, -13, -31, 44, -12, + -32, 44, -11, -33, 43, -10, -34, 43, -9, -34, 43, -8, -35, 42, -7, -36, + 42, -6, -36, 41, -4, -37, 41, -3, -38, 40, -2, -38, 40, -1, -39, 39, + }, { + 32, -24, -19, 45, -29, -14, 44, -33, -9, 42, -36, -3, 40, -39, 2, 37, + -42, 8, 34, -44, 13, 30, -45, 18, 25, -45, 23, 20, -45, 28, 15, -44, + 32, 10, -43, 36, 4, -40, 39, -1, -38, 41, -7, -34, 43, -12, -30, 45, + -17, -26, 45, -22, -21, 45, -27, -16, 44, -31, -11, 43, -35, -6, 41, -38, + }, { + 32, -26, -15, 44, -35, -3, 39, -41, 9, 31, -45, 20, 21, -45, 30, 10, + -42, 38, -2, -36, 43, -14, -27, 45, -25, -16, 44, -34, -4, 39, -41, 8, + 32, -45, 19, 22, -45, 30, 11, -42, 38, -1, -36, 43, -13, -28, 45, -24, + -17, 44, -34, -6, 40, -40, 7, 33, -44, 18, 23, -45, 29, 12, -43, 37, + }, { + 32, -28, -11, 41, -40, 8, 30, -45, 25, 14, -43, 38, -4, -33, 45, -22, + -17, 44, -36, 1, 35, -44, 19, 20, -44, 34, 2, -37, 43, -16, -23, 45, + -32, -6, 39, -42, 13, 26, -45, 30, 9, -40, 41, -10, -29, 45, -27, -12, + 42, -39, 7, 31, -45, 24, 15, -43, 38, -3, -34, 45, -21, -18, 44, -36, + }, { + 32, -30, -7, 38, -43, 18, 19, -44, 38, -6, -30, 45, -29, -8, 39, -43, + 17, 20, -44, 37, -4, -31, 45, -28, -9, 39, -43, 16, 21, -44, 36, -3, + -32, 45, -27, -10, 40, -42, 15, 22, -44, 36, -2, -33, 45, -26, -11, 40, + -42, 14, 23, -45, 35, -1, -34, 45, -25, -12, 41, -41, 13, 24, -45, 34, + }, { + 32, -31, -2, 34, -45, 28, 7, -37, 44, -24, -11, 39, -43, 20, 15, -41, + 42, -16, -19, 43, -40, 12, 23, -44, 38, -8, -27, 45, -35, 3, 30, -45, + 32, 1, -34, 45, -29, -6, 36, -45, 25, 10, -39, 44, -21, -14, 41, -42, + 17, 18, -43, 40, -13, -22, 44, -38, 9, 26, -45, 36, -4, -30, 45, -33, + }, { + 32, -33, 2, 30, -45, 36, -7, -26, 44, -38, 11, 22, -43, 40, -15, -18, + 42, -42, 19, 14, -40, 44, -23, -10, 38, -45, 27, 6, -35, 45, -30, -1, + 32, -45, 34, -3, -29, 45, -36, 8, 25, -44, 39, -12, -21, 43, -41, 16, + 17, -41, 43, -20, -13, 39, -44, 24, 9, -37, 45, -28, -4, 34, -45, 31, + }, { + 32, -34, 7, 24, -43, 41, -19, -12, 38, -45, 30, -1, -29, 45, -39, 14, + 17, -40, 44, -26, -4, 33, -45, 36, -9, -22, 43, -42, 21, 10, -36, 45, + -32, 3, 27, -44, 40, -16, -15, 39, -44, 28, 2, -31, 45, -37, 11, 20, + -42, 43, -23, -8, 35, -45, 34, -6, -25, 44, -41, 18, 13, -38, 45, -30, + }, { + 32, -36, 11, 18, -40, 45, -30, 3, 25, -43, 43, -24, -4, 31, -45, 39, + -17, -12, 36, -45, 35, -10, -19, 40, -44, 30, -2, -26, 43, -42, 23, 6, + -32, 45, -39, 16, 13, -37, 45, -34, 9, 20, -41, 44, -29, 1, 27, -44, + 42, -22, -7, 33, -45, 38, -15, -14, 38, -45, 34, -8, -21, 41, -44, 28, + }, { + 32, -37, 15, 12, -35, 45, -39, 18, 9, -33, 45, -40, 21, 6, -30, 44, + -42, 24, 2, -28, 43, -43, 27, -1, -25, 42, -44, 30, -4, -22, 41, -45, + 32, -8, -19, 39, -45, 34, -11, -16, 38, -45, 36, -14, -13, 36, -45, 38, + -17, -10, 34, -45, 40, -20, -7, 31, -44, 41, -23, -3, 29, -44, 43, -26, + }, { + 32, -38, 19, 6, -29, 43, -44, 31, -9, -16, 36, -45, 40, -22, -2, 26, + -42, 45, -34, 12, 13, -34, 45, -41, 25, -1, -23, 40, -45, 36, -15, -10, + 32, -44, 43, -28, 4, 20, -39, 45, -38, 18, 7, -30, 43, -44, 30, -8, + -17, 37, -45, 39, -21, -3, 27, -42, 44, -33, 11, 14, -35, 45, -41, 24, + }, { + 32, -39, 23, -1, -21, 38, -45, 40, -25, 3, 19, -37, 45, -41, 27, -6, + -17, 36, -45, 42, -29, 8, 15, -34, 44, -43, 30, -10, -13, 33, -44, 44, + -32, 12, 11, -31, 43, -44, 34, -14, -9, 30, -43, 45, -35, 16, 7, -28, + 42, -45, 36, -18, -4, 26, -41, 45, -38, 20, 2, -24, 40, -45, 39, -22, + }, { + 32, -40, 27, -8, -13, 31, -43, 45, -38, 22, -2, -18, 35, -44, 44, -34, + 17, 3, -23, 38, -45, 42, -30, 12, 9, -28, 41, -45, 40, -26, 7, 14, + -32, 43, -45, 37, -21, 1, 19, -36, 44, -44, 34, -16, -4, 24, -39, 45, + -42, 30, -11, -10, 29, -41, 45, -39, 25, -6, -15, 33, -43, 45, -36, 20, + }, { + 32, -41, 30, -14, -4, 22, -36, 44, -44, 37, -23, 6, 13, -30, 41, -45, + 42, -31, 15, 3, -21, 36, -44, 45, -38, 24, -7, -12, 29, -40, 45, -42, + 32, -16, -2, 20, -35, 44, -45, 38, -25, 8, 11, -28, 40, -45, 43, -33, + 17, 1, -19, 34, -43, 45, -39, 26, -9, -10, 27, -39, 45, -43, 34, -18, + }, { + 32, -42, 34, -20, 4, 12, -27, 38, -44, 45, -39, 28, -13, -3, 19, -33, + 42, -45, 43, -34, 21, -6, -11, 26, -38, 44, -45, 39, -29, 14, 2, -18, + 32, -41, 45, -43, 35, -22, 7, 10, -25, 37, -44, 45, -40, 30, -15, -1, + 17, -31, 41, -45, 43, -36, 23, -8, -9, 24, -36, 44, -45, 40, -30, 16, + }, { + 32, -43, 36, -26, 13, 1, -15, 28, -38, 44, -45, 42, -35, 24, -11, -3, + 17, -30, 39, -44, 45, -41, 34, -22, 9, 6, -19, 31, -40, 45, -45, 40, + -32, 20, -7, -8, 21, -33, 41, -45, 44, -39, 30, -18, 4, 10, -23, 34, + -42, 45, -44, 38, -29, 16, -2, -12, 25, -36, 43, -45, 43, -37, 27, -14, + }, { + 32, -44, 39, -31, 21, -10, -2, 14, -25, 34, -41, 45, -45, 42, -36, 28, + -17, 6, 7, -18, 29, -37, 43, -45, 44, -40, 34, -24, 13, -1, -11, 22, + -32, 39, -44, 45, -43, 38, -30, 20, -9, -3, 15, -26, 35, -41, 45, -45, + 42, -36, 27, -16, 4, 8, -19, 30, -38, 43, -45, 44, -40, 33, -23, 12, + }, { + 32, -44, 41, -36, 29, -20, 11, -1, -9, 18, -27, 34, -40, 44, -45, 45, + -42, 37, -30, 22, -13, 3, 7, -16, 25, -33, 39, -43, 45, -45, 43, -38, + 32, -24, 15, -6, -4, 14, -23, 31, -38, 42, -45, 45, -43, 39, -34, 26, + -17, 8, 2, -12, 21, -30, 36, -41, 44, -45, 44, -40, 35, -28, 19, -10, + }, { + 32, -45, 43, -39, 35, -30, 23, -16, 9, -1, -7, 14, -21, 28, -34, 38, + -42, 44, -45, 45, -43, 40, -36, 31, -25, 18, -11, 3, 4, -12, 19, -26, + 32, -37, 41, -44, 45, -45, 44, -41, 38, -33, 27, -20, 13, -6, -2, 10, + -17, 24, -30, 36, -40, 43, -45, 45, -44, 42, -39, 34, -29, 22, -15, 8, + }, { + 32, -45, 44, -42, 40, -37, 34, -30, 25, -20, 15, -10, 4, 1, -7, 12, + -17, 22, -27, 31, -35, 38, -41, 43, -44, 45, -45, 45, -43, 41, -39, 36, + -32, 28, -23, 18, -13, 8, -2, -3, 9, -14, 19, -24, 29, -33, 36, -39, + 42, -44, 45, -45, 45, -44, 43, -40, 38, -34, 30, -26, 21, -16, 11, -6, + }, { + 32, -45, 45, -44, 43, -42, 41, -39, 38, -36, 34, -31, 29, -26, 23, -20, + 17, -14, 11, -8, 4, -1, -2, 6, -9, 12, -15, 18, -21, 24, -27, 30, + -32, 34, -36, 38, -40, 41, -43, 44, -44, 45, -45, 45, -45, 45, -44, 43, + -42, 40, -39, 37, -35, 33, -30, 28, -25, 22, -19, 16, -13, 10, -7, 3, + }, { + 32, -45, 45, -45, 45, -45, 45, -45, 44, -44, 44, -44, 43, -43, 43, -42, + 42, -41, 41, -40, 40, -39, 39, -38, 38, -37, 36, -36, 35, -34, 34, -33, + 32, -31, 30, -30, 29, -28, 27, -26, 25, -24, 23, -22, 21, -20, 19, -18, + 17, -16, 15, -14, 13, -12, 11, -10, 9, -8, 7, -6, 4, -3, 2, -1, + } +}; diff --git a/chromium/third_party/ffmpeg/libavcodec/h274.h b/chromium/third_party/ffmpeg/libavcodec/h274.h new file mode 100644 index 00000000000..807b3a016ad --- /dev/null +++ b/chromium/third_party/ffmpeg/libavcodec/h274.h @@ -0,0 +1,52 @@ +/* + * H.274 film grain synthesis + * Copyright (c) 2021 Niklas Haas <ffmpeg@haasn.xyz> + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * H.274 film grain synthesis. + * @author Niklas Haas <ffmpeg@haasn.xyz> + */ + +#ifndef AVCODEC_H274_H +#define AVCODEC_H274_H + +#include <libavutil/film_grain_params.h> + +// Must be initialized to {0} prior to first usage +typedef struct H274FilmGrainDatabase { + // Database of film grain patterns, lazily computed as-needed + int8_t db[13 /* h */][13 /* v */][64][64]; + uint16_t residency[13 /* h */]; // bit field of v + + // Temporary buffer for slice generation + int16_t slice_tmp[64][64]; +} H274FilmGrainDatabase; + +// Synthesizes film grain on top of `in` and stores the result to `out`. `out` +// must already have been allocated and set to the same size and format as +// `in`. +// +// Returns a negative error code on error, such as invalid params. +int ff_h274_apply_film_grain(AVFrame *out, const AVFrame *in, + H274FilmGrainDatabase *db, + const AVFilmGrainParams *params); + +#endif /* AVCODEC_H274_H */ diff --git a/chromium/third_party/ffmpeg/libavcodec/hevc_sei.c b/chromium/third_party/ffmpeg/libavcodec/hevc_sei.c index e6ae777852b..2c326bf1f7a 100644 --- a/chromium/third_party/ffmpeg/libavcodec/hevc_sei.c +++ b/chromium/third_party/ffmpeg/libavcodec/hevc_sei.c @@ -395,6 +395,48 @@ static int decode_nal_sei_timecode(HEVCSEITimeCode *s, GetBitContext *gb) return 0; } +static int decode_film_grain_characteristics(HEVCSEIFilmGrainCharacteristics *h, + GetBitContext *gb) +{ + h->present = !get_bits1(gb); // film_grain_characteristics_cancel_flag + + if (h->present) { + memset(h, 0, sizeof(*h)); + h->model_id = get_bits(gb, 2); + h->separate_colour_description_present_flag = get_bits1(gb); + if (h->separate_colour_description_present_flag) { + h->bit_depth_luma = get_bits(gb, 3) + 8; + h->bit_depth_chroma = get_bits(gb, 3) + 8; + h->full_range = get_bits1(gb); + h->color_primaries = get_bits(gb, 8); + h->transfer_characteristics = get_bits(gb, 8); + h->matrix_coeffs = get_bits(gb, 8); + } + h->blending_mode_id = get_bits(gb, 2); + h->log2_scale_factor = get_bits(gb, 4); + for (int c = 0; c < 3; c++) + h->comp_model_present_flag[c] = get_bits1(gb); + for (int c = 0; c < 3; c++) { + if (h->comp_model_present_flag[c]) { + h->num_intensity_intervals[c] = get_bits(gb, 8) + 1; + h->num_model_values[c] = get_bits(gb, 3) + 1; + if (h->num_model_values[c] > 6) + return AVERROR_INVALIDDATA; + for (int i = 0; i < h->num_intensity_intervals[c]; i++) { + h->intensity_interval_lower_bound[c][i] = get_bits(gb, 8); + h->intensity_interval_upper_bound[c][i] = get_bits(gb, 8); + for (int j = 0; j < h->num_model_values[c]; j++) + h->comp_model_value[c][i][j] = get_se_golomb_long(gb); + } + } + } + h->persistence_flag = get_bits1(gb); + + h->present = 1; + } + + return 0; +} static int decode_nal_sei_prefix(GetBitContext *gb, void *logctx, HEVCSEI *s, const HEVCParamSets *ps, int type, int size) @@ -422,6 +464,8 @@ static int decode_nal_sei_prefix(GetBitContext *gb, void *logctx, HEVCSEI *s, return decode_nal_sei_alternative_transfer(&s->alternative_transfer, gb); case SEI_TYPE_TIME_CODE: return decode_nal_sei_timecode(&s->timecode, gb); + case SEI_TYPE_FILM_GRAIN_CHARACTERISTICS: + return decode_film_grain_characteristics(&s->film_grain_characteristics, gb); default: av_log(logctx, AV_LOG_DEBUG, "Skipped PREFIX SEI %d\n", type); skip_bits_long(gb, 8 * size); diff --git a/chromium/third_party/ffmpeg/libavcodec/hevc_sei.h b/chromium/third_party/ffmpeg/libavcodec/hevc_sei.h index 4b6bfddeb96..ac8c61c1f1b 100644 --- a/chromium/third_party/ffmpeg/libavcodec/hevc_sei.h +++ b/chromium/third_party/ffmpeg/libavcodec/hevc_sei.h @@ -109,6 +109,27 @@ typedef struct HEVCSEITimeCode { int32_t time_offset_value[3]; } HEVCSEITimeCode; +typedef struct HEVCSEIFilmGrainCharacteristics { + int present; + int model_id; + int separate_colour_description_present_flag; + int bit_depth_luma; + int bit_depth_chroma; + int full_range; + int color_primaries; + int transfer_characteristics; + int matrix_coeffs; + int blending_mode_id; + int log2_scale_factor; + int comp_model_present_flag[3]; + uint16_t num_intensity_intervals[3]; + uint8_t num_model_values[3]; + uint8_t intensity_interval_lower_bound[3][256]; + uint8_t intensity_interval_upper_bound[3][256]; + int16_t comp_model_value[3][256][6]; + int persistence_flag; +} HEVCSEIFilmGrainCharacteristics; + typedef struct HEVCSEI { HEVCSEIPictureHash picture_hash; HEVCSEIFramePacking frame_packing; @@ -122,6 +143,7 @@ typedef struct HEVCSEI { int active_seq_parameter_set_id; HEVCSEIAlternativeTransfer alternative_transfer; HEVCSEITimeCode timecode; + HEVCSEIFilmGrainCharacteristics film_grain_characteristics; } HEVCSEI; struct HEVCParamSets; diff --git a/chromium/third_party/ffmpeg/libavcodec/hevcdec.c b/chromium/third_party/ffmpeg/libavcodec/hevcdec.c index 2d35b0b1824..eafb8834296 100644 --- a/chromium/third_party/ffmpeg/libavcodec/hevcdec.c +++ b/chromium/third_party/ffmpeg/libavcodec/hevcdec.c @@ -26,6 +26,7 @@ #include "libavutil/attributes.h" #include "libavutil/common.h" #include "libavutil/display.h" +#include "libavutil/film_grain_params.h" #include "libavutil/internal.h" #include "libavutil/mastering_display_metadata.h" #include "libavutil/md5.h" @@ -2880,6 +2881,61 @@ static int set_side_data(HEVCContext *s) s->sei.timecode.num_clock_ts = 0; } + if (s->sei.film_grain_characteristics.present && + (s->avctx->export_side_data & AV_CODEC_EXPORT_DATA_FILM_GRAIN)) { + HEVCSEIFilmGrainCharacteristics *fgc = &s->sei.film_grain_characteristics; + AVFilmGrainParams *fgp = av_film_grain_params_create_side_data(out); + if (!fgp) + return AVERROR(ENOMEM); + + fgp->type = AV_FILM_GRAIN_PARAMS_H274; + + fgp->codec.h274.model_id = fgc->model_id; + if (fgc->separate_colour_description_present_flag) { + fgp->codec.h274.bit_depth_luma = fgc->bit_depth_luma; + fgp->codec.h274.bit_depth_chroma = fgc->bit_depth_chroma; + fgp->codec.h274.color_range = fgc->full_range + 1; + fgp->codec.h274.color_primaries = fgc->color_primaries; + fgp->codec.h274.color_trc = fgc->transfer_characteristics; + fgp->codec.h274.color_space = fgc->matrix_coeffs; + } else { + const HEVCSPS *sps = s->ps.sps; + const VUI *vui = &sps->vui; + fgp->codec.h274.bit_depth_luma = sps->bit_depth; + fgp->codec.h274.bit_depth_chroma = sps->bit_depth_chroma; + if (vui->video_signal_type_present_flag) + fgp->codec.h274.color_range = vui->video_full_range_flag + 1; + else + fgp->codec.h274.color_range = AVCOL_RANGE_UNSPECIFIED; + if (vui->colour_description_present_flag) { + fgp->codec.h274.color_primaries = vui->colour_primaries; + fgp->codec.h274.color_trc = vui->transfer_characteristic; + fgp->codec.h274.color_space = vui->matrix_coeffs; + } else { + fgp->codec.h274.color_primaries = AVCOL_PRI_UNSPECIFIED; + fgp->codec.h274.color_trc = AVCOL_TRC_UNSPECIFIED; + fgp->codec.h274.color_space = AVCOL_SPC_UNSPECIFIED; + } + } + fgp->codec.h274.blending_mode_id = fgc->blending_mode_id; + fgp->codec.h274.log2_scale_factor = fgc->log2_scale_factor; + + memcpy(&fgp->codec.h274.component_model_present, &fgc->comp_model_present_flag, + sizeof(fgp->codec.h274.component_model_present)); + memcpy(&fgp->codec.h274.num_intensity_intervals, &fgc->num_intensity_intervals, + sizeof(fgp->codec.h274.num_intensity_intervals)); + memcpy(&fgp->codec.h274.num_model_values, &fgc->num_model_values, + sizeof(fgp->codec.h274.num_model_values)); + memcpy(&fgp->codec.h274.intensity_interval_lower_bound, &fgc->intensity_interval_lower_bound, + sizeof(fgp->codec.h274.intensity_interval_lower_bound)); + memcpy(&fgp->codec.h274.intensity_interval_upper_bound, &fgc->intensity_interval_upper_bound, + sizeof(fgp->codec.h274.intensity_interval_upper_bound)); + memcpy(&fgp->codec.h274.comp_model_value, &fgc->comp_model_value, + sizeof(fgp->codec.h274.comp_model_value)); + + fgc->present = fgc->persistence_flag; + } + if (s->sei.dynamic_hdr_plus.info) { AVBufferRef *info_ref = av_buffer_ref(s->sei.dynamic_hdr_plus.info); if (!info_ref) diff --git a/chromium/third_party/ffmpeg/libavcodec/huffman.c b/chromium/third_party/ffmpeg/libavcodec/huffman.c index df1141b7e75..be351ba2d6c 100644 --- a/chromium/third_party/ffmpeg/libavcodec/huffman.c +++ b/chromium/third_party/ffmpeg/libavcodec/huffman.c @@ -29,7 +29,6 @@ #include "libavutil/qsort.h" #include "libavutil/common.h" -#include "avcodec.h" #include "huffman.h" #include "vlc.h" @@ -154,7 +153,7 @@ static int build_huff_tree(VLC *vlc, Node *nodes, int head, int flags, int nb_bi * nodes size must be 2*nb_codes * first nb_codes nodes.count must be set */ -int ff_huff_build_tree(AVCodecContext *avctx, VLC *vlc, int nb_codes, int nb_bits, +int ff_huff_build_tree(void *logctx, VLC *vlc, int nb_codes, int nb_bits, Node *nodes, HuffCmp cmp, int flags) { int i, j; @@ -168,7 +167,7 @@ int ff_huff_build_tree(AVCodecContext *avctx, VLC *vlc, int nb_codes, int nb_bit } if (sum >> 31) { - av_log(avctx, AV_LOG_ERROR, + av_log(logctx, AV_LOG_ERROR, "Too high symbol frequencies. " "Tree construction is not possible\n"); return -1; @@ -193,7 +192,7 @@ int ff_huff_build_tree(AVCodecContext *avctx, VLC *vlc, int nb_codes, int nb_bit cur_node++; } if (build_huff_tree(vlc, nodes, nb_codes * 2 - 2, flags, nb_bits) < 0) { - av_log(avctx, AV_LOG_ERROR, "Error building tree\n"); + av_log(logctx, AV_LOG_ERROR, "Error building tree\n"); return -1; } return 0; diff --git a/chromium/third_party/ffmpeg/libavcodec/huffman.h b/chromium/third_party/ffmpeg/libavcodec/huffman.h index 4f879e6e840..1d5e140e811 100644 --- a/chromium/third_party/ffmpeg/libavcodec/huffman.h +++ b/chromium/third_party/ffmpeg/libavcodec/huffman.h @@ -26,7 +26,8 @@ #ifndef AVCODEC_HUFFMAN_H #define AVCODEC_HUFFMAN_H -#include "avcodec.h" +#include <stdint.h> + #include "vlc.h" typedef struct Node { @@ -40,7 +41,7 @@ typedef struct Node { #define FF_HUFFMAN_BITS 10 typedef int (*HuffCmp)(const void *va, const void *vb); -int ff_huff_build_tree(AVCodecContext *avctx, VLC *vlc, int nb_codes, int nb_bits, +int ff_huff_build_tree(void *logctx, VLC *vlc, int nb_codes, int nb_bits, Node *nodes, HuffCmp cmp, int flags); int ff_huff_gen_len_table(uint8_t *dst, const uint64_t *stats, int n, int skip0); diff --git a/chromium/third_party/ffmpeg/libavcodec/iirfilter.c b/chromium/third_party/ffmpeg/libavcodec/iirfilter.c index cd5bbc943ae..900893d2ff6 100644 --- a/chromium/third_party/ffmpeg/libavcodec/iirfilter.c +++ b/chromium/third_party/ffmpeg/libavcodec/iirfilter.c @@ -287,10 +287,21 @@ void ff_iir_filter(const struct FFIIRFilterCoeffs *c, } } -void ff_iir_filter_flt(const struct FFIIRFilterCoeffs *c, - struct FFIIRFilterState *s, int size, - const float *src, ptrdiff_t sstep, - float *dst, ptrdiff_t dstep) +/** + * Perform IIR filtering on floating-point input samples. + * + * @param coeffs pointer to filter coefficients + * @param state pointer to filter state + * @param size input length + * @param src source samples + * @param sstep source stride + * @param dst filtered samples (destination may be the same as input) + * @param dstep destination stride + */ +static void iir_filter_flt(const struct FFIIRFilterCoeffs *c, + struct FFIIRFilterState *s, int size, + const float *src, ptrdiff_t sstep, + float *dst, ptrdiff_t dstep) { if (c->order == 2) { FILTER_O2(float, FLT) @@ -317,7 +328,7 @@ av_cold void ff_iir_filter_free_coeffsp(struct FFIIRFilterCoeffs **coeffsp) } void ff_iir_filter_init(FFIIRFilterContext *f) { - f->filter_flt = ff_iir_filter_flt; + f->filter_flt = iir_filter_flt; if (HAVE_MIPSFPU) ff_iir_filter_init_mips(f); diff --git a/chromium/third_party/ffmpeg/libavcodec/iirfilter.h b/chromium/third_party/ffmpeg/libavcodec/iirfilter.h index 5ffa1ce53ab..d6b8fe27824 100644 --- a/chromium/third_party/ffmpeg/libavcodec/iirfilter.h +++ b/chromium/third_party/ffmpeg/libavcodec/iirfilter.h @@ -128,20 +128,4 @@ void ff_iir_filter_free_statep(struct FFIIRFilterState **state); void ff_iir_filter(const struct FFIIRFilterCoeffs *coeffs, struct FFIIRFilterState *state, int size, const int16_t *src, ptrdiff_t sstep, int16_t *dst, ptrdiff_t dstep); -/** - * Perform IIR filtering on floating-point input samples. - * - * @param coeffs pointer to filter coefficients - * @param state pointer to filter state - * @param size input length - * @param src source samples - * @param sstep source stride - * @param dst filtered samples (destination may be the same as input) - * @param dstep destination stride - */ -void ff_iir_filter_flt(const struct FFIIRFilterCoeffs *coeffs, - struct FFIIRFilterState *state, int size, - const float *src, ptrdiff_t sstep, - float *dst, ptrdiff_t dstep); - #endif /* AVCODEC_IIRFILTER_H */ diff --git a/chromium/third_party/ffmpeg/libavcodec/internal.h b/chromium/third_party/ffmpeg/libavcodec/internal.h index 1921515bdd6..dc60e4bf08e 100644 --- a/chromium/third_party/ffmpeg/libavcodec/internal.h +++ b/chromium/third_party/ffmpeg/libavcodec/internal.h @@ -91,13 +91,6 @@ #define FF_CODEC_TAGS_END -1 -#ifdef TRACE -# define ff_tlog(ctx, ...) av_log(ctx, AV_LOG_TRACE, __VA_ARGS__) -#else -# define ff_tlog(ctx, ...) do { } while(0) -#endif - - #define FF_DEFAULT_QUANT_BIAS 999999 #define FF_QSCALE_TYPE_MPEG1 0 diff --git a/chromium/third_party/ffmpeg/libavcodec/interplayacm.c b/chromium/third_party/ffmpeg/libavcodec/interplayacm.c index 470d6403f3e..c11178a9eed 100644 --- a/chromium/third_party/ffmpeg/libavcodec/interplayacm.c +++ b/chromium/third_party/ffmpeg/libavcodec/interplayacm.c @@ -39,6 +39,7 @@ typedef struct InterplayACMContext { GetBitContext gb; uint8_t *bitstream; int max_framesize; + uint64_t max_samples; int bitstream_size; int bitstream_index; @@ -83,6 +84,9 @@ static av_cold int decode_init(AVCodecContext *avctx) return AVERROR_INVALIDDATA; } + s->max_samples = AV_RL32(avctx->extradata + 4) / avctx->channels; + if (s->max_samples == 0) + s->max_samples = UINT64_MAX; s->level = AV_RL16(avctx->extradata + 12) & 0xf; s->rows = AV_RL16(avctx->extradata + 12) >> 4; s->cols = 1 << s->level; @@ -581,7 +585,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, if ((ret = init_get_bits8(gb, buf, buf_size)) < 0) return ret; - frame->nb_samples = s->block_len / avctx->channels; + frame->nb_samples = FFMIN(s->block_len / avctx->channels, s->max_samples); + s->max_samples -= FFMIN(frame->nb_samples, s->max_samples); if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; @@ -606,9 +611,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, return AVERROR_INVALIDDATA; } - if (s->bitstream_size) { + if (s->bitstream_size > 0) { s->bitstream_index += n; - s->bitstream_size -= n; + s->bitstream_size -= FFMIN(s->bitstream_size, n); return input_buf_size; } return n; diff --git a/chromium/third_party/ffmpeg/libavcodec/jpeg2000.c b/chromium/third_party/ffmpeg/libavcodec/jpeg2000.c index 324908d833a..2fbdb642809 100644 --- a/chromium/third_party/ffmpeg/libavcodec/jpeg2000.c +++ b/chromium/third_party/ffmpeg/libavcodec/jpeg2000.c @@ -39,8 +39,7 @@ /* tag tree routines */ -/* allocate the memory for tag tree */ -int32_t ff_tag_tree_size(int w, int h) +static int32_t tag_tree_size(int w, int h) { int64_t res = 0; while (w > 1 || h > 1) { @@ -52,13 +51,14 @@ int32_t ff_tag_tree_size(int w, int h) return (int32_t)(res + 1); } +/* allocate the memory for tag tree */ static Jpeg2000TgtNode *ff_jpeg2000_tag_tree_init(int w, int h) { int pw = w, ph = h; Jpeg2000TgtNode *res, *t, *t2; int32_t tt_size; - tt_size = ff_tag_tree_size(w, h); + tt_size = tag_tree_size(w, h); t = res = av_mallocz_array(tt_size, sizeof(*t)); if (!res) @@ -85,7 +85,7 @@ static Jpeg2000TgtNode *ff_jpeg2000_tag_tree_init(int w, int h) void ff_tag_tree_zero(Jpeg2000TgtNode *t, int w, int h, int val) { - int i, siz = ff_tag_tree_size(w, h); + int i, siz = tag_tree_size(w, h); for (i = 0; i < siz; i++) { t[i].val = val; diff --git a/chromium/third_party/ffmpeg/libavcodec/jpeg2000.h b/chromium/third_party/ffmpeg/libavcodec/jpeg2000.h index 612832c8725..d06313425e3 100644 --- a/chromium/third_party/ffmpeg/libavcodec/jpeg2000.h +++ b/chromium/third_party/ffmpeg/libavcodec/jpeg2000.h @@ -301,7 +301,6 @@ static inline int needs_termination(int style, int passno) { return 0; } -int32_t ff_tag_tree_size(int w, int h); void ff_tag_tree_zero(Jpeg2000TgtNode *t, int w, int h, int val); #endif /* AVCODEC_JPEG2000_H */ diff --git a/chromium/third_party/ffmpeg/libavcodec/jpeg2000_parser.c b/chromium/third_party/ffmpeg/libavcodec/jpeg2000_parser.c index 123197fdca1..e6db7eefa86 100644 --- a/chromium/third_party/ffmpeg/libavcodec/jpeg2000_parser.c +++ b/chromium/third_party/ffmpeg/libavcodec/jpeg2000_parser.c @@ -42,7 +42,6 @@ typedef struct JPEG2000ParserContext { uint8_t fheader_read; // are we reading uint8_t reading_file_header; uint8_t skipped_codestream; - uint8_t codestream_frame_end; uint8_t read_tp; uint8_t in_codestream; } JPEG2000ParserContext; @@ -57,7 +56,6 @@ static inline void reset_context(JPEG2000ParserContext *m) m->ft = 0; m->skipped_codestream = 0; m->fheader_read = 0; - m->codestream_frame_end = 0; m->skip_bytes = 0; m->read_tp = 0; m->in_codestream = 0; @@ -84,7 +82,7 @@ static int find_frame_end(JPEG2000ParserContext *m, const uint8_t *buf, int buf_ { ParseContext *pc= &m->pc; int i; - uint32_t state; + uint32_t state, next_state; uint64_t state64; state= pc->state; state64 = pc->state64; @@ -100,16 +98,13 @@ static int find_frame_end(JPEG2000ParserContext *m, const uint8_t *buf, int buf_ m->skip_bytes--; continue; } - if (m->codestream_frame_end) { - reset_context(m); - return i; - } if (m->read_tp) { // Find out how many bytes inside Tile part codestream to skip. if (m->read_tp == 1) { - m->skip_bytes = (state64 & 0xFFFFFFFF) - 10 > 0? - (state64 & 0xFFFFFFFF) - 10 : 0; + m->skip_bytes = (state64 & 0xFFFFFFFF) - 9 > 0? + (state64 & 0xFFFFFFFF) - 9 : 0; } m->read_tp--; + continue; } if (m->fheader_read) { if (m->fheader_read == 1) { @@ -141,13 +136,24 @@ static int find_frame_end(JPEG2000ParserContext *m, const uint8_t *buf, int buf_ if (pc->frame_start_found && m->ft == jp2_file) { m->skipped_codestream = 1; } else if (pc->frame_start_found && m->ft == j2k_cstream) { - m->codestream_frame_end = 1; + reset_context(m); + return i + 1; // End of frame detected, return frame size. } m->in_codestream = 0; } else if (m->in_codestream && (state & 0xFFFF) == 0xFF90) { // Are we in tile part header? m->read_tp = 8; } else if (pc->frame_start_found && info_marker((state & 0xFFFF0000)>>16) && m->in_codestream) { - m->skip_bytes = (state & 0xFFFF) - 2; + // Calculate number of bytes to skip to get to end of the next marker. + m->skip_bytes = (state & 0xFFFF)-1; + + // If the next marker is an info marker, skip to the end of of the marker length. + if (i + m->skip_bytes + 1 < buf_size) { + next_state = (buf[i + m->skip_bytes] << 8) | buf[i + m->skip_bytes + 1]; + if (info_marker(next_state)) { + // Skip an additional 2 bytes to get to the end of the marker length. + m->skip_bytes += 2; + } + } } } diff --git a/chromium/third_party/ffmpeg/libavcodec/jpeg2000dec.c b/chromium/third_party/ffmpeg/libavcodec/jpeg2000dec.c index e62f7b19e6d..c95f22bc90d 100644 --- a/chromium/third_party/ffmpeg/libavcodec/jpeg2000dec.c +++ b/chromium/third_party/ffmpeg/libavcodec/jpeg2000dec.c @@ -2360,6 +2360,8 @@ static int jp2_find_codestream(Jpeg2000DecoderContext *s) atom_size >= 16) { uint32_t atom2_size, atom2, atom2_end; do { + if (bytestream2_get_bytes_left(&s->g) < 8) + break; atom2_size = bytestream2_get_be32u(&s->g); atom2 = bytestream2_get_be32u(&s->g); atom2_end = bytestream2_tell(&s->g) + atom2_size - 8; diff --git a/chromium/third_party/ffmpeg/libavcodec/libaomenc.c b/chromium/third_party/ffmpeg/libavcodec/libaomenc.c index 9c0317f3b2f..800fda05911 100644 --- a/chromium/third_party/ffmpeg/libavcodec/libaomenc.c +++ b/chromium/third_party/ffmpeg/libavcodec/libaomenc.c @@ -599,7 +599,7 @@ static av_cold int aom_init(AVCodecContext *avctx, av_log(avctx, AV_LOG_INFO, "%s\n", aom_codec_version_str()); av_log(avctx, AV_LOG_VERBOSE, "%s\n", aom_codec_build_config()); - if ((res = aom_codec_enc_config_default(iface, &enccfg, 0)) != AOM_CODEC_OK) { + if ((res = aom_codec_enc_config_default(iface, &enccfg, ctx->usage)) != AOM_CODEC_OK) { av_log(avctx, AV_LOG_ERROR, "Failed to get config: %s\n", aom_codec_err_to_string(res)); return AVERROR(EINVAL); @@ -623,8 +623,6 @@ static av_cold int aom_init(AVCodecContext *avctx, enccfg.g_threads = FFMIN(avctx->thread_count ? avctx->thread_count : av_cpu_count(), 64); - enccfg.g_usage = ctx->usage; - if (ctx->lag_in_frames >= 0) enccfg.g_lag_in_frames = ctx->lag_in_frames; diff --git a/chromium/third_party/ffmpeg/libavcodec/libdav1d.c b/chromium/third_party/ffmpeg/libavcodec/libdav1d.c index 8a816da34db..4711337f39a 100644 --- a/chromium/third_party/ffmpeg/libavcodec/libdav1d.c +++ b/chromium/third_party/ffmpeg/libavcodec/libdav1d.c @@ -157,6 +157,11 @@ static void libdav1d_init_params(AVCodecContext *c, const Dav1dSequenceHeader *s if (seq->equal_picture_interval) c->ticks_per_frame = seq->num_ticks_per_picture; } + + if (seq->film_grain_present) + c->properties |= FF_CODEC_PROPERTY_FILM_GRAIN; + else + c->properties &= ~FF_CODEC_PROPERTY_FILM_GRAIN; } static av_cold int libdav1d_parse_extradata(AVCodecContext *c) @@ -223,6 +228,15 @@ static av_cold int libdav1d_init(AVCodecContext *c) if (dav1d->operating_point >= 0) s.operating_point = dav1d->operating_point; +#if FF_DAV1D_VERSION_AT_LEAST(6,0) + if (dav1d->frame_threads || dav1d->tile_threads) + s.n_threads = FFMAX(dav1d->frame_threads, dav1d->tile_threads); + else + s.n_threads = FFMIN(threads, DAV1D_MAX_THREADS); + s.max_frame_delay = (c->flags & AV_CODEC_FLAG_LOW_DELAY) ? 1 : s.n_threads; + av_log(c, AV_LOG_DEBUG, "Using %d threads, %d max_frame_delay\n", + s.n_threads, s.max_frame_delay); +#else s.n_tile_threads = dav1d->tile_threads ? dav1d->tile_threads : FFMIN(floor(sqrt(threads)), DAV1D_MAX_TILE_THREADS); @@ -231,6 +245,7 @@ static av_cold int libdav1d_init(AVCodecContext *c) : FFMIN(ceil(threads / s.n_tile_threads), DAV1D_MAX_FRAME_THREADS); av_log(c, AV_LOG_DEBUG, "Using %d frame threads, %d tile threads\n", s.n_frame_threads, s.n_tile_threads); +#endif res = libdav1d_parse_extradata(c); if (res < 0) @@ -514,11 +529,18 @@ static av_cold int libdav1d_close(AVCodecContext *c) return 0; } +#ifndef DAV1D_MAX_FRAME_THREADS +#define DAV1D_MAX_FRAME_THREADS DAV1D_MAX_THREADS +#endif +#ifndef DAV1D_MAX_TILE_THREADS +#define DAV1D_MAX_TILE_THREADS DAV1D_MAX_THREADS +#endif + #define OFFSET(x) offsetof(Libdav1dContext, x) #define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM static const AVOption libdav1d_options[] = { - { "tilethreads", "Tile threads", OFFSET(tile_threads), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, DAV1D_MAX_TILE_THREADS, VD }, - { "framethreads", "Frame threads", OFFSET(frame_threads), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, DAV1D_MAX_FRAME_THREADS, VD }, + { "tilethreads", "Tile threads", OFFSET(tile_threads), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, DAV1D_MAX_TILE_THREADS, VD | AV_OPT_FLAG_DEPRECATED }, + { "framethreads", "Frame threads", OFFSET(frame_threads), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, DAV1D_MAX_FRAME_THREADS, VD | AV_OPT_FLAG_DEPRECATED }, { "filmgrain", "Apply Film Grain", OFFSET(apply_grain), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, VD | AV_OPT_FLAG_DEPRECATED }, { "oppoint", "Select an operating point of the scalable bitstream", OFFSET(operating_point), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 31, VD }, { "alllayers", "Output all spatial layers", OFFSET(all_layers), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VD }, diff --git a/chromium/third_party/ffmpeg/libavcodec/libvpxenc.c b/chromium/third_party/ffmpeg/libavcodec/libvpxenc.c index 0e50fbfd7c0..f66345e9981 100644 --- a/chromium/third_party/ffmpeg/libavcodec/libvpxenc.c +++ b/chromium/third_party/ffmpeg/libavcodec/libvpxenc.c @@ -385,9 +385,20 @@ static av_cold int codecctl_int(AVCodecContext *avctx, snprintf(buf, sizeof(buf), "Failed to set %s codec control", ctlidstr[id]); log_encoder_error(avctx, buf); + return AVERROR(EINVAL); } - return res == VPX_CODEC_OK ? 0 : AVERROR(EINVAL); + if (ctx->is_alpha) { + int res_alpha = vpx_codec_control(&ctx->encoder_alpha, id, val); + if (res_alpha != VPX_CODEC_OK) { + snprintf(buf, sizeof(buf), "Failed to set %s alpha codec control", + ctlidstr[id]); + log_encoder_error(avctx, buf); + return AVERROR(EINVAL); + } + } + + return 0; } #if VPX_ENCODER_ABI_VERSION >= 12 @@ -407,9 +418,20 @@ static av_cold int codecctl_intp(AVCodecContext *avctx, snprintf(buf, sizeof(buf), "Failed to set %s codec control", ctlidstr[id]); log_encoder_error(avctx, buf); + return AVERROR(EINVAL); } - return res == VPX_CODEC_OK ? 0 : AVERROR(EINVAL); + if (ctx->is_alpha) { + int res_alpha = vpx_codec_control(&ctx->encoder_alpha, id, val); + if (res_alpha != VPX_CODEC_OK) { + snprintf(buf, sizeof(buf), "Failed to set %s alpha codec control", + ctlidstr[id]); + log_encoder_error(avctx, buf); + return AVERROR(EINVAL); + } + } + + return 0; } #endif diff --git a/chromium/third_party/ffmpeg/libavcodec/libx264.c b/chromium/third_party/ffmpeg/libavcodec/libx264.c index 9afaf195477..379c167e6f8 100644 --- a/chromium/third_party/ffmpeg/libavcodec/libx264.c +++ b/chromium/third_party/ffmpeg/libavcodec/libx264.c @@ -857,10 +857,12 @@ static av_cold int X264_init(AVCodecContext *avctx) x4->params.i_slice_count = avctx->slices; - x4->params.vui.b_fullrange = avctx->pix_fmt == AV_PIX_FMT_YUVJ420P || - avctx->pix_fmt == AV_PIX_FMT_YUVJ422P || - avctx->pix_fmt == AV_PIX_FMT_YUVJ444P || - avctx->color_range == AVCOL_RANGE_JPEG; + if (avctx->color_range != AVCOL_RANGE_UNSPECIFIED) + x4->params.vui.b_fullrange = avctx->color_range == AVCOL_RANGE_JPEG; + else if (avctx->pix_fmt == AV_PIX_FMT_YUVJ420P || + avctx->pix_fmt == AV_PIX_FMT_YUVJ422P || + avctx->pix_fmt == AV_PIX_FMT_YUVJ444P) + x4->params.vui.b_fullrange = 1; if (avctx->colorspace != AVCOL_SPC_UNSPECIFIED) x4->params.vui.i_colmatrix = avctx->colorspace; @@ -868,6 +870,8 @@ static av_cold int X264_init(AVCodecContext *avctx) x4->params.vui.i_colorprim = avctx->color_primaries; if (avctx->color_trc != AVCOL_TRC_UNSPECIFIED) x4->params.vui.i_transfer = avctx->color_trc; + if (avctx->chroma_sample_location != AVCHROMA_LOC_UNSPECIFIED) + x4->params.vui.i_chroma_loc = avctx->chroma_sample_location - 1; if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) x4->params.b_repeat_headers = 0; diff --git a/chromium/third_party/ffmpeg/libavcodec/libx265.c b/chromium/third_party/ffmpeg/libavcodec/libx265.c index 90658d3d9e3..839b6ce9dea 100644 --- a/chromium/third_party/ffmpeg/libavcodec/libx265.c +++ b/chromium/third_party/ffmpeg/libavcodec/libx265.c @@ -35,6 +35,7 @@ #include "encode.h" #include "internal.h" #include "packet_internal.h" +#include "sei.h" typedef struct libx265Context { const AVClass *class; @@ -51,6 +52,9 @@ typedef struct libx265Context { char *profile; AVDictionary *x265_opts; + void *sei_data; + int sei_data_size; + /** * If the encoder does not support ROI then warn the first time we * encounter a frame with ROI side data. @@ -78,6 +82,7 @@ static av_cold int libx265_encode_close(AVCodecContext *avctx) libx265Context *ctx = avctx->priv_data; ctx->api->param_free(ctx->params); + av_freep(&ctx->sei_data); if (ctx->encoder) ctx->api->encoder_close(ctx->encoder); @@ -119,9 +124,10 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx) { libx265Context *ctx = avctx->priv_data; AVCPBProperties *cpb_props = NULL; + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); int ret; - ctx->api = x265_api_get(av_pix_fmt_desc_get(avctx->pix_fmt)->comp[0].depth); + ctx->api = x265_api_get(desc->comp[0].depth); if (!ctx->api) ctx->api = x265_api_get(0); @@ -176,10 +182,15 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx) ctx->params->vui.bEnableVideoSignalTypePresentFlag = 1; - ctx->params->vui.bEnableVideoFullRangeFlag = avctx->pix_fmt == AV_PIX_FMT_YUVJ420P || - avctx->pix_fmt == AV_PIX_FMT_YUVJ422P || - avctx->pix_fmt == AV_PIX_FMT_YUVJ444P || - avctx->color_range == AVCOL_RANGE_JPEG; + if (avctx->color_range != AVCOL_RANGE_UNSPECIFIED) + ctx->params->vui.bEnableVideoFullRangeFlag = + avctx->color_range == AVCOL_RANGE_JPEG; + else + ctx->params->vui.bEnableVideoFullRangeFlag = + (desc->flags & AV_PIX_FMT_FLAG_RGB) || + avctx->pix_fmt == AV_PIX_FMT_YUVJ420P || + avctx->pix_fmt == AV_PIX_FMT_YUVJ422P || + avctx->pix_fmt == AV_PIX_FMT_YUVJ444P; if ((avctx->color_primaries <= AVCOL_PRI_SMPTE432 && avctx->color_primaries != AVCOL_PRI_UNSPECIFIED) || @@ -200,6 +211,19 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx) ctx->params->vui.matrixCoeffs = avctx->colorspace; } + // chroma sample location values are to be ignored in case of non-4:2:0 + // according to the specification, so we only write them out in case of + // 4:2:0 (log2_chroma_{w,h} == 1). + ctx->params->vui.bEnableChromaLocInfoPresentFlag = + avctx->chroma_sample_location != AVCHROMA_LOC_UNSPECIFIED && + desc->log2_chroma_w == 1 && desc->log2_chroma_h == 1; + + if (ctx->params->vui.bEnableChromaLocInfoPresentFlag) { + ctx->params->vui.chromaSampleLocTypeTopField = + ctx->params->vui.chromaSampleLocTypeBottomField = + avctx->chroma_sample_location - 1; + } + if (avctx->sample_aspect_ratio.num > 0 && avctx->sample_aspect_ratio.den > 0) { char sar[12]; int sar_num, sar_den; @@ -489,6 +513,8 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt, ctx->api->picture_init(ctx->params, &x265pic); if (pic) { + x265_sei *sei = &x265pic.userSEI; + sei->numPayloads = 0; for (i = 0; i < 3; i++) { x265pic.planes[i] = pic->data[i]; x265pic.stride[i] = pic->linesize[i]; @@ -516,6 +542,32 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt, memcpy(x265pic.userData, &pic->reordered_opaque, sizeof(pic->reordered_opaque)); } + + for (i = 0; i < pic->nb_side_data; i++) { + AVFrameSideData *side_data = pic->side_data[i]; + void *tmp; + x265_sei_payload *sei_payload; + + if (side_data->type != AV_FRAME_DATA_SEI_UNREGISTERED) + continue; + + tmp = av_fast_realloc(ctx->sei_data, + &ctx->sei_data_size, + (sei->numPayloads + 1) * sizeof(*sei_payload)); + if (!tmp) { + av_freep(&x265pic.userData); + av_freep(&x265pic.quantOffsets); + return AVERROR(ENOMEM); + } + ctx->sei_data = tmp; + sei->payloads = ctx->sei_data; + sei_payload = &sei->payloads[sei->numPayloads]; + sei_payload->payload = side_data->data; + sei_payload->payloadSize = side_data->size; + /* Equal to libx265 USER_DATA_UNREGISTERED */ + sei_payload->payloadType = SEI_TYPE_USER_DATA_UNREGISTERED; + sei->numPayloads++; + } } ret = ctx->api->encoder_encode(ctx->encoder, &nal, &nnal, diff --git a/chromium/third_party/ffmpeg/libavcodec/mdct_fixed_32.c b/chromium/third_party/ffmpeg/libavcodec/mdct_fixed_32.c index 5a34dfe7607..eaa6355e679 100644 --- a/chromium/third_party/ffmpeg/libavcodec/mdct_fixed_32.c +++ b/chromium/third_party/ffmpeg/libavcodec/mdct_fixed_32.c @@ -48,5 +48,4 @@ */ #define FFT_FLOAT 0 -#define FFT_FIXED_32 1 #include "mdct_template.c" diff --git a/chromium/third_party/ffmpeg/libavcodec/mdct_float.c b/chromium/third_party/ffmpeg/libavcodec/mdct_float.c index cff2d211c4b..3d3d3a55482 100644 --- a/chromium/third_party/ffmpeg/libavcodec/mdct_float.c +++ b/chromium/third_party/ffmpeg/libavcodec/mdct_float.c @@ -17,5 +17,4 @@ */ #define FFT_FLOAT 1 -#define FFT_FIXED_32 0 #include "mdct_template.c" diff --git a/chromium/third_party/ffmpeg/libavcodec/mdct_template.c b/chromium/third_party/ffmpeg/libavcodec/mdct_template.c index e0ad9f1e531..a854ad27008 100644 --- a/chromium/third_party/ffmpeg/libavcodec/mdct_template.c +++ b/chromium/third_party/ffmpeg/libavcodec/mdct_template.c @@ -35,11 +35,7 @@ #if FFT_FLOAT # define RSCALE(x, y) ((x) + (y)) #else -#if FFT_FIXED_32 # define RSCALE(x, y) ((int)((x) + (unsigned)(y) + 32) >> 6) -#else /* FFT_FIXED_32 */ -# define RSCALE(x, y) ((int)((x) + (unsigned)(y)) >> 1) -#endif /* FFT_FIXED_32 */ #endif /** @@ -82,7 +78,7 @@ av_cold int ff_mdct_init(FFTContext *s, int nbits, int inverse, double scale) scale = sqrt(fabs(scale)); for(i=0;i<n4;i++) { alpha = 2 * M_PI * (i + theta) / n; -#if FFT_FIXED_32 +#if !FFT_FLOAT s->tcos[i*tstep] = lrint(-cos(alpha) * 2147483648.0); s->tsin[i*tstep] = lrint(-sin(alpha) * 2147483648.0); #else diff --git a/chromium/third_party/ffmpeg/libavcodec/mfenc.c b/chromium/third_party/ffmpeg/libavcodec/mfenc.c index 26f1c8057fa..410ad64d8d5 100644 --- a/chromium/third_party/ffmpeg/libavcodec/mfenc.c +++ b/chromium/third_party/ffmpeg/libavcodec/mfenc.c @@ -100,8 +100,6 @@ static int mf_wait_events(AVCodecContext *avctx) static AVRational mf_get_tb(AVCodecContext *avctx) { - if (avctx->pkt_timebase.num > 0 && avctx->pkt_timebase.den > 0) - return avctx->pkt_timebase; if (avctx->time_base.num > 0 && avctx->time_base.den > 0) return avctx->time_base; return MF_TIMEBASE; diff --git a/chromium/third_party/ffmpeg/libavcodec/mips/constants.h b/chromium/third_party/ffmpeg/libavcodec/mips/constants.h index df54b3016f0..f6eaf4415e8 100644 --- a/chromium/third_party/ffmpeg/libavcodec/mips/constants.h +++ b/chromium/third_party/ffmpeg/libavcodec/mips/constants.h @@ -22,6 +22,8 @@ #ifndef AVCODEC_MIPS_CONSTANTS_H #define AVCODEC_MIPS_CONSTANTS_H +#include "libavutil/intfloat.h" + extern const union av_intfloat64 ff_pw_1; extern const union av_intfloat64 ff_pw_2; extern const union av_intfloat64 ff_pw_3; diff --git a/chromium/third_party/ffmpeg/libavcodec/mips/h264dsp_mips.h b/chromium/third_party/ffmpeg/libavcodec/mips/h264dsp_mips.h index 5847ef36fe7..93a201c66a7 100644 --- a/chromium/third_party/ffmpeg/libavcodec/mips/h264dsp_mips.h +++ b/chromium/third_party/ffmpeg/libavcodec/mips/h264dsp_mips.h @@ -50,10 +50,10 @@ void ff_h264_deq_idct_luma_dc_msa(int16_t *dst, int16_t *src, int32_t de_q_val); void ff_h264_idct_add16_msa(uint8_t *dst, const int32_t *blk_offset, int16_t *block, int32_t stride, - const uint8_t nnzc[15 * 8]); + const uint8_t nnzc[5 * 8]); void ff_h264_idct_add16_intra_msa(uint8_t *dst, const int32_t *blk_offset, int16_t *block, int32_t dst_stride, - const uint8_t nnzc[15 * 8]); + const uint8_t nnzc[5 * 8]); void ff_h264_idct_add8_msa(uint8_t **dst, const int32_t *blk_offset, int16_t *block, int32_t dst_stride, const uint8_t nnzc[15 * 8]); @@ -65,7 +65,7 @@ void ff_h264_idct8_dc_addblk_msa(uint8_t *dst, int16_t *src, int32_t dst_stride); void ff_h264_idct8_add4_msa(uint8_t *dst, const int *blk_offset, int16_t *blk, int dst_stride, - const uint8_t nnzc[15 * 8]); + const uint8_t nnzc[5 * 8]); void ff_h264_h_lpf_luma_intra_msa(uint8_t *src, ptrdiff_t stride, int alpha, int beta); @@ -329,11 +329,11 @@ void ff_h264_idct8_add_8_mmi(uint8_t *dst, int16_t *block, int stride); void ff_h264_idct_dc_add_8_mmi(uint8_t *dst, int16_t *block, int stride); void ff_h264_idct8_dc_add_8_mmi(uint8_t *dst, int16_t *block, int stride); void ff_h264_idct_add16_8_mmi(uint8_t *dst, const int *block_offset, - int16_t *block, int stride, const uint8_t nnzc[15*8]); + int16_t *block, int stride, const uint8_t nnzc[5 * 8]); void ff_h264_idct_add16intra_8_mmi(uint8_t *dst, const int *block_offset, - int16_t *block, int stride, const uint8_t nnzc[15*8]); + int16_t *block, int stride, const uint8_t nnzc[5 * 8]); void ff_h264_idct8_add4_8_mmi(uint8_t *dst, const int *block_offset, - int16_t *block, int stride, const uint8_t nnzc[15*8]); + int16_t *block, int stride, const uint8_t nnzc[5 * 8]); void ff_h264_idct_add8_8_mmi(uint8_t **dest, const int *block_offset, int16_t *block, int stride, const uint8_t nnzc[15*8]); void ff_h264_idct_add8_422_8_mmi(uint8_t **dest, const int *block_offset, diff --git a/chromium/third_party/ffmpeg/libavcodec/mips/h264dsp_mmi.c b/chromium/third_party/ffmpeg/libavcodec/mips/h264dsp_mmi.c index b5ab07c8634..dff3d331b1f 100644 --- a/chromium/third_party/ffmpeg/libavcodec/mips/h264dsp_mmi.c +++ b/chromium/third_party/ffmpeg/libavcodec/mips/h264dsp_mmi.c @@ -766,7 +766,8 @@ void ff_h264_idct8_dc_add_8_mmi(uint8_t *dst, int16_t *block, int stride) } void ff_h264_idct_add16_8_mmi(uint8_t *dst, const int *block_offset, - int16_t *block, int stride, const uint8_t nnzc[15*8]) + int16_t *block, int stride, + const uint8_t nnzc[5 * 8]) { int i; for(i=0; i<16; i++){ @@ -783,7 +784,7 @@ void ff_h264_idct_add16_8_mmi(uint8_t *dst, const int *block_offset, } void ff_h264_idct_add16intra_8_mmi(uint8_t *dst, const int *block_offset, - int16_t *block, int stride, const uint8_t nnzc[15*8]) + int16_t *block, int stride, const uint8_t nnzc[5 * 8]) { int i; for(i=0; i<16; i++){ @@ -796,7 +797,7 @@ void ff_h264_idct_add16intra_8_mmi(uint8_t *dst, const int *block_offset, } void ff_h264_idct8_add4_8_mmi(uint8_t *dst, const int *block_offset, - int16_t *block, int stride, const uint8_t nnzc[15*8]) + int16_t *block, int stride, const uint8_t nnzc[5 * 8]) { int i; for(i=0; i<16; i+=4){ diff --git a/chromium/third_party/ffmpeg/libavcodec/mips/h264idct_msa.c b/chromium/third_party/ffmpeg/libavcodec/mips/h264idct_msa.c index fbf7795e27f..1a20a3e30e5 100644 --- a/chromium/third_party/ffmpeg/libavcodec/mips/h264idct_msa.c +++ b/chromium/third_party/ffmpeg/libavcodec/mips/h264idct_msa.c @@ -347,7 +347,7 @@ void ff_h264_idct8_dc_addblk_msa(uint8_t *dst, int16_t *src, void ff_h264_idct_add16_msa(uint8_t *dst, const int32_t *blk_offset, int16_t *block, int32_t dst_stride, - const uint8_t nzc[15 * 8]) + const uint8_t nzc[5 * 8]) { int32_t i; @@ -369,7 +369,7 @@ void ff_h264_idct_add16_msa(uint8_t *dst, void ff_h264_idct8_add4_msa(uint8_t *dst, const int32_t *blk_offset, int16_t *block, int32_t dst_stride, - const uint8_t nzc[15 * 8]) + const uint8_t nzc[5 * 8]) { int32_t cnt; @@ -448,7 +448,7 @@ void ff_h264_idct_add16_intra_msa(uint8_t *dst, const int32_t *blk_offset, int16_t *block, int32_t dst_stride, - const uint8_t nzc[15 * 8]) + const uint8_t nzc[5 * 8]) { int32_t i; diff --git a/chromium/third_party/ffmpeg/libavcodec/mjpegbdec.c b/chromium/third_party/ffmpeg/libavcodec/mjpegbdec.c index 87eebb87713..218be411925 100644 --- a/chromium/third_party/ffmpeg/libavcodec/mjpegbdec.c +++ b/chromium/third_party/ffmpeg/libavcodec/mjpegbdec.c @@ -119,9 +119,13 @@ read_header: 8 * FFMIN(field_size, buf_end - buf_ptr - sos_offs)); s->mjpb_skiptosod = (sod_offs - sos_offs - show_bits(&s->gb, 16)); s->start_code = SOS; - ret = ff_mjpeg_decode_sos(s, NULL, 0, NULL); - if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE)) - return ret; + if (avctx->skip_frame == AVDISCARD_ALL) { + skip_bits(&s->gb, get_bits_left(&s->gb)); + } else { + ret = ff_mjpeg_decode_sos(s, NULL, 0, NULL); + if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE)) + return ret; + } } if (s->interlaced) { diff --git a/chromium/third_party/ffmpeg/libavcodec/mjpegdec.c b/chromium/third_party/ffmpeg/libavcodec/mjpegdec.c index 8172dca513b..2a5868fe1d9 100644 --- a/chromium/third_party/ffmpeg/libavcodec/mjpegdec.c +++ b/chromium/third_party/ffmpeg/libavcodec/mjpegdec.c @@ -1580,6 +1580,9 @@ static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss, else ret = decode_block_progressive(s, *block, last_nnz, s->ac_index[0], quant_matrix, ss, se, Al, &EOBRUN); + + if (ret >= 0 && get_bits_left(&s->gb) < 0) + ret = AVERROR_INVALIDDATA; if (ret < 0) { av_log(s->avctx, AV_LOG_ERROR, "error y=%d x=%d\n", mb_y, mb_x); diff --git a/chromium/third_party/ffmpeg/libavcodec/mlp.h b/chromium/third_party/ffmpeg/libavcodec/mlp.h index 5b7d8c8cacc..e45eba55aef 100644 --- a/chromium/third_party/ffmpeg/libavcodec/mlp.h +++ b/chromium/third_party/ffmpeg/libavcodec/mlp.h @@ -24,6 +24,9 @@ #include <stdint.h> +#define SYNC_MLP 0xbb +#define SYNC_TRUEHD 0xba + /** Last possible matrix channel for each codec */ #define MAX_MATRIX_CHANNEL_MLP 5 #define MAX_MATRIX_CHANNEL_TRUEHD 7 diff --git a/chromium/third_party/ffmpeg/libavcodec/mlpdec.c b/chromium/third_party/ffmpeg/libavcodec/mlpdec.c index e4992550eea..fef92c5a313 100644 --- a/chromium/third_party/ffmpeg/libavcodec/mlpdec.c +++ b/chromium/third_party/ffmpeg/libavcodec/mlpdec.c @@ -53,6 +53,8 @@ typedef struct SubStream { /// Set if a valid restart header has been read. Otherwise the substream cannot be decoded. uint8_t restart_seen; + /// Set if end of stream is encountered + uint8_t end_of_stream; //@{ /** restart header data */ @@ -389,7 +391,7 @@ static int read_major_sync(MLPDecodeContext *m, GetBitContext *gb) * substream is Stereo. Subsequent substreams' layouts are indicated in the * major sync. */ if (m->avctx->codec_id == AV_CODEC_ID_MLP) { - if (mh.stream_type != 0xbb) { + if (mh.stream_type != SYNC_MLP) { avpriv_request_sample(m->avctx, "unexpected stream_type %X in MLP", mh.stream_type); @@ -399,7 +401,7 @@ static int read_major_sync(MLPDecodeContext *m, GetBitContext *gb) m->substream[0].mask = AV_CH_LAYOUT_STEREO; m->substream[substr].mask = mh.channel_layout_mlp; } else { - if (mh.stream_type != 0xba) { + if (mh.stream_type != SYNC_TRUEHD) { avpriv_request_sample(m->avctx, "unexpected stream_type %X in !MLP", mh.stream_type); @@ -920,7 +922,7 @@ fail: return ret; } -#define MSB_MASK(bits) (-1u << (bits)) +#define MSB_MASK(bits) (-(1 << (bits))) /** Generate PCM samples using the prediction filters and residual values * read from the data stream, and update the filter state. */ @@ -1286,8 +1288,8 @@ static int read_access_unit(AVCodecContext *avctx, void* data, else if (m->avctx->codec_id == AV_CODEC_ID_MLP && shorten_by != 0xD234) return AVERROR_INVALIDDATA; - if (substr == m->max_decoded_substream) - av_log(m->avctx, AV_LOG_INFO, "End of stream indicated.\n"); + av_log(m->avctx, AV_LOG_DEBUG, "End of stream indicated.\n"); + s->end_of_stream = 1; } if (substream_parity_present[substr]) { @@ -1319,6 +1321,16 @@ next_substr: if ((ret = output_data(m, m->max_decoded_substream, data, got_frame_ptr)) < 0) return ret; + for (substr = 0; substr <= m->max_decoded_substream; substr++){ + SubStream *s = &m->substream[substr]; + + if (s->end_of_stream) { + s->lossless_check_data = 0xffffffff; + s->end_of_stream = 0; + m->params_valid = 0; + } + } + return length; substream_length_mismatch: @@ -1330,6 +1342,18 @@ error: return AVERROR_INVALIDDATA; } +static void mlp_decode_flush(AVCodecContext *avctx) +{ + MLPDecodeContext *m = avctx->priv_data; + + m->params_valid = 0; + for (int substr = 0; substr <= m->max_decoded_substream; substr++){ + SubStream *s = &m->substream[substr]; + + s->lossless_check_data = 0xffffffff; + } +} + #if CONFIG_MLP_DECODER const AVCodec ff_mlp_decoder = { .name = "mlp", @@ -1339,6 +1363,7 @@ const AVCodec ff_mlp_decoder = { .priv_data_size = sizeof(MLPDecodeContext), .init = mlp_decode_init, .decode = read_access_unit, + .flush = mlp_decode_flush, .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, }; @@ -1352,6 +1377,7 @@ const AVCodec ff_truehd_decoder = { .priv_data_size = sizeof(MLPDecodeContext), .init = mlp_decode_init, .decode = read_access_unit, + .flush = mlp_decode_flush, .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, }; diff --git a/chromium/third_party/ffmpeg/libavcodec/mlpenc.c b/chromium/third_party/ffmpeg/libavcodec/mlpenc.c index 8b61fc6b1eb..ef01c1d2828 100644 --- a/chromium/third_party/ffmpeg/libavcodec/mlpenc.c +++ b/chromium/third_party/ffmpeg/libavcodec/mlpenc.c @@ -28,6 +28,7 @@ #include "libavutil/channel_layout.h" #include "libavutil/crc.h" #include "libavutil/avstring.h" +#include "libavutil/intmath.h" #include "libavutil/samplefmt.h" #include "libavutil/thread.h" #include "mlp.h" @@ -103,7 +104,7 @@ typedef struct BestOffset { /** Number of possible codebooks (counting "no codebooks") */ #define NUM_CODEBOOKS 4 -typedef struct { +typedef struct MLPEncodeContext { AVCodecContext *avctx; int num_substreams; ///< Number of substreams contained within this stream. @@ -129,7 +130,7 @@ typedef struct { int32_t *write_buffer; ///< Pointer to data currently being written to bitstream. int32_t *sample_buffer; ///< Pointer to current access unit samples. int32_t *major_scratch_buffer; ///< Scratch buffer big enough to fit all data for one entire major frame interval. - int32_t *last_frame; ///< Pointer to last frame with data to encode. + int32_t last_frames; ///< Signal last frames. int32_t *lpc_sample_buffer; @@ -142,7 +143,6 @@ typedef struct { int32_t *lossless_check_data; ///< Array with lossless_check_data for each access unit. unsigned int *max_output_bits; ///< largest output bit-depth - unsigned int *frame_size; ///< Array with number of samples/channel in each access unit. unsigned int frame_index; ///< Index of current frame being encoded. unsigned int one_sample_buffer_size; ///< Number of samples*channel for one access unit. @@ -169,11 +169,11 @@ typedef struct { BestOffset best_offset[MAJOR_HEADER_INTERVAL+1][MAX_CHANNELS][NUM_CODEBOOKS]; DecodingParams *decoding_params; - RestartHeader restart_header [MAX_SUBSTREAMS]; + RestartHeader restart_header; ChannelParams major_channel_params[MAJOR_HEADER_INTERVAL+1][MAX_CHANNELS]; ///< ChannelParams to be written to bitstream. - DecodingParams major_decoding_params[MAJOR_HEADER_INTERVAL+1][MAX_SUBSTREAMS]; ///< DecodingParams to be written to bitstream. - int major_params_changed[MAJOR_HEADER_INTERVAL+1][MAX_SUBSTREAMS]; ///< params_changed to be written to bitstream. + DecodingParams major_decoding_params[MAJOR_HEADER_INTERVAL+1]; ///< DecodingParams to be written to bitstream. + int major_params_changed[MAJOR_HEADER_INTERVAL+1]; ///< params_changed to be written to bitstream. unsigned int major_cur_subblock_index; unsigned int major_filter_state_subblock; @@ -187,7 +187,6 @@ typedef struct { AudioFrameQueue afq; /* Analysis stage. */ - unsigned int starting_frame_index; unsigned int number_of_frames; unsigned int number_of_samples; unsigned int number_of_subblocks; @@ -199,8 +198,12 @@ typedef struct { ChannelParams *seq_channel_params; DecodingParams *seq_decoding_params; + int32_t *filter_state_buffer[NUM_FILTERS]; + unsigned int max_codebook_search; + int shorten_by; + LPCContext lpc_ctx; } MLPEncodeContext; @@ -211,9 +214,6 @@ static const BestOffset restart_best_offset[NUM_CODEBOOKS] = {{0}}; #define SYNC_MAJOR 0xf8726f #define MAJOR_SYNC_INFO_SIGNATURE 0xB752 -#define SYNC_MLP 0xbb -#define SYNC_TRUEHD 0xba - /* must be set for DVD-A */ #define FLAGS_DVDA 0x4000 /* FIFO delay must be constant */ @@ -235,7 +235,6 @@ static int compare_filter_params(const ChannelParams *prev_cp, const ChannelPara { const FilterParams *prev = &prev_cp->filter_params[filter]; const FilterParams *fp = &cp->filter_params[filter]; - int i; if (prev->order != fp->order) return 1; @@ -246,7 +245,7 @@ static int compare_filter_params(const ChannelParams *prev_cp, const ChannelPara if (prev->shift != fp->shift) return 1; - for (i = 0; i < fp->order; i++) + for (int i = 0; i < fp->order; i++) if (prev_cp->coeff[filter][i] != cp->coeff[filter][i]) return 1; @@ -259,7 +258,6 @@ static int compare_filter_params(const ChannelParams *prev_cp, const ChannelPara static int compare_matrix_params(MLPEncodeContext *ctx, const MatrixParams *prev, const MatrixParams *mp) { RestartHeader *rh = ctx->cur_restart_header; - unsigned int channel, mat; if (prev->count != mp->count) return 1; @@ -267,15 +265,15 @@ static int compare_matrix_params(MLPEncodeContext *ctx, const MatrixParams *prev if (!prev->count) return 0; - for (channel = rh->min_channel; channel <= rh->max_channel; channel++) + for (unsigned int channel = rh->min_channel; channel <= rh->max_channel; channel++) if (prev->fbits[channel] != mp->fbits[channel]) return 1; - for (mat = 0; mat < mp->count; mat++) { + for (unsigned int mat = 0; mat < mp->count; mat++) { if (prev->outch[mat] != mp->outch[mat]) return 1; - for (channel = 0; channel < ctx->num_channels; channel++) + for (unsigned int channel = 0; channel < ctx->num_channels; channel++) if (prev->coeff[mat][channel] != mp->coeff[mat][channel]) return 1; } @@ -293,7 +291,6 @@ static int compare_decoding_params(MLPEncodeContext *ctx) const MatrixParams *prev_mp = &prev->matrix_params; MatrixParams *mp = &dp->matrix_params; RestartHeader *rh = ctx->cur_restart_header; - unsigned int ch; int retval = 0; if (prev->param_presence_flags != dp->param_presence_flags) @@ -305,19 +302,19 @@ static int compare_decoding_params(MLPEncodeContext *ctx) if (compare_matrix_params(ctx, prev_mp, mp)) retval |= PARAM_MATRIX; - for (ch = 0; ch <= rh->max_matrix_channel; ch++) + for (unsigned int ch = 0; ch <= rh->max_matrix_channel; ch++) if (prev_mp->shift[ch] != mp->shift[ch]) { retval |= PARAM_OUTSHIFT; break; } - for (ch = 0; ch <= rh->max_channel; ch++) + for (unsigned int ch = 0; ch <= rh->max_channel; ch++) if (prev->quant_step_size[ch] != dp->quant_step_size[ch]) { retval |= PARAM_QUANTSTEP; break; } - for (ch = rh->min_channel; ch <= rh->max_channel; ch++) { + for (unsigned int ch = rh->min_channel; ch <= rh->max_channel; ch++) { const ChannelParams *prev_cp = &ctx->prev_channel_params[ch]; ChannelParams *cp = &ctx->cur_channel_params[ch]; @@ -334,7 +331,7 @@ static int compare_decoding_params(MLPEncodeContext *ctx) if (prev_cp->codebook != cp->codebook || prev_cp->huff_lsbs != cp->huff_lsbs ) - retval |= 0x1; + retval |= PARAM_PRESENT; } return retval; @@ -344,7 +341,6 @@ static void copy_filter_params(ChannelParams *dst_cp, ChannelParams *src_cp, int { FilterParams *dst = &dst_cp->filter_params[filter]; FilterParams *src = &src_cp->filter_params[filter]; - unsigned int order; dst->order = src->order; @@ -355,7 +351,7 @@ static void copy_filter_params(ChannelParams *dst_cp, ChannelParams *src_cp, int dst->coeff_bits = src->coeff_bits; } - for (order = 0; order < dst->order; order++) + for (unsigned int order = 0; order < dst->order; order++) dst_cp->coeff[filter][order] = src_cp->coeff[filter][order]; } @@ -364,59 +360,50 @@ static void copy_matrix_params(MatrixParams *dst, MatrixParams *src) dst->count = src->count; if (dst->count) { - unsigned int channel, count; - - for (channel = 0; channel < MAX_CHANNELS; channel++) { + for (unsigned int channel = 0; channel < MAX_CHANNELS; channel++) { dst->fbits[channel] = src->fbits[channel]; dst->shift[channel] = src->shift[channel]; - for (count = 0; count < MAX_MATRICES; count++) + for (unsigned int count = 0; count < MAX_MATRICES; count++) dst->coeff[count][channel] = src->coeff[count][channel]; } - for (count = 0; count < MAX_MATRICES; count++) + for (unsigned int count = 0; count < MAX_MATRICES; count++) dst->outch[count] = src->outch[count]; } } -static void copy_restart_frame_params(MLPEncodeContext *ctx, - unsigned int substr) +static void copy_restart_frame_params(MLPEncodeContext *ctx) { - unsigned int index; - - for (index = 0; index < ctx->number_of_subblocks; index++) { - DecodingParams *dp = ctx->seq_decoding_params + index*(ctx->num_substreams) + substr; - unsigned int channel; + for (unsigned int index = 0; index < ctx->number_of_subblocks; index++) { + DecodingParams *dp = ctx->seq_decoding_params + index; copy_matrix_params(&dp->matrix_params, &ctx->cur_decoding_params->matrix_params); - for (channel = 0; channel < ctx->avctx->channels; channel++) { + for (unsigned int channel = 0; channel < ctx->avctx->channels; channel++) { ChannelParams *cp = ctx->seq_channel_params + index*(ctx->avctx->channels) + channel; - unsigned int filter; dp->quant_step_size[channel] = ctx->cur_decoding_params->quant_step_size[channel]; dp->matrix_params.shift[channel] = ctx->cur_decoding_params->matrix_params.shift[channel]; if (index) - for (filter = 0; filter < NUM_FILTERS; filter++) + for (unsigned int filter = 0; filter < NUM_FILTERS; filter++) copy_filter_params(cp, &ctx->cur_channel_params[channel], filter); } } } /** Clears a DecodingParams struct the way it should be after a restart header. */ -static void clear_decoding_params(DecodingParams decoding_params[MAX_SUBSTREAMS], int num_substreams) +static void clear_decoding_params(DecodingParams *decoding_params) { - for (unsigned substr = 0; substr < num_substreams; substr++) { - DecodingParams *dp = &decoding_params[substr]; + DecodingParams *dp = decoding_params; - dp->param_presence_flags = 0xff; - dp->blocksize = 8; + dp->param_presence_flags = 0xff; + dp->blocksize = 8; - memset(&dp->matrix_params , 0, sizeof(MatrixParams )); - memset(dp->quant_step_size, 0, sizeof(dp->quant_step_size)); - } + memset(&dp->matrix_params , 0, sizeof(MatrixParams )); + memset(dp->quant_step_size, 0, sizeof(dp->quant_step_size)); } /** Clears a ChannelParams struct the way it should be after a restart header. */ @@ -435,28 +422,23 @@ static void clear_channel_params(ChannelParams channel_params[MAX_CHANNELS], int } /** Sets default vales in our encoder for a DecodingParams struct. */ -static void default_decoding_params(MLPEncodeContext *ctx, - DecodingParams decoding_params[MAX_SUBSTREAMS]) +static void default_decoding_params(MLPEncodeContext *ctx, DecodingParams *decoding_params) { - unsigned int substr; - - clear_decoding_params(decoding_params, ctx->num_substreams); + DecodingParams *dp = decoding_params; + uint8_t param_presence_flags = 0; - for (substr = 0; substr < ctx->num_substreams; substr++) { - DecodingParams *dp = &decoding_params[substr]; - uint8_t param_presence_flags = 0; + clear_decoding_params(decoding_params); - param_presence_flags |= PARAM_BLOCKSIZE; - param_presence_flags |= PARAM_MATRIX; - param_presence_flags |= PARAM_OUTSHIFT; - param_presence_flags |= PARAM_QUANTSTEP; - param_presence_flags |= PARAM_FIR; -/* param_presence_flags |= PARAM_IIR; */ - param_presence_flags |= PARAM_HUFFOFFSET; - param_presence_flags |= PARAM_PRESENT; + param_presence_flags |= PARAM_BLOCKSIZE; + param_presence_flags |= PARAM_MATRIX; + param_presence_flags |= PARAM_OUTSHIFT; + param_presence_flags |= PARAM_QUANTSTEP; + param_presence_flags |= PARAM_FIR; + /*param_presence_flags |= PARAM_IIR; */ + param_presence_flags |= PARAM_HUFFOFFSET; + param_presence_flags |= PARAM_PRESENT; - dp->param_presence_flags = param_presence_flags; - } + dp->param_presence_flags = param_presence_flags; } /****************************************************************************/ @@ -486,7 +468,7 @@ static int mlp_peak_bitrate(int peak_bitrate, int sample_rate) static av_cold void mlp_encode_init_static(void) { clear_channel_params (restart_channel_params, MAX_CHANNELS); - clear_decoding_params(restart_decoding_params, MAX_SUBSTREAMS); + clear_decoding_params(restart_decoding_params); ff_mlp_init_crc(); } @@ -494,9 +476,9 @@ static av_cold int mlp_encode_init(AVCodecContext *avctx) { static AVOnce init_static_once = AV_ONCE_INIT; MLPEncodeContext *ctx = avctx->priv_data; - unsigned int substr, index; + RestartHeader *const rh = &ctx->restart_header; unsigned int sum = 0; - unsigned int size; + size_t size; int ret; ctx->avctx = avctx; @@ -590,29 +572,18 @@ static av_cold int mlp_encode_init(AVCodecContext *avctx) /* TODO Let user pass parameters for LPC filter. */ size = avctx->frame_size * ctx->max_restart_interval; - - ctx->lpc_sample_buffer = av_malloc_array(size, sizeof(int32_t)); - if (!ctx->lpc_sample_buffer) { - av_log(avctx, AV_LOG_ERROR, - "Not enough memory for buffering samples.\n"); + ctx->lpc_sample_buffer = av_calloc(size, sizeof(*ctx->lpc_sample_buffer)); + if (!ctx->lpc_sample_buffer) return AVERROR(ENOMEM); - } size = ctx->one_sample_buffer_size * ctx->max_restart_interval; - - ctx->major_scratch_buffer = av_malloc_array(size, sizeof(int32_t)); - if (!ctx->major_scratch_buffer) { - av_log(avctx, AV_LOG_ERROR, - "Not enough memory for buffering samples.\n"); + ctx->major_scratch_buffer = av_calloc(size, sizeof(*ctx->major_scratch_buffer)); + if (!ctx->major_scratch_buffer) return AVERROR(ENOMEM); - } - ctx->major_inout_buffer = av_malloc_array(size, sizeof(int32_t)); - if (!ctx->major_inout_buffer) { - av_log(avctx, AV_LOG_ERROR, - "Not enough memory for buffering samples.\n"); + ctx->major_inout_buffer = av_calloc(size, sizeof(*ctx->major_inout_buffer)); + if (!ctx->major_inout_buffer) return AVERROR(ENOMEM); - } ctx->num_substreams = 1; // TODO: change this after adding multi-channel support for TrueHD @@ -678,64 +649,49 @@ static av_cold int mlp_encode_init(AVCodecContext *avctx) ctx->summary_info = 0; } - size = sizeof(unsigned int) * ctx->max_restart_interval; - - ctx->frame_size = av_malloc(size); - if (!ctx->frame_size) - return AVERROR(ENOMEM); - - ctx->max_output_bits = av_malloc(size); + size = ctx->max_restart_interval; + ctx->max_output_bits = av_calloc(size, sizeof(*ctx->max_output_bits)); if (!ctx->max_output_bits) return AVERROR(ENOMEM); - size = sizeof(int32_t) - * ctx->num_substreams * ctx->max_restart_interval; - - ctx->lossless_check_data = av_malloc(size); + size = ctx->max_restart_interval; + ctx->lossless_check_data = av_calloc(size, sizeof(*ctx->lossless_check_data)); if (!ctx->lossless_check_data) return AVERROR(ENOMEM); - for (index = 0; index < ctx->restart_intervals; index++) { + for (unsigned int index = 0; index < ctx->restart_intervals; index++) { ctx->seq_offset[index] = sum; ctx->seq_size [index] = ((index + 1) * ctx->min_restart_interval) + 1; sum += ctx->seq_size[index]; } ctx->sequence_size = sum; - size = sizeof(ChannelParams) - * ctx->restart_intervals * ctx->sequence_size * ctx->avctx->channels; - ctx->channel_params = av_malloc(size); - if (!ctx->channel_params) { - av_log(avctx, AV_LOG_ERROR, - "Not enough memory for analysis context.\n"); + size = ctx->restart_intervals * ctx->sequence_size * ctx->avctx->channels; + ctx->channel_params = av_calloc(size, sizeof(*ctx->channel_params)); + if (!ctx->channel_params) return AVERROR(ENOMEM); - } - size = sizeof(DecodingParams) - * ctx->restart_intervals * ctx->sequence_size * ctx->num_substreams; - ctx->decoding_params = av_malloc(size); - if (!ctx->decoding_params) { - av_log(avctx, AV_LOG_ERROR, - "Not enough memory for analysis context.\n"); + size = ctx->restart_intervals * ctx->sequence_size; + ctx->decoding_params = av_calloc(size, sizeof(*ctx->decoding_params)); + if (!ctx->decoding_params) return AVERROR(ENOMEM); - } - - for (substr = 0; substr < ctx->num_substreams; substr++) { - RestartHeader *rh = &ctx->restart_header [substr]; - /* TODO see if noisegen_seed is really worth it. */ - rh->noisegen_seed = 0; + /* TODO see if noisegen_seed is really worth it. */ + rh->noisegen_seed = 0; - rh->min_channel = 0; - rh->max_channel = avctx->channels - 1; - /* FIXME: this works for 1 and 2 channels, but check for more */ - rh->max_matrix_channel = rh->max_channel; - } + rh->min_channel = 0; + rh->max_channel = avctx->channels - 1; + /* FIXME: this works for 1 and 2 channels, but check for more */ + rh->max_matrix_channel = rh->max_channel; if ((ret = ff_lpc_init(&ctx->lpc_ctx, ctx->number_of_samples, - MLP_MAX_LPC_ORDER, FF_LPC_TYPE_LEVINSON)) < 0) { - av_log(avctx, AV_LOG_ERROR, - "Not enough memory for LPC context.\n"); + MLP_MAX_LPC_ORDER, FF_LPC_TYPE_LEVINSON)) < 0) return ret; + + for (int i = 0; i < NUM_FILTERS; i++) { + ctx->filter_state_buffer[i] = av_calloc(avctx->frame_size * ctx->max_restart_interval, + sizeof(*ctx->filter_state_buffer[0])); + if (!ctx->filter_state_buffer[i]) + return AVERROR(ENOMEM); } ff_af_queue_init(avctx, &ctx->afq); @@ -816,7 +772,6 @@ static void write_restart_header(MLPEncodeContext *ctx, PutBitContext *pb) unsigned int start_count = put_bits_count(pb); PutBitContext tmpb; uint8_t checksum; - unsigned int ch; put_bits(pb, 14, 0x31ea ); /* TODO 0x31eb */ put_bits(pb, 16, ctx->timestamp ); @@ -833,7 +788,7 @@ static void write_restart_header(MLPEncodeContext *ctx, PutBitContext *pb) put_bits(pb, 8, lossless_check ); put_bits(pb, 16, 0 ); /* ignored */ - for (ch = 0; ch <= rh->max_matrix_channel; ch++) + for (unsigned int ch = 0; ch <= rh->max_matrix_channel; ch++) put_bits(pb, 6, ch); /* Data must be flushed for the checksum to be correct. */ @@ -850,18 +805,15 @@ static void write_matrix_params(MLPEncodeContext *ctx, PutBitContext *pb) { DecodingParams *dp = ctx->cur_decoding_params; MatrixParams *mp = &dp->matrix_params; - unsigned int mat; put_bits(pb, 4, mp->count); - for (mat = 0; mat < mp->count; mat++) { - unsigned int channel; - + for (unsigned int mat = 0; mat < mp->count; mat++) { put_bits(pb, 4, mp->outch[mat]); /* matrix_out_ch */ put_bits(pb, 4, mp->fbits[mat]); put_bits(pb, 1, 0 ); /* lsb_bypass */ - for (channel = 0; channel < ctx->num_channels; channel++) { + for (unsigned int channel = 0; channel < ctx->num_channels; channel++) { int32_t coeff = mp->coeff[mat][channel]; if (coeff) { @@ -886,14 +838,13 @@ static void write_filter_params(MLPEncodeContext *ctx, PutBitContext *pb, put_bits(pb, 4, fp->order); if (fp->order > 0) { - int i; int32_t *fcoeff = ctx->cur_channel_params[channel].coeff[filter]; put_bits(pb, 4, fp->shift ); put_bits(pb, 5, fp->coeff_bits ); put_bits(pb, 3, fp->coeff_shift); - for (i = 0; i < fp->order; i++) { + for (int i = 0; i < fp->order; i++) { put_sbits(pb, fp->coeff_bits, fcoeff[i] >> fp->coeff_shift); } @@ -911,7 +862,6 @@ static void write_decoding_params(MLPEncodeContext *ctx, PutBitContext *pb, DecodingParams *dp = ctx->cur_decoding_params; RestartHeader *rh = ctx->cur_restart_header; MatrixParams *mp = &dp->matrix_params; - unsigned int ch; if (dp->param_presence_flags != PARAMS_DEFAULT && params_changed & PARAM_PRESENCE_FLAGS) { @@ -942,7 +892,7 @@ static void write_decoding_params(MLPEncodeContext *ctx, PutBitContext *pb, if (dp->param_presence_flags & PARAM_OUTSHIFT) { if (params_changed & PARAM_OUTSHIFT) { put_bits(pb, 1, 1); - for (ch = 0; ch <= rh->max_matrix_channel; ch++) + for (unsigned int ch = 0; ch <= rh->max_matrix_channel; ch++) put_sbits(pb, 4, mp->shift[ch]); } else { put_bits(pb, 1, 0); @@ -952,14 +902,14 @@ static void write_decoding_params(MLPEncodeContext *ctx, PutBitContext *pb, if (dp->param_presence_flags & PARAM_QUANTSTEP) { if (params_changed & PARAM_QUANTSTEP) { put_bits(pb, 1, 1); - for (ch = 0; ch <= rh->max_channel; ch++) + for (unsigned int ch = 0; ch <= rh->max_channel; ch++) put_bits(pb, 4, dp->quant_step_size[ch]); } else { put_bits(pb, 1, 0); } } - for (ch = rh->min_channel; ch <= rh->max_channel; ch++) { + for (unsigned int ch = rh->min_channel; ch <= rh->max_channel; ch++) { ChannelParams *cp = &ctx->cur_channel_params[ch]; if (dp->param_presence_flags & 0xF) { @@ -1014,9 +964,8 @@ static void write_block_data(MLPEncodeContext *ctx, PutBitContext *pb) int32_t sign_huff_offset[MAX_CHANNELS]; int codebook_index [MAX_CHANNELS]; int lsb_bits [MAX_CHANNELS]; - unsigned int i, ch; - for (ch = rh->min_channel; ch <= rh->max_channel; ch++) { + for (unsigned int ch = rh->min_channel; ch <= rh->max_channel; ch++) { ChannelParams *cp = &ctx->cur_channel_params[ch]; int sign_shift; @@ -1034,8 +983,8 @@ static void write_block_data(MLPEncodeContext *ctx, PutBitContext *pb) sign_huff_offset[ch] -= 1 << sign_shift; } - for (i = 0; i < dp->blocksize; i++) { - for (ch = rh->min_channel; ch <= rh->max_channel; ch++) { + for (unsigned int i = 0; i < dp->blocksize; i++) { + for (unsigned int ch = rh->min_channel; ch <= rh->max_channel; ch++) { int32_t sample = *sample_buffer++ >> dp->quant_step_size[ch]; sample -= sign_huff_offset[ch]; @@ -1053,91 +1002,89 @@ static void write_block_data(MLPEncodeContext *ctx, PutBitContext *pb) ctx->write_buffer = sample_buffer; } -/** Writes the substreams data to the bitstream. */ -static uint8_t *write_substrs(MLPEncodeContext *ctx, uint8_t *buf, int buf_size, - int restart_frame, - uint16_t substream_data_len[MAX_SUBSTREAMS]) +/** Writes the substream data to the bitstream. */ +static uint8_t *write_substr(MLPEncodeContext *ctx, uint8_t *buf, int buf_size, + int restart_frame, + uint16_t substream_data_len[MAX_SUBSTREAMS]) { int32_t *lossless_check_data = ctx->lossless_check_data; - unsigned int substr; + unsigned int cur_subblock_index = ctx->major_cur_subblock_index; + unsigned int num_subblocks = ctx->major_filter_state_subblock; + RestartHeader *rh = &ctx->restart_header; + int substr_restart_frame = restart_frame; + uint8_t parity, checksum; + PutBitContext pb; + int params_changed; int end = 0; - lossless_check_data += ctx->frame_index * ctx->num_substreams; + lossless_check_data += ctx->frame_index; + ctx->cur_restart_header = rh; - for (substr = 0; substr < ctx->num_substreams; substr++) { - unsigned int cur_subblock_index = ctx->major_cur_subblock_index; - unsigned int num_subblocks = ctx->major_filter_state_subblock; - unsigned int subblock; - RestartHeader *rh = &ctx->restart_header [substr]; - int substr_restart_frame = restart_frame; - uint8_t parity, checksum; - PutBitContext pb; - int params_changed; - - ctx->cur_restart_header = rh; + init_put_bits(&pb, buf, buf_size); - init_put_bits(&pb, buf, buf_size); + for (unsigned int subblock = 0; subblock <= num_subblocks; subblock++) { + unsigned int subblock_index; - for (subblock = 0; subblock <= num_subblocks; subblock++) { - unsigned int subblock_index; + subblock_index = cur_subblock_index++; - subblock_index = cur_subblock_index++; + ctx->cur_decoding_params = &ctx->major_decoding_params[subblock_index]; + ctx->cur_channel_params = ctx->major_channel_params[subblock_index]; - ctx->cur_decoding_params = &ctx->major_decoding_params[subblock_index][substr]; - ctx->cur_channel_params = ctx->major_channel_params[subblock_index]; + params_changed = ctx->major_params_changed[subblock_index]; - params_changed = ctx->major_params_changed[subblock_index][substr]; + if (substr_restart_frame || params_changed) { + put_bits(&pb, 1, 1); - if (substr_restart_frame || params_changed) { + if (substr_restart_frame) { put_bits(&pb, 1, 1); - if (substr_restart_frame) { - put_bits(&pb, 1, 1); - - write_restart_header(ctx, &pb); - rh->lossless_check_data = 0; - } else { - put_bits(&pb, 1, 0); - } - - write_decoding_params(ctx, &pb, params_changed); + write_restart_header(ctx, &pb); + rh->lossless_check_data = 0; } else { put_bits(&pb, 1, 0); } - write_block_data(ctx, &pb); + write_decoding_params(ctx, &pb, params_changed); + } else { + put_bits(&pb, 1, 0); + } - put_bits(&pb, 1, !substr_restart_frame); + write_block_data(ctx, &pb); - substr_restart_frame = 0; - } + put_bits(&pb, 1, !substr_restart_frame); + + substr_restart_frame = 0; + } - put_bits(&pb, (-put_bits_count(&pb)) & 15, 0); + put_bits(&pb, (-put_bits_count(&pb)) & 15, 0); - rh->lossless_check_data ^= *lossless_check_data++; + rh->lossless_check_data ^= *lossless_check_data++; - if (ctx->last_frame == ctx->inout_buffer) { - /* TODO find a sample and implement shorten_by. */ + if (ctx->last_frames == 0 && ctx->shorten_by) { + if (ctx->avctx->codec_id == AV_CODEC_ID_TRUEHD) { + put_bits(&pb, 16, END_OF_STREAM & 0xFFFF); + put_bits(&pb, 16, (ctx->shorten_by & 0x1FFF) | 0x2000); + } else { put_bits(&pb, 32, END_OF_STREAM); } + } - /* Data must be flushed for the checksum and parity to be correct; - * notice that we already are word-aligned here. */ - flush_put_bits(&pb); + /* Data must be flushed for the checksum and parity to be correct; + * notice that we already are word-aligned here. */ + flush_put_bits(&pb); - parity = ff_mlp_calculate_parity(buf, put_bytes_output(&pb)) ^ 0xa9; - checksum = ff_mlp_checksum8 (buf, put_bytes_output(&pb)); + parity = ff_mlp_calculate_parity(buf, put_bytes_output(&pb)) ^ 0xa9; + checksum = ff_mlp_checksum8 (buf, put_bytes_output(&pb)); - put_bits(&pb, 8, parity ); - put_bits(&pb, 8, checksum); + put_bits(&pb, 8, parity ); + put_bits(&pb, 8, checksum); - flush_put_bits(&pb); + flush_put_bits(&pb); - end += put_bytes_output(&pb); - substream_data_len[substr] = end; + end += put_bytes_output(&pb); + substream_data_len[0] = end; - buf += put_bytes_output(&pb); - } + buf += put_bytes_output(&pb); ctx->major_cur_subblock_index += ctx->major_filter_state_subblock + 1; ctx->major_filter_state_subblock = 0; @@ -1149,16 +1096,15 @@ static uint8_t *write_substrs(MLPEncodeContext *ctx, uint8_t *buf, int buf_size, static void write_frame_headers(MLPEncodeContext *ctx, uint8_t *frame_header, uint8_t *substream_headers, unsigned int length, int restart_frame, - uint16_t substream_data_len[MAX_SUBSTREAMS]) + uint16_t substream_data_len[1]) { uint16_t access_unit_header = 0; uint16_t parity_nibble = 0; - unsigned int substr; parity_nibble = ctx->dts; parity_nibble ^= length; - for (substr = 0; substr < ctx->num_substreams; substr++) { + for (unsigned int substr = 0; substr < ctx->num_substreams; substr++) { uint16_t substr_hdr = 0; substr_hdr |= (0 << 15); /* extraword */ @@ -1185,24 +1131,18 @@ static void write_frame_headers(MLPEncodeContext *ctx, uint8_t *frame_header, } /** Writes an entire access unit to the bitstream. */ -static unsigned int write_access_unit(MLPEncodeContext *ctx, uint8_t *buf, - int buf_size, int restart_frame) +static int write_access_unit(MLPEncodeContext *ctx, uint8_t *buf, + int buf_size, int restart_frame) { uint16_t substream_data_len[MAX_SUBSTREAMS]; uint8_t *buf1, *buf0 = buf; - unsigned int substr; int total_length; - if (buf_size < 4) - return AVERROR(EINVAL); - /* Frame header will be written at the end. */ buf += 4; buf_size -= 4; if (restart_frame) { - if (buf_size < 28) - return AVERROR(EINVAL); write_major_sync(ctx, buf, buf_size); buf += 28; buf_size -= 28; @@ -1211,12 +1151,12 @@ static unsigned int write_access_unit(MLPEncodeContext *ctx, uint8_t *buf, buf1 = buf; /* Substream headers will be written at the end. */ - for (substr = 0; substr < ctx->num_substreams; substr++) { + for (unsigned int substr = 0; substr < ctx->num_substreams; substr++) { buf += 2; buf_size -= 2; } - buf = write_substrs(ctx, buf, buf_size, restart_frame, substream_data_len); + buf = write_substr(ctx, buf, buf_size, restart_frame, &substream_data_len[0]); total_length = buf - buf0; @@ -1239,41 +1179,35 @@ static void input_data_internal(MLPEncodeContext *ctx, const uint8_t *samples, int32_t *lossless_check_data = ctx->lossless_check_data; const int32_t *samples_32 = (const int32_t *) samples; const int16_t *samples_16 = (const int16_t *) samples; - unsigned int substr; + RestartHeader *rh = &ctx->restart_header; + int32_t *sample_buffer = ctx->inout_buffer; + int32_t temp_lossless_check_data = 0; + uint32_t greatest = 0; - lossless_check_data += ctx->frame_index * ctx->num_substreams; + lossless_check_data += ctx->frame_index; - for (substr = 0; substr < ctx->num_substreams; substr++) { - RestartHeader *rh = &ctx->restart_header [substr]; - int32_t *sample_buffer = ctx->inout_buffer; - int32_t temp_lossless_check_data = 0; - uint32_t greatest = 0; - unsigned int channel; - int i; + for (int i = 0; i < ctx->avctx->frame_size; i++) { + for (unsigned int channel = 0; channel <= rh->max_channel; channel++) { + uint32_t abs_sample; + int32_t sample; - for (i = 0; i < ctx->frame_size[ctx->frame_index]; i++) { - for (channel = 0; channel <= rh->max_channel; channel++) { - uint32_t abs_sample; - int32_t sample; + sample = is24 ? *samples_32++ >> 8 : *samples_16++ * 256; - sample = is24 ? *samples_32++ >> 8 : *samples_16++ * 256; + /* TODO Find out if number_sbits can be used for negative values. */ + abs_sample = FFABS(sample); + if (greatest < abs_sample) + greatest = abs_sample; - /* TODO Find out if number_sbits can be used for negative values. */ - abs_sample = FFABS(sample); - if (greatest < abs_sample) - greatest = abs_sample; - - temp_lossless_check_data ^= (sample & 0x00ffffff) << channel; - *sample_buffer++ = sample; - } - - sample_buffer += 2; /* noise channels */ + temp_lossless_check_data ^= (sample & 0x00ffffff) << channel; + *sample_buffer++ = sample; } - ctx->max_output_bits[ctx->frame_index] = number_sbits(greatest); - - *lossless_check_data++ = temp_lossless_check_data; + sample_buffer += 2; /* noise channels */ } + + ctx->max_output_bits[ctx->frame_index] = number_sbits(greatest); + + *lossless_check_data++ = temp_lossless_check_data; } /** Wrapper function for inputting data in two different bit-depths. */ @@ -1288,15 +1222,13 @@ static void input_data(MLPEncodeContext *ctx, void *samples) static void input_to_sample_buffer(MLPEncodeContext *ctx) { int32_t *sample_buffer = ctx->sample_buffer; - unsigned int index; - for (index = 0; index < ctx->number_of_frames; index++) { - unsigned int cur_index = (ctx->starting_frame_index + index) % ctx->max_restart_interval; + for (unsigned int index = 0; index < ctx->number_of_frames; index++) { + unsigned int cur_index = (ctx->frame_index + index + 1) % ctx->max_restart_interval; int32_t *input_buffer = ctx->inout_buffer + cur_index * ctx->one_sample_buffer_size; - unsigned int i, channel; - for (i = 0; i < ctx->frame_size[cur_index]; i++) { - for (channel = 0; channel < ctx->avctx->channels; channel++) + for (unsigned int i = 0; i < ctx->avctx->frame_size; i++) { + for (unsigned int channel = 0; channel < ctx->avctx->channels; channel++) *sample_buffer++ = *input_buffer++; sample_buffer += 2; /* noise_channels */ input_buffer += 2; /* noise_channels */ @@ -1311,13 +1243,11 @@ static void input_to_sample_buffer(MLPEncodeContext *ctx) /** Counts the number of trailing zeroes in a value */ static int number_trailing_zeroes(int32_t sample) { - int bits; - - for (bits = 0; bits < 24 && !(sample & (1<<bits)); bits++); + int bits = ff_ctz(sample); /* All samples are 0. TODO Return previous quant_step_size to avoid * writing a new header. */ - if (bits == 24) + if (bits >= 24) return 0; return bits; @@ -1333,19 +1263,17 @@ static void determine_quant_step_size(MLPEncodeContext *ctx) MatrixParams *mp = &dp->matrix_params; int32_t *sample_buffer = ctx->sample_buffer; int32_t sample_mask[MAX_CHANNELS]; - unsigned int channel; - int i; memset(sample_mask, 0x00, sizeof(sample_mask)); - for (i = 0; i < ctx->number_of_samples; i++) { - for (channel = 0; channel <= rh->max_channel; channel++) + for (unsigned int i = 0; i < ctx->number_of_samples; i++) { + for (unsigned int channel = 0; channel <= rh->max_channel; channel++) sample_mask[channel] |= *sample_buffer++; sample_buffer += 2; /* noise channels */ } - for (channel = 0; channel <= rh->max_channel; channel++) + for (unsigned int channel = 0; channel <= rh->max_channel; channel++) dp->quant_step_size[channel] = number_trailing_zeroes(sample_mask[channel]) - mp->shift[channel]; } @@ -1358,9 +1286,8 @@ static void code_filter_coeffs(MLPEncodeContext *ctx, FilterParams *fp, int32_t int min = INT_MAX, max = INT_MIN; int bits, shift; int coeff_mask = 0; - int order; - for (order = 0; order < fp->order; order++) { + for (int order = 0; order < fp->order; order++) { int coeff = fcoeff[order]; if (coeff < min) @@ -1403,10 +1330,9 @@ static void set_filter_params(MLPEncodeContext *ctx, int32_t *lpc_samples = ctx->lpc_sample_buffer; int32_t *fcoeff = ctx->cur_channel_params[channel].coeff[filter]; int shift[MLP_MAX_LPC_ORDER]; - unsigned int i; int order; - for (i = 0; i < ctx->number_of_samples; i++) { + for (unsigned int i = 0; i < ctx->number_of_samples; i++) { *lpc_samples++ = *sample_buffer; sample_buffer += ctx->num_channels; } @@ -1420,7 +1346,7 @@ static void set_filter_params(MLPEncodeContext *ctx, fp->order = order; fp->shift = shift[order-1]; - for (i = 0; i < order; i++) + for (unsigned int i = 0; i < order; i++) fcoeff[i] = coefs[order-1][i]; code_filter_coeffs(ctx, fp, fcoeff); @@ -1434,10 +1360,9 @@ static void set_filter_params(MLPEncodeContext *ctx, static void determine_filters(MLPEncodeContext *ctx) { RestartHeader *rh = ctx->cur_restart_header; - int channel, filter; - for (channel = rh->min_channel; channel <= rh->max_channel; channel++) { - for (filter = 0; filter < NUM_FILTERS; filter++) + for (int channel = rh->min_channel; channel <= rh->max_channel; channel++) { + for (int filter = 0; filter < NUM_FILTERS; filter++) set_filter_params(ctx, channel, filter, 0); } } @@ -1487,10 +1412,9 @@ static void code_matrix_coeffs(MLPEncodeContext *ctx, unsigned int mat) DecodingParams *dp = ctx->cur_decoding_params; MatrixParams *mp = &dp->matrix_params; int32_t coeff_mask = 0; - unsigned int channel; unsigned int bits; - for (channel = 0; channel < ctx->num_channels; channel++) { + for (unsigned int channel = 0; channel < ctx->num_channels; channel++) { int32_t coeff = mp->coeff[mat][channel]; coeff_mask |= coeff; } @@ -1506,8 +1430,6 @@ static void lossless_matrix_coeffs(MLPEncodeContext *ctx) DecodingParams *dp = ctx->cur_decoding_params; MatrixParams *mp = &dp->matrix_params; unsigned int shift = 0; - unsigned int channel; - int mat; enum MLPChMode mode; /* No decorrelation for non-stereo. */ @@ -1518,34 +1440,34 @@ static void lossless_matrix_coeffs(MLPEncodeContext *ctx) mode = estimate_stereo_mode(ctx); - switch(mode) { - /* TODO: add matrix for MID_SIDE */ - case MLP_CHMODE_MID_SIDE: - case MLP_CHMODE_LEFT_RIGHT: - mp->count = 0; - break; - case MLP_CHMODE_LEFT_SIDE: - mp->count = 1; - mp->outch[0] = 1; - mp->coeff[0][0] = 1 << 14; mp->coeff[0][1] = -(1 << 14); - mp->coeff[0][2] = 0 << 14; mp->coeff[0][2] = 0 << 14; - mp->forco[0][0] = 1 << 14; mp->forco[0][1] = -(1 << 14); - mp->forco[0][2] = 0 << 14; mp->forco[0][2] = 0 << 14; - break; - case MLP_CHMODE_RIGHT_SIDE: - mp->count = 1; - mp->outch[0] = 0; - mp->coeff[0][0] = 1 << 14; mp->coeff[0][1] = 1 << 14; - mp->coeff[0][2] = 0 << 14; mp->coeff[0][2] = 0 << 14; - mp->forco[0][0] = 1 << 14; mp->forco[0][1] = -(1 << 14); - mp->forco[0][2] = 0 << 14; mp->forco[0][2] = 0 << 14; - break; + switch (mode) { + /* TODO: add matrix for MID_SIDE */ + case MLP_CHMODE_MID_SIDE: + case MLP_CHMODE_LEFT_RIGHT: + mp->count = 0; + break; + case MLP_CHMODE_LEFT_SIDE: + mp->count = 1; + mp->outch[0] = 1; + mp->coeff[0][0] = 1 << 14; mp->coeff[0][1] = -(1 << 14); + mp->coeff[0][2] = 0 << 14; mp->coeff[0][2] = 0 << 14; + mp->forco[0][0] = 1 << 14; mp->forco[0][1] = -(1 << 14); + mp->forco[0][2] = 0 << 14; mp->forco[0][2] = 0 << 14; + break; + case MLP_CHMODE_RIGHT_SIDE: + mp->count = 1; + mp->outch[0] = 0; + mp->coeff[0][0] = 1 << 14; mp->coeff[0][1] = 1 << 14; + mp->coeff[0][2] = 0 << 14; mp->coeff[0][2] = 0 << 14; + mp->forco[0][0] = 1 << 14; mp->forco[0][1] = -(1 << 14); + mp->forco[0][2] = 0 << 14; mp->forco[0][2] = 0 << 14; + break; } - for (mat = 0; mat < mp->count; mat++) + for (int mat = 0; mat < mp->count; mat++) code_matrix_coeffs(ctx, mat); - for (channel = 0; channel < ctx->num_channels; channel++) + for (unsigned int channel = 0; channel < ctx->num_channels; channel++) mp->shift[channel] = shift; } @@ -1644,7 +1566,6 @@ static inline void codebook_bits_offset(MLPEncodeContext *ctx, int lsb_bits = 0, bitcount = 0; int offset_min = INT_MAX, offset_max = INT_MAX; int unsign, mask; - int i; sample_min -= offset; sample_max -= offset; @@ -1663,7 +1584,7 @@ static inline void codebook_bits_offset(MLPEncodeContext *ctx, lsb_bits++; } - for (i = 0; i < dp->blocksize; i++) { + for (int i = 0; i < dp->blocksize; i++) { int32_t sample = *sample_buffer >> dp->quant_step_size[channel]; int temp_min, temp_max; @@ -1738,19 +1659,17 @@ static void determine_bits(MLPEncodeContext *ctx) { DecodingParams *dp = ctx->cur_decoding_params; RestartHeader *rh = ctx->cur_restart_header; - unsigned int channel; - for (channel = 0; channel <= rh->max_channel; channel++) { + for (unsigned int channel = 0; channel <= rh->max_channel; channel++) { ChannelParams *cp = &ctx->cur_channel_params[channel]; int32_t *sample_buffer = ctx->sample_buffer + channel; int32_t min = INT32_MAX, max = INT32_MIN; int no_filters_used = !cp->filter_params[FIR].order; int average = 0; int offset = 0; - int i; /* Determine extremes and average. */ - for (i = 0; i < dp->blocksize; i++) { + for (int i = 0; i < dp->blocksize; i++) { int32_t sample = *sample_buffer >> dp->quant_step_size[channel]; if (sample < min) min = sample; @@ -1770,7 +1689,7 @@ static void determine_bits(MLPEncodeContext *ctx) no_codebook_bits_offset(ctx, channel, offset, min, max, &ctx->cur_best_offset[channel][0]); } - for (i = 1; i < NUM_CODEBOOKS; i++) { + for (int i = 1; i < NUM_CODEBOOKS; i++) { BestOffset temp_bo = { 0, INT_MAX, 0, 0, 0, }; int16_t offset_max; @@ -1810,42 +1729,28 @@ static int apply_filter(MLPEncodeContext *ctx, unsigned int channel) { FilterParams *fp[NUM_FILTERS] = { &ctx->cur_channel_params[channel].filter_params[FIR], &ctx->cur_channel_params[channel].filter_params[IIR], }; - int32_t *filter_state_buffer[NUM_FILTERS] = { NULL }; int32_t mask = MSB_MASK(ctx->cur_decoding_params->quant_step_size[channel]); int32_t *sample_buffer = ctx->sample_buffer + channel; unsigned int number_of_samples = ctx->number_of_samples; unsigned int filter_shift = fp[FIR]->shift; - int filter; - int i, ret = 0; - - for (i = 0; i < NUM_FILTERS; i++) { - unsigned int size = ctx->number_of_samples; - filter_state_buffer[i] = av_malloc(size*sizeof(int32_t)); - if (!filter_state_buffer[i]) { - av_log(ctx->avctx, AV_LOG_ERROR, - "Not enough memory for applying filters.\n"); - ret = AVERROR(ENOMEM); - goto free_and_return; - } - } + int ret = 0; - for (i = 0; i < 8; i++) { - filter_state_buffer[FIR][i] = *sample_buffer; - filter_state_buffer[IIR][i] = *sample_buffer; + for (int i = 0; i < 8; i++) { + ctx->filter_state_buffer[FIR][i] = *sample_buffer; + ctx->filter_state_buffer[IIR][i] = *sample_buffer; sample_buffer += ctx->num_channels; } - for (i = 8; i < number_of_samples; i++) { + for (int i = 8; i < number_of_samples; i++) { int32_t sample = *sample_buffer; - unsigned int order; int64_t accum = 0; int64_t residual; - for (filter = 0; filter < NUM_FILTERS; filter++) { + for (int filter = 0; filter < NUM_FILTERS; filter++) { int32_t *fcoeff = ctx->cur_channel_params[channel].coeff[filter]; - for (order = 0; order < fp[filter]->order; order++) - accum += (int64_t)filter_state_buffer[filter][i - 1 - order] * + for (unsigned int order = 0; order < fp[filter]->order; order++) + accum += (int64_t)ctx->filter_state_buffer[filter][i - 1 - order] * fcoeff[order]; } @@ -1854,36 +1759,30 @@ static int apply_filter(MLPEncodeContext *ctx, unsigned int channel) if (residual < SAMPLE_MIN(24) || residual > SAMPLE_MAX(24)) { ret = AVERROR_INVALIDDATA; - goto free_and_return; + return ret; } - filter_state_buffer[FIR][i] = sample; - filter_state_buffer[IIR][i] = (int32_t) residual; + ctx->filter_state_buffer[FIR][i] = sample; + ctx->filter_state_buffer[IIR][i] = (int32_t) residual; sample_buffer += ctx->num_channels; } sample_buffer = ctx->sample_buffer + channel; - for (i = 0; i < number_of_samples; i++) { - *sample_buffer = filter_state_buffer[IIR][i]; + for (int i = 0; i < number_of_samples; i++) { + *sample_buffer = ctx->filter_state_buffer[IIR][i]; sample_buffer += ctx->num_channels; } -free_and_return: - for (i = 0; i < NUM_FILTERS; i++) { - av_freep(&filter_state_buffer[i]); - } - return ret; } static void apply_filters(MLPEncodeContext *ctx) { RestartHeader *rh = ctx->cur_restart_header; - int channel; - for (channel = rh->min_channel; channel <= rh->max_channel; channel++) { + for (int channel = rh->min_channel; channel <= rh->max_channel; channel++) { if (apply_filter(ctx, channel) < 0) { /* Filter is horribly wrong. * Clear filter params and update state. */ @@ -1899,10 +1798,9 @@ static void generate_2_noise_channels(MLPEncodeContext *ctx) { int32_t *sample_buffer = ctx->sample_buffer + ctx->num_channels - 2; RestartHeader *rh = ctx->cur_restart_header; - unsigned int i; uint32_t seed = rh->noisegen_seed; - for (i = 0; i < ctx->number_of_samples; i++) { + for (unsigned int i = 0; i < ctx->number_of_samples; i++) { uint16_t seed_shr7 = seed >> 7; *sample_buffer++ = ((int8_t)(seed >> 15)) * (1 << rh->noise_shift); *sample_buffer++ = ((int8_t) seed_shr7) * (1 << rh->noise_shift); @@ -1921,21 +1819,18 @@ static void rematrix_channels(MLPEncodeContext *ctx) DecodingParams *dp = ctx->cur_decoding_params; MatrixParams *mp = &dp->matrix_params; int32_t *sample_buffer = ctx->sample_buffer; - unsigned int mat, i, maxchan; - - maxchan = ctx->num_channels; + unsigned int maxchan = ctx->num_channels; - for (mat = 0; mat < mp->count; mat++) { + for (unsigned int mat = 0; mat < mp->count; mat++) { unsigned int msb_mask_bits = (ctx->avctx->sample_fmt == AV_SAMPLE_FMT_S16 ? 8 : 0) - mp->shift[mat]; int32_t mask = MSB_MASK(msb_mask_bits); unsigned int outch = mp->outch[mat]; sample_buffer = ctx->sample_buffer; - for (i = 0; i < ctx->number_of_samples; i++) { - unsigned int src_ch; + for (unsigned int i = 0; i < ctx->number_of_samples; i++) { int64_t accum = 0; - for (src_ch = 0; src_ch < maxchan; src_ch++) { + for (unsigned int src_ch = 0; src_ch < maxchan; src_ch++) { int32_t sample = *(sample_buffer + src_ch); accum += (int64_t) sample * mp->forco[mat][src_ch]; } @@ -1965,10 +1860,7 @@ static void clear_path_counter(PathCounter *path_counter) static int compare_best_offset(const BestOffset *prev, const BestOffset *cur) { - if (prev->lsb_bits != cur->lsb_bits) - return 1; - - return 0; + return prev->lsb_bits != cur->lsb_bits; } static int best_codebook_path_cost(MLPEncodeContext *ctx, unsigned int channel, @@ -1994,29 +1886,25 @@ static void set_best_codebook(MLPEncodeContext *ctx) { DecodingParams *dp = ctx->cur_decoding_params; RestartHeader *rh = ctx->cur_restart_header; - unsigned int channel; - for (channel = rh->min_channel; channel <= rh->max_channel; channel++) { + for (unsigned int channel = rh->min_channel; channel <= rh->max_channel; channel++) { const BestOffset *prev_bo = restart_best_offset; BestOffset *cur_bo; PathCounter path_counter[NUM_CODEBOOKS + 1]; unsigned int best_codebook; - unsigned int index; char *best_path; clear_path_counter(path_counter); - for (index = 0; index < ctx->number_of_subblocks; index++) { + for (unsigned int index = 0; index < ctx->number_of_subblocks; index++) { unsigned int best_bitcount = INT_MAX; - unsigned int codebook; cur_bo = ctx->best_offset[index][channel]; - for (codebook = 0; codebook < NUM_CODEBOOKS; codebook++) { + for (unsigned int codebook = 0; codebook < NUM_CODEBOOKS; codebook++) { int prev_best_bitcount = INT_MAX; - int last_best; - for (last_best = 0; last_best < 2; last_best++) { + for (unsigned int last_best = 0; last_best < 2; last_best++) { PathCounter *dst_path = &path_counter[codebook]; PathCounter *src_path; int temp_bitcount; @@ -2058,7 +1946,7 @@ static void set_best_codebook(MLPEncodeContext *ctx) best_path = path_counter[NUM_CODEBOOKS].path + 1; /* Update context. */ - for (index = 0; index < ctx->number_of_subblocks; index++) { + for (unsigned int index = 0; index < ctx->number_of_subblocks; index++) { ChannelParams *cp = ctx->seq_channel_params + index*(ctx->avctx->channels) + channel; best_codebook = *best_path++; @@ -2078,56 +1966,43 @@ static void set_best_codebook(MLPEncodeContext *ctx) static void set_major_params(MLPEncodeContext *ctx) { RestartHeader *rh = ctx->cur_restart_header; - unsigned int index; - unsigned int substr; uint8_t max_huff_lsbs = 0; uint8_t max_output_bits = 0; - - for (substr = 0; substr < ctx->num_substreams; substr++) { - DecodingParams *seq_dp = (DecodingParams *) ctx->decoding_params+ - (ctx->restart_intervals - 1)*(ctx->sequence_size)*(ctx->avctx->channels) + - (ctx->seq_offset[ctx->restart_intervals - 1])*(ctx->avctx->channels); - - ChannelParams *seq_cp = (ChannelParams *) ctx->channel_params + - (ctx->restart_intervals - 1)*(ctx->sequence_size)*(ctx->avctx->channels) + - (ctx->seq_offset[ctx->restart_intervals - 1])*(ctx->avctx->channels); - unsigned int channel; - for (index = 0; index < ctx->seq_size[ctx->restart_intervals-1]; index++) { - memcpy(&ctx->major_decoding_params[index][substr], seq_dp + index*(ctx->num_substreams) + substr, sizeof(DecodingParams)); - for (channel = 0; channel < ctx->avctx->channels; channel++) { - uint8_t huff_lsbs = (seq_cp + index*(ctx->avctx->channels) + channel)->huff_lsbs; - if (max_huff_lsbs < huff_lsbs) - max_huff_lsbs = huff_lsbs; - memcpy(&ctx->major_channel_params[index][channel], - (seq_cp + index*(ctx->avctx->channels) + channel), - sizeof(ChannelParams)); - } + DecodingParams *seq_dp = ctx->decoding_params + ctx->seq_offset[0] * ctx->avctx->channels; + ChannelParams *seq_cp = ctx->channel_params + ctx->seq_offset[0] * ctx->avctx->channels; + + for (unsigned int index = 0; index < ctx->seq_size[ctx->restart_intervals-1]; index++) { + memcpy(&ctx->major_decoding_params[index], seq_dp + index, sizeof(DecodingParams)); + for (unsigned int channel = 0; channel < ctx->avctx->channels; channel++) { + uint8_t huff_lsbs = (seq_cp + index*(ctx->avctx->channels) + channel)->huff_lsbs; + if (max_huff_lsbs < huff_lsbs) + max_huff_lsbs = huff_lsbs; + memcpy(&ctx->major_channel_params[index][channel], + (seq_cp + index*(ctx->avctx->channels) + channel), + sizeof(ChannelParams)); } } rh->max_huff_lsbs = max_huff_lsbs; - for (index = 0; index < ctx->number_of_frames; index++) + for (unsigned int index = 0; index < ctx->number_of_frames; index++) if (max_output_bits < ctx->max_output_bits[index]) max_output_bits = ctx->max_output_bits[index]; rh->max_output_bits = max_output_bits; - for (substr = 0; substr < ctx->num_substreams; substr++) { + ctx->cur_restart_header = &ctx->restart_header; - ctx->cur_restart_header = &ctx->restart_header[substr]; + ctx->prev_decoding_params = restart_decoding_params; + ctx->prev_channel_params = restart_channel_params; - ctx->prev_decoding_params = &restart_decoding_params[substr]; - ctx->prev_channel_params = restart_channel_params; + for (unsigned int index = 0; index < MAJOR_HEADER_INTERVAL + 1; index++) { + ctx->cur_decoding_params = &ctx->major_decoding_params[index]; + ctx->cur_channel_params = ctx->major_channel_params[index]; - for (index = 0; index < MAJOR_HEADER_INTERVAL + 1; index++) { - ctx->cur_decoding_params = &ctx->major_decoding_params[index][substr]; - ctx->cur_channel_params = ctx->major_channel_params[index]; + ctx->major_params_changed[index] = compare_decoding_params(ctx); - ctx->major_params_changed[index][substr] = compare_decoding_params(ctx); - - ctx->prev_decoding_params = ctx->cur_decoding_params; - ctx->prev_channel_params = ctx->cur_channel_params; - } + ctx->prev_decoding_params = ctx->cur_decoding_params; + ctx->prev_channel_params = ctx->cur_channel_params; } ctx->major_number_of_subblocks = ctx->number_of_subblocks; @@ -2139,71 +2014,61 @@ static void analyze_sample_buffer(MLPEncodeContext *ctx) { ChannelParams *seq_cp = ctx->seq_channel_params; DecodingParams *seq_dp = ctx->seq_decoding_params; - unsigned int index; - unsigned int substr; - - for (substr = 0; substr < ctx->num_substreams; substr++) { - - ctx->cur_restart_header = &ctx->restart_header[substr]; - ctx->cur_decoding_params = seq_dp + 1*(ctx->num_substreams) + substr; - ctx->cur_channel_params = seq_cp + 1*(ctx->avctx->channels); - - determine_quant_step_size(ctx); - generate_2_noise_channels(ctx); - lossless_matrix_coeffs (ctx); - rematrix_channels (ctx); - determine_filters (ctx); - apply_filters (ctx); - - copy_restart_frame_params(ctx, substr); - - /* Copy frame_size from frames 0...max to decoding_params 1...max + 1 - * decoding_params[0] is for the filter state subblock. - */ - for (index = 0; index < ctx->number_of_frames; index++) { - DecodingParams *dp = seq_dp + (index + 1)*(ctx->num_substreams) + substr; - dp->blocksize = ctx->frame_size[index]; - } - /* The official encoder seems to always encode a filter state subblock - * even if there are no filters. TODO check if it is possible to skip - * the filter state subblock for no filters. - */ - (seq_dp + substr)->blocksize = 8; - (seq_dp + 1*(ctx->num_substreams) + substr)->blocksize -= 8; - - for (index = 0; index < ctx->number_of_subblocks; index++) { - ctx->cur_decoding_params = seq_dp + index*(ctx->num_substreams) + substr; - ctx->cur_channel_params = seq_cp + index*(ctx->avctx->channels); - ctx->cur_best_offset = ctx->best_offset[index]; - determine_bits(ctx); - ctx->sample_buffer += ctx->cur_decoding_params->blocksize * ctx->num_channels; - } - set_best_codebook(ctx); - } + ctx->cur_restart_header = &ctx->restart_header; + ctx->cur_decoding_params = seq_dp + 1; + ctx->cur_channel_params = seq_cp + ctx->avctx->channels; + + determine_quant_step_size(ctx); + generate_2_noise_channels(ctx); + lossless_matrix_coeffs (ctx); + rematrix_channels (ctx); + determine_filters (ctx); + apply_filters (ctx); + + copy_restart_frame_params(ctx); + + /* Copy frame_size from frames 0...max to decoding_params 1...max + 1 + * decoding_params[0] is for the filter state subblock. + */ + for (unsigned int index = 0; index < ctx->number_of_frames; index++) { + DecodingParams *dp = seq_dp + (index + 1); + dp->blocksize = ctx->avctx->frame_size; + } + /* The official encoder seems to always encode a filter state subblock + * even if there are no filters. TODO check if it is possible to skip + * the filter state subblock for no filters. + */ + (seq_dp + 0)->blocksize = 8; + (seq_dp + 1)->blocksize -= 8; + + for (unsigned int index = 0; index < ctx->number_of_subblocks; index++) { + ctx->cur_decoding_params = seq_dp + index; + ctx->cur_channel_params = seq_cp + index*(ctx->avctx->channels); + ctx->cur_best_offset = ctx->best_offset[index]; + determine_bits(ctx); + ctx->sample_buffer += ctx->cur_decoding_params->blocksize * ctx->num_channels; + } + + set_best_codebook(ctx); } static void process_major_frame(MLPEncodeContext *ctx) { - unsigned int substr; - ctx->sample_buffer = ctx->major_inout_buffer; - ctx->starting_frame_index = 0; ctx->number_of_frames = ctx->major_number_of_frames; ctx->number_of_samples = ctx->major_frame_size; - for (substr = 0; substr < ctx->num_substreams; substr++) { - ctx->cur_restart_header = &ctx->restart_header[substr]; + ctx->cur_restart_header = &ctx->restart_header; - ctx->cur_decoding_params = &ctx->major_decoding_params[1][substr]; - ctx->cur_channel_params = ctx->major_channel_params[1]; + ctx->cur_decoding_params = &ctx->major_decoding_params[1]; + ctx->cur_channel_params = ctx->major_channel_params[1]; - generate_2_noise_channels(ctx); - rematrix_channels (ctx); + generate_2_noise_channels(ctx); + rematrix_channels (ctx); - apply_filters(ctx); - } + apply_filters(ctx); } /****************************************************************************/ @@ -2212,52 +2077,38 @@ static int mlp_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet) { MLPEncodeContext *ctx = avctx->priv_data; - unsigned int bytes_written = 0; + int bytes_written = 0; int restart_frame, ret; uint8_t *data; + if (!frame && !ctx->last_frames--) + return 0; + if ((ret = ff_alloc_packet(avctx, avpkt, 87500 * avctx->channels)) < 0) return ret; - /* add current frame to queue */ - if ((ret = ff_af_queue_add(&ctx->afq, frame)) < 0) - return ret; + if (frame) { + /* add current frame to queue */ + if ((ret = ff_af_queue_add(&ctx->afq, frame)) < 0) + return ret; + ctx->last_frames = ctx->max_restart_interval; + } - data = frame->data[0]; + data = frame ? frame->data[0] : NULL; ctx->frame_index = avctx->frame_number % ctx->max_restart_interval; ctx->inout_buffer = ctx->major_inout_buffer + ctx->frame_index * ctx->one_sample_buffer_size; - if (ctx->last_frame == ctx->inout_buffer) { - return 0; - } - ctx->sample_buffer = ctx->major_scratch_buffer + ctx->frame_index * ctx->one_sample_buffer_size; ctx->write_buffer = ctx->inout_buffer; if (avctx->frame_number < ctx->max_restart_interval) { - if (data) { + if (data) goto input_and_return; - } else { - /* There are less frames than the requested major header interval. - * Update the context to reflect this. - */ - ctx->max_restart_interval = avctx->frame_number; - ctx->frame_index = 0; - - ctx->sample_buffer = ctx->major_scratch_buffer; - ctx->inout_buffer = ctx->major_inout_buffer; - } - } - - if (ctx->frame_size[ctx->frame_index] > MAX_BLOCKSIZE) { - av_log(avctx, AV_LOG_ERROR, "Invalid frame size (%d > %d)\n", - ctx->frame_size[ctx->frame_index], MAX_BLOCKSIZE); - return AVERROR_INVALIDDATA; } restart_frame = !ctx->frame_index; @@ -2273,56 +2124,40 @@ static int mlp_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, bytes_written = write_access_unit(ctx, avpkt->data, avpkt->size, restart_frame); - ctx->timestamp += ctx->frame_size[ctx->frame_index]; - ctx->dts += ctx->frame_size[ctx->frame_index]; + ctx->timestamp += avctx->frame_size; + ctx->dts += avctx->frame_size; input_and_return: - if (data) { - ctx->frame_size[ctx->frame_index] = avctx->frame_size; - ctx->next_major_frame_size += avctx->frame_size; - ctx->next_major_number_of_frames++; + if (frame) + ctx->shorten_by = avctx->frame_size - frame->nb_samples; + ctx->next_major_frame_size += avctx->frame_size; + ctx->next_major_number_of_frames++; + if (data) input_data(ctx, data); - } else if (!ctx->last_frame) { - ctx->last_frame = ctx->inout_buffer; - } restart_frame = (ctx->frame_index + 1) % ctx->min_restart_interval; if (!restart_frame) { - int seq_index; - - for (seq_index = 0; - seq_index < ctx->restart_intervals && (seq_index * ctx->min_restart_interval) <= ctx->avctx->frame_number; - seq_index++) { - unsigned int number_of_samples = 0; - unsigned int index; + for (unsigned int seq_index = 0; seq_index < ctx->restart_intervals; seq_index++) { + unsigned int number_of_samples; ctx->sample_buffer = ctx->major_scratch_buffer; ctx->inout_buffer = ctx->major_inout_buffer; - ctx->seq_index = seq_index; - ctx->starting_frame_index = (ctx->avctx->frame_number - (ctx->avctx->frame_number % ctx->min_restart_interval) - - (seq_index * ctx->min_restart_interval)) % ctx->max_restart_interval; ctx->number_of_frames = ctx->next_major_number_of_frames; ctx->number_of_subblocks = ctx->next_major_number_of_frames + 1; - ctx->seq_channel_params = (ChannelParams *) ctx->channel_params + - (ctx->frame_index / ctx->min_restart_interval)*(ctx->sequence_size)*(ctx->avctx->channels) + - (ctx->seq_offset[seq_index])*(ctx->avctx->channels); + ctx->seq_channel_params = ctx->channel_params + ctx->seq_offset[seq_index] * ctx->avctx->channels; - ctx->seq_decoding_params = (DecodingParams *) ctx->decoding_params + - (ctx->frame_index / ctx->min_restart_interval)*(ctx->sequence_size)*(ctx->num_substreams) + - (ctx->seq_offset[seq_index])*(ctx->num_substreams); + ctx->seq_decoding_params = ctx->decoding_params + ctx->seq_offset[seq_index]; - for (index = 0; index < ctx->number_of_frames; index++) { - number_of_samples += ctx->frame_size[(ctx->starting_frame_index + index) % ctx->max_restart_interval]; - } + number_of_samples = avctx->frame_size * ctx->number_of_frames; ctx->number_of_samples = number_of_samples; - for (index = 0; index < ctx->seq_size[seq_index]; index++) { + for (unsigned int index = 0; index < ctx->seq_size[seq_index]; index++) { clear_channel_params(ctx->seq_channel_params + index * ctx->avctx->channels, ctx->avctx->channels); - default_decoding_params(ctx, ctx->seq_decoding_params + index*(ctx->num_substreams)); + default_decoding_params(ctx, ctx->seq_decoding_params + index); } input_to_sample_buffer(ctx); @@ -2335,18 +2170,23 @@ input_and_return: ctx->next_major_frame_size = 0; ctx->major_number_of_frames = ctx->next_major_number_of_frames; ctx->next_major_number_of_frames = 0; - - if (!ctx->major_frame_size) - goto no_data_left; } } -no_data_left: + if (!frame) + avctx->frame_number++; + + if (bytes_written > 0) { + ff_af_queue_remove(&ctx->afq, avctx->frame_size, &avpkt->pts, + &avpkt->duration); + + av_shrink_packet(avpkt, bytes_written); + + *got_packet = 1; + } else { + *got_packet = 0; + } - ff_af_queue_remove(&ctx->afq, avctx->frame_size, &avpkt->pts, - &avpkt->duration); - avpkt->size = bytes_written; - *got_packet = 1; return 0; } @@ -2362,10 +2202,12 @@ static av_cold int mlp_encode_close(AVCodecContext *avctx) av_freep(&ctx->lpc_sample_buffer); av_freep(&ctx->decoding_params); av_freep(&ctx->channel_params); - av_freep(&ctx->frame_size); av_freep(&ctx->max_output_bits); ff_af_queue_close(&ctx->afq); + for (int i = 0; i < NUM_FILTERS; i++) + av_freep(&ctx->filter_state_buffer[i]); + return 0; } @@ -2379,8 +2221,8 @@ const AVCodec ff_mlp_encoder = { .init = mlp_encode_init, .encode2 = mlp_encode_frame, .close = mlp_encode_close, - .capabilities = AV_CODEC_CAP_SMALL_LAST_FRAME | AV_CODEC_CAP_EXPERIMENTAL, - .sample_fmts = (const enum AVSampleFormat[]) {AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE}, + .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_EXPERIMENTAL, + .sample_fmts = (const enum AVSampleFormat[]) {AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_NONE}, .supported_samplerates = (const int[]) {44100, 48000, 88200, 96000, 176400, 192000, 0}, .channel_layouts = ff_mlp_channel_layouts, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP, @@ -2396,8 +2238,8 @@ const AVCodec ff_truehd_encoder = { .init = mlp_encode_init, .encode2 = mlp_encode_frame, .close = mlp_encode_close, - .capabilities = AV_CODEC_CAP_SMALL_LAST_FRAME | AV_CODEC_CAP_EXPERIMENTAL, - .sample_fmts = (const enum AVSampleFormat[]) {AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE}, + .capabilities = AV_CODEC_CAP_SMALL_LAST_FRAME | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_EXPERIMENTAL, + .sample_fmts = (const enum AVSampleFormat[]) {AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_NONE}, .supported_samplerates = (const int[]) {44100, 48000, 88200, 96000, 176400, 192000, 0}, .channel_layouts = (const uint64_t[]) {AV_CH_LAYOUT_STEREO, AV_CH_LAYOUT_5POINT0_BACK, AV_CH_LAYOUT_5POINT1_BACK, 0}, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP, diff --git a/chromium/third_party/ffmpeg/libavcodec/movtextenc.c b/chromium/third_party/ffmpeg/libavcodec/movtextenc.c index a6a18085927..2ae5a9bf0b4 100644 --- a/chromium/third_party/ffmpeg/libavcodec/movtextenc.c +++ b/chromium/third_party/ffmpeg/libavcodec/movtextenc.c @@ -654,7 +654,7 @@ static int mov_text_encode_frame(AVCodecContext *avctx, unsigned char *buf, return AVERROR(EINVAL); } - dialog = ff_ass_split_dialog2(s->ass_ctx, ass); + dialog = ff_ass_split_dialog(s->ass_ctx, ass); if (!dialog) return AVERROR(ENOMEM); mov_text_dialog(s, dialog); diff --git a/chromium/third_party/ffmpeg/libavcodec/mpeg12dec.c b/chromium/third_party/ffmpeg/libavcodec/mpeg12dec.c index a04e8b79f37..ffa727f11c9 100644 --- a/chromium/third_party/ffmpeg/libavcodec/mpeg12dec.c +++ b/chromium/third_party/ffmpeg/libavcodec/mpeg12dec.c @@ -1528,7 +1528,7 @@ static void mpeg_decode_quant_matrix_extension(MpegEncContext *s) load_matrix(s, s->chroma_inter_matrix, NULL, 0); } -static void mpeg_decode_picture_coding_extension(Mpeg1Context *s1) +static int mpeg_decode_picture_coding_extension(Mpeg1Context *s1) { MpegEncContext *s = &s1->mpeg_enc_ctx; @@ -1538,8 +1538,10 @@ static void mpeg_decode_picture_coding_extension(Mpeg1Context *s1) s->mpeg_f_code[1][0] = get_bits(&s->gb, 4); s->mpeg_f_code[1][1] = get_bits(&s->gb, 4); if (!s->pict_type && s1->mpeg_enc_ctx_allocated) { - av_log(s->avctx, AV_LOG_ERROR, - "Missing picture start code, guessing missing values\n"); + av_log(s->avctx, AV_LOG_ERROR, "Missing picture start code\n"); + if (s->avctx->err_recognition & AV_EF_EXPLODE) + return AVERROR_INVALIDDATA; + av_log(s->avctx, AV_LOG_WARNING, "Guessing pict_type from mpeg_f_code\n"); if (s->mpeg_f_code[1][0] == 15 && s->mpeg_f_code[1][1] == 15) { if (s->mpeg_f_code[0][0] == 15 && s->mpeg_f_code[0][1] == 15) s->pict_type = AV_PICTURE_TYPE_I; @@ -1585,6 +1587,8 @@ static void mpeg_decode_picture_coding_extension(Mpeg1Context *s1) ff_dlog(s->avctx, "alternate_scan=%d\n", s->alternate_scan); ff_dlog(s->avctx, "frame_pred_frame_dct=%d\n", s->frame_pred_frame_dct); ff_dlog(s->avctx, "progressive_frame=%d\n", s->progressive_frame); + + return 0; } static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size) @@ -2598,7 +2602,9 @@ static int decode_chunks(AVCodecContext *avctx, AVFrame *picture, break; case 0x8: if (last_code == PICTURE_START_CODE) { - mpeg_decode_picture_coding_extension(s); + int ret = mpeg_decode_picture_coding_extension(s); + if (ret < 0) + return ret; } else { av_log(avctx, AV_LOG_ERROR, "ignoring pic cod ext after %X\n", last_code); diff --git a/chromium/third_party/ffmpeg/libavcodec/mqc.h b/chromium/third_party/ffmpeg/libavcodec/mqc.h index ad80fe9228b..5e782b05f90 100644 --- a/chromium/third_party/ffmpeg/libavcodec/mqc.h +++ b/chromium/third_party/ffmpeg/libavcodec/mqc.h @@ -55,7 +55,6 @@ void ff_mqc_initenc(MqcState *mqc, uint8_t *bp); void ff_mqc_encode(MqcState *mqc, uint8_t *cxstate, int d); /** flush the encoder [returns number of bytes encoded] */ -int ff_mqc_flush(MqcState *mqc); int ff_mqc_flush_to(MqcState *mqc, uint8_t *dst, int *dst_len); /* decoder */ diff --git a/chromium/third_party/ffmpeg/libavcodec/mqcenc.c b/chromium/third_party/ffmpeg/libavcodec/mqcenc.c index c941f849d96..6d0368f8277 100644 --- a/chromium/third_party/ffmpeg/libavcodec/mqcenc.c +++ b/chromium/third_party/ffmpeg/libavcodec/mqcenc.c @@ -102,7 +102,7 @@ void ff_mqc_encode(MqcState *mqc, uint8_t *cxstate, int d) } } -int ff_mqc_flush(MqcState *mqc) +static int mqc_flush(MqcState *mqc) { setbits(mqc); mqc->c = mqc->c << mqc->ct; @@ -120,7 +120,7 @@ int ff_mqc_flush_to(MqcState *mqc, uint8_t *dst, int *dst_len) mqc2.bpstart= mqc2.bp = dst; *mqc2.bp = *mqc->bp; - ff_mqc_flush(&mqc2); + mqc_flush(&mqc2); *dst_len = mqc2.bp - dst; if (mqc->bp < mqc->bpstart) { av_assert1(mqc->bpstart - mqc->bp == 1); diff --git a/chromium/third_party/ffmpeg/libavcodec/nvenc.c b/chromium/third_party/ffmpeg/libavcodec/nvenc.c index b52b6bda6d0..ae25afd7f86 100644 --- a/chromium/third_party/ffmpeg/libavcodec/nvenc.c +++ b/chromium/third_party/ffmpeg/libavcodec/nvenc.c @@ -217,8 +217,14 @@ static void nvenc_map_preset(NvencContext *ctx) static void nvenc_print_driver_requirement(AVCodecContext *avctx, int level) { -#if NVENCAPI_CHECK_VERSION(11, 1) +#if NVENCAPI_CHECK_VERSION(11, 2) const char *minver = "(unknown)"; +#elif NVENCAPI_CHECK_VERSION(11, 1) +# if defined(_WIN32) || defined(__CYGWIN__) + const char *minver = "471.41"; +# else + const char *minver = "470.57.02"; +# endif #elif NVENCAPI_CHECK_VERSION(11, 0) # if defined(_WIN32) || defined(__CYGWIN__) const char *minver = "456.71"; @@ -523,6 +529,38 @@ static int nvenc_check_capabilities(AVCodecContext *avctx) } #endif +#ifdef NVENC_HAVE_SINGLE_SLICE_INTRA_REFRESH + ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SINGLE_SLICE_INTRA_REFRESH); + if(ctx->single_slice_intra_refresh && ret <= 0) { + av_log(avctx, AV_LOG_WARNING, "Single slice intra refresh not supported by the device\n"); + return AVERROR(ENOSYS); + } +#else + if(ctx->single_slice_intra_refresh) { + av_log(avctx, AV_LOG_WARNING, "Single slice intra refresh needs SDK 11.1 at build time\n"); + return AVERROR(ENOSYS); + } +#endif + + ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_INTRA_REFRESH); + if((ctx->intra_refresh || ctx->single_slice_intra_refresh) && ret <= 0) { + av_log(avctx, AV_LOG_WARNING, "Intra refresh not supported by the device\n"); + return AVERROR(ENOSYS); + } + +#ifndef NVENC_HAVE_HEVC_CONSTRAINED_ENCODING + if (ctx->constrained_encoding && avctx->codec->id == AV_CODEC_ID_HEVC) { + av_log(avctx, AV_LOG_WARNING, "HEVC constrained encoding needs SDK 10.0 at build time\n"); + return AVERROR(ENOSYS); + } +#endif + + ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_CONSTRAINED_ENCODING); + if(ctx->constrained_encoding && ret <= 0) { + av_log(avctx, AV_LOG_WARNING, "Constrained encoding not supported by the device\n"); + return AVERROR(ENOSYS); + } + ctx->support_dyn_bitrate = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_DYN_BITRATE_CHANGE); return 0; @@ -962,6 +1000,14 @@ static av_cold void nvenc_setup_rate_control(AVCodecContext *avctx) ctx->rc &= ~RC_MODE_DEPRECATED; } +#ifdef NVENC_HAVE_QP_CHROMA_OFFSETS + ctx->encode_config.rcParams.cbQPIndexOffset = ctx->qp_cb_offset; + ctx->encode_config.rcParams.crQPIndexOffset = ctx->qp_cr_offset; +#else + if (ctx->qp_cb_offset || ctx->qp_cr_offset) + av_log(avctx, AV_LOG_WARNING, "Failed setting QP CB/CR offsets, SDK 11.1 or greater required at compile time.\n"); +#endif + #ifdef NVENC_HAVE_LDKFS if (ctx->ldkfs) ctx->encode_config.rcParams.lowDelayKeyFrameScale = ctx->ldkfs; @@ -1060,7 +1106,19 @@ static av_cold int nvenc_setup_h264_config(AVCodecContext *avctx) || vui->videoFullRangeFlag != 0); h264->sliceMode = 3; - h264->sliceModeData = 1; + h264->sliceModeData = avctx->slices > 0 ? avctx->slices : 1; + + if (ctx->intra_refresh) { + h264->enableIntraRefresh = 1; + h264->intraRefreshPeriod = avctx->gop_size; + h264->intraRefreshCnt = avctx->gop_size - 1; +#ifdef NVENC_HAVE_SINGLE_SLICE_INTRA_REFRESH + h264->singleSliceIntraRefresh = ctx->single_slice_intra_refresh; +#endif + } + + if (ctx->constrained_encoding) + h264->enableConstrainedEncoding = 1; h264->disableSPSPPS = (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) ? 1 : 0; h264->repeatSPSPPS = (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) ? 0 : 1; @@ -1070,8 +1128,11 @@ static av_cold int nvenc_setup_h264_config(AVCodecContext *avctx) /* 0 means "let the hardware decide" */ h264->maxNumRefFrames = ctx->dpb_size; } - if (avctx->gop_size >= 0) { - h264->idrPeriod = cc->gopLength; + + if (ctx->intra_refresh) { + h264->idrPeriod = NVENC_INFINITE_GOPLENGTH; + } else if (avctx->gop_size >= 0) { + h264->idrPeriod = avctx->gop_size; } if (IS_CBR(cc->rcParams.rateControlMode)) { @@ -1157,7 +1218,21 @@ static av_cold int nvenc_setup_hevc_config(AVCodecContext *avctx) || vui->videoFullRangeFlag != 0); hevc->sliceMode = 3; - hevc->sliceModeData = 1; + hevc->sliceModeData = avctx->slices > 0 ? avctx->slices : 1; + + if (ctx->intra_refresh) { + hevc->enableIntraRefresh = 1; + hevc->intraRefreshPeriod = avctx->gop_size; + hevc->intraRefreshCnt = avctx->gop_size - 1; +#ifdef NVENC_HAVE_SINGLE_SLICE_INTRA_REFRESH + hevc->singleSliceIntraRefresh = ctx->single_slice_intra_refresh; +#endif + } + +#ifdef NVENC_HAVE_HEVC_CONSTRAINED_ENCODING + if (ctx->constrained_encoding) + hevc->enableConstrainedEncoding = 1; +#endif hevc->disableSPSPPS = (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) ? 1 : 0; hevc->repeatSPSPPS = (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) ? 0 : 1; @@ -1167,8 +1242,11 @@ static av_cold int nvenc_setup_hevc_config(AVCodecContext *avctx) /* 0 means "let the hardware decide" */ hevc->maxNumRefFramesInDPB = ctx->dpb_size; } - if (avctx->gop_size >= 0) { - hevc->idrPeriod = cc->gopLength; + + if (ctx->intra_refresh) { + hevc->idrPeriod = NVENC_INFINITE_GOPLENGTH; + } else if (avctx->gop_size >= 0) { + hevc->idrPeriod = avctx->gop_size; } if (IS_CBR(cc->rcParams.rateControlMode)) { @@ -1353,6 +1431,13 @@ static av_cold int nvenc_setup_encoder(AVCodecContext *avctx) ctx->encode_config.gopLength = 1; } + /* force to enable intra refresh */ + if(ctx->single_slice_intra_refresh) + ctx->intra_refresh = 1; + + if (ctx->intra_refresh) + ctx->encode_config.gopLength = NVENC_INFINITE_GOPLENGTH; + nvenc_recalc_surfaces(avctx); nvenc_setup_rate_control(avctx); diff --git a/chromium/third_party/ffmpeg/libavcodec/nvenc.h b/chromium/third_party/ffmpeg/libavcodec/nvenc.h index 85d3a336010..08531e1be33 100644 --- a/chromium/third_party/ffmpeg/libavcodec/nvenc.h +++ b/chromium/third_party/ffmpeg/libavcodec/nvenc.h @@ -68,6 +68,13 @@ typedef void ID3D11Device; #define NVENC_HAVE_MULTIPASS #define NVENC_HAVE_LDKFS #define NVENC_HAVE_H264_LVL6 +#define NVENC_HAVE_HEVC_CONSTRAINED_ENCODING +#endif + +// SDK 11.1 compile time feature checks +#if NVENCAPI_CHECK_VERSION(11, 1) +#define NVENC_HAVE_QP_CHROMA_OFFSETS +#define NVENC_HAVE_SINGLE_SLICE_INTRA_REFRESH #endif typedef struct NvencSurface @@ -213,6 +220,8 @@ typedef struct NvencContext int init_qp_b; int init_qp_i; int cqp; + int qp_cb_offset; + int qp_cr_offset; int weighted_pred; int coder; int b_ref_mode; @@ -223,6 +232,9 @@ typedef struct NvencContext int multipass; int ldkfs; int extra_sei; + int intra_refresh; + int single_slice_intra_refresh; + int constrained_encoding; } NvencContext; int ff_nvenc_encode_init(AVCodecContext *avctx); diff --git a/chromium/third_party/ffmpeg/libavcodec/nvenc_h264.c b/chromium/third_party/ffmpeg/libavcodec/nvenc_h264.c index c7af7fa6827..7d78aa0d879 100644 --- a/chromium/third_party/ffmpeg/libavcodec/nvenc_h264.c +++ b/chromium/third_party/ffmpeg/libavcodec/nvenc_h264.c @@ -147,6 +147,10 @@ static const AVOption options[] = { { "init_qpI", "Initial QP value for I frame", OFFSET(init_qp_i), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 51, VE }, { "qp", "Constant quantization parameter rate control method", OFFSET(cqp), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 51, VE }, + { "qp_cb_offset", "Quantization parameter offset for cb channel", + OFFSET(qp_cb_offset), AV_OPT_TYPE_INT, { .i64 = 0 }, -12, 12, VE }, + { "qp_cr_offset", "Quantization parameter offset for cr channel", + OFFSET(qp_cr_offset), AV_OPT_TYPE_INT, { .i64 = 0 }, -12, 12, VE }, { "weighted_pred","Set 1 to enable weighted prediction", OFFSET(weighted_pred),AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE }, { "coder", "Coder type", OFFSET(coder), AV_OPT_TYPE_INT, { .i64 = -1 },-1, 2, VE, "coder" }, @@ -184,6 +188,12 @@ static const AVOption options[] = { #endif { "extra_sei", "Pass on extra SEI data (e.g. a53 cc) to be included in the bitstream", OFFSET(extra_sei), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, VE }, + { "intra-refresh","Use Periodic Intra Refresh instead of IDR frames", + OFFSET(intra_refresh),AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, + { "single-slice-intra-refresh", "Use single slice intra refresh", + OFFSET(single_slice_intra_refresh), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, + { "constrained-encoding", "Enable constrainedFrame encoding where each slice in the constrained picture is independent of other slices", + OFFSET(constrained_encoding), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, { NULL } }; diff --git a/chromium/third_party/ffmpeg/libavcodec/nvenc_hevc.c b/chromium/third_party/ffmpeg/libavcodec/nvenc_hevc.c index c85a3175182..a13ac5a395f 100644 --- a/chromium/third_party/ffmpeg/libavcodec/nvenc_hevc.c +++ b/chromium/third_party/ffmpeg/libavcodec/nvenc_hevc.c @@ -134,6 +134,10 @@ static const AVOption options[] = { { "init_qpI", "Initial QP value for I frame", OFFSET(init_qp_i), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 51, VE }, { "qp", "Constant quantization parameter rate control method", OFFSET(cqp), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 51, VE }, + { "qp_cb_offset", "Quantization parameter offset for cb channel", + OFFSET(qp_cb_offset), AV_OPT_TYPE_INT, { .i64 = 0 }, -12, 12, VE }, + { "qp_cr_offset", "Quantization parameter offset for cr channel", + OFFSET(qp_cr_offset), AV_OPT_TYPE_INT, { .i64 = 0 }, -12, 12, VE }, { "weighted_pred","Set 1 to enable weighted prediction", OFFSET(weighted_pred),AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE }, #ifdef NVENC_HAVE_HEVC_BFRAME_REF_MODE @@ -165,6 +169,12 @@ static const AVOption options[] = { #endif { "extra_sei", "Pass on extra SEI data (e.g. a53 cc) to be included in the bitstream", OFFSET(extra_sei), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, VE }, + { "intra-refresh","Use Periodic Intra Refresh instead of IDR frames", + OFFSET(intra_refresh),AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, + { "single-slice-intra-refresh", "Use single slice intra refresh", + OFFSET(single_slice_intra_refresh), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, + { "constrained-encoding", "Enable constrainedFrame encoding where each slice in the constrained picture is independent of other slices", + OFFSET(constrained_encoding), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, { NULL } }; diff --git a/chromium/third_party/ffmpeg/libavcodec/omx.c b/chromium/third_party/ffmpeg/libavcodec/omx.c index 9597c600577..4078ac84a44 100644 --- a/chromium/third_party/ffmpeg/libavcodec/omx.c +++ b/chromium/third_party/ffmpeg/libavcodec/omx.c @@ -43,6 +43,7 @@ #include "avcodec.h" #include "h264.h" #include "internal.h" +#include "pthread_internal.h" #ifdef OMX_SKIP64BIT static OMX_TICKS to_omx_ticks(int64_t value) @@ -218,7 +219,7 @@ typedef struct OMXCodecContext { OMX_STATETYPE state; OMX_ERRORTYPE error; - int mutex_cond_inited; + unsigned mutex_cond_inited_cnt; int eos_sent, got_eos; @@ -229,6 +230,12 @@ typedef struct OMXCodecContext { int profile; } OMXCodecContext; +#define NB_MUTEX_CONDS 6 +#define OFF(field) offsetof(OMXCodecContext, field) +DEFINE_OFFSET_ARRAY(OMXCodecContext, omx_codec_context, mutex_cond_inited_cnt, + (OFF(input_mutex), OFF(output_mutex), OFF(state_mutex)), + (OFF(input_cond), OFF(output_cond), OFF(state_cond))); + static void append_buffer(pthread_mutex_t *mutex, pthread_cond_t *cond, int* array_size, OMX_BUFFERHEADERTYPE **array, OMX_BUFFERHEADERTYPE *buffer) @@ -589,51 +596,47 @@ static av_cold int omx_component_init(AVCodecContext *avctx, const char *role) static av_cold void cleanup(OMXCodecContext *s) { - int i, executing; + int executing; - pthread_mutex_lock(&s->state_mutex); - executing = s->state == OMX_StateExecuting; - pthread_mutex_unlock(&s->state_mutex); + /* If the mutexes/condition variables have not been properly initialized, + * nothing has been initialized and locking the mutex might be unsafe. */ + if (s->mutex_cond_inited_cnt == NB_MUTEX_CONDS) { + pthread_mutex_lock(&s->state_mutex); + executing = s->state == OMX_StateExecuting; + pthread_mutex_unlock(&s->state_mutex); - if (executing) { - OMX_SendCommand(s->handle, OMX_CommandStateSet, OMX_StateIdle, NULL); - wait_for_state(s, OMX_StateIdle); - OMX_SendCommand(s->handle, OMX_CommandStateSet, OMX_StateLoaded, NULL); - for (i = 0; i < s->num_in_buffers; i++) { - OMX_BUFFERHEADERTYPE *buffer = get_buffer(&s->input_mutex, &s->input_cond, - &s->num_free_in_buffers, s->free_in_buffers, 1); - if (s->input_zerocopy) - buffer->pBuffer = NULL; - OMX_FreeBuffer(s->handle, s->in_port, buffer); + if (executing) { + OMX_SendCommand(s->handle, OMX_CommandStateSet, OMX_StateIdle, NULL); + wait_for_state(s, OMX_StateIdle); + OMX_SendCommand(s->handle, OMX_CommandStateSet, OMX_StateLoaded, NULL); + for (int i = 0; i < s->num_in_buffers; i++) { + OMX_BUFFERHEADERTYPE *buffer = get_buffer(&s->input_mutex, &s->input_cond, + &s->num_free_in_buffers, s->free_in_buffers, 1); + if (s->input_zerocopy) + buffer->pBuffer = NULL; + OMX_FreeBuffer(s->handle, s->in_port, buffer); + } + for (int i = 0; i < s->num_out_buffers; i++) { + OMX_BUFFERHEADERTYPE *buffer = get_buffer(&s->output_mutex, &s->output_cond, + &s->num_done_out_buffers, s->done_out_buffers, 1); + OMX_FreeBuffer(s->handle, s->out_port, buffer); + } + wait_for_state(s, OMX_StateLoaded); } - for (i = 0; i < s->num_out_buffers; i++) { - OMX_BUFFERHEADERTYPE *buffer = get_buffer(&s->output_mutex, &s->output_cond, - &s->num_done_out_buffers, s->done_out_buffers, 1); - OMX_FreeBuffer(s->handle, s->out_port, buffer); + if (s->handle) { + s->omx_context->ptr_FreeHandle(s->handle); + s->handle = NULL; } - wait_for_state(s, OMX_StateLoaded); - } - if (s->handle) { - s->omx_context->ptr_FreeHandle(s->handle); - s->handle = NULL; - } - omx_deinit(s->omx_context); - s->omx_context = NULL; - if (s->mutex_cond_inited) { - pthread_cond_destroy(&s->state_cond); - pthread_mutex_destroy(&s->state_mutex); - pthread_cond_destroy(&s->input_cond); - pthread_mutex_destroy(&s->input_mutex); - pthread_cond_destroy(&s->output_cond); - pthread_mutex_destroy(&s->output_mutex); - s->mutex_cond_inited = 0; + omx_deinit(s->omx_context); + s->omx_context = NULL; + av_freep(&s->in_buffer_headers); + av_freep(&s->out_buffer_headers); + av_freep(&s->free_in_buffers); + av_freep(&s->done_out_buffers); + av_freep(&s->output_buf); } - av_freep(&s->in_buffer_headers); - av_freep(&s->out_buffer_headers); - av_freep(&s->free_in_buffers); - av_freep(&s->done_out_buffers); - av_freep(&s->output_buf); + ff_pthread_free(s, omx_codec_context_offsets); } static av_cold int omx_encode_init(AVCodecContext *avctx) @@ -644,17 +647,14 @@ static av_cold int omx_encode_init(AVCodecContext *avctx) OMX_BUFFERHEADERTYPE *buffer; OMX_ERRORTYPE err; + /* cleanup relies on the mutexes/conditions being initialized first. */ + ret = ff_pthread_init(s, omx_codec_context_offsets); + if (ret < 0) + return ret; s->omx_context = omx_init(avctx, s->libname, s->libprefix); if (!s->omx_context) return AVERROR_ENCODER_NOT_FOUND; - pthread_mutex_init(&s->state_mutex, NULL); - pthread_cond_init(&s->state_cond, NULL); - pthread_mutex_init(&s->input_mutex, NULL); - pthread_cond_init(&s->input_cond, NULL); - pthread_mutex_init(&s->output_mutex, NULL); - pthread_cond_init(&s->output_cond, NULL); - s->mutex_cond_inited = 1; s->avctx = avctx; s->state = OMX_StateLoaded; s->error = OMX_ErrorNone; diff --git a/chromium/third_party/ffmpeg/libavcodec/options_table.h b/chromium/third_party/ffmpeg/libavcodec/options_table.h index ed428b13104..ae42b65b7b3 100644 --- a/chromium/third_party/ffmpeg/libavcodec/options_table.h +++ b/chromium/third_party/ffmpeg/libavcodec/options_table.h @@ -260,8 +260,8 @@ static const AVOption avcodec_options[] = { {"mv0_threshold", NULL, OFFSET(mv0_threshold), AV_OPT_TYPE_INT, {.i64 = 256 }, 0, INT_MAX, V|E}, {"compression_level", NULL, OFFSET(compression_level), AV_OPT_TYPE_INT, {.i64 = FF_COMPRESSION_DEFAULT }, INT_MIN, INT_MAX, V|A|E}, {"bits_per_raw_sample", NULL, OFFSET(bits_per_raw_sample), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX}, -{"channel_layout", NULL, OFFSET(channel_layout), AV_OPT_TYPE_UINT64, {.i64 = DEFAULT }, 0, UINT64_MAX, A|E|D, "channel_layout"}, -{"request_channel_layout", NULL, OFFSET(request_channel_layout), AV_OPT_TYPE_UINT64, {.i64 = DEFAULT }, 0, UINT64_MAX, A|D, "request_channel_layout"}, +{"channel_layout", NULL, OFFSET(channel_layout), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64 = DEFAULT }, 0, UINT64_MAX, A|E|D, "channel_layout"}, +{"request_channel_layout", NULL, OFFSET(request_channel_layout), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64 = DEFAULT }, 0, UINT64_MAX, A|D, "request_channel_layout"}, {"rc_max_vbv_use", NULL, OFFSET(rc_max_available_vbv_use), AV_OPT_TYPE_FLOAT, {.dbl = 0 }, 0.0, FLT_MAX, V|E}, {"rc_min_vbv_use", NULL, OFFSET(rc_min_vbv_overflow_use), AV_OPT_TYPE_FLOAT, {.dbl = 3 }, 0.0, FLT_MAX, V|E}, {"ticks_per_frame", NULL, OFFSET(ticks_per_frame), AV_OPT_TYPE_INT, {.i64 = 1 }, 1, INT_MAX, A|V|E|D}, diff --git a/chromium/third_party/ffmpeg/libavcodec/packet.h b/chromium/third_party/ffmpeg/libavcodec/packet.h index a9d3a9b5968..9baff246352 100644 --- a/chromium/third_party/ffmpeg/libavcodec/packet.h +++ b/chromium/third_party/ffmpeg/libavcodec/packet.h @@ -391,6 +391,27 @@ typedef struct AVPacket { int64_t duration; int64_t pos; ///< byte position in stream, -1 if unknown + + /** + * for some private data of the user + */ + void *opaque; + + /** + * AVBufferRef for free use by the API user. FFmpeg will never check the + * contents of the buffer ref. FFmpeg calls av_buffer_unref() on it when + * the packet is unreferenced. av_packet_copy_props() calls create a new + * reference with av_buffer_ref() for the target packet's opaque_ref field. + * + * This is unrelated to the opaque field, although it serves a similar + * purpose. + */ + AVBufferRef *opaque_ref; + + /** + * Time base of the packet's timestamps. + */ + AVRational time_base; } AVPacket; #if FF_API_INIT_PACKET diff --git a/chromium/third_party/ffmpeg/libavcodec/parser.c b/chromium/third_party/ffmpeg/libavcodec/parser.c index fc57246965c..3b459cc1253 100644 --- a/chromium/third_party/ffmpeg/libavcodec/parser.c +++ b/chromium/third_party/ffmpeg/libavcodec/parser.c @@ -46,7 +46,9 @@ AVCodecParserContext *av_parser_init(int codec_id) parser->codec_ids[1] == codec_id || parser->codec_ids[2] == codec_id || parser->codec_ids[3] == codec_id || - parser->codec_ids[4] == codec_id) + parser->codec_ids[4] == codec_id || + parser->codec_ids[5] == codec_id || + parser->codec_ids[6] == codec_id) goto found; } return NULL; @@ -127,7 +129,9 @@ int av_parser_parse2(AVCodecParserContext *s, AVCodecContext *avctx, avctx->codec_id == s->parser->codec_ids[1] || avctx->codec_id == s->parser->codec_ids[2] || avctx->codec_id == s->parser->codec_ids[3] || - avctx->codec_id == s->parser->codec_ids[4]); + avctx->codec_id == s->parser->codec_ids[4] || + avctx->codec_id == s->parser->codec_ids[5] || + avctx->codec_id == s->parser->codec_ids[6]); if (!(s->flags & PARSER_FLAG_FETCHED_OFFSET)) { s->next_frame_offset = diff --git a/chromium/third_party/ffmpeg/libavcodec/pictordec.c b/chromium/third_party/ffmpeg/libavcodec/pictordec.c index c37c5e7106d..c7b3a335d33 100644 --- a/chromium/third_party/ffmpeg/libavcodec/pictordec.c +++ b/chromium/third_party/ffmpeg/libavcodec/pictordec.c @@ -89,8 +89,7 @@ static void picmemset(PicContext *s, AVFrame *frame, unsigned value, int run, d = frame->data[0] + yl * frame->linesize[0]; if (s->nb_planes == 1 && run*pixels_per_value >= s->width && - pixels_per_value < s->width && - s->width % pixels_per_value == 0 + pixels_per_value < (s->width / pixels_per_value * pixels_per_value) ) { for (; xl < pixels_per_value; xl ++) { j = (j < bits_per_plane ? 8 : j) - bits_per_plane; @@ -98,7 +97,7 @@ static void picmemset(PicContext *s, AVFrame *frame, unsigned value, int run, } av_memcpy_backptr(d+xl, pixels_per_value, s->width - xl); run -= s->width / pixels_per_value; - xl = s->width; + xl = s->width / pixels_per_value * pixels_per_value; } } } diff --git a/chromium/third_party/ffmpeg/libavcodec/pnm_parser.c b/chromium/third_party/ffmpeg/libavcodec/pnm_parser.c index f8eb2e7edab..309bc76a24e 100644 --- a/chromium/third_party/ffmpeg/libavcodec/pnm_parser.c +++ b/chromium/third_party/ffmpeg/libavcodec/pnm_parser.c @@ -133,7 +133,7 @@ end: const AVCodecParser ff_pnm_parser = { .codec_ids = { AV_CODEC_ID_PGM, AV_CODEC_ID_PGMYUV, AV_CODEC_ID_PPM, - AV_CODEC_ID_PBM, AV_CODEC_ID_PAM }, + AV_CODEC_ID_PBM, AV_CODEC_ID_PAM, AV_CODEC_ID_PFM }, .priv_data_size = sizeof(PNMParseContext), .parser_parse = pnm_parse, .parser_close = ff_parse_close, diff --git a/chromium/third_party/ffmpeg/libavcodec/ppc/h264dsp.c b/chromium/third_party/ffmpeg/libavcodec/ppc/h264dsp.c index 779092fd765..c02733dda2a 100644 --- a/chromium/third_party/ffmpeg/libavcodec/ppc/h264dsp.c +++ b/chromium/third_party/ffmpeg/libavcodec/ppc/h264dsp.c @@ -328,7 +328,7 @@ static void h264_idct8_dc_add_altivec(uint8_t *dst, int16_t *block, int stride) static void h264_idct_add16_altivec(uint8_t *dst, const int *block_offset, int16_t *block, int stride, - const uint8_t nnzc[15 * 8]) + const uint8_t nnzc[5 * 8]) { int i; for(i=0; i<16; i++){ @@ -342,7 +342,7 @@ static void h264_idct_add16_altivec(uint8_t *dst, const int *block_offset, static void h264_idct_add16intra_altivec(uint8_t *dst, const int *block_offset, int16_t *block, int stride, - const uint8_t nnzc[15 * 8]) + const uint8_t nnzc[5 * 8]) { int i; for(i=0; i<16; i++){ @@ -353,7 +353,7 @@ static void h264_idct_add16intra_altivec(uint8_t *dst, const int *block_offset, static void h264_idct8_add4_altivec(uint8_t *dst, const int *block_offset, int16_t *block, int stride, - const uint8_t nnzc[15 * 8]) + const uint8_t nnzc[5 * 8]) { int i; for(i=0; i<16; i+=4){ diff --git a/chromium/third_party/ffmpeg/libavcodec/pthread.c b/chromium/third_party/ffmpeg/libavcodec/pthread.c index 14b7cca4fea..e7bad19f8bf 100644 --- a/chromium/third_party/ffmpeg/libavcodec/pthread.c +++ b/chromium/third_party/ffmpeg/libavcodec/pthread.c @@ -29,6 +29,8 @@ * @see doc/multithreading.txt */ +#include "libavutil/thread.h" + #include "avcodec.h" #include "internal.h" #include "pthread_internal.h" @@ -86,3 +88,39 @@ void ff_thread_free(AVCodecContext *avctx) else ff_slice_thread_free(avctx); } + +av_cold void ff_pthread_free(void *obj, const unsigned offsets[]) +{ + unsigned cnt = *(unsigned*)((char*)obj + offsets[0]); + const unsigned *cur_offset = offsets; + + *(unsigned*)((char*)obj + offsets[0]) = 0; + + for (; *(++cur_offset) != THREAD_SENTINEL && cnt; cnt--) + pthread_mutex_destroy((pthread_mutex_t*)((char*)obj + *cur_offset)); + for (; *(++cur_offset) != THREAD_SENTINEL && cnt; cnt--) + pthread_cond_destroy ((pthread_cond_t *)((char*)obj + *cur_offset)); +} + +av_cold int ff_pthread_init(void *obj, const unsigned offsets[]) +{ + const unsigned *cur_offset = offsets; + unsigned cnt = 0; + int err; + +#define PTHREAD_INIT_LOOP(type) \ + for (; *(++cur_offset) != THREAD_SENTINEL; cnt++) { \ + pthread_ ## type ## _t *dst = (void*)((char*)obj + *cur_offset); \ + err = pthread_ ## type ## _init(dst, NULL); \ + if (err) { \ + err = AVERROR(err); \ + goto fail; \ + } \ + } + PTHREAD_INIT_LOOP(mutex) + PTHREAD_INIT_LOOP(cond) + +fail: + *(unsigned*)((char*)obj + offsets[0]) = cnt; + return err; +} diff --git a/chromium/third_party/ffmpeg/libavcodec/pthread_frame.c b/chromium/third_party/ffmpeg/libavcodec/pthread_frame.c index 2ff71ca39ec..9c5d66c0d40 100644 --- a/chromium/third_party/ffmpeg/libavcodec/pthread_frame.c +++ b/chromium/third_party/ffmpeg/libavcodec/pthread_frame.c @@ -277,6 +277,7 @@ static int update_context_from_thread(AVCodecContext *dst, AVCodecContext *src, dst->has_b_frames = src->has_b_frames; dst->idct_algo = src->idct_algo; + dst->properties = src->properties; dst->bits_per_coded_sample = src->bits_per_coded_sample; dst->sample_aspect_ratio = src->sample_aspect_ratio; @@ -679,59 +680,18 @@ static void park_frame_worker_threads(FrameThreadContext *fctx, int thread_count async_lock(fctx); } -#define SENTINEL 0 // This forbids putting a mutex/condition variable at the front. -#define OFFSET_ARRAY(...) __VA_ARGS__, SENTINEL -#define DEFINE_OFFSET_ARRAY(type, name, mutexes, conds) \ -static const unsigned name ## _offsets[] = { offsetof(type, pthread_init_cnt),\ - OFFSET_ARRAY mutexes, \ - OFFSET_ARRAY conds } - #define OFF(member) offsetof(FrameThreadContext, member) -DEFINE_OFFSET_ARRAY(FrameThreadContext, thread_ctx, +DEFINE_OFFSET_ARRAY(FrameThreadContext, thread_ctx, pthread_init_cnt, (OFF(buffer_mutex), OFF(hwaccel_mutex), OFF(async_mutex)), (OFF(async_cond))); #undef OFF #define OFF(member) offsetof(PerThreadContext, member) -DEFINE_OFFSET_ARRAY(PerThreadContext, per_thread, +DEFINE_OFFSET_ARRAY(PerThreadContext, per_thread, pthread_init_cnt, (OFF(progress_mutex), OFF(mutex)), (OFF(input_cond), OFF(progress_cond), OFF(output_cond))); #undef OFF -static av_cold void free_pthread(void *obj, const unsigned offsets[]) -{ - unsigned cnt = *(unsigned*)((char*)obj + offsets[0]); - const unsigned *cur_offset = offsets; - - for (; *(++cur_offset) != SENTINEL && cnt; cnt--) - pthread_mutex_destroy((pthread_mutex_t*)((char*)obj + *cur_offset)); - for (; *(++cur_offset) != SENTINEL && cnt; cnt--) - pthread_cond_destroy ((pthread_cond_t *)((char*)obj + *cur_offset)); -} - -static av_cold int init_pthread(void *obj, const unsigned offsets[]) -{ - const unsigned *cur_offset = offsets; - unsigned cnt = 0; - int err; - -#define PTHREAD_INIT_LOOP(type) \ - for (; *(++cur_offset) != SENTINEL; cnt++) { \ - pthread_ ## type ## _t *dst = (void*)((char*)obj + *cur_offset); \ - err = pthread_ ## type ## _init(dst, NULL); \ - if (err) { \ - err = AVERROR(err); \ - goto fail; \ - } \ - } - PTHREAD_INIT_LOOP(mutex) - PTHREAD_INIT_LOOP(cond) - -fail: - *(unsigned*)((char*)obj + offsets[0]) = cnt; - return err; -} - void ff_frame_thread_free(AVCodecContext *avctx, int thread_count) { FrameThreadContext *fctx = avctx->internal->thread_ctx; @@ -791,14 +751,14 @@ void ff_frame_thread_free(AVCodecContext *avctx, int thread_count) av_frame_free(&p->frame); - free_pthread(p, per_thread_offsets); + ff_pthread_free(p, per_thread_offsets); av_packet_free(&p->avpkt); av_freep(&p->avctx); } av_freep(&fctx->threads); - free_pthread(fctx, thread_ctx_offsets); + ff_pthread_free(fctx, thread_ctx_offsets); av_freep(&avctx->internal->thread_ctx); } @@ -844,7 +804,7 @@ static av_cold int init_thread(PerThreadContext *p, int *threads_to_free, } } - err = init_pthread(p, per_thread_offsets); + err = ff_pthread_init(p, per_thread_offsets); if (err < 0) return err; @@ -905,9 +865,9 @@ int ff_frame_thread_init(AVCodecContext *avctx) if (!fctx) return AVERROR(ENOMEM); - err = init_pthread(fctx, thread_ctx_offsets); + err = ff_pthread_init(fctx, thread_ctx_offsets); if (err < 0) { - free_pthread(fctx, thread_ctx_offsets); + ff_pthread_free(fctx, thread_ctx_offsets); av_freep(&avctx->internal->thread_ctx); return err; } diff --git a/chromium/third_party/ffmpeg/libavcodec/pthread_internal.h b/chromium/third_party/ffmpeg/libavcodec/pthread_internal.h index d2115cbbafb..d0b6a7a673b 100644 --- a/chromium/third_party/ffmpeg/libavcodec/pthread_internal.h +++ b/chromium/third_party/ffmpeg/libavcodec/pthread_internal.h @@ -31,4 +31,36 @@ void ff_slice_thread_free(AVCodecContext *avctx); int ff_frame_thread_init(AVCodecContext *avctx); void ff_frame_thread_free(AVCodecContext *avctx, int thread_count); +#define THREAD_SENTINEL 0 // This forbids putting a mutex/condition variable at the front. +/** + * Initialize/destroy a list of mutexes/conditions contained in a structure. + * The positions of these mutexes/conditions in the structure are given by + * their offsets. Because it is undefined behaviour to destroy + * an uninitialized mutex/condition, ff_pthread_init() stores the number + * of successfully initialized mutexes and conditions in the object itself + * and ff_pthread_free() uses this number to destroy exactly the mutexes and + * condition variables that have been successfully initialized. + * + * @param obj The object containing the mutexes/conditions. + * @param[in] offsets An array of offsets. Its first member gives the offset + * of the variable that contains the count of successfully + * initialized mutexes/condition variables; said variable + * must be an unsigned int. Two arrays of offsets, each + * delimited by a THREAD_SENTINEL follow. The first + * contains the offsets of all the mutexes, the second + * contains the offsets of all the condition variables. + */ +int ff_pthread_init(void *obj, const unsigned offsets[]); +void ff_pthread_free(void *obj, const unsigned offsets[]); + +/** + * Macros to help creating the above lists. mutexes and conds need + * to be parentheses-enclosed lists of offsets in the containing structure. + */ +#define OFFSET_ARRAY(...) __VA_ARGS__, THREAD_SENTINEL +#define DEFINE_OFFSET_ARRAY(type, name, cnt_variable, mutexes, conds) \ +static const unsigned name ## _offsets[] = { offsetof(type, cnt_variable), \ + OFFSET_ARRAY mutexes, \ + OFFSET_ARRAY conds } + #endif // AVCODEC_PTHREAD_INTERNAL_H diff --git a/chromium/third_party/ffmpeg/libavcodec/qsv.c b/chromium/third_party/ffmpeg/libavcodec/qsv.c index 6e3154e1a39..2f332092a1d 100644 --- a/chromium/third_party/ffmpeg/libavcodec/qsv.c +++ b/chromium/third_party/ffmpeg/libavcodec/qsv.c @@ -36,6 +36,8 @@ #include "avcodec.h" #include "qsv_internal.h" +#define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl)) + #if QSV_VERSION_ATLEAST(1, 12) #include "mfx/mfxvp8.h" #endif @@ -76,19 +78,6 @@ int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id) return AVERROR(ENOSYS); } -int ff_qsv_level_to_mfx(enum AVCodecID codec_id, int level) -{ - if (level == FF_LEVEL_UNKNOWN) - return MFX_LEVEL_UNKNOWN; - - switch (codec_id) { - case AV_CODEC_ID_HEVC: - return level / 3; - default: - return level; - } -} - static const struct { int mfx_iopattern; const char *desc; @@ -158,7 +147,10 @@ static const struct { { MFX_WRN_INCOMPATIBLE_AUDIO_PARAM, 0, "incompatible audio parameters" }, }; -int ff_qsv_map_error(mfxStatus mfx_err, const char **desc) +/** + * Convert a libmfx error code into an FFmpeg error code. + */ +static int qsv_map_error(mfxStatus mfx_err, const char **desc) { int i; for (i = 0; i < FF_ARRAY_ELEMS(qsv_errors); i++) { @@ -177,8 +169,7 @@ int ff_qsv_print_error(void *log_ctx, mfxStatus err, const char *error_string) { const char *desc; - int ret; - ret = ff_qsv_map_error(err, &desc); + int ret = qsv_map_error(err, &desc); av_log(log_ctx, AV_LOG_ERROR, "%s: %s (%d)\n", error_string, desc, err); return ret; } @@ -187,8 +178,7 @@ int ff_qsv_print_warning(void *log_ctx, mfxStatus err, const char *warning_string) { const char *desc; - int ret; - ret = ff_qsv_map_error(err, &desc); + int ret = qsv_map_error(err, &desc); av_log(log_ctx, AV_LOG_WARNING, "%s: %s (%d)\n", warning_string, desc, err); return ret; } @@ -243,7 +233,9 @@ int ff_qsv_find_surface_idx(QSVFramesContext *ctx, QSVFrame *frame) int i; for (i = 0; i < ctx->nb_mids; i++) { QSVMid *mid = &ctx->mids[i]; - if (mid->handle == frame->surface.Data.MemId) + mfxHDLPair *pair = (mfxHDLPair*)frame->surface.Data.MemId; + if ((mid->handle_pair->first == pair->first) && + (mid->handle_pair->second == pair->second)) return i; } return AVERROR_BUG; @@ -383,7 +375,11 @@ static int ff_qsv_set_display_handle(AVCodecContext *avctx, QSVSession *qs) int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs, const char *load_plugins, int gpu_copy) { +#if CONFIG_D3D11VA + mfxIMPL impl = MFX_IMPL_AUTO_ANY | MFX_IMPL_VIA_D3D11; +#else mfxIMPL impl = MFX_IMPL_AUTO_ANY; +#endif mfxVersion ver = { { QSV_VERSION_MINOR, QSV_VERSION_MAJOR } }; mfxInitParam init_par = { MFX_IMPL_AUTO_ANY }; @@ -472,7 +468,7 @@ static AVBufferRef *qsv_create_mids(AVBufferRef *hw_frames_ref) for (i = 0; i < nb_surfaces; i++) { QSVMid *mid = &mids[i]; - mid->handle = frames_hwctx->surfaces[i].Data.MemId; + mid->handle_pair = (mfxHDLPair*)frames_hwctx->surfaces[i].Data.MemId; mid->hw_frames_ref = hw_frames_ref1; } @@ -649,7 +645,7 @@ static mfxStatus qsv_frame_lock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr) goto fail; qsv_mid->surf.Info = hw_frames_hwctx->surfaces[0].Info; - qsv_mid->surf.Data.MemId = qsv_mid->handle; + qsv_mid->surf.Data.MemId = qsv_mid->handle_pair; /* map the data to the system memory */ ret = av_hwframe_map(qsv_mid->locked_frame, qsv_mid->hw_frame, @@ -682,7 +678,13 @@ static mfxStatus qsv_frame_unlock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr) static mfxStatus qsv_frame_get_hdl(mfxHDL pthis, mfxMemId mid, mfxHDL *hdl) { QSVMid *qsv_mid = (QSVMid*)mid; - *hdl = qsv_mid->handle; + mfxHDLPair *pair_dst = (mfxHDLPair*)hdl; + mfxHDLPair *pair_src = (mfxHDLPair*)qsv_mid->handle_pair; + + pair_dst->first = pair_src->first; + + if (pair_src->second != (mfxMemId)MFX_INFINITE) + pair_dst->second = pair_src->second; return MFX_ERR_NONE; } @@ -690,24 +692,19 @@ int ff_qsv_init_session_device(AVCodecContext *avctx, mfxSession *psession, AVBufferRef *device_ref, const char *load_plugins, int gpu_copy) { - static const mfxHandleType handle_types[] = { - MFX_HANDLE_VA_DISPLAY, - MFX_HANDLE_D3D9_DEVICE_MANAGER, - MFX_HANDLE_D3D11_DEVICE, - }; AVHWDeviceContext *device_ctx = (AVHWDeviceContext*)device_ref->data; AVQSVDeviceContext *device_hwctx = device_ctx->hwctx; mfxSession parent_session = device_hwctx->session; mfxInitParam init_par = { MFX_IMPL_AUTO_ANY }; mfxHDL handle = NULL; + int hw_handle_supported = 0; mfxSession session; mfxVersion ver; mfxIMPL impl; mfxHandleType handle_type; mfxStatus err; - - int i, ret; + int ret; err = MFXQueryIMPL(parent_session, &impl); if (err == MFX_ERR_NONE) @@ -716,13 +713,23 @@ int ff_qsv_init_session_device(AVCodecContext *avctx, mfxSession *psession, return ff_qsv_print_error(avctx, err, "Error querying the session attributes"); - for (i = 0; i < FF_ARRAY_ELEMS(handle_types); i++) { - err = MFXVideoCORE_GetHandle(parent_session, handle_types[i], &handle); - if (err == MFX_ERR_NONE) { - handle_type = handle_types[i]; - break; + if (MFX_IMPL_VIA_VAAPI == MFX_IMPL_VIA_MASK(impl)) { + handle_type = MFX_HANDLE_VA_DISPLAY; + hw_handle_supported = 1; + } else if (MFX_IMPL_VIA_D3D11 == MFX_IMPL_VIA_MASK(impl)) { + handle_type = MFX_HANDLE_D3D11_DEVICE; + hw_handle_supported = 1; + } else if (MFX_IMPL_VIA_D3D9 == MFX_IMPL_VIA_MASK(impl)) { + handle_type = MFX_HANDLE_D3D9_DEVICE_MANAGER; + hw_handle_supported = 1; + } + + if (hw_handle_supported) { + err = MFXVideoCORE_GetHandle(parent_session, handle_type, &handle); + if (err != MFX_ERR_NONE) { + return ff_qsv_print_error(avctx, err, + "Error getting handle session"); } - handle = NULL; } if (!handle) { av_log(avctx, AV_LOG_VERBOSE, "No supported hw handle could be retrieved " diff --git a/chromium/third_party/ffmpeg/libavcodec/qsv_internal.h b/chromium/third_party/ffmpeg/libavcodec/qsv_internal.h index 6b2fbbe2525..8090b748b30 100644 --- a/chromium/third_party/ffmpeg/libavcodec/qsv_internal.h +++ b/chromium/third_party/ffmpeg/libavcodec/qsv_internal.h @@ -62,7 +62,7 @@ typedef struct QSVMid { AVBufferRef *hw_frames_ref; - mfxHDL handle; + mfxHDLPair *handle_pair; AVFrame *locked_frame; AVFrame *hw_frame; @@ -106,11 +106,6 @@ typedef struct QSVFramesContext { int ff_qsv_print_iopattern(void *log_ctx, int mfx_iopattern, const char *extra_string); -/** - * Convert a libmfx error code into an ffmpeg error code. - */ -int ff_qsv_map_error(mfxStatus mfx_err, const char **desc); - int ff_qsv_print_error(void *log_ctx, mfxStatus err, const char *error_string); @@ -118,7 +113,6 @@ int ff_qsv_print_warning(void *log_ctx, mfxStatus err, const char *warning_string); int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id); -int ff_qsv_level_to_mfx(enum AVCodecID codec_id, int level); enum AVPixelFormat ff_qsv_map_fourcc(uint32_t fourcc); diff --git a/chromium/third_party/ffmpeg/libavcodec/qsvdec.c b/chromium/third_party/ffmpeg/libavcodec/qsvdec.c index 622750927c0..8bce9f2cf0f 100644 --- a/chromium/third_party/ffmpeg/libavcodec/qsvdec.c +++ b/chromium/third_party/ffmpeg/libavcodec/qsvdec.c @@ -99,7 +99,7 @@ static const AVCodecHWConfigInternal *const qsv_hw_configs[] = { .public = { .pix_fmt = AV_PIX_FMT_QSV, .methods = AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX | - AV_CODEC_HW_CONFIG_METHOD_AD_HOC, + AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX, .device_type = AV_HWDEVICE_TYPE_QSV, }, .hwaccel = NULL, @@ -248,6 +248,35 @@ static int qsv_decode_preinit(AVCodecContext *avctx, QSVContext *q, enum AVPixel q->nb_ext_buffers = user_ctx->nb_ext_buffers; } + if (avctx->hw_device_ctx && !avctx->hw_frames_ctx && ret == AV_PIX_FMT_QSV) { + AVHWFramesContext *hwframes_ctx; + AVQSVFramesContext *frames_hwctx; + + avctx->hw_frames_ctx = av_hwframe_ctx_alloc(avctx->hw_device_ctx); + + if (!avctx->hw_frames_ctx) { + av_log(avctx, AV_LOG_ERROR, "av_hwframe_ctx_alloc failed\n"); + return AVERROR(ENOMEM); + } + + hwframes_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data; + frames_hwctx = hwframes_ctx->hwctx; + hwframes_ctx->width = FFALIGN(avctx->coded_width, 32); + hwframes_ctx->height = FFALIGN(avctx->coded_height, 32); + hwframes_ctx->format = AV_PIX_FMT_QSV; + hwframes_ctx->sw_format = avctx->sw_pix_fmt; + hwframes_ctx->initial_pool_size = 64 + avctx->extra_hw_frames; + frames_hwctx->frame_type = MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET; + + ret = av_hwframe_ctx_init(avctx->hw_frames_ctx); + + if (ret < 0) { + av_log(NULL, AV_LOG_ERROR, "Error initializing a QSV frame pool\n"); + av_buffer_unref(&avctx->hw_frames_ctx); + return ret; + } + } + if (avctx->hw_frames_ctx) { AVHWFramesContext *frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data; AVQSVFramesContext *frames_hwctx = frames_ctx->hwctx; @@ -311,7 +340,8 @@ static int qsv_decode_header(AVCodecContext *avctx, QSVContext *q, mfxVideoParam *param) { int ret; - + mfxExtVideoSignalInfo video_signal_info = { 0 }; + mfxExtBuffer *header_ext_params[1] = { (mfxExtBuffer *)&video_signal_info }; mfxBitstream bs = { 0 }; if (avpkt->size) { @@ -336,6 +366,12 @@ static int qsv_decode_header(AVCodecContext *avctx, QSVContext *q, return ret; param->mfx.CodecId = ret; + video_signal_info.Header.BufferId = MFX_EXTBUFF_VIDEO_SIGNAL_INFO; + video_signal_info.Header.BufferSz = sizeof(video_signal_info); + // The SDK doesn't support other ext buffers when calling MFXVideoDECODE_DecodeHeader, + // so do not append this buffer to the existent buffer array + param->ExtParam = header_ext_params; + param->NumExtParam = 1; ret = MFXVideoDECODE_DecodeHeader(q->session, &bs, param); if (MFX_ERR_MORE_DATA == ret) { return AVERROR(EAGAIN); @@ -344,6 +380,17 @@ static int qsv_decode_header(AVCodecContext *avctx, QSVContext *q, return ff_qsv_print_error(avctx, ret, "Error decoding stream header"); + avctx->color_range = video_signal_info.VideoFullRange ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG; + + if (video_signal_info.ColourDescriptionPresent) { + avctx->color_primaries = video_signal_info.ColourPrimaries; + avctx->color_trc = video_signal_info.TransferCharacteristics; + avctx->colorspace = video_signal_info.MatrixCoefficients; + } + + param->ExtParam = q->ext_buffers; + param->NumExtParam = q->nb_ext_buffers; + return 0; } diff --git a/chromium/third_party/ffmpeg/libavcodec/qsvenc.c b/chromium/third_party/ffmpeg/libavcodec/qsvenc.c index f6fa759447f..090fdbe75ed 100644 --- a/chromium/third_party/ffmpeg/libavcodec/qsvenc.c +++ b/chromium/third_party/ffmpeg/libavcodec/qsvenc.c @@ -514,7 +514,7 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) } } - if (q->low_power) { + if (q->low_power == 1) { #if QSV_HAVE_VDENC q->param.mfx.LowPower = MFX_CODINGOPTION_ON; #else @@ -523,7 +523,9 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) q->low_power = 0; q->param.mfx.LowPower = MFX_CODINGOPTION_OFF; #endif - } else + } else if (q->low_power == -1) + q->param.mfx.LowPower = MFX_CODINGOPTION_UNKNOWN; + else q->param.mfx.LowPower = MFX_CODINGOPTION_OFF; q->param.mfx.CodecProfile = q->profile; @@ -805,6 +807,24 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) } #endif + q->extvsi.VideoFullRange = (avctx->color_range == AVCOL_RANGE_JPEG); + q->extvsi.ColourDescriptionPresent = 0; + + if (avctx->color_primaries != AVCOL_PRI_UNSPECIFIED || + avctx->color_trc != AVCOL_TRC_UNSPECIFIED || + avctx->colorspace != AVCOL_SPC_UNSPECIFIED) { + q->extvsi.ColourDescriptionPresent = 1; + q->extvsi.ColourPrimaries = avctx->color_primaries; + q->extvsi.TransferCharacteristics = avctx->color_trc; + q->extvsi.MatrixCoefficients = avctx->colorspace; + } + + if (q->extvsi.VideoFullRange || q->extvsi.ColourDescriptionPresent) { + q->extvsi.Header.BufferId = MFX_EXTBUFF_VIDEO_SIGNAL_INFO; + q->extvsi.Header.BufferSz = sizeof(q->extvsi); + q->extparam_internal[q->nb_extparam_internal++] = (mfxExtBuffer *)&q->extvsi; + } + if (!check_enc_param(avctx,q)) { av_log(avctx, AV_LOG_ERROR, "some encoding parameters are not supported by the QSV " @@ -1251,6 +1271,8 @@ static void clear_unused_frames(QSVEncContext *q) while (cur) { if (cur->used && !cur->surface.Data.Locked) { free_encoder_ctrl_payloads(&cur->enc_ctrl); + //do not reuse enc_ctrl from previous frame + memset(&cur->enc_ctrl, 0, sizeof(cur->enc_ctrl)); if (cur->frame->format == AV_PIX_FMT_QSV) { av_frame_unref(cur->frame); } diff --git a/chromium/third_party/ffmpeg/libavcodec/qsvenc.h b/chromium/third_party/ffmpeg/libavcodec/qsvenc.h index 6d305f87ddb..31516b8e55b 100644 --- a/chromium/third_party/ffmpeg/libavcodec/qsvenc.h +++ b/chromium/third_party/ffmpeg/libavcodec/qsvenc.h @@ -76,8 +76,8 @@ #define QSV_COMMON_OPTS \ { "async_depth", "Maximum processing parallelism", OFFSET(qsv.async_depth), AV_OPT_TYPE_INT, { .i64 = ASYNC_DEPTH_DEFAULT }, 1, INT_MAX, VE }, \ -{ "avbr_accuracy", "Accuracy of the AVBR ratecontrol", OFFSET(qsv.avbr_accuracy), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE }, \ -{ "avbr_convergence", "Convergence of the AVBR ratecontrol", OFFSET(qsv.avbr_convergence), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE }, \ +{ "avbr_accuracy", "Accuracy of the AVBR ratecontrol (unit of tenth of percent)", OFFSET(qsv.avbr_accuracy), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, UINT16_MAX, VE }, \ +{ "avbr_convergence", "Convergence of the AVBR ratecontrol (unit of 100 frames)", OFFSET(qsv.avbr_convergence), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, UINT16_MAX, VE }, \ { "preset", NULL, OFFSET(qsv.preset), AV_OPT_TYPE_INT, { .i64 = MFX_TARGETUSAGE_BALANCED }, MFX_TARGETUSAGE_BEST_QUALITY, MFX_TARGETUSAGE_BEST_SPEED, VE, "preset" }, \ { "veryfast", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_TARGETUSAGE_BEST_SPEED }, INT_MIN, INT_MAX, VE, "preset" }, \ { "faster", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_TARGETUSAGE_6 }, INT_MIN, INT_MAX, VE, "preset" }, \ @@ -96,7 +96,7 @@ { "adaptive_b", "Adaptive B-frame placement", OFFSET(qsv.adaptive_b), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE }, \ { "b_strategy", "Strategy to choose between I/P/B-frames", OFFSET(qsv.b_strategy), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE }, \ { "forced_idr", "Forcing I frames as IDR frames", OFFSET(qsv.forced_idr), AV_OPT_TYPE_BOOL,{ .i64 = 0 }, 0, 1, VE }, \ -{ "low_power", "enable low power mode(experimental: many limitations by mfx version, BRC modes, etc.)", OFFSET(qsv.low_power), AV_OPT_TYPE_BOOL, { .i64 = 0}, 0, 1, VE},\ +{ "low_power", "enable low power mode(experimental: many limitations by mfx version, BRC modes, etc.)", OFFSET(qsv.low_power), AV_OPT_TYPE_BOOL, { .i64 = -1}, -1, 1, VE},\ extern const AVCodecHWConfigInternal *const ff_qsv_enc_hw_configs[]; @@ -139,7 +139,9 @@ typedef struct QSVEncContext { mfxFrameSurface1 **opaque_surfaces; AVBufferRef *opaque_alloc_buf; - mfxExtBuffer *extparam_internal[2 + QSV_HAVE_CO2 + QSV_HAVE_CO3 + (QSV_HAVE_MF * 2)]; + mfxExtVideoSignalInfo extvsi; + + mfxExtBuffer *extparam_internal[3 + QSV_HAVE_CO2 + QSV_HAVE_CO3 + (QSV_HAVE_MF * 2)]; int nb_extparam_internal; mfxExtBuffer **extparam; diff --git a/chromium/third_party/ffmpeg/libavcodec/sbrdsp_fixed.c b/chromium/third_party/ffmpeg/libavcodec/sbrdsp_fixed.c index 91fa664c087..43fcc90ae57 100644 --- a/chromium/third_party/ffmpeg/libavcodec/sbrdsp_fixed.c +++ b/chromium/third_party/ffmpeg/libavcodec/sbrdsp_fixed.c @@ -87,7 +87,7 @@ static void sbr_neg_odd_64_c(int *x) { int i; for (i = 1; i < 64; i += 2) - x[i] = -x[i]; + x[i] = -(unsigned)x[i]; } static void sbr_qmf_pre_shuffle_c(int *z) diff --git a/chromium/third_party/ffmpeg/libavcodec/siren.c b/chromium/third_party/ffmpeg/libavcodec/siren.c index 87464808a49..2161b29a2cc 100644 --- a/chromium/third_party/ffmpeg/libavcodec/siren.c +++ b/chromium/third_party/ffmpeg/libavcodec/siren.c @@ -359,11 +359,13 @@ static const float noise_category6[21] = { typedef struct SirenContext { GetBitContext gb; + int microsoft; int rate_control_possibilities; int esf_adjustment; int number_of_regions; int scale_factor; int sample_rate_bits; + int checksum_bits; unsigned dw1, dw2, dw3, dw4; @@ -421,6 +423,15 @@ static av_cold int siren_init(AVCodecContext *avctx) if (!s->fdsp) return AVERROR(ENOMEM); + s->microsoft = avctx->codec->id == AV_CODEC_ID_MSNSIREN; + if (s->microsoft) { + s->esf_adjustment = -2; + s->number_of_regions = 14; + s->scale_factor = 1; + s->sample_rate_bits = 2; + s->checksum_bits = 4; + } + return av_tx_init(&s->tx_ctx, &s->tx_fn, AV_TX_FLOAT_MDCT, 1, FRAME_SIZE, &scale, 0); } @@ -557,7 +568,7 @@ static int get_dw(SirenContext *s) } static int decode_vector(SirenContext *s, int number_of_regions, - int number_of_available_bits, float *decoder_standard_deviation, + float *decoder_standard_deviation, int *power_categories, float *coefs, int scale_factor) { GetBitContext *gb = &s->gb; @@ -626,6 +637,20 @@ static int decode_vector(SirenContext *s, int number_of_regions, coefs_ptr = coefs + (region * REGION_SIZE); + if (category == 5 && s->microsoft) { + i = 0; + for (j = 0; j < REGION_SIZE; j++) { + if (*coefs_ptr != 0) { + i++; + if (fabs(*coefs_ptr) > 2.0 * decoder_standard_deviation[region]) { + i += 3; + } + } + coefs_ptr++; + } + + noise = decoder_standard_deviation[region] * noise_category5[i]; + } else if (category == 5 || category == 6) { i = 0; for (j = 0; j < REGION_SIZE; j++) { @@ -673,12 +698,24 @@ static int siren_decode(AVCodecContext *avctx, void *data, SirenContext *s = avctx->priv_data; GetBitContext *gb = &s->gb; AVFrame *frame = data; - int ret, number_of_valid_coefs = 20 * s->number_of_regions; + int ret, number_of_valid_coefs = REGION_SIZE * s->number_of_regions; int frame_error = 0, rate_control = 0; + int bits_per_frame; + + if (s->microsoft) { + bits_per_frame = avctx->sample_rate / 50; + if (avpkt->size < bits_per_frame / 8) + return AVERROR_INVALIDDATA; + + if ((ret = init_get_bits(gb, avpkt->data, bits_per_frame - s->checksum_bits)) < 0) + return ret; + } else if ((ret = init_get_bits8(gb, avpkt->data, avpkt->size)) < 0) return ret; + skip_bits(gb, s->sample_rate_bits); + decode_envelope(s, gb, s->number_of_regions, s->decoder_standard_deviation, s->absolute_region_power_index, s->esf_adjustment); @@ -694,10 +731,10 @@ static int siren_decode(AVCodecContext *avctx, void *data, for (int i = 0; i < rate_control; i++) s->power_categories[s->category_balance[i]]++; - ret = decode_vector(s, s->number_of_regions, get_bits_left(gb), + ret = decode_vector(s, s->number_of_regions, s->decoder_standard_deviation, s->power_categories, s->imdct_in, s->scale_factor); - if (ret < 0) + if (ret < 0 && !s->microsoft) return ret; if (get_bits_left(gb) > 0) { @@ -715,6 +752,8 @@ static int siren_decode(AVCodecContext *avctx, void *data, frame_error = 1; } + skip_bits(gb, s->checksum_bits); + if (frame_error) { memcpy(s->imdct_in, s->backup_frame, number_of_valid_coefs * sizeof(float)); memset(s->backup_frame, 0, number_of_valid_coefs * sizeof(float)); @@ -726,7 +765,7 @@ static int siren_decode(AVCodecContext *avctx, void *data, if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - for (int i = 0; i < 320; i += 2) + for (int i = 0; i < FRAME_SIZE; i += 2) s->imdct_in[i] *= -1; s->tx_fn(s->tx_ctx, s->imdct_out, s->imdct_in, sizeof(float)); @@ -738,7 +777,7 @@ static int siren_decode(AVCodecContext *avctx, void *data, *got_frame = 1; - return avpkt->size; + return s->microsoft ? bits_per_frame / 8 : avpkt->size; } static av_cold void siren_flush(AVCodecContext *avctx) @@ -775,3 +814,19 @@ const AVCodec ff_siren_decoder = { .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP, }; + +const AVCodec ff_msnsiren_decoder = { + .name = "msnsiren", + .long_name = NULL_IF_CONFIG_SMALL("MSN Siren"), + .priv_data_size = sizeof(SirenContext), + .type = AVMEDIA_TYPE_AUDIO, + .id = AV_CODEC_ID_MSNSIREN, + .init = siren_init, + .close = siren_close, + .decode = siren_decode, + .flush = siren_flush, + .capabilities = AV_CODEC_CAP_CHANNEL_CONF | + AV_CODEC_CAP_DR1, + .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | + FF_CODEC_CAP_INIT_CLEANUP, +}; diff --git a/chromium/third_party/ffmpeg/libavcodec/smc.c b/chromium/third_party/ffmpeg/libavcodec/smc.c index 70851e5e072..9cd86216a22 100644 --- a/chromium/third_party/ffmpeg/libavcodec/smc.c +++ b/chromium/third_party/ffmpeg/libavcodec/smc.c @@ -52,15 +52,15 @@ typedef struct SmcContext { GetByteContext gb; /* SMC color tables */ - unsigned char color_pairs[COLORS_PER_TABLE * CPAIR]; - unsigned char color_quads[COLORS_PER_TABLE * CQUAD]; - unsigned char color_octets[COLORS_PER_TABLE * COCTET]; + uint8_t color_pairs[COLORS_PER_TABLE * CPAIR]; + uint8_t color_quads[COLORS_PER_TABLE * CQUAD]; + uint8_t color_octets[COLORS_PER_TABLE * COCTET]; uint32_t pal[256]; } SmcContext; #define GET_BLOCK_COUNT() \ - (opcode & 0x10) ? (1 + bytestream2_get_byte(&s->gb)) : 1 + (opcode & 0x0F); + (opcode & 0x10) ? (1 + bytestream2_get_byte(gb)) : 1 + (opcode & 0x0F); #define ADVANCE_BLOCK() \ { \ @@ -73,27 +73,28 @@ typedef struct SmcContext { total_blocks--; \ if (total_blocks < !!n_blocks) \ { \ - av_log(s->avctx, AV_LOG_INFO, "warning: block counter just went negative (this should not happen)\n"); \ - return; \ + av_log(s->avctx, AV_LOG_ERROR, "block counter just went negative (this should not happen)\n"); \ + return AVERROR_INVALIDDATA; \ } \ } -static void smc_decode_stream(SmcContext *s) +static int smc_decode_stream(SmcContext *s) { + GetByteContext *gb = &s->gb; int width = s->avctx->width; int height = s->avctx->height; int stride = s->frame->linesize[0]; int i; int chunk_size; - int buf_size = bytestream2_size(&s->gb); - unsigned char opcode; + int buf_size = bytestream2_size(gb); + uint8_t opcode; int n_blocks; unsigned int color_flags; unsigned int color_flags_a; unsigned int color_flags_b; unsigned int flag_mask; - unsigned char * const pixels = s->frame->data[0]; + uint8_t * const pixels = s->frame->data[0]; int image_size = height * s->frame->linesize[0]; int row_ptr = 0; @@ -115,10 +116,10 @@ static void smc_decode_stream(SmcContext *s) /* make the palette available */ memcpy(s->frame->data[1], s->pal, AVPALETTE_SIZE); - bytestream2_skip(&s->gb, 1); - chunk_size = bytestream2_get_be24(&s->gb); + bytestream2_skip(gb, 1); + chunk_size = bytestream2_get_be24(gb); if (chunk_size != buf_size) - av_log(s->avctx, AV_LOG_INFO, "warning: MOV chunk size != encoded chunk size (%d != %d); using MOV chunk size\n", + av_log(s->avctx, AV_LOG_WARNING, "MOV chunk size != encoded chunk size (%d != %d); using MOV chunk size\n", chunk_size, buf_size); chunk_size = buf_size; @@ -129,16 +130,16 @@ static void smc_decode_stream(SmcContext *s) /* sanity checks */ /* make sure the row pointer hasn't gone wild */ if (row_ptr >= image_size) { - av_log(s->avctx, AV_LOG_INFO, "SMC decoder just went out of bounds (row ptr = %d, height = %d)\n", + av_log(s->avctx, AV_LOG_ERROR, "just went out of bounds (row ptr = %d, height = %d)\n", row_ptr, image_size); - return; + return AVERROR_INVALIDDATA; } - if (bytestream2_get_bytes_left(&s->gb) < 1) { + if (bytestream2_get_bytes_left(gb) < 1) { av_log(s->avctx, AV_LOG_ERROR, "input too small\n"); - return; + return AVERROR_INVALIDDATA; } - opcode = bytestream2_get_byte(&s->gb); + opcode = bytestream2_get_byteu(gb); switch (opcode & 0xF0) { /* skip n blocks */ case 0x00: @@ -156,9 +157,9 @@ static void smc_decode_stream(SmcContext *s) /* sanity check */ if ((row_ptr == 0) && (pixel_ptr == 0)) { - av_log(s->avctx, AV_LOG_INFO, "encountered repeat block opcode (%02X) but no blocks rendered yet\n", + av_log(s->avctx, AV_LOG_ERROR, "encountered repeat block opcode (%02X) but no blocks rendered yet\n", opcode & 0xF0); - return; + return AVERROR_INVALIDDATA; } /* figure out where the previous block started */ @@ -190,9 +191,9 @@ static void smc_decode_stream(SmcContext *s) /* sanity check */ if ((row_ptr == 0) && (pixel_ptr < 2 * 4)) { - av_log(s->avctx, AV_LOG_INFO, "encountered repeat block opcode (%02X) but not enough blocks rendered yet\n", + av_log(s->avctx, AV_LOG_ERROR, "encountered repeat block opcode (%02X) but not enough blocks rendered yet\n", opcode & 0xF0); - return; + return AVERROR_INVALIDDATA; } /* figure out where the previous 2 blocks started */ @@ -233,7 +234,7 @@ static void smc_decode_stream(SmcContext *s) case 0x60: case 0x70: n_blocks = GET_BLOCK_COUNT(); - pixel = bytestream2_get_byte(&s->gb); + pixel = bytestream2_get_byte(gb); while (n_blocks--) { block_ptr = row_ptr + pixel_ptr; @@ -257,7 +258,7 @@ static void smc_decode_stream(SmcContext *s) /* fetch the next 2 colors from bytestream and store in next * available entry in the color pair table */ for (i = 0; i < CPAIR; i++) { - pixel = bytestream2_get_byte(&s->gb); + pixel = bytestream2_get_byte(gb); color_table_index = CPAIR * color_pair_index + i; s->color_pairs[color_table_index] = pixel; } @@ -268,10 +269,10 @@ static void smc_decode_stream(SmcContext *s) if (color_pair_index == COLORS_PER_TABLE) color_pair_index = 0; } else - color_table_index = CPAIR * bytestream2_get_byte(&s->gb); + color_table_index = CPAIR * bytestream2_get_byte(gb); while (n_blocks--) { - color_flags = bytestream2_get_be16(&s->gb); + color_flags = bytestream2_get_be16(gb); flag_mask = 0x8000; block_ptr = row_ptr + pixel_ptr; for (pixel_y = 0; pixel_y < 4; pixel_y++) { @@ -299,7 +300,7 @@ static void smc_decode_stream(SmcContext *s) /* fetch the next 4 colors from bytestream and store in next * available entry in the color quad table */ for (i = 0; i < CQUAD; i++) { - pixel = bytestream2_get_byte(&s->gb); + pixel = bytestream2_get_byte(gb); color_table_index = CQUAD * color_quad_index + i; s->color_quads[color_table_index] = pixel; } @@ -310,10 +311,10 @@ static void smc_decode_stream(SmcContext *s) if (color_quad_index == COLORS_PER_TABLE) color_quad_index = 0; } else - color_table_index = CQUAD * bytestream2_get_byte(&s->gb); + color_table_index = CQUAD * bytestream2_get_byte(gb); while (n_blocks--) { - color_flags = bytestream2_get_be32(&s->gb); + color_flags = bytestream2_get_be32(gb); /* flag mask actually acts as a bit shift count here */ flag_mask = 30; block_ptr = row_ptr + pixel_ptr; @@ -340,7 +341,7 @@ static void smc_decode_stream(SmcContext *s) /* fetch the next 8 colors from bytestream and store in next * available entry in the color octet table */ for (i = 0; i < COCTET; i++) { - pixel = bytestream2_get_byte(&s->gb); + pixel = bytestream2_get_byte(gb); color_table_index = COCTET * color_octet_index + i; s->color_octets[color_table_index] = pixel; } @@ -351,7 +352,7 @@ static void smc_decode_stream(SmcContext *s) if (color_octet_index == COLORS_PER_TABLE) color_octet_index = 0; } else - color_table_index = COCTET * bytestream2_get_byte(&s->gb); + color_table_index = COCTET * bytestream2_get_byte(gb); while (n_blocks--) { /* @@ -361,9 +362,9 @@ static void smc_decode_stream(SmcContext *s) flags_a = xx012456, flags_b = xx89A37B */ /* build the color flags */ - int val1 = bytestream2_get_be16(&s->gb); - int val2 = bytestream2_get_be16(&s->gb); - int val3 = bytestream2_get_be16(&s->gb); + int val1 = bytestream2_get_be16(gb); + int val2 = bytestream2_get_be16(gb); + int val3 = bytestream2_get_be16(gb); color_flags_a = ((val1 & 0xFFF0) << 8) | (val2 >> 4); color_flags_b = ((val3 & 0xFFF0) << 8) | ((val1 & 0x0F) << 8) | ((val2 & 0x0F) << 4) | (val3 & 0x0F); @@ -392,27 +393,24 @@ static void smc_decode_stream(SmcContext *s) /* 16-color block encoding (every pixel is a different color) */ case 0xE0: + case 0xF0: n_blocks = (opcode & 0x0F) + 1; while (n_blocks--) { block_ptr = row_ptr + pixel_ptr; for (pixel_y = 0; pixel_y < 4; pixel_y++) { for (pixel_x = 0; pixel_x < 4; pixel_x++) { - pixels[block_ptr++] = bytestream2_get_byte(&s->gb); + pixels[block_ptr++] = bytestream2_get_byte(gb); } block_ptr += row_inc; } ADVANCE_BLOCK(); } break; - - case 0xF0: - avpriv_request_sample(s->avctx, "0xF0 opcode"); - break; } } - return; + return 0; } static av_cold int smc_decode_init(AVCodecContext *avctx) @@ -449,7 +447,9 @@ static int smc_decode_frame(AVCodecContext *avctx, s->frame->palette_has_changed = ff_copy_palette(s->pal, avpkt, avctx); - smc_decode_stream(s); + ret = smc_decode_stream(s); + if (ret < 0) + return ret; *got_frame = 1; if ((ret = av_frame_ref(data, s->frame)) < 0) diff --git a/chromium/third_party/ffmpeg/libavcodec/smcenc.c b/chromium/third_party/ffmpeg/libavcodec/smcenc.c new file mode 100644 index 00000000000..5b0035b2443 --- /dev/null +++ b/chromium/third_party/ffmpeg/libavcodec/smcenc.c @@ -0,0 +1,563 @@ +/* + * QuickTime Graphics (SMC) Video Encoder + * Copyright (c) 2021 The FFmpeg project + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file smcenc.c + * QT SMC Video Encoder by Paul B. Mahol + */ + +#include "libavutil/common.h" + +#include "avcodec.h" +#include "encode.h" +#include "internal.h" +#include "bytestream.h" + +#define CPAIR 2 +#define CQUAD 4 +#define COCTET 8 + +#define COLORS_PER_TABLE 256 + +typedef struct SMCContext { + AVFrame *prev_frame; // buffer for previous source frame + PutByteContext pb; + + uint8_t mono_value; + int nb_distinct; + int next_nb_distinct; + uint8_t distinct_values[16]; + uint8_t next_distinct_values[16]; + + uint8_t color_pairs[COLORS_PER_TABLE][CPAIR]; + uint8_t color_quads[COLORS_PER_TABLE][CQUAD]; + uint8_t color_octets[COLORS_PER_TABLE][COCTET]; + + int key_frame; +} SMCContext; + +#define ADVANCE_BLOCK(pixel_ptr, row_ptr, nb_blocks) \ +{ \ + for (int block = 0; block < nb_blocks && pixel_ptr && row_ptr; block++) { \ + pixel_ptr += 4; \ + if (pixel_ptr - row_ptr >= width) \ + { \ + row_ptr += stride * 4; \ + pixel_ptr = row_ptr; \ + } \ + } \ +} + +static int smc_cmp_values(const void *a, const void *b) +{ + const uint8_t *aa = a, *bb = b; + + return FFDIFFSIGN(aa[0], bb[0]); +} + +static int count_distinct_items(const uint8_t *block_values, + uint8_t *distinct_values, + int size) +{ + int n = 1; + + distinct_values[0] = block_values[0]; + for (int i = 1; i < size; i++) { + if (block_values[i] != block_values[i-1]) { + distinct_values[n] = block_values[i]; + n++; + } + } + + return n; +} + +#define CACHE_PAIR(x) \ + (s->color_pairs[i][0] == distinct_values[x] || \ + s->color_pairs[i][1] == distinct_values[x]) + +#define CACHE_QUAD(x) \ + (s->color_quads[i][0] == distinct_values[x] || \ + s->color_quads[i][1] == distinct_values[x] || \ + s->color_quads[i][2] == distinct_values[x] || \ + s->color_quads[i][3] == distinct_values[x]) + +#define CACHE_OCTET(x) \ + (s->color_octets[i][0] == distinct_values[x] || \ + s->color_octets[i][1] == distinct_values[x] || \ + s->color_octets[i][2] == distinct_values[x] || \ + s->color_octets[i][3] == distinct_values[x] || \ + s->color_octets[i][4] == distinct_values[x] || \ + s->color_octets[i][5] == distinct_values[x] || \ + s->color_octets[i][6] == distinct_values[x] || \ + s->color_octets[i][7] == distinct_values[x]) + +static void smc_encode_stream(SMCContext *s, const AVFrame *frame) +{ + PutByteContext *pb = &s->pb; + const uint8_t *src_pixels = (const uint8_t *)frame->data[0]; + const int stride = frame->linesize[0]; + const uint8_t *prev_pixels = (const uint8_t *)s->prev_frame->data[0]; + uint8_t *distinct_values = s->distinct_values; + const uint8_t *pixel_ptr, *row_ptr; + const int width = frame->width; + uint8_t block_values[16]; + int block_counter = 0; + int color_pair_index = 0; + int color_quad_index = 0; + int color_octet_index = 0; + int color_table_index; /* indexes to color pair, quad, or octet tables */ + int total_blocks; + + memset(s->color_pairs, 0, sizeof(s->color_pairs)); + memset(s->color_quads, 0, sizeof(s->color_quads)); + memset(s->color_octets, 0, sizeof(s->color_octets)); + + /* Number of 4x4 blocks in frame. */ + total_blocks = ((frame->width + 3) / 4) * ((frame->height + 3) / 4); + + pixel_ptr = row_ptr = src_pixels; + + while (block_counter < total_blocks) { + const uint8_t *xpixel_ptr = pixel_ptr; + const uint8_t *xrow_ptr = row_ptr; + int intra_skip_blocks = 0; + int inter_skip_blocks = 0; + int coded_distinct = 0; + int coded_blocks = 0; + int cache_index; + int distinct = 0; + int blocks = 0; + + while (prev_pixels && s->key_frame == 0 && block_counter + inter_skip_blocks < total_blocks) { + int compare = 0; + + for (int y = 0; y < 4; y++) { + const ptrdiff_t offset = pixel_ptr - src_pixels; + const uint8_t *prev_pixel_ptr = prev_pixels + offset; + + compare |= memcmp(prev_pixel_ptr + y * stride, pixel_ptr + y * stride, 4); + if (compare) + break; + } + + if (compare) + break; + + if (inter_skip_blocks >= 256) + break; + inter_skip_blocks++; + + ADVANCE_BLOCK(pixel_ptr, row_ptr, 1) + } + + pixel_ptr = xpixel_ptr; + row_ptr = xrow_ptr; + + while (block_counter > 0 && block_counter + intra_skip_blocks < total_blocks) { + const ptrdiff_t offset = pixel_ptr - src_pixels; + const int sy = offset / stride; + const int sx = offset % stride; + const int ny = sx < 4 ? sy - 4 : sy; + const int nx = sx < 4 ? width - 4 : sx - 4; + const uint8_t *old_pixel_ptr = src_pixels + nx + ny * stride; + int compare = 0; + + for (int y = 0; y < 4; y++) { + compare |= memcmp(old_pixel_ptr + y * stride, pixel_ptr + y * stride, 4); + if (compare) + break; + } + + if (compare) + break; + + if (intra_skip_blocks >= 256) + break; + intra_skip_blocks++; + ADVANCE_BLOCK(pixel_ptr, row_ptr, 1) + } + + pixel_ptr = xpixel_ptr; + row_ptr = xrow_ptr; + + while (block_counter + coded_blocks < total_blocks && coded_blocks < 256) { + for (int y = 0; y < 4; y++) + memcpy(block_values + y * 4, pixel_ptr + y * stride, 4); + + qsort(block_values, 16, sizeof(block_values[0]), smc_cmp_values); + s->next_nb_distinct = count_distinct_items(block_values, s->next_distinct_values, 16); + if (coded_blocks == 0) { + memcpy(distinct_values, s->next_distinct_values, sizeof(s->distinct_values)); + s->nb_distinct = s->next_nb_distinct; + } else { + if (s->next_nb_distinct != s->nb_distinct || + memcmp(distinct_values, s->next_distinct_values, s->nb_distinct)) { + break; + } + } + s->mono_value = block_values[0]; + + coded_distinct = s->nb_distinct; + ADVANCE_BLOCK(pixel_ptr, row_ptr, 1) + coded_blocks++; + if (coded_distinct > 1 && coded_blocks >= 16) + break; + } + + pixel_ptr = xpixel_ptr; + row_ptr = xrow_ptr; + + blocks = coded_blocks; + distinct = coded_distinct; + + if (intra_skip_blocks > 0 && intra_skip_blocks >= inter_skip_blocks && + intra_skip_blocks > 0) { + distinct = 17; + blocks = intra_skip_blocks; + } + + if (intra_skip_blocks > 16 && intra_skip_blocks >= inter_skip_blocks && + intra_skip_blocks > 0) { + distinct = 18; + blocks = intra_skip_blocks; + } + + if (inter_skip_blocks > 0 && inter_skip_blocks > intra_skip_blocks && + inter_skip_blocks > 0) { + distinct = 19; + blocks = inter_skip_blocks; + } + + if (inter_skip_blocks > 16 && inter_skip_blocks > intra_skip_blocks && + inter_skip_blocks > 0) { + distinct = 20; + blocks = inter_skip_blocks; + } + + switch (distinct) { + case 1: + if (blocks <= 16) { + bytestream2_put_byte(pb, 0x60 | (blocks - 1)); + } else { + bytestream2_put_byte(pb, 0x70); + bytestream2_put_byte(pb, blocks - 1); + } + bytestream2_put_byte(pb, s->mono_value); + ADVANCE_BLOCK(pixel_ptr, row_ptr, blocks) + break; + case 2: + cache_index = -1; + for (int i = 0; i < COLORS_PER_TABLE; i++) { + if (CACHE_PAIR(0) && + CACHE_PAIR(1)) { + cache_index = i; + break; + } + } + + if (cache_index >= 0) { + bytestream2_put_byte(pb, 0x90 | (blocks - 1)); + bytestream2_put_byte(pb, cache_index); + color_table_index = cache_index; + } else { + bytestream2_put_byte(pb, 0x80 | (blocks - 1)); + + color_table_index = color_pair_index; + for (int i = 0; i < CPAIR; i++) { + s->color_pairs[color_table_index][i] = distinct_values[i]; + bytestream2_put_byte(pb, distinct_values[i]); + } + + color_pair_index++; + if (color_pair_index == COLORS_PER_TABLE) + color_pair_index = 0; + } + + for (int i = 0; i < blocks; i++) { + uint8_t value = s->color_pairs[color_table_index][1]; + uint16_t flags = 0; + int shift = 15; + + for (int y = 0; y < 4; y++) { + for (int x = 0; x < 4; x++) { + flags |= (value == pixel_ptr[x + y * stride]) << shift; + shift--; + } + } + + bytestream2_put_be16(pb, flags); + + ADVANCE_BLOCK(pixel_ptr, row_ptr, 1) + } + break; + case 3: + case 4: + cache_index = -1; + for (int i = 0; i < COLORS_PER_TABLE; i++) { + if (CACHE_QUAD(0) && + CACHE_QUAD(1) && + CACHE_QUAD(2) && + CACHE_QUAD(3)) { + cache_index = i; + break; + } + } + + if (cache_index >= 0) { + bytestream2_put_byte(pb, 0xB0 | (blocks - 1)); + bytestream2_put_byte(pb, cache_index); + color_table_index = cache_index; + } else { + bytestream2_put_byte(pb, 0xA0 | (blocks - 1)); + + color_table_index = color_quad_index; + for (int i = 0; i < CQUAD; i++) { + s->color_quads[color_table_index][i] = distinct_values[i]; + bytestream2_put_byte(pb, distinct_values[i]); + } + + color_quad_index++; + if (color_quad_index == COLORS_PER_TABLE) + color_quad_index = 0; + } + + for (int i = 0; i < blocks; i++) { + uint32_t flags = 0; + uint8_t quad[4]; + int shift = 30; + + for (int k = 0; k < 4; k++) + quad[k] = s->color_quads[color_table_index][k]; + + for (int y = 0; y < 4; y++) { + for (int x = 0; x < 4; x++) { + int pixel = pixel_ptr[x + y * stride]; + uint32_t idx = 0; + + for (int w = 0; w < CQUAD; w++) { + if (quad[w] == pixel) { + idx = w; + break; + } + } + + flags |= idx << shift; + shift -= 2; + } + } + + bytestream2_put_be32(pb, flags); + + ADVANCE_BLOCK(pixel_ptr, row_ptr, 1) + } + break; + case 5: + case 6: + case 7: + case 8: + cache_index = -1; + for (int i = 0; i < COLORS_PER_TABLE; i++) { + if (CACHE_OCTET(0) && + CACHE_OCTET(1) && + CACHE_OCTET(2) && + CACHE_OCTET(3) && + CACHE_OCTET(4) && + CACHE_OCTET(5) && + CACHE_OCTET(6) && + CACHE_OCTET(7)) { + cache_index = i; + break; + } + } + + if (cache_index >= 0) { + bytestream2_put_byte(pb, 0xD0 | (blocks - 1)); + bytestream2_put_byte(pb, cache_index); + color_table_index = cache_index; + } else { + bytestream2_put_byte(pb, 0xC0 | (blocks - 1)); + + color_table_index = color_octet_index; + for (int i = 0; i < COCTET; i++) { + s->color_octets[color_table_index][i] = distinct_values[i]; + bytestream2_put_byte(pb, distinct_values[i]); + } + + color_octet_index++; + if (color_octet_index == COLORS_PER_TABLE) + color_octet_index = 0; + } + + for (int i = 0; i < blocks; i++) { + uint64_t flags = 0; + uint8_t octet[8]; + int shift = 45; + + for (int k = 0; k < 8; k++) + octet[k] = s->color_octets[color_table_index][k]; + + for (int y = 0; y < 4; y++) { + for (int x = 0; x < 4; x++) { + int pixel = pixel_ptr[x + y * stride]; + uint64_t idx = 0; + + for (int w = 0; w < COCTET; w++) { + if (octet[w] == pixel) { + idx = w; + break; + } + } + + flags |= idx << shift; + shift -= 3; + } + } + + bytestream2_put_be16(pb, ((flags >> 32) & 0xFFF0) | ((flags >> 8) & 0xF)); + bytestream2_put_be16(pb, ((flags >> 20) & 0xFFF0) | ((flags >> 4) & 0xF)); + bytestream2_put_be16(pb, ((flags >> 8) & 0xFFF0) | ((flags >> 0) & 0xF)); + + ADVANCE_BLOCK(pixel_ptr, row_ptr, 1) + } + break; + default: + bytestream2_put_byte(pb, 0xE0 | (blocks - 1)); + for (int i = 0; i < blocks; i++) { + for (int y = 0; y < 4; y++) { + for (int x = 0; x < 4; x++) + bytestream2_put_byte(pb, pixel_ptr[x + y * stride]); + } + + ADVANCE_BLOCK(pixel_ptr, row_ptr, 1) + } + break; + case 17: + bytestream2_put_byte(pb, 0x20 | (blocks - 1)); + ADVANCE_BLOCK(pixel_ptr, row_ptr, blocks) + break; + case 18: + bytestream2_put_byte(pb, 0x30); + bytestream2_put_byte(pb, blocks - 1); + ADVANCE_BLOCK(pixel_ptr, row_ptr, blocks) + break; + case 19: + bytestream2_put_byte(pb, 0x00 | (blocks - 1)); + ADVANCE_BLOCK(pixel_ptr, row_ptr, blocks) + break; + case 20: + bytestream2_put_byte(pb, 0x10); + bytestream2_put_byte(pb, blocks - 1); + ADVANCE_BLOCK(pixel_ptr, row_ptr, blocks) + break; + } + + block_counter += blocks; + } +} + +static int smc_encode_init(AVCodecContext *avctx) +{ + SMCContext *s = avctx->priv_data; + + avctx->bits_per_coded_sample = 8; + + s->prev_frame = av_frame_alloc(); + if (!s->prev_frame) + return AVERROR(ENOMEM); + + return 0; +} + +static int smc_encode_frame(AVCodecContext *avctx, AVPacket *pkt, + const AVFrame *frame, int *got_packet) +{ + SMCContext *s = avctx->priv_data; + const AVFrame *pict = frame; + uint8_t *pal; + int ret; + + ret = ff_alloc_packet(avctx, pkt, 8LL * avctx->height * avctx->width); + if (ret < 0) + return ret; + + if (avctx->gop_size == 0 || !s->prev_frame->data[0] || + (avctx->frame_number % avctx->gop_size) == 0) { + s->key_frame = 1; + } else { + s->key_frame = 0; + } + + bytestream2_init_writer(&s->pb, pkt->data, pkt->size); + + bytestream2_put_be32(&s->pb, 0x00); + + pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE); + if (!pal) + return AVERROR(ENOMEM); + memcpy(pal, frame->data[1], AVPALETTE_SIZE); + + smc_encode_stream(s, pict); + + av_shrink_packet(pkt, bytestream2_tell_p(&s->pb)); + + pkt->data[0] = 0x0; + + // write chunk length + AV_WB24(pkt->data + 1, pkt->size); + + av_frame_unref(s->prev_frame); + ret = av_frame_ref(s->prev_frame, frame); + if (ret < 0) { + av_log(avctx, AV_LOG_ERROR, "cannot add reference\n"); + return ret; + } + + if (s->key_frame) + pkt->flags |= AV_PKT_FLAG_KEY; + + *got_packet = 1; + + return 0; +} + +static int smc_encode_end(AVCodecContext *avctx) +{ + SMCContext *s = (SMCContext *)avctx->priv_data; + + av_frame_free(&s->prev_frame); + + return 0; +} + +const AVCodec ff_smc_encoder = { + .name = "smc", + .long_name = NULL_IF_CONFIG_SMALL("QuickTime Graphics (SMC)"), + .type = AVMEDIA_TYPE_VIDEO, + .id = AV_CODEC_ID_SMC, + .priv_data_size = sizeof(SMCContext), + .init = smc_encode_init, + .encode2 = smc_encode_frame, + .close = smc_encode_end, + .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, + .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_PAL8, + AV_PIX_FMT_NONE}, +}; diff --git a/chromium/third_party/ffmpeg/libavcodec/snow_dwt.c b/chromium/third_party/ffmpeg/libavcodec/snow_dwt.c index 25681e7edd1..3dca3c6d304 100644 --- a/chromium/third_party/ffmpeg/libavcodec/snow_dwt.c +++ b/chromium/third_party/ffmpeg/libavcodec/snow_dwt.c @@ -462,7 +462,7 @@ static void spatial_compose53i_dy(DWTCompose *cs, IDWTELEM *buffer, cs->y += 2; } -void ff_snow_horizontal_compose97i(IDWTELEM *b, IDWTELEM *temp, int width) +static void snow_horizontal_compose97i(IDWTELEM *b, IDWTELEM *temp, int width) { const int w2 = (width + 1) >> 1; int x; @@ -526,9 +526,9 @@ static void vertical_compose97iL1(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, b1[i] -= (W_DM * (b0[i] + b2[i]) + W_DO) >> W_DS; } -void ff_snow_vertical_compose97i(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, - IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5, - int width) +static void snow_vertical_compose97i(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, + IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5, + int width) { int i; @@ -625,9 +625,9 @@ static void spatial_compose97i_dy(DWTCompose *cs, IDWTELEM *buffer, vertical_compose97iH0(b0, b1, b2, width); if (y - 1 < (unsigned)height) - ff_snow_horizontal_compose97i(b0, temp, width); + snow_horizontal_compose97i(b0, temp, width); if (y + 0 < (unsigned)height) - ff_snow_horizontal_compose97i(b1, temp, width); + snow_horizontal_compose97i(b1, temp, width); cs->b0 = b2; cs->b1 = b3; @@ -849,8 +849,8 @@ av_cold void ff_dsputil_init_dwt(MECmpContext *c) av_cold void ff_dwt_init(SnowDWTContext *c) { - c->vertical_compose97i = ff_snow_vertical_compose97i; - c->horizontal_compose97i = ff_snow_horizontal_compose97i; + c->vertical_compose97i = snow_vertical_compose97i; + c->horizontal_compose97i = snow_horizontal_compose97i; c->inner_add_yblock = ff_snow_inner_add_yblock; if (HAVE_MMX) diff --git a/chromium/third_party/ffmpeg/libavcodec/snow_dwt.h b/chromium/third_party/ffmpeg/libavcodec/snow_dwt.h index ee699de35ed..390bc571304 100644 --- a/chromium/third_party/ffmpeg/libavcodec/snow_dwt.h +++ b/chromium/third_party/ffmpeg/libavcodec/snow_dwt.h @@ -99,10 +99,6 @@ void ff_slice_buffer_flush(slice_buffer *buf); void ff_slice_buffer_destroy(slice_buffer *buf); IDWTELEM *ff_slice_buffer_load_line(slice_buffer *buf, int line); -void ff_snow_vertical_compose97i(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, - IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5, - int width); -void ff_snow_horizontal_compose97i(IDWTELEM *b, IDWTELEM *temp, int width); void ff_snow_inner_add_yblock(const uint8_t *obmc, const int obmc_stride, uint8_t **block, int b_w, int b_h, int src_x, int src_y, int src_stride, slice_buffer *sb, diff --git a/chromium/third_party/ffmpeg/libavcodec/srtenc.c b/chromium/third_party/ffmpeg/libavcodec/srtenc.c index edc91c40134..2e3ac557706 100644 --- a/chromium/third_party/ffmpeg/libavcodec/srtenc.c +++ b/chromium/third_party/ffmpeg/libavcodec/srtenc.c @@ -245,7 +245,7 @@ static int encode_frame(AVCodecContext *avctx, return AVERROR(EINVAL); } - dialog = ff_ass_split_dialog2(s->ass_ctx, ass); + dialog = ff_ass_split_dialog(s->ass_ctx, ass); if (!dialog) return AVERROR(ENOMEM); s->alignment_applied = 0; diff --git a/chromium/third_party/ffmpeg/libavcodec/tiff_common.c b/chromium/third_party/ffmpeg/libavcodec/tiff_common.c index b3c6b96b57b..2b872ea7e2c 100644 --- a/chromium/third_party/ffmpeg/libavcodec/tiff_common.c +++ b/chromium/third_party/ffmpeg/libavcodec/tiff_common.c @@ -80,11 +80,26 @@ static const char *auto_sep(int count, const char *sep, int i, int columns) return columns < count ? "\n" : ""; } +static int bprint_to_avdict(AVBPrint *bp, const char *name, + AVDictionary **metadata) +{ + char *ap; + int ret; + + if (!av_bprint_is_complete(bp)) { + av_bprint_finalize(bp, NULL); + return AVERROR(ENOMEM); + } + if ((ret = av_bprint_finalize(bp, &ap)) < 0) + return ret; + + return av_dict_set(metadata, name, ap, AV_DICT_DONT_STRDUP_VAL); +} + int ff_tadd_rational_metadata(int count, const char *name, const char *sep, GetByteContext *gb, int le, AVDictionary **metadata) { AVBPrint bp; - char *ap; int32_t nom, denom; int i; @@ -101,16 +116,7 @@ int ff_tadd_rational_metadata(int count, const char *name, const char *sep, av_bprintf(&bp, "%s%7"PRId32":%-7"PRId32, auto_sep(count, sep, i, 4), nom, denom); } - if ((i = av_bprint_finalize(&bp, &ap))) { - return i; - } - if (!ap) { - return AVERROR(ENOMEM); - } - - av_dict_set(metadata, name, ap, AV_DICT_DONT_STRDUP_VAL); - - return 0; + return bprint_to_avdict(&bp, name, metadata); } @@ -118,7 +124,6 @@ int ff_tadd_long_metadata(int count, const char *name, const char *sep, GetByteContext *gb, int le, AVDictionary **metadata) { AVBPrint bp; - char *ap; int i; if (count >= INT_MAX / sizeof(int32_t) || count <= 0) @@ -132,16 +137,7 @@ int ff_tadd_long_metadata(int count, const char *name, const char *sep, av_bprintf(&bp, "%s%7i", auto_sep(count, sep, i, 8), ff_tget_long(gb, le)); } - if ((i = av_bprint_finalize(&bp, &ap))) { - return i; - } - if (!ap) { - return AVERROR(ENOMEM); - } - - av_dict_set(metadata, name, ap, AV_DICT_DONT_STRDUP_VAL); - - return 0; + return bprint_to_avdict(&bp, name, metadata); } @@ -149,7 +145,6 @@ int ff_tadd_doubles_metadata(int count, const char *name, const char *sep, GetByteContext *gb, int le, AVDictionary **metadata) { AVBPrint bp; - char *ap; int i; if (count >= INT_MAX / sizeof(int64_t) || count <= 0) @@ -163,16 +158,7 @@ int ff_tadd_doubles_metadata(int count, const char *name, const char *sep, av_bprintf(&bp, "%s%.15g", auto_sep(count, sep, i, 4), ff_tget_double(gb, le)); } - if ((i = av_bprint_finalize(&bp, &ap))) { - return i; - } - if (!ap) { - return AVERROR(ENOMEM); - } - - av_dict_set(metadata, name, ap, AV_DICT_DONT_STRDUP_VAL); - - return 0; + return bprint_to_avdict(&bp, name, metadata); } @@ -180,7 +166,6 @@ int ff_tadd_shorts_metadata(int count, const char *name, const char *sep, GetByteContext *gb, int le, int is_signed, AVDictionary **metadata) { AVBPrint bp; - char *ap; int i; if (count >= INT_MAX / sizeof(int16_t) || count <= 0) @@ -195,16 +180,7 @@ int ff_tadd_shorts_metadata(int count, const char *name, const char *sep, av_bprintf(&bp, "%s%5i", auto_sep(count, sep, i, 8), v); } - if ((i = av_bprint_finalize(&bp, &ap))) { - return i; - } - if (!ap) { - return AVERROR(ENOMEM); - } - - av_dict_set(metadata, name, ap, AV_DICT_DONT_STRDUP_VAL); - - return 0; + return bprint_to_avdict(&bp, name, metadata); } @@ -212,7 +188,6 @@ int ff_tadd_bytes_metadata(int count, const char *name, const char *sep, GetByteContext *gb, int le, int is_signed, AVDictionary **metadata) { AVBPrint bp; - char *ap; int i; if (count >= INT_MAX / sizeof(int8_t) || count < 0) @@ -227,16 +202,7 @@ int ff_tadd_bytes_metadata(int count, const char *name, const char *sep, av_bprintf(&bp, "%s%3i", auto_sep(count, sep, i, 16), v); } - if ((i = av_bprint_finalize(&bp, &ap))) { - return i; - } - if (!ap) { - return AVERROR(ENOMEM); - } - - av_dict_set(metadata, name, ap, AV_DICT_DONT_STRDUP_VAL); - - return 0; + return bprint_to_avdict(&bp, name, metadata); } int ff_tadd_string_metadata(int count, const char *name, diff --git a/chromium/third_party/ffmpeg/libavcodec/trace_headers_bsf.c b/chromium/third_party/ffmpeg/libavcodec/trace_headers_bsf.c index b891730bacd..a9b02474127 100644 --- a/chromium/third_party/ffmpeg/libavcodec/trace_headers_bsf.c +++ b/chromium/third_party/ffmpeg/libavcodec/trace_headers_bsf.c @@ -95,6 +95,19 @@ static int trace_headers(AVBSFContext *bsf, AVPacket *pkt) av_log(bsf, AV_LOG_INFO, "Packet: %d bytes%s.\n", pkt->size, tmp); + if (av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, NULL)) { + av_log(bsf, AV_LOG_INFO, "Side data:\n"); + + err = ff_cbs_read_packet_side_data(ctx->cbc, frag, pkt); + ff_cbs_fragment_reset(frag); + + if (err < 0) { + av_packet_unref(pkt); + return err; + } + av_log(bsf, AV_LOG_INFO, "Payload:\n"); + } + err = ff_cbs_read_packet(ctx->cbc, frag, pkt); ff_cbs_fragment_reset(frag); diff --git a/chromium/third_party/ffmpeg/libavcodec/ttmlenc.c b/chromium/third_party/ffmpeg/libavcodec/ttmlenc.c index 5cab33cc60e..ad2eddfdd52 100644 --- a/chromium/third_party/ffmpeg/libavcodec/ttmlenc.c +++ b/chromium/third_party/ffmpeg/libavcodec/ttmlenc.c @@ -95,7 +95,7 @@ static int ttml_encode_frame(AVCodecContext *avctx, uint8_t *buf, return AVERROR(EINVAL); } - dialog = ff_ass_split_dialog2(s->ass_ctx, ass); + dialog = ff_ass_split_dialog(s->ass_ctx, ass); if (!dialog) return AVERROR(ENOMEM); diff --git a/chromium/third_party/ffmpeg/libavcodec/utils.c b/chromium/third_party/ffmpeg/libavcodec/utils.c index 5fad782f5a6..cfc07cbcb8b 100644 --- a/chromium/third_party/ffmpeg/libavcodec/utils.c +++ b/chromium/third_party/ffmpeg/libavcodec/utils.c @@ -810,20 +810,22 @@ static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba, int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes) { - return get_audio_frame_duration(avctx->codec_id, avctx->sample_rate, + int duration = get_audio_frame_duration(avctx->codec_id, avctx->sample_rate, avctx->channels, avctx->block_align, avctx->codec_tag, avctx->bits_per_coded_sample, avctx->bit_rate, avctx->extradata, avctx->frame_size, frame_bytes); + return FFMAX(0, duration); } int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes) { - return get_audio_frame_duration(par->codec_id, par->sample_rate, + int duration = get_audio_frame_duration(par->codec_id, par->sample_rate, par->channels, par->block_align, par->codec_tag, par->bits_per_coded_sample, par->bit_rate, par->extradata, par->frame_size, frame_bytes); + return FFMAX(0, duration); } #if !HAVE_THREADS diff --git a/chromium/third_party/ffmpeg/libavcodec/vc1dec.c b/chromium/third_party/ffmpeg/libavcodec/vc1dec.c index 6cd74a09f12..e636fa61606 100644 --- a/chromium/third_party/ffmpeg/libavcodec/vc1dec.c +++ b/chromium/third_party/ffmpeg/libavcodec/vc1dec.c @@ -444,7 +444,9 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) // the last byte of the extradata is a version number, 1 for the // samples we can decode - init_get_bits(&gb, avctx->extradata, avctx->extradata_size*8); + ret = init_get_bits8(&gb, avctx->extradata, avctx->extradata_size); + if (ret < 0) + return ret; if ((ret = ff_vc1_decode_sequence_header(avctx, v, &gb)) < 0) return ret; @@ -770,8 +772,11 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data, buf_size2 = vc1_unescape_buffer(buf, buf_size, buf2); } init_get_bits(&s->gb, buf2, buf_size2*8); - } else - init_get_bits(&s->gb, buf, buf_size*8); + } else{ + ret = init_get_bits8(&s->gb, buf, buf_size); + if (ret < 0) + return ret; + } if (v->res_sprite) { v->new_sprite = !get_bits1(&s->gb); @@ -1121,7 +1126,9 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data, ret = AVERROR_INVALIDDATA; goto err; } - if (!v->field_mode) + if ( !v->field_mode + && avctx->codec_id != AV_CODEC_ID_WMV3IMAGE + && avctx->codec_id != AV_CODEC_ID_VC1IMAGE) ff_er_frame_end(&s->er); } @@ -1149,12 +1156,14 @@ image: if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { if ((ret = av_frame_ref(pict, s->current_picture_ptr->f)) < 0) goto err; - ff_print_debug_info(s, s->current_picture_ptr, pict); + if (!v->field_mode) + ff_print_debug_info(s, s->current_picture_ptr, pict); *got_frame = 1; } else if (s->last_picture_ptr) { if ((ret = av_frame_ref(pict, s->last_picture_ptr->f)) < 0) goto err; - ff_print_debug_info(s, s->last_picture_ptr, pict); + if (!v->field_mode) + ff_print_debug_info(s, s->last_picture_ptr, pict); *got_frame = 1; } } diff --git a/chromium/third_party/ffmpeg/libavcodec/vdpau.c b/chromium/third_party/ffmpeg/libavcodec/vdpau.c index f20dbd78e2a..7c29746adbd 100644 --- a/chromium/third_party/ffmpeg/libavcodec/vdpau.c +++ b/chromium/third_party/ffmpeg/libavcodec/vdpau.c @@ -69,6 +69,9 @@ AVVDPAUContext *av_alloc_vdpaucontext(void) return av_vdpau_alloc_context(); } +#define MAKE_ACCESSORS(str, name, type, field) \ + type av_##name##_get_##field(const str *s) { return s->field; } \ + void av_##name##_set_##field(str *s, type v) { s->field = v; } MAKE_ACCESSORS(AVVDPAUContext, vdpau_hwaccel, AVVDPAU_Render2, render2) int av_vdpau_get_surface_parameters(AVCodecContext *avctx, diff --git a/chromium/third_party/ffmpeg/libavcodec/version.h b/chromium/third_party/ffmpeg/libavcodec/version.h index 91325ce4e7b..4b4fe543ab1 100644 --- a/chromium/third_party/ffmpeg/libavcodec/version.h +++ b/chromium/third_party/ffmpeg/libavcodec/version.h @@ -28,8 +28,8 @@ #include "libavutil/version.h" #define LIBAVCODEC_VERSION_MAJOR 59 -#define LIBAVCODEC_VERSION_MINOR 3 -#define LIBAVCODEC_VERSION_MICRO 102 +#define LIBAVCODEC_VERSION_MINOR 7 +#define LIBAVCODEC_VERSION_MICRO 103 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ diff --git a/chromium/third_party/ffmpeg/libavcodec/videotoolboxenc.c b/chromium/third_party/ffmpeg/libavcodec/videotoolboxenc.c index 4eaabed5d8f..8dfd6e3d0c2 100644 --- a/chromium/third_party/ffmpeg/libavcodec/videotoolboxenc.c +++ b/chromium/third_party/ffmpeg/libavcodec/videotoolboxenc.c @@ -1398,7 +1398,6 @@ static int vtenc_configure_encoder(AVCodecContext *avctx) } vtctx->codec_id = avctx->codec_id; - avctx->max_b_frames = 16; if (vtctx->codec_id == AV_CODEC_ID_H264) { vtctx->get_param_set_func = CMVideoFormatDescriptionGetH264ParameterSetAtIndex; diff --git a/chromium/third_party/ffmpeg/libavcodec/vp6.c b/chromium/third_party/ffmpeg/libavcodec/vp6.c index 73822a00f98..d0243707934 100644 --- a/chromium/third_party/ffmpeg/libavcodec/vp6.c +++ b/chromium/third_party/ffmpeg/libavcodec/vp6.c @@ -167,7 +167,9 @@ static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size) } if (s->use_huffman) { s->parse_coeff = vp6_parse_coeff_huffman; - init_get_bits(&s->gb, buf, buf_size<<3); + ret = init_get_bits8(&s->gb, buf, buf_size); + if (ret < 0) + return ret; } else { ret = ff_vp56_init_range_decoder(&s->cc, buf, buf_size); if (ret < 0) diff --git a/chromium/third_party/ffmpeg/libavcodec/vp9.c b/chromium/third_party/ffmpeg/libavcodec/vp9.c index 874005a5ae0..c1b58d47521 100644 --- a/chromium/third_party/ffmpeg/libavcodec/vp9.c +++ b/chromium/third_party/ffmpeg/libavcodec/vp9.c @@ -27,6 +27,8 @@ #include "internal.h" #include "profiles.h" #include "thread.h" +#include "pthread_internal.h" + #include "videodsp.h" #include "vp56.h" #include "vp9.h" @@ -39,15 +41,9 @@ #define VP9_SYNCCODE 0x498342 #if HAVE_THREADS -static void vp9_free_entries(AVCodecContext *avctx) { - VP9Context *s = avctx->priv_data; - - if (avctx->active_thread_type & FF_THREAD_SLICE) { - pthread_mutex_destroy(&s->progress_mutex); - pthread_cond_destroy(&s->progress_cond); - av_freep(&s->entries); - } -} +DEFINE_OFFSET_ARRAY(VP9Context, vp9_context, pthread_init_cnt, + (offsetof(VP9Context, progress_mutex)), + (offsetof(VP9Context, progress_cond))); static int vp9_alloc_entries(AVCodecContext *avctx, int n) { VP9Context *s = avctx->priv_data; @@ -58,17 +54,11 @@ static int vp9_alloc_entries(AVCodecContext *avctx, int n) { av_freep(&s->entries); s->entries = av_malloc_array(n, sizeof(atomic_int)); - - if (!s->entries) { - av_freep(&s->entries); + if (!s->entries) return AVERROR(ENOMEM); - } for (i = 0; i < n; i++) atomic_init(&s->entries[i], 0); - - pthread_mutex_init(&s->progress_mutex, NULL); - pthread_cond_init(&s->progress_cond, NULL); } return 0; } @@ -90,7 +80,6 @@ static void vp9_await_tile_progress(VP9Context *s, int field, int n) { pthread_mutex_unlock(&s->progress_mutex); } #else -static void vp9_free_entries(AVCodecContext *avctx) {} static int vp9_alloc_entries(AVCodecContext *avctx, int n) { return 0; } #endif @@ -792,11 +781,10 @@ static int decode_frame_header(AVCodecContext *avctx, if (s->td) { for (i = 0; i < s->active_tile_cols; i++) vp9_tile_data_free(&s->td[i]); - av_free(s->td); + av_freep(&s->td); } s->s.h.tiling.tile_cols = 1 << s->s.h.tiling.log2_tile_cols; - vp9_free_entries(avctx); s->active_tile_cols = avctx->active_thread_type == FF_THREAD_SLICE ? s->s.h.tiling.tile_cols : 1; vp9_alloc_entries(avctx, s->sb_rows); @@ -1251,7 +1239,10 @@ static av_cold int vp9_decode_free(AVCodecContext *avctx) } free_buffers(s); - vp9_free_entries(avctx); +#if HAVE_THREADS + av_freep(&s->entries); + ff_pthread_free(s, vp9_context_offsets); +#endif av_freep(&s->td); return 0; } @@ -1793,10 +1784,19 @@ static void vp9_decode_flush(AVCodecContext *avctx) static av_cold int vp9_decode_init(AVCodecContext *avctx) { VP9Context *s = avctx->priv_data; + int ret; s->last_bpp = 0; s->s.h.filter.sharpness = -1; +#if HAVE_THREADS + if (avctx->active_thread_type & FF_THREAD_SLICE) { + ret = ff_pthread_init(s, vp9_context_offsets); + if (ret < 0) + return ret; + } +#endif + for (int i = 0; i < 3; i++) { s->s.frames[i].tf.f = av_frame_alloc(); if (!s->s.frames[i].tf.f) diff --git a/chromium/third_party/ffmpeg/libavcodec/vp9dec.h b/chromium/third_party/ffmpeg/libavcodec/vp9dec.h index d82b258a3d8..9cbd5839a8a 100644 --- a/chromium/third_party/ffmpeg/libavcodec/vp9dec.h +++ b/chromium/third_party/ffmpeg/libavcodec/vp9dec.h @@ -105,6 +105,7 @@ typedef struct VP9Context { pthread_mutex_t progress_mutex; pthread_cond_t progress_cond; atomic_int *entries; + unsigned pthread_init_cnt; #endif uint8_t ss_h, ss_v; diff --git a/chromium/third_party/ffmpeg/libavcodec/webp.c b/chromium/third_party/ffmpeg/libavcodec/webp.c index 83371ef6fdc..3efd4438d9c 100644 --- a/chromium/third_party/ffmpeg/libavcodec/webp.c +++ b/chromium/third_party/ffmpeg/libavcodec/webp.c @@ -627,6 +627,9 @@ static int decode_entropy_coded_image(WebPContext *s, enum ImageRole role, while (y < img->frame->height) { int v; + if (get_bits_left(&s->gb) < 0) + return AVERROR_INVALIDDATA; + hg = get_huffman_group(s, img, x, y); v = huff_reader_get_symbol(&hg[HUFF_IDX_GREEN], &s->gb); if (v < NUM_LITERAL_CODES) { diff --git a/chromium/third_party/ffmpeg/libavcodec/webvttenc.c b/chromium/third_party/ffmpeg/libavcodec/webvttenc.c index 3181e251208..89b49e42bf2 100644 --- a/chromium/third_party/ffmpeg/libavcodec/webvttenc.c +++ b/chromium/third_party/ffmpeg/libavcodec/webvttenc.c @@ -172,7 +172,7 @@ static int webvtt_encode_frame(AVCodecContext *avctx, return AVERROR(EINVAL); } - dialog = ff_ass_split_dialog2(s->ass_ctx, ass); + dialog = ff_ass_split_dialog(s->ass_ctx, ass); if (!dialog) return AVERROR(ENOMEM); webvtt_style_apply(s, dialog->style); diff --git a/chromium/third_party/ffmpeg/libavcodec/wma.c b/chromium/third_party/ffmpeg/libavcodec/wma.c index 004ffb5515b..d9fda2dbfa1 100644 --- a/chromium/third_party/ffmpeg/libavcodec/wma.c +++ b/chromium/third_party/ffmpeg/libavcodec/wma.c @@ -459,7 +459,7 @@ int ff_wma_run_level_decode(AVCodecContext *avctx, GetBitContext *gb, if (get_bits1(gb)) { av_log(avctx, AV_LOG_ERROR, "broken escape sequence\n"); - return -1; + return AVERROR_INVALIDDATA; } else offset += get_bits(gb, frame_len_bits) + 4; } else @@ -477,7 +477,7 @@ int ff_wma_run_level_decode(AVCodecContext *avctx, GetBitContext *gb, offset, num_coefs ); - return -1; + return AVERROR_INVALIDDATA; } return 0; diff --git a/chromium/third_party/ffmpeg/libavcodec/wma.h b/chromium/third_party/ffmpeg/libavcodec/wma.h index aea7ba28ab4..80e52687fdd 100644 --- a/chromium/third_party/ffmpeg/libavcodec/wma.h +++ b/chromium/third_party/ffmpeg/libavcodec/wma.h @@ -135,6 +135,8 @@ typedef struct WMACodecContext { float lsp_pow_m_table2[(1 << LSP_POW_BITS)]; AVFloatDSPContext *fdsp; + int eof_done; /* decode flag to output remaining samples after EOF */ + #ifdef TRACE int frame_count; #endif /* TRACE */ diff --git a/chromium/third_party/ffmpeg/libavcodec/wmadec.c b/chromium/third_party/ffmpeg/libavcodec/wmadec.c index d627bbe50e3..9955aaa7d61 100644 --- a/chromium/third_party/ffmpeg/libavcodec/wmadec.c +++ b/chromium/third_party/ffmpeg/libavcodec/wmadec.c @@ -135,6 +135,8 @@ static av_cold int wma_decode_init(AVCodecContext *avctx) avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; + avctx->internal->skip_samples = s->frame_len * 2; + return 0; } @@ -601,15 +603,18 @@ static int wma_decode_block(WMACodecContext *s) if (s->channel_coded[ch]) { int tindex; WMACoef *ptr = &s->coefs1[ch][0]; + int ret; /* special VLC tables are used for ms stereo because * there is potentially less energy there */ tindex = (ch == 1 && s->ms_stereo); memset(ptr, 0, s->block_len * sizeof(WMACoef)); - ff_wma_run_level_decode(s->avctx, &s->gb, &s->coef_vlc[tindex], - s->level_table[tindex], s->run_table[tindex], - 0, ptr, 0, nb_coefs[ch], - s->block_len, s->frame_len_bits, coef_nb_bits); + ret = ff_wma_run_level_decode(s->avctx, &s->gb, &s->coef_vlc[tindex], + s->level_table[tindex], s->run_table[tindex], + 0, ptr, 0, nb_coefs[ch], + s->block_len, s->frame_len_bits, coef_nb_bits); + if (ret < 0) + return ret; } if (s->version == 1 && s->avctx->channels >= 2) align_get_bits(&s->gb); @@ -826,7 +831,20 @@ static int wma_decode_superframe(AVCodecContext *avctx, void *data, ff_tlog(avctx, "***decode_superframe:\n"); if (buf_size == 0) { + if (s->eof_done) + return 0; + + frame->nb_samples = s->frame_len; + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) + return ret; + + for (i = 0; i < s->avctx->channels; i++) + memcpy(frame->extended_data[i], &s->frame_out[i][0], + frame->nb_samples * sizeof(s->frame_out[i][0])); + s->last_superframe_len = 0; + s->eof_done = 1; + *got_frame_ptr = 1; return 0; } if (buf_size < avctx->block_align) { @@ -972,6 +990,9 @@ static av_cold void flush(AVCodecContext *avctx) s->last_bitoffset = s->last_superframe_len = 0; + + s->eof_done = 0; + avctx->internal->skip_samples = s->frame_len * 2; } #if CONFIG_WMAV1_DECODER @@ -985,7 +1006,7 @@ const AVCodec ff_wmav1_decoder = { .close = ff_wma_end, .decode = wma_decode_superframe, .flush = flush, - .capabilities = AV_CODEC_CAP_DR1, + .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY, .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP, @@ -1002,7 +1023,7 @@ const AVCodec ff_wmav2_decoder = { .close = ff_wma_end, .decode = wma_decode_superframe, .flush = flush, - .capabilities = AV_CODEC_CAP_DR1, + .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY, .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP, diff --git a/chromium/third_party/ffmpeg/libavcodec/wmaprodec.c b/chromium/third_party/ffmpeg/libavcodec/wmaprodec.c index e0d00d2d378..a4b48b13a8c 100644 --- a/chromium/third_party/ffmpeg/libavcodec/wmaprodec.c +++ b/chromium/third_party/ffmpeg/libavcodec/wmaprodec.c @@ -88,6 +88,7 @@ #include <inttypes.h> +#include "libavutil/audio_fifo.h" #include "libavutil/ffmath.h" #include "libavutil/float_dsp.h" #include "libavutil/intfloat.h" @@ -192,6 +193,8 @@ typedef struct WMAProDecodeCtx { uint8_t dynamic_range_compression; ///< frame contains DRC data uint8_t bits_per_sample; ///< integer audio sample size for the unscaled IMDCT output (used to scale to [-1.0, 1.0]) uint16_t samples_per_frame; ///< number of samples to output + uint16_t trim_start; ///< number of samples to skip at start + uint16_t trim_end; ///< number of samples to skip at end uint16_t log2_frame_size; int8_t lfe_channel; ///< lfe channel index uint8_t max_num_subframes; @@ -246,9 +249,10 @@ typedef struct XMADecodeCtx { AVFrame *frames[XMA_MAX_STREAMS]; int current_stream; int num_streams; - float samples[XMA_MAX_CHANNELS][512 * 64]; - int offset[XMA_MAX_STREAMS]; + AVAudioFifo *samples[2][XMA_MAX_STREAMS]; int start_channel[XMA_MAX_STREAMS]; + int trim_start, trim_end; + int flushed; } XMADecodeCtx; /** @@ -417,10 +421,7 @@ static av_cold int decode_init(WMAProDecodeCtx *s, AVCodecContext *avctx, int nu } /** frame info */ - if (avctx->codec_id != AV_CODEC_ID_WMAPRO) - s->skip_frame = 0; - else - s->skip_frame = 1; /* skip first frame */ + s->skip_frame = 1; /* skip first frame */ s->packet_loss = 1; s->len_prefix = (s->decode_flags & 0x40); @@ -574,7 +575,8 @@ static av_cold int decode_init(WMAProDecodeCtx *s, AVCodecContext *avctx, int nu if (avctx->debug & FF_DEBUG_BITSTREAM) dump_context(s); - avctx->channel_layout = channel_mask; + if (avctx->codec_id == AV_CODEC_ID_WMAPRO) + avctx->channel_layout = channel_mask; ff_thread_once(&init_static_once, decode_init_static); @@ -991,13 +993,16 @@ static int decode_coeffs(WMAProDecodeCtx *s, int c) /** decode run level coded coefficients */ if (cur_coeff < s->subframe_len) { + int ret; + memset(&ci->coeffs[cur_coeff], 0, sizeof(*ci->coeffs) * (s->subframe_len - cur_coeff)); - if (ff_wma_run_level_decode(s->avctx, &s->gb, vlc, - level, run, 1, ci->coeffs, - cur_coeff, s->subframe_len, - s->subframe_len, s->esc_len, 0)) - return AVERROR_INVALIDDATA; + ret = ff_wma_run_level_decode(s->avctx, &s->gb, vlc, + level, run, 1, ci->coeffs, + cur_coeff, s->subframe_len, + s->subframe_len, s->esc_len, 0); + if (ret < 0) + return ret; } return 0; @@ -1459,23 +1464,14 @@ static int decode_frame(WMAProDecodeCtx *s, AVFrame *frame, int *got_frame_ptr) ff_dlog(s->avctx, "drc_gain %i\n", s->drc_gain); } - /** no idea what these are for, might be the number of samples - that need to be skipped at the beginning or end of a stream */ if (get_bits1(gb)) { - int av_unused skip; - - /** usually true for the first frame */ - if (get_bits1(gb)) { - skip = get_bits(gb, av_log2(s->samples_per_frame * 2)); - ff_dlog(s->avctx, "start skip: %i\n", skip); - } - - /** sometimes true for the last frame */ - if (get_bits1(gb)) { - skip = get_bits(gb, av_log2(s->samples_per_frame * 2)); - ff_dlog(s->avctx, "end skip: %i\n", skip); - } + if (get_bits1(gb)) + s->trim_start = get_bits(gb, av_log2(s->samples_per_frame * 2)); + if (get_bits1(gb)) + s->trim_end = get_bits(gb, av_log2(s->samples_per_frame * 2)); + } else { + s->trim_start = s->trim_end = 0; } ff_dlog(s->avctx, "BITSTREAM: frame header length was %i\n", @@ -1615,6 +1611,7 @@ static int decode_packet(AVCodecContext *avctx, WMAProDecodeCtx *s, int buf_size = avpkt->size; int num_bits_prev_frame; int packet_sequence_number; + int ret; *got_frame_ptr = 0; @@ -1637,9 +1634,6 @@ static int decode_packet(AVCodecContext *avctx, WMAProDecodeCtx *s, s->samples_per_frame * sizeof(*s->channel[i].out) >> 1); } - /* TODO: XMA should output 128 samples only (instead of 512) and WMAPRO - * maybe 768 (with 2048), XMA needs changes in multi-stream handling though. */ - s->eof_done = 1; s->packet_done = 1; *got_frame_ptr = 1; @@ -1666,7 +1660,9 @@ static int decode_packet(AVCodecContext *avctx, WMAProDecodeCtx *s, s->buf_bit_size = buf_size << 3; /** parse packet header */ - init_get_bits(gb, buf, s->buf_bit_size); + ret = init_get_bits8(gb, buf, buf_size); + if (ret < 0) + return ret; if (avctx->codec_id != AV_CODEC_ID_XMA2) { packet_sequence_number = get_bits(gb, 4); skip_bits(gb, 2); @@ -1734,7 +1730,9 @@ static int decode_packet(AVCodecContext *avctx, WMAProDecodeCtx *s, } s->buf_bit_size = (avpkt->size - s->next_packet_start) << 3; - init_get_bits(gb, avpkt->data, s->buf_bit_size); + ret = init_get_bits8(gb, avpkt->data, avpkt->size - s->next_packet_start); + if (ret < 0) + return ret; skip_bits(gb, s->packet_offset); if (s->len_prefix && remaining_bits(s, gb) > s->log2_frame_size && (frame_size = show_bits(gb, s->log2_frame_size)) && @@ -1773,6 +1771,33 @@ static int decode_packet(AVCodecContext *avctx, WMAProDecodeCtx *s, if (s->packet_loss) return AVERROR_INVALIDDATA; + if (s->trim_start && avctx->codec_id == AV_CODEC_ID_WMAPRO) { + AVFrame *frame = data; + + if (s->trim_start < frame->nb_samples) { + for (int ch = 0; ch < frame->channels; ch++) + frame->extended_data[ch] += s->trim_start * 4; + + frame->nb_samples -= s->trim_start; + } else { + *got_frame_ptr = 0; + } + + s->trim_start = 0; + } + + if (s->trim_end && avctx->codec_id == AV_CODEC_ID_WMAPRO) { + AVFrame *frame = data; + + if (s->trim_end < frame->nb_samples) { + frame->nb_samples -= s->trim_end; + } else { + *got_frame_ptr = 0; + } + + s->trim_end = 0; + } + return get_bits_count(gb) >> 3; } @@ -1806,34 +1831,54 @@ static int xma_decode_packet(AVCodecContext *avctx, void *data, XMADecodeCtx *s = avctx->priv_data; int got_stream_frame_ptr = 0; AVFrame *frame = data; - int i, ret, offset = INT_MAX; + int i, ret = 0, eof = 0; if (!s->frames[s->current_stream]->data[0]) { + avctx->internal->skip_samples = 64; s->frames[s->current_stream]->nb_samples = 512; - if ((ret = ff_get_buffer(avctx, s->frames[s->current_stream], 0)) < 0) { + if ((ret = ff_get_buffer(avctx, s->frames[s->current_stream], 0)) < 0) + return ret; + } else if (s->frames[s->current_stream]->nb_samples != 512) { + avctx->internal->skip_samples = 64; + av_frame_unref(s->frames[s->current_stream]); + s->frames[s->current_stream]->nb_samples = 512; + if ((ret = ff_get_buffer(avctx, s->frames[s->current_stream], 0)) < 0) return ret; - } } /* decode current stream packet */ - ret = decode_packet(avctx, &s->xma[s->current_stream], s->frames[s->current_stream], - &got_stream_frame_ptr, avpkt); + if (!s->xma[s->current_stream].eof_done) { + ret = decode_packet(avctx, &s->xma[s->current_stream], s->frames[s->current_stream], + &got_stream_frame_ptr, avpkt); + } - if (got_stream_frame_ptr && s->offset[s->current_stream] >= 64) { - got_stream_frame_ptr = 0; - ret = AVERROR_INVALIDDATA; + if (!avpkt->size) { + eof = 1; + + for (i = 0; i < s->num_streams; i++) { + if (!s->xma[i].eof_done) { + ret = decode_packet(avctx, &s->xma[i], s->frames[i], + &got_stream_frame_ptr, avpkt); + } + + eof &= s->xma[i].eof_done; + } } + if (s->xma[0].trim_start) + s->trim_start = s->xma[0].trim_start; + if (s->xma[0].trim_end) + s->trim_end = s->xma[0].trim_end; + /* copy stream samples (1/2ch) to sample buffer (Nch) */ if (got_stream_frame_ptr) { - int start_ch = s->start_channel[s->current_stream]; - memcpy(&s->samples[start_ch + 0][s->offset[s->current_stream] * 512], - s->frames[s->current_stream]->extended_data[0], 512 * 4); + const int nb_samples = s->frames[s->current_stream]->nb_samples; + void *left[1] = { s->frames[s->current_stream]->extended_data[0] }; + void *right[1] = { s->frames[s->current_stream]->extended_data[1] }; + + av_audio_fifo_write(s->samples[0][s->current_stream], left, nb_samples); if (s->xma[s->current_stream].nb_channels > 1) - memcpy(&s->samples[start_ch + 1][s->offset[s->current_stream] * 512], - s->frames[s->current_stream]->extended_data[1], 512 * 4); - s->offset[s->current_stream]++; + av_audio_fifo_write(s->samples[1][s->current_stream], right, nb_samples); } else if (ret < 0) { - memset(s->offset, 0, sizeof(s->offset)); s->current_stream = 0; return ret; } @@ -1843,6 +1888,7 @@ static int xma_decode_packet(AVCodecContext *avctx, void *data, * (at start there is one packet per stream, then interleave non-linearly). */ if (s->xma[s->current_stream].packet_done || s->xma[s->current_stream].packet_loss) { + int nb_samples = INT_MAX; /* select stream with 0 skip_packets (= uses next packet) */ if (s->xma[s->current_stream].skip_packets != 0) { @@ -1864,35 +1910,36 @@ static int xma_decode_packet(AVCodecContext *avctx, void *data, /* all other streams skip next packet */ for (i = 0; i < s->num_streams; i++) { s->xma[i].skip_packets = FFMAX(0, s->xma[i].skip_packets - 1); + nb_samples = FFMIN(nb_samples, av_audio_fifo_size(s->samples[0][i])); } + if (!eof && avpkt->size) + nb_samples -= FFMIN(nb_samples, 4096); + /* copy samples from buffer to output if possible */ - for (i = 0; i < s->num_streams; i++) { - offset = FFMIN(offset, s->offset[i]); - } - if (offset > 0) { + if ((nb_samples > 0 || eof || !avpkt->size) && !s->flushed) { int bret; - frame->nb_samples = 512 * offset; + if (eof) { + nb_samples -= av_clip(s->trim_end + s->trim_start - 128 - 64, 0, nb_samples); + s->flushed = 1; + } + + frame->nb_samples = nb_samples; if ((bret = ff_get_buffer(avctx, frame, 0)) < 0) return bret; - /* copy samples buffer (Nch) to frame samples (Nch), move unconsumed samples */ for (i = 0; i < s->num_streams; i++) { - int start_ch = s->start_channel[i]; - memcpy(frame->extended_data[start_ch + 0], s->samples[start_ch + 0], frame->nb_samples * 4); - if (s->xma[i].nb_channels > 1) - memcpy(frame->extended_data[start_ch + 1], s->samples[start_ch + 1], frame->nb_samples * 4); + const int start_ch = s->start_channel[i]; + void *left[1] = { frame->extended_data[start_ch + 0] }; + void *right[1] = { frame->extended_data[start_ch + 1] }; - s->offset[i] -= offset; - if (s->offset[i]) { - memmove(s->samples[start_ch + 0], s->samples[start_ch + 0] + frame->nb_samples, s->offset[i] * 4 * 512); - if (s->xma[i].nb_channels > 1) - memmove(s->samples[start_ch + 1], s->samples[start_ch + 1] + frame->nb_samples, s->offset[i] * 4 * 512); - } + av_audio_fifo_read(s->samples[0][i], left, nb_samples); + if (s->xma[i].nb_channels > 1) + av_audio_fifo_read(s->samples[1][i], right, nb_samples); } - *got_frame_ptr = 1; + *got_frame_ptr = nb_samples > 0; } } @@ -1909,7 +1956,8 @@ static av_cold int xma_decode_init(AVCodecContext *avctx) /* get stream config */ if (avctx->codec_id == AV_CODEC_ID_XMA2 && avctx->extradata_size == 34) { /* XMA2WAVEFORMATEX */ - s->num_streams = (avctx->channels + 1) / 2; + s->num_streams = AV_RL16(avctx->extradata); + avctx->channel_layout = AV_RL32(avctx->extradata + 2); } else if (avctx->codec_id == AV_CODEC_ID_XMA2 && avctx->extradata_size >= 2) { /* XMA2WAVEFORMAT */ s->num_streams = avctx->extradata[1]; if (avctx->extradata_size != (32 + ((avctx->extradata[0]==3)?0:8) + 4*s->num_streams)) { @@ -1953,6 +2001,13 @@ static av_cold int xma_decode_init(AVCodecContext *avctx) if (start_channels != avctx->channels) return AVERROR_INVALIDDATA; + for (int i = 0; i < XMA_MAX_STREAMS; i++) { + s->samples[0][i] = av_audio_fifo_alloc(avctx->sample_fmt, 1, 64 * 512); + s->samples[1][i] = av_audio_fifo_alloc(avctx->sample_fmt, 1, 64 * 512); + if (!s->samples[0][i] || !s->samples[1][i]) + return AVERROR(ENOMEM); + } + return ret; } @@ -1967,6 +2022,11 @@ static av_cold int xma_decode_end(AVCodecContext *avctx) } s->num_streams = 0; + for (i = 0; i < XMA_MAX_STREAMS; i++) { + av_audio_fifo_free(s->samples[0][i]); + av_audio_fifo_free(s->samples[1][i]); + } + return 0; } @@ -1981,9 +2041,9 @@ static void flush(WMAProDecodeCtx *s) s->packet_loss = 1; s->skip_packets = 0; s->eof_done = 0; + s->skip_frame = 1; } - /** *@brief Clear decoder buffers (for seeking). *@param avctx codec context @@ -2000,14 +2060,18 @@ static void xma_flush(AVCodecContext *avctx) XMADecodeCtx *s = avctx->priv_data; int i; + for (i = 0; i < XMA_MAX_STREAMS; i++) { + av_audio_fifo_reset(s->samples[0][i]); + av_audio_fifo_reset(s->samples[1][i]); + } + for (i = 0; i < s->num_streams; i++) flush(&s->xma[i]); - memset(s->offset, 0, sizeof(s->offset)); s->current_stream = 0; + s->flushed = 0; } - /** *@brief wmapro decoder */ diff --git a/chromium/third_party/ffmpeg/libavcodec/x86/cabac.h b/chromium/third_party/ffmpeg/libavcodec/x86/cabac.h index 53d74c541e2..b046a56a6b7 100644 --- a/chromium/third_party/ffmpeg/libavcodec/x86/cabac.h +++ b/chromium/third_party/ffmpeg/libavcodec/x86/cabac.h @@ -177,8 +177,13 @@ #if HAVE_7REGS && !BROKEN_COMPILER #define get_cabac_inline get_cabac_inline_x86 -static av_always_inline int get_cabac_inline_x86(CABACContext *c, - uint8_t *const state) +static +#if defined(_WIN32) && !defined(_WIN64) && defined(__clang__) +av_noinline +#else +av_always_inline +#endif +int get_cabac_inline_x86(CABACContext *c, uint8_t *const state) { int bit, tmp; #ifdef BROKEN_RELOCATIONS diff --git a/chromium/third_party/ffmpeg/libavcodec/x86/h264dsp_init.c b/chromium/third_party/ffmpeg/libavcodec/x86/h264dsp_init.c index 08eb7ead44d..c9a96c7dca4 100644 --- a/chromium/third_party/ffmpeg/libavcodec/x86/h264dsp_init.c +++ b/chromium/third_party/ffmpeg/libavcodec/x86/h264dsp_init.c @@ -52,7 +52,7 @@ IDCT_ADD_FUNC(8, 10, avx) #define IDCT_ADD_REP_FUNC(NUM, REP, DEPTH, OPT) \ void ff_h264_idct ## NUM ## _add ## REP ## _ ## DEPTH ## _ ## OPT \ (uint8_t *dst, const int *block_offset, \ - int16_t *block, int stride, const uint8_t nnzc[6 * 8]); + int16_t *block, int stride, const uint8_t nnzc[5 * 8]); IDCT_ADD_REP_FUNC(8, 4, 8, mmx) IDCT_ADD_REP_FUNC(8, 4, 8, mmxext) @@ -74,7 +74,7 @@ IDCT_ADD_REP_FUNC(, 16intra, 10, avx) #define IDCT_ADD_REP_FUNC2(NUM, REP, DEPTH, OPT) \ void ff_h264_idct ## NUM ## _add ## REP ## _ ## DEPTH ## _ ## OPT \ (uint8_t **dst, const int *block_offset, \ - int16_t *block, int stride, const uint8_t nnzc[6 * 8]); + int16_t *block, int stride, const uint8_t nnzc[15 * 8]); IDCT_ADD_REP_FUNC2(, 8, 8, mmx) IDCT_ADD_REP_FUNC2(, 8, 8, mmxext) diff --git a/chromium/third_party/ffmpeg/libavcodec/xpmdec.c b/chromium/third_party/ffmpeg/libavcodec/xpmdec.c index e609a70c6ae..a11926ba289 100644 --- a/chromium/third_party/ffmpeg/libavcodec/xpmdec.c +++ b/chromium/third_party/ffmpeg/libavcodec/xpmdec.c @@ -341,9 +341,6 @@ static int xpm_decode_frame(AVCodecContext *avctx, void *data, if ((ret = ff_set_dimensions(avctx, width, height)) < 0) return ret; - if ((ret = ff_get_buffer(avctx, p, 0)) < 0) - return ret; - if (cpp <= 0 || cpp >= 5) { av_log(avctx, AV_LOG_ERROR, "unsupported/invalid number of chars per pixel: %d\n", cpp); return AVERROR_INVALIDDATA; @@ -360,14 +357,17 @@ static int xpm_decode_frame(AVCodecContext *avctx, void *data, size *= 4; - av_fast_padded_malloc(&x->pixels, &x->pixels_size, size); - if (!x->pixels) - return AVERROR(ENOMEM); - ptr += mod_strcspn(ptr, ",") + 1; if (end - ptr < 1) return AVERROR_INVALIDDATA; + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) + return ret; + + av_fast_padded_malloc(&x->pixels, &x->pixels_size, size); + if (!x->pixels) + return AVERROR(ENOMEM); + for (i = 0; i < ncolors; i++) { const uint8_t *index; int len; diff --git a/chromium/third_party/ffmpeg/libavdevice/decklink_common.cpp b/chromium/third_party/ffmpeg/libavdevice/decklink_common.cpp index 24aa9b1d135..acd1f77e6c9 100644 --- a/chromium/third_party/ffmpeg/libavdevice/decklink_common.cpp +++ b/chromium/third_party/ffmpeg/libavdevice/decklink_common.cpp @@ -182,7 +182,11 @@ int ff_decklink_set_configs(AVFormatContext *avctx, if (duplex_supported) { #if BLACKMAGIC_DECKLINK_API_VERSION >= 0x0b000000 IDeckLinkProfile *profile = NULL; - BMDProfileID bmd_profile_id = ctx->duplex_mode == 2 ? bmdProfileOneSubDeviceFullDuplex : bmdProfileTwoSubDevicesHalfDuplex; + BMDProfileID bmd_profile_id; + + if (ctx->duplex_mode < 0 || ctx->duplex_mode >= FF_ARRAY_ELEMS(decklink_profile_id_map)) + return EINVAL; + bmd_profile_id = decklink_profile_id_map[ctx->duplex_mode]; res = manager->GetProfile(bmd_profile_id, &profile); if (res == S_OK) { res = profile->SetActive(); @@ -195,7 +199,7 @@ int ff_decklink_set_configs(AVFormatContext *avctx, if (res != S_OK) av_log(avctx, AV_LOG_WARNING, "Setting duplex mode failed.\n"); else - av_log(avctx, AV_LOG_VERBOSE, "Successfully set duplex mode to %s duplex.\n", ctx->duplex_mode == 2 ? "full" : "half"); + av_log(avctx, AV_LOG_VERBOSE, "Successfully set duplex mode to %s duplex.\n", ctx->duplex_mode == 2 || ctx->duplex_mode == 4 ? "full" : "half"); } else { av_log(avctx, AV_LOG_WARNING, "Unable to set duplex mode, because it is not supported.\n"); } @@ -214,6 +218,39 @@ int ff_decklink_set_configs(AVFormatContext *avctx, if (res != S_OK) av_log(avctx, AV_LOG_WARNING, "Setting timing offset failed.\n"); } + + if (direction == DIRECTION_OUT && ctx->link > 0) { + res = ctx->cfg->SetInt(bmdDeckLinkConfigSDIOutputLinkConfiguration, ctx->link); + if (res != S_OK) + av_log(avctx, AV_LOG_WARNING, "Setting link configuration failed.\n"); + else + av_log(avctx, AV_LOG_VERBOSE, "Successfully set link configuration: 0x%x.\n", ctx->link); + if (ctx->link == bmdLinkConfigurationQuadLink && cctx->sqd >= 0) { + res = ctx->cfg->SetFlag(bmdDeckLinkConfigQuadLinkSDIVideoOutputSquareDivisionSplit, cctx->sqd); + if (res != S_OK) + av_log(avctx, AV_LOG_WARNING, "Setting SquareDivisionSplit failed.\n"); + else + av_log(avctx, AV_LOG_VERBOSE, "Successfully set SquareDivisionSplit.\n"); + } + } + + if (direction == DIRECTION_OUT && cctx->level_a >= 0) { + DECKLINK_BOOL level_a_supported = false; + + if (ctx->attr->GetFlag(BMDDeckLinkSupportsSMPTELevelAOutput, &level_a_supported) != S_OK) + level_a_supported = false; + + if (level_a_supported) { + res = ctx->cfg->SetFlag(bmdDeckLinkConfigSMPTELevelAOutput, cctx->level_a); + if (res != S_OK) + av_log(avctx, AV_LOG_WARNING, "Setting SMPTE levelA failed.\n"); + else + av_log(avctx, AV_LOG_VERBOSE, "Successfully set SMPTE levelA.\n"); + } else { + av_log(avctx, AV_LOG_WARNING, "Unable to set SMPTE levelA mode, because it is not supported.\n"); + } + } + return 0; } diff --git a/chromium/third_party/ffmpeg/libavdevice/decklink_common.h b/chromium/third_party/ffmpeg/libavdevice/decklink_common.h index 6e032956a8e..5b11dcd46db 100644 --- a/chromium/third_party/ffmpeg/libavdevice/decklink_common.h +++ b/chromium/third_party/ffmpeg/libavdevice/decklink_common.h @@ -131,6 +131,7 @@ struct decklink_ctx { int64_t teletext_lines; double preroll; int duplex_mode; + BMDLinkConfiguration link; DecklinkPtsSource audio_pts_source; DecklinkPtsSource video_pts_source; int draw_bars; @@ -200,6 +201,24 @@ static const BMDTimecodeFormat decklink_timecode_format_map[] = { #endif }; +static const BMDLinkConfiguration decklink_link_conf_map[] = { + (BMDLinkConfiguration)0, + bmdLinkConfigurationSingleLink, + bmdLinkConfigurationDualLink, + bmdLinkConfigurationQuadLink +}; + +#if BLACKMAGIC_DECKLINK_API_VERSION >= 0x0b000000 +static const BMDProfileID decklink_profile_id_map[] = { + (BMDProfileID)0, + bmdProfileTwoSubDevicesHalfDuplex, + bmdProfileOneSubDeviceFullDuplex, + bmdProfileOneSubDeviceHalfDuplex, + bmdProfileTwoSubDevicesFullDuplex, + bmdProfileFourSubDevicesHalfDuplex, +}; +#endif + int ff_decklink_set_configs(AVFormatContext *avctx, decklink_direction_t direction); int ff_decklink_set_format(AVFormatContext *avctx, int width, int height, int tb_num, int tb_den, enum AVFieldOrder field_order, decklink_direction_t direction = DIRECTION_OUT); int ff_decklink_set_format(AVFormatContext *avctx, decklink_direction_t direction); diff --git a/chromium/third_party/ffmpeg/libavdevice/decklink_common_c.h b/chromium/third_party/ffmpeg/libavdevice/decklink_common_c.h index 68978fa8558..c2577210a62 100644 --- a/chromium/third_party/ffmpeg/libavdevice/decklink_common_c.h +++ b/chromium/third_party/ffmpeg/libavdevice/decklink_common_c.h @@ -48,6 +48,9 @@ struct decklink_cctx { int audio_channels; int audio_depth; int duplex_mode; + int link; + int sqd; + int level_a; DecklinkPtsSource audio_pts_source; DecklinkPtsSource video_pts_source; int audio_input; diff --git a/chromium/third_party/ffmpeg/libavdevice/decklink_dec_c.c b/chromium/third_party/ffmpeg/libavdevice/decklink_dec_c.c index 1d93e8bab5b..2159702c96b 100644 --- a/chromium/third_party/ffmpeg/libavdevice/decklink_dec_c.c +++ b/chromium/third_party/ffmpeg/libavdevice/decklink_dec_c.c @@ -45,10 +45,20 @@ static const AVOption options[] = { { "standard", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0x7fff9fffeLL}, 0, 0, DEC, "teletext_lines"}, { "all", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0x7ffffffffLL}, 0, 0, DEC, "teletext_lines"}, { "channels", "number of audio channels", OFFSET(audio_channels), AV_OPT_TYPE_INT , { .i64 = 2 }, 2, 16, DEC }, +#if BLACKMAGIC_DECKLINK_API_VERSION >= 0x0b000000 + { "duplex_mode", "duplex mode", OFFSET(duplex_mode), AV_OPT_TYPE_INT, { .i64 = 0}, 0, 5, DEC, "duplex_mode"}, +#else { "duplex_mode", "duplex mode", OFFSET(duplex_mode), AV_OPT_TYPE_INT, { .i64 = 0}, 0, 2, DEC, "duplex_mode"}, +#endif { "unset", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0}, 0, 0, DEC, "duplex_mode"}, { "half", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1}, 0, 0, DEC, "duplex_mode"}, { "full", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 2}, 0, 0, DEC, "duplex_mode"}, +#if BLACKMAGIC_DECKLINK_API_VERSION >= 0x0b000000 + { "one_sub_device_full", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 2}, 0, 0, DEC, "duplex_mode"}, + { "one_sub_device_half", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 3}, 0, 0, DEC, "duplex_mode"}, + { "two_sub_device_full", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 4}, 0, 0, DEC, "duplex_mode"}, + { "four_sub_device_half", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 5}, 0, 0, DEC, "duplex_mode"}, +#endif { "timecode_format", "timecode format", OFFSET(tc_format), AV_OPT_TYPE_INT, { .i64 = 0}, 0, 8, DEC, "tc_format"}, { "none", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0}, 0, 0, DEC, "tc_format"}, { "rp188vitc", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1}, 0, 0, DEC, "tc_format"}, diff --git a/chromium/third_party/ffmpeg/libavdevice/decklink_enc.cpp b/chromium/third_party/ffmpeg/libavdevice/decklink_enc.cpp index 4c1eb05be4b..6dec5f35ea3 100644 --- a/chromium/third_party/ffmpeg/libavdevice/decklink_enc.cpp +++ b/chromium/third_party/ffmpeg/libavdevice/decklink_enc.cpp @@ -559,6 +559,8 @@ av_cold int ff_decklink_write_header(AVFormatContext *avctx) ctx->list_formats = cctx->list_formats; ctx->preroll = cctx->preroll; ctx->duplex_mode = cctx->duplex_mode; + if (cctx->link > 0 && (unsigned int)cctx->link < FF_ARRAY_ELEMS(decklink_link_conf_map)) + ctx->link = decklink_link_conf_map[cctx->link]; cctx->ctx = ctx; #if CONFIG_LIBKLVANC if (klvanc_context_create(&ctx->vanc_ctx) < 0) { diff --git a/chromium/third_party/ffmpeg/libavdevice/decklink_enc_c.c b/chromium/third_party/ffmpeg/libavdevice/decklink_enc_c.c index 828cf5db656..990fbb81684 100644 --- a/chromium/third_party/ffmpeg/libavdevice/decklink_enc_c.c +++ b/chromium/third_party/ffmpeg/libavdevice/decklink_enc_c.c @@ -31,10 +31,33 @@ static const AVOption options[] = { { "list_devices", "use ffmpeg -sinks decklink instead", OFFSET(list_devices), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, ENC | AV_OPT_FLAG_DEPRECATED}, { "list_formats", "list supported formats" , OFFSET(list_formats), AV_OPT_TYPE_INT , { .i64 = 0 }, 0, 1, ENC }, { "preroll" , "video preroll in seconds", OFFSET(preroll ), AV_OPT_TYPE_DOUBLE, { .dbl = 0.5 }, 0, 5, ENC }, +#if BLACKMAGIC_DECKLINK_API_VERSION >= 0x0b000000 + { "duplex_mode" , "duplex mode" , OFFSET(duplex_mode ), AV_OPT_TYPE_INT , { .i64 = 0 }, 0, 5, ENC, "duplex_mode"}, +#else { "duplex_mode" , "duplex mode" , OFFSET(duplex_mode ), AV_OPT_TYPE_INT , { .i64 = 0 }, 0, 2, ENC, "duplex_mode"}, +#endif { "unset" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = 0 }, 0, 0, ENC, "duplex_mode"}, { "half" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = 1 }, 0, 0, ENC, "duplex_mode"}, { "full" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = 2 }, 0, 0, ENC, "duplex_mode"}, +#if BLACKMAGIC_DECKLINK_API_VERSION >= 0x0b000000 + { "one_sub_device_full", NULL ,0 , AV_OPT_TYPE_CONST , { .i64 = 2 }, 0, 0, ENC, "duplex_mode"}, + { "one_sub_device_half", NULL ,0 , AV_OPT_TYPE_CONST , { .i64 = 3 }, 0, 0, ENC, "duplex_mode"}, + { "two_sub_device_full", NULL ,0 , AV_OPT_TYPE_CONST , { .i64 = 4 }, 0, 0, ENC, "duplex_mode"}, + { "four_sub_device_half", NULL ,0 , AV_OPT_TYPE_CONST , { .i64 = 5 }, 0, 0, ENC, "duplex_mode"}, +#endif + { "link" , "single/dual/quad SDI link configuration", OFFSET(link), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 3, ENC, "link"}, + { "unset" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = 0 }, 0, 0, ENC, "link"}, + { "single" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = 1 }, 0, 0, ENC, "link"}, + { "dual" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = 2 }, 0, 0, ENC, "link"}, + { "quad" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = 3 }, 0, 0, ENC, "link"}, + { "sqd" , "set Square Division" , OFFSET(sqd) , AV_OPT_TYPE_INT, { .i64 = -1 }, -1,1, ENC, "sqd"}, + { "unset" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = -1 }, 0, 0, ENC, "sqd"}, + { "false" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = 0 }, 0, 0, ENC, "sqd"}, + { "true" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = 1 }, 0, 0, ENC, "sqd"}, + { "level_a" , "set SMPTE LevelA" , OFFSET(level_a) , AV_OPT_TYPE_INT, { .i64 = -1 }, -1,1, ENC, "level_a"}, + { "unset" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = -1 }, 0, 0, ENC, "level_a"}, + { "false" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = 0 }, 0, 0, ENC, "level_a"}, + { "true" , NULL , 0 , AV_OPT_TYPE_CONST , { .i64 = 1 }, 0, 0, ENC, "level_a"}, { "timing_offset", "genlock timing pixel offset", OFFSET(timing_offset), AV_OPT_TYPE_INT, { .i64 = INT_MIN }, INT_MIN, INT_MAX, ENC, "timing_offset"}, { "unset" , NULL , 0 , AV_OPT_TYPE_CONST, { .i64 = INT_MIN }, 0, 0, ENC, "timing_offset"}, { NULL }, diff --git a/chromium/third_party/ffmpeg/libavdevice/lavfi.c b/chromium/third_party/ffmpeg/libavdevice/lavfi.c index 57d977e7ced..4eb1f56f7db 100644 --- a/chromium/third_party/ffmpeg/libavdevice/lavfi.c +++ b/chromium/third_party/ffmpeg/libavdevice/lavfi.c @@ -100,6 +100,7 @@ static int create_subcc_streams(AVFormatContext *avctx) LavfiContext *lavfi = avctx->priv_data; AVStream *st; int stream_idx, sink_idx; + AVRational *time_base; for (stream_idx = 0; stream_idx < lavfi->nb_sinks; stream_idx++) { sink_idx = lavfi->stream_sink_map[stream_idx]; @@ -109,6 +110,9 @@ static int create_subcc_streams(AVFormatContext *avctx) return AVERROR(ENOMEM); st->codecpar->codec_id = AV_CODEC_ID_EIA_608; st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE; + time_base = &avctx->streams[stream_idx]->time_base; + st->time_base.num = time_base->num; + st->time_base.den = time_base->den; } else { lavfi->sink_stream_subcc_map[sink_idx] = -1; } diff --git a/chromium/third_party/ffmpeg/libavdevice/version.h b/chromium/third_party/ffmpeg/libavdevice/version.h index 6021a0dd654..8daeb0059a6 100644 --- a/chromium/third_party/ffmpeg/libavdevice/version.h +++ b/chromium/third_party/ffmpeg/libavdevice/version.h @@ -29,7 +29,7 @@ #define LIBAVDEVICE_VERSION_MAJOR 59 #define LIBAVDEVICE_VERSION_MINOR 0 -#define LIBAVDEVICE_VERSION_MICRO 100 +#define LIBAVDEVICE_VERSION_MICRO 101 #define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \ LIBAVDEVICE_VERSION_MINOR, \ diff --git a/chromium/third_party/ffmpeg/libavfilter/Makefile b/chromium/third_party/ffmpeg/libavfilter/Makefile index 49c0c8342bb..f059f3fef89 100644 --- a/chromium/third_party/ffmpeg/libavfilter/Makefile +++ b/chromium/third_party/ffmpeg/libavfilter/Makefile @@ -40,6 +40,7 @@ OBJS-$(CONFIG_ACRUSHER_FILTER) += af_acrusher.o OBJS-$(CONFIG_ACUE_FILTER) += f_cue.o OBJS-$(CONFIG_ADECLICK_FILTER) += af_adeclick.o OBJS-$(CONFIG_ADECLIP_FILTER) += af_adeclick.o +OBJS-$(CONFIG_ADECORRELATE_FILTER) += af_adecorrelate.o OBJS-$(CONFIG_ADELAY_FILTER) += af_adelay.o OBJS-$(CONFIG_ADENORM_FILTER) += af_adenorm.o OBJS-$(CONFIG_ADERIVATIVE_FILTER) += af_aderivative.o @@ -73,11 +74,13 @@ OBJS-$(CONFIG_APAD_FILTER) += af_apad.o OBJS-$(CONFIG_APERMS_FILTER) += f_perms.o OBJS-$(CONFIG_APHASER_FILTER) += af_aphaser.o generate_wave_table.o OBJS-$(CONFIG_APHASESHIFT_FILTER) += af_afreqshift.o +OBJS-$(CONFIG_APSYCLIP_FILTER) += af_apsyclip.o OBJS-$(CONFIG_APULSATOR_FILTER) += af_apulsator.o OBJS-$(CONFIG_AREALTIME_FILTER) += f_realtime.o OBJS-$(CONFIG_ARESAMPLE_FILTER) += af_aresample.o OBJS-$(CONFIG_AREVERSE_FILTER) += f_reverse.o OBJS-$(CONFIG_ARNNDN_FILTER) += af_arnndn.o +OBJS-$(CONFIG_ASEGMENT_FILTER) += f_segment.o OBJS-$(CONFIG_ASELECT_FILTER) += f_select.o OBJS-$(CONFIG_ASENDCMD_FILTER) += f_sendcmd.o OBJS-$(CONFIG_ASETNSAMPLES_FILTER) += af_asetnsamples.o @@ -97,6 +100,7 @@ OBJS-$(CONFIG_ASUPERCUT_FILTER) += af_asupercut.o OBJS-$(CONFIG_ASUPERPASS_FILTER) += af_asupercut.o OBJS-$(CONFIG_ASUPERSTOP_FILTER) += af_asupercut.o OBJS-$(CONFIG_ATEMPO_FILTER) += af_atempo.o +OBJS-$(CONFIG_ATILT_FILTER) += af_atilt.o OBJS-$(CONFIG_ATRIM_FILTER) += trim.o OBJS-$(CONFIG_AXCORRELATE_FILTER) += af_axcorrelate.o OBJS-$(CONFIG_AZMQ_FILTER) += f_zmq.o @@ -286,6 +290,7 @@ OBJS-$(CONFIG_GBLUR_FILTER) += vf_gblur.o OBJS-$(CONFIG_GEQ_FILTER) += vf_geq.o OBJS-$(CONFIG_GRADFUN_FILTER) += vf_gradfun.o OBJS-$(CONFIG_GRAPHMONITOR_FILTER) += f_graphmonitor.o +OBJS-$(CONFIG_GRAYWORLD_FILTER) += vf_grayworld.o OBJS-$(CONFIG_GREYEDGE_FILTER) += vf_colorconstancy.o OBJS-$(CONFIG_GUIDED_FILTER) += vf_guided.o OBJS-$(CONFIG_HALDCLUT_FILTER) += vf_lut3d.o framesync.o @@ -295,6 +300,8 @@ OBJS-$(CONFIG_HISTOGRAM_FILTER) += vf_histogram.o OBJS-$(CONFIG_HQDN3D_FILTER) += vf_hqdn3d.o OBJS-$(CONFIG_HQX_FILTER) += vf_hqx.o OBJS-$(CONFIG_HSTACK_FILTER) += vf_stack.o framesync.o +OBJS-$(CONFIG_HSVHOLD_FILTER) += vf_hsvkey.o +OBJS-$(CONFIG_HSVKEY_FILTER) += vf_hsvkey.o OBJS-$(CONFIG_HUE_FILTER) += vf_hue.o OBJS-$(CONFIG_HWDOWNLOAD_FILTER) += vf_hwdownload.o OBJS-$(CONFIG_HWMAP_FILTER) += vf_hwmap.o @@ -403,7 +410,9 @@ OBJS-$(CONFIG_SCALE_VAAPI_FILTER) += vf_scale_vaapi.o scale_eval.o va OBJS-$(CONFIG_SCALE_VULKAN_FILTER) += vf_scale_vulkan.o vulkan.o OBJS-$(CONFIG_SCALE2REF_FILTER) += vf_scale.o scale_eval.o OBJS-$(CONFIG_SCDET_FILTER) += vf_scdet.o +OBJS-$(CONFIG_SCHARR_FILTER) += vf_convolution.o OBJS-$(CONFIG_SCROLL_FILTER) += vf_scroll.o +OBJS-$(CONFIG_SEGMENT_FILTER) += f_segment.o OBJS-$(CONFIG_SELECT_FILTER) += f_select.o OBJS-$(CONFIG_SELECTIVECOLOR_FILTER) += vf_selectivecolor.o OBJS-$(CONFIG_SENDCMD_FILTER) += f_sendcmd.o diff --git a/chromium/third_party/ffmpeg/libavfilter/aeval.c b/chromium/third_party/ffmpeg/libavfilter/aeval.c index 007758bf57e..6c9aad46540 100644 --- a/chromium/third_party/ffmpeg/libavfilter/aeval.c +++ b/chromium/third_party/ffmpeg/libavfilter/aeval.c @@ -30,6 +30,7 @@ #include "libavutil/parseutils.h" #include "avfilter.h" #include "audio.h" +#include "filters.h" #include "internal.h" static const char * const var_names[] = { @@ -246,45 +247,42 @@ static int query_formats(AVFilterContext *ctx) static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; int64_t chlayouts[] = { eval->chlayout ? eval->chlayout : FF_COUNT2LAYOUT(eval->nb_channels) , -1 }; int sample_rates[] = { eval->sample_rate, -1 }; - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; int ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats (ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_make_format64_list(chlayouts); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_channel_layouts_from_list(ctx, chlayouts); if (ret < 0) return ret; - formats = ff_make_format_list(sample_rates); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_samplerates_from_list(ctx, sample_rates); } -static int request_frame(AVFilterLink *outlink) +static int activate(AVFilterContext *ctx) { + AVFilterLink *outlink = ctx->outputs[0]; EvalContext *eval = outlink->src->priv; AVFrame *samplesref; int i, j; int64_t t = av_rescale(eval->n, AV_TIME_BASE, eval->sample_rate); int nb_samples; - if (eval->duration >= 0 && t >= eval->duration) - return AVERROR_EOF; + if (!ff_outlink_frame_wanted(outlink)) + return FFERROR_NOT_READY; + + if (eval->duration >= 0 && t >= eval->duration) { + ff_outlink_set_status(outlink, AVERROR_EOF, eval->pts); + return 0; + } if (eval->duration >= 0) { nb_samples = FFMIN(eval->nb_samples, av_rescale(eval->duration, eval->sample_rate, AV_TIME_BASE) - eval->pts); - if (!nb_samples) - return AVERROR_EOF; + if (!nb_samples) { + ff_outlink_set_status(outlink, AVERROR_EOF, eval->pts); + return 0; + } } else { nb_samples = eval->nb_samples; } @@ -316,9 +314,7 @@ static const AVFilterPad aevalsrc_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, .config_props = config_props, - .request_frame = request_frame, }, - { NULL } }; const AVFilter ff_asrc_aevalsrc = { @@ -327,9 +323,10 @@ const AVFilter ff_asrc_aevalsrc = { .query_formats = query_formats, .init = init, .uninit = uninit, + .activate = activate, .priv_size = sizeof(EvalContext), .inputs = NULL, - .outputs = aevalsrc_outputs, + FILTER_OUTPUTS(aevalsrc_outputs), .priv_class = &aevalsrc_class, }; @@ -349,7 +346,6 @@ AVFILTER_DEFINE_CLASS(aeval); static int aeval_query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; AVFilterChannelLayouts *layouts; AVFilterLink *inlink = ctx->inputs[0]; AVFilterLink *outlink = ctx->outputs[0]; @@ -365,8 +361,7 @@ static int aeval_query_formats(AVFilterContext *ctx) return ret; if (eval->same_chlayout) { - layouts = ff_all_channel_counts(); - if ((ret = ff_set_common_channel_layouts(ctx, layouts)) < 0) + if ((ret = ff_set_common_all_channel_counts(ctx)) < 0) return ret; } else { // outlink supports only requested output channel layout @@ -379,12 +374,10 @@ static int aeval_query_formats(AVFilterContext *ctx) return ret; } - formats = ff_make_format_list(sample_fmts); - if ((ret = ff_set_common_formats(ctx, formats)) < 0) + if ((ret = ff_set_common_formats_from_list(ctx, sample_fmts)) < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static int aeval_config_output(AVFilterLink *outlink) @@ -460,7 +453,6 @@ static const AVFilterPad aeval_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad aeval_outputs[] = { @@ -469,7 +461,6 @@ static const AVFilterPad aeval_outputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = aeval_config_output, }, - { NULL } }; const AVFilter ff_af_aeval = { @@ -479,8 +470,8 @@ const AVFilter ff_af_aeval = { .init = init, .uninit = uninit, .priv_size = sizeof(EvalContext), - .inputs = aeval_inputs, - .outputs = aeval_outputs, + FILTER_INPUTS(aeval_inputs), + FILTER_OUTPUTS(aeval_outputs), .priv_class = &aeval_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_acontrast.c b/chromium/third_party/ffmpeg/libavfilter/af_acontrast.c index 69fe6b7e222..b5a5381fbab 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_acontrast.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_acontrast.c @@ -44,8 +44,6 @@ AVFILTER_DEFINE_CLASS(acontrast); static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP, @@ -53,23 +51,15 @@ static int query_formats(AVFilterContext *ctx) }; int ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static void filter_flt(void **d, const void **s, @@ -197,7 +187,6 @@ static const AVFilterPad inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -205,7 +194,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_acontrast = { @@ -214,6 +202,6 @@ const AVFilter ff_af_acontrast = { .query_formats = query_formats, .priv_size = sizeof(AudioContrastContext), .priv_class = &acontrast_class, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_acopy.c b/chromium/third_party/ffmpeg/libavfilter/af_acopy.c index 29551996d90..32455d9186f 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_acopy.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_acopy.c @@ -51,7 +51,6 @@ static const AVFilterPad acopy_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad acopy_outputs[] = { @@ -59,12 +58,11 @@ static const AVFilterPad acopy_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_acopy = { .name = "acopy", .description = NULL_IF_CONFIG_SMALL("Copy the input audio unchanged to the output."), - .inputs = acopy_inputs, - .outputs = acopy_outputs, + FILTER_INPUTS(acopy_inputs), + FILTER_OUTPUTS(acopy_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_acrossover.c b/chromium/third_party/ffmpeg/libavfilter/af_acrossover.c index 3ba67b30e17..b3399191420 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_acrossover.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_acrossover.c @@ -191,10 +191,8 @@ static av_cold int init(AVFilterContext *ctx) return AVERROR(ENOMEM); pad.name = name; - if ((ret = ff_insert_outpad(ctx, i, &pad)) < 0) { - av_freep(&pad.name); + if ((ret = ff_append_outpad_free_name(ctx, &pad)) < 0) return ret; - } } return ret; @@ -305,32 +303,21 @@ static void calc_q_factors(int order, double *q) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; int ret; - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } #define BIQUAD_PROCESS(name, type) \ @@ -496,6 +483,7 @@ static int config_input(AVFilterLink *inlink) switch (inlink->format) { case AV_SAMPLE_FMT_FLTP: s->filter_channels = filter_channels_fltp; break; case AV_SAMPLE_FMT_DBLP: s->filter_channels = filter_channels_dblp; break; + default: return AVERROR_BUG; } s->xover = ff_get_audio_buffer(inlink, 2 * (ctx->nb_outputs * 10 + ctx->nb_outputs * 10 + @@ -528,8 +516,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) goto fail; s->input_frame = in; - ctx->internal->execute(ctx, s->filter_channels, NULL, NULL, FFMIN(inlink->channels, - ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->filter_channels, NULL, NULL, + FFMIN(inlink->channels, ff_filter_get_nb_threads(ctx))); for (i = 0; i < ctx->nb_outputs; i++) { ret = ff_filter_frame(ctx->outputs[i], frames[i]); @@ -550,13 +538,9 @@ fail: static av_cold void uninit(AVFilterContext *ctx) { AudioCrossoverContext *s = ctx->priv; - int i; av_freep(&s->fdsp); av_frame_free(&s->xover); - - for (i = 0; i < ctx->nb_outputs; i++) - av_freep(&ctx->output_pads[i].name); } static const AVFilterPad inputs[] = { @@ -566,7 +550,6 @@ static const AVFilterPad inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; const AVFilter ff_af_acrossover = { @@ -577,7 +560,7 @@ const AVFilter ff_af_acrossover = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = inputs, + FILTER_INPUTS(inputs), .outputs = NULL, .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS | AVFILTER_FLAG_SLICE_THREADS, diff --git a/chromium/third_party/ffmpeg/libavfilter/af_acrusher.c b/chromium/third_party/ffmpeg/libavfilter/af_acrusher.c index ce337013ab4..6130c9f2ece 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_acrusher.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_acrusher.c @@ -265,32 +265,21 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_NONE }; int ret; - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static av_cold void uninit(AVFilterContext *ctx) @@ -353,7 +342,6 @@ static const AVFilterPad avfilter_af_acrusher_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad avfilter_af_acrusher_outputs[] = { @@ -361,7 +349,6 @@ static const AVFilterPad avfilter_af_acrusher_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_acrusher = { @@ -371,7 +358,7 @@ const AVFilter ff_af_acrusher = { .priv_class = &acrusher_class, .uninit = uninit, .query_formats = query_formats, - .inputs = avfilter_af_acrusher_inputs, - .outputs = avfilter_af_acrusher_outputs, + FILTER_INPUTS(avfilter_af_acrusher_inputs), + FILTER_OUTPUTS(avfilter_af_acrusher_outputs), .process_command = process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_adeclick.c b/chromium/third_party/ffmpeg/libavfilter/af_adeclick.c index 798838f522c..1e30ada03ca 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_adeclick.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_adeclick.c @@ -115,31 +115,21 @@ AVFILTER_DEFINE_CLASS(adeclick); static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; int ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static int config_input(AVFilterLink *inlink) @@ -586,7 +576,7 @@ static int filter_frame(AVFilterLink *inlink) goto fail; td.out = out; - ret = ctx->internal->execute(ctx, filter_channel, &td, NULL, inlink->channels); + ret = ff_filter_execute(ctx, filter_channel, &td, NULL, inlink->channels); if (ret < 0) goto fail; @@ -751,7 +741,6 @@ static const AVFilterPad inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -759,7 +748,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_adeclick = { @@ -771,8 +759,8 @@ const AVFilter ff_af_adeclick = { .init = init, .activate = activate, .uninit = uninit, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .flags = AVFILTER_FLAG_SLICE_THREADS | AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, }; @@ -807,7 +795,7 @@ const AVFilter ff_af_adeclip = { .init = init, .activate = activate, .uninit = uninit, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .flags = AVFILTER_FLAG_SLICE_THREADS | AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_adecorrelate.c b/chromium/third_party/ffmpeg/libavfilter/af_adecorrelate.c new file mode 100644 index 00000000000..6113574125d --- /dev/null +++ b/chromium/third_party/ffmpeg/libavfilter/af_adecorrelate.c @@ -0,0 +1,268 @@ +/* + * Copyright (c) 2013-2020 Michael Barbour <barbour.michael.0@gmail.com> + * Copyright (c) 2021 Paul B Mahol + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/channel_layout.h" +#include "libavutil/ffmath.h" +#include "libavutil/lfg.h" +#include "libavutil/random_seed.h" +#include "libavutil/opt.h" +#include "avfilter.h" +#include "audio.h" +#include "formats.h" + +#define MAX_STAGES 16 +#define FILTER_FC 1100.0 +#define RT60_LF 0.1 +#define RT60_HF 0.008 + +typedef struct APContext { + int len, p; + double *mx, *my; + double b0, b1, a0, a1; +} APContext; + +typedef struct ADecorrelateContext { + const AVClass *class; + + int stages; + int64_t seed; + + int nb_channels; + APContext (*ap)[MAX_STAGES]; + + AVLFG c; + + void (*filter_channel)(AVFilterContext *ctx, + int channel, + AVFrame *in, AVFrame *out); +} ADecorrelateContext; + +static int query_formats(AVFilterContext *ctx) +{ + static const enum AVSampleFormat sample_fmts[] = { + AV_SAMPLE_FMT_DBLP, + AV_SAMPLE_FMT_NONE + }; + int ret = ff_set_common_formats_from_list(ctx, sample_fmts); + if (ret < 0) + return ret; + + ret = ff_set_common_all_channel_counts(ctx); + if (ret < 0) + return ret; + + return ff_set_common_all_samplerates(ctx); +} + +static int ap_init(APContext *ap, int fs, double delay) +{ + const int delay_samples = lrint(round(delay * fs)); + const double gain_lf = -60.0 / (RT60_LF * fs) * delay_samples; + const double gain_hf = -60.0 / (RT60_HF * fs) * delay_samples; + const double w0 = 2.0 * M_PI * FILTER_FC / fs; + const double t = tan(w0 / 2.0); + const double g_hf = ff_exp10(gain_hf / 20.0); + const double gd = ff_exp10((gain_lf-gain_hf) / 20.0); + const double sgd = sqrt(gd); + + ap->len = delay_samples + 1; + ap->p = 0; + ap->mx = av_calloc(ap->len, sizeof(*ap->mx)); + ap->my = av_calloc(ap->len, sizeof(*ap->my)); + if (!ap->mx || !ap->my) + return AVERROR(ENOMEM); + + ap->a0 = t + sgd; + ap->a1 = (t - sgd) / ap->a0; + ap->b0 = (gd*t - sgd) / ap->a0 * g_hf; + ap->b1 = (gd*t + sgd) / ap->a0 * g_hf; + ap->a0 = 1.0; + + return 0; +} + +static void ap_free(APContext *ap) +{ + av_freep(&ap->mx); + av_freep(&ap->my); +} + +static double ap_run(APContext *ap, double x) +{ + const int i0 = ((ap->p < 1) ? ap->len : ap->p)-1, i_n1 = ap->p, i_n2 = (ap->p+1 >= ap->len) ? 0 : ap->p+1; + const double r = ap->b1*x + ap->b0*ap->mx[i0] + ap->a1*ap->mx[i_n2] + ap->a0*ap->mx[i_n1] - + ap->a1*ap->my[i0] - ap->b0*ap->my[i_n2] - ap->b1*ap->my[i_n1]; + + ap->mx[ap->p] = x; + ap->my[ap->p] = r; + ap->p = (ap->p+1 >= ap->len) ? 0 : ap->p+1; + + return r; +} + +static void filter_channel_dbl(AVFilterContext *ctx, int ch, + AVFrame *in, AVFrame *out) +{ + ADecorrelateContext *s = ctx->priv; + const double *src = (const double *)in->extended_data[ch]; + double *dst = (double *)out->extended_data[ch]; + const int nb_samples = in->nb_samples; + const int stages = s->stages; + APContext *ap0 = &s->ap[ch][0]; + + for (int n = 0; n < nb_samples; n++) { + dst[n] = ap_run(ap0, src[n]); + for (int i = 1; i < stages; i++) { + APContext *ap = &s->ap[ch][i]; + + dst[n] = ap_run(ap, dst[n]); + } + } +} + +static int config_input(AVFilterLink *inlink) +{ + AVFilterContext *ctx = inlink->dst; + ADecorrelateContext *s = ctx->priv; + int ret; + + if (s->seed == -1) + s->seed = av_get_random_seed(); + av_lfg_init(&s->c, s->seed); + + s->nb_channels = inlink->channels; + s->ap = av_calloc(inlink->channels, sizeof(*s->ap)); + if (!s->ap) + return AVERROR(ENOMEM); + + for (int i = 0; i < inlink->channels; i++) { + for (int j = 0; j < s->stages; j++) { + ret = ap_init(&s->ap[i][j], inlink->sample_rate, + (double)av_lfg_get(&s->c) / 0xffffffff * 2.2917e-3 + 0.83333e-3); + if (ret < 0) + return ret; + } + } + + s->filter_channel = filter_channel_dbl; + + return 0; +} + +typedef struct ThreadData { + AVFrame *in, *out; +} ThreadData; + +static int filter_channels(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) +{ + ADecorrelateContext *s = ctx->priv; + ThreadData *td = arg; + AVFrame *out = td->out; + AVFrame *in = td->in; + const int start = (in->channels * jobnr) / nb_jobs; + const int end = (in->channels * (jobnr+1)) / nb_jobs; + + for (int ch = start; ch < end; ch++) + s->filter_channel(ctx, ch, in, out); + + return 0; +} + +static int filter_frame(AVFilterLink *inlink, AVFrame *in) +{ + AVFilterContext *ctx = inlink->dst; + AVFilterLink *outlink = ctx->outputs[0]; + AVFrame *out; + ThreadData td; + + if (av_frame_is_writable(in)) { + out = in; + } else { + out = ff_get_audio_buffer(outlink, in->nb_samples); + if (!out) { + av_frame_free(&in); + return AVERROR(ENOMEM); + } + av_frame_copy_props(out, in); + } + + td.in = in; td.out = out; + ff_filter_execute(ctx, filter_channels, &td, NULL, + FFMIN(inlink->channels, ff_filter_get_nb_threads(ctx))); + + if (out != in) + av_frame_free(&in); + return ff_filter_frame(outlink, out); +} + +static av_cold void uninit(AVFilterContext *ctx) +{ + ADecorrelateContext *s = ctx->priv; + + if (s->ap) { + for (int ch = 0; ch < s->nb_channels; ch++) { + for (int stage = 0; stage < s->stages; stage++) + ap_free(&s->ap[ch][stage]); + } + } + + av_freep(&s->ap); +} + +#define OFFSET(x) offsetof(ADecorrelateContext, x) +#define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM + +static const AVOption adecorrelate_options[] = { + { "stages", "set filtering stages", OFFSET(stages), AV_OPT_TYPE_INT, {.i64=6}, 1, MAX_STAGES, FLAGS }, + { "seed", "set random seed", OFFSET(seed), AV_OPT_TYPE_INT64, {.i64=-1}, -1, UINT_MAX, FLAGS }, + { NULL } +}; + +AVFILTER_DEFINE_CLASS(adecorrelate); + +static const AVFilterPad inputs[] = { + { + .name = "default", + .type = AVMEDIA_TYPE_AUDIO, + .filter_frame = filter_frame, + .config_props = config_input, + }, +}; + +static const AVFilterPad outputs[] = { + { + .name = "default", + .type = AVMEDIA_TYPE_AUDIO, + }, +}; + +const AVFilter ff_af_adecorrelate = { + .name = "adecorrelate", + .description = NULL_IF_CONFIG_SMALL("Apply decorrelation to input audio."), + .query_formats = query_formats, + .priv_size = sizeof(ADecorrelateContext), + .priv_class = &adecorrelate_class, + .uninit = uninit, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), + .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | + AVFILTER_FLAG_SLICE_THREADS, +}; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_adelay.c b/chromium/third_party/ffmpeg/libavfilter/af_adelay.c index c6450cb2b9b..f9b4acd6004 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_adelay.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_adelay.c @@ -63,33 +63,20 @@ AVFILTER_DEFINE_CLASS(adelay); static int query_formats(AVFilterContext *ctx) { - AVFilterChannelLayouts *layouts; - AVFilterFormats *formats; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_U8P, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S32P, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } #define DELAY(name, type, fill) \ @@ -339,7 +326,6 @@ static const AVFilterPad adelay_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_input, }, - { NULL } }; static const AVFilterPad adelay_outputs[] = { @@ -347,7 +333,6 @@ static const AVFilterPad adelay_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_adelay = { @@ -358,7 +343,7 @@ const AVFilter ff_af_adelay = { .priv_class = &adelay_class, .activate = activate, .uninit = uninit, - .inputs = adelay_inputs, - .outputs = adelay_outputs, + FILTER_INPUTS(adelay_inputs), + FILTER_OUTPUTS(adelay_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_adenorm.c b/chromium/third_party/ffmpeg/libavfilter/af_adenorm.c index ee8d26ee734..c48c02fc701 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_adenorm.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_adenorm.c @@ -45,31 +45,19 @@ typedef struct ADenormContext { static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static void dc_denorm_fltp(AVFilterContext *ctx, void *dstp, @@ -262,8 +250,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) s->level = exp(s->level_db / 20. * M_LN10); td.in = in; td.out = out; - ctx->internal->execute(ctx, filter_channels, &td, NULL, FFMIN(inlink->channels, - ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_channels, &td, NULL, + FFMIN(inlink->channels, ff_filter_get_nb_threads(ctx))); s->in_samples += in->nb_samples; @@ -291,7 +279,6 @@ static const AVFilterPad adenorm_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad adenorm_outputs[] = { @@ -300,7 +287,6 @@ static const AVFilterPad adenorm_outputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_output, }, - { NULL } }; #define OFFSET(x) offsetof(ADenormContext, x) @@ -323,8 +309,8 @@ const AVFilter ff_af_adenorm = { .description = NULL_IF_CONFIG_SMALL("Remedy denormals by adding extremely low-level noise."), .query_formats = query_formats, .priv_size = sizeof(ADenormContext), - .inputs = adenorm_inputs, - .outputs = adenorm_outputs, + FILTER_INPUTS(adenorm_inputs), + FILTER_OUTPUTS(adenorm_outputs), .priv_class = &adenorm_class, .process_command = process_command, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | diff --git a/chromium/third_party/ffmpeg/libavfilter/af_aderivative.c b/chromium/third_party/ffmpeg/libavfilter/af_aderivative.c index 6b3e4dd0e4c..e4b6267a1a7 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_aderivative.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_aderivative.c @@ -29,8 +29,6 @@ typedef struct ADerivativeContext { static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat derivative_sample_fmts[] = { AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_S32P, AV_SAMPLE_FMT_DBLP, @@ -40,26 +38,16 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - formats = ff_make_format_list(strcmp(ctx->filter->name, "aintegral") ? - derivative_sample_fmts : integral_sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, strcmp(ctx->filter->name, "aintegral") ? + derivative_sample_fmts : integral_sample_fmts); if (ret < 0) return ret; - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } #define DERIVATIVE(name, type) \ @@ -175,7 +163,6 @@ static const AVFilterPad aderivative_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad aderivative_outputs[] = { @@ -183,7 +170,6 @@ static const AVFilterPad aderivative_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_aderivative = { @@ -192,8 +178,8 @@ const AVFilter ff_af_aderivative = { .query_formats = query_formats, .priv_size = sizeof(ADerivativeContext), .uninit = uninit, - .inputs = aderivative_inputs, - .outputs = aderivative_outputs, + FILTER_INPUTS(aderivative_inputs), + FILTER_OUTPUTS(aderivative_outputs), }; const AVFilter ff_af_aintegral = { @@ -202,6 +188,6 @@ const AVFilter ff_af_aintegral = { .query_formats = query_formats, .priv_size = sizeof(ADerivativeContext), .uninit = uninit, - .inputs = aderivative_inputs, - .outputs = aderivative_outputs, + FILTER_INPUTS(aderivative_inputs), + FILTER_OUTPUTS(aderivative_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_aecho.c b/chromium/third_party/ffmpeg/libavfilter/af_aecho.c index 4e45ab9a8b6..d533bb610ba 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_aecho.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_aecho.c @@ -154,33 +154,20 @@ static av_cold int init(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterChannelLayouts *layouts; - AVFilterFormats *formats; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S32P, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } #define MOD(a, b) (((a) >= (b)) ? (a) - (b) : (a)) @@ -364,7 +351,6 @@ static const AVFilterPad aecho_inputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; static const AVFilterPad aecho_outputs[] = { @@ -373,7 +359,6 @@ static const AVFilterPad aecho_outputs[] = { .config_props = config_output, .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_aecho = { @@ -385,6 +370,6 @@ const AVFilter ff_af_aecho = { .init = init, .activate = activate, .uninit = uninit, - .inputs = aecho_inputs, - .outputs = aecho_outputs, + FILTER_INPUTS(aecho_inputs), + FILTER_OUTPUTS(aecho_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_aemphasis.c b/chromium/third_party/ffmpeg/libavfilter/af_aemphasis.c index 66fe7036fab..a9c0cf599d0 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_aemphasis.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_aemphasis.c @@ -143,8 +143,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) } td.in = in; td.out = out; - ctx->internal->execute(ctx, filter_channels, &td, NULL, FFMIN(inlink->channels, - ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_channels, &td, NULL, + FFMIN(inlink->channels, ff_filter_get_nb_threads(ctx))); if (in != out) av_frame_free(&in); @@ -153,32 +153,19 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) static int query_formats(AVFilterContext *ctx) { - AVFilterChannelLayouts *layouts; - AVFilterFormats *formats; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static inline void set_highshelf_rbj(BiquadCoeffs *bq, double freq, double q, double peak, double sr) @@ -389,7 +376,6 @@ static const AVFilterPad avfilter_af_aemphasis_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad avfilter_af_aemphasis_outputs[] = { @@ -397,7 +383,6 @@ static const AVFilterPad avfilter_af_aemphasis_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_aemphasis = { @@ -407,8 +392,8 @@ const AVFilter ff_af_aemphasis = { .priv_class = &aemphasis_class, .uninit = uninit, .query_formats = query_formats, - .inputs = avfilter_af_aemphasis_inputs, - .outputs = avfilter_af_aemphasis_outputs, + FILTER_INPUTS(avfilter_af_aemphasis_inputs), + FILTER_OUTPUTS(avfilter_af_aemphasis_outputs), .process_command = process_command, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, diff --git a/chromium/third_party/ffmpeg/libavfilter/af_aexciter.c b/chromium/third_party/ffmpeg/libavfilter/af_aexciter.c index e7f72cca38a..f9ece59d93e 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_aexciter.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_aexciter.c @@ -220,32 +220,19 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static av_cold void uninit(AVFilterContext *ctx) @@ -292,7 +279,6 @@ static const AVFilterPad avfilter_af_aexciter_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad avfilter_af_aexciter_outputs[] = { @@ -300,7 +286,6 @@ static const AVFilterPad avfilter_af_aexciter_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_aexciter = { @@ -310,8 +295,8 @@ const AVFilter ff_af_aexciter = { .priv_class = &aexciter_class, .uninit = uninit, .query_formats = query_formats, - .inputs = avfilter_af_aexciter_inputs, - .outputs = avfilter_af_aexciter_outputs, + FILTER_INPUTS(avfilter_af_aexciter_inputs), + FILTER_OUTPUTS(avfilter_af_aexciter_outputs), .process_command = process_command, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_afade.c b/chromium/third_party/ffmpeg/libavfilter/af_afade.c index b22432f2e74..a55d5d72c33 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_afade.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_afade.c @@ -59,8 +59,6 @@ enum CurveType { NONE = -1, TRI, QSIN, ESIN, HSIN, LOG, IPAR, QUA, CUB, SQU, CBR static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32P, @@ -68,26 +66,15 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static double fade_gain(int curve, int64_t index, int64_t range) @@ -353,7 +340,6 @@ static const AVFilterPad avfilter_af_afade_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad avfilter_af_afade_outputs[] = { @@ -362,7 +348,6 @@ static const AVFilterPad avfilter_af_afade_outputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_af_afade = { @@ -371,8 +356,8 @@ const AVFilter ff_af_afade = { .query_formats = query_formats, .priv_size = sizeof(AudioFadeContext), .init = init, - .inputs = avfilter_af_afade_inputs, - .outputs = avfilter_af_afade_outputs, + FILTER_INPUTS(avfilter_af_afade_inputs), + FILTER_OUTPUTS(avfilter_af_afade_outputs), .priv_class = &afade_class, .process_command = process_command, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, @@ -641,7 +626,6 @@ static const AVFilterPad avfilter_af_acrossfade_inputs[] = { .name = "crossfade1", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; static const AVFilterPad avfilter_af_acrossfade_outputs[] = { @@ -650,7 +634,6 @@ static const AVFilterPad avfilter_af_acrossfade_outputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = acrossfade_config_output, }, - { NULL } }; const AVFilter ff_af_acrossfade = { @@ -660,8 +643,8 @@ const AVFilter ff_af_acrossfade = { .priv_size = sizeof(AudioFadeContext), .activate = activate, .priv_class = &acrossfade_class, - .inputs = avfilter_af_acrossfade_inputs, - .outputs = avfilter_af_acrossfade_outputs, + FILTER_INPUTS(avfilter_af_acrossfade_inputs), + FILTER_OUTPUTS(avfilter_af_acrossfade_outputs), }; #endif /* CONFIG_ACROSSFADE_FILTER */ diff --git a/chromium/third_party/ffmpeg/libavfilter/af_afftdn.c b/chromium/third_party/ffmpeg/libavfilter/af_afftdn.c index 693585439bc..5e9cefcfc10 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_afftdn.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_afftdn.c @@ -1033,13 +1033,12 @@ static void set_noise_profile(AudioFFTDeNoiseContext *s, double temp[15]; double sum = 0.0, d1; float new_noise_floor; - int i, n; + int i = 0, n; for (int m = 0; m < 15; m++) temp[m] = sample_noise[m]; if (new_profile) { - i = 0; for (int m = 0; m < 5; m++) { sum = 0.0; for (n = 0; n < 15; n++) @@ -1224,8 +1223,8 @@ static int output_frame(AVFilterLink *inlink) s->block_count++; td.in = in; - ctx->internal->execute(ctx, filter_channel, &td, NULL, - FFMIN(outlink->channels, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_channel, &td, NULL, + FFMIN(outlink->channels, ff_filter_get_nb_threads(ctx))); out = ff_get_audio_buffer(outlink, s->sample_advance); if (!out) { @@ -1349,31 +1348,19 @@ static av_cold void uninit(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }; - int ret; - - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, @@ -1412,7 +1399,6 @@ static const AVFilterPad inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -1420,7 +1406,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_afftdn = { @@ -1431,8 +1416,8 @@ const AVFilter ff_af_afftdn = { .priv_class = &afftdn_class, .activate = activate, .uninit = uninit, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .process_command = process_command, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, diff --git a/chromium/third_party/ffmpeg/libavfilter/af_afftfilt.c b/chromium/third_party/ffmpeg/libavfilter/af_afftfilt.c index 6c1ddbe51fc..87e50f57e93 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_afftfilt.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_afftfilt.c @@ -22,9 +22,10 @@ #include "libavutil/avstring.h" #include "libavfilter/internal.h" #include "libavutil/common.h" +#include "libavutil/cpu.h" #include "libavutil/opt.h" -#include "libavcodec/avfft.h" #include "libavutil/eval.h" +#include "libavutil/tx.h" #include "audio.h" #include "filters.h" #include "window_func.h" @@ -34,11 +35,12 @@ typedef struct AFFTFiltContext { char *real_str; char *img_str; int fft_size; - int fft_bits; - FFTContext *fft, *ifft; - FFTComplex **fft_data; - FFTComplex **fft_temp; + AVTXContext *fft, *ifft; + av_tx_fn tx_fn, itx_fn; + AVComplexFloat **fft_in; + AVComplexFloat **fft_out; + AVComplexFloat **fft_temp; int nb_exprs; int channels; int window_size; @@ -100,7 +102,7 @@ static inline double getreal(void *priv, double x, double ch) ich = av_clip(ch, 0, s->nb_exprs - 1); ix = av_clip(x, 0, s->window_size / 2); - return s->fft_data[ich][ix].re; + return s->fft_out[ich][ix].re; } static inline double getimag(void *priv, double x, double ch) @@ -111,7 +113,7 @@ static inline double getimag(void *priv, double x, double ch) ich = av_clip(ch, 0, s->nb_exprs - 1); ix = av_clip(x, 0, s->window_size / 2); - return s->fft_data[ich][ix].im; + return s->fft_out[ich][ix].im; } static double realf(void *priv, double x, double ch) { return getreal(priv, x, ch); } @@ -126,22 +128,30 @@ static int config_input(AVFilterLink *inlink) AFFTFiltContext *s = ctx->priv; char *saveptr = NULL; int ret = 0, ch; - float overlap; + float overlap, scale; char *args; const char *last_expr = "1"; + int buf_size; s->channels = inlink->channels; s->pts = AV_NOPTS_VALUE; - s->fft_bits = av_log2(s->fft_size); - s->fft = av_fft_init(s->fft_bits, 0); - s->ifft = av_fft_init(s->fft_bits, 1); - if (!s->fft || !s->ifft) - return AVERROR(ENOMEM); + ret = av_tx_init(&s->fft, &s->tx_fn, AV_TX_FLOAT_FFT, 0, s->fft_size, &scale, 0); + if (ret < 0) + return ret; + + ret = av_tx_init(&s->ifft, &s->itx_fn, AV_TX_FLOAT_FFT, 1, s->fft_size, &scale, 0); + if (ret < 0) + return ret; - s->window_size = 1 << s->fft_bits; + s->window_size = s->fft_size; + buf_size = FFALIGN(s->window_size, av_cpu_max_align()); - s->fft_data = av_calloc(inlink->channels, sizeof(*s->fft_data)); - if (!s->fft_data) + s->fft_in = av_calloc(inlink->channels, sizeof(*s->fft_in)); + if (!s->fft_in) + return AVERROR(ENOMEM); + + s->fft_out = av_calloc(inlink->channels, sizeof(*s->fft_out)); + if (!s->fft_out) return AVERROR(ENOMEM); s->fft_temp = av_calloc(inlink->channels, sizeof(*s->fft_temp)); @@ -149,13 +159,15 @@ static int config_input(AVFilterLink *inlink) return AVERROR(ENOMEM); for (ch = 0; ch < inlink->channels; ch++) { - s->fft_data[ch] = av_calloc(s->window_size, sizeof(**s->fft_data)); - if (!s->fft_data[ch]) + s->fft_in[ch] = av_calloc(buf_size, sizeof(**s->fft_in)); + if (!s->fft_in[ch]) return AVERROR(ENOMEM); - } - for (ch = 0; ch < inlink->channels; ch++) { - s->fft_temp[ch] = av_calloc(s->window_size, sizeof(**s->fft_temp)); + s->fft_out[ch] = av_calloc(buf_size, sizeof(**s->fft_out)); + if (!s->fft_out[ch]) + return AVERROR(ENOMEM); + + s->fft_temp[ch] = av_calloc(buf_size, sizeof(**s->fft_temp)); if (!s->fft_temp[ch]) return AVERROR(ENOMEM); } @@ -254,16 +266,16 @@ static int filter_frame(AVFilterLink *inlink) for (ch = 0; ch < inlink->channels; ch++) { const float *src = (float *)in->extended_data[ch]; - FFTComplex *fft_data = s->fft_data[ch]; + AVComplexFloat *fft_in = s->fft_in[ch]; for (n = 0; n < in->nb_samples; n++) { - fft_data[n].re = src[n] * s->window_func_lut[n]; - fft_data[n].im = 0; + fft_in[n].re = src[n] * s->window_func_lut[n]; + fft_in[n].im = 0; } for (; n < window_size; n++) { - fft_data[n].re = 0; - fft_data[n].im = 0; + fft_in[n].re = 0; + fft_in[n].im = 0; } } @@ -273,31 +285,38 @@ static int filter_frame(AVFilterLink *inlink) values[VAR_CHANNELS] = inlink->channels; for (ch = 0; ch < inlink->channels; ch++) { - FFTComplex *fft_data = s->fft_data[ch]; + AVComplexFloat *fft_in = s->fft_in[ch]; + AVComplexFloat *fft_out = s->fft_out[ch]; - av_fft_permute(s->fft, fft_data); - av_fft_calc(s->fft, fft_data); + s->tx_fn(s->fft, fft_out, fft_in, sizeof(float)); } for (ch = 0; ch < inlink->channels; ch++) { - FFTComplex *fft_data = s->fft_data[ch]; - FFTComplex *fft_temp = s->fft_temp[ch]; + AVComplexFloat *fft_out = s->fft_out[ch]; + AVComplexFloat *fft_temp = s->fft_temp[ch]; float *buf = (float *)s->buffer->extended_data[ch]; int x; values[VAR_CHANNEL] = ch; - for (n = 0; n <= window_size / 2; n++) { - float fr, fi; + if (ctx->is_disabled) { + for (n = 0; n <= window_size / 2; n++) { + fft_temp[n].re = fft_out[n].re; + fft_temp[n].im = fft_out[n].im; + } + } else { + for (n = 0; n <= window_size / 2; n++) { + float fr, fi; - values[VAR_BIN] = n; - values[VAR_REAL] = fft_data[n].re; - values[VAR_IMAG] = fft_data[n].im; + values[VAR_BIN] = n; + values[VAR_REAL] = fft_out[n].re; + values[VAR_IMAG] = fft_out[n].im; - fr = av_expr_eval(s->real[ch], values, s); - fi = av_expr_eval(s->imag[ch], values, s); + fr = av_expr_eval(s->real[ch], values, s); + fi = av_expr_eval(s->imag[ch], values, s); - fft_temp[n].re = fr; - fft_temp[n].im = fi; + fft_temp[n].re = fr; + fft_temp[n].im = fi; + } } for (n = window_size / 2 + 1, x = window_size / 2 - 1; n < window_size; n++, x--) { @@ -305,11 +324,10 @@ static int filter_frame(AVFilterLink *inlink) fft_temp[n].im = -fft_temp[x].im; } - av_fft_permute(s->ifft, fft_temp); - av_fft_calc(s->ifft, fft_temp); + s->itx_fn(s->ifft, fft_out, fft_temp, sizeof(float)); for (i = 0; i < window_size; i++) { - buf[i] += s->fft_temp[ch][i].re * f; + buf[i] += s->fft_out[ch][i].re * f; } } @@ -401,32 +419,19 @@ static int activate(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static av_cold void uninit(AVFilterContext *ctx) @@ -434,16 +439,19 @@ static av_cold void uninit(AVFilterContext *ctx) AFFTFiltContext *s = ctx->priv; int i; - av_fft_end(s->fft); - av_fft_end(s->ifft); + av_tx_uninit(&s->fft); + av_tx_uninit(&s->ifft); for (i = 0; i < s->channels; i++) { - if (s->fft_data) - av_freep(&s->fft_data[i]); + if (s->fft_in) + av_freep(&s->fft_in[i]); + if (s->fft_out) + av_freep(&s->fft_out[i]); if (s->fft_temp) av_freep(&s->fft_temp[i]); } - av_freep(&s->fft_data); + av_freep(&s->fft_in); + av_freep(&s->fft_out); av_freep(&s->fft_temp); for (i = 0; i < s->nb_exprs; i++) { @@ -465,7 +473,6 @@ static const AVFilterPad inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -473,7 +480,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_afftfilt = { @@ -481,9 +487,10 @@ const AVFilter ff_af_afftfilt = { .description = NULL_IF_CONFIG_SMALL("Apply arbitrary expressions to samples in frequency domain."), .priv_size = sizeof(AFFTFiltContext), .priv_class = &afftfilt_class, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .activate = activate, .query_formats = query_formats, .uninit = uninit, + .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_afir.c b/chromium/third_party/ffmpeg/libavfilter/af_afir.c index 309eb3dd2e8..b74e7ddfaec 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_afir.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_afir.c @@ -225,8 +225,8 @@ static int fir_frame(AudioFIRContext *s, AVFrame *in, AVFilterLink *outlink) if (s->pts == AV_NOPTS_VALUE) s->pts = in->pts; s->in = in; - ctx->internal->execute(ctx, fir_channels, out, NULL, FFMIN(outlink->channels, - ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, fir_channels, out, NULL, + FFMIN(outlink->channels, ff_filter_get_nb_threads(ctx))); out->pts = s->pts; if (s->pts != AV_NOPTS_VALUE) @@ -715,8 +715,6 @@ static int activate(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { AudioFIRContext *s = ctx->priv; - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE @@ -729,21 +727,18 @@ static int query_formats(AVFilterContext *ctx) if (s->response) { AVFilterLink *videolink = ctx->outputs[1]; - formats = ff_make_format_list(pix_fmts); + AVFilterFormats *formats = ff_make_format_list(pix_fmts); if ((ret = ff_formats_ref(formats, &videolink->incfg.formats)) < 0) return ret; } - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - if (s->ir_format) { - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; } else { AVFilterChannelLayouts *mono = NULL; + AVFilterChannelLayouts *layouts = ff_all_channel_counts(); if ((ret = ff_channel_layouts_ref(layouts, &ctx->inputs[0]->outcfg.channel_layouts)) < 0) return ret; @@ -759,12 +754,10 @@ static int query_formats(AVFilterContext *ctx) } } - formats = ff_make_format_list(sample_fmts); - if ((ret = ff_set_common_formats(ctx, formats)) < 0) + if ((ret = ff_set_common_formats_from_list(ctx, sample_fmts)) < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static int config_output(AVFilterLink *outlink) @@ -799,9 +792,6 @@ static av_cold void uninit(AVFilterContext *ctx) av_frame_free(&s->ir[i]); } - for (unsigned i = 1; i < ctx->nb_inputs; i++) - av_freep(&ctx->input_pads[i].name); - av_frame_free(&s->video); } @@ -843,7 +833,7 @@ static av_cold int init(AVFilterContext *ctx) .type = AVMEDIA_TYPE_AUDIO, }; - ret = ff_insert_inpad(ctx, 0, &pad); + ret = ff_append_inpad(ctx, &pad); if (ret < 0) return ret; @@ -856,11 +846,9 @@ static av_cold int init(AVFilterContext *ctx) if (!pad.name) return AVERROR(ENOMEM); - ret = ff_insert_inpad(ctx, n + 1, &pad); - if (ret < 0) { - av_freep(&pad.name); + ret = ff_append_inpad_free_name(ctx, &pad); + if (ret < 0) return ret; - } } pad = (AVFilterPad) { @@ -869,7 +857,7 @@ static av_cold int init(AVFilterContext *ctx) .config_props = config_output, }; - ret = ff_insert_outpad(ctx, 0, &pad); + ret = ff_append_outpad(ctx, &pad); if (ret < 0) return ret; @@ -880,7 +868,7 @@ static av_cold int init(AVFilterContext *ctx) .config_props = config_video, }; - ret = ff_insert_outpad(ctx, 1, &vpad); + ret = ff_append_outpad(ctx, &vpad); if (ret < 0) return ret; } diff --git a/chromium/third_party/ffmpeg/libavfilter/af_aformat.c b/chromium/third_party/ffmpeg/libavfilter/af_aformat.c index e9cc4738fde..1cab148d95f 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_aformat.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_aformat.c @@ -146,7 +146,6 @@ static const AVFilterPad avfilter_af_aformat_inputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; static const AVFilterPad avfilter_af_aformat_outputs[] = { @@ -154,7 +153,6 @@ static const AVFilterPad avfilter_af_aformat_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO }, - { NULL } }; const AVFilter ff_af_aformat = { @@ -165,6 +163,6 @@ const AVFilter ff_af_aformat = { .query_formats = query_formats, .priv_size = sizeof(AFormatContext), .priv_class = &aformat_class, - .inputs = avfilter_af_aformat_inputs, - .outputs = avfilter_af_aformat_outputs, + FILTER_INPUTS(avfilter_af_aformat_inputs), + FILTER_OUTPUTS(avfilter_af_aformat_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_afreqshift.c b/chromium/third_party/ffmpeg/libavfilter/af_afreqshift.c index 85a1e65a964..0410bde70b6 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_afreqshift.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_afreqshift.c @@ -26,16 +26,18 @@ #include "audio.h" #include "formats.h" -#define NB_COEFS 16 +#define MAX_NB_COEFFS 16 typedef struct AFreqShift { const AVClass *class; double shift; double level; + int nb_coeffs; + int old_nb_coeffs; - double cd[NB_COEFS]; - float cf[NB_COEFS]; + double cd[MAX_NB_COEFFS * 2]; + float cf[MAX_NB_COEFFS * 2]; int64_t in_samples; @@ -49,32 +51,20 @@ typedef struct AFreqShift { static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } #define PFILTER(name, type, sin, cos, cc) \ @@ -100,7 +90,7 @@ static void pfilter_channel_## name(AVFilterContext *ctx, \ type xn1 = src[n], xn2 = src[n]; \ type I, Q; \ \ - for (int j = 0; j < NB_COEFS / 2; j++) { \ + for (int j = 0; j < s->nb_coeffs; j++) { \ I = c[j] * (xn1 + o2[j]) - i2[j]; \ i2[j] = i1[j]; \ i1[j] = xn1; \ @@ -109,7 +99,7 @@ static void pfilter_channel_## name(AVFilterContext *ctx, \ xn1 = I; \ } \ \ - for (int j = NB_COEFS / 2; j < NB_COEFS; j++) { \ + for (int j = s->nb_coeffs; j < s->nb_coeffs*2; j++) { \ Q = c[j] * (xn2 + o2[j]) - i2[j]; \ i2[j] = i1[j]; \ i1[j] = xn2; \ @@ -117,7 +107,7 @@ static void pfilter_channel_## name(AVFilterContext *ctx, \ o1[j] = Q; \ xn2 = Q; \ } \ - Q = o2[NB_COEFS - 1]; \ + Q = o2[s->nb_coeffs * 2 - 1]; \ \ dst[n] = (I * cos_theta - Q * sin_theta) * level; \ } \ @@ -149,7 +139,7 @@ static void ffilter_channel_## name(AVFilterContext *ctx, \ type xn1 = src[n], xn2 = src[n]; \ type I, Q, theta; \ \ - for (int j = 0; j < NB_COEFS / 2; j++) { \ + for (int j = 0; j < s->nb_coeffs; j++) { \ I = c[j] * (xn1 + o2[j]) - i2[j]; \ i2[j] = i1[j]; \ i1[j] = xn1; \ @@ -158,7 +148,7 @@ static void ffilter_channel_## name(AVFilterContext *ctx, \ xn1 = I; \ } \ \ - for (int j = NB_COEFS / 2; j < NB_COEFS; j++) { \ + for (int j = s->nb_coeffs; j < s->nb_coeffs*2; j++) { \ Q = c[j] * (xn2 + o2[j]) - i2[j]; \ i2[j] = i1[j]; \ i1[j] = xn2; \ @@ -166,7 +156,7 @@ static void ffilter_channel_## name(AVFilterContext *ctx, \ o1[j] = Q; \ xn2 = Q; \ } \ - Q = o2[NB_COEFS - 1]; \ + Q = o2[s->nb_coeffs * 2 - 1]; \ \ theta = 2. * M_PI * fmod(shift * (N + n) * ts, 1.); \ dst[n] = (I * cos(theta) - Q * sin(theta)) * level; \ @@ -278,12 +268,14 @@ static int config_input(AVFilterLink *inlink) AVFilterContext *ctx = inlink->dst; AFreqShift *s = ctx->priv; - compute_coefs(s->cd, s->cf, NB_COEFS, 2. * 20. / inlink->sample_rate); + if (s->old_nb_coeffs != s->nb_coeffs) + compute_coefs(s->cd, s->cf, s->nb_coeffs * 2, 2. * 20. / inlink->sample_rate); + s->old_nb_coeffs = s->nb_coeffs; - s->i1 = ff_get_audio_buffer(inlink, NB_COEFS); - s->o1 = ff_get_audio_buffer(inlink, NB_COEFS); - s->i2 = ff_get_audio_buffer(inlink, NB_COEFS); - s->o2 = ff_get_audio_buffer(inlink, NB_COEFS); + s->i1 = ff_get_audio_buffer(inlink, MAX_NB_COEFFS * 2); + s->o1 = ff_get_audio_buffer(inlink, MAX_NB_COEFFS * 2); + s->i2 = ff_get_audio_buffer(inlink, MAX_NB_COEFFS * 2); + s->o2 = ff_get_audio_buffer(inlink, MAX_NB_COEFFS * 2); if (!s->i1 || !s->o1 || !s->i2 || !s->o2) return AVERROR(ENOMEM); @@ -329,6 +321,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) AVFrame *out; ThreadData td; + if (s->old_nb_coeffs != s->nb_coeffs) + compute_coefs(s->cd, s->cf, s->nb_coeffs * 2, 2. * 20. / inlink->sample_rate); + s->old_nb_coeffs = s->nb_coeffs; + if (av_frame_is_writable(in)) { out = in; } else { @@ -341,8 +337,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) } td.in = in; td.out = out; - ctx->internal->execute(ctx, filter_channels, &td, NULL, FFMIN(inlink->channels, - ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_channels, &td, NULL, + FFMIN(inlink->channels, ff_filter_get_nb_threads(ctx))); s->in_samples += in->nb_samples; @@ -367,6 +363,7 @@ static av_cold void uninit(AVFilterContext *ctx) static const AVOption afreqshift_options[] = { { "shift", "set frequency shift", OFFSET(shift), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -INT_MAX, INT_MAX, FLAGS }, { "level", "set output level", OFFSET(level), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.0, 1.0, FLAGS }, + { "order", "set filter order", OFFSET(nb_coeffs),AV_OPT_TYPE_INT, {.i64=8}, 1, MAX_NB_COEFFS, FLAGS }, { NULL } }; @@ -379,7 +376,6 @@ static const AVFilterPad inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -387,7 +383,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_afreqshift = { @@ -397,8 +392,8 @@ const AVFilter ff_af_afreqshift = { .priv_size = sizeof(AFreqShift), .priv_class = &afreqshift_class, .uninit = uninit, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .process_command = ff_filter_process_command, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, @@ -407,6 +402,7 @@ const AVFilter ff_af_afreqshift = { static const AVOption aphaseshift_options[] = { { "shift", "set phase shift", OFFSET(shift), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -1.0, 1.0, FLAGS }, { "level", "set output level",OFFSET(level), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.0, 1.0, FLAGS }, + { "order", "set filter order",OFFSET(nb_coeffs), AV_OPT_TYPE_INT,{.i64=8}, 1, MAX_NB_COEFFS, FLAGS }, { NULL } }; @@ -419,8 +415,8 @@ const AVFilter ff_af_aphaseshift = { .priv_size = sizeof(AFreqShift), .priv_class = &aphaseshift_class, .uninit = uninit, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .process_command = ff_filter_process_command, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, diff --git a/chromium/third_party/ffmpeg/libavfilter/af_afwtdn.c b/chromium/third_party/ffmpeg/libavfilter/af_afwtdn.c index a23bb902eab..f7e8211bb4a 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_afwtdn.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_afwtdn.c @@ -463,31 +463,19 @@ AVFILTER_DEFINE_CLASS(afwtdn); static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } #define pow2(x) (1U << (x)) @@ -1072,7 +1060,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.in = in; td.out = out; - ctx->internal->execute(ctx, s->filter_channel, &td, NULL, inlink->channels); + ff_filter_execute(ctx, s->filter_channel, &td, NULL, inlink->channels); if (s->need_profile) s->got_profile = 1; @@ -1323,7 +1311,6 @@ static const AVFilterPad inputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -1332,7 +1319,6 @@ static const AVFilterPad outputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_af_afwtdn = { @@ -1343,8 +1329,8 @@ const AVFilter ff_af_afwtdn = { .priv_class = &afwtdn_class, .activate = activate, .uninit = uninit, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .process_command = process_command, .flags = AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_agate.c b/chromium/third_party/ffmpeg/libavfilter/af_agate.c index 3c858021d1f..0dc28ac080b 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_agate.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_agate.c @@ -189,7 +189,6 @@ AVFILTER_DEFINE_CLASS(agate); static int query_formats(AVFilterContext *ctx) { AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts; int ret; if ((ret = ff_add_format(&formats, AV_SAMPLE_FMT_DBL)) < 0) @@ -198,18 +197,11 @@ static int query_formats(AVFilterContext *ctx) if (ret < 0) return ret; - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static int filter_frame(AVFilterLink *inlink, AVFrame *in) @@ -248,7 +240,6 @@ static const AVFilterPad inputs[] = { .filter_frame = filter_frame, .config_props = agate_config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -256,7 +247,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_agate = { @@ -265,8 +255,8 @@ const AVFilter ff_af_agate = { .query_formats = query_formats, .priv_size = sizeof(AudioGateContext), .priv_class = &agate_class, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .process_command = ff_filter_process_command, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; @@ -346,7 +336,6 @@ static int activate(AVFilterContext *ctx) static int scquery_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBL, @@ -371,12 +360,10 @@ static int scquery_formats(AVFilterContext *ctx) return ret; } - formats = ff_make_format_list(sample_fmts); - if ((ret = ff_set_common_formats(ctx, formats)) < 0) + if ((ret = ff_set_common_formats_from_list(ctx, sample_fmts)) < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static int scconfig_output(AVFilterLink *outlink) @@ -424,7 +411,6 @@ static const AVFilterPad sidechaingate_inputs[] = { .name = "sidechain", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; static const AVFilterPad sidechaingate_outputs[] = { @@ -433,7 +419,6 @@ static const AVFilterPad sidechaingate_outputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = scconfig_output, }, - { NULL } }; const AVFilter ff_af_sidechaingate = { @@ -444,8 +429,8 @@ const AVFilter ff_af_sidechaingate = { .query_formats = scquery_formats, .activate = activate, .uninit = uninit, - .inputs = sidechaingate_inputs, - .outputs = sidechaingate_outputs, + FILTER_INPUTS(sidechaingate_inputs), + FILTER_OUTPUTS(sidechaingate_outputs), .process_command = ff_filter_process_command, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_aiir.c b/chromium/third_party/ffmpeg/libavfilter/af_aiir.c index 6ac39872ef2..cae2c365bf9 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_aiir.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_aiir.c @@ -79,7 +79,6 @@ static int query_formats(AVFilterContext *ctx) { AudioIIRContext *s = ctx->priv; AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE @@ -98,25 +97,16 @@ static int query_formats(AVFilterContext *ctx) return ret; } - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; sample_fmts[0] = s->sample_format; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } #define IIR_CH(name, type, min, max, need_clipping) \ @@ -1411,7 +1401,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.in = in; td.out = out; - ctx->internal->execute(ctx, s->iir_channel, &td, NULL, outlink->channels); + ff_filter_execute(ctx, s->iir_channel, &td, NULL, outlink->channels); for (ch = 0; ch < outlink->channels; ch++) { if (s->iir[ch].clippings > 0) @@ -1483,7 +1473,7 @@ static av_cold int init(AVFilterContext *ctx) .config_props = config_output, }; - ret = ff_insert_outpad(ctx, 0, &pad); + ret = ff_append_outpad(ctx, &pad); if (ret < 0) return ret; @@ -1494,7 +1484,7 @@ static av_cold int init(AVFilterContext *ctx) .config_props = config_video, }; - ret = ff_insert_outpad(ctx, 1, &vpad); + ret = ff_append_outpad(ctx, &vpad); if (ret < 0) return ret; } @@ -1528,7 +1518,6 @@ static const AVFilterPad inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = filter_frame, }, - { NULL } }; #define OFFSET(x) offsetof(AudioIIRContext, x) @@ -1584,7 +1573,7 @@ const AVFilter ff_af_aiir = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = inputs, + FILTER_INPUTS(inputs), .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS | AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_alimiter.c b/chromium/third_party/ffmpeg/libavfilter/af_alimiter.c index 30f1a4cba50..9172f305f0e 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_alimiter.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_alimiter.c @@ -278,32 +278,19 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static int config_input(AVFilterLink *inlink) @@ -350,7 +337,6 @@ static const AVFilterPad alimiter_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad alimiter_outputs[] = { @@ -358,7 +344,6 @@ static const AVFilterPad alimiter_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_alimiter = { @@ -369,6 +354,6 @@ const AVFilter ff_af_alimiter = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = alimiter_inputs, - .outputs = alimiter_outputs, + FILTER_INPUTS(alimiter_inputs), + FILTER_OUTPUTS(alimiter_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_amerge.c b/chromium/third_party/ffmpeg/libavfilter/af_amerge.c index 2e45b7c2779..d67e3d7e324 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_amerge.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_amerge.c @@ -60,8 +60,6 @@ static av_cold void uninit(AVFilterContext *ctx) AMergeContext *s = ctx->priv; av_freep(&s->in); - for (unsigned i = 0; i < ctx->nb_inputs; i++) - av_freep(&ctx->input_pads[i].name); } static int query_formats(AVFilterContext *ctx) @@ -76,7 +74,6 @@ static int query_formats(AVFilterContext *ctx) }; AMergeContext *s = ctx->priv; int64_t inlayout[SWR_CH_MAX], outlayout = 0; - AVFilterFormats *formats; AVFilterChannelLayouts *layouts; int i, ret, overlap = 0, nb_ch = 0; @@ -129,8 +126,7 @@ static int query_formats(AVFilterContext *ctx) if ((inlayout[i] >> c) & 1) *(route[i]++) = out_ch_number++; } - formats = ff_make_format_list(packed_sample_fmts); - if ((ret = ff_set_common_formats(ctx, formats)) < 0) + if ((ret = ff_set_common_formats_from_list(ctx, packed_sample_fmts)) < 0) return ret; for (i = 0; i < s->nb_inputs; i++) { layouts = NULL; @@ -145,7 +141,7 @@ static int query_formats(AVFilterContext *ctx) if ((ret = ff_channel_layouts_ref(layouts, &ctx->outputs[0]->incfg.channel_layouts)) < 0) return ret; - return ff_set_common_samplerates(ctx, ff_all_samplerates()); + return ff_set_common_all_samplerates(ctx); } static int config_output(AVFilterLink *outlink) @@ -330,10 +326,8 @@ static av_cold int init(AVFilterContext *ctx) }; if (!name) return AVERROR(ENOMEM); - if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0) { - av_freep(&pad.name); + if ((ret = ff_append_inpad_free_name(ctx, &pad)) < 0) return ret; - } } return 0; } @@ -344,7 +338,6 @@ static const AVFilterPad amerge_outputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_af_amerge = { @@ -357,7 +350,7 @@ const AVFilter ff_af_amerge = { .query_formats = query_formats, .activate = activate, .inputs = NULL, - .outputs = amerge_outputs, + FILTER_OUTPUTS(amerge_outputs), .priv_class = &amerge_class, .flags = AVFILTER_FLAG_DYNAMIC_INPUTS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_amix.c b/chromium/third_party/ffmpeg/libavfilter/af_amix.c index 2296b49243a..41212d922a7 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_amix.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_amix.c @@ -553,10 +553,8 @@ static av_cold int init(AVFilterContext *ctx) if (!pad.name) return AVERROR(ENOMEM); - if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0) { - av_freep(&pad.name); + if ((ret = ff_append_inpad_free_name(ctx, &pad)) < 0) return ret; - } } s->fdsp = avpriv_float_dsp_alloc(0); @@ -589,9 +587,6 @@ static av_cold void uninit(AVFilterContext *ctx) av_freep(&s->scale_norm); av_freep(&s->weights); av_freep(&s->fdsp); - - for (i = 0; i < ctx->nb_inputs; i++) - av_freep(&ctx->input_pads[i].name); } static int query_formats(AVFilterContext *ctx) @@ -603,11 +598,11 @@ static int query_formats(AVFilterContext *ctx) }; int ret; - if ((ret = ff_set_common_formats(ctx, ff_make_format_list(sample_fmts))) < 0 || - (ret = ff_set_common_samplerates(ctx, ff_all_samplerates())) < 0) + if ((ret = ff_set_common_formats_from_list(ctx, sample_fmts)) < 0 || + (ret = ff_set_common_all_samplerates(ctx)) < 0) return ret; - return ff_set_common_channel_layouts(ctx, ff_all_channel_counts()); + return ff_set_common_all_channel_counts(ctx); } static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, @@ -634,7 +629,6 @@ static const AVFilterPad avfilter_af_amix_outputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_af_amix = { @@ -647,7 +641,7 @@ const AVFilter ff_af_amix = { .activate = activate, .query_formats = query_formats, .inputs = NULL, - .outputs = avfilter_af_amix_outputs, + FILTER_OUTPUTS(avfilter_af_amix_outputs), .process_command = process_command, .flags = AVFILTER_FLAG_DYNAMIC_INPUTS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_amultiply.c b/chromium/third_party/ffmpeg/libavfilter/af_amultiply.c index b50bbfb6ce5..7c44cadb2bf 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_amultiply.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_amultiply.c @@ -42,33 +42,20 @@ typedef struct AudioMultiplyContext { static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static int activate(AVFilterContext *ctx) @@ -192,7 +179,6 @@ static const AVFilterPad inputs[] = { .name = "multiply1", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -201,7 +187,6 @@ static const AVFilterPad outputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_af_amultiply = { @@ -212,6 +197,6 @@ const AVFilter ff_af_amultiply = { .uninit = uninit, .activate = activate, .query_formats = query_formats, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_anequalizer.c b/chromium/third_party/ffmpeg/libavfilter/af_anequalizer.c index faa0e2a230a..ab1838f990f 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_anequalizer.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_anequalizer.c @@ -196,7 +196,7 @@ static av_cold int init(AVFilterContext *ctx) .type = AVMEDIA_TYPE_AUDIO, }; - ret = ff_insert_outpad(ctx, 0, &pad); + ret = ff_append_outpad(ctx, &pad); if (ret < 0) return ret; @@ -206,7 +206,7 @@ static av_cold int init(AVFilterContext *ctx) .type = AVMEDIA_TYPE_VIDEO, .config_props = config_video, }; - ret = ff_insert_outpad(ctx, 1, &vpad); + ret = ff_append_outpad(ctx, &vpad); if (ret < 0) return ret; } @@ -730,8 +730,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf) AVFilterLink *outlink = ctx->outputs[0]; if (!ctx->is_disabled) - ctx->internal->execute(ctx, filter_channels, buf, NULL, FFMIN(inlink->channels, - ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_channels, buf, NULL, + FFMIN(inlink->channels, ff_filter_get_nb_threads(ctx))); if (s->draw_curves) { AVFrame *clone; @@ -757,11 +757,10 @@ static const AVFilterPad inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_AUDIO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .config_props = config_input, .filter_frame = filter_frame, - .needs_writable = 1, }, - { NULL } }; const AVFilter ff_af_anequalizer = { @@ -772,7 +771,7 @@ const AVFilter ff_af_anequalizer = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = inputs, + FILTER_INPUTS(inputs), .outputs = NULL, .process_command = process_command, .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS | diff --git a/chromium/third_party/ffmpeg/libavfilter/af_anlmdn.c b/chromium/third_party/ffmpeg/libavfilter/af_anlmdn.c index 05e84282f01..0ba725f59fb 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_anlmdn.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_anlmdn.c @@ -95,31 +95,19 @@ AVFILTER_DEFINE_CLASS(anlmdn); static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }; - int ret; - - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static float compute_distance_ssd_c(const float *f1, const float *f2, ptrdiff_t K) @@ -321,7 +309,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) if (ret < 0) break; - ctx->internal->execute(ctx, filter_channel, out, NULL, inlink->channels); + ff_filter_execute(ctx, filter_channel, out, NULL, inlink->channels); av_audio_fifo_drain(s->fifo, s->H); @@ -400,7 +388,6 @@ static const AVFilterPad inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -410,7 +397,6 @@ static const AVFilterPad outputs[] = { .config_props = config_output, .request_frame = request_frame, }, - { NULL } }; const AVFilter ff_af_anlmdn = { @@ -420,8 +406,8 @@ const AVFilter ff_af_anlmdn = { .priv_size = sizeof(AudioNLMeansContext), .priv_class = &anlmdn_class, .uninit = uninit, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .process_command = process_command, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, diff --git a/chromium/third_party/ffmpeg/libavfilter/af_anlms.c b/chromium/third_party/ffmpeg/libavfilter/af_anlms.c index 26df40107fd..75e932ca965 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_anlms.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_anlms.c @@ -78,32 +78,19 @@ AVFILTER_DEFINE_CLASS(anlms); static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static float fir_sample(AudioNLMSContext *s, float sample, float *delay, @@ -216,8 +203,8 @@ static int activate(AVFilterContext *ctx) return AVERROR(ENOMEM); } - ctx->internal->execute(ctx, process_channels, out, NULL, FFMIN(ctx->outputs[0]->channels, - ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, process_channels, out, NULL, + FFMIN(ctx->outputs[0]->channels, ff_filter_get_nb_threads(ctx))); out->pts = s->frame[0]->pts; @@ -301,7 +288,6 @@ static const AVFilterPad inputs[] = { .name = "desired", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -310,7 +296,6 @@ static const AVFilterPad outputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_af_anlms = { @@ -322,8 +307,8 @@ const AVFilter ff_af_anlms = { .uninit = uninit, .activate = activate, .query_formats = query_formats, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .flags = AVFILTER_FLAG_SLICE_THREADS, .process_command = ff_filter_process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_anull.c b/chromium/third_party/ffmpeg/libavfilter/af_anull.c index 74f915778fa..065d37e17e9 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_anull.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_anull.c @@ -32,7 +32,6 @@ static const AVFilterPad avfilter_af_anull_inputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; static const AVFilterPad avfilter_af_anull_outputs[] = { @@ -40,12 +39,11 @@ static const AVFilterPad avfilter_af_anull_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_anull = { .name = "anull", .description = NULL_IF_CONFIG_SMALL("Pass the source unchanged to the output."), - .inputs = avfilter_af_anull_inputs, - .outputs = avfilter_af_anull_outputs, + FILTER_INPUTS(avfilter_af_anull_inputs), + FILTER_OUTPUTS(avfilter_af_anull_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_apad.c b/chromium/third_party/ffmpeg/libavfilter/af_apad.c index 8628c0c2e2a..27259a87a39 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_apad.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_apad.c @@ -155,7 +155,6 @@ static const AVFilterPad apad_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad apad_outputs[] = { @@ -165,7 +164,6 @@ static const AVFilterPad apad_outputs[] = { .config_props = config_output, .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_apad = { @@ -173,8 +171,8 @@ const AVFilter ff_af_apad = { .description = NULL_IF_CONFIG_SMALL("Pad audio with silence."), .init = init, .priv_size = sizeof(APadContext), - .inputs = apad_inputs, - .outputs = apad_outputs, + FILTER_INPUTS(apad_inputs), + FILTER_OUTPUTS(apad_outputs), .priv_class = &apad_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_aphaser.c b/chromium/third_party/ffmpeg/libavfilter/af_aphaser.c index e033a6d9040..3a365140db7 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_aphaser.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_aphaser.c @@ -85,8 +85,6 @@ static av_cold int init(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP, @@ -94,26 +92,15 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } #define MOD(a, b) (((a) >= (b)) ? (a) - (b) : (a)) @@ -278,7 +265,6 @@ static const AVFilterPad aphaser_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad aphaser_outputs[] = { @@ -287,7 +273,6 @@ static const AVFilterPad aphaser_outputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_af_aphaser = { @@ -297,7 +282,7 @@ const AVFilter ff_af_aphaser = { .priv_size = sizeof(AudioPhaserContext), .init = init, .uninit = uninit, - .inputs = aphaser_inputs, - .outputs = aphaser_outputs, + FILTER_INPUTS(aphaser_inputs), + FILTER_OUTPUTS(aphaser_outputs), .priv_class = &aphaser_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_apsyclip.c b/chromium/third_party/ffmpeg/libavfilter/af_apsyclip.c new file mode 100644 index 00000000000..ef151bcb557 --- /dev/null +++ b/chromium/third_party/ffmpeg/libavfilter/af_apsyclip.c @@ -0,0 +1,679 @@ +/* + * Copyright (c) 2014 - 2021 Jason Jang + * Copyright (c) 2021 Paul B Mahol + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with FFmpeg; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/opt.h" +#include "libavutil/tx.h" +#include "audio.h" +#include "avfilter.h" +#include "filters.h" +#include "internal.h" + +typedef struct AudioPsyClipContext { + const AVClass *class; + + double level_in; + double level_out; + double clip_level; + double adaptive; + int auto_level; + int diff_only; + int iterations; + char *protections_str; + double *protections; + + int num_psy_bins; + int fft_size; + int overlap; + int channels; + + int spread_table_rows; + int *spread_table_index; + int (*spread_table_range)[2]; + float *window, *inv_window, *spread_table, *margin_curve; + + AVFrame *in; + AVFrame *in_buffer; + AVFrame *in_frame; + AVFrame *out_dist_frame; + AVFrame *windowed_frame; + AVFrame *clipping_delta; + AVFrame *spectrum_buf; + AVFrame *mask_curve; + + AVTXContext **tx_ctx; + av_tx_fn tx_fn; + AVTXContext **itx_ctx; + av_tx_fn itx_fn; +} AudioPsyClipContext; + +#define OFFSET(x) offsetof(AudioPsyClipContext, x) +#define FLAGS AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_RUNTIME_PARAM + +static const AVOption apsyclip_options[] = { + { "level_in", "set input level", OFFSET(level_in), AV_OPT_TYPE_DOUBLE, {.dbl=1},.015625, 64, FLAGS }, + { "level_out", "set output level", OFFSET(level_out), AV_OPT_TYPE_DOUBLE, {.dbl=1},.015625, 64, FLAGS }, + { "clip", "set clip level", OFFSET(clip_level), AV_OPT_TYPE_DOUBLE, {.dbl=1},.015625, 1, FLAGS }, + { "diff", "enable difference", OFFSET(diff_only), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS }, + { "adaptive", "set adaptive distortion", OFFSET(adaptive), AV_OPT_TYPE_DOUBLE, {.dbl=0.5}, 0, 1, FLAGS }, + { "iterations", "set iterations", OFFSET(iterations), AV_OPT_TYPE_INT, {.i64=10}, 1, 20, FLAGS }, + { "level", "set auto level", OFFSET(auto_level), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS }, + {NULL} +}; + +AVFILTER_DEFINE_CLASS(apsyclip); + +static int query_formats(AVFilterContext *ctx) +{ + static const enum AVSampleFormat sample_fmts[] = { + AV_SAMPLE_FMT_FLTP, + AV_SAMPLE_FMT_NONE + }; + int ret; + + ret = ff_set_common_all_channel_counts(ctx); + if (ret < 0) + return ret; + + ret = ff_set_common_formats_from_list(ctx, sample_fmts); + if (ret < 0) + return ret; + + return ff_set_common_all_samplerates(ctx); +} + +static void generate_hann_window(float *window, float *inv_window, int size) +{ + for (int i = 0; i < size; i++) { + float value = 0.5f * (1.f - cosf(2.f * M_PI * i / size)); + + window[i] = value; + // 1/window to calculate unwindowed peak. + inv_window[i] = value > 0.01f ? 1.f / value : 0.f; + } +} + +static void set_margin_curve(AudioPsyClipContext *s, + const int (*points)[2], int num_points, int sample_rate) +{ + int j = 0; + + s->margin_curve[0] = points[0][1]; + + for (int i = 0; i < num_points - 1; i++) { + while (j < s->fft_size / 2 + 1 && j * sample_rate / s->fft_size < points[i + 1][0]) { + // linearly interpolate between points + int binHz = j * sample_rate / s->fft_size; + s->margin_curve[j] = points[i][1] + (binHz - points[i][0]) * (points[i + 1][1] - points[i][1]) / (points[i + 1][0] - points[i][0]); + j++; + } + } + // handle bins after the last point + while (j < s->fft_size / 2 + 1) { + s->margin_curve[j] = points[num_points - 1][1]; + j++; + } + + // convert margin curve to linear amplitude scale + for (j = 0; j < s->fft_size / 2 + 1; j++) + s->margin_curve[j] = powf(10.f, s->margin_curve[j] / 20.f); +} + +static void generate_spread_table(AudioPsyClipContext *s) +{ + // Calculate tent-shape function in log-log scale. + + // As an optimization, only consider bins close to "bin" + // This reduces the number of multiplications needed in calculate_mask_curve + // The masking contribution at faraway bins is negligeable + + // Another optimization to save memory and speed up the calculation of the + // spread table is to calculate and store only 2 spread functions per + // octave, and reuse the same spread function for multiple bins. + int table_index = 0; + int bin = 0; + int increment = 1; + + while (bin < s->num_psy_bins) { + float sum = 0; + int base_idx = table_index * s->num_psy_bins; + int start_bin = bin * 3 / 4; + int end_bin = FFMIN(s->num_psy_bins, ((bin + 1) * 4 + 2) / 3); + int next_bin; + + for (int j = start_bin; j < end_bin; j++) { + // add 0.5 so i=0 doesn't get log(0) + float rel_idx_log = FFABS(logf((j + 0.5f) / (bin + 0.5f))); + float value; + if (j >= bin) { + // mask up + value = expf(-rel_idx_log * 40.f); + } else { + // mask down + value = expf(-rel_idx_log * 80.f); + } + // the spreading function is centred in the row + sum += value; + s->spread_table[base_idx + s->num_psy_bins / 2 + j - bin] = value; + } + // now normalize it + for (int j = start_bin; j < end_bin; j++) { + s->spread_table[base_idx + s->num_psy_bins / 2 + j - bin] /= sum; + } + + s->spread_table_range[table_index][0] = start_bin - bin; + s->spread_table_range[table_index][1] = end_bin - bin; + + if (bin <= 1) { + next_bin = bin + 1; + } else { + if ((bin & (bin - 1)) == 0) { + // power of 2 + increment = bin / 2; + } + + next_bin = bin + increment; + } + + // set bins between "bin" and "next_bin" to use this table_index + for (int i = bin; i < next_bin; i++) + s->spread_table_index[i] = table_index; + + bin = next_bin; + table_index++; + } +} + +static int config_input(AVFilterLink *inlink) +{ + AVFilterContext *ctx = inlink->dst; + AudioPsyClipContext *s = ctx->priv; + static const int points[][2] = { {0,14}, {125,14}, {250,16}, {500,18}, {1000,20}, {2000,20}, {4000,20}, {8000,15}, {16000,5}, {20000,-10} }; + static const int num_points = 10; + float scale; + int ret; + + s->fft_size = inlink->sample_rate > 100000 ? 1024 : inlink->sample_rate > 50000 ? 512 : 256; + s->overlap = s->fft_size / 4; + + // The psy masking calculation is O(n^2), + // so skip it for frequencies not covered by base sampling rantes (i.e. 44k) + if (inlink->sample_rate <= 50000) { + s->num_psy_bins = s->fft_size / 2; + } else if (inlink->sample_rate <= 100000) { + s->num_psy_bins = s->fft_size / 4; + } else { + s->num_psy_bins = s->fft_size / 8; + } + + s->window = av_calloc(s->fft_size, sizeof(*s->window)); + s->inv_window = av_calloc(s->fft_size, sizeof(*s->inv_window)); + if (!s->window || !s->inv_window) + return AVERROR(ENOMEM); + + s->in_buffer = ff_get_audio_buffer(inlink, s->fft_size * 2); + s->in_frame = ff_get_audio_buffer(inlink, s->fft_size * 2); + s->out_dist_frame = ff_get_audio_buffer(inlink, s->fft_size * 2); + s->windowed_frame = ff_get_audio_buffer(inlink, s->fft_size * 2); + s->clipping_delta = ff_get_audio_buffer(inlink, s->fft_size * 2); + s->spectrum_buf = ff_get_audio_buffer(inlink, s->fft_size * 2); + s->mask_curve = ff_get_audio_buffer(inlink, s->fft_size / 2 + 1); + if (!s->in_buffer || !s->in_frame || + !s->out_dist_frame || !s->windowed_frame || + !s->clipping_delta || !s->spectrum_buf || !s->mask_curve) + return AVERROR(ENOMEM); + + generate_hann_window(s->window, s->inv_window, s->fft_size); + + s->margin_curve = av_calloc(s->fft_size / 2 + 1, sizeof(*s->margin_curve)); + if (!s->margin_curve) + return AVERROR(ENOMEM); + + s->spread_table_rows = av_log2(s->num_psy_bins) * 2; + s->spread_table = av_calloc(s->spread_table_rows * s->num_psy_bins, sizeof(*s->spread_table)); + if (!s->spread_table) + return AVERROR(ENOMEM); + + s->spread_table_range = av_calloc(s->spread_table_rows * 2, sizeof(*s->spread_table_range)); + if (!s->spread_table_range) + return AVERROR(ENOMEM); + + s->spread_table_index = av_calloc(s->num_psy_bins, sizeof(*s->spread_table_index)); + if (!s->spread_table_index) + return AVERROR(ENOMEM); + + set_margin_curve(s, points, num_points, inlink->sample_rate); + + generate_spread_table(s); + + s->channels = inlink->channels; + + s->tx_ctx = av_calloc(s->channels, sizeof(*s->tx_ctx)); + s->itx_ctx = av_calloc(s->channels, sizeof(*s->itx_ctx)); + if (!s->tx_ctx || !s->itx_ctx) + return AVERROR(ENOMEM); + + for (int ch = 0; ch < s->channels; ch++) { + ret = av_tx_init(&s->tx_ctx[ch], &s->tx_fn, AV_TX_FLOAT_FFT, 0, s->fft_size, &scale, 0); + if (ret < 0) + return ret; + + ret = av_tx_init(&s->itx_ctx[ch], &s->itx_fn, AV_TX_FLOAT_FFT, 1, s->fft_size, &scale, 0); + if (ret < 0) + return ret; + } + + return 0; +} + +static void apply_window(AudioPsyClipContext *s, + const float *in_frame, float *out_frame, const int add_to_out_frame) +{ + const float *window = s->window; + + for (int i = 0; i < s->fft_size; i++) { + if (add_to_out_frame) { + out_frame[i] += in_frame[i] * window[i]; + } else { + out_frame[i] = in_frame[i] * window[i]; + } + } +} + +static void calculate_mask_curve(AudioPsyClipContext *s, + const float *spectrum, float *mask_curve) +{ + for (int i = 0; i < s->fft_size / 2 + 1; i++) + mask_curve[i] = 0; + + for (int i = 0; i < s->num_psy_bins; i++) { + int base_idx, start_bin, end_bin, table_idx; + float magnitude; + int range[2]; + + if (i == 0) { + magnitude = FFABS(spectrum[0]); + } else if (i == s->fft_size / 2) { + magnitude = FFABS(spectrum[1]); + } else { + // although the negative frequencies are omitted because they are redundant, + // the magnitude of the positive frequencies are not doubled. + // Multiply the magnitude by 2 to simulate adding up the + and - frequencies. + magnitude = hypotf(spectrum[2 * i], spectrum[2 * i + 1]) * 2; + } + + table_idx = s->spread_table_index[i]; + range[0] = s->spread_table_range[table_idx][0]; + range[1] = s->spread_table_range[table_idx][1]; + base_idx = table_idx * s->num_psy_bins; + start_bin = FFMAX(0, i + range[0]); + end_bin = FFMIN(s->num_psy_bins, i + range[1]); + + for (int j = start_bin; j < end_bin; j++) + mask_curve[j] += s->spread_table[base_idx + s->num_psy_bins / 2 + j - i] * magnitude; + } + + // for ultrasonic frequencies, skip the O(n^2) spread calculation and just copy the magnitude + for (int i = s->num_psy_bins; i < s->fft_size / 2 + 1; i++) { + float magnitude; + if (i == s->fft_size / 2) { + magnitude = FFABS(spectrum[1]); + } else { + // although the negative frequencies are omitted because they are redundant, + // the magnitude of the positive frequencies are not doubled. + // Multiply the magnitude by 2 to simulate adding up the + and - frequencies. + magnitude = hypotf(spectrum[2 * i], spectrum[2 * i + 1]) * 2; + } + + mask_curve[i] = magnitude; + } + + for (int i = 0; i < s->fft_size / 2 + 1; i++) + mask_curve[i] = mask_curve[i] / s->margin_curve[i]; +} + +static void clip_to_window(AudioPsyClipContext *s, + const float *windowed_frame, float *clipping_delta, float delta_boost) +{ + const float *window = s->window; + + for (int i = 0; i < s->fft_size; i++) { + const float limit = s->clip_level * window[i]; + const float effective_value = windowed_frame[i] + clipping_delta[i]; + + if (effective_value > limit) { + clipping_delta[i] += (limit - effective_value) * delta_boost; + } else if (effective_value < -limit) { + clipping_delta[i] += (-limit - effective_value) * delta_boost; + } + } +} + +static void limit_clip_spectrum(AudioPsyClipContext *s, + float *clip_spectrum, const float *mask_curve) +{ + // bin 0 + float relative_distortion_level = FFABS(clip_spectrum[0]) / mask_curve[0]; + + if (relative_distortion_level > 1.f) + clip_spectrum[0] /= relative_distortion_level; + + // bin 1..N/2-1 + for (int i = 1; i < s->fft_size / 2; i++) { + float real = clip_spectrum[i * 2]; + float imag = clip_spectrum[i * 2 + 1]; + // although the negative frequencies are omitted because they are redundant, + // the magnitude of the positive frequencies are not doubled. + // Multiply the magnitude by 2 to simulate adding up the + and - frequencies. + relative_distortion_level = hypotf(real, imag) * 2 / mask_curve[i]; + if (relative_distortion_level > 1.0) { + clip_spectrum[i * 2] /= relative_distortion_level; + clip_spectrum[i * 2 + 1] /= relative_distortion_level; + } + } + // bin N/2 + relative_distortion_level = FFABS(clip_spectrum[1]) / mask_curve[s->fft_size / 2]; + if (relative_distortion_level > 1.f) + clip_spectrum[1] /= relative_distortion_level; +} + +static void r2c(float *buffer, int size) +{ + for (int i = size - 1; i >= 0; i--) + buffer[2 * i] = buffer[i]; + + for (int i = size - 1; i >= 0; i--) + buffer[2 * i + 1] = 0.f; +} + +static void c2r(float *buffer, int size) +{ + for (int i = 0; i < size; i++) + buffer[i] = buffer[2 * i]; + + for (int i = 0; i < size; i++) + buffer[i + size] = 0.f; +} + +static void feed(AVFilterContext *ctx, int ch, + const float *in_samples, float *out_samples, int diff_only, + float *in_frame, float *out_dist_frame, + float *windowed_frame, float *clipping_delta, + float *spectrum_buf, float *mask_curve) +{ + AudioPsyClipContext *s = ctx->priv; + const float clip_level_inv = 1.f / s->clip_level; + const float level_out = s->level_out; + float orig_peak = 0; + float peak; + + // shift in/out buffers + for (int i = 0; i < s->fft_size - s->overlap; i++) { + in_frame[i] = in_frame[i + s->overlap]; + out_dist_frame[i] = out_dist_frame[i + s->overlap]; + } + + for (int i = 0; i < s->overlap; i++) { + in_frame[i + s->fft_size - s->overlap] = in_samples[i]; + out_dist_frame[i + s->fft_size - s->overlap] = 0.f; + } + + apply_window(s, in_frame, windowed_frame, 0); + r2c(windowed_frame, s->fft_size); + s->tx_fn(s->tx_ctx[ch], spectrum_buf, windowed_frame, sizeof(float)); + c2r(windowed_frame, s->fft_size); + calculate_mask_curve(s, spectrum_buf, mask_curve); + + // It would be easier to calculate the peak from the unwindowed input. + // This is just for consistency with the clipped peak calculateion + // because the inv_window zeros out samples on the edge of the window. + for (int i = 0; i < s->fft_size; i++) + orig_peak = FFMAX(orig_peak, FFABS(windowed_frame[i] * s->inv_window[i])); + orig_peak *= clip_level_inv; + peak = orig_peak; + + // clear clipping_delta + for (int i = 0; i < s->fft_size * 2; i++) + clipping_delta[i] = 0.f; + + // repeat clipping-filtering process a few times to control both the peaks and the spectrum + for (int i = 0; i < s->iterations; i++) { + float mask_curve_shift = 1.122f; // 1.122 is 1dB + // The last 1/3 of rounds have boosted delta to help reach the peak target faster + float delta_boost = 1.f; + if (i >= s->iterations - s->iterations / 3) { + // boosting the delta when largs peaks are still present is dangerous + if (peak < 2.f) + delta_boost = 2.f; + } + + clip_to_window(s, windowed_frame, clipping_delta, delta_boost); + + r2c(clipping_delta, s->fft_size); + s->tx_fn(s->tx_ctx[ch], spectrum_buf, clipping_delta, sizeof(float)); + + limit_clip_spectrum(s, spectrum_buf, mask_curve); + + s->itx_fn(s->itx_ctx[ch], clipping_delta, spectrum_buf, sizeof(float)); + c2r(clipping_delta, s->fft_size); + + for (int i = 0; i < s->fft_size; i++) + clipping_delta[i] /= s->fft_size; + + peak = 0; + for (int i = 0; i < s->fft_size; i++) + peak = FFMAX(peak, FFABS((windowed_frame[i] + clipping_delta[i]) * s->inv_window[i])); + peak *= clip_level_inv; + + // Automatically adjust mask_curve as necessary to reach peak target + if (orig_peak > 1.f && peak > 1.f) { + float diff_achieved = orig_peak - peak; + if (i + 1 < s->iterations - s->iterations / 3 && diff_achieved > 0) { + float diff_needed = orig_peak - 1.f; + float diff_ratio = diff_needed / diff_achieved; + // If a good amount of peak reduction was already achieved, + // don't shift the mask_curve by the full peak value + // On the other hand, if only a little peak reduction was achieved, + // don't shift the mask_curve by the enormous diff_ratio. + diff_ratio = FFMIN(diff_ratio, peak); + mask_curve_shift = FFMAX(mask_curve_shift, diff_ratio); + } else { + // If the peak got higher than the input or we are in the last 1/3 rounds, + // go back to the heavy-handed peak heuristic. + mask_curve_shift = FFMAX(mask_curve_shift, peak); + } + } + + mask_curve_shift = 1.f + (mask_curve_shift - 1.f) * s->adaptive; + + // Be less strict in the next iteration. + // This helps with peak control. + for (int i = 0; i < s->fft_size / 2 + 1; i++) + mask_curve[i] *= mask_curve_shift; + } + + // do overlap & add + apply_window(s, clipping_delta, out_dist_frame, 1); + + for (int i = 0; i < s->overlap; i++) { + // 4 times overlap with squared hanning window results in 1.5 time increase in amplitude + if (!ctx->is_disabled) { + out_samples[i] = out_dist_frame[i] / 1.5f; + if (!diff_only) + out_samples[i] += in_frame[i]; + if (s->auto_level) + out_samples[i] *= clip_level_inv; + out_samples[i] *= level_out; + } else { + out_samples[i] = in_frame[i]; + } + } +} + +static int psy_channel(AVFilterContext *ctx, AVFrame *in, AVFrame *out, int ch) +{ + AudioPsyClipContext *s = ctx->priv; + const float *src = (const float *)in->extended_data[ch]; + float *in_buffer = (float *)s->in_buffer->extended_data[ch]; + float *dst = (float *)out->extended_data[ch]; + + for (int n = 0; n < s->overlap; n++) + in_buffer[n] = src[n] * s->level_in; + + feed(ctx, ch, in_buffer, dst, s->diff_only, + (float *)(s->in_frame->extended_data[ch]), + (float *)(s->out_dist_frame->extended_data[ch]), + (float *)(s->windowed_frame->extended_data[ch]), + (float *)(s->clipping_delta->extended_data[ch]), + (float *)(s->spectrum_buf->extended_data[ch]), + (float *)(s->mask_curve->extended_data[ch])); + + return 0; +} + +static int psy_channels(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) +{ + AudioPsyClipContext *s = ctx->priv; + AVFrame *out = arg; + const int start = (out->channels * jobnr) / nb_jobs; + const int end = (out->channels * (jobnr+1)) / nb_jobs; + + for (int ch = start; ch < end; ch++) + psy_channel(ctx, s->in, out, ch); + + return 0; +} + +static int filter_frame(AVFilterLink *inlink, AVFrame *in) +{ + AVFilterContext *ctx = inlink->dst; + AVFilterLink *outlink = ctx->outputs[0]; + AudioPsyClipContext *s = ctx->priv; + AVFrame *out; + int ret; + + out = ff_get_audio_buffer(outlink, s->overlap); + if (!out) { + ret = AVERROR(ENOMEM); + goto fail; + } + + s->in = in; + ff_filter_execute(ctx, psy_channels, out, NULL, + FFMIN(outlink->channels, ff_filter_get_nb_threads(ctx))); + + out->pts = in->pts; + out->nb_samples = in->nb_samples; + ret = ff_filter_frame(outlink, out); +fail: + av_frame_free(&in); + s->in = NULL; + return ret < 0 ? ret : 0; +} + +static int activate(AVFilterContext *ctx) +{ + AVFilterLink *inlink = ctx->inputs[0]; + AVFilterLink *outlink = ctx->outputs[0]; + AudioPsyClipContext *s = ctx->priv; + AVFrame *in = NULL; + int ret = 0, status; + int64_t pts; + + FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink); + + ret = ff_inlink_consume_samples(inlink, s->overlap, s->overlap, &in); + if (ret < 0) + return ret; + + if (ret > 0) { + return filter_frame(inlink, in); + } else if (ff_inlink_acknowledge_status(inlink, &status, &pts)) { + ff_outlink_set_status(outlink, status, pts); + return 0; + } else { + if (ff_inlink_queued_samples(inlink) >= s->overlap) { + ff_filter_set_ready(ctx, 10); + } else if (ff_outlink_frame_wanted(outlink)) { + ff_inlink_request_frame(inlink); + } + return 0; + } +} + +static av_cold void uninit(AVFilterContext *ctx) +{ + AudioPsyClipContext *s = ctx->priv; + + av_freep(&s->window); + av_freep(&s->inv_window); + av_freep(&s->spread_table); + av_freep(&s->spread_table_range); + av_freep(&s->spread_table_index); + av_freep(&s->margin_curve); + + av_frame_free(&s->in_buffer); + av_frame_free(&s->in_frame); + av_frame_free(&s->out_dist_frame); + av_frame_free(&s->windowed_frame); + av_frame_free(&s->clipping_delta); + av_frame_free(&s->spectrum_buf); + av_frame_free(&s->mask_curve); + + for (int ch = 0; ch < s->channels; ch++) { + if (s->tx_ctx) + av_tx_uninit(&s->tx_ctx[ch]); + if (s->itx_ctx) + av_tx_uninit(&s->itx_ctx[ch]); + } + + av_freep(&s->tx_ctx); + av_freep(&s->itx_ctx); +} + +static const AVFilterPad inputs[] = { + { + .name = "default", + .type = AVMEDIA_TYPE_AUDIO, + .config_props = config_input, + }, +}; + +static const AVFilterPad outputs[] = { + { + .name = "default", + .type = AVMEDIA_TYPE_AUDIO, + }, +}; + +const AVFilter ff_af_apsyclip = { + .name = "apsyclip", + .description = NULL_IF_CONFIG_SMALL("Audio Psychoacoustic Clipper."), + .query_formats = query_formats, + .priv_size = sizeof(AudioPsyClipContext), + .priv_class = &apsyclip_class, + .uninit = uninit, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), + .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | + AVFILTER_FLAG_SLICE_THREADS, + .activate = activate, + .process_command = ff_filter_process_command, +}; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_apulsator.c b/chromium/third_party/ffmpeg/libavfilter/af_apulsator.c index 56ff4579d6f..b9a194eb9db 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_apulsator.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_apulsator.c @@ -196,8 +196,7 @@ static int query_formats(AVFilterContext *ctx) (ret = ff_set_common_channel_layouts (ctx , layout )) < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static int config_input(AVFilterLink *inlink) @@ -236,7 +235,6 @@ static const AVFilterPad inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -244,7 +242,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_apulsator = { @@ -253,6 +250,6 @@ const AVFilter ff_af_apulsator = { .priv_size = sizeof(AudioPulsatorContext), .priv_class = &apulsator_class, .query_formats = query_formats, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_aresample.c b/chromium/third_party/ffmpeg/libavfilter/af_aresample.c index 1127ad27182..e46369b98dc 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_aresample.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_aresample.c @@ -329,7 +329,6 @@ static const AVFilterPad aresample_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad aresample_outputs[] = { @@ -339,7 +338,6 @@ static const AVFilterPad aresample_outputs[] = { .request_frame = request_frame, .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_aresample = { @@ -350,6 +348,6 @@ const AVFilter ff_af_aresample = { .query_formats = query_formats, .priv_size = sizeof(AResampleContext), .priv_class = &aresample_class, - .inputs = aresample_inputs, - .outputs = aresample_outputs, + FILTER_INPUTS(aresample_inputs), + FILTER_OUTPUTS(aresample_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_arnndn.c b/chromium/third_party/ffmpeg/libavfilter/af_arnndn.c index 0c70a32271f..8225b1657ed 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_arnndn.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_arnndn.c @@ -330,40 +330,28 @@ static int rnnoise_model_from_file(FILE *f, RNNModel **rnn) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }; int ret, sample_rates[] = { 48000, -1 }; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_rates); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_samplerates_from_list(ctx, sample_rates); } static int config_input(AVFilterLink *inlink) { AVFilterContext *ctx = inlink->dst; AudioRNNContext *s = ctx->priv; - int ret; + int ret = 0; s->channels = inlink->channels; @@ -399,7 +387,7 @@ static int config_input(AVFilterLink *inlink) return ret; } - return 0; + return ret; } static void biquad(float *y, float mem[2], const float *x, @@ -1453,8 +1441,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) out->pts = in->pts; td.in = in; td.out = out; - ctx->internal->execute(ctx, rnnoise_channels, &td, NULL, FFMIN(outlink->channels, - ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, rnnoise_channels, &td, NULL, + FFMIN(outlink->channels, ff_filter_get_nb_threads(ctx))); av_frame_free(&in); return ff_filter_frame(outlink, out); @@ -1596,7 +1584,6 @@ static const AVFilterPad inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -1604,7 +1591,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; #define OFFSET(x) offsetof(AudioRNNContext, x) @@ -1628,8 +1614,8 @@ const AVFilter ff_af_arnndn = { .activate = activate, .init = init, .uninit = uninit, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, .process_command = process_command, diff --git a/chromium/third_party/ffmpeg/libavfilter/af_asetnsamples.c b/chromium/third_party/ffmpeg/libavfilter/af_asetnsamples.c index 9987eff8a24..71788f2a76b 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_asetnsamples.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_asetnsamples.c @@ -106,7 +106,6 @@ static const AVFilterPad asetnsamples_inputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; static const AVFilterPad asetnsamples_outputs[] = { @@ -114,7 +113,6 @@ static const AVFilterPad asetnsamples_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_asetnsamples = { @@ -122,7 +120,7 @@ const AVFilter ff_af_asetnsamples = { .description = NULL_IF_CONFIG_SMALL("Set the number of samples for each output audio frames."), .priv_size = sizeof(ASNSContext), .priv_class = &asetnsamples_class, - .inputs = asetnsamples_inputs, - .outputs = asetnsamples_outputs, + FILTER_INPUTS(asetnsamples_inputs), + FILTER_OUTPUTS(asetnsamples_outputs), .activate = activate, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_asetrate.c b/chromium/third_party/ffmpeg/libavfilter/af_asetrate.c index f89185d9367..920baedad23 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_asetrate.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_asetrate.c @@ -94,7 +94,6 @@ static const AVFilterPad asetrate_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad asetrate_outputs[] = { @@ -103,7 +102,6 @@ static const AVFilterPad asetrate_outputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_props, }, - { NULL } }; const AVFilter ff_af_asetrate = { @@ -112,7 +110,7 @@ const AVFilter ff_af_asetrate = { "altering the data."), .query_formats = query_formats, .priv_size = sizeof(ASetRateContext), - .inputs = asetrate_inputs, - .outputs = asetrate_outputs, + FILTER_INPUTS(asetrate_inputs), + FILTER_OUTPUTS(asetrate_outputs), .priv_class = &asetrate_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_ashowinfo.c b/chromium/third_party/ffmpeg/libavfilter/af_ashowinfo.c index db8aa029c4f..b6623fa69d5 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_ashowinfo.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_ashowinfo.c @@ -37,6 +37,8 @@ #include "libavutil/timestamp.h" #include "libavutil/samplefmt.h" +#include "libavcodec/defs.h" + #include "audio.h" #include "avfilter.h" #include "internal.h" @@ -241,7 +243,6 @@ static const AVFilterPad inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -249,7 +250,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_ashowinfo = { @@ -257,6 +257,6 @@ const AVFilter ff_af_ashowinfo = { .description = NULL_IF_CONFIG_SMALL("Show textual information for each audio frame."), .priv_size = sizeof(AShowInfoContext), .uninit = uninit, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_asoftclip.c b/chromium/third_party/ffmpeg/libavfilter/af_asoftclip.c index 17361ba3a2f..9b3d58747a0 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_asoftclip.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_asoftclip.c @@ -21,11 +21,12 @@ #include "libavutil/avassert.h" #include "libavutil/channel_layout.h" #include "libavutil/opt.h" -#include "libswresample/swresample.h" #include "avfilter.h" #include "audio.h" #include "formats.h" +#define MAX_OVERSAMPLE 64 + enum ASoftClipTypes { ASC_HARD = -1, ASC_TANH, @@ -39,6 +40,14 @@ enum ASoftClipTypes { NB_TYPES, }; +typedef struct Lowpass { + float fb0, fb1, fb2; + float fa0, fa1, fa2; + + double db0, db1, db2; + double da0, da1, da2; +} Lowpass; + typedef struct ASoftClipContext { const AVClass *class; @@ -49,10 +58,8 @@ typedef struct ASoftClipContext { double output; double param; - SwrContext *up_ctx; - SwrContext *down_ctx; - - AVFrame *frame; + Lowpass lowpass[MAX_OVERSAMPLE]; + AVFrame *frame[2]; void (*filter)(struct ASoftClipContext *s, void **dst, const void **src, int nb_samples, int channels, int start, int end); @@ -60,7 +67,6 @@ typedef struct ASoftClipContext { #define OFFSET(x) offsetof(ASoftClipContext, x) #define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM -#define F AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM static const AVOption asoftclip_options[] = { { "type", "set softclip type", OFFSET(type), AV_OPT_TYPE_INT, {.i64=0}, -1, NB_TYPES-1, A, "types" }, @@ -76,7 +82,7 @@ static const AVOption asoftclip_options[] = { { "threshold", "set softclip threshold", OFFSET(threshold), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.000001, 1, A }, { "output", "set softclip output gain", OFFSET(output), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.000001, 16, A }, { "param", "set softclip parameter", OFFSET(param), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0.01, 3, A }, - { "oversample", "set oversample factor", OFFSET(oversample), AV_OPT_TYPE_INT, {.i64=1}, 1, 32, F }, + { "oversample", "set oversample factor", OFFSET(oversample), AV_OPT_TYPE_INT, {.i64=1}, 1, MAX_OVERSAMPLE, A }, { NULL } }; @@ -84,32 +90,66 @@ AVFILTER_DEFINE_CLASS(asoftclip); static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { - AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP, - AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP, + AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); +} + +static void get_lowpass(Lowpass *s, + double frequency, + double sample_rate) +{ + double w0 = 2 * M_PI * frequency / sample_rate; + double alpha = sin(w0) / (2 * 0.8); + double factor; + + s->da0 = 1 + alpha; + s->da1 = -2 * cos(w0); + s->da2 = 1 - alpha; + s->db0 = (1 - cos(w0)) / 2; + s->db1 = 1 - cos(w0); + s->db2 = (1 - cos(w0)) / 2; + + s->da1 /= s->da0; + s->da2 /= s->da0; + s->db0 /= s->da0; + s->db1 /= s->da0; + s->db2 /= s->da0; + s->da0 /= s->da0; + + factor = (s->da0 + s->da1 + s->da2) / (s->db0 + s->db1 + s->db2); + s->db0 *= factor; + s->db1 *= factor; + s->db2 *= factor; + + s->fa0 = s->da0; + s->fa1 = s->da1; + s->fa2 = s->da2; + s->fb0 = s->db0; + s->fb1 = s->db1; + s->fb2 = s->db2; +} + +static inline float run_lowpassf(const Lowpass *const s, + float src, float *w) +{ + float dst; + + dst = src * s->fb0 + w[0]; + w[0] = s->fb1 * src + w[1] - s->fa1 * dst; + w[1] = s->fb2 * src - s->fa2 * dst; + + return dst; } static void filter_flt(ASoftClipContext *s, @@ -117,37 +157,51 @@ static void filter_flt(ASoftClipContext *s, int nb_samples, int channels, int start, int end) { + const int oversample = s->oversample; + const int nb_osamples = nb_samples * oversample; + const float scale = oversample > 1 ? oversample * 0.5f : 1.f; float threshold = s->threshold; float gain = s->output * threshold; float factor = 1.f / threshold; float param = s->param; for (int c = start; c < end; c++) { + float *w = (float *)(s->frame[0]->extended_data[c]) + 2 * (oversample - 1); const float *src = sptr[c]; float *dst = dptr[c]; + for (int n = 0; n < nb_samples; n++) { + dst[oversample * n] = src[n]; + + for (int m = 1; m < oversample; m++) + dst[oversample * n + m] = 0.f; + } + + for (int n = 0; n < nb_osamples && oversample > 1; n++) + dst[n] = run_lowpassf(&s->lowpass[oversample - 1], dst[n], w); + switch (s->type) { case ASC_HARD: - for (int n = 0; n < nb_samples; n++) { - dst[n] = av_clipf(src[n] * factor, -1.f, 1.f); + for (int n = 0; n < nb_osamples; n++) { + dst[n] = av_clipf(dst[n] * factor, -1.f, 1.f); dst[n] *= gain; } break; case ASC_TANH: - for (int n = 0; n < nb_samples; n++) { - dst[n] = tanhf(src[n] * factor * param); + for (int n = 0; n < nb_osamples; n++) { + dst[n] = tanhf(dst[n] * factor * param); dst[n] *= gain; } break; case ASC_ATAN: - for (int n = 0; n < nb_samples; n++) { - dst[n] = 2.f / M_PI * atanf(src[n] * factor * param); + for (int n = 0; n < nb_osamples; n++) { + dst[n] = 2.f / M_PI * atanf(dst[n] * factor * param); dst[n] *= gain; } break; case ASC_CUBIC: - for (int n = 0; n < nb_samples; n++) { - float sample = src[n] * factor; + for (int n = 0; n < nb_osamples; n++) { + float sample = dst[n] * factor; if (FFABS(sample) >= 1.5f) dst[n] = FFSIGN(sample); @@ -157,22 +211,22 @@ static void filter_flt(ASoftClipContext *s, } break; case ASC_EXP: - for (int n = 0; n < nb_samples; n++) { - dst[n] = 2.f / (1.f + expf(-2.f * src[n] * factor)) - 1.; + for (int n = 0; n < nb_osamples; n++) { + dst[n] = 2.f / (1.f + expf(-2.f * dst[n] * factor)) - 1.; dst[n] *= gain; } break; case ASC_ALG: - for (int n = 0; n < nb_samples; n++) { - float sample = src[n] * factor; + for (int n = 0; n < nb_osamples; n++) { + float sample = dst[n] * factor; dst[n] = sample / (sqrtf(param + sample * sample)); dst[n] *= gain; } break; case ASC_QUINTIC: - for (int n = 0; n < nb_samples; n++) { - float sample = src[n] * factor; + for (int n = 0; n < nb_osamples; n++) { + float sample = dst[n] * factor; if (FFABS(sample) >= 1.25) dst[n] = FFSIGN(sample); @@ -182,8 +236,8 @@ static void filter_flt(ASoftClipContext *s, } break; case ASC_SIN: - for (int n = 0; n < nb_samples; n++) { - float sample = src[n] * factor; + for (int n = 0; n < nb_osamples; n++) { + float sample = dst[n] * factor; if (FFABS(sample) >= M_PI_2) dst[n] = FFSIGN(sample); @@ -193,53 +247,86 @@ static void filter_flt(ASoftClipContext *s, } break; case ASC_ERF: - for (int n = 0; n < nb_samples; n++) { - dst[n] = erff(src[n] * factor); + for (int n = 0; n < nb_osamples; n++) { + dst[n] = erff(dst[n] * factor); dst[n] *= gain; } break; default: av_assert0(0); } + + w = (float *)(s->frame[1]->extended_data[c]) + 2 * (oversample - 1); + for (int n = 0; n < nb_osamples && oversample > 1; n++) + dst[n] = run_lowpassf(&s->lowpass[oversample - 1], dst[n], w); + + for (int n = 0; n < nb_samples; n++) + dst[n] = dst[n * oversample] * scale; } } +static inline double run_lowpassd(const Lowpass *const s, + double src, double *w) +{ + double dst; + + dst = src * s->db0 + w[0]; + w[0] = s->db1 * src + w[1] - s->da1 * dst; + w[1] = s->db2 * src - s->da2 * dst; + + return dst; +} + static void filter_dbl(ASoftClipContext *s, void **dptr, const void **sptr, int nb_samples, int channels, int start, int end) { + const int oversample = s->oversample; + const int nb_osamples = nb_samples * oversample; + const double scale = oversample > 1 ? oversample * 0.5 : 1.; double threshold = s->threshold; double gain = s->output * threshold; double factor = 1. / threshold; double param = s->param; for (int c = start; c < end; c++) { + double *w = (double *)(s->frame[0]->extended_data[c]) + 2 * (oversample - 1); const double *src = sptr[c]; double *dst = dptr[c]; + for (int n = 0; n < nb_samples; n++) { + dst[oversample * n] = src[n]; + + for (int m = 1; m < oversample; m++) + dst[oversample * n + m] = 0.f; + } + + for (int n = 0; n < nb_osamples && oversample > 1; n++) + dst[n] = run_lowpassd(&s->lowpass[oversample - 1], dst[n], w); + switch (s->type) { case ASC_HARD: - for (int n = 0; n < nb_samples; n++) { - dst[n] = av_clipd(src[n] * factor, -1., 1.); + for (int n = 0; n < nb_osamples; n++) { + dst[n] = av_clipd(dst[n] * factor, -1., 1.); dst[n] *= gain; } break; case ASC_TANH: - for (int n = 0; n < nb_samples; n++) { - dst[n] = tanh(src[n] * factor * param); + for (int n = 0; n < nb_osamples; n++) { + dst[n] = tanh(dst[n] * factor * param); dst[n] *= gain; } break; case ASC_ATAN: - for (int n = 0; n < nb_samples; n++) { - dst[n] = 2. / M_PI * atan(src[n] * factor * param); + for (int n = 0; n < nb_osamples; n++) { + dst[n] = 2. / M_PI * atan(dst[n] * factor * param); dst[n] *= gain; } break; case ASC_CUBIC: - for (int n = 0; n < nb_samples; n++) { - double sample = src[n] * factor; + for (int n = 0; n < nb_osamples; n++) { + double sample = dst[n] * factor; if (FFABS(sample) >= 1.5) dst[n] = FFSIGN(sample); @@ -249,22 +336,22 @@ static void filter_dbl(ASoftClipContext *s, } break; case ASC_EXP: - for (int n = 0; n < nb_samples; n++) { - dst[n] = 2. / (1. + exp(-2. * src[n] * factor)) - 1.; + for (int n = 0; n < nb_osamples; n++) { + dst[n] = 2. / (1. + exp(-2. * dst[n] * factor)) - 1.; dst[n] *= gain; } break; case ASC_ALG: - for (int n = 0; n < nb_samples; n++) { - double sample = src[n] * factor; + for (int n = 0; n < nb_osamples; n++) { + double sample = dst[n] * factor; dst[n] = sample / (sqrt(param + sample * sample)); dst[n] *= gain; } break; case ASC_QUINTIC: - for (int n = 0; n < nb_samples; n++) { - double sample = src[n] * factor; + for (int n = 0; n < nb_osamples; n++) { + double sample = dst[n] * factor; if (FFABS(sample) >= 1.25) dst[n] = FFSIGN(sample); @@ -274,8 +361,8 @@ static void filter_dbl(ASoftClipContext *s, } break; case ASC_SIN: - for (int n = 0; n < nb_samples; n++) { - double sample = src[n] * factor; + for (int n = 0; n < nb_osamples; n++) { + double sample = dst[n] * factor; if (FFABS(sample) >= M_PI_2) dst[n] = FFSIGN(sample); @@ -285,14 +372,21 @@ static void filter_dbl(ASoftClipContext *s, } break; case ASC_ERF: - for (int n = 0; n < nb_samples; n++) { - dst[n] = erf(src[n] * factor); + for (int n = 0; n < nb_osamples; n++) { + dst[n] = erf(dst[n] * factor); dst[n] *= gain; } break; default: av_assert0(0); } + + w = (double *)(s->frame[1]->extended_data[c]) + 2 * (oversample - 1); + for (int n = 0; n < nb_osamples && oversample > 1; n++) + dst[n] = run_lowpassd(&s->lowpass[oversample - 1], dst[n], w); + + for (int n = 0; n < nb_samples; n++) + dst[n] = dst[n * oversample] * scale; } } @@ -300,47 +394,21 @@ static int config_input(AVFilterLink *inlink) { AVFilterContext *ctx = inlink->dst; ASoftClipContext *s = ctx->priv; - int ret; switch (inlink->format) { - case AV_SAMPLE_FMT_FLT: case AV_SAMPLE_FMT_FLTP: s->filter = filter_flt; break; - case AV_SAMPLE_FMT_DBL: case AV_SAMPLE_FMT_DBLP: s->filter = filter_dbl; break; default: av_assert0(0); } - if (s->oversample <= 1) - return 0; - - s->up_ctx = swr_alloc(); - s->down_ctx = swr_alloc(); - if (!s->up_ctx || !s->down_ctx) + s->frame[0] = ff_get_audio_buffer(inlink, 2 * MAX_OVERSAMPLE); + s->frame[1] = ff_get_audio_buffer(inlink, 2 * MAX_OVERSAMPLE); + if (!s->frame[0] || !s->frame[1]) return AVERROR(ENOMEM); - av_opt_set_int(s->up_ctx, "in_channel_layout", inlink->channel_layout, 0); - av_opt_set_int(s->up_ctx, "in_sample_rate", inlink->sample_rate, 0); - av_opt_set_sample_fmt(s->up_ctx, "in_sample_fmt", inlink->format, 0); - - av_opt_set_int(s->up_ctx, "out_channel_layout", inlink->channel_layout, 0); - av_opt_set_int(s->up_ctx, "out_sample_rate", inlink->sample_rate * s->oversample, 0); - av_opt_set_sample_fmt(s->up_ctx, "out_sample_fmt", inlink->format, 0); - - av_opt_set_int(s->down_ctx, "in_channel_layout", inlink->channel_layout, 0); - av_opt_set_int(s->down_ctx, "in_sample_rate", inlink->sample_rate * s->oversample, 0); - av_opt_set_sample_fmt(s->down_ctx, "in_sample_fmt", inlink->format, 0); - - av_opt_set_int(s->down_ctx, "out_channel_layout", inlink->channel_layout, 0); - av_opt_set_int(s->down_ctx, "out_sample_rate", inlink->sample_rate, 0); - av_opt_set_sample_fmt(s->down_ctx, "out_sample_fmt", inlink->format, 0); - - ret = swr_init(s->up_ctx); - if (ret < 0) - return ret; - - ret = swr_init(s->down_ctx); - if (ret < 0) - return ret; + for (int i = 0; i < MAX_OVERSAMPLE; i++) { + get_lowpass(&s->lowpass[i], inlink->sample_rate / 2, inlink->sample_rate * (i + 1)); + } return 0; } @@ -373,14 +441,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) AVFilterContext *ctx = inlink->dst; ASoftClipContext *s = ctx->priv; AVFilterLink *outlink = ctx->outputs[0]; - int ret, nb_samples, channels; + int nb_samples, channels; ThreadData td; AVFrame *out; - if (av_frame_is_writable(in)) { + if (av_frame_is_writable(in) && s->oversample == 1) { out = in; } else { - out = ff_get_audio_buffer(outlink, in->nb_samples); + out = ff_get_audio_buffer(outlink, in->nb_samples * s->oversample); if (!out) { av_frame_free(&in); return AVERROR(ENOMEM); @@ -388,72 +456,29 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) av_frame_copy_props(out, in); } - if (av_sample_fmt_is_planar(in->format)) { - nb_samples = in->nb_samples; - channels = in->channels; - } else { - nb_samples = in->channels * in->nb_samples; - channels = 1; - } + nb_samples = in->nb_samples; + channels = in->channels; - if (s->oversample > 1) { - s->frame = ff_get_audio_buffer(outlink, in->nb_samples * s->oversample); - if (!s->frame) { - ret = AVERROR(ENOMEM); - goto fail; - } - - ret = swr_convert(s->up_ctx, (uint8_t**)s->frame->extended_data, in->nb_samples * s->oversample, - (const uint8_t **)in->extended_data, in->nb_samples); - if (ret < 0) - goto fail; - - td.in = s->frame; - td.out = s->frame; - td.nb_samples = av_sample_fmt_is_planar(in->format) ? ret : ret * in->channels; - td.channels = channels; - ctx->internal->execute(ctx, filter_channels, &td, NULL, FFMIN(channels, - ff_filter_get_nb_threads(ctx))); - - ret = swr_convert(s->down_ctx, (uint8_t**)out->extended_data, out->nb_samples, - (const uint8_t **)s->frame->extended_data, ret); - if (ret < 0) - goto fail; - - if (out->pts) - out->pts -= s->delay; - s->delay += in->nb_samples - ret; - out->nb_samples = ret; - - av_frame_free(&s->frame); - } else { - td.in = in; - td.out = out; - td.nb_samples = nb_samples; - td.channels = channels; - ctx->internal->execute(ctx, filter_channels, &td, NULL, FFMIN(channels, - ff_filter_get_nb_threads(ctx))); - } + td.in = in; + td.out = out; + td.nb_samples = nb_samples; + td.channels = channels; + ff_filter_execute(ctx, filter_channels, &td, NULL, + FFMIN(channels, ff_filter_get_nb_threads(ctx))); if (out != in) av_frame_free(&in); + out->nb_samples /= s->oversample; return ff_filter_frame(outlink, out); -fail: - if (out != in) - av_frame_free(&out); - av_frame_free(&in); - av_frame_free(&s->frame); - - return ret; } static av_cold void uninit(AVFilterContext *ctx) { ASoftClipContext *s = ctx->priv; - swr_free(&s->up_ctx); - swr_free(&s->down_ctx); + av_frame_free(&s->frame[0]); + av_frame_free(&s->frame[1]); } static const AVFilterPad inputs[] = { @@ -463,7 +488,6 @@ static const AVFilterPad inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -471,7 +495,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_asoftclip = { @@ -480,8 +503,8 @@ const AVFilter ff_af_asoftclip = { .query_formats = query_formats, .priv_size = sizeof(ASoftClipContext), .priv_class = &asoftclip_class, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .uninit = uninit, .process_command = ff_filter_process_command, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | diff --git a/chromium/third_party/ffmpeg/libavfilter/af_asr.c b/chromium/third_party/ffmpeg/libavfilter/af_asr.c index b34cdd38eed..c7dc3b2db62 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_asr.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_asr.c @@ -133,7 +133,7 @@ static int query_formats(AVFilterContext *ctx) (ret = ff_set_common_formats (ctx , formats )) < 0 || (ret = ff_add_channel_layout (&layout , AV_CH_LAYOUT_MONO )) < 0 || (ret = ff_set_common_channel_layouts (ctx , layout )) < 0 || - (ret = ff_set_common_samplerates (ctx , ff_make_format_list(sample_rates) )) < 0) + (ret = ff_set_common_samplerates_from_list(ctx, sample_rates )) < 0) return ret; return 0; @@ -156,7 +156,6 @@ static const AVFilterPad asr_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad asr_outputs[] = { @@ -164,7 +163,6 @@ static const AVFilterPad asr_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_asr = { @@ -175,6 +173,6 @@ const AVFilter ff_af_asr = { .init = asr_init, .uninit = asr_uninit, .query_formats = query_formats, - .inputs = asr_inputs, - .outputs = asr_outputs, + FILTER_INPUTS(asr_inputs), + FILTER_OUTPUTS(asr_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_astats.c b/chromium/third_party/ffmpeg/libavfilter/af_astats.c index 23a5785d5a8..899746864dd 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_astats.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_astats.c @@ -57,6 +57,7 @@ #define MEASURE_NUMBER_OF_DENORMALS (1 << 21) #define MEASURE_NOISE_FLOOR (1 << 22) #define MEASURE_NOISE_FLOOR_COUNT (1 << 23) +#define MEASURE_ENTROPY (1 << 24) #define MEASURE_MINMAXPEAK (MEASURE_MIN_LEVEL | MEASURE_MAX_LEVEL | MEASURE_PEAK_LEVEL) @@ -82,10 +83,12 @@ typedef struct ChannelStats { uint64_t nb_infs; uint64_t nb_denormals; double *win_samples; - unsigned histogram[HISTOGRAM_SIZE]; + uint64_t histogram[HISTOGRAM_SIZE]; + uint64_t ehistogram[HISTOGRAM_SIZE]; int win_pos; int max_index; double noise_floor; + double entropy; } ChannelStats; typedef struct AudioStatsContext { @@ -109,7 +112,7 @@ typedef struct AudioStatsContext { #define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM static const AVOption astats_options[] = { - { "length", "set the window length", OFFSET(time_constant), AV_OPT_TYPE_DOUBLE, {.dbl=.05}, .01, 10, FLAGS }, + { "length", "set the window length", OFFSET(time_constant), AV_OPT_TYPE_DOUBLE, {.dbl=.05}, 0, 10, FLAGS }, { "metadata", "inject metadata in the filtergraph", OFFSET(metadata), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS }, { "reset", "recalculate stats after this many frames", OFFSET(reset_count), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX, FLAGS }, { "measure_perchannel", "only measure_perchannel these per-channel statistics", OFFSET(measure_perchannel), AV_OPT_TYPE_FLAGS, {.i64=MEASURE_ALL}, 0, UINT_MAX, FLAGS, "measure" }, @@ -135,6 +138,7 @@ static const AVOption astats_options[] = { { "Zero_crossings_rate" , "", 0, AV_OPT_TYPE_CONST, {.i64=MEASURE_ZERO_CROSSINGS_RATE }, 0, 0, FLAGS, "measure" }, { "Noise_floor" , "", 0, AV_OPT_TYPE_CONST, {.i64=MEASURE_NOISE_FLOOR }, 0, 0, FLAGS, "measure" }, { "Noise_floor_count" , "", 0, AV_OPT_TYPE_CONST, {.i64=MEASURE_NOISE_FLOOR_COUNT }, 0, 0, FLAGS, "measure" }, + { "Entropy" , "", 0, AV_OPT_TYPE_CONST, {.i64=MEASURE_ENTROPY }, 0, 0, FLAGS, "measure" }, { "Number_of_samples" , "", 0, AV_OPT_TYPE_CONST, {.i64=MEASURE_NUMBER_OF_SAMPLES }, 0, 0, FLAGS, "measure" }, { "Number_of_NaNs" , "", 0, AV_OPT_TYPE_CONST, {.i64=MEASURE_NUMBER_OF_NANS }, 0, 0, FLAGS, "measure" }, { "Number_of_Infs" , "", 0, AV_OPT_TYPE_CONST, {.i64=MEASURE_NUMBER_OF_INFS }, 0, 0, FLAGS, "measure" }, @@ -147,8 +151,6 @@ AVFILTER_DEFINE_CLASS(astats); static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32P, @@ -157,26 +159,15 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static void reset_stats(AudioStatsContext *s) @@ -212,9 +203,11 @@ static void reset_stats(AudioStatsContext *s) p->last = NAN; p->noise_floor = NAN; p->noise_floor_count = 0; + p->entropy = 0; p->win_pos = 0; memset(p->win_samples, 0, s->tc_samples * sizeof(*p->win_samples)); memset(p->histogram, 0, sizeof(p->histogram)); + memset(p->ehistogram, 0, sizeof(p->ehistogram)); } } @@ -226,7 +219,7 @@ static int config_output(AVFilterLink *outlink) if (!s->chstats) return AVERROR(ENOMEM); - s->tc_samples = 5 * s->time_constant * outlink->sample_rate + .5; + s->tc_samples = FFMAX(s->time_constant * outlink->sample_rate + .5, 1); s->nb_channels = outlink->channels; for (int i = 0; i < s->nb_channels; i++) { @@ -267,6 +260,20 @@ static void bit_depth(AudioStatsContext *s, uint64_t mask, uint64_t imask, AVRat depth->num++; } +static double calc_entropy(AudioStatsContext *s, ChannelStats *p) +{ + double entropy = 0.; + + for (int i = 0; i < HISTOGRAM_SIZE; i++) { + double entry = p->ehistogram[i] / ((double)p->nb_samples); + + if (entry > 1e-8) + entropy += entry * log2(entry); + } + + return -entropy / log2(HISTOGRAM_SIZE); +} + static inline void update_minmax(AudioStatsContext *s, ChannelStats *p, double d) { if (d < p->min) @@ -332,6 +339,7 @@ static inline void update_stat(AudioStatsContext *s, ChannelStats *p, double d, index = av_clip(lrint(av_clipd(FFABS(nd), 0.0, 1.0) * HISTOGRAM_MAX), 0, HISTOGRAM_MAX); p->max_index = FFMAX(p->max_index, index); p->histogram[index]++; + p->ehistogram[index]++; if (!isnan(p->noise_floor)) p->histogram[av_clip(lrint(av_clipd(FFABS(drop), 0.0, 1.0) * HISTOGRAM_MAX), 0, HISTOGRAM_MAX)]--; p->win_pos++; @@ -419,6 +427,7 @@ static void set_metadata(AudioStatsContext *s, AVDictionary **metadata) sigma_x = 0, sigma_x2 = 0, noise_floor = 0, + entropy = 0, min_sigma_x2 = DBL_MAX, max_sigma_x2 =-DBL_MAX; AVRational depth; @@ -444,6 +453,8 @@ static void set_metadata(AudioStatsContext *s, AVDictionary **metadata) sigma_x2 += p->sigma_x2; noise_floor = FFMAX(noise_floor, p->noise_floor); noise_floor_count += p->noise_floor_count; + p->entropy = calc_entropy(s, p); + entropy += p->entropy; min_count += p->min_count; max_count += p->max_count; min_runs += p->min_runs; @@ -489,6 +500,8 @@ static void set_metadata(AudioStatsContext *s, AVDictionary **metadata) set_meta(metadata, c + 1, "Noise_floor", "%f", LINEAR_TO_DB(p->noise_floor)); if (s->measure_perchannel & MEASURE_NOISE_FLOOR_COUNT) set_meta(metadata, c + 1, "Noise_floor_count", "%f", p->noise_floor_count); + if (s->measure_perchannel & MEASURE_ENTROPY) + set_meta(metadata, c + 1, "Entropy", "%f", p->entropy); if (s->measure_perchannel & MEASURE_BIT_DEPTH) { bit_depth(s, p->mask, p->imask, &depth); set_meta(metadata, c + 1, "Bit_depth", "%f", depth.num); @@ -538,6 +551,8 @@ static void set_metadata(AudioStatsContext *s, AVDictionary **metadata) set_meta(metadata, 0, "Overall.Noise_floor", "%f", LINEAR_TO_DB(noise_floor)); if (s->measure_overall & MEASURE_NOISE_FLOOR_COUNT) set_meta(metadata, 0, "Overall.Noise_floor_count", "%f", noise_floor_count / (double)s->nb_channels); + if (s->measure_overall & MEASURE_ENTROPY) + set_meta(metadata, 0, "Overall.Entropy", "%f", entropy / (double)s->nb_channels); if (s->measure_overall & MEASURE_BIT_DEPTH) { bit_depth(s, mask, imask, &depth); set_meta(metadata, 0, "Overall.Bit_depth", "%f", depth.num); @@ -645,7 +660,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf) s->nb_frames++; } - ctx->internal->execute(ctx, filter_channel, buf, NULL, FFMIN(inlink->channels, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_channel, buf, NULL, + FFMIN(inlink->channels, ff_filter_get_nb_threads(ctx))); if (s->metadata) set_metadata(s, metadata); @@ -667,6 +683,7 @@ static void print_stats(AVFilterContext *ctx) sigma_x = 0, sigma_x2 = 0, noise_floor = 0, + entropy = 0, min_sigma_x2 = DBL_MAX, max_sigma_x2 =-DBL_MAX; AVRational depth; @@ -691,6 +708,8 @@ static void print_stats(AVFilterContext *ctx) sigma_x += p->sigma_x; sigma_x2 += p->sigma_x2; noise_floor = FFMAX(noise_floor, p->noise_floor); + p->entropy = calc_entropy(s, p); + entropy += p->entropy; min_count += p->min_count; max_count += p->max_count; noise_floor_count += p->noise_floor_count; @@ -740,6 +759,8 @@ static void print_stats(AVFilterContext *ctx) av_log(ctx, AV_LOG_INFO, "Noise floor dB: %f\n", LINEAR_TO_DB(p->noise_floor)); if (s->measure_perchannel & MEASURE_NOISE_FLOOR_COUNT) av_log(ctx, AV_LOG_INFO, "Noise floor count: %"PRId64"\n", p->noise_floor_count); + if (s->measure_perchannel & MEASURE_ENTROPY) + av_log(ctx, AV_LOG_INFO, "Entropy: %f\n", p->entropy); if (s->measure_perchannel & MEASURE_BIT_DEPTH) { bit_depth(s, p->mask, p->imask, &depth); av_log(ctx, AV_LOG_INFO, "Bit depth: %u/%u\n", depth.num, depth.den); @@ -791,6 +812,8 @@ static void print_stats(AVFilterContext *ctx) av_log(ctx, AV_LOG_INFO, "Noise floor dB: %f\n", LINEAR_TO_DB(noise_floor)); if (s->measure_overall & MEASURE_NOISE_FLOOR_COUNT) av_log(ctx, AV_LOG_INFO, "Noise floor count: %f\n", noise_floor_count / (double)s->nb_channels); + if (s->measure_overall & MEASURE_ENTROPY) + av_log(ctx, AV_LOG_INFO, "Entropy: %f\n", entropy / (double)s->nb_channels); if (s->measure_overall & MEASURE_BIT_DEPTH) { bit_depth(s, mask, imask, &depth); av_log(ctx, AV_LOG_INFO, "Bit depth: %u/%u\n", depth.num, depth.den); @@ -827,7 +850,6 @@ static const AVFilterPad astats_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad astats_outputs[] = { @@ -836,7 +858,6 @@ static const AVFilterPad astats_outputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_af_astats = { @@ -846,7 +867,7 @@ const AVFilter ff_af_astats = { .priv_size = sizeof(AudioStatsContext), .priv_class = &astats_class, .uninit = uninit, - .inputs = astats_inputs, - .outputs = astats_outputs, + FILTER_INPUTS(astats_inputs), + FILTER_OUTPUTS(astats_outputs), .flags = AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_asubboost.c b/chromium/third_party/ffmpeg/libavfilter/af_asubboost.c index f36ce815523..7543601b8a7 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_asubboost.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_asubboost.c @@ -46,31 +46,19 @@ typedef struct ASubBoostContext { static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static int get_coeffs(AVFilterContext *ctx) @@ -181,8 +169,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) } td.in = in; td.out = out; - ctx->internal->execute(ctx, filter_channels, &td, NULL, FFMIN(inlink->channels, - ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_channels, &td, NULL, + FFMIN(inlink->channels, ff_filter_get_nb_threads(ctx))); if (out != in) av_frame_free(&in); @@ -233,7 +221,6 @@ static const AVFilterPad inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -241,7 +228,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_asubboost = { @@ -251,8 +237,8 @@ const AVFilter ff_af_asubboost = { .priv_size = sizeof(ASubBoostContext), .priv_class = &asubboost_class, .uninit = uninit, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .process_command = process_command, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, diff --git a/chromium/third_party/ffmpeg/libavfilter/af_asupercut.c b/chromium/third_party/ffmpeg/libavfilter/af_asupercut.c index 54921cf4c32..bd8b1cf44a7 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_asupercut.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_asupercut.c @@ -51,32 +51,20 @@ typedef struct ASuperCutContext { static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static void calc_q_factors(int n, double *q) @@ -311,8 +299,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) } td.in = in; td.out = out; - ctx->internal->execute(ctx, s->filter_channels, &td, NULL, FFMIN(inlink->channels, - ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->filter_channels, &td, NULL, + FFMIN(inlink->channels, ff_filter_get_nb_threads(ctx))); if (out != in) av_frame_free(&in); @@ -357,7 +345,6 @@ static const AVFilterPad inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -365,7 +352,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_asupercut = { @@ -375,8 +361,8 @@ const AVFilter ff_af_asupercut = { .priv_size = sizeof(ASuperCutContext), .priv_class = &asupercut_class, .uninit = uninit, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .process_command = process_command, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, @@ -398,8 +384,8 @@ const AVFilter ff_af_asubcut = { .priv_size = sizeof(ASuperCutContext), .priv_class = &asubcut_class, .uninit = uninit, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .process_command = process_command, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, @@ -423,8 +409,8 @@ const AVFilter ff_af_asuperpass = { .priv_size = sizeof(ASuperCutContext), .priv_class = &asuperpass_class, .uninit = uninit, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .process_command = process_command, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, @@ -440,8 +426,8 @@ const AVFilter ff_af_asuperstop = { .priv_size = sizeof(ASuperCutContext), .priv_class = &asuperstop_class, .uninit = uninit, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .process_command = process_command, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, diff --git a/chromium/third_party/ffmpeg/libavfilter/af_atempo.c b/chromium/third_party/ffmpeg/libavfilter/af_atempo.c index 80a33c43ede..16fa59701a5 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_atempo.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_atempo.c @@ -995,9 +995,6 @@ static av_cold void uninit(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterChannelLayouts *layouts = NULL; - AVFilterFormats *formats = NULL; - // WSOLA necessitates an internal sliding window ring buffer // for incoming audio stream. // @@ -1012,29 +1009,15 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) { - return AVERROR(ENOMEM); - } - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) { - return AVERROR(ENOMEM); - } - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) { - return AVERROR(ENOMEM); - } - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static int config_props(AVFilterLink *inlink) @@ -1190,7 +1173,6 @@ static const AVFilterPad atempo_inputs[] = { .filter_frame = filter_frame, .config_props = config_props, }, - { NULL } }; static const AVFilterPad atempo_outputs[] = { @@ -1199,7 +1181,6 @@ static const AVFilterPad atempo_outputs[] = { .request_frame = request_frame, .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_atempo = { @@ -1211,6 +1192,6 @@ const AVFilter ff_af_atempo = { .process_command = process_command, .priv_size = sizeof(ATempoContext), .priv_class = &atempo_class, - .inputs = atempo_inputs, - .outputs = atempo_outputs, + FILTER_INPUTS(atempo_inputs), + FILTER_OUTPUTS(atempo_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_atilt.c b/chromium/third_party/ffmpeg/libavfilter/af_atilt.c new file mode 100644 index 00000000000..833e0c571b8 --- /dev/null +++ b/chromium/third_party/ffmpeg/libavfilter/af_atilt.c @@ -0,0 +1,287 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/channel_layout.h" +#include "libavutil/ffmath.h" +#include "libavutil/opt.h" +#include "avfilter.h" +#include "audio.h" +#include "formats.h" + +#define MAX_ORDER 30 + +typedef struct Coeffs { + double g; + double a1; + double b0, b1; +} Coeffs; + +typedef struct ATiltContext { + const AVClass *class; + + double freq; + double level; + double slope; + double width; + int order; + + Coeffs coeffs[MAX_ORDER]; + + AVFrame *w; + + int (*filter_channels)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs); +} ATiltContext; + +static int query_formats(AVFilterContext *ctx) +{ + static const enum AVSampleFormat sample_fmts[] = { + AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP, + AV_SAMPLE_FMT_NONE + }; + int ret; + + ret = ff_set_common_formats_from_list(ctx, sample_fmts); + if (ret < 0) + return ret; + + ret = ff_set_common_all_channel_counts(ctx); + if (ret < 0) + return ret; + + return ff_set_common_all_samplerates(ctx); +} + +static double prewarp(double w, double T, double wp) +{ + return wp * tan(w * T * 0.5) / tan(wp * T * 0.5); +} + +static double mz(int i, double w0, double r, double alpha) +{ + return w0 * pow(r, -alpha + i); +} + +static double mp(int i, double w0, double r) +{ + return w0 * pow(r, i); +} + +static double mzh(int i, double T, double w0, double r, double alpha) +{ + return prewarp(mz(i, w0, r, alpha), T, w0); +} + +static double mph(int i, double T, double w0, double r) +{ + return prewarp(mp(i, w0, r), T, w0); +} + +static void set_tf1s(Coeffs *coeffs, double b1, double b0, double a0, + double w1, double sr, double alpha) +{ + double c = 1.0 / tan(w1 * 0.5 / sr); + double d = a0 + c; + + coeffs->b1 = (b0 - b1 * c) / d; + coeffs->b0 = (b0 + b1 * c) / d; + coeffs->a1 = (a0 - c) / d; + coeffs->g = a0 / b0; +} + +static void set_filter(AVFilterContext *ctx, + int order, double sr, double f0, + double bw, double alpha) +{ + ATiltContext *s = ctx->priv; + const double w0 = 2. * M_PI * f0; + const double f1 = f0 + bw; + const double w1 = 1.; + const double r = pow(f1 / f0, 1.0 / (order - 1.0)); + const double T = 1. / sr; + + for (int i = 0; i < order; i++) { + Coeffs *coeffs = &s->coeffs[i]; + + set_tf1s(coeffs, 1.0, mzh(i, T, w0, r, alpha), mph(i, T, w0, r), + w1, sr, alpha); + } +} + +static int get_coeffs(AVFilterContext *ctx) +{ + ATiltContext *s = ctx->priv; + AVFilterLink *inlink = ctx->inputs[0]; + + set_filter(ctx, s->order, inlink->sample_rate, s->freq, s->width, s->slope); + + return 0; +} + +typedef struct ThreadData { + AVFrame *in, *out; +} ThreadData; + +#define FILTER(name, type) \ +static int filter_channels_## name(AVFilterContext *ctx, void *arg, \ + int jobnr, int nb_jobs) \ +{ \ + ATiltContext *s = ctx->priv; \ + ThreadData *td = arg; \ + AVFrame *out = td->out; \ + AVFrame *in = td->in; \ + const int start = (in->channels * jobnr) / nb_jobs; \ + const int end = (in->channels * (jobnr+1)) / nb_jobs; \ + const type level = s->level; \ + \ + for (int ch = start; ch < end; ch++) { \ + const type *src = (const type *)in->extended_data[ch]; \ + type *dst = (type *)out->extended_data[ch]; \ + \ + for (int b = 0; b < s->order; b++) { \ + Coeffs *coeffs = &s->coeffs[b]; \ + const type g = coeffs->g; \ + const type a1 = coeffs->a1; \ + const type b0 = coeffs->b0; \ + const type b1 = coeffs->b1; \ + type *w = ((type *)s->w->extended_data[ch]) + b * 2; \ + \ + for (int n = 0; n < in->nb_samples; n++) { \ + type sain = b ? dst[n] : src[n] * level; \ + type saout = sain * b0 + w[0] * b1 - w[1] * a1; \ + \ + w[0] = sain; \ + w[1] = saout; \ + \ + dst[n] = saout * g; \ + } \ + } \ + } \ + \ + return 0; \ +} + +FILTER(fltp, float) +FILTER(dblp, double) + +static int config_input(AVFilterLink *inlink) +{ + AVFilterContext *ctx = inlink->dst; + ATiltContext *s = ctx->priv; + + switch (inlink->format) { + case AV_SAMPLE_FMT_FLTP: s->filter_channels = filter_channels_fltp; break; + case AV_SAMPLE_FMT_DBLP: s->filter_channels = filter_channels_dblp; break; + } + + s->w = ff_get_audio_buffer(inlink, 2 * MAX_ORDER); + if (!s->w) + return AVERROR(ENOMEM); + + return get_coeffs(ctx); +} + +static int filter_frame(AVFilterLink *inlink, AVFrame *in) +{ + AVFilterContext *ctx = inlink->dst; + ATiltContext *s = ctx->priv; + AVFilterLink *outlink = ctx->outputs[0]; + ThreadData td; + AVFrame *out; + + if (av_frame_is_writable(in)) { + out = in; + } else { + out = ff_get_audio_buffer(outlink, in->nb_samples); + if (!out) { + av_frame_free(&in); + return AVERROR(ENOMEM); + } + av_frame_copy_props(out, in); + } + + td.in = in; td.out = out; + ctx->internal->execute(ctx, s->filter_channels, &td, NULL, FFMIN(inlink->channels, + ff_filter_get_nb_threads(ctx))); + + if (out != in) + av_frame_free(&in); + return ff_filter_frame(outlink, out); +} + +static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, + char *res, int res_len, int flags) +{ + int ret; + + ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags); + if (ret < 0) + return ret; + + return get_coeffs(ctx); +} + +static av_cold void uninit(AVFilterContext *ctx) +{ + ATiltContext *s = ctx->priv; + + av_frame_free(&s->w); +} + +#define OFFSET(x) offsetof(ATiltContext, x) +#define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM + +static const AVOption atilt_options[] = { + { "freq", "set central frequency",OFFSET(freq), AV_OPT_TYPE_DOUBLE, {.dbl=10000}, 20, 192000, FLAGS }, + { "slope", "set filter slope", OFFSET(slope), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -1, 1, FLAGS }, + { "width", "set filter width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=1000}, 100, 10000, FLAGS }, + { "order", "set filter order", OFFSET(order), AV_OPT_TYPE_INT, {.i64=5}, 2,MAX_ORDER, FLAGS }, + { "level", "set input level", OFFSET(level), AV_OPT_TYPE_DOUBLE, {.dbl=1.}, 0., 4., FLAGS }, + { NULL } +}; + +AVFILTER_DEFINE_CLASS(atilt); + +static const AVFilterPad inputs[] = { + { + .name = "default", + .type = AVMEDIA_TYPE_AUDIO, + .filter_frame = filter_frame, + .config_props = config_input, + }, +}; + +static const AVFilterPad outputs[] = { + { + .name = "default", + .type = AVMEDIA_TYPE_AUDIO, + }, +}; + +AVFilter ff_af_atilt = { + .name = "atilt", + .description = NULL_IF_CONFIG_SMALL("Apply spectral tilt to audio."), + .query_formats = query_formats, + .priv_size = sizeof(ATiltContext), + .priv_class = &atilt_class, + .uninit = uninit, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), + .process_command = process_command, + .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | + AVFILTER_FLAG_SLICE_THREADS, +}; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_axcorrelate.c b/chromium/third_party/ffmpeg/libavfilter/af_axcorrelate.c index cec39dee760..18fc3004b10 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_axcorrelate.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_axcorrelate.c @@ -48,32 +48,19 @@ typedef struct AudioXCorrelateContext { static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static float mean_sum(const float *in, int size) @@ -339,7 +326,6 @@ static const AVFilterPad inputs[] = { .name = "axcorrelate1", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -348,7 +334,6 @@ static const AVFilterPad outputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_output, }, - { NULL } }; #define AF AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM @@ -372,6 +357,6 @@ const AVFilter ff_af_axcorrelate = { .query_formats = query_formats, .activate = activate, .uninit = uninit, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_biquads.c b/chromium/third_party/ffmpeg/libavfilter/af_biquads.c index 0baf5541fd3..c110734458e 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_biquads.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_biquads.c @@ -146,8 +146,6 @@ typedef struct BiquadsContext { static int query_formats(AVFilterContext *ctx) { BiquadsContext *s = ctx->priv; - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat auto_sample_fmts[] = { AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S32P, @@ -159,46 +157,33 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + const enum AVSampleFormat *sample_fmts_list = sample_fmts; + int ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; switch (s->precision) { case 0: sample_fmts[0] = AV_SAMPLE_FMT_S16P; - formats = ff_make_format_list(sample_fmts); break; case 1: sample_fmts[0] = AV_SAMPLE_FMT_S32P; - formats = ff_make_format_list(sample_fmts); break; case 2: sample_fmts[0] = AV_SAMPLE_FMT_FLTP; - formats = ff_make_format_list(sample_fmts); break; case 3: sample_fmts[0] = AV_SAMPLE_FMT_DBLP; - formats = ff_make_format_list(sample_fmts); break; default: - formats = ff_make_format_list(auto_sample_fmts); + sample_fmts_list = auto_sample_fmts; break; } - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts_list); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } #define BIQUAD_FILTER(name, type, min, max, need_clipping) \ @@ -812,7 +797,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf) td.in = buf; td.out = out_buf; - ctx->internal->execute(ctx, filter_channel, &td, NULL, FFMIN(outlink->channels, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_channel, &td, NULL, + FFMIN(outlink->channels, ff_filter_get_nb_threads(ctx))); for (ch = 0; ch < outlink->channels; ch++) { if (s->cache[ch].clippings > 0) @@ -853,7 +839,6 @@ static const AVFilterPad inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -862,7 +847,6 @@ static const AVFilterPad outputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_output, }, - { NULL } }; #define OFFSET(x) offsetof(BiquadsContext, x) @@ -885,8 +869,8 @@ const AVFilter ff_af_##name_ = { \ .init = name_##_init, \ .uninit = uninit, \ .query_formats = query_formats, \ - .inputs = inputs, \ - .outputs = outputs, \ + FILTER_INPUTS(inputs), \ + FILTER_OUTPUTS(outputs), \ .priv_class = &name_##_class, \ .process_command = process_command, \ .flags = AVFILTER_FLAG_SLICE_THREADS | AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, \ diff --git a/chromium/third_party/ffmpeg/libavfilter/af_bs2b.c b/chromium/third_party/ffmpeg/libavfilter/af_bs2b.c index 7b9958325f0..55b4d2ac6fe 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_bs2b.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_bs2b.c @@ -92,7 +92,6 @@ static av_cold void uninit(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { @@ -111,17 +110,11 @@ static int query_formats(AVFilterContext *ctx) if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static int filter_frame(AVFilterLink *inlink, AVFrame *frame) @@ -199,7 +192,6 @@ static const AVFilterPad bs2b_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad bs2b_outputs[] = { @@ -208,7 +200,6 @@ static const AVFilterPad bs2b_outputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_af_bs2b = { @@ -219,6 +210,6 @@ const AVFilter ff_af_bs2b = { .priv_class = &bs2b_class, .init = init, .uninit = uninit, - .inputs = bs2b_inputs, - .outputs = bs2b_outputs, + FILTER_INPUTS(bs2b_inputs), + FILTER_OUTPUTS(bs2b_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_channelmap.c b/chromium/third_party/ffmpeg/libavfilter/af_channelmap.c index 3cdf8b2bd87..c1eac79c983 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_channelmap.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_channelmap.c @@ -284,7 +284,7 @@ static int channelmap_query_formats(AVFilterContext *ctx) int ret; if ((ret = ff_set_common_formats (ctx, ff_planar_sample_fmts())) < 0 || - (ret = ff_set_common_samplerates (ctx , ff_all_samplerates() )) < 0 || + (ret = ff_set_common_all_samplerates(ctx )) < 0 || (ret = ff_add_channel_layout(&channel_layouts, s->output_layout)) < 0 || (ret = ff_channel_layouts_ref(channel_layouts, &ctx->outputs[0]->incfg.channel_layouts)) < 0) @@ -383,11 +383,10 @@ static const AVFilterPad avfilter_af_channelmap_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_AUDIO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = channelmap_filter_frame, .config_props = channelmap_config_input, - .needs_writable = 1, }, - { NULL } }; static const AVFilterPad avfilter_af_channelmap_outputs[] = { @@ -395,7 +394,6 @@ static const AVFilterPad avfilter_af_channelmap_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO }, - { NULL } }; const AVFilter ff_af_channelmap = { @@ -405,6 +403,6 @@ const AVFilter ff_af_channelmap = { .query_formats = channelmap_query_formats, .priv_size = sizeof(ChannelMapContext), .priv_class = &channelmap_class, - .inputs = avfilter_af_channelmap_inputs, - .outputs = avfilter_af_channelmap_outputs, + FILTER_INPUTS(avfilter_af_channelmap_inputs), + FILTER_OUTPUTS(avfilter_af_channelmap_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_channelsplit.c b/chromium/third_party/ffmpeg/libavfilter/af_channelsplit.c index 3bd3355d883..2bb34881a66 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_channelsplit.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_channelsplit.c @@ -97,9 +97,8 @@ static av_cold int init(AVFilterContext *ctx) s->map[i] = ret; } - if ((ret = ff_insert_outpad(ctx, i, &pad)) < 0) { + if ((ret = ff_append_outpad(ctx, &pad)) < 0) return ret; - } } fail: @@ -113,7 +112,7 @@ static int query_formats(AVFilterContext *ctx) int i, ret; if ((ret = ff_set_common_formats(ctx, ff_planar_sample_fmts())) < 0 || - (ret = ff_set_common_samplerates(ctx, ff_all_samplerates())) < 0) + (ret = ff_set_common_all_samplerates(ctx)) < 0) return ret; if ((ret = ff_add_channel_layout(&in_layouts, s->channel_layout)) < 0 || @@ -165,7 +164,6 @@ static const AVFilterPad avfilter_af_channelsplit_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = filter_frame, }, - { NULL } }; const AVFilter ff_af_channelsplit = { @@ -175,7 +173,7 @@ const AVFilter ff_af_channelsplit = { .priv_class = &channelsplit_class, .init = init, .query_formats = query_formats, - .inputs = avfilter_af_channelsplit_inputs, + FILTER_INPUTS(avfilter_af_channelsplit_inputs), .outputs = NULL, .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_chorus.c b/chromium/third_party/ffmpeg/libavfilter/af_chorus.c index 72e684bd3ac..9c9090e4ccc 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_chorus.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_chorus.c @@ -156,31 +156,18 @@ static av_cold int init(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static int config_output(AVFilterLink *outlink) @@ -356,7 +343,6 @@ static const AVFilterPad chorus_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad chorus_outputs[] = { @@ -366,7 +352,6 @@ static const AVFilterPad chorus_outputs[] = { .request_frame = request_frame, .config_props = config_output, }, - { NULL } }; const AVFilter ff_af_chorus = { @@ -377,6 +362,6 @@ const AVFilter ff_af_chorus = { .priv_class = &chorus_class, .init = init, .uninit = uninit, - .inputs = chorus_inputs, - .outputs = chorus_outputs, + FILTER_INPUTS(chorus_inputs), + FILTER_OUTPUTS(chorus_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_compand.c b/chromium/third_party/ffmpeg/libavfilter/af_compand.c index 62d9c2e941f..1df28d55904 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_compand.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_compand.c @@ -102,32 +102,19 @@ static av_cold void uninit(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterChannelLayouts *layouts; - AVFilterFormats *formats; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static void count_items(char *item_str, int *nb_items) @@ -571,7 +558,6 @@ static const AVFilterPad compand_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad compand_outputs[] = { @@ -581,7 +567,6 @@ static const AVFilterPad compand_outputs[] = { .config_props = config_output, .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; @@ -594,6 +579,6 @@ const AVFilter ff_af_compand = { .priv_class = &compand_class, .init = init, .uninit = uninit, - .inputs = compand_inputs, - .outputs = compand_outputs, + FILTER_INPUTS(compand_inputs), + FILTER_OUTPUTS(compand_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_compensationdelay.c b/chromium/third_party/ffmpeg/libavfilter/af_compensationdelay.c index f2e0dcd467f..16207507600 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_compensationdelay.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_compensationdelay.c @@ -65,32 +65,19 @@ AVFILTER_DEFINE_CLASS(compensationdelay); static int query_formats(AVFilterContext *ctx) { - AVFilterChannelLayouts *layouts; - AVFilterFormats *formats; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static int config_input(AVFilterLink *inlink) @@ -175,7 +162,6 @@ static const AVFilterPad compensationdelay_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad compensationdelay_outputs[] = { @@ -183,7 +169,6 @@ static const AVFilterPad compensationdelay_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_compensationdelay = { @@ -193,6 +178,6 @@ const AVFilter ff_af_compensationdelay = { .priv_size = sizeof(CompensationDelayContext), .priv_class = &compensationdelay_class, .uninit = uninit, - .inputs = compensationdelay_inputs, - .outputs = compensationdelay_outputs, + FILTER_INPUTS(compensationdelay_inputs), + FILTER_OUTPUTS(compensationdelay_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_crossfeed.c b/chromium/third_party/ffmpeg/libavfilter/af_crossfeed.c index 7ad9c4f483a..bbab8f423c0 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_crossfeed.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_crossfeed.c @@ -48,7 +48,7 @@ static int query_formats(AVFilterContext *ctx) (ret = ff_set_common_formats (ctx , formats )) < 0 || (ret = ff_add_channel_layout (&layout , AV_CH_LAYOUT_STEREO)) < 0 || (ret = ff_set_common_channel_layouts (ctx , layout )) < 0 || - (ret = ff_set_common_samplerates (ctx , ff_all_samplerates())) < 0) + (ret = ff_set_common_all_samplerates (ctx )) < 0) return ret; return 0; @@ -164,7 +164,6 @@ static const AVFilterPad inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -172,7 +171,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_crossfeed = { @@ -181,8 +179,8 @@ const AVFilter ff_af_crossfeed = { .query_formats = query_formats, .priv_size = sizeof(CrossfeedContext), .priv_class = &crossfeed_class, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, .process_command = process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_crystalizer.c b/chromium/third_party/ffmpeg/libavfilter/af_crystalizer.c index f4ad326ede7..b20d360beed 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_crystalizer.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_crystalizer.c @@ -29,7 +29,7 @@ typedef struct CrystalizerContext { float mult; int clip; AVFrame *prev; - int (*filter)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs); + int (*filter[2][2])(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs); } CrystalizerContext; #define OFFSET(x) offsetof(CrystalizerContext, x) @@ -45,32 +45,20 @@ AVFILTER_DEFINE_CLASS(crystalizer); static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } typedef struct ThreadData { @@ -80,10 +68,11 @@ typedef struct ThreadData { int nb_samples; int channels; float mult; - int clip; } ThreadData; -static int filter_flt(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) +static av_always_inline int filter_flt(AVFilterContext *ctx, void *arg, + int jobnr, int nb_jobs, + int inverse, int clip) { ThreadData *td = arg; void **d = td->d; @@ -92,7 +81,7 @@ static int filter_flt(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) const int nb_samples = td->nb_samples; const int channels = td->channels; const float mult = td->mult; - const int clip = td->clip; + const float scale = 1.f / (-mult + 1.f); const int start = (channels * jobnr) / nb_jobs; const int end = (channels * (jobnr+1)) / nb_jobs; float *prv = p[0]; @@ -104,10 +93,16 @@ static int filter_flt(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) for (n = 0; n < nb_samples; n++) { float current = src[c]; - dst[c] = current + (current - prv[c]) * mult; - prv[c] = current; + + if (inverse) { + dst[c] = (current - prv[c] * mult) * scale; + prv[c] = dst[c]; + } else { + dst[c] = current + (current - prv[c]) * mult; + prv[c] = current; + } if (clip) { - dst[c] = av_clipf(dst[c], -1, 1); + dst[c] = av_clipf(dst[c], -1.f, 1.f); } dst += channels; @@ -118,7 +113,9 @@ static int filter_flt(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) return 0; } -static int filter_dbl(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) +static av_always_inline int filter_dbl(AVFilterContext *ctx, void *arg, + int jobnr, int nb_jobs, + int inverse, int clip) { ThreadData *td = arg; void **d = td->d; @@ -126,8 +123,8 @@ static int filter_dbl(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) const void **s = td->s; const int nb_samples = td->nb_samples; const int channels = td->channels; - double mult = td->mult; - const int clip = td->clip; + const double mult = td->mult; + const double scale = 1.0 / (-mult + 1.0); const int start = (channels * jobnr) / nb_jobs; const int end = (channels * (jobnr+1)) / nb_jobs; double *prv = p[0]; @@ -140,10 +137,15 @@ static int filter_dbl(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) for (n = 0; n < nb_samples; n++) { double current = src[c]; - dst[c] = current + (current - prv[c]) * mult; - prv[c] = current; + if (inverse) { + dst[c] = (current - prv[c] * mult) * scale; + prv[c] = dst[c]; + } else { + dst[c] = current + (current - prv[c]) * mult; + prv[c] = current; + } if (clip) { - dst[c] = av_clipd(dst[c], -1, 1); + dst[c] = av_clipd(dst[c], -1., 1.); } dst += channels; @@ -154,7 +156,9 @@ static int filter_dbl(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) return 0; } -static int filter_fltp(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) +static av_always_inline int filter_fltp(AVFilterContext *ctx, void *arg, + int jobnr, int nb_jobs, + int inverse, int clip) { ThreadData *td = arg; void **d = td->d; @@ -162,8 +166,8 @@ static int filter_fltp(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) const void **s = td->s; const int nb_samples = td->nb_samples; const int channels = td->channels; - float mult = td->mult; - const int clip = td->clip; + const float mult = td->mult; + const float scale = 1.f / (-mult + 1.f); const int start = (channels * jobnr) / nb_jobs; const int end = (channels * (jobnr+1)) / nb_jobs; int n, c; @@ -176,10 +180,15 @@ static int filter_fltp(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) for (n = 0; n < nb_samples; n++) { float current = src[n]; - dst[n] = current + (current - prv[0]) * mult; - prv[0] = current; + if (inverse) { + dst[n] = (current - prv[0] * mult) * scale; + prv[0] = dst[n]; + } else { + dst[n] = current + (current - prv[0]) * mult; + prv[0] = current; + } if (clip) { - dst[n] = av_clipf(dst[n], -1, 1); + dst[n] = av_clipf(dst[n], -1.f, 1.f); } } } @@ -187,7 +196,9 @@ static int filter_fltp(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) return 0; } -static int filter_dblp(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) +static av_always_inline int filter_dblp(AVFilterContext *ctx, void *arg, + int jobnr, int nb_jobs, + int inverse, int clip) { ThreadData *td = arg; void **d = td->d; @@ -196,7 +207,7 @@ static int filter_dblp(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) const int nb_samples = td->nb_samples; const int channels = td->channels; const double mult = td->mult; - const int clip = td->clip; + const double scale = 1.0 / (-mult + 1.0); const int start = (channels * jobnr) / nb_jobs; const int end = (channels * (jobnr+1)) / nb_jobs; int n, c; @@ -209,157 +220,47 @@ static int filter_dblp(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) for (n = 0; n < nb_samples; n++) { double current = src[n]; - dst[n] = current + (current - prv[0]) * mult; - prv[0] = current; - if (clip) { - dst[n] = av_clipd(dst[n], -1, 1); + if (inverse) { + dst[n] = (current - prv[0] * mult) * scale; + prv[0] = dst[n]; + } else { + dst[n] = current + (current - prv[0]) * mult; + prv[0] = current; } - } - } - - return 0; -} - -static int ifilter_flt(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) -{ - ThreadData *td = arg; - void **d = td->d; - void **p = td->p; - const void **s = td->s; - const int nb_samples = td->nb_samples; - const int channels = td->channels; - const float mult = -td->mult; - const float div = -td->mult + 1.f; - const int clip = td->clip; - const int start = (channels * jobnr) / nb_jobs; - const int end = (channels * (jobnr+1)) / nb_jobs; - float *prv = p[0]; - int n, c; - - for (c = start; c < end; c++) { - const float *src = s[0]; - float *dst = d[0]; - - for (n = 0; n < nb_samples; n++) { - float current = src[c]; - dst[c] = (current + prv[c] * mult) / div; - prv[c] = dst[c]; - if (clip) { - dst[c] = av_clipf(dst[c], -1, 1); - } - - dst += channels; - src += channels; - } - } - - return 0; -} - -static int ifilter_dbl(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) -{ - ThreadData *td = arg; - void **d = td->d; - void **p = td->p; - const void **s = td->s; - const int nb_samples = td->nb_samples; - const int channels = td->channels; - const double mult = -td->mult; - const double div = -td->mult + 1.f; - const int clip = td->clip; - const int start = (channels * jobnr) / nb_jobs; - const int end = (channels * (jobnr+1)) / nb_jobs; - double *prv = p[0]; - int n, c; - - for (c = start; c < end; c++) { - const double *src = s[0]; - double *dst = d[0]; - - for (n = 0; n < nb_samples; n++) { - double current = src[c]; - - dst[c] = (current + prv[c] * mult) / div; - prv[c] = dst[c]; if (clip) { - dst[c] = av_clipd(dst[c], -1, 1); + dst[n] = av_clipd(dst[n], -1., 1.); } - - dst += channels; - src += channels; } } return 0; } -static int ifilter_fltp(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) -{ - ThreadData *td = arg; - void **d = td->d; - void **p = td->p; - const void **s = td->s; - const int nb_samples = td->nb_samples; - const int channels = td->channels; - const float mult = -td->mult; - const float div = -td->mult + 1.f; - const int clip = td->clip; - const int start = (channels * jobnr) / nb_jobs; - const int end = (channels * (jobnr+1)) / nb_jobs; - int n, c; - - for (c = start; c < end; c++) { - const float *src = s[c]; - float *dst = d[c]; - float *prv = p[c]; - - for (n = 0; n < nb_samples; n++) { - float current = src[n]; - - dst[n] = (current + prv[0] * mult) / div; - prv[0] = dst[n]; - if (clip) { - dst[n] = av_clipf(dst[n], -1, 1); - } - } - } - - return 0; +#define filters(fmt, inverse, clip, i, c) \ +static int filter_## inverse ##_## fmt ##_## clip(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) \ +{ \ + return filter_## fmt(ctx, arg, jobnr, nb_jobs, i, c); \ } -static int ifilter_dblp(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) -{ - ThreadData *td = arg; - void **d = td->d; - void **p = td->p; - const void **s = td->s; - const int nb_samples = td->nb_samples; - const int channels = td->channels; - const double mult = -td->mult; - const double div = -td->mult + 1.f; - const int clip = td->clip; - const int start = (channels * jobnr) / nb_jobs; - const int end = (channels * (jobnr+1)) / nb_jobs; - int n, c; +filters(flt, inverse, noclip, 1, 0) +filters(flt, inverse, clip, 1, 1) +filters(flt, noinverse, noclip, 0, 0) +filters(flt, noinverse, clip, 0, 1) - for (c = start; c < end; c++) { - const double *src = s[c]; - double *dst = d[c]; - double *prv = p[c]; +filters(fltp, inverse, noclip, 1, 0) +filters(fltp, inverse, clip, 1, 1) +filters(fltp, noinverse, noclip, 0, 0) +filters(fltp, noinverse, clip, 0, 1) - for (n = 0; n < nb_samples; n++) { - double current = src[n]; - - dst[n] = (current + prv[0] * mult) / div; - prv[0] = dst[n]; - if (clip) { - dst[n] = av_clipd(dst[n], -1, 1); - } - } - } +filters(dbl, inverse, noclip, 1, 0) +filters(dbl, inverse, clip, 1, 1) +filters(dbl, noinverse, noclip, 0, 0) +filters(dbl, noinverse, clip, 0, 1) - return 0; -} +filters(dblp, inverse, noclip, 1, 0) +filters(dblp, inverse, clip, 1, 1) +filters(dblp, noinverse, noclip, 0, 0) +filters(dblp, noinverse, clip, 0, 1) static int config_input(AVFilterLink *inlink) { @@ -367,10 +268,32 @@ static int config_input(AVFilterLink *inlink) CrystalizerContext *s = ctx->priv; switch (inlink->format) { - case AV_SAMPLE_FMT_FLT: s->filter = s->mult >= 0.f ? filter_flt : ifilter_flt; break; - case AV_SAMPLE_FMT_DBL: s->filter = s->mult >= 0.f ? filter_dbl : ifilter_dbl; break; - case AV_SAMPLE_FMT_FLTP: s->filter = s->mult >= 0.f ? filter_fltp : ifilter_fltp; break; - case AV_SAMPLE_FMT_DBLP: s->filter = s->mult >= 0.f ? filter_dblp : ifilter_dblp; break; + case AV_SAMPLE_FMT_FLT: + s->filter[0][0] = filter_inverse_flt_noclip; + s->filter[1][0] = filter_noinverse_flt_noclip; + s->filter[0][1] = filter_inverse_flt_clip; + s->filter[1][1] = filter_noinverse_flt_clip; + break; + case AV_SAMPLE_FMT_FLTP: + s->filter[0][0] = filter_inverse_fltp_noclip; + s->filter[1][0] = filter_noinverse_fltp_noclip; + s->filter[0][1] = filter_inverse_fltp_clip; + s->filter[1][1] = filter_noinverse_fltp_clip; + break; + case AV_SAMPLE_FMT_DBL: + s->filter[0][0] = filter_inverse_dbl_noclip; + s->filter[1][0] = filter_noinverse_dbl_noclip; + s->filter[0][1] = filter_inverse_dbl_clip; + s->filter[1][1] = filter_noinverse_dbl_clip; + break; + case AV_SAMPLE_FMT_DBLP: + s->filter[0][0] = filter_inverse_dblp_noclip; + s->filter[1][0] = filter_noinverse_dblp_noclip; + s->filter[0][1] = filter_inverse_dblp_clip; + s->filter[1][1] = filter_noinverse_dblp_clip; + break; + default: + return AVERROR_BUG; } return 0; @@ -409,9 +332,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.nb_samples = in->nb_samples; td.channels = in->channels; td.mult = ctx->is_disabled ? 0.f : s->mult; - td.clip = s->clip; - ctx->internal->execute(ctx, s->filter, &td, NULL, FFMIN(inlink->channels, - ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->filter[td.mult >= 0.f][s->clip], &td, NULL, + FFMIN(inlink->channels, ff_filter_get_nb_threads(ctx))); if (out != in) av_frame_free(&in); @@ -445,7 +367,6 @@ static const AVFilterPad inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -453,7 +374,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_crystalizer = { @@ -463,8 +383,8 @@ const AVFilter ff_af_crystalizer = { .priv_size = sizeof(CrystalizerContext), .priv_class = &crystalizer_class, .uninit = uninit, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .process_command = process_command, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, diff --git a/chromium/third_party/ffmpeg/libavfilter/af_dcshift.c b/chromium/third_party/ffmpeg/libavfilter/af_dcshift.c index 1384ad87bf1..d2751df4412 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_dcshift.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_dcshift.c @@ -54,31 +54,18 @@ static av_cold int init(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterChannelLayouts *layouts; - AVFilterFormats *formats; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_S32P, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static int filter_frame(AVFilterLink *inlink, AVFrame *in) @@ -149,7 +136,6 @@ static const AVFilterPad dcshift_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad dcshift_outputs[] = { @@ -157,7 +143,6 @@ static const AVFilterPad dcshift_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_dcshift = { @@ -167,7 +152,7 @@ const AVFilter ff_af_dcshift = { .priv_size = sizeof(DCShiftContext), .priv_class = &dcshift_class, .init = init, - .inputs = dcshift_inputs, - .outputs = dcshift_outputs, + FILTER_INPUTS(dcshift_inputs), + FILTER_OUTPUTS(dcshift_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_deesser.c b/chromium/third_party/ffmpeg/libavfilter/af_deesser.c index e05ee9f10b1..defea49e415 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_deesser.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_deesser.c @@ -70,31 +70,19 @@ AVFILTER_DEFINE_CLASS(deesser); static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static int config_input(AVFilterLink *inlink) @@ -220,7 +208,6 @@ static const AVFilterPad inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -228,7 +215,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_deesser = { @@ -238,7 +224,7 @@ const AVFilter ff_af_deesser = { .priv_size = sizeof(DeesserContext), .priv_class = &deesser_class, .uninit = uninit, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_drmeter.c b/chromium/third_party/ffmpeg/libavfilter/af_drmeter.c index 58932fe6c57..338fce3fc93 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_drmeter.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_drmeter.c @@ -55,32 +55,19 @@ AVFILTER_DEFINE_CLASS(drmeter); static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static int config_output(AVFilterLink *outlink) @@ -214,7 +201,6 @@ static const AVFilterPad drmeter_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad drmeter_outputs[] = { @@ -223,7 +209,6 @@ static const AVFilterPad drmeter_outputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_af_drmeter = { @@ -233,6 +218,6 @@ const AVFilter ff_af_drmeter = { .priv_size = sizeof(DRMeterContext), .priv_class = &drmeter_class, .uninit = uninit, - .inputs = drmeter_inputs, - .outputs = drmeter_outputs, + FILTER_INPUTS(drmeter_inputs), + FILTER_OUTPUTS(drmeter_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_dynaudnorm.c b/chromium/third_party/ffmpeg/libavfilter/af_dynaudnorm.c index 01c99788af3..b78b3df85e9 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_dynaudnorm.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_dynaudnorm.c @@ -129,32 +129,19 @@ static av_cold int init(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static inline int frame_size(int sample_rate, int frame_len_msec) @@ -719,7 +706,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) cqueue_dequeue(s->is_enabled, &is_enabled); amplify_frame(s, out, is_enabled > 0.); - s->pts = out->pts + out->nb_samples; + s->pts = out->pts + av_rescale_q(out->nb_samples, av_make_q(1, outlink->sample_rate), + outlink->time_base); ret = ff_filter_frame(outlink, out); } @@ -762,15 +750,17 @@ static int flush_buffer(DynamicAudioNormalizerContext *s, AVFilterLink *inlink, static int flush(AVFilterLink *outlink) { AVFilterContext *ctx = outlink->src; + AVFilterLink *inlink = ctx->inputs[0]; DynamicAudioNormalizerContext *s = ctx->priv; int ret = 0; if (!cqueue_empty(s->gain_history_smoothed[0])) { - ret = flush_buffer(s, ctx->inputs[0], outlink); + ret = flush_buffer(s, inlink, outlink); } else if (s->queue.available) { AVFrame *out = ff_bufqueue_get(&s->queue); - s->pts = out->pts + out->nb_samples; + s->pts = out->pts + av_rescale_q(out->nb_samples, av_make_q(1, outlink->sample_rate), + outlink->time_base); ret = ff_filter_frame(outlink, out); } @@ -857,7 +847,6 @@ static const AVFilterPad avfilter_af_dynaudnorm_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_input, }, - { NULL } }; static const AVFilterPad avfilter_af_dynaudnorm_outputs[] = { @@ -865,7 +854,6 @@ static const AVFilterPad avfilter_af_dynaudnorm_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_dynaudnorm = { @@ -876,8 +864,8 @@ const AVFilter ff_af_dynaudnorm = { .init = init, .uninit = uninit, .activate = activate, - .inputs = avfilter_af_dynaudnorm_inputs, - .outputs = avfilter_af_dynaudnorm_outputs, + FILTER_INPUTS(avfilter_af_dynaudnorm_inputs), + FILTER_OUTPUTS(avfilter_af_dynaudnorm_outputs), .priv_class = &dynaudnorm_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, .process_command = process_command, diff --git a/chromium/third_party/ffmpeg/libavfilter/af_earwax.c b/chromium/third_party/ffmpeg/libavfilter/af_earwax.c index a5a7e6a5d2d..2d219181d4c 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_earwax.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_earwax.c @@ -90,7 +90,7 @@ static int query_formats(AVFilterContext *ctx) (ret = ff_set_common_formats (ctx , formats )) < 0 || (ret = ff_add_channel_layout (&layout , AV_CH_LAYOUT_STEREO )) < 0 || (ret = ff_set_common_channel_layouts (ctx , layout )) < 0 || - (ret = ff_set_common_samplerates (ctx , ff_make_format_list(sample_rates) )) < 0) + (ret = ff_set_common_samplerates_from_list(ctx, sample_rates)) < 0) return ret; return 0; @@ -220,7 +220,6 @@ static const AVFilterPad earwax_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad earwax_outputs[] = { @@ -228,7 +227,6 @@ static const AVFilterPad earwax_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_earwax = { @@ -237,6 +235,6 @@ const AVFilter ff_af_earwax = { .query_formats = query_formats, .priv_size = sizeof(EarwaxContext), .uninit = uninit, - .inputs = earwax_inputs, - .outputs = earwax_outputs, + FILTER_INPUTS(earwax_inputs), + FILTER_OUTPUTS(earwax_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_extrastereo.c b/chromium/third_party/ffmpeg/libavfilter/af_extrastereo.c index 0555aa6610b..0fcf840a4a4 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_extrastereo.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_extrastereo.c @@ -53,8 +53,7 @@ static int query_formats(AVFilterContext *ctx) (ret = ff_set_common_channel_layouts (ctx , layout )) < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static int filter_frame(AVFilterLink *inlink, AVFrame *in) @@ -109,7 +108,6 @@ static const AVFilterPad inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -117,7 +115,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_extrastereo = { @@ -126,8 +123,8 @@ const AVFilter ff_af_extrastereo = { .query_formats = query_formats, .priv_size = sizeof(ExtraStereoContext), .priv_class = &extrastereo_class, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, .process_command = ff_filter_process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_firequalizer.c b/chromium/third_party/ffmpeg/libavfilter/af_firequalizer.c index a4de76ee0ff..e147118d082 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_firequalizer.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_firequalizer.c @@ -182,32 +182,19 @@ static av_cold void uninit(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterChannelLayouts *layouts; - AVFilterFormats *formats; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static void fast_convolute(FIREqualizerContext *av_restrict s, const float *av_restrict kernel_buf, float *av_restrict conv_buf, @@ -837,7 +824,7 @@ static int config_input(AVFilterLink *inlink) inlink->sample_rate, inlink->channels, s->analysis_rdft_len, s->rdft_len, s->fir_len, s->nsamples_max); if (s->fixed) - inlink->min_samples = inlink->max_samples = inlink->partial_buf_size = s->nsamples_max; + inlink->min_samples = inlink->max_samples = s->nsamples_max; return generate_kernel(ctx, SELECT_GAIN(s), SELECT_GAIN_ENTRY(s)); } @@ -952,12 +939,11 @@ static int process_command(AVFilterContext *ctx, const char *cmd, const char *ar static const AVFilterPad firequalizer_inputs[] = { { .name = "default", + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .config_props = config_input, .filter_frame = filter_frame, .type = AVMEDIA_TYPE_AUDIO, - .needs_writable = 1, }, - { NULL } }; static const AVFilterPad firequalizer_outputs[] = { @@ -966,7 +952,6 @@ static const AVFilterPad firequalizer_outputs[] = { .request_frame = request_frame, .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_firequalizer = { @@ -976,7 +961,7 @@ const AVFilter ff_af_firequalizer = { .query_formats = query_formats, .process_command = process_command, .priv_size = sizeof(FIREqualizerContext), - .inputs = firequalizer_inputs, - .outputs = firequalizer_outputs, + FILTER_INPUTS(firequalizer_inputs), + FILTER_OUTPUTS(firequalizer_outputs), .priv_class = &firequalizer_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_flanger.c b/chromium/third_party/ffmpeg/libavfilter/af_flanger.c index 6984ab12d3b..b0d765365c9 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_flanger.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_flanger.c @@ -90,31 +90,18 @@ static av_cold int init(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterChannelLayouts *layouts; - AVFilterFormats *formats; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static int config_input(AVFilterLink *inlink) @@ -222,7 +209,6 @@ static const AVFilterPad flanger_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad flanger_outputs[] = { @@ -230,7 +216,6 @@ static const AVFilterPad flanger_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_flanger = { @@ -241,6 +226,6 @@ const AVFilter ff_af_flanger = { .priv_class = &flanger_class, .init = init, .uninit = uninit, - .inputs = flanger_inputs, - .outputs = flanger_outputs, + FILTER_INPUTS(flanger_inputs), + FILTER_OUTPUTS(flanger_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_haas.c b/chromium/third_party/ffmpeg/libavfilter/af_haas.c index b1a207f8086..e162e4b7f04 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_haas.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_haas.c @@ -91,8 +91,7 @@ static int query_formats(AVFilterContext *ctx) (ret = ff_set_common_channel_layouts (ctx , layout )) < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static int config_input(AVFilterLink *inlink) @@ -205,7 +204,6 @@ static const AVFilterPad inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -213,7 +211,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_haas = { @@ -223,6 +220,6 @@ const AVFilter ff_af_haas = { .priv_size = sizeof(HaasContext), .priv_class = &haas_class, .uninit = uninit, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_hdcd.c b/chromium/third_party/ffmpeg/libavfilter/af_hdcd.c index 144c0d31ed2..94a9c701a51 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_hdcd.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_hdcd.c @@ -1648,8 +1648,7 @@ static int query_formats(AVFilterContext *ctx) if (ret < 0) return ret; - return - ff_set_common_samplerates(ctx, ff_make_format_list(sample_rates) ); + return ff_set_common_samplerates_from_list(ctx, sample_rates); } static av_cold void uninit(AVFilterContext *ctx) @@ -1762,7 +1761,6 @@ static const AVFilterPad avfilter_af_hdcd_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad avfilter_af_hdcd_outputs[] = { @@ -1770,7 +1768,6 @@ static const AVFilterPad avfilter_af_hdcd_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_hdcd = { @@ -1781,6 +1778,6 @@ const AVFilter ff_af_hdcd = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = avfilter_af_hdcd_inputs, - .outputs = avfilter_af_hdcd_outputs, + FILTER_INPUTS(avfilter_af_hdcd_inputs), + FILTER_OUTPUTS(avfilter_af_hdcd_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_headphone.c b/chromium/third_party/ffmpeg/libavfilter/af_headphone.c index 5e8fadb6cd7..0cb188b61d0 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_headphone.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_headphone.c @@ -341,9 +341,9 @@ static int headphone_frame(HeadphoneContext *s, AVFrame *in, AVFilterLink *outli td.temp_afft = s->temp_afft; if (s->type == TIME_DOMAIN) { - ctx->internal->execute(ctx, headphone_convolute, &td, NULL, 2); + ff_filter_execute(ctx, headphone_convolute, &td, NULL, 2); } else { - ctx->internal->execute(ctx, headphone_fast_convolute, &td, NULL, 2); + ff_filter_execute(ctx, headphone_fast_convolute, &td, NULL, 2); } emms_c(); @@ -624,10 +624,7 @@ static int query_formats(AVFilterContext *ctx) } } - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static int config_input(AVFilterLink *inlink) @@ -655,7 +652,7 @@ static av_cold int init(AVFilterContext *ctx) .type = AVMEDIA_TYPE_AUDIO, .config_props = config_input, }; - if ((ret = ff_insert_inpad(ctx, 0, &pad)) < 0) + if ((ret = ff_append_inpad(ctx, &pad)) < 0) return ret; if (!s->map) { @@ -673,10 +670,8 @@ static av_cold int init(AVFilterContext *ctx) }; if (!name) return AVERROR(ENOMEM); - if ((ret = ff_insert_inpad(ctx, i + 1, &pad)) < 0) { - av_freep(&pad.name); + if ((ret = ff_append_inpad_free_name(ctx, &pad)) < 0) return ret; - } } if (s->type == TIME_DOMAIN) { @@ -732,9 +727,6 @@ static av_cold void uninit(AVFilterContext *ctx) av_freep(&s->temp_afft[1]); av_freep(&s->data_hrtf[0]); av_freep(&s->data_hrtf[1]); - - for (unsigned i = 1; i < ctx->nb_inputs; i++) - av_freep(&ctx->input_pads[i].name); } #define OFFSET(x) offsetof(HeadphoneContext, x) @@ -762,7 +754,6 @@ static const AVFilterPad outputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_af_headphone = { @@ -775,6 +766,6 @@ const AVFilter ff_af_headphone = { .query_formats = query_formats, .activate = activate, .inputs = NULL, - .outputs = outputs, + FILTER_OUTPUTS(outputs), .flags = AVFILTER_FLAG_SLICE_THREADS | AVFILTER_FLAG_DYNAMIC_INPUTS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_join.c b/chromium/third_party/ffmpeg/libavfilter/af_join.c index 98b6389306a..c8e58260da5 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_join.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_join.c @@ -50,6 +50,8 @@ typedef struct JoinContext { char *channel_layout_str; uint64_t channel_layout; + int64_t eof_pts; + int nb_channels; ChannelMap *channels; @@ -192,10 +194,8 @@ static av_cold int join_init(AVFilterContext *ctx) if (!pad.name) return AVERROR(ENOMEM); - if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0) { - av_freep(&pad.name); + if ((ret = ff_append_inpad_free_name(ctx, &pad)) < 0) return ret; - } } return 0; @@ -210,10 +210,6 @@ static av_cold void join_uninit(AVFilterContext *ctx) av_frame_free(&s->input_frames[i]); } - for (i = 0; i < ctx->nb_inputs; i++) { - av_freep(&ctx->input_pads[i].name); - } - av_freep(&s->channels); av_freep(&s->buffers); av_freep(&s->input_frames); @@ -236,7 +232,7 @@ static int join_query_formats(AVFilterContext *ctx) } if ((ret = ff_set_common_formats(ctx, ff_planar_sample_fmts())) < 0 || - (ret = ff_set_common_samplerates(ctx, ff_all_samplerates())) < 0) + (ret = ff_set_common_all_samplerates(ctx)) < 0) return ret; return 0; @@ -372,12 +368,15 @@ static int try_push_frame(AVFilterContext *ctx) int i, j, ret; for (i = 0; i < ctx->nb_inputs; i++) { - if (!s->input_frames[i]) - return 0; - nb_samples = FFMIN(nb_samples, s->input_frames[i]->nb_samples); + if (!s->input_frames[i]) { + nb_samples = 0; + break; + } else { + nb_samples = FFMIN(nb_samples, s->input_frames[i]->nb_samples); + } } if (!nb_samples) - return 0; + goto eof; /* setup the output frame */ frame = av_frame_alloc(); @@ -454,6 +453,9 @@ static int try_push_frame(AVFilterContext *ctx) FFMIN(FF_ARRAY_ELEMS(frame->data), s->nb_channels)); } + s->eof_pts = frame->pts + av_rescale_q(frame->nb_samples, + av_make_q(1, outlink->sample_rate), + outlink->time_base); ret = ff_filter_frame(outlink, frame); for (i = 0; i < ctx->nb_inputs; i++) @@ -464,6 +466,16 @@ static int try_push_frame(AVFilterContext *ctx) fail: av_frame_free(&frame); return ret; +eof: + for (i = 0; i < ctx->nb_inputs; i++) { + if (ff_outlink_get_status(ctx->inputs[i]) && + ff_inlink_queued_samples(ctx->inputs[i]) <= 0 && + !s->input_frames[i]) { + ff_outlink_set_status(outlink, AVERROR_EOF, s->eof_pts); + } + } + + return 0; } static int activate(AVFilterContext *ctx) @@ -479,16 +491,13 @@ static int activate(AVFilterContext *ctx) ret = ff_inlink_consume_frame(ctx->inputs[0], &s->input_frames[0]); if (ret < 0) { return ret; - } else if (ff_inlink_acknowledge_status(ctx->inputs[0], &status, &pts)) { - ff_outlink_set_status(ctx->outputs[0], status, pts); + } else if (ret == 0 && ff_inlink_acknowledge_status(ctx->inputs[0], &status, &pts)) { + ff_outlink_set_status(ctx->outputs[0], status, s->eof_pts); return 0; - } else { - if (ff_outlink_frame_wanted(ctx->outputs[0]) && !s->input_frames[0]) { - ff_inlink_request_frame(ctx->inputs[0]); - return 0; - } } - if (!s->input_frames[0]) { + + if (!s->input_frames[0] && ff_outlink_frame_wanted(ctx->outputs[0])) { + ff_inlink_request_frame(ctx->inputs[0]); return 0; } } @@ -498,20 +507,17 @@ static int activate(AVFilterContext *ctx) for (i = 1; i < ctx->nb_inputs && nb_samples > 0; i++) { if (s->input_frames[i]) continue; + ret = ff_inlink_consume_samples(ctx->inputs[i], nb_samples, nb_samples, &s->input_frames[i]); + if (ret < 0) { + return ret; + } else if (ff_inlink_acknowledge_status(ctx->inputs[i], &status, &pts)) { + ff_outlink_set_status(ctx->outputs[0], status, pts); + return 0; + } - if (ff_inlink_check_available_samples(ctx->inputs[i], nb_samples) > 0) { - ret = ff_inlink_consume_samples(ctx->inputs[i], nb_samples, nb_samples, &s->input_frames[i]); - if (ret < 0) { - return ret; - } else if (ff_inlink_acknowledge_status(ctx->inputs[i], &status, &pts)) { - ff_outlink_set_status(ctx->outputs[0], status, pts); - return 0; - } - } else { - if (ff_outlink_frame_wanted(ctx->outputs[0])) { - ff_inlink_request_frame(ctx->inputs[i]); - return 0; - } + if (!s->input_frames[i]) { + ff_inlink_request_frame(ctx->inputs[i]); + return 0; } } @@ -524,7 +530,6 @@ static const AVFilterPad avfilter_af_join_outputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = join_config_output, }, - { NULL } }; const AVFilter ff_af_join = { @@ -538,6 +543,6 @@ const AVFilter ff_af_join = { .activate = activate, .query_formats = join_query_formats, .inputs = NULL, - .outputs = avfilter_af_join_outputs, + FILTER_OUTPUTS(avfilter_af_join_outputs), .flags = AVFILTER_FLAG_DYNAMIC_INPUTS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_ladspa.c b/chromium/third_party/ffmpeg/libavfilter/af_ladspa.c index 4060251670e..73cbd288c07 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_ladspa.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_ladspa.c @@ -456,7 +456,7 @@ static av_cold int init(AVFilterContext *ctx) AVFilterPad pad = { NULL }; char *p, *arg, *saveptr = NULL; unsigned long nb_ports; - int i, j = 0; + int i, j = 0, ret; if (!s->dl_name) { av_log(ctx, AV_LOG_ERROR, "No plugin name provided\n"); @@ -639,10 +639,8 @@ static av_cold int init(AVFilterContext *ctx) pad.filter_frame = filter_frame; pad.config_props = config_input; - if (ff_insert_inpad(ctx, ctx->nb_inputs, &pad) < 0) { - av_freep(&pad.name); - return AVERROR(ENOMEM); - } + if ((ret = ff_append_inpad_free_name(ctx, &pad)) < 0) + return ret; } av_log(ctx, AV_LOG_DEBUG, "ports: %lu\n", nb_ports); @@ -657,42 +655,28 @@ static av_cold int init(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { LADSPAContext *s = ctx->priv; - AVFilterFormats *formats; AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }; - int ret; - - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; if (s->nb_inputs) { - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - - ret = ff_set_common_samplerates(ctx, formats); + ret = ff_set_common_all_samplerates(ctx); if (ret < 0) return ret; } else { int sample_rates[] = { s->sample_rate, -1 }; - ret = ff_set_common_samplerates(ctx, ff_make_format_list(sample_rates)); + ret = ff_set_common_samplerates_from_list(ctx, sample_rates); if (ret < 0) return ret; } if (s->nb_inputs == 1 && s->nb_outputs == 1) { // We will instantiate multiple LADSPA_Handle, one over each channel - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; } else if (s->nb_inputs == 2 && s->nb_outputs == 2) { @@ -764,9 +748,6 @@ static av_cold void uninit(AVFilterContext *ctx) av_freep(&s->octlv); av_freep(&s->handles); av_freep(&s->ctl_needs_value); - - if (ctx->nb_inputs) - av_freep(&ctx->input_pads[0].name); } static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, @@ -788,7 +769,6 @@ static const AVFilterPad ladspa_outputs[] = { .config_props = config_output, .request_frame = request_frame, }, - { NULL } }; const AVFilter ff_af_ladspa = { @@ -801,6 +781,6 @@ const AVFilter ff_af_ladspa = { .query_formats = query_formats, .process_command = process_command, .inputs = 0, - .outputs = ladspa_outputs, + FILTER_OUTPUTS(ladspa_outputs), .flags = AVFILTER_FLAG_DYNAMIC_INPUTS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_loudnorm.c b/chromium/third_party/ffmpeg/libavfilter/af_loudnorm.c index 5a3e762b27f..7807ed927a5 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_loudnorm.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_loudnorm.c @@ -504,8 +504,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) s->pts += out->nb_samples = inlink->min_samples = - inlink->max_samples = - inlink->partial_buf_size = subframe_length; + inlink->max_samples = subframe_length; s->frame_type = INNER_FRAME; break; @@ -686,7 +685,6 @@ static int query_formats(AVFilterContext *ctx) { LoudNormContext *s = ctx->priv; AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; AVFilterLink *inlink = ctx->inputs[0]; AVFilterLink *outlink = ctx->outputs[0]; static const int input_srate[] = {192000, -1}; @@ -694,19 +692,11 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; @@ -761,8 +751,7 @@ static int config_input(AVFilterLink *inlink) if (s->frame_type != LINEAR_MODE) { inlink->min_samples = - inlink->max_samples = - inlink->partial_buf_size = frame_size(inlink->sample_rate, 3000); + inlink->max_samples = frame_size(inlink->sample_rate, 3000); } s->pts = AV_NOPTS_VALUE; @@ -907,7 +896,6 @@ static const AVFilterPad avfilter_af_loudnorm_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad avfilter_af_loudnorm_outputs[] = { @@ -916,7 +904,6 @@ static const AVFilterPad avfilter_af_loudnorm_outputs[] = { .request_frame = request_frame, .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_loudnorm = { @@ -927,6 +914,6 @@ const AVFilter ff_af_loudnorm = { .query_formats = query_formats, .init = init, .uninit = uninit, - .inputs = avfilter_af_loudnorm_inputs, - .outputs = avfilter_af_loudnorm_outputs, + FILTER_INPUTS(avfilter_af_loudnorm_inputs), + FILTER_OUTPUTS(avfilter_af_loudnorm_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_lv2.c b/chromium/third_party/ffmpeg/libavfilter/af_lv2.c index cc5d702e275..75c7494cc8a 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_lv2.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_lv2.c @@ -380,7 +380,7 @@ static int config_output(AVFilterLink *outlink) lilv_plugin_has_feature(s->plugin, s->boundedBlockLength))) { AVFilterLink *inlink = ctx->inputs[0]; - inlink->partial_buf_size = inlink->min_samples = inlink->max_samples = 4096; + inlink->min_samples = inlink->max_samples = 4096; } return 0; @@ -393,7 +393,7 @@ static av_cold int init(AVFilterContext *ctx) const LilvPlugin *plugin; AVFilterPad pad = { NULL }; LilvNode *uri; - int i; + int i, ret; s->world = lilv_world_new(); if (!s->world) @@ -464,10 +464,8 @@ static av_cold int init(AVFilterContext *ctx) return AVERROR(ENOMEM); pad.filter_frame = filter_frame; - if (ff_insert_inpad(ctx, ctx->nb_inputs, &pad) < 0) { - av_freep(&pad.name); - return AVERROR(ENOMEM); - } + if ((ret = ff_append_inpad_free_name(ctx, &pad)) < 0) + return ret; } return 0; @@ -476,32 +474,22 @@ static av_cold int init(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { LV2Context *s = ctx->priv; - AVFilterFormats *formats; AVFilterChannelLayouts *layouts; AVFilterLink *outlink = ctx->outputs[0]; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }; - int ret; - - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; if (s->nb_inputs) { - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - - ret = ff_set_common_samplerates(ctx, formats); + ret = ff_set_common_all_samplerates(ctx); if (ret < 0) return ret; } else { int sample_rates[] = { s->sample_rate, -1 }; - ret = ff_set_common_samplerates(ctx, ff_make_format_list(sample_rates)); + ret = ff_set_common_samplerates_from_list(ctx, sample_rates); if (ret < 0) return ret; } @@ -572,9 +560,6 @@ static av_cold void uninit(AVFilterContext *ctx) av_freep(&s->maxes); av_freep(&s->controls); av_freep(&s->seq_out); - - if (ctx->nb_inputs) - av_freep(&ctx->input_pads[0].name); } static const AVFilterPad lv2_outputs[] = { @@ -584,7 +569,6 @@ static const AVFilterPad lv2_outputs[] = { .config_props = config_output, .request_frame = request_frame, }, - { NULL } }; const AVFilter ff_af_lv2 = { @@ -596,6 +580,6 @@ const AVFilter ff_af_lv2 = { .uninit = uninit, .query_formats = query_formats, .inputs = 0, - .outputs = lv2_outputs, + FILTER_OUTPUTS(lv2_outputs), .flags = AVFILTER_FLAG_DYNAMIC_INPUTS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_mcompand.c b/chromium/third_party/ffmpeg/libavfilter/af_mcompand.c index 08d93f8c6a3..0ae84221b63 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_mcompand.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_mcompand.c @@ -124,32 +124,19 @@ static av_cold void uninit(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterChannelLayouts *layouts; - AVFilterFormats *formats; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static void count_items(char *item_str, int *nb_items, char delimiter) @@ -651,7 +638,6 @@ static const AVFilterPad mcompand_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad mcompand_outputs[] = { @@ -661,7 +647,6 @@ static const AVFilterPad mcompand_outputs[] = { .request_frame = request_frame, .config_props = config_output, }, - { NULL } }; @@ -673,6 +658,6 @@ const AVFilter ff_af_mcompand = { .priv_size = sizeof(MCompandContext), .priv_class = &mcompand_class, .uninit = uninit, - .inputs = mcompand_inputs, - .outputs = mcompand_outputs, + FILTER_INPUTS(mcompand_inputs), + FILTER_OUTPUTS(mcompand_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_pan.c b/chromium/third_party/ffmpeg/libavfilter/af_pan.c index 7ae18e9bfe7..d17e45438d4 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_pan.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_pan.c @@ -251,7 +251,6 @@ static int query_formats(AVFilterContext *ctx) PanContext *pan = ctx->priv; AVFilterLink *inlink = ctx->inputs[0]; AVFilterLink *outlink = ctx->outputs[0]; - AVFilterFormats *formats = NULL; AVFilterChannelLayouts *layouts; int ret; @@ -260,8 +259,7 @@ static int query_formats(AVFilterContext *ctx) if ((ret = ff_set_common_formats(ctx, ff_all_formats(AVMEDIA_TYPE_AUDIO))) < 0) return ret; - formats = ff_all_samplerates(); - if ((ret = ff_set_common_samplerates(ctx, formats)) < 0) + if ((ret = ff_set_common_all_samplerates(ctx)) < 0) return ret; // inlink supports any channel layout @@ -437,7 +435,6 @@ static const AVFilterPad pan_inputs[] = { .config_props = config_props, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad pan_outputs[] = { @@ -445,7 +442,6 @@ static const AVFilterPad pan_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_pan = { @@ -456,6 +452,6 @@ const AVFilter ff_af_pan = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = pan_inputs, - .outputs = pan_outputs, + FILTER_INPUTS(pan_inputs), + FILTER_OUTPUTS(pan_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_replaygain.c b/chromium/third_party/ffmpeg/libavfilter/af_replaygain.c index a5f5959eb3d..7db7fe41788 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_replaygain.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_replaygain.c @@ -359,7 +359,6 @@ static int config_input(AVFilterLink *inlink) s->yule_hist_i = 20; s->butter_hist_i = 4; - inlink->partial_buf_size = inlink->min_samples = inlink->max_samples = inlink->sample_rate / 20; @@ -593,7 +592,6 @@ static const AVFilterPad replaygain_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad replaygain_outputs[] = { @@ -601,7 +599,6 @@ static const AVFilterPad replaygain_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_replaygain = { @@ -610,6 +607,6 @@ const AVFilter ff_af_replaygain = { .query_formats = query_formats, .uninit = uninit, .priv_size = sizeof(ReplayGainContext), - .inputs = replaygain_inputs, - .outputs = replaygain_outputs, + FILTER_INPUTS(replaygain_inputs), + FILTER_OUTPUTS(replaygain_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_rubberband.c b/chromium/third_party/ffmpeg/libavfilter/af_rubberband.c index bfacbcd245f..6a4b71d09dd 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_rubberband.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_rubberband.c @@ -91,32 +91,19 @@ static av_cold void uninit(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE, }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static int filter_frame(AVFilterLink *inlink, AVFrame *in) @@ -223,7 +210,6 @@ static const AVFilterPad rubberband_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_input, }, - { NULL } }; static const AVFilterPad rubberband_outputs[] = { @@ -231,7 +217,6 @@ static const AVFilterPad rubberband_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_rubberband = { @@ -242,7 +227,7 @@ const AVFilter ff_af_rubberband = { .priv_class = &rubberband_class, .uninit = uninit, .activate = activate, - .inputs = rubberband_inputs, - .outputs = rubberband_outputs, + FILTER_INPUTS(rubberband_inputs), + FILTER_OUTPUTS(rubberband_outputs), .process_command = process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_sidechaincompress.c b/chromium/third_party/ffmpeg/libavfilter/af_sidechaincompress.c index 71e27d4530b..c964e0d27ce 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_sidechaincompress.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_sidechaincompress.c @@ -297,7 +297,6 @@ static int activate(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBL, @@ -322,12 +321,10 @@ static int query_formats(AVFilterContext *ctx) return ret; } - formats = ff_make_format_list(sample_fmts); - if ((ret = ff_set_common_formats(ctx, formats)) < 0) + if ((ret = ff_set_common_formats_from_list(ctx, sample_fmts)) < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static int config_output(AVFilterLink *outlink) @@ -374,7 +371,6 @@ static const AVFilterPad sidechaincompress_inputs[] = { .name = "sidechain", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; static const AVFilterPad sidechaincompress_outputs[] = { @@ -383,7 +379,6 @@ static const AVFilterPad sidechaincompress_outputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_af_sidechaincompress = { @@ -394,8 +389,8 @@ const AVFilter ff_af_sidechaincompress = { .query_formats = query_formats, .activate = activate, .uninit = uninit, - .inputs = sidechaincompress_inputs, - .outputs = sidechaincompress_outputs, + FILTER_INPUTS(sidechaincompress_inputs), + FILTER_OUTPUTS(sidechaincompress_outputs), .process_command = process_command, }; #endif /* CONFIG_SIDECHAINCOMPRESS_FILTER */ @@ -433,32 +428,19 @@ static int acompressor_filter_frame(AVFilterLink *inlink, AVFrame *in) static int acompressor_query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } #define acompressor_options options @@ -470,7 +452,6 @@ static const AVFilterPad acompressor_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = acompressor_filter_frame, }, - { NULL } }; static const AVFilterPad acompressor_outputs[] = { @@ -479,7 +460,6 @@ static const AVFilterPad acompressor_outputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = compressor_config_output, }, - { NULL } }; const AVFilter ff_af_acompressor = { @@ -488,8 +468,8 @@ const AVFilter ff_af_acompressor = { .priv_size = sizeof(SidechainCompressContext), .priv_class = &acompressor_class, .query_formats = acompressor_query_formats, - .inputs = acompressor_inputs, - .outputs = acompressor_outputs, + FILTER_INPUTS(acompressor_inputs), + FILTER_OUTPUTS(acompressor_outputs), .process_command = process_command, }; #endif /* CONFIG_ACOMPRESSOR_FILTER */ diff --git a/chromium/third_party/ffmpeg/libavfilter/af_silencedetect.c b/chromium/third_party/ffmpeg/libavfilter/af_silencedetect.c index 53f54d1834f..93ec5f7171e 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_silencedetect.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_silencedetect.c @@ -131,11 +131,35 @@ static void silencedetect_##name(SilenceDetectContext *s, AVFrame *insamples, nb_samples_notify, time_base); \ } +#define SILENCE_DETECT_PLANAR(name, type) \ +static void silencedetect_##name(SilenceDetectContext *s, AVFrame *insamples, \ + int nb_samples, int64_t nb_samples_notify, \ + AVRational time_base) \ +{ \ + const int channels = insamples->channels; \ + const type noise = s->noise; \ + \ + nb_samples /= channels; \ + for (int i = 0; i < nb_samples; i++) { \ + for (int ch = 0; ch < insamples->channels; ch++) { \ + const type *p = (const type *)insamples->extended_data[ch]; \ + update(s, insamples, p[i] < noise && p[i] > -noise, \ + channels * i + ch, \ + nb_samples_notify, time_base); \ + } \ + } \ +} + SILENCE_DETECT(dbl, double) SILENCE_DETECT(flt, float) SILENCE_DETECT(s32, int32_t) SILENCE_DETECT(s16, int16_t) +SILENCE_DETECT_PLANAR(dblp, double) +SILENCE_DETECT_PLANAR(fltp, float) +SILENCE_DETECT_PLANAR(s32p, int32_t) +SILENCE_DETECT_PLANAR(s16p, int16_t) + static int config_input(AVFilterLink *inlink) { AVFilterContext *ctx = inlink->dst; @@ -165,6 +189,18 @@ static int config_input(AVFilterLink *inlink) s->noise *= INT16_MAX; s->silencedetect = silencedetect_s16; break; + case AV_SAMPLE_FMT_DBLP: s->silencedetect = silencedetect_dblp; break; + case AV_SAMPLE_FMT_FLTP: s->silencedetect = silencedetect_fltp; break; + case AV_SAMPLE_FMT_S32P: + s->noise *= INT32_MAX; + s->silencedetect = silencedetect_s32p; + break; + case AV_SAMPLE_FMT_S16P: + s->noise *= INT16_MAX; + s->silencedetect = silencedetect_s16p; + break; + default: + return AVERROR_BUG; } return 0; @@ -197,35 +233,22 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { - AV_SAMPLE_FMT_DBL, - AV_SAMPLE_FMT_FLT, - AV_SAMPLE_FMT_S32, - AV_SAMPLE_FMT_S16, + AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP, + AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP, + AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32P, + AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_layouts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static av_cold void uninit(AVFilterContext *ctx) @@ -247,7 +270,6 @@ static const AVFilterPad silencedetect_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad silencedetect_outputs[] = { @@ -255,7 +277,6 @@ static const AVFilterPad silencedetect_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_silencedetect = { @@ -264,7 +285,7 @@ const AVFilter ff_af_silencedetect = { .priv_size = sizeof(SilenceDetectContext), .query_formats = query_formats, .uninit = uninit, - .inputs = silencedetect_inputs, - .outputs = silencedetect_outputs, + FILTER_INPUTS(silencedetect_inputs), + FILTER_OUTPUTS(silencedetect_outputs), .priv_class = &silencedetect_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_silenceremove.c b/chromium/third_party/ffmpeg/libavfilter/af_silenceremove.c index 9d6d683688a..e8e79e93f45 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_silenceremove.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_silenceremove.c @@ -23,6 +23,8 @@ #include <float.h> /* DBL_MAX */ +#include "libavutil/audio_fifo.h" +#include "libavutil/avassert.h" #include "libavutil/opt.h" #include "libavutil/timestamp.h" #include "audio.h" @@ -69,6 +71,8 @@ typedef struct SilenceRemoveContext { int64_t stop_silence_opt; int stop_mode; + int64_t window_duration_opt; + AVFrame *start_holdoff; AVFrame *start_silence_hold; size_t start_holdoff_offset; @@ -85,12 +89,13 @@ typedef struct SilenceRemoveContext { size_t stop_silence_end; int stop_found_periods; - double window_ratio; AVFrame *window; int window_offset; - int window_size; + int64_t window_duration; double sum; + int threshold; + int one_period; int restart; int64_t next_pts; @@ -99,20 +104,22 @@ typedef struct SilenceRemoveContext { double (*compute)(struct SilenceRemoveContext *s, AVFrame *frame, int ch, int offset); void (*copy)(struct SilenceRemoveContext *s, AVFrame *out, AVFrame *in, int ch, int out_offset, int in_offset); + + AVAudioFifo *fifo; } SilenceRemoveContext; #define OFFSET(x) offsetof(SilenceRemoveContext, x) #define AF AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_AUDIO_PARAM static const AVOption silenceremove_options[] = { - { "start_periods", NULL, OFFSET(start_periods), AV_OPT_TYPE_INT, {.i64=0}, 0, 9000, AF }, + { "start_periods", "set periods of silence parts to skip from start", OFFSET(start_periods), AV_OPT_TYPE_INT, {.i64=0}, 0, 9000, AF }, { "start_duration", "set start duration of non-silence part", OFFSET(start_duration_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT32_MAX, AF }, { "start_threshold", "set threshold for start silence detection", OFFSET(start_threshold), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, DBL_MAX, AF }, { "start_silence", "set start duration of silence part to keep", OFFSET(start_silence_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT32_MAX, AF }, { "start_mode", "set which channel will trigger trimming from start", OFFSET(start_mode), AV_OPT_TYPE_INT, {.i64=T_ANY}, T_ANY, T_ALL, AF, "mode" }, { "any", 0, 0, AV_OPT_TYPE_CONST, {.i64=T_ANY}, 0, 0, AF, "mode" }, { "all", 0, 0, AV_OPT_TYPE_CONST, {.i64=T_ALL}, 0, 0, AF, "mode" }, - { "stop_periods", NULL, OFFSET(stop_periods), AV_OPT_TYPE_INT, {.i64=0}, -9000, 9000, AF }, + { "stop_periods", "set periods of silence parts to skip from end", OFFSET(stop_periods), AV_OPT_TYPE_INT, {.i64=0}, -9000, 9000, AF }, { "stop_duration", "set stop duration of non-silence part", OFFSET(stop_duration_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT32_MAX, AF }, { "stop_threshold", "set threshold for stop silence detection", OFFSET(stop_threshold), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, DBL_MAX, AF }, { "stop_silence", "set stop duration of silence part to keep", OFFSET(stop_silence_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT32_MAX, AF }, @@ -120,7 +127,7 @@ static const AVOption silenceremove_options[] = { { "detection", "set how silence is detected", OFFSET(detection), AV_OPT_TYPE_INT, {.i64=D_RMS}, D_PEAK,D_RMS, AF, "detection" }, { "peak", "use absolute values of samples", 0, AV_OPT_TYPE_CONST, {.i64=D_PEAK},0, 0, AF, "detection" }, { "rms", "use squared values of samples", 0, AV_OPT_TYPE_CONST, {.i64=D_RMS}, 0, 0, AF, "detection" }, - { "window", "set duration of window in seconds", OFFSET(window_ratio), AV_OPT_TYPE_DOUBLE, {.dbl=0.02}, 0, 10, AF }, + { "window", "set duration of window for silence detection", OFFSET(window_duration_opt), AV_OPT_TYPE_DURATION, {.i64=20000}, 0, 100000000, AF }, { NULL } }; @@ -176,9 +183,10 @@ static double compute_peak_double(SilenceRemoveContext *s, AVFrame *frame, int c new_sum = s->sum; new_sum -= wsample; + new_sum = fmax(new_sum, 0.); new_sum += fabs(sample); - return new_sum / s->window_size; + return new_sum / s->window_duration; } static void update_peak_double(SilenceRemoveContext *s, AVFrame *frame, int ch, int offset) @@ -189,6 +197,7 @@ static void update_peak_double(SilenceRemoveContext *s, AVFrame *frame, int ch, double *wsample = &wsamples[frame->channels * s->window_offset + ch]; s->sum -= *wsample; + s->sum = fmax(s->sum, 0.); *wsample = fabs(sample); s->sum += *wsample; } @@ -203,9 +212,10 @@ static double compute_peak_float(SilenceRemoveContext *s, AVFrame *frame, int ch new_sum = s->sum; new_sum -= wsample; + new_sum = fmaxf(new_sum, 0.f); new_sum += fabsf(sample); - return new_sum / s->window_size; + return new_sum / s->window_duration; } static void update_peak_float(SilenceRemoveContext *s, AVFrame *frame, int ch, int offset) @@ -216,6 +226,7 @@ static void update_peak_float(SilenceRemoveContext *s, AVFrame *frame, int ch, i float *wsample = &wsamples[frame->channels * s->window_offset + ch]; s->sum -= *wsample; + s->sum = fmaxf(s->sum, 0.f); *wsample = fabsf(sample); s->sum += *wsample; } @@ -230,9 +241,11 @@ static double compute_rms_double(SilenceRemoveContext *s, AVFrame *frame, int ch new_sum = s->sum; new_sum -= wsample; + new_sum = fmax(new_sum, 0.); new_sum += sample * sample; - return sqrt(new_sum / s->window_size); + av_assert2(new_sum >= 0.); + return sqrt(new_sum / s->window_duration); } static void update_rms_double(SilenceRemoveContext *s, AVFrame *frame, int ch, int offset) @@ -243,6 +256,7 @@ static void update_rms_double(SilenceRemoveContext *s, AVFrame *frame, int ch, i double *wsample = &wsamples[frame->channels * s->window_offset + ch]; s->sum -= *wsample; + s->sum = fmax(s->sum, 0.); *wsample = sample * sample; s->sum += *wsample; } @@ -257,9 +271,11 @@ static double compute_rms_float(SilenceRemoveContext *s, AVFrame *frame, int ch, new_sum = s->sum; new_sum -= wsample; + new_sum = fmaxf(new_sum, 0.f); new_sum += sample * sample; - return sqrtf(new_sum / s->window_size); + av_assert2(new_sum >= 0.f); + return sqrtf(new_sum / s->window_duration); } static void update_rms_float(SilenceRemoveContext *s, AVFrame *frame, int ch, int offset) @@ -270,6 +286,7 @@ static void update_rms_float(SilenceRemoveContext *s, AVFrame *frame, int ch, in float *wsample = &wsamples[frame->channels * s->window_offset + ch]; s->sum -= *wsample; + s->sum = fmaxf(s->sum, 0.f); *wsample = sample * sample; s->sum += *wsample; } @@ -284,9 +301,10 @@ static double compute_peak_doublep(SilenceRemoveContext *s, AVFrame *frame, int new_sum = s->sum; new_sum -= wsample; + new_sum = fmax(new_sum, 0.); new_sum += fabs(sample); - return new_sum / s->window_size; + return new_sum / s->window_duration; } static void update_peak_doublep(SilenceRemoveContext *s, AVFrame *frame, int ch, int offset) @@ -297,6 +315,7 @@ static void update_peak_doublep(SilenceRemoveContext *s, AVFrame *frame, int ch, double *wsample = &wsamples[s->window_offset]; s->sum -= *wsample; + s->sum = fmax(s->sum, 0.); *wsample = fabs(sample); s->sum += *wsample; } @@ -311,9 +330,10 @@ static double compute_peak_floatp(SilenceRemoveContext *s, AVFrame *frame, int c new_sum = s->sum; new_sum -= wsample; + new_sum = fmaxf(new_sum, 0.f); new_sum += fabsf(sample); - return new_sum / s->window_size; + return new_sum / s->window_duration; } static void update_peak_floatp(SilenceRemoveContext *s, AVFrame *frame, int ch, int offset) @@ -324,6 +344,7 @@ static void update_peak_floatp(SilenceRemoveContext *s, AVFrame *frame, int ch, float *wsample = &wsamples[s->window_offset]; s->sum -= *wsample; + s->sum = fmaxf(s->sum, 0.f); *wsample = fabsf(sample); s->sum += *wsample; } @@ -338,9 +359,11 @@ static double compute_rms_doublep(SilenceRemoveContext *s, AVFrame *frame, int c new_sum = s->sum; new_sum -= wsample; + new_sum = fmax(new_sum, 0.); new_sum += sample * sample; - return sqrt(new_sum / s->window_size); + av_assert2(new_sum >= 0.); + return sqrt(new_sum / s->window_duration); } static void update_rms_doublep(SilenceRemoveContext *s, AVFrame *frame, int ch, int offset) @@ -351,6 +374,7 @@ static void update_rms_doublep(SilenceRemoveContext *s, AVFrame *frame, int ch, double *wsample = &wsamples[s->window_offset]; s->sum -= *wsample; + s->sum = fmax(s->sum, 0.); *wsample = sample * sample; s->sum += *wsample; } @@ -365,9 +389,11 @@ static double compute_rms_floatp(SilenceRemoveContext *s, AVFrame *frame, int ch new_sum = s->sum; new_sum -= wsample; + new_sum = fmaxf(new_sum, 0.f); new_sum += sample * sample; - return sqrtf(new_sum / s->window_size); + av_assert2(new_sum >= 0.f); + return sqrtf(new_sum / s->window_duration); } static void update_rms_floatp(SilenceRemoveContext *s, AVFrame *frame, int ch, int offset) @@ -378,6 +404,7 @@ static void update_rms_floatp(SilenceRemoveContext *s, AVFrame *frame, int ch, i float *wsample = &wsamples[s->window_offset]; s->sum -= *wsample; + s->sum = fmaxf(s->sum, 0.f); *wsample = sample * sample; s->sum += *wsample; } @@ -396,7 +423,7 @@ static av_cold int init(AVFilterContext *ctx) static void clear_window(SilenceRemoveContext *s) { - av_samples_set_silence(s->window->extended_data, 0, s->window_size, + av_samples_set_silence(s->window->extended_data, 0, s->window_duration, s->window->channels, s->window->format); s->window_offset = 0; @@ -408,9 +435,12 @@ static int config_input(AVFilterLink *inlink) AVFilterContext *ctx = inlink->dst; SilenceRemoveContext *s = ctx->priv; + s->threshold = -1; s->next_pts = AV_NOPTS_VALUE; - s->window_size = FFMAX((inlink->sample_rate * s->window_ratio), 1); - s->window = ff_get_audio_buffer(ctx->outputs[0], s->window_size); + s->window_duration = av_rescale(s->window_duration_opt, inlink->sample_rate, + AV_TIME_BASE); + s->window_duration = FFMAX(1, s->window_duration); + s->window = ff_get_audio_buffer(ctx->outputs[0], s->window_duration); if (!s->window) return AVERROR(ENOMEM); @@ -462,90 +492,87 @@ static int config_input(AVFilterLink *inlink) case AV_SAMPLE_FMT_DBL: s->copy = copy_double; switch (s->detection) { - case D_PEAK: - s->update = update_peak_double; - s->compute = compute_peak_double; - break; - case D_RMS: - s->update = update_rms_double; - s->compute = compute_rms_double; - break; + case D_PEAK: + s->update = update_peak_double; + s->compute = compute_peak_double; + break; + case D_RMS: + s->update = update_rms_double; + s->compute = compute_rms_double; + break; } break; case AV_SAMPLE_FMT_FLT: s->copy = copy_float; switch (s->detection) { - case D_PEAK: - s->update = update_peak_float; - s->compute = compute_peak_float; - break; - case D_RMS: - s->update = update_rms_float; - s->compute = compute_rms_float; - break; + case D_PEAK: + s->update = update_peak_float; + s->compute = compute_peak_float; + break; + case D_RMS: + s->update = update_rms_float; + s->compute = compute_rms_float; + break; } break; case AV_SAMPLE_FMT_DBLP: s->copy = copy_doublep; switch (s->detection) { - case D_PEAK: - s->update = update_peak_doublep; - s->compute = compute_peak_doublep; - break; - case D_RMS: - s->update = update_rms_doublep; - s->compute = compute_rms_doublep; - break; + case D_PEAK: + s->update = update_peak_doublep; + s->compute = compute_peak_doublep; + break; + case D_RMS: + s->update = update_rms_doublep; + s->compute = compute_rms_doublep; + break; } break; case AV_SAMPLE_FMT_FLTP: s->copy = copy_floatp; switch (s->detection) { - case D_PEAK: - s->update = update_peak_floatp; - s->compute = compute_peak_floatp; - break; - case D_RMS: - s->update = update_rms_floatp; - s->compute = compute_rms_floatp; - break; + case D_PEAK: + s->update = update_peak_floatp; + s->compute = compute_peak_floatp; + break; + case D_RMS: + s->update = update_rms_floatp; + s->compute = compute_rms_floatp; + break; } break; + default: + return AVERROR_BUG; } + s->fifo = av_audio_fifo_alloc(inlink->format, inlink->channels, 1024); + if (!s->fifo) + return AVERROR(ENOMEM); + return 0; } static void flush(SilenceRemoveContext *s, AVFrame *out, AVFilterLink *outlink, - int *nb_samples_written, int *ret, int flush_silence) + int *nb_samples_written, int flush_silence) { AVFrame *silence; if (*nb_samples_written) { out->nb_samples = *nb_samples_written; - out->pts = s->next_pts; - s->next_pts += av_rescale_q(out->nb_samples, - (AVRational){1, outlink->sample_rate}, - outlink->time_base); - - *ret = ff_filter_frame(outlink, out); - if (*ret < 0) - return; + av_audio_fifo_write(s->fifo, (void **)out->extended_data, out->nb_samples); *nb_samples_written = 0; - } else { - av_frame_free(&out); } + av_frame_free(&out); + if (s->stop_silence_end <= 0 || !flush_silence) return; silence = ff_get_audio_buffer(outlink, s->stop_silence_end); - if (!silence) { - *ret = AVERROR(ENOMEM); + if (!silence) return; - } if (s->stop_silence_offset < s->stop_silence_end) { av_samples_copy(silence->extended_data, s->stop_silence_hold->extended_data, 0, @@ -564,12 +591,8 @@ static void flush(SilenceRemoveContext *s, s->stop_silence_offset = 0; s->stop_silence_end = 0; - silence->pts = s->next_pts; - s->next_pts += av_rescale_q(silence->nb_samples, - (AVRational){1, outlink->sample_rate}, - outlink->time_base); - - *ret = ff_filter_frame(outlink, silence); + av_audio_fifo_write(s->fifo, (void **)silence->extended_data, silence->nb_samples); + av_frame_free(&silence); } static int filter_frame(AVFilterLink *inlink, AVFrame *in) @@ -577,8 +600,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) AVFilterContext *ctx = inlink->dst; AVFilterLink *outlink = ctx->outputs[0]; SilenceRemoveContext *s = ctx->priv; - int i, j, threshold, ret = 0; int nbs, nb_samples_read, nb_samples_written; + int i, j, threshold, ret = 0; AVFrame *out; nb_samples_read = nb_samples_written = 0; @@ -606,6 +629,10 @@ silence_trim: } } + if (s->threshold >= 0) + s->one_period = s->threshold != threshold; + s->threshold = threshold; + if (threshold) { for (j = 0; j < outlink->channels; j++) { s->update(s, in, j, nb_samples_read); @@ -613,13 +640,14 @@ silence_trim: } s->window_offset++; - if (s->window_offset >= s->window_size) + if (s->window_offset >= s->window_duration) s->window_offset = 0; s->start_holdoff_end++; nb_samples_read++; if (s->start_holdoff_end >= s->start_duration) { - if (++s->start_found_periods >= s->start_periods) { + s->start_found_periods += s->one_period; + if (s->start_found_periods >= s->start_periods) { s->mode = SILENCE_TRIM_FLUSH; goto silence_trim_flush; } @@ -639,7 +667,7 @@ silence_trim: } s->window_offset++; - if (s->window_offset >= s->window_size) + if (s->window_offset >= s->window_duration) s->window_offset = 0; nb_samples_read++; s->start_silence_offset++; @@ -686,14 +714,10 @@ silence_trim_flush: s->start_holdoff_offset, nbs, outlink->channels, outlink->format); - out->pts = s->next_pts; - s->next_pts += av_rescale_q(out->nb_samples, - (AVRational){1, outlink->sample_rate}, - outlink->time_base); - s->start_holdoff_offset += nbs; - ret = ff_filter_frame(outlink, out); + av_audio_fifo_write(s->fifo, (void **)out->extended_data, out->nb_samples); + av_frame_free(&out); if (s->start_holdoff_offset == s->start_holdoff_end) { s->start_holdoff_offset = 0; @@ -731,9 +755,13 @@ silence_copy: } } + if (s->threshold >= 0) + s->one_period = s->threshold != threshold; + s->threshold = threshold; + if (threshold && s->stop_holdoff_end && !s->stop_silence) { s->mode = SILENCE_COPY_FLUSH; - flush(s, out, outlink, &nb_samples_written, &ret, 0); + flush(s, out, outlink, &nb_samples_written, 0); goto silence_copy_flush; } else if (threshold) { for (j = 0; j < outlink->channels; j++) { @@ -742,38 +770,42 @@ silence_copy: } s->window_offset++; - if (s->window_offset >= s->window_size) + if (s->window_offset >= s->window_duration) s->window_offset = 0; nb_samples_read++; nb_samples_written++; } else if (!threshold) { for (j = 0; j < outlink->channels; j++) { s->update(s, in, j, nb_samples_read); - if (s->stop_silence) { + if (s->stop_silence) s->copy(s, s->stop_silence_hold, in, j, s->stop_silence_offset, nb_samples_read); - s->stop_silence_end = FFMIN(s->stop_silence_end + 1, s->stop_silence); - if (s->stop_silence_offset >= s->stop_silence) { - s->stop_silence_offset = 0; - } - } s->copy(s, s->stop_holdoff, in, j, s->stop_holdoff_end, nb_samples_read); } + if (s->stop_silence) { + s->stop_silence_offset++; + s->stop_silence_end = FFMIN(s->stop_silence_end + 1, s->stop_silence); + if (s->stop_silence_offset >= s->stop_silence) { + s->stop_silence_offset = 0; + } + } + s->window_offset++; - if (s->window_offset >= s->window_size) + if (s->window_offset >= s->window_duration) s->window_offset = 0; nb_samples_read++; s->stop_holdoff_end++; if (s->stop_holdoff_end >= s->stop_duration) { - if (++s->stop_found_periods >= s->stop_periods) { + s->stop_found_periods += s->one_period; + if (s->stop_found_periods >= s->stop_periods) { s->stop_holdoff_offset = 0; s->stop_holdoff_end = 0; if (!s->restart) { s->mode = SILENCE_STOP; - flush(s, out, outlink, &nb_samples_written, &ret, 1); + flush(s, out, outlink, &nb_samples_written, 1); goto silence_stop; } else { s->stop_found_periods = 0; @@ -784,29 +816,25 @@ silence_copy: s->start_silence_end = 0; clear_window(s); s->mode = SILENCE_TRIM; - flush(s, out, outlink, &nb_samples_written, &ret, 1); + flush(s, out, outlink, &nb_samples_written, 1); goto silence_trim; } } s->mode = SILENCE_COPY_FLUSH; - flush(s, out, outlink, &nb_samples_written, &ret, 0); + flush(s, out, outlink, &nb_samples_written, 0); goto silence_copy_flush; } } } - flush(s, out, outlink, &nb_samples_written, &ret, 0); + flush(s, out, outlink, &nb_samples_written, 0); } else { av_samples_copy(out->extended_data, in->extended_data, nb_samples_written, nb_samples_read, nbs, outlink->channels, outlink->format); - out->pts = s->next_pts; - s->next_pts += av_rescale_q(out->nb_samples, - (AVRational){1, outlink->sample_rate}, - outlink->time_base); - - ret = ff_filter_frame(outlink, out); + av_audio_fifo_write(s->fifo, (void **)out->extended_data, out->nb_samples); + av_frame_free(&out); } break; @@ -828,12 +856,8 @@ silence_copy_flush: s->stop_holdoff_offset += nbs; - out->pts = s->next_pts; - s->next_pts += av_rescale_q(out->nb_samples, - (AVRational){1, outlink->sample_rate}, - outlink->time_base); - - ret = ff_filter_frame(outlink, out); + av_audio_fifo_write(s->fifo, (void **)out->extended_data, out->nb_samples); + av_frame_free(&out); if (s->stop_holdoff_offset == s->stop_holdoff_end) { s->stop_holdoff_offset = 0; @@ -847,10 +871,26 @@ silence_copy_flush: case SILENCE_STOP: silence_stop: break; + default: + ret = AVERROR_BUG; } av_frame_free(&in); + if (av_audio_fifo_size(s->fifo) > 0) { + out = ff_get_audio_buffer(outlink, av_audio_fifo_size(s->fifo)); + if (!out) + return AVERROR(ENOMEM); + + av_audio_fifo_read(s->fifo, (void **)out->extended_data, out->nb_samples); + out->pts = s->next_pts; + s->next_pts += av_rescale_q(out->nb_samples, + (AVRational){1, outlink->sample_rate}, + outlink->time_base); + + ret = ff_filter_frame(outlink, out); + } + return ret; } @@ -889,33 +929,20 @@ static int request_frame(AVFilterLink *outlink) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts = NULL; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static av_cold void uninit(AVFilterContext *ctx) @@ -927,6 +954,9 @@ static av_cold void uninit(AVFilterContext *ctx) av_frame_free(&s->stop_holdoff); av_frame_free(&s->stop_silence_hold); av_frame_free(&s->window); + + av_audio_fifo_free(s->fifo); + s->fifo = NULL; } static const AVFilterPad silenceremove_inputs[] = { @@ -936,7 +966,6 @@ static const AVFilterPad silenceremove_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad silenceremove_outputs[] = { @@ -945,7 +974,6 @@ static const AVFilterPad silenceremove_outputs[] = { .type = AVMEDIA_TYPE_AUDIO, .request_frame = request_frame, }, - { NULL } }; const AVFilter ff_af_silenceremove = { @@ -956,6 +984,6 @@ const AVFilter ff_af_silenceremove = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = silenceremove_inputs, - .outputs = silenceremove_outputs, + FILTER_INPUTS(silenceremove_inputs), + FILTER_OUTPUTS(silenceremove_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_sofalizer.c b/chromium/third_party/ffmpeg/libavfilter/af_sofalizer.c index 1bffd57de91..52832e0ee2d 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_sofalizer.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_sofalizer.c @@ -604,9 +604,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.temp_afft = s->temp_afft; if (s->type == TIME_DOMAIN) { - ctx->internal->execute(ctx, sofalizer_convolute, &td, NULL, 2); + ff_filter_execute(ctx, sofalizer_convolute, &td, NULL, 2); } else if (s->type == FREQUENCY_DOMAIN) { - ctx->internal->execute(ctx, sofalizer_fast_convolute, &td, NULL, 2); + ff_filter_execute(ctx, sofalizer_fast_convolute, &td, NULL, 2); } emms_c(); @@ -648,7 +648,6 @@ static int activate(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { struct SOFAlizerContext *s = ctx->priv; - AVFilterFormats *formats = NULL; AVFilterChannelLayouts *layouts = NULL; int ret, sample_rates[] = { 48000, -1 }; static const enum AVSampleFormat sample_fmts[] = { @@ -656,10 +655,7 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_NONE }; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret) return ret; @@ -681,10 +677,7 @@ static int query_formats(AVFilterContext *ctx) return ret; sample_rates[0] = s->sample_rate; - formats = ff_make_format_list(sample_rates); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_samplerates_from_list(ctx, sample_rates); } static int getfilter_float(AVFilterContext *ctx, float x, float y, float z, @@ -1102,7 +1095,6 @@ static const AVFilterPad inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -1110,7 +1102,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_sofalizer = { @@ -1122,7 +1113,7 @@ const AVFilter ff_af_sofalizer = { .activate = activate, .uninit = uninit, .query_formats = query_formats, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .flags = AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_speechnorm.c b/chromium/third_party/ffmpeg/libavfilter/af_speechnorm.c index d0441773527..f56ca8e5586 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_speechnorm.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_speechnorm.c @@ -116,32 +116,19 @@ AVFILTER_DEFINE_CLASS(speechnorm); static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static int get_pi_samples(PeriodItem *pi, int start, int end, int remain) @@ -249,7 +236,7 @@ static double min_gain(AVFilterContext *ctx, ChannelContext *cc, int max_size) return min_gain; } -#define ANALYZE_CHANNEL(name, ptype, zero) \ +#define ANALYZE_CHANNEL(name, ptype, zero, min_peak) \ static void analyze_channel_## name (AVFilterContext *ctx, ChannelContext *cc, \ const uint8_t *srcp, int nb_samples) \ { \ @@ -263,11 +250,11 @@ static void analyze_channel_## name (AVFilterContext *ctx, ChannelContext *cc, while (n < nb_samples) { \ if ((cc->state != (src[n] >= zero)) || \ (cc->pi[cc->pi_end].size > s->max_period)) { \ - double max_peak = cc->pi[cc->pi_end].max_peak; \ + ptype max_peak = cc->pi[cc->pi_end].max_peak; \ int state = cc->state; \ cc->state = src[n] >= zero; \ av_assert0(cc->pi[cc->pi_end].size > 0); \ - if (cc->pi[cc->pi_end].max_peak >= MIN_PEAK || \ + if (max_peak >= min_peak || \ cc->pi[cc->pi_end].size > s->max_period) { \ cc->pi[cc->pi_end].type = 1; \ cc->pi_end++; \ @@ -303,8 +290,8 @@ static void analyze_channel_## name (AVFilterContext *ctx, ChannelContext *cc, } \ } -ANALYZE_CHANNEL(dbl, double, 0.0) -ANALYZE_CHANNEL(flt, float, 0.f) +ANALYZE_CHANNEL(dbl, double, 0.0, MIN_PEAK) +ANALYZE_CHANNEL(flt, float, 0.f, (float)MIN_PEAK) #define FILTER_CHANNELS(name, ptype) \ static void filter_channels_## name (AVFilterContext *ctx, \ @@ -328,7 +315,7 @@ static void filter_channels_## name (AVFilterContext *ctx, av_assert0(size > 0); \ gain = cc->gain_state; \ consume_pi(cc, size); \ - for (int i = n; i < n + size; i++) \ + for (int i = n; !ctx->is_disabled && i < n + size; i++) \ dst[i] *= gain; \ n += size; \ } \ @@ -338,12 +325,17 @@ static void filter_channels_## name (AVFilterContext *ctx, FILTER_CHANNELS(dbl, double) FILTER_CHANNELS(flt, float) -static double lerp(double min, double max, double mix) +static double dlerp(double min, double max, double mix) { return min + (max - min) * mix; } -#define FILTER_LINK_CHANNELS(name, ptype) \ +static float flerp(float min, float max, float mix) +{ + return min + (max - min) * mix; +} + +#define FILTER_LINK_CHANNELS(name, ptype, tlerp) \ static void filter_link_channels_## name (AVFilterContext *ctx, \ AVFrame *in, int nb_samples) \ { \ @@ -383,8 +375,8 @@ static void filter_link_channels_## name (AVFilterContext *ctx, if (cc->bypass) \ continue; \ \ - for (int i = n; i < n + min_size; i++) { \ - ptype g = lerp(s->prev_gain, gain, (i - n) / (double)min_size); \ + for (int i = n; !ctx->is_disabled && i < n + min_size; i++) { \ + ptype g = tlerp(s->prev_gain, gain, (i - n) / (ptype)min_size); \ dst[i] *= g; \ } \ } \ @@ -394,8 +386,8 @@ static void filter_link_channels_## name (AVFilterContext *ctx, } \ } -FILTER_LINK_CHANNELS(dbl, double) -FILTER_LINK_CHANNELS(flt, float) +FILTER_LINK_CHANNELS(dbl, double, dlerp) +FILTER_LINK_CHANNELS(flt, float, flerp) static int filter_frame(AVFilterContext *ctx) { @@ -418,11 +410,14 @@ static int filter_frame(AVFilterContext *ctx) in = ff_bufqueue_get(&s->queue); - av_frame_make_writable(in); + ret = av_frame_make_writable(in); + if (ret < 0) + return ret; s->filter_channels[s->link](ctx, in, in->nb_samples); - s->pts = in->pts + in->nb_samples; + s->pts = in->pts + av_rescale_q(in->nb_samples, av_make_q(1, outlink->sample_rate), + outlink->time_base); return ff_filter_frame(outlink, in); } @@ -555,7 +550,6 @@ static const AVFilterPad inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -563,7 +557,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_speechnorm = { @@ -574,7 +567,8 @@ const AVFilter ff_af_speechnorm = { .priv_class = &speechnorm_class, .activate = activate, .uninit = uninit, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), + .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, .process_command = process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_stereotools.c b/chromium/third_party/ffmpeg/libavfilter/af_stereotools.c index d60fa55ccd3..d4aca66a927 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_stereotools.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_stereotools.c @@ -111,8 +111,7 @@ static int query_formats(AVFilterContext *ctx) (ret = ff_set_common_channel_layouts (ctx , layout )) < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static int config_input(AVFilterLink *inlink) @@ -364,7 +363,6 @@ static const AVFilterPad inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -372,7 +370,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_stereotools = { @@ -382,8 +379,8 @@ const AVFilter ff_af_stereotools = { .priv_size = sizeof(StereoToolsContext), .priv_class = &stereotools_class, .uninit = uninit, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .process_command = process_command, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_stereowiden.c b/chromium/third_party/ffmpeg/libavfilter/af_stereowiden.c index 1fbb635841e..ce194ec5b47 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_stereowiden.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_stereowiden.c @@ -64,8 +64,7 @@ static int query_formats(AVFilterContext *ctx) (ret = ff_set_common_channel_layouts (ctx , layout )) < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static int config_input(AVFilterLink *inlink) @@ -145,7 +144,6 @@ static const AVFilterPad inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -153,7 +151,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_stereowiden = { @@ -163,8 +160,8 @@ const AVFilter ff_af_stereowiden = { .priv_size = sizeof(StereoWidenContext), .priv_class = &stereowiden_class, .uninit = uninit, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, .process_command = ff_filter_process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_superequalizer.c b/chromium/third_party/ffmpeg/libavfilter/af_superequalizer.c index aa8b6376b09..69e03e88204 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_superequalizer.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_superequalizer.c @@ -272,27 +272,18 @@ static av_cold int init(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if ((ret = ff_set_common_formats(ctx, formats)) < 0) + if ((ret = ff_set_common_formats_from_list(ctx, sample_fmts)) < 0) return ret; - formats = ff_all_samplerates(); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static int config_input(AVFilterLink *inlink) @@ -335,7 +326,6 @@ static const AVFilterPad superequalizer_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_input, }, - { NULL } }; static const AVFilterPad superequalizer_outputs[] = { @@ -344,7 +334,6 @@ static const AVFilterPad superequalizer_outputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_output, }, - { NULL } }; #define AF AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM @@ -383,6 +372,6 @@ const AVFilter ff_af_superequalizer = { .init = init, .activate = activate, .uninit = uninit, - .inputs = superequalizer_inputs, - .outputs = superequalizer_outputs, + FILTER_INPUTS(superequalizer_inputs), + FILTER_OUTPUTS(superequalizer_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_surround.c b/chromium/third_party/ffmpeg/libavfilter/af_surround.c index 3fb7a1bbba8..33190de2482 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_surround.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_surround.c @@ -188,10 +188,7 @@ static int query_formats(AVFilterContext *ctx) if (ret) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static int config_input(AVFilterLink *inlink) @@ -1589,7 +1586,7 @@ static int filter_frame(AVFilterLink *inlink) if (ret < 0) return ret; - ctx->internal->execute(ctx, fft_channel, NULL, NULL, inlink->channels); + ff_filter_execute(ctx, fft_channel, NULL, NULL, inlink->channels); s->filter(ctx); @@ -1597,7 +1594,7 @@ static int filter_frame(AVFilterLink *inlink) if (!out) return AVERROR(ENOMEM); - ctx->internal->execute(ctx, ifft_channel, out, NULL, outlink->channels); + ff_filter_execute(ctx, ifft_channel, out, NULL, outlink->channels); out->pts = s->pts; if (s->pts != AV_NOPTS_VALUE) @@ -1773,7 +1770,6 @@ static const AVFilterPad inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -1782,7 +1778,6 @@ static const AVFilterPad outputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_af_surround = { @@ -1794,7 +1789,7 @@ const AVFilter ff_af_surround = { .init = init, .uninit = uninit, .activate = activate, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .flags = AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_tremolo.c b/chromium/third_party/ffmpeg/libavfilter/af_tremolo.c index 8f9e3100409..1ab7832d47e 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_tremolo.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_tremolo.c @@ -85,32 +85,19 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static av_cold void uninit(AVFilterContext *ctx) @@ -149,7 +136,6 @@ static const AVFilterPad avfilter_af_tremolo_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad avfilter_af_tremolo_outputs[] = { @@ -157,7 +143,6 @@ static const AVFilterPad avfilter_af_tremolo_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_tremolo = { @@ -167,6 +152,6 @@ const AVFilter ff_af_tremolo = { .priv_class = &tremolo_class, .uninit = uninit, .query_formats = query_formats, - .inputs = avfilter_af_tremolo_inputs, - .outputs = avfilter_af_tremolo_outputs, + FILTER_INPUTS(avfilter_af_tremolo_inputs), + FILTER_OUTPUTS(avfilter_af_tremolo_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_vibrato.c b/chromium/third_party/ffmpeg/libavfilter/af_vibrato.c index fe4d1945318..ec6f6558b0e 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_vibrato.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_vibrato.c @@ -113,32 +113,19 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static av_cold void uninit(AVFilterContext *ctx) @@ -187,7 +174,6 @@ static const AVFilterPad avfilter_af_vibrato_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad avfilter_af_vibrato_outputs[] = { @@ -195,7 +181,6 @@ static const AVFilterPad avfilter_af_vibrato_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_vibrato = { @@ -205,6 +190,6 @@ const AVFilter ff_af_vibrato = { .priv_class = &vibrato_class, .uninit = uninit, .query_formats = query_formats, - .inputs = avfilter_af_vibrato_inputs, - .outputs = avfilter_af_vibrato_outputs, + FILTER_INPUTS(avfilter_af_vibrato_inputs), + FILTER_OUTPUTS(avfilter_af_vibrato_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_volume.c b/chromium/third_party/ffmpeg/libavfilter/af_volume.c index 844ddbeff73..2d4012bfbfb 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_volume.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_volume.c @@ -132,8 +132,6 @@ static av_cold void uninit(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { VolumeContext *vol = ctx->priv; - AVFilterFormats *formats = NULL; - AVFilterChannelLayouts *layouts; static const enum AVSampleFormat sample_fmts[][7] = { [PRECISION_FIXED] = { AV_SAMPLE_FMT_U8, @@ -155,26 +153,15 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_NONE } }; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - formats = ff_make_format_list(sample_fmts[vol->precision]); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats_from_list(ctx, sample_fmts[vol->precision]); if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static inline void scale_samples_u8(uint8_t *dst, const uint8_t *src, @@ -465,7 +452,6 @@ static const AVFilterPad avfilter_af_volume_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad avfilter_af_volume_outputs[] = { @@ -474,7 +460,6 @@ static const AVFilterPad avfilter_af_volume_outputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_af_volume = { @@ -485,8 +470,8 @@ const AVFilter ff_af_volume = { .priv_class = &volume_class, .init = init, .uninit = uninit, - .inputs = avfilter_af_volume_inputs, - .outputs = avfilter_af_volume_outputs, + FILTER_INPUTS(avfilter_af_volume_inputs), + FILTER_OUTPUTS(avfilter_af_volume_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, .process_command = process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/af_volumedetect.c b/chromium/third_party/ffmpeg/libavfilter/af_volumedetect.c index 61af21797c7..412b690302d 100644 --- a/chromium/third_party/ffmpeg/libavfilter/af_volumedetect.c +++ b/chromium/third_party/ffmpeg/libavfilter/af_volumedetect.c @@ -40,21 +40,11 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_NONE }; - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; - int ret; - - if (!(formats = ff_make_format_list(sample_fmts))) - return AVERROR(ENOMEM); - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, sample_fmts); } static int filter_frame(AVFilterLink *inlink, AVFrame *samples) @@ -144,7 +134,6 @@ static const AVFilterPad volumedetect_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad volumedetect_outputs[] = { @@ -152,7 +141,6 @@ static const AVFilterPad volumedetect_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_volumedetect = { @@ -161,6 +149,6 @@ const AVFilter ff_af_volumedetect = { .priv_size = sizeof(VolDetectContext), .query_formats = query_formats, .uninit = uninit, - .inputs = volumedetect_inputs, - .outputs = volumedetect_outputs, + FILTER_INPUTS(volumedetect_inputs), + FILTER_OUTPUTS(volumedetect_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/allfilters.c b/chromium/third_party/ffmpeg/libavfilter/allfilters.c index ae74f9c891d..ddd64042284 100644 --- a/chromium/third_party/ffmpeg/libavfilter/allfilters.c +++ b/chromium/third_party/ffmpeg/libavfilter/allfilters.c @@ -33,6 +33,7 @@ extern const AVFilter ff_af_acrossover; extern const AVFilter ff_af_acrusher; extern const AVFilter ff_af_adeclick; extern const AVFilter ff_af_adeclip; +extern const AVFilter ff_af_adecorrelate; extern const AVFilter ff_af_adelay; extern const AVFilter ff_af_adenorm; extern const AVFilter ff_af_aderivative; @@ -66,11 +67,13 @@ extern const AVFilter ff_af_apad; extern const AVFilter ff_af_aperms; extern const AVFilter ff_af_aphaser; extern const AVFilter ff_af_aphaseshift; +extern const AVFilter ff_af_apsyclip; extern const AVFilter ff_af_apulsator; extern const AVFilter ff_af_arealtime; extern const AVFilter ff_af_aresample; extern const AVFilter ff_af_areverse; extern const AVFilter ff_af_arnndn; +extern const AVFilter ff_af_asegment; extern const AVFilter ff_af_aselect; extern const AVFilter ff_af_asendcmd; extern const AVFilter ff_af_asetnsamples; @@ -90,6 +93,7 @@ extern const AVFilter ff_af_asupercut; extern const AVFilter ff_af_asuperpass; extern const AVFilter ff_af_asuperstop; extern const AVFilter ff_af_atempo; +extern const AVFilter ff_af_atilt; extern const AVFilter ff_af_atrim; extern const AVFilter ff_af_axcorrelate; extern const AVFilter ff_af_azmq; @@ -271,6 +275,7 @@ extern const AVFilter ff_vf_gblur; extern const AVFilter ff_vf_geq; extern const AVFilter ff_vf_gradfun; extern const AVFilter ff_vf_graphmonitor; +extern const AVFilter ff_vf_grayworld; extern const AVFilter ff_vf_greyedge; extern const AVFilter ff_vf_guided; extern const AVFilter ff_vf_haldclut; @@ -280,6 +285,8 @@ extern const AVFilter ff_vf_histogram; extern const AVFilter ff_vf_hqdn3d; extern const AVFilter ff_vf_hqx; extern const AVFilter ff_vf_hstack; +extern const AVFilter ff_vf_hsvhold; +extern const AVFilter ff_vf_hsvkey; extern const AVFilter ff_vf_hue; extern const AVFilter ff_vf_hwdownload; extern const AVFilter ff_vf_hwmap; @@ -384,7 +391,9 @@ extern const AVFilter ff_vf_scale_vaapi; extern const AVFilter ff_vf_scale_vulkan; extern const AVFilter ff_vf_scale2ref; extern const AVFilter ff_vf_scdet; +extern const AVFilter ff_vf_scharr; extern const AVFilter ff_vf_scroll; +extern const AVFilter ff_vf_segment; extern const AVFilter ff_vf_select; extern const AVFilter ff_vf_selectivecolor; extern const AVFilter ff_vf_sendcmd; diff --git a/chromium/third_party/ffmpeg/libavfilter/asink_anullsink.c b/chromium/third_party/ffmpeg/libavfilter/asink_anullsink.c index dce0204839c..64a733e1656 100644 --- a/chromium/third_party/ffmpeg/libavfilter/asink_anullsink.c +++ b/chromium/third_party/ffmpeg/libavfilter/asink_anullsink.c @@ -34,13 +34,12 @@ static const AVFilterPad avfilter_asink_anullsink_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = null_filter_frame, }, - { NULL }, }; const AVFilter ff_asink_anullsink = { .name = "anullsink", .description = NULL_IF_CONFIG_SMALL("Do absolutely nothing with the input audio."), .priv_size = 0, - .inputs = avfilter_asink_anullsink_inputs, + FILTER_INPUTS(avfilter_asink_anullsink_inputs), .outputs = NULL, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/asrc_afirsrc.c b/chromium/third_party/ffmpeg/libavfilter/asrc_afirsrc.c index 0ede722ba15..cea9b2fe8af 100644 --- a/chromium/third_party/ffmpeg/libavfilter/asrc_afirsrc.c +++ b/chromium/third_party/ffmpeg/libavfilter/asrc_afirsrc.c @@ -24,6 +24,7 @@ #include "libavutil/tx.h" #include "audio.h" #include "avfilter.h" +#include "filters.h" #include "internal.h" #include "window_func.h" @@ -134,29 +135,15 @@ static av_cold int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_NONE }; - - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; - int ret; - - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats (ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_make_format64_list(chlayouts); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_channel_layouts_from_list(ctx, chlayouts); if (ret < 0) return ret; - formats = ff_make_format_list(sample_rates); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_samplerates_from_list(ctx, sample_rates); } static int parse_string(char *str, float **items, int *nb_items, int *items_size) @@ -287,16 +274,21 @@ static av_cold int config_output(AVFilterLink *outlink) return 0; } -static int request_frame(AVFilterLink *outlink) +static int activate(AVFilterContext *ctx) { - AVFilterContext *ctx = outlink->src; + AVFilterLink *outlink = ctx->outputs[0]; AudioFIRSourceContext *s = ctx->priv; AVFrame *frame; int nb_samples; + if (!ff_outlink_frame_wanted(outlink)) + return FFERROR_NOT_READY; + nb_samples = FFMIN(s->nb_samples, s->nb_taps - s->pts); - if (!nb_samples) - return AVERROR_EOF; + if (nb_samples <= 0) { + ff_outlink_set_status(outlink, AVERROR_EOF, s->pts); + return 0; + } if (!(frame = ff_get_audio_buffer(outlink, nb_samples))) return AVERROR(ENOMEM); @@ -312,10 +304,8 @@ static const AVFilterPad afirsrc_outputs[] = { { .name = "default", .type = AVMEDIA_TYPE_AUDIO, - .request_frame = request_frame, .config_props = config_output, }, - { NULL } }; const AVFilter ff_asrc_afirsrc = { @@ -324,8 +314,9 @@ const AVFilter ff_asrc_afirsrc = { .query_formats = query_formats, .init = init, .uninit = uninit, + .activate = activate, .priv_size = sizeof(AudioFIRSourceContext), .inputs = NULL, - .outputs = afirsrc_outputs, + FILTER_OUTPUTS(afirsrc_outputs), .priv_class = &afirsrc_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/asrc_anoisesrc.c b/chromium/third_party/ffmpeg/libavfilter/asrc_anoisesrc.c index 0aab14b58fe..ca866580406 100644 --- a/chromium/third_party/ffmpeg/libavfilter/asrc_anoisesrc.c +++ b/chromium/third_party/ffmpeg/libavfilter/asrc_anoisesrc.c @@ -90,29 +90,15 @@ static av_cold int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_NONE }; - - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; - int ret; - - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats (ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_make_format64_list(chlayouts); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_channel_layouts_from_list(ctx, chlayouts); if (ret < 0) return ret; - formats = ff_make_format_list(sample_rates); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_samplerates_from_list(ctx, sample_rates); } static double white_filter(double white, double *buf, double ha) @@ -244,7 +230,6 @@ static const AVFilterPad anoisesrc_outputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_props, }, - { NULL } }; const AVFilter ff_asrc_anoisesrc = { @@ -254,6 +239,6 @@ const AVFilter ff_asrc_anoisesrc = { .priv_size = sizeof(ANoiseSrcContext), .inputs = NULL, .activate = activate, - .outputs = anoisesrc_outputs, + FILTER_OUTPUTS(anoisesrc_outputs), .priv_class = &anoisesrc_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/asrc_anullsrc.c b/chromium/third_party/ffmpeg/libavfilter/asrc_anullsrc.c index 45d830e3a22..698102deda3 100644 --- a/chromium/third_party/ffmpeg/libavfilter/asrc_anullsrc.c +++ b/chromium/third_party/ffmpeg/libavfilter/asrc_anullsrc.c @@ -87,10 +87,10 @@ static int query_formats(AVFilterContext *ctx) int ret; if ((ret = ff_set_common_formats (ctx, ff_all_formats (AVMEDIA_TYPE_AUDIO))) < 0 || - (ret = ff_set_common_samplerates (ctx, ff_make_format_list (sample_rates ))) < 0) + (ret = ff_set_common_samplerates_from_list(ctx, sample_rates)) < 0) return ret; - return ff_set_common_channel_layouts(ctx, ff_make_format64_list(chlayouts)); + return ff_set_common_channel_layouts_from_list(ctx, chlayouts); } static av_cold int config_props(AVFilterLink *outlink) @@ -134,7 +134,6 @@ static const AVFilterPad avfilter_asrc_anullsrc_outputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_props, }, - { NULL } }; const AVFilter ff_asrc_anullsrc = { @@ -144,7 +143,7 @@ const AVFilter ff_asrc_anullsrc = { .query_formats = query_formats, .priv_size = sizeof(ANullContext), .inputs = NULL, - .outputs = avfilter_asrc_anullsrc_outputs, + FILTER_OUTPUTS(avfilter_asrc_anullsrc_outputs), .activate = activate, .priv_class = &anullsrc_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/asrc_flite.c b/chromium/third_party/ffmpeg/libavfilter/asrc_flite.c index e3065cff79b..61c177e0ba9 100644 --- a/chromium/third_party/ffmpeg/libavfilter/asrc_flite.c +++ b/chromium/third_party/ffmpeg/libavfilter/asrc_flite.c @@ -81,7 +81,7 @@ struct voice_entry { void (*unregister_fn)(cst_voice *); cst_voice *voice; unsigned usage_count; -} voice_entry; +}; #define MAKE_VOICE_STRUCTURE(voice_name) { \ .name = #voice_name, \ @@ -271,7 +271,6 @@ static const AVFilterPad flite_outputs[] = { .config_props = config_props, .request_frame = request_frame, }, - { NULL } }; const AVFilter ff_asrc_flite = { @@ -282,6 +281,6 @@ const AVFilter ff_asrc_flite = { .uninit = uninit, .priv_size = sizeof(FliteContext), .inputs = NULL, - .outputs = flite_outputs, + FILTER_OUTPUTS(flite_outputs), .priv_class = &flite_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/asrc_hilbert.c b/chromium/third_party/ffmpeg/libavfilter/asrc_hilbert.c index e7d596ee46c..8ff9934967c 100644 --- a/chromium/third_party/ffmpeg/libavfilter/asrc_hilbert.c +++ b/chromium/third_party/ffmpeg/libavfilter/asrc_hilbert.c @@ -23,6 +23,7 @@ #include "audio.h" #include "avfilter.h" #include "internal.h" +#include "filters.h" #include "window_func.h" typedef struct HilbertContext { @@ -102,29 +103,15 @@ static av_cold int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_NONE }; - - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; - int ret; - - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats (ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_make_format64_list(chlayouts); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_channel_layouts_from_list(ctx, chlayouts); if (ret < 0) return ret; - formats = ff_make_format_list(sample_rates); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_samplerates_from_list(ctx, sample_rates); } static av_cold int config_props(AVFilterLink *outlink) @@ -157,16 +144,21 @@ static av_cold int config_props(AVFilterLink *outlink) return 0; } -static int request_frame(AVFilterLink *outlink) +static int activate(AVFilterContext *ctx) { - AVFilterContext *ctx = outlink->src; + AVFilterLink *outlink = ctx->outputs[0]; HilbertContext *s = ctx->priv; AVFrame *frame; int nb_samples; + if (!ff_outlink_frame_wanted(outlink)) + return FFERROR_NOT_READY; + nb_samples = FFMIN(s->nb_samples, s->nb_taps - s->pts); - if (!nb_samples) - return AVERROR_EOF; + if (nb_samples <= 0) { + ff_outlink_set_status(outlink, AVERROR_EOF, s->pts); + return 0; + } if (!(frame = ff_get_audio_buffer(outlink, nb_samples))) return AVERROR(ENOMEM); @@ -182,10 +174,8 @@ static const AVFilterPad hilbert_outputs[] = { { .name = "default", .type = AVMEDIA_TYPE_AUDIO, - .request_frame = request_frame, .config_props = config_props, }, - { NULL } }; const AVFilter ff_asrc_hilbert = { @@ -194,8 +184,9 @@ const AVFilter ff_asrc_hilbert = { .query_formats = query_formats, .init = init, .uninit = uninit, + .activate = activate, .priv_size = sizeof(HilbertContext), .inputs = NULL, - .outputs = hilbert_outputs, + FILTER_OUTPUTS(hilbert_outputs), .priv_class = &hilbert_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/asrc_sinc.c b/chromium/third_party/ffmpeg/libavfilter/asrc_sinc.c index 5397d89c771..e2d3ea62ff0 100644 --- a/chromium/third_party/ffmpeg/libavfilter/asrc_sinc.c +++ b/chromium/third_party/ffmpeg/libavfilter/asrc_sinc.c @@ -27,6 +27,7 @@ #include "audio.h" #include "avfilter.h" +#include "filters.h" #include "internal.h" typedef struct SincContext { @@ -44,17 +45,22 @@ typedef struct SincContext { RDFTContext *rdft, *irdft; } SincContext; -static int request_frame(AVFilterLink *outlink) +static int activate(AVFilterContext *ctx) { - AVFilterContext *ctx = outlink->src; + AVFilterLink *outlink = ctx->outputs[0]; SincContext *s = ctx->priv; const float *coeffs = s->coeffs; AVFrame *frame = NULL; int nb_samples; + if (!ff_outlink_frame_wanted(outlink)) + return FFERROR_NOT_READY; + nb_samples = FFMIN(s->nb_samples, s->n - s->pts); - if (nb_samples <= 0) - return AVERROR_EOF; + if (nb_samples <= 0) { + ff_outlink_set_status(outlink, AVERROR_EOF, s->pts); + return 0; + } if (!(frame = ff_get_audio_buffer(outlink, nb_samples))) return AVERROR(ENOMEM); @@ -74,28 +80,15 @@ static int query_formats(AVFilterContext *ctx) int sample_rates[] = { s->sample_rate, -1 }; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_NONE }; - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; - int ret; - - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats (ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_make_format64_list(chlayouts); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_channel_layouts_from_list(ctx, chlayouts); if (ret < 0) return ret; - formats = ff_make_format_list(sample_rates); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_samplerates_from_list(ctx, sample_rates); } static float bessel_I_0(float x) @@ -419,9 +412,7 @@ static const AVFilterPad sinc_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, .config_props = config_output, - .request_frame = request_frame, }, - { NULL } }; #define AF AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM @@ -452,6 +443,7 @@ const AVFilter ff_asrc_sinc = { .priv_class = &sinc_class, .query_formats = query_formats, .uninit = uninit, + .activate = activate, .inputs = NULL, - .outputs = sinc_outputs, + FILTER_OUTPUTS(sinc_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/asrc_sine.c b/chromium/third_party/ffmpeg/libavfilter/asrc_sine.c index f75a5fc7280..ef4e346e7ba 100644 --- a/chromium/third_party/ffmpeg/libavfilter/asrc_sine.c +++ b/chromium/third_party/ffmpeg/libavfilter/asrc_sine.c @@ -26,6 +26,7 @@ #include "libavutil/opt.h" #include "audio.h" #include "avfilter.h" +#include "filters.h" #include "internal.h" typedef struct SineContext { @@ -183,28 +184,15 @@ static av_cold int query_formats(AVFilterContext *ctx) int sample_rates[] = { sine->sample_rate, -1 }; static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE }; - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; - int ret; - - formats = ff_make_format_list(sample_fmts); - if (!formats) - return AVERROR(ENOMEM); - ret = ff_set_common_formats (ctx, formats); + int ret = ff_set_common_formats_from_list(ctx, sample_fmts); if (ret < 0) return ret; - layouts = ff_make_format64_list(chlayouts); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_channel_layouts_from_list(ctx, chlayouts); if (ret < 0) return ret; - formats = ff_make_format_list(sample_rates); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_samplerates_from_list(ctx, sample_rates); } static av_cold int config_props(AVFilterLink *outlink) @@ -214,9 +202,10 @@ static av_cold int config_props(AVFilterLink *outlink) return 0; } -static int request_frame(AVFilterLink *outlink) +static int activate(AVFilterContext *ctx) { - SineContext *sine = outlink->src->priv; + AVFilterLink *outlink = ctx->outputs[0]; + SineContext *sine = ctx->priv; AVFrame *frame; double values[VAR_VARS_NB] = { [VAR_N] = outlink->frame_count_in, @@ -227,6 +216,8 @@ static int request_frame(AVFilterLink *outlink) int i, nb_samples = lrint(av_expr_eval(sine->samples_per_frame_expr, values, sine)); int16_t *samples; + if (!ff_outlink_frame_wanted(outlink)) + return FFERROR_NOT_READY; if (nb_samples <= 0) { av_log(sine, AV_LOG_WARNING, "nb samples expression evaluated to %d, " "defaulting to 1024\n", nb_samples); @@ -236,8 +227,10 @@ static int request_frame(AVFilterLink *outlink) if (sine->duration) { nb_samples = FFMIN(nb_samples, sine->duration - sine->pts); av_assert1(nb_samples >= 0); - if (!nb_samples) - return AVERROR_EOF; + if (!nb_samples) { + ff_outlink_set_status(outlink, AVERROR_EOF, sine->pts); + return 0; + } } if (!(frame = ff_get_audio_buffer(outlink, nb_samples))) return AVERROR(ENOMEM); @@ -263,10 +256,8 @@ static const AVFilterPad sine_outputs[] = { { .name = "default", .type = AVMEDIA_TYPE_AUDIO, - .request_frame = request_frame, .config_props = config_props, }, - { NULL } }; const AVFilter ff_asrc_sine = { @@ -275,8 +266,9 @@ const AVFilter ff_asrc_sine = { .query_formats = query_formats, .init = init, .uninit = uninit, + .activate = activate, .priv_size = sizeof(SineContext), .inputs = NULL, - .outputs = sine_outputs, + FILTER_OUTPUTS(sine_outputs), .priv_class = &sine_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/audio.c b/chromium/third_party/ffmpeg/libavfilter/audio.c index 5996f607b24..cebc9709dda 100644 --- a/chromium/third_party/ffmpeg/libavfilter/audio.c +++ b/chromium/third_party/ffmpeg/libavfilter/audio.c @@ -25,6 +25,7 @@ #include "audio.h" #include "avfilter.h" +#include "framepool.h" #include "internal.h" #define BUFFER_ALIGN 0 @@ -39,8 +40,9 @@ AVFrame *ff_default_get_audio_buffer(AVFilterLink *link, int nb_samples) { AVFrame *frame = NULL; int channels = link->channels; + int channel_layout_nb_channels = av_get_channel_layout_nb_channels(link->channel_layout); - av_assert0(channels == av_get_channel_layout_nb_channels(link->channel_layout) || !av_get_channel_layout_nb_channels(link->channel_layout)); + av_assert0(channels == channel_layout_nb_channels || !channel_layout_nb_channels); if (!link->frame_pool) { link->frame_pool = ff_frame_pool_audio_init(av_buffer_allocz, channels, @@ -87,8 +89,8 @@ AVFrame *ff_get_audio_buffer(AVFilterLink *link, int nb_samples) { AVFrame *ret = NULL; - if (link->dstpad->get_audio_buffer) - ret = link->dstpad->get_audio_buffer(link, nb_samples); + if (link->dstpad->get_buffer.audio) + ret = link->dstpad->get_buffer.audio(link, nb_samples); if (!ret) ret = ff_default_get_audio_buffer(link, nb_samples); diff --git a/chromium/third_party/ffmpeg/libavfilter/avf_abitscope.c b/chromium/third_party/ffmpeg/libavfilter/avf_abitscope.c index 481a218e6e1..c394091b7b7 100644 --- a/chromium/third_party/ffmpeg/libavfilter/avf_abitscope.c +++ b/chromium/third_party/ffmpeg/libavfilter/avf_abitscope.c @@ -248,7 +248,6 @@ static const AVFilterPad inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -257,7 +256,6 @@ static const AVFilterPad outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_avf_abitscope = { @@ -265,8 +263,8 @@ const AVFilter ff_avf_abitscope = { .description = NULL_IF_CONFIG_SMALL("Convert input audio to audio bit scope video output."), .query_formats = query_formats, .priv_size = sizeof(AudioBitScopeContext), - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .activate = activate, .priv_class = &abitscope_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/avf_ahistogram.c b/chromium/third_party/ffmpeg/libavfilter/avf_ahistogram.c index 864c061c2f1..96baf6da83b 100644 --- a/chromium/third_party/ffmpeg/libavfilter/avf_ahistogram.c +++ b/chromium/third_party/ffmpeg/libavfilter/avf_ahistogram.c @@ -412,7 +412,6 @@ static const AVFilterPad ahistogram_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_input, }, - { NULL } }; static const AVFilterPad ahistogram_outputs[] = { @@ -421,7 +420,6 @@ static const AVFilterPad ahistogram_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_avf_ahistogram = { @@ -431,7 +429,7 @@ const AVFilter ff_avf_ahistogram = { .query_formats = query_formats, .priv_size = sizeof(AudioHistogramContext), .activate = activate, - .inputs = ahistogram_inputs, - .outputs = ahistogram_outputs, + FILTER_INPUTS(ahistogram_inputs), + FILTER_OUTPUTS(ahistogram_outputs), .priv_class = &ahistogram_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/avf_aphasemeter.c b/chromium/third_party/ffmpeg/libavfilter/avf_aphasemeter.c index ef7e50e6572..13035328e98 100644 --- a/chromium/third_party/ffmpeg/libavfilter/avf_aphasemeter.c +++ b/chromium/third_party/ffmpeg/libavfilter/avf_aphasemeter.c @@ -131,7 +131,6 @@ static int config_input(AVFilterLink *inlink) if (s->do_video) { nb_samples = FFMAX(1, av_rescale(inlink->sample_rate, s->frame_rate.den, s->frame_rate.num)); - inlink->partial_buf_size = inlink->min_samples = inlink->max_samples = nb_samples; } @@ -356,7 +355,7 @@ static av_cold int init(AVFilterContext *ctx) .name = "out0", .type = AVMEDIA_TYPE_AUDIO, }; - ret = ff_insert_outpad(ctx, 0, &pad); + ret = ff_append_outpad(ctx, &pad); if (ret < 0) return ret; @@ -366,7 +365,7 @@ static av_cold int init(AVFilterContext *ctx) .type = AVMEDIA_TYPE_VIDEO, .config_props = config_video_output, }; - ret = ff_insert_outpad(ctx, 1, &pad); + ret = ff_append_outpad(ctx, &pad); if (ret < 0) return ret; } @@ -381,7 +380,6 @@ static const AVFilterPad inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; const AVFilter ff_avf_aphasemeter = { @@ -391,7 +389,7 @@ const AVFilter ff_avf_aphasemeter = { .uninit = uninit, .query_formats = query_formats, .priv_size = sizeof(AudioPhaseMeterContext), - .inputs = inputs, + FILTER_INPUTS(inputs), .outputs = NULL, .priv_class = &aphasemeter_class, .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS, diff --git a/chromium/third_party/ffmpeg/libavfilter/avf_avectorscope.c b/chromium/third_party/ffmpeg/libavfilter/avf_avectorscope.c index a0011fe33b9..f3001e99a32 100644 --- a/chromium/third_party/ffmpeg/libavfilter/avf_avectorscope.c +++ b/chromium/third_party/ffmpeg/libavfilter/avf_avectorscope.c @@ -403,7 +403,6 @@ static const AVFilterPad audiovectorscope_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_input, }, - { NULL } }; static const AVFilterPad audiovectorscope_outputs[] = { @@ -412,7 +411,6 @@ static const AVFilterPad audiovectorscope_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_avf_avectorscope = { @@ -422,7 +420,7 @@ const AVFilter ff_avf_avectorscope = { .query_formats = query_formats, .priv_size = sizeof(AudioVectorScopeContext), .activate = activate, - .inputs = audiovectorscope_inputs, - .outputs = audiovectorscope_outputs, + FILTER_INPUTS(audiovectorscope_inputs), + FILTER_OUTPUTS(audiovectorscope_outputs), .priv_class = &avectorscope_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/avf_concat.c b/chromium/third_party/ffmpeg/libavfilter/avf_concat.c index 333a0b090c4..2ae24e9b395 100644 --- a/chromium/third_party/ffmpeg/libavfilter/avf_concat.c +++ b/chromium/third_party/ffmpeg/libavfilter/avf_concat.c @@ -313,14 +313,14 @@ static av_cold int init(AVFilterContext *ctx) for (str = 0; str < cat->nb_streams[type]; str++) { AVFilterPad pad = { .type = type, - .get_video_buffer = get_video_buffer, - .get_audio_buffer = get_audio_buffer, }; + if (type == AVMEDIA_TYPE_VIDEO) + pad.get_buffer.video = get_video_buffer; + else + pad.get_buffer.audio = get_audio_buffer; pad.name = av_asprintf("in%d:%c%d", seg, "va"[type], str); - if ((ret = ff_insert_inpad(ctx, ctx->nb_inputs, &pad)) < 0) { - av_freep(&pad.name); + if ((ret = ff_append_inpad_free_name(ctx, &pad)) < 0) return ret; - } } } } @@ -332,10 +332,8 @@ static av_cold int init(AVFilterContext *ctx) .config_props = config_output, }; pad.name = av_asprintf("out:%c%d", "va"[type], str); - if ((ret = ff_insert_outpad(ctx, ctx->nb_outputs, &pad)) < 0) { - av_freep(&pad.name); + if ((ret = ff_append_outpad_free_name(ctx, &pad)) < 0) return ret; - } } } @@ -349,12 +347,7 @@ static av_cold int init(AVFilterContext *ctx) static av_cold void uninit(AVFilterContext *ctx) { ConcatContext *cat = ctx->priv; - unsigned i; - for (i = 0; i < ctx->nb_inputs; i++) - av_freep(&ctx->input_pads[i].name); - for (i = 0; i < ctx->nb_outputs; i++) - av_freep(&ctx->output_pads[i].name); av_freep(&cat->in); } diff --git a/chromium/third_party/ffmpeg/libavfilter/avf_showcqt.c b/chromium/third_party/ffmpeg/libavfilter/avf_showcqt.c index aa9900ebe0e..aab4aa28d64 100644 --- a/chromium/third_party/ffmpeg/libavfilter/avf_showcqt.c +++ b/chromium/third_party/ffmpeg/libavfilter/avf_showcqt.c @@ -1577,7 +1577,6 @@ static const AVFilterPad showcqt_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad showcqt_outputs[] = { @@ -1587,7 +1586,6 @@ static const AVFilterPad showcqt_outputs[] = { .config_props = config_output, .request_frame = request_frame, }, - { NULL } }; const AVFilter ff_avf_showcqt = { @@ -1597,7 +1595,7 @@ const AVFilter ff_avf_showcqt = { .uninit = uninit, .query_formats = query_formats, .priv_size = sizeof(ShowCQTContext), - .inputs = showcqt_inputs, - .outputs = showcqt_outputs, + FILTER_INPUTS(showcqt_inputs), + FILTER_OUTPUTS(showcqt_outputs), .priv_class = &showcqt_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/avf_showfreqs.c b/chromium/third_party/ffmpeg/libavfilter/avf_showfreqs.c index 5dee3445a83..7eff7261397 100644 --- a/chromium/third_party/ffmpeg/libavfilter/avf_showfreqs.c +++ b/chromium/third_party/ffmpeg/libavfilter/avf_showfreqs.c @@ -552,7 +552,6 @@ static const AVFilterPad showfreqs_inputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; static const AVFilterPad showfreqs_outputs[] = { @@ -561,7 +560,6 @@ static const AVFilterPad showfreqs_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_avf_showfreqs = { @@ -572,7 +570,7 @@ const AVFilter ff_avf_showfreqs = { .query_formats = query_formats, .priv_size = sizeof(ShowFreqsContext), .activate = activate, - .inputs = showfreqs_inputs, - .outputs = showfreqs_outputs, + FILTER_INPUTS(showfreqs_inputs), + FILTER_OUTPUTS(showfreqs_outputs), .priv_class = &showfreqs_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/avf_showspatial.c b/chromium/third_party/ffmpeg/libavfilter/avf_showspatial.c index 82d202a817a..c5af9032165 100644 --- a/chromium/third_party/ffmpeg/libavfilter/avf_showspatial.c +++ b/chromium/third_party/ffmpeg/libavfilter/avf_showspatial.c @@ -318,7 +318,7 @@ static int spatial_activate(AVFilterContext *ctx) av_assert0(fin->nb_samples == s->win_size); - ctx->internal->execute(ctx, run_channel_fft, fin, NULL, 2); + ff_filter_execute(ctx, run_channel_fft, fin, NULL, 2); ret = draw_spatial(inlink, fin); @@ -346,7 +346,6 @@ static const AVFilterPad showspatial_inputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; static const AVFilterPad showspatial_outputs[] = { @@ -355,7 +354,6 @@ static const AVFilterPad showspatial_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_avf_showspatial = { @@ -364,8 +362,8 @@ const AVFilter ff_avf_showspatial = { .uninit = uninit, .query_formats = query_formats, .priv_size = sizeof(ShowSpatialContext), - .inputs = showspatial_inputs, - .outputs = showspatial_outputs, + FILTER_INPUTS(showspatial_inputs), + FILTER_OUTPUTS(showspatial_outputs), .activate = spatial_activate, .priv_class = &showspatial_class, .flags = AVFILTER_FLAG_SLICE_THREADS, diff --git a/chromium/third_party/ffmpeg/libavfilter/avf_showspectrum.c b/chromium/third_party/ffmpeg/libavfilter/avf_showspectrum.c index 8aa6c668fab..5b5c4dccc9b 100644 --- a/chromium/third_party/ffmpeg/libavfilter/avf_showspectrum.c +++ b/chromium/third_party/ffmpeg/libavfilter/avf_showspectrum.c @@ -26,6 +26,7 @@ * (by Michael Niedermayer) and lavfi/avf_showwaves (by Stefano Sabatini). */ +#include <float.h> #include <math.h> #include "libavutil/tx.h" @@ -33,6 +34,7 @@ #include "libavutil/avassert.h" #include "libavutil/avstring.h" #include "libavutil/channel_layout.h" +#include "libavutil/cpu.h" #include "libavutil/opt.h" #include "libavutil/parseutils.h" #include "libavutil/xga_font_data.h" @@ -44,11 +46,11 @@ #include "window_func.h" enum DisplayMode { COMBINED, SEPARATE, NB_MODES }; -enum DataMode { D_MAGNITUDE, D_PHASE, NB_DMODES }; +enum DataMode { D_MAGNITUDE, D_PHASE, D_UPHASE, NB_DMODES }; enum FrequencyScale { F_LINEAR, F_LOG, NB_FSCALES }; enum DisplayScale { LINEAR, SQRT, CBRT, LOG, FOURTHRT, FIFTHRT, NB_SCALES }; enum ColorMode { CHANNEL, INTENSITY, RAINBOW, MORELAND, NEBULAE, FIRE, FIERY, FRUIT, COOL, MAGMA, GREEN, VIRIDIS, PLASMA, CIVIDIS, TERRAIN, NB_CLMODES }; -enum SlideMode { REPLACE, SCROLL, FULLFRAME, RSCROLL, NB_SLIDES }; +enum SlideMode { REPLACE, SCROLL, FULLFRAME, RSCROLL, LREPLACE, NB_SLIDES }; enum Orientation { VERTICAL, HORIZONTAL, NB_ORIENTATIONS }; typedef struct ShowSpectrumContext { @@ -100,6 +102,8 @@ typedef struct ShowSpectrumContext { int single_pic; int legend; int start_x, start_y; + float drange, limit; + float dmin, dmax; int (*plot_channel)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs); } ShowSpectrumContext; @@ -114,6 +118,7 @@ static const AVOption showspectrum_options[] = { { "scroll", "scroll from right to left", 0, AV_OPT_TYPE_CONST, {.i64=SCROLL}, 0, 0, FLAGS, "slide" }, { "fullframe", "return full frames", 0, AV_OPT_TYPE_CONST, {.i64=FULLFRAME}, 0, 0, FLAGS, "slide" }, { "rscroll", "scroll from left to right", 0, AV_OPT_TYPE_CONST, {.i64=RSCROLL}, 0, 0, FLAGS, "slide" }, + { "lreplace", "replace from right to left", 0, AV_OPT_TYPE_CONST, {.i64=LREPLACE}, 0, 0, FLAGS, "slide" }, { "mode", "set channel display mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=COMBINED}, COMBINED, NB_MODES-1, FLAGS, "mode" }, { "combined", "combined mode", 0, AV_OPT_TYPE_CONST, {.i64=COMBINED}, 0, 0, FLAGS, "mode" }, { "separate", "separate mode", 0, AV_OPT_TYPE_CONST, {.i64=SEPARATE}, 0, 0, FLAGS, "mode" }, @@ -174,11 +179,14 @@ static const AVOption showspectrum_options[] = { { "data", "set data mode", OFFSET(data), AV_OPT_TYPE_INT, {.i64 = 0}, 0, NB_DMODES-1, FLAGS, "data" }, { "magnitude", NULL, 0, AV_OPT_TYPE_CONST, {.i64=D_MAGNITUDE}, 0, 0, FLAGS, "data" }, { "phase", NULL, 0, AV_OPT_TYPE_CONST, {.i64=D_PHASE}, 0, 0, FLAGS, "data" }, + { "uphase", NULL, 0, AV_OPT_TYPE_CONST, {.i64=D_UPHASE}, 0, 0, FLAGS, "data" }, { "rotation", "color rotation", OFFSET(rotation), AV_OPT_TYPE_FLOAT, {.dbl = 0}, -1, 1, FLAGS }, { "start", "start frequency", OFFSET(start), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT32_MAX, FLAGS }, { "stop", "stop frequency", OFFSET(stop), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT32_MAX, FLAGS }, { "fps", "set video rate", OFFSET(rate_str), AV_OPT_TYPE_STRING, {.str = "auto"}, 0, 0, FLAGS }, { "legend", "draw legend", OFFSET(legend), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, FLAGS }, + { "drange", "set dynamic range in dBFS", OFFSET(drange), AV_OPT_TYPE_FLOAT, {.dbl = 120}, 10, 200, FLAGS }, + { "limit", "set upper limit in dBFS", OFFSET(limit), AV_OPT_TYPE_FLOAT, {.dbl = 0}, -100, 100, FLAGS }, { NULL } }; @@ -687,6 +695,75 @@ static float bin_pos(const int bin, const int num_bins, const float sample_rate) return num_bins * scaled_freq / max_freq; } +static float get_scale(AVFilterContext *ctx, int scale, float a) +{ + ShowSpectrumContext *s = ctx->priv; + const float dmin = s->dmin; + const float dmax = s->dmax; + + a = av_clipf(a, dmin, dmax); + if (scale != LOG) + a = (a - dmin) / (dmax - dmin); + + switch (scale) { + case LINEAR: + break; + case SQRT: + a = sqrtf(a); + break; + case CBRT: + a = cbrtf(a); + break; + case FOURTHRT: + a = sqrtf(sqrtf(a)); + break; + case FIFTHRT: + a = powf(a, 0.2f); + break; + case LOG: + a = (s->drange - s->limit + log10f(a) * 20.f) / s->drange; + break; + default: + av_assert0(0); + } + + return a; +} + +static float get_iscale(AVFilterContext *ctx, int scale, float a) +{ + ShowSpectrumContext *s = ctx->priv; + const float dmin = s->dmin; + const float dmax = s->dmax; + + switch (scale) { + case LINEAR: + break; + case SQRT: + a = a * a; + break; + case CBRT: + a = a * a * a; + break; + case FOURTHRT: + a = a * a * a * a; + break; + case FIFTHRT: + a = a * a * a * a * a; + break; + case LOG: + a = expf(M_LN10 * (a * s->drange - s->drange + s->limit) / 20.f); + break; + default: + av_assert0(0); + } + + if (scale != LOG) + a = a * (dmax - dmin) + dmin; + + return a; +} + static int draw_legend(AVFilterContext *ctx, int samples) { ShowSpectrumContext *s = ctx->priv; @@ -868,20 +945,24 @@ static int draw_legend(AVFilterContext *ctx, int samples) memset(s->outpicref->data[2]+(s->start_y + h * (ch + 1) - y - 1) * s->outpicref->linesize[2] + s->w + s->start_x + 20, av_clip_uint8(out[2]), 10); } - for (y = 0; ch == 0 && y < h; y += h / 10) { - float value = 120.f * log10f(1.f - y / (float)h); + for (y = 0; ch == 0 && y < h + 5; y += 25) { + static const char *log_fmt = "%.0f"; + static const char *lin_fmt = "%.3f"; + const float a = av_clipf(1.f - y / (float)(h - 1), 0.f, 1.f); + const float value = s->scale == LOG ? log10f(get_iscale(ctx, s->scale, a)) * 20.f : get_iscale(ctx, s->scale, a); char *text; - if (value < -120) - break; - text = av_asprintf("%.0f dB", value); + text = av_asprintf(s->scale == LOG ? log_fmt : lin_fmt, value); if (!text) continue; - drawtext(s->outpicref, s->w + s->start_x + 35, s->start_y + y - 5, text, 0); + drawtext(s->outpicref, s->w + s->start_x + 35, s->start_y + y - 3, text, 0); av_free(text); } } + if (s->scale == LOG) + drawtext(s->outpicref, s->w + s->start_x + 22, s->start_y + s->h + 20, "dBFS", 0); + return 0; } @@ -897,6 +978,7 @@ static float get_value(AVFilterContext *ctx, int ch, int y) /* get magnitude */ a = magnitudes[y]; break; + case D_UPHASE: case D_PHASE: /* get phase */ a = phases[y]; @@ -905,31 +987,7 @@ static float get_value(AVFilterContext *ctx, int ch, int y) av_assert0(0); } - /* apply scale */ - switch (s->scale) { - case LINEAR: - a = av_clipf(a, 0, 1); - break; - case SQRT: - a = av_clipf(sqrtf(a), 0, 1); - break; - case CBRT: - a = av_clipf(cbrtf(a), 0, 1); - break; - case FOURTHRT: - a = av_clipf(sqrtf(sqrtf(a)), 0, 1); - break; - case FIFTHRT: - a = av_clipf(powf(a, 0.20), 0, 1); - break; - case LOG: - a = 1.f + log10f(av_clipf(a, 1e-6, 1)) / 6.f; // zero = -120dBFS - break; - default: - av_assert0(0); - } - - return a; + return av_clipf(get_scale(ctx, s->scale, a), 0.f, 1.f); } static int plot_channel_lin(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) @@ -997,6 +1055,9 @@ static int config_output(AVFilterLink *outlink) int i, fft_size, h, w, ret; float overlap; + s->dmax = expf(s->limit * M_LN10 / 20.f); + s->dmin = expf((s->limit - s->drange) * M_LN10 / 20.f); + switch (s->fscale) { case F_LINEAR: s->plot_channel = plot_channel_lin; break; case F_LOG: s->plot_channel = plot_channel_log; break; @@ -1037,7 +1098,7 @@ static int config_output(AVFilterLink *outlink) } s->win_size = fft_size; - s->buf_size = FFALIGN(s->win_size << (!!s->stop), 512); + s->buf_size = FFALIGN(s->win_size << (!!s->stop), av_cpu_max_align()); if (!s->fft) { s->fft = av_calloc(inlink->channels, sizeof(*s->fft)); @@ -1186,11 +1247,18 @@ static int config_output(AVFilterLink *outlink) (s->orientation == HORIZONTAL && s->xpos >= s->h)) s->xpos = 0; + if (s->sliding == LREPLACE) { + if (s->orientation == VERTICAL) + s->xpos = s->w - 1; + if (s->orientation == HORIZONTAL) + s->xpos = s->h - 1; + } + s->auto_frame_rate = av_make_q(inlink->sample_rate, s->hop_size); if (s->orientation == VERTICAL && s->sliding == FULLFRAME) - s->auto_frame_rate.den *= s->w; + s->auto_frame_rate = av_mul_q(s->auto_frame_rate, av_make_q(1, s->w)); if (s->orientation == HORIZONTAL && s->sliding == FULLFRAME) - s->auto_frame_rate.den *= s->h; + s->auto_frame_rate = av_mul_q(s->auto_frame_rate, av_make_q(1, s->h)); if (!s->single_pic && strcmp(s->rate_str, "auto")) { int ret = av_parse_video_rate(&s->frame_rate, s->rate_str); if (ret < 0) @@ -1255,6 +1323,46 @@ static int calc_channel_phases(AVFilterContext *ctx, void *arg, int jobnr, int n return 0; } +static void unwrap(float *x, int N, float tol, float *mi, float *ma) +{ + const float rng = 2.f * M_PI; + float prev_p = 0.f; + float max = -FLT_MAX; + float min = FLT_MAX; + + for (int i = 0; i < N; i++) { + const float d = x[FFMIN(i + 1, N)] - x[i]; + const float p = ceilf(fabsf(d) / rng) * rng * (((d < tol) > 0.f) - ((d > -tol) > 0.f)); + + x[i] += p + prev_p; + prev_p += p; + max = fmaxf(x[i], max); + min = fminf(x[i], min); + } + + *mi = min; + *ma = max; +} + +static int calc_channel_uphases(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) +{ + ShowSpectrumContext *s = ctx->priv; + const int h = s->orientation == VERTICAL ? s->h : s->w; + const int ch = jobnr; + float *phases = s->phases[ch]; + float min, max, scale; + int y; + + for (y = 0; y < h; y++) + phases[y] = PHASE(y, ch); + unwrap(phases, h, M_PI, &min, &max); + scale = 1.f / (max - min + FLT_MIN); + for (y = 0; y < h; y++) + phases[y] = fabsf((phases[y] - min) * scale); + + return 0; +} + static void acalc_magnitudes(ShowSpectrumContext *s) { const double w = s->win_scale * (s->scale == LOG ? s->win_scale : 1); @@ -1304,7 +1412,7 @@ static int plot_spectrum_column(AVFilterLink *inlink, AVFrame *insamples) /* initialize buffer for combining to black */ clear_combine_buffer(s, z); - ctx->internal->execute(ctx, s->plot_channel, NULL, NULL, s->nb_display_channels); + ff_filter_execute(ctx, s->plot_channel, NULL, NULL, s->nb_display_channels); for (y = 0; y < z * 3; y++) { for (x = 0; x < s->nb_display_channels; x++) { @@ -1376,11 +1484,20 @@ static int plot_spectrum_column(AVFilterLink *inlink, AVFrame *insamples) if (s->sliding != FULLFRAME || s->xpos == 0) outpicref->pts = av_rescale_q(insamples->pts, inlink->time_base, outlink->time_base); - s->xpos++; - if (s->orientation == VERTICAL && s->xpos >= s->w) - s->xpos = 0; - if (s->orientation == HORIZONTAL && s->xpos >= s->h) - s->xpos = 0; + if (s->sliding == LREPLACE) { + s->xpos--; + if (s->orientation == VERTICAL && s->xpos < 0) + s->xpos = s->w - 1; + if (s->orientation == HORIZONTAL && s->xpos < 0) + s->xpos = s->h - 1; + } else { + s->xpos++; + if (s->orientation == VERTICAL && s->xpos >= s->w) + s->xpos = 0; + if (s->orientation == HORIZONTAL && s->xpos >= s->h) + s->xpos = 0; + } + if (!s->single_pic && (s->sliding != FULLFRAME || s->xpos == 0)) { if (s->old_pts < outpicref->pts) { AVFrame *clone; @@ -1469,13 +1586,16 @@ static int activate(AVFilterContext *ctx) av_assert0(fin->nb_samples == s->win_size); - ctx->internal->execute(ctx, run_channel_fft, fin, NULL, s->nb_display_channels); + ff_filter_execute(ctx, run_channel_fft, fin, NULL, s->nb_display_channels); if (s->data == D_MAGNITUDE) - ctx->internal->execute(ctx, calc_channel_magnitudes, NULL, NULL, s->nb_display_channels); + ff_filter_execute(ctx, calc_channel_magnitudes, NULL, NULL, s->nb_display_channels); if (s->data == D_PHASE) - ctx->internal->execute(ctx, calc_channel_phases, NULL, NULL, s->nb_display_channels); + ff_filter_execute(ctx, calc_channel_phases, NULL, NULL, s->nb_display_channels); + + if (s->data == D_UPHASE) + ff_filter_execute(ctx, calc_channel_uphases, NULL, NULL, s->nb_display_channels); ret = plot_spectrum_column(inlink, fin); @@ -1503,7 +1623,7 @@ static int activate(AVFilterContext *ctx) memset(s->outpicref->data[2] + i * s->outpicref->linesize[2], 128, outlink->w); } } - s->outpicref->pts += s->consumed; + s->outpicref->pts += av_rescale_q(s->consumed, inlink->time_base, outlink->time_base); pts = s->outpicref->pts; ret = ff_filter_frame(outlink, s->outpicref); s->outpicref = NULL; @@ -1513,12 +1633,14 @@ static int activate(AVFilterContext *ctx) FF_FILTER_FORWARD_STATUS(inlink, outlink); if (av_audio_fifo_size(s->fifo) >= s->win_size || + ff_inlink_queued_frames(inlink) > 0 || ff_outlink_get_status(inlink) == AVERROR_EOF) { ff_filter_set_ready(ctx, 10); return 0; } if (ff_outlink_frame_wanted(outlink) && av_audio_fifo_size(s->fifo) < s->win_size && + ff_inlink_queued_frames(inlink) == 0 && ff_outlink_get_status(inlink) != AVERROR_EOF) { ff_inlink_request_frame(inlink); return 0; @@ -1532,7 +1654,6 @@ static const AVFilterPad showspectrum_inputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; static const AVFilterPad showspectrum_outputs[] = { @@ -1541,7 +1662,6 @@ static const AVFilterPad showspectrum_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_avf_showspectrum = { @@ -1550,8 +1670,8 @@ const AVFilter ff_avf_showspectrum = { .uninit = uninit, .query_formats = query_formats, .priv_size = sizeof(ShowSpectrumContext), - .inputs = showspectrum_inputs, - .outputs = showspectrum_outputs, + FILTER_INPUTS(showspectrum_inputs), + FILTER_OUTPUTS(showspectrum_outputs), .activate = activate, .priv_class = &showspectrum_class, .flags = AVFILTER_FLAG_SLICE_THREADS, @@ -1623,6 +1743,8 @@ static const AVOption showspectrumpic_options[] = { { "rotation", "color rotation", OFFSET(rotation), AV_OPT_TYPE_FLOAT, {.dbl = 0}, -1, 1, FLAGS }, { "start", "start frequency", OFFSET(start), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT32_MAX, FLAGS }, { "stop", "stop frequency", OFFSET(stop), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT32_MAX, FLAGS }, + { "drange", "set dynamic range in dBFS", OFFSET(drange), AV_OPT_TYPE_FLOAT, {.dbl = 120}, 10, 200, FLAGS }, + { "limit", "set upper limit in dBFS", OFFSET(limit), AV_OPT_TYPE_FLOAT, {.dbl = 0}, -100, 100, FLAGS }, { NULL } }; @@ -1668,7 +1790,7 @@ static int showspectrumpic_request_frame(AVFilterLink *outlink) } } - ctx->internal->execute(ctx, run_channel_fft, fin, NULL, s->nb_display_channels); + ff_filter_execute(ctx, run_channel_fft, fin, NULL, s->nb_display_channels); acalc_magnitudes(s); consumed += spf; @@ -1714,7 +1836,6 @@ static const AVFilterPad showspectrumpic_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = showspectrumpic_filter_frame, }, - { NULL } }; static const AVFilterPad showspectrumpic_outputs[] = { @@ -1724,7 +1845,6 @@ static const AVFilterPad showspectrumpic_outputs[] = { .config_props = config_output, .request_frame = showspectrumpic_request_frame, }, - { NULL } }; const AVFilter ff_avf_showspectrumpic = { @@ -1733,8 +1853,8 @@ const AVFilter ff_avf_showspectrumpic = { .uninit = uninit, .query_formats = query_formats, .priv_size = sizeof(ShowSpectrumContext), - .inputs = showspectrumpic_inputs, - .outputs = showspectrumpic_outputs, + FILTER_INPUTS(showspectrumpic_inputs), + FILTER_OUTPUTS(showspectrumpic_outputs), .priv_class = &showspectrumpic_class, .flags = AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/avf_showvolume.c b/chromium/third_party/ffmpeg/libavfilter/avf_showvolume.c index d4b8c482977..2fd8298b852 100644 --- a/chromium/third_party/ffmpeg/libavfilter/avf_showvolume.c +++ b/chromium/third_party/ffmpeg/libavfilter/avf_showvolume.c @@ -486,7 +486,6 @@ static const AVFilterPad showvolume_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_input, }, - { NULL } }; static const AVFilterPad showvolume_outputs[] = { @@ -495,7 +494,6 @@ static const AVFilterPad showvolume_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_avf_showvolume = { @@ -506,7 +504,7 @@ const AVFilter ff_avf_showvolume = { .uninit = uninit, .query_formats = query_formats, .priv_size = sizeof(ShowVolumeContext), - .inputs = showvolume_inputs, - .outputs = showvolume_outputs, + FILTER_INPUTS(showvolume_inputs), + FILTER_OUTPUTS(showvolume_outputs), .priv_class = &showvolume_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/avf_showwaves.c b/chromium/third_party/ffmpeg/libavfilter/avf_showwaves.c index b3639f46a52..e75ed887298 100644 --- a/chromium/third_party/ffmpeg/libavfilter/avf_showwaves.c +++ b/chromium/third_party/ffmpeg/libavfilter/avf_showwaves.c @@ -600,7 +600,7 @@ static int push_single_pic(AVFilterLink *outlink) switch (showwaves->filter_mode) { case FILTER_AVERAGE: for (ch = 0; ch < nb_channels; ch++) - sum[ch] += abs(p[ch + i*nb_channels]) << 1; + sum[ch] += abs(p[ch + i*nb_channels]); break; case FILTER_PEAK: for (ch = 0; ch < nb_channels; ch++) @@ -763,7 +763,6 @@ static const AVFilterPad showwaves_inputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; static const AVFilterPad showwaves_outputs[] = { @@ -772,7 +771,6 @@ static const AVFilterPad showwaves_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_avf_showwaves = { @@ -782,9 +780,9 @@ const AVFilter ff_avf_showwaves = { .uninit = uninit, .query_formats = query_formats, .priv_size = sizeof(ShowWavesContext), - .inputs = showwaves_inputs, + FILTER_INPUTS(showwaves_inputs), .activate = activate, - .outputs = showwaves_outputs, + FILTER_OUTPUTS(showwaves_outputs), .priv_class = &showwaves_class, }; @@ -877,7 +875,6 @@ static const AVFilterPad showwavespic_inputs[] = { .config_props = showwavespic_config_input, .filter_frame = showwavespic_filter_frame, }, - { NULL } }; static const AVFilterPad showwavespic_outputs[] = { @@ -887,7 +884,6 @@ static const AVFilterPad showwavespic_outputs[] = { .config_props = config_output, .request_frame = request_frame, }, - { NULL } }; const AVFilter ff_avf_showwavespic = { @@ -897,8 +893,8 @@ const AVFilter ff_avf_showwavespic = { .uninit = uninit, .query_formats = query_formats, .priv_size = sizeof(ShowWavesContext), - .inputs = showwavespic_inputs, - .outputs = showwavespic_outputs, + FILTER_INPUTS(showwavespic_inputs), + FILTER_OUTPUTS(showwavespic_outputs), .priv_class = &showwavespic_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/avfilter.c b/chromium/third_party/ffmpeg/libavfilter/avfilter.c index c04afc6639f..c614eb0740e 100644 --- a/chromium/third_party/ffmpeg/libavfilter/avfilter.c +++ b/chromium/third_party/ffmpeg/libavfilter/avfilter.c @@ -25,8 +25,8 @@ #include "libavutil/channel_layout.h" #include "libavutil/common.h" #include "libavutil/eval.h" +#include "libavutil/frame.h" #include "libavutil/hwcontext.h" -#include "libavutil/imgutils.h" #include "libavutil/internal.h" #include "libavutil/opt.h" #include "libavutil/pixdesc.h" @@ -41,6 +41,7 @@ #include "avfilter.h" #include "filters.h" #include "formats.h" +#include "framepool.h" #include "internal.h" #include "libavutil/ffversion.h" @@ -100,38 +101,64 @@ void ff_command_queue_pop(AVFilterContext *filter) av_free(c); } -int ff_insert_pad(unsigned idx, unsigned *count, size_t padidx_off, - AVFilterPad **pads, AVFilterLink ***links, - AVFilterPad *newpad) +/** + * Append a new pad. + * + * @param count Pointer to the number of pads in the list + * @param pads Pointer to the pointer to the beginning of the list of pads + * @param links Pointer to the pointer to the beginning of the list of links + * @param newpad The new pad to add. A copy is made when adding. + * @return >= 0 in case of success, a negative AVERROR code on error + */ +static int append_pad(unsigned *count, AVFilterPad **pads, + AVFilterLink ***links, AVFilterPad *newpad) { AVFilterLink **newlinks; AVFilterPad *newpads; - unsigned i; - - idx = FFMIN(idx, *count); + unsigned idx = *count; - newpads = av_realloc_array(*pads, *count + 1, sizeof(AVFilterPad)); - newlinks = av_realloc_array(*links, *count + 1, sizeof(AVFilterLink*)); + newpads = av_realloc_array(*pads, idx + 1, sizeof(*newpads)); + newlinks = av_realloc_array(*links, idx + 1, sizeof(*newlinks)); if (newpads) *pads = newpads; if (newlinks) *links = newlinks; - if (!newpads || !newlinks) + if (!newpads || !newlinks) { + if (newpad->flags & AVFILTERPAD_FLAG_FREE_NAME) + av_freep(&newpad->name); return AVERROR(ENOMEM); + } - memmove(*pads + idx + 1, *pads + idx, sizeof(AVFilterPad) * (*count - idx)); - memmove(*links + idx + 1, *links + idx, sizeof(AVFilterLink*) * (*count - idx)); memcpy(*pads + idx, newpad, sizeof(AVFilterPad)); (*links)[idx] = NULL; (*count)++; - for (i = idx + 1; i < *count; i++) - if ((*links)[i]) - (*(unsigned *)((uint8_t *) (*links)[i] + padidx_off))++; return 0; } +int ff_append_inpad(AVFilterContext *f, AVFilterPad *p) +{ + return append_pad(&f->nb_inputs, &f->input_pads, &f->inputs, p); +} + +int ff_append_inpad_free_name(AVFilterContext *f, AVFilterPad *p) +{ + p->flags |= AVFILTERPAD_FLAG_FREE_NAME; + return ff_append_inpad(f, p); +} + +int ff_append_outpad(AVFilterContext *f, AVFilterPad *p) +{ + return append_pad(&f->nb_outputs, &f->output_pads, &f->outputs, p); +} + +int ff_append_outpad_free_name(AVFilterContext *f, AVFilterPad *p) +{ + p->flags |= AVFILTERPAD_FLAG_FREE_NAME; + return ff_append_outpad(f, p); +} + int avfilter_link(AVFilterContext *src, unsigned srcpad, AVFilterContext *dst, unsigned dstpad) { @@ -176,7 +203,6 @@ void avfilter_link_free(AVFilterLink **link) if (!*link) return; - av_frame_free(&(*link)->partial_buf); ff_framequeue_free(&(*link)->fifo); ff_frame_pool_uninit((FFFramePool**)&(*link)->frame_pool); @@ -545,16 +571,30 @@ int avfilter_process_command(AVFilterContext *filter, const char *cmd, const cha return AVERROR(ENOSYS); } +#if FF_API_PAD_COUNT int avfilter_pad_count(const AVFilterPad *pads) { - int count; + const AVFilter *filter; + void *opaque = NULL; if (!pads) return 0; - for (count = 0; pads->name; count++) - pads++; - return count; + while (filter = av_filter_iterate(&opaque)) { + if (pads == filter->inputs) + return filter->nb_inputs; + if (pads == filter->outputs) + return filter->nb_outputs; + } + + av_assert0(!"AVFilterPad list not from a filter"); + return AVERROR_BUG; +} +#endif + +unsigned avfilter_filter_pad_count(const AVFilter *filter, int is_output) +{ + return is_output ? filter->nb_outputs : filter->nb_inputs; } static const char *default_filter_name(void *filter_ctx) @@ -657,23 +697,21 @@ AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name) goto err; ret->internal->execute = default_execute; - ret->nb_inputs = avfilter_pad_count(filter->inputs); + ret->nb_inputs = filter->nb_inputs; if (ret->nb_inputs ) { - ret->input_pads = av_malloc_array(ret->nb_inputs, sizeof(AVFilterPad)); + ret->input_pads = av_memdup(filter->inputs, ret->nb_inputs * sizeof(*filter->inputs)); if (!ret->input_pads) goto err; - memcpy(ret->input_pads, filter->inputs, sizeof(AVFilterPad) * ret->nb_inputs); ret->inputs = av_mallocz_array(ret->nb_inputs, sizeof(AVFilterLink*)); if (!ret->inputs) goto err; } - ret->nb_outputs = avfilter_pad_count(filter->outputs); + ret->nb_outputs = filter->nb_outputs; if (ret->nb_outputs) { - ret->output_pads = av_malloc_array(ret->nb_outputs, sizeof(AVFilterPad)); + ret->output_pads = av_memdup(filter->outputs, ret->nb_outputs * sizeof(*filter->outputs)); if (!ret->output_pads) goto err; - memcpy(ret->output_pads, filter->outputs, sizeof(AVFilterPad) * ret->nb_outputs); ret->outputs = av_mallocz_array(ret->nb_outputs, sizeof(AVFilterLink*)); if (!ret->outputs) goto err; @@ -732,9 +770,13 @@ void avfilter_free(AVFilterContext *filter) for (i = 0; i < filter->nb_inputs; i++) { free_link(filter->inputs[i]); + if (filter->input_pads[i].flags & AVFILTERPAD_FLAG_FREE_NAME) + av_freep(&filter->input_pads[i].name); } for (i = 0; i < filter->nb_outputs; i++) { free_link(filter->outputs[i]); + if (filter->output_pads[i].flags & AVFILTERPAD_FLAG_FREE_NAME) + av_freep(&filter->output_pads[i].name); } if (filter->filter->priv_class) @@ -770,7 +812,7 @@ static int process_options(AVFilterContext *ctx, AVDictionary **options, const char *args) { const AVOption *o = NULL; - int ret, count = 0; + int ret; char *av_uninit(parsed_key), *av_uninit(value); const char *key; int offset= -1; @@ -833,10 +875,9 @@ static int process_options(AVFilterContext *ctx, AVDictionary **options, av_free(value); av_free(parsed_key); - count++; } - return count; + return 0; } int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, @@ -879,9 +920,7 @@ int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options) } } - if (ctx->filter->init_opaque) - ret = ctx->filter->init_opaque(ctx, NULL); - else if (ctx->filter->init) + if (ctx->filter->init) ret = ctx->filter->init(ctx); else if (ctx->filter->init_dict) ret = ctx->filter->init_dict(ctx, options); @@ -954,7 +993,7 @@ static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame) if (!(filter_frame = dst->filter_frame)) filter_frame = default_filter_frame; - if (dst->needs_writable) { + if (dst->flags & AVFILTERPAD_FLAG_NEEDS_WRITABLE) { ret = ff_inlink_make_frame_writable(link, &frame); if (ret < 0) goto fail; @@ -1012,6 +1051,7 @@ int ff_filter_frame(AVFilterLink *link, AVFrame *frame) link->frame_blocked_in = link->frame_wanted_out = 0; link->frame_count_in++; + link->sample_count_in += frame->nb_samples; filter_unblock(link->dst); ret = ff_framequeue_add(&link->fifo, frame); if (ret < 0) { @@ -1071,7 +1111,6 @@ static int take_samples(AVFilterLink *link, unsigned min, unsigned max, av_frame_free(&buf); return ret; } - buf->pts = frame0->pts; p = 0; for (i = 0; i < nb_frames; i++) { @@ -1371,6 +1410,7 @@ static void consume_update(AVFilterLink *link, const AVFrame *frame) ff_inlink_process_commands(link, frame); link->dst->is_disabled = !ff_inlink_evaluate_timeline_at_frame(link, frame); link->frame_count_out++; + link->sample_count_out += frame->nb_samples; } int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe) @@ -1446,19 +1486,10 @@ int ff_inlink_make_frame_writable(AVFilterLink *link, AVFrame **rframe) return ret; } - switch (link->type) { - case AVMEDIA_TYPE_VIDEO: - av_image_copy(out->data, out->linesize, (const uint8_t **)frame->data, frame->linesize, - frame->format, frame->width, frame->height); - break; - case AVMEDIA_TYPE_AUDIO: - av_samples_copy(out->extended_data, frame->extended_data, - 0, 0, frame->nb_samples, - frame->channels, - frame->format); - break; - default: - av_assert0(!"reached"); + ret = av_frame_copy(out, frame); + if (ret < 0) { + av_frame_free(&out); + return ret; } av_frame_free(&frame); diff --git a/chromium/third_party/ffmpeg/libavfilter/avfilter.h b/chromium/third_party/ffmpeg/libavfilter/avfilter.h index b82f72d040c..69ecb0186d0 100644 --- a/chromium/third_party/ffmpeg/libavfilter/avfilter.h +++ b/chromium/third_party/ffmpeg/libavfilter/avfilter.h @@ -70,11 +70,15 @@ typedef struct AVFilterPad AVFilterPad; typedef struct AVFilterFormats AVFilterFormats; typedef struct AVFilterChannelLayouts AVFilterChannelLayouts; +#if FF_API_PAD_COUNT /** - * Get the number of elements in a NULL-terminated array of AVFilterPads (e.g. - * AVFilter.inputs/outputs). + * Get the number of elements in an AVFilter's inputs or outputs array. + * + * @deprecated Use avfilter_filter_pad_count() instead. */ +attribute_deprecated int avfilter_pad_count(const AVFilterPad *pads); +#endif /** * Get the name of an AVFilterPad. @@ -156,15 +160,16 @@ typedef struct AVFilter { const char *description; /** - * List of inputs, terminated by a zeroed element. + * List of static inputs. * * NULL if there are no (static) inputs. Instances of filters with * AVFILTER_FLAG_DYNAMIC_INPUTS set may have more inputs than present in * this list. */ const AVFilterPad *inputs; + /** - * List of outputs, terminated by a zeroed element. + * List of static outputs. * * NULL if there are no (static) outputs. Instances of filters with * AVFILTER_FLAG_DYNAMIC_OUTPUTS set may have more outputs than present in @@ -196,6 +201,16 @@ typedef struct AVFilter { */ /** + * The number of entries in the list of inputs. + */ + uint16_t nb_inputs; + + /** + * The number of entries in the list of outputs. + */ + uint16_t nb_outputs; + + /** * Filter pre-initialization function * * This callback will be called immediately after the filter context is @@ -301,13 +316,6 @@ typedef struct AVFilter { int (*process_command)(AVFilterContext *, const char *cmd, const char *arg, char *res, int res_len, int flags); /** - * Filter initialization function, alternative to the init() - * callback. Args contains the user-supplied parameters, opaque is - * used for providing binary data. - */ - int (*init_opaque)(AVFilterContext *ctx, void *opaque); - - /** * Filter activation function. * * Called when any processing is needed from the filter, instead of any @@ -323,6 +331,11 @@ typedef struct AVFilter { } AVFilter; /** + * Get the number of elements in an AVFilter's inputs or outputs array. + */ +unsigned avfilter_filter_pad_count(const AVFilter *filter, int is_output); + +/** * Process multiple parts of the frame concurrently. */ #define AVFILTER_THREAD_SLICE (1 << 0) @@ -549,19 +562,8 @@ struct AVFilterLink { AVRational frame_rate; /** - * Buffer partially filled with samples to achieve a fixed/minimum size. - */ - AVFrame *partial_buf; - - /** - * Size of the partial buffer to allocate. - * Must be between min_samples and max_samples. - */ - int partial_buf_size; - - /** * Minimum number of samples to filter at once. If filter_frame() is - * called with fewer samples, it will accumulate them in partial_buf. + * called with fewer samples, it will accumulate them in fifo. * This field and the related ones must not be changed after filtering * has started. * If 0, all related fields are ignored. @@ -585,6 +587,11 @@ struct AVFilterLink { int64_t frame_count_in, frame_count_out; /** + * Number of past samples sent through the link. + */ + int64_t sample_count_in, sample_count_out; + + /** * A pointer to a FFFramePool struct. */ void *frame_pool; diff --git a/chromium/third_party/ffmpeg/libavfilter/avfiltergraph.c b/chromium/third_party/ffmpeg/libavfilter/avfiltergraph.c index 5389d82d9f8..45b028cd9cd 100644 --- a/chromium/third_party/ffmpeg/libavfilter/avfiltergraph.c +++ b/chromium/third_party/ffmpeg/libavfilter/avfiltergraph.c @@ -50,8 +50,9 @@ static const AVOption filtergraph_options[] = { { "thread_type", "Allowed thread types", OFFSET(thread_type), AV_OPT_TYPE_FLAGS, { .i64 = AVFILTER_THREAD_SLICE }, 0, INT_MAX, F|V|A, "thread_type" }, { "slice", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AVFILTER_THREAD_SLICE }, .flags = F|V|A, .unit = "thread_type" }, - { "threads", "Maximum number of threads", OFFSET(nb_threads), - AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, F|V|A }, + { "threads", "Maximum number of threads", OFFSET(nb_threads), AV_OPT_TYPE_INT, + { .i64 = 0 }, 0, INT_MAX, F|V|A, "threads"}, + {"auto", "autodetect a suitable number of threads to use", 0, AV_OPT_TYPE_CONST, {.i64 = 0 }, .flags = F|V|A, .unit = "threads"}, {"scale_sws_opts" , "default scale filter options" , OFFSET(scale_sws_opts) , AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, F|V }, {"aresample_swr_opts" , "default aresample filter options" , OFFSET(aresample_swr_opts) , @@ -208,7 +209,7 @@ AVFilterContext *avfilter_graph_alloc_filter(AVFilterGraph *graph, * * @return >= 0 in case of success, a negative value otherwise */ -static int graph_check_validity(AVFilterGraph *graph, AVClass *log_ctx) +static int graph_check_validity(AVFilterGraph *graph, void *log_ctx) { AVFilterContext *filt; int i, j; @@ -246,7 +247,7 @@ static int graph_check_validity(AVFilterGraph *graph, AVClass *log_ctx) * * @return >= 0 in case of success, a negative value otherwise */ -static int graph_config_links(AVFilterGraph *graph, AVClass *log_ctx) +static int graph_config_links(AVFilterGraph *graph, void *log_ctx) { AVFilterContext *filt; int i, ret; @@ -263,7 +264,7 @@ static int graph_config_links(AVFilterGraph *graph, AVClass *log_ctx) return 0; } -static int graph_check_links(AVFilterGraph *graph, AVClass *log_ctx) +static int graph_check_links(AVFilterGraph *graph, void *log_ctx) { AVFilterContext *f; AVFilterLink *l; @@ -295,21 +296,6 @@ AVFilterContext *avfilter_graph_get_filter(AVFilterGraph *graph, const char *nam return NULL; } -static void sanitize_channel_layouts(void *log, AVFilterChannelLayouts *l) -{ - if (!l) - return; - if (l->nb_channel_layouts) { - if (l->all_layouts || l->all_counts) - av_log(log, AV_LOG_WARNING, "All layouts set on non-empty list\n"); - l->all_layouts = l->all_counts = 0; - } else { - if (l->all_counts && !l->all_layouts) - av_log(log, AV_LOG_WARNING, "All counts without all layouts\n"); - l->all_layouts = 1; - } -} - static int filter_link_check_formats(void *log, AVFilterLink *link, AVFilterFormatsConfig *cfg) { int ret; @@ -359,10 +345,9 @@ static int filter_check_formats(AVFilterContext *ctx) static int filter_query_formats(AVFilterContext *ctx) { - int ret, i; + int ret; AVFilterFormats *formats; AVFilterChannelLayouts *chlayouts; - AVFilterFormats *samplerates; enum AVMediaType type = ctx->inputs && ctx->inputs [0] ? ctx->inputs [0]->type : ctx->outputs && ctx->outputs[0] ? ctx->outputs[0]->type : AVMEDIA_TYPE_VIDEO; @@ -377,17 +362,11 @@ static int filter_query_formats(AVFilterContext *ctx) if (ret < 0) return ret; - for (i = 0; i < ctx->nb_inputs; i++) - sanitize_channel_layouts(ctx, ctx->inputs[i]->outcfg.channel_layouts); - for (i = 0; i < ctx->nb_outputs; i++) - sanitize_channel_layouts(ctx, ctx->outputs[i]->incfg.channel_layouts); - formats = ff_all_formats(type); if ((ret = ff_set_common_formats(ctx, formats)) < 0) return ret; if (type == AVMEDIA_TYPE_AUDIO) { - samplerates = ff_all_samplerates(); - if ((ret = ff_set_common_samplerates(ctx, samplerates)) < 0) + if ((ret = ff_set_common_all_samplerates(ctx)) < 0) return ret; chlayouts = ff_all_channel_layouts(); if ((ret = ff_set_common_channel_layouts(ctx, chlayouts)) < 0) @@ -429,10 +408,10 @@ static int formats_declared(AVFilterContext *f) * was made and the negotiation is stuck; * a negative error code if some other error happened */ -static int query_formats(AVFilterGraph *graph, AVClass *log_ctx) +static int query_formats(AVFilterGraph *graph, void *log_ctx) { int i, j, ret; - int scaler_count = 0, resampler_count = 0; + int converter_count = 0; int count_queried = 0; /* successful calls to query_formats() */ int count_merged = 0; /* successful merge of formats lists */ int count_already_merged = 0; /* lists already merged */ @@ -458,54 +437,48 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx) for (j = 0; j < filter->nb_inputs; j++) { AVFilterLink *link = filter->inputs[j]; + const AVFilterNegotiation *neg; + unsigned neg_step; int convert_needed = 0; if (!link) continue; - if (link->incfg.formats != link->outcfg.formats - && link->incfg.formats && link->outcfg.formats) - if (!ff_can_merge_formats(link->incfg.formats, link->outcfg.formats, - link->type)) + neg = ff_filter_get_negotiation(link); + av_assert0(neg); + for (neg_step = 1; neg_step < neg->nb_mergers; neg_step++) { + const AVFilterFormatsMerger *m = &neg->mergers[neg_step]; + void *a = FF_FIELD_AT(void *, m->offset, link->incfg); + void *b = FF_FIELD_AT(void *, m->offset, link->outcfg); + if (a && b && a != b && !m->can_merge(a, b)) { convert_needed = 1; - if (link->type == AVMEDIA_TYPE_AUDIO) { - if (link->incfg.samplerates != link->outcfg.samplerates - && link->incfg.samplerates && link->outcfg.samplerates) - if (!ff_can_merge_samplerates(link->incfg.samplerates, - link->outcfg.samplerates)) - convert_needed = 1; - } - -#define CHECKED_MERGE(field, ...) ((ret = ff_merge_ ## field(__VA_ARGS__)) <= 0) -#define MERGE_DISPATCH(field, ...) \ - if (!(link->incfg.field && link->outcfg.field)) { \ - count_delayed++; \ - } else if (link->incfg.field == link->outcfg.field) { \ - count_already_merged++; \ - } else if (!convert_needed) { \ - count_merged++; \ - if (CHECKED_MERGE(field, __VA_ARGS__)) { \ - if (ret < 0) \ - return ret; \ - convert_needed = 1; \ - } \ + break; + } } - - if (link->type == AVMEDIA_TYPE_AUDIO) { - MERGE_DISPATCH(channel_layouts, link->incfg.channel_layouts, - link->outcfg.channel_layouts) - MERGE_DISPATCH(samplerates, link->incfg.samplerates, - link->outcfg.samplerates) + for (neg_step = 0; neg_step < neg->nb_mergers; neg_step++) { + const AVFilterFormatsMerger *m = &neg->mergers[neg_step]; + void *a = FF_FIELD_AT(void *, m->offset, link->incfg); + void *b = FF_FIELD_AT(void *, m->offset, link->outcfg); + if (!(a && b)) { + count_delayed++; + } else if (a == b) { + count_already_merged++; + } else if (!convert_needed) { + count_merged++; + ret = m->merge(a, b); + if (ret < 0) + return ret; + if (!ret) + convert_needed = 1; + } } - MERGE_DISPATCH(formats, link->incfg.formats, - link->outcfg.formats, link->type) -#undef MERGE_DISPATCH if (convert_needed) { AVFilterContext *convert; const AVFilter *filter; AVFilterLink *inlink, *outlink; char inst_name[30]; + const char *opts; if (graph->disable_auto_convert) { av_log(log_ctx, AV_LOG_ERROR, @@ -516,40 +489,18 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx) } /* couldn't merge format lists. auto-insert conversion filter */ - switch (link->type) { - case AVMEDIA_TYPE_VIDEO: - if (!(filter = avfilter_get_by_name("scale"))) { - av_log(log_ctx, AV_LOG_ERROR, "'scale' filter " - "not present, cannot convert pixel formats.\n"); - return AVERROR(EINVAL); - } - - snprintf(inst_name, sizeof(inst_name), "auto_scaler_%d", - scaler_count++); - - if ((ret = avfilter_graph_create_filter(&convert, filter, - inst_name, graph->scale_sws_opts, NULL, - graph)) < 0) - return ret; - break; - case AVMEDIA_TYPE_AUDIO: - if (!(filter = avfilter_get_by_name("aresample"))) { - av_log(log_ctx, AV_LOG_ERROR, "'aresample' filter " - "not present, cannot convert audio formats.\n"); - return AVERROR(EINVAL); - } - - snprintf(inst_name, sizeof(inst_name), "auto_resampler_%d", - resampler_count++); - if ((ret = avfilter_graph_create_filter(&convert, filter, - inst_name, graph->aresample_swr_opts, - NULL, graph)) < 0) - return ret; - break; - default: + if (!(filter = avfilter_get_by_name(neg->conversion_filter))) { + av_log(log_ctx, AV_LOG_ERROR, + "'%s' filter not present, cannot convert formats.\n", + neg->conversion_filter); return AVERROR(EINVAL); } - + snprintf(inst_name, sizeof(inst_name), "auto_%s_%d", + neg->conversion_filter, converter_count++); + opts = FF_FIELD_AT(char *, neg->conversion_opts_offset, *graph); + ret = avfilter_graph_create_filter(&convert, filter, inst_name, opts, NULL, graph); + if (ret < 0) + return ret; if ((ret = avfilter_insert_filter(link, convert, 0, 0)) < 0) return ret; @@ -572,26 +523,21 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx) av_assert0(outlink-> incfg.channel_layouts->refcount > 0); av_assert0(outlink->outcfg.channel_layouts->refcount > 0); } - if (CHECKED_MERGE(formats, inlink->incfg.formats, - inlink->outcfg.formats, inlink->type) || - CHECKED_MERGE(formats, outlink->incfg.formats, - outlink->outcfg.formats, outlink->type) || - inlink->type == AVMEDIA_TYPE_AUDIO && - (CHECKED_MERGE(samplerates, inlink->incfg.samplerates, - inlink->outcfg.samplerates) || - CHECKED_MERGE(channel_layouts, inlink->incfg.channel_layouts, - inlink->outcfg.channel_layouts)) || - outlink->type == AVMEDIA_TYPE_AUDIO && - (CHECKED_MERGE(samplerates, outlink->incfg.samplerates, - outlink->outcfg.samplerates) || - CHECKED_MERGE(channel_layouts, outlink->incfg.channel_layouts, - outlink->outcfg.channel_layouts))) { - if (ret < 0) - return ret; - av_log(log_ctx, AV_LOG_ERROR, - "Impossible to convert between the formats supported by the filter " - "'%s' and the filter '%s'\n", link->src->name, link->dst->name); - return AVERROR(ENOSYS); + for (neg_step = 0; neg_step < neg->nb_mergers; neg_step++) { + const AVFilterFormatsMerger *m = &neg->mergers[neg_step]; + void *ia = FF_FIELD_AT(void *, m->offset, inlink->incfg); + void *ib = FF_FIELD_AT(void *, m->offset, inlink->outcfg); + void *oa = FF_FIELD_AT(void *, m->offset, outlink->incfg); + void *ob = FF_FIELD_AT(void *, m->offset, outlink->outcfg); + if ((ret = m->merge(ia, ib)) <= 0 || + (ret = m->merge(oa, ob)) <= 0) { + if (ret < 0) + return ret; + av_log(log_ctx, AV_LOG_ERROR, + "Impossible to convert between the formats supported by the filter " + "'%s' and the filter '%s'\n", link->src->name, link->dst->name); + return AVERROR(ENOSYS); + } } } } @@ -1142,7 +1088,7 @@ static int pick_formats(AVFilterGraph *graph) /** * Configure the formats of all the links in the graph. */ -static int graph_config_formats(AVFilterGraph *graph, AVClass *log_ctx) +static int graph_config_formats(AVFilterGraph *graph, void *log_ctx) { int ret; @@ -1170,8 +1116,7 @@ static int graph_config_formats(AVFilterGraph *graph, AVClass *log_ctx) return 0; } -static int graph_config_pointers(AVFilterGraph *graph, - AVClass *log_ctx) +static int graph_config_pointers(AVFilterGraph *graph, void *log_ctx) { unsigned i, j; int sink_links_count = 0, n = 0; diff --git a/chromium/third_party/ffmpeg/libavfilter/buffersink.c b/chromium/third_party/ffmpeg/libavfilter/buffersink.c index c4147bf7324..8b46dcb15ee 100644 --- a/chromium/third_party/ffmpeg/libavfilter/buffersink.c +++ b/chromium/third_party/ffmpeg/libavfilter/buffersink.c @@ -199,8 +199,7 @@ void av_buffersink_set_frame_size(AVFilterContext *ctx, unsigned frame_size) { AVFilterLink *inlink = ctx->inputs[0]; - inlink->min_samples = inlink->max_samples = - inlink->partial_buf_size = frame_size; + inlink->min_samples = inlink->max_samples = frame_size; } #define MAKE_AVFILTERLINK_ACCESSOR(type, field) \ @@ -332,7 +331,6 @@ static const AVFilterPad avfilter_vsink_buffer_inputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vsink_buffer = { @@ -343,7 +341,7 @@ const AVFilter ff_vsink_buffer = { .init = common_init, .query_formats = vsink_query_formats, .activate = activate, - .inputs = avfilter_vsink_buffer_inputs, + FILTER_INPUTS(avfilter_vsink_buffer_inputs), .outputs = NULL, }; @@ -352,7 +350,6 @@ static const AVFilterPad avfilter_asink_abuffer_inputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_asink_abuffer = { @@ -363,6 +360,6 @@ const AVFilter ff_asink_abuffer = { .init = common_init, .query_formats = asink_query_formats, .activate = activate, - .inputs = avfilter_asink_abuffer_inputs, + FILTER_INPUTS(avfilter_asink_abuffer_inputs), .outputs = NULL, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/buffersrc.c b/chromium/third_party/ffmpeg/libavfilter/buffersrc.c index 4d0bb4f91d8..632bfc7ad8c 100644 --- a/chromium/third_party/ffmpeg/libavfilter/buffersrc.c +++ b/chromium/third_party/ffmpeg/libavfilter/buffersrc.c @@ -434,7 +434,6 @@ static const AVFilterPad avfilter_vsrc_buffer_outputs[] = { .request_frame = request_frame, .config_props = config_props, }, - { NULL } }; const AVFilter ff_vsrc_buffer = { @@ -447,7 +446,7 @@ const AVFilter ff_vsrc_buffer = { .uninit = uninit, .inputs = NULL, - .outputs = avfilter_vsrc_buffer_outputs, + FILTER_OUTPUTS(avfilter_vsrc_buffer_outputs), .priv_class = &buffer_class, }; @@ -458,7 +457,6 @@ static const AVFilterPad avfilter_asrc_abuffer_outputs[] = { .request_frame = request_frame, .config_props = config_props, }, - { NULL } }; const AVFilter ff_asrc_abuffer = { @@ -471,6 +469,6 @@ const AVFilter ff_asrc_abuffer = { .uninit = uninit, .inputs = NULL, - .outputs = avfilter_asrc_abuffer_outputs, + FILTER_OUTPUTS(avfilter_asrc_abuffer_outputs), .priv_class = &abuffer_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/dnn/dnn_backend_common.c b/chromium/third_party/ffmpeg/libavfilter/dnn/dnn_backend_common.c index 4d9d3f79b19..6a9c4cc87ff 100644 --- a/chromium/third_party/ffmpeg/libavfilter/dnn/dnn_backend_common.c +++ b/chromium/third_party/ffmpeg/libavfilter/dnn/dnn_backend_common.c @@ -23,6 +23,9 @@ #include "dnn_backend_common.h" +#define DNN_ASYNC_SUCCESS (void *)0 +#define DNN_ASYNC_FAIL (void *)-1 + int ff_check_exec_params(void *ctx, DNNBackendType backend, DNNFunctionType func_type, DNNExecBaseParams *exec_params) { if (!exec_params) { @@ -35,7 +38,7 @@ int ff_check_exec_params(void *ctx, DNNBackendType backend, DNNFunctionType func return AVERROR(EINVAL); } - if (!exec_params->out_frame) { + if (!exec_params->out_frame && func_type == DFT_PROCESS_FRAME) { av_log(ctx, AV_LOG_ERROR, "out frame is NULL when execute model.\n"); return AVERROR(EINVAL); } @@ -69,3 +72,114 @@ DNNReturnType ff_dnn_fill_task(TaskItem *task, DNNExecBaseParams *exec_params, v return DNN_SUCCESS; } + +/** + * Thread routine for async execution. + * @param args pointer to DNNAsyncExecModule module + */ +static void *async_thread_routine(void *args) +{ + DNNAsyncExecModule *async_module = args; + void *request = async_module->args; + + if (async_module->start_inference(request) != DNN_SUCCESS) { + return DNN_ASYNC_FAIL; + } + async_module->callback(request); + return DNN_ASYNC_SUCCESS; +} + +DNNReturnType ff_dnn_async_module_cleanup(DNNAsyncExecModule *async_module) +{ + void *status = 0; + if (!async_module) { + return DNN_ERROR; + } +#if HAVE_PTHREAD_CANCEL + pthread_join(async_module->thread_id, &status); + if (status == DNN_ASYNC_FAIL) { + av_log(NULL, AV_LOG_ERROR, "Last Inference Failed.\n"); + return DNN_ERROR; + } +#endif + async_module->start_inference = NULL; + async_module->callback = NULL; + async_module->args = NULL; + return DNN_SUCCESS; +} + +DNNReturnType ff_dnn_start_inference_async(void *ctx, DNNAsyncExecModule *async_module) +{ + int ret; + void *status = 0; + + if (!async_module) { + av_log(ctx, AV_LOG_ERROR, "async_module is null when starting async inference.\n"); + return DNN_ERROR; + } + +#if HAVE_PTHREAD_CANCEL + pthread_join(async_module->thread_id, &status); + if (status == DNN_ASYNC_FAIL) { + av_log(ctx, AV_LOG_ERROR, "Unable to start inference as previous inference failed.\n"); + return DNN_ERROR; + } + ret = pthread_create(&async_module->thread_id, NULL, async_thread_routine, async_module); + if (ret != 0) { + av_log(ctx, AV_LOG_ERROR, "Unable to start async inference.\n"); + return DNN_ERROR; + } +#else + if (async_module->start_inference(async_module->args) != DNN_SUCCESS) { + return DNN_ERROR; + } + async_module->callback(async_module->args); +#endif + return DNN_SUCCESS; +} + +DNNAsyncStatusType ff_dnn_get_result_common(Queue *task_queue, AVFrame **in, AVFrame **out) +{ + TaskItem *task = ff_queue_peek_front(task_queue); + + if (!task) { + return DAST_EMPTY_QUEUE; + } + + if (task->inference_done != task->inference_todo) { + return DAST_NOT_READY; + } + + *in = task->in_frame; + *out = task->out_frame; + ff_queue_pop_front(task_queue); + av_freep(&task); + + return DAST_SUCCESS; +} + +DNNReturnType ff_dnn_fill_gettingoutput_task(TaskItem *task, DNNExecBaseParams *exec_params, void *backend_model, int input_height, int input_width, void *ctx) +{ + AVFrame *in_frame = NULL; + AVFrame *out_frame = NULL; + + in_frame = av_frame_alloc(); + if (!in_frame) { + av_log(ctx, AV_LOG_ERROR, "Failed to allocate memory for input frame\n"); + return DNN_ERROR; + } + + out_frame = av_frame_alloc(); + if (!out_frame) { + av_frame_free(&in_frame); + av_log(ctx, AV_LOG_ERROR, "Failed to allocate memory for output frame\n"); + return DNN_ERROR; + } + + in_frame->width = input_width; + in_frame->height = input_height; + exec_params->in_frame = in_frame; + exec_params->out_frame = out_frame; + + return ff_dnn_fill_task(task, exec_params, backend_model, 0, 0); +} diff --git a/chromium/third_party/ffmpeg/libavfilter/dnn/dnn_backend_common.h b/chromium/third_party/ffmpeg/libavfilter/dnn/dnn_backend_common.h index 5281fdfed1d..6b6a5e21aec 100644 --- a/chromium/third_party/ffmpeg/libavfilter/dnn/dnn_backend_common.h +++ b/chromium/third_party/ffmpeg/libavfilter/dnn/dnn_backend_common.h @@ -24,10 +24,13 @@ #ifndef AVFILTER_DNN_DNN_BACKEND_COMMON_H #define AVFILTER_DNN_DNN_BACKEND_COMMON_H +#include "queue.h" #include "../dnn_interface.h" +#include "libavutil/thread.h" #define DNN_BACKEND_COMMON_OPTIONS \ - { "nireq", "number of request", OFFSET(options.nireq), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS }, + { "nireq", "number of request", OFFSET(options.nireq), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS }, \ + { "async", "use DNN async inference", OFFSET(options.async), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, FLAGS }, // one task for one function call from dnn interface typedef struct TaskItem { @@ -44,10 +47,38 @@ typedef struct TaskItem { } TaskItem; // one task might have multiple inferences -typedef struct InferenceItem { +typedef struct LastLevelTaskItem { TaskItem *task; uint32_t bbox_index; -} InferenceItem; +} LastLevelTaskItem; + +/** + * Common Async Execution Mechanism for the DNN Backends. + */ +typedef struct DNNAsyncExecModule { + /** + * Synchronous inference function for the backend + * with corresponding request item as the argument. + */ + DNNReturnType (*start_inference)(void *request); + + /** + * Completion Callback for the backend. + * Expected argument type of callback must match that + * of the inference function. + */ + void (*callback)(void *args); + + /** + * Argument for the execution functions. + * i.e. Request item for the backend. + */ + void *args; +#if HAVE_PTHREAD_CANCEL + pthread_t thread_id; + pthread_attr_t thread_attr; +#endif +} DNNAsyncExecModule; int ff_check_exec_params(void *ctx, DNNBackendType backend, DNNFunctionType func_type, DNNExecBaseParams *exec_params); @@ -66,4 +97,61 @@ int ff_check_exec_params(void *ctx, DNNBackendType backend, DNNFunctionType func */ DNNReturnType ff_dnn_fill_task(TaskItem *task, DNNExecBaseParams *exec_params, void *backend_model, int async, int do_ioproc); +/** + * Join the Async Execution thread and set module pointers to NULL. + * + * @param async_module pointer to DNNAsyncExecModule module + * + * @retval DNN_SUCCESS if successful + * @retval DNN_ERROR if async_module is NULL + */ +DNNReturnType ff_dnn_async_module_cleanup(DNNAsyncExecModule *async_module); + +/** + * Start asynchronous inference routine for the TensorFlow + * model on a detached thread. It calls the completion callback + * after the inference completes. Completion callback and inference + * function must be set before calling this function. + * + * If POSIX threads aren't supported, the execution rolls back + * to synchronous mode, calling completion callback after inference. + * + * @param ctx pointer to the backend context + * @param async_module pointer to DNNAsyncExecModule module + * + * @retval DNN_SUCCESS on the start of async inference. + * @retval DNN_ERROR in case async inference cannot be started + */ +DNNReturnType ff_dnn_start_inference_async(void *ctx, DNNAsyncExecModule *async_module); + +/** + * Extract input and output frame from the Task Queue after + * asynchronous inference. + * + * @param task_queue pointer to the task queue of the backend + * @param in double pointer to the input frame + * @param out double pointer to the output frame + * + * @retval DAST_EMPTY_QUEUE if task queue is empty + * @retval DAST_NOT_READY if inference not completed yet. + * @retval DAST_SUCCESS if result successfully extracted + */ +DNNAsyncStatusType ff_dnn_get_result_common(Queue *task_queue, AVFrame **in, AVFrame **out); + +/** + * Allocate input and output frames and fill the Task + * with execution parameters. + * + * @param task pointer to the allocated task + * @param exec_params pointer to execution parameters + * @param backend_model void pointer to the backend model + * @param input_height height of input frame + * @param input_width width of input frame + * @param ctx pointer to the backend context + * + * @retval DNN_SUCCESS if successful + * @retval DNN_ERROR if allocation fails + */ +DNNReturnType ff_dnn_fill_gettingoutput_task(TaskItem *task, DNNExecBaseParams *exec_params, void *backend_model, int input_height, int input_width, void *ctx); + #endif diff --git a/chromium/third_party/ffmpeg/libavfilter/dnn/dnn_backend_native.c b/chromium/third_party/ffmpeg/libavfilter/dnn/dnn_backend_native.c index a6be27f1fdb..13436c04842 100644 --- a/chromium/third_party/ffmpeg/libavfilter/dnn/dnn_backend_native.c +++ b/chromium/third_party/ffmpeg/libavfilter/dnn/dnn_backend_native.c @@ -34,6 +34,7 @@ #define FLAGS AV_OPT_FLAG_FILTERING_PARAM static const AVOption dnn_native_options[] = { { "conv2d_threads", "threads num for conv2d layer", OFFSET(options.conv2d_threads), AV_OPT_TYPE_INT, { .i64 = 0 }, INT_MIN, INT_MAX, FLAGS }, + { "async", "use DNN async inference", OFFSET(options.async), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS }, { NULL }, }; @@ -45,9 +46,29 @@ static const AVClass dnn_native_class = { .category = AV_CLASS_CATEGORY_FILTER, }; -static DNNReturnType execute_model_native(const DNNModel *model, const char *input_name, AVFrame *in_frame, - const char **output_names, uint32_t nb_output, AVFrame *out_frame, - int do_ioproc); +static DNNReturnType execute_model_native(Queue *lltask_queue); + +static DNNReturnType extract_lltask_from_task(TaskItem *task, Queue *lltask_queue) +{ + NativeModel *native_model = task->model; + NativeContext *ctx = &native_model->ctx; + LastLevelTaskItem *lltask = av_malloc(sizeof(*lltask)); + + if (!lltask) { + av_log(ctx, AV_LOG_ERROR, "Unable to allocate space for LastLevelTaskItem\n"); + return DNN_ERROR; + } + task->inference_todo = 1; + task->inference_done = 0; + lltask->task = task; + + if (ff_queue_push_back(lltask_queue, lltask) < 0) { + av_log(ctx, AV_LOG_ERROR, "Failed to push back lltask_queue.\n"); + av_freep(&lltask); + return DNN_ERROR; + } + return DNN_SUCCESS; +} static DNNReturnType get_input_native(void *model, DNNData *input, const char *input_name) { @@ -78,34 +99,36 @@ static DNNReturnType get_input_native(void *model, DNNData *input, const char *i static DNNReturnType get_output_native(void *model, const char *input_name, int input_width, int input_height, const char *output_name, int *output_width, int *output_height) { - DNNReturnType ret; + DNNReturnType ret = 0; NativeModel *native_model = model; NativeContext *ctx = &native_model->ctx; - AVFrame *in_frame = av_frame_alloc(); - AVFrame *out_frame = NULL; - - if (!in_frame) { - av_log(ctx, AV_LOG_ERROR, "Could not allocate memory for input frame\n"); - return DNN_ERROR; + TaskItem task; + DNNExecBaseParams exec_params = { + .input_name = input_name, + .output_names = &output_name, + .nb_output = 1, + .in_frame = NULL, + .out_frame = NULL, + }; + + if (ff_dnn_fill_gettingoutput_task(&task, &exec_params, native_model, input_height, input_width, ctx) != DNN_SUCCESS) { + ret = DNN_ERROR; + goto err; } - out_frame = av_frame_alloc(); - - if (!out_frame) { - av_log(ctx, AV_LOG_ERROR, "Could not allocate memory for output frame\n"); - av_frame_free(&in_frame); - return DNN_ERROR; + if (extract_lltask_from_task(&task, native_model->lltask_queue) != DNN_SUCCESS) { + av_log(ctx, AV_LOG_ERROR, "unable to extract last level task from task.\n"); + ret = DNN_ERROR; + goto err; } - in_frame->width = input_width; - in_frame->height = input_height; + ret = execute_model_native(native_model->lltask_queue); + *output_width = task.out_frame->width; + *output_height = task.out_frame->height; - ret = execute_model_native(native_model->model, input_name, in_frame, &output_name, 1, out_frame, 0); - *output_width = out_frame->width; - *output_height = out_frame->height; - - av_frame_free(&out_frame); - av_frame_free(&in_frame); +err: + av_frame_free(&task.out_frame); + av_frame_free(&task.in_frame); return ret; } @@ -167,6 +190,11 @@ DNNModel *ff_dnn_load_model_native(const char *model_filename, DNNFunctionType f goto fail; native_model->model = model; + if (native_model->ctx.options.async) { + av_log(&native_model->ctx, AV_LOG_WARNING, "Async not supported. Rolling back to sync\n"); + native_model->ctx.options.async = 0; + } + #if !HAVE_PTHREAD_CANCEL if (native_model->ctx.options.conv2d_threads > 1){ av_log(&native_model->ctx, AV_LOG_WARNING, "'conv2d_threads' option was set but it is not supported " @@ -190,6 +218,16 @@ DNNModel *ff_dnn_load_model_native(const char *model_filename, DNNFunctionType f goto fail; } + native_model->task_queue = ff_queue_create(); + if (!native_model->task_queue) { + goto fail; + } + + native_model->lltask_queue = ff_queue_create(); + if (!native_model->lltask_queue) { + goto fail; + } + for (layer = 0; layer < native_model->layers_num; ++layer){ layer_type = (int32_t)avio_rl32(model_file_context); dnn_size += 4; @@ -259,50 +297,66 @@ fail: return NULL; } -static DNNReturnType execute_model_native(const DNNModel *model, const char *input_name, AVFrame *in_frame, - const char **output_names, uint32_t nb_output, AVFrame *out_frame, - int do_ioproc) +static DNNReturnType execute_model_native(Queue *lltask_queue) { - NativeModel *native_model = model->model; - NativeContext *ctx = &native_model->ctx; + NativeModel *native_model = NULL; + NativeContext *ctx = NULL; int32_t layer; DNNData input, output; DnnOperand *oprd = NULL; + LastLevelTaskItem *lltask = NULL; + TaskItem *task = NULL; + DNNReturnType ret = 0; + + lltask = ff_queue_pop_front(lltask_queue); + if (!lltask) { + av_log(NULL, AV_LOG_ERROR, "Failed to get LastLevelTaskItem\n"); + ret = DNN_ERROR; + goto err; + } + task = lltask->task; + native_model = task->model; + ctx = &native_model->ctx; if (native_model->layers_num <= 0 || native_model->operands_num <= 0) { av_log(ctx, AV_LOG_ERROR, "No operands or layers in model\n"); - return DNN_ERROR; + ret = DNN_ERROR; + goto err; } for (int i = 0; i < native_model->operands_num; ++i) { oprd = &native_model->operands[i]; - if (strcmp(oprd->name, input_name) == 0) { + if (strcmp(oprd->name, task->input_name) == 0) { if (oprd->type != DOT_INPUT) { - av_log(ctx, AV_LOG_ERROR, "Found \"%s\" in model, but it is not input node\n", input_name); - return DNN_ERROR; + av_log(ctx, AV_LOG_ERROR, "Found \"%s\" in model, but it is not input node\n", task->input_name); + ret = DNN_ERROR; + goto err; } break; } oprd = NULL; } if (!oprd) { - av_log(ctx, AV_LOG_ERROR, "Could not find \"%s\" in model\n", input_name); - return DNN_ERROR; + av_log(ctx, AV_LOG_ERROR, "Could not find \"%s\" in model\n", task->input_name); + ret = DNN_ERROR; + goto err; } - oprd->dims[1] = in_frame->height; - oprd->dims[2] = in_frame->width; + oprd->dims[1] = task->in_frame->height; + oprd->dims[2] = task->in_frame->width; av_freep(&oprd->data); oprd->length = ff_calculate_operand_data_length(oprd); if (oprd->length <= 0) { av_log(ctx, AV_LOG_ERROR, "The input data length overflow\n"); - return DNN_ERROR; + ret = DNN_ERROR; + goto err; } oprd->data = av_malloc(oprd->length); if (!oprd->data) { av_log(ctx, AV_LOG_ERROR, "Failed to malloc memory for input data\n"); - return DNN_ERROR; + ret = DNN_ERROR; + goto err; } input.height = oprd->dims[1]; @@ -310,19 +364,20 @@ static DNNReturnType execute_model_native(const DNNModel *model, const char *inp input.channels = oprd->dims[3]; input.data = oprd->data; input.dt = oprd->data_type; - if (do_ioproc) { + if (task->do_ioproc) { if (native_model->model->frame_pre_proc != NULL) { - native_model->model->frame_pre_proc(in_frame, &input, native_model->model->filter_ctx); + native_model->model->frame_pre_proc(task->in_frame, &input, native_model->model->filter_ctx); } else { - ff_proc_from_frame_to_dnn(in_frame, &input, ctx); + ff_proc_from_frame_to_dnn(task->in_frame, &input, ctx); } } - if (nb_output != 1) { + if (task->nb_output != 1) { // currently, the filter does not need multiple outputs, // so we just pending the support until we really need it. avpriv_report_missing_feature(ctx, "multiple outputs"); - return DNN_ERROR; + ret = DNN_ERROR; + goto err; } for (layer = 0; layer < native_model->layers_num; ++layer){ @@ -333,13 +388,14 @@ static DNNReturnType execute_model_native(const DNNModel *model, const char *inp native_model->layers[layer].params, &native_model->ctx) == DNN_ERROR) { av_log(ctx, AV_LOG_ERROR, "Failed to execute model\n"); - return DNN_ERROR; + ret = DNN_ERROR; + goto err; } } - for (uint32_t i = 0; i < nb_output; ++i) { + for (uint32_t i = 0; i < task->nb_output; ++i) { DnnOperand *oprd = NULL; - const char *output_name = output_names[i]; + const char *output_name = task->output_names[i]; for (int j = 0; j < native_model->operands_num; ++j) { if (strcmp(native_model->operands[j].name, output_name) == 0) { oprd = &native_model->operands[j]; @@ -349,7 +405,8 @@ static DNNReturnType execute_model_native(const DNNModel *model, const char *inp if (oprd == NULL) { av_log(ctx, AV_LOG_ERROR, "Could not find output in model\n"); - return DNN_ERROR; + ret = DNN_ERROR; + goto err; } output.data = oprd->data; @@ -358,32 +415,76 @@ static DNNReturnType execute_model_native(const DNNModel *model, const char *inp output.channels = oprd->dims[3]; output.dt = oprd->data_type; - if (do_ioproc) { + if (task->do_ioproc) { if (native_model->model->frame_post_proc != NULL) { - native_model->model->frame_post_proc(out_frame, &output, native_model->model->filter_ctx); + native_model->model->frame_post_proc(task->out_frame, &output, native_model->model->filter_ctx); } else { - ff_proc_from_dnn_to_frame(out_frame, &output, ctx); + ff_proc_from_dnn_to_frame(task->out_frame, &output, ctx); } } else { - out_frame->width = output.width; - out_frame->height = output.height; + task->out_frame->width = output.width; + task->out_frame->height = output.height; } } - - return DNN_SUCCESS; + task->inference_done++; +err: + av_freep(&lltask); + return ret; } DNNReturnType ff_dnn_execute_model_native(const DNNModel *model, DNNExecBaseParams *exec_params) { NativeModel *native_model = model->model; NativeContext *ctx = &native_model->ctx; + TaskItem *task; if (ff_check_exec_params(ctx, DNN_NATIVE, model->func_type, exec_params) != 0) { return DNN_ERROR; } - return execute_model_native(model, exec_params->input_name, exec_params->in_frame, - exec_params->output_names, exec_params->nb_output, exec_params->out_frame, 1); + task = av_malloc(sizeof(*task)); + if (!task) { + av_log(ctx, AV_LOG_ERROR, "unable to alloc memory for task item.\n"); + return DNN_ERROR; + } + + if (ff_dnn_fill_task(task, exec_params, native_model, ctx->options.async, 1) != DNN_SUCCESS) { + av_freep(&task); + return DNN_ERROR; + } + + if (ff_queue_push_back(native_model->task_queue, task) < 0) { + av_freep(&task); + av_log(ctx, AV_LOG_ERROR, "unable to push back task_queue.\n"); + return DNN_ERROR; + } + + if (extract_lltask_from_task(task, native_model->lltask_queue) != DNN_SUCCESS) { + av_log(ctx, AV_LOG_ERROR, "unable to extract last level task from task.\n"); + return DNN_ERROR; + } + + return execute_model_native(native_model->lltask_queue); +} + +DNNReturnType ff_dnn_flush_native(const DNNModel *model) +{ + NativeModel *native_model = model->model; + + if (ff_queue_size(native_model->lltask_queue) == 0) { + // no pending task need to flush + return DNN_SUCCESS; + } + + // for now, use sync node with flush operation + // Switch to async when it is supported + return execute_model_native(native_model->lltask_queue); +} + +DNNAsyncStatusType ff_dnn_get_result_native(const DNNModel *model, AVFrame **in, AVFrame **out) +{ + NativeModel *native_model = model->model; + return ff_dnn_get_result_common(native_model->task_queue, in, out); } int32_t ff_calculate_operand_dims_count(const DnnOperand *oprd) @@ -435,6 +536,20 @@ void ff_dnn_free_model_native(DNNModel **model) av_freep(&native_model->operands); } + while (ff_queue_size(native_model->lltask_queue) != 0) { + LastLevelTaskItem *item = ff_queue_pop_front(native_model->lltask_queue); + av_freep(&item); + } + ff_queue_destroy(native_model->lltask_queue); + + while (ff_queue_size(native_model->task_queue) != 0) { + TaskItem *item = ff_queue_pop_front(native_model->task_queue); + av_frame_free(&item->in_frame); + av_frame_free(&item->out_frame); + av_freep(&item); + } + ff_queue_destroy(native_model->task_queue); + av_freep(&native_model); } av_freep(model); diff --git a/chromium/third_party/ffmpeg/libavfilter/dnn/dnn_backend_native.h b/chromium/third_party/ffmpeg/libavfilter/dnn/dnn_backend_native.h index 89bcb8e358a..e8017ee4b49 100644 --- a/chromium/third_party/ffmpeg/libavfilter/dnn/dnn_backend_native.h +++ b/chromium/third_party/ffmpeg/libavfilter/dnn/dnn_backend_native.h @@ -30,6 +30,7 @@ #include "../dnn_interface.h" #include "libavformat/avio.h" #include "libavutil/opt.h" +#include "queue.h" /** * the enum value of DNNLayerType should not be changed, @@ -110,6 +111,7 @@ typedef struct InputParams{ } InputParams; typedef struct NativeOptions{ + uint8_t async; uint32_t conv2d_threads; } NativeOptions; @@ -126,12 +128,18 @@ typedef struct NativeModel{ int32_t layers_num; DnnOperand *operands; int32_t operands_num; + Queue *task_queue; + Queue *lltask_queue; } NativeModel; DNNModel *ff_dnn_load_model_native(const char *model_filename, DNNFunctionType func_type, const char *options, AVFilterContext *filter_ctx); DNNReturnType ff_dnn_execute_model_native(const DNNModel *model, DNNExecBaseParams *exec_params); +DNNAsyncStatusType ff_dnn_get_result_native(const DNNModel *model, AVFrame **in, AVFrame **out); + +DNNReturnType ff_dnn_flush_native(const DNNModel *model); + void ff_dnn_free_model_native(DNNModel **model); // NOTE: User must check for error (return value <= 0) to handle diff --git a/chromium/third_party/ffmpeg/libavfilter/dnn/dnn_backend_openvino.c b/chromium/third_party/ffmpeg/libavfilter/dnn/dnn_backend_openvino.c index 8d234462966..f5b1454d21b 100644 --- a/chromium/third_party/ffmpeg/libavfilter/dnn/dnn_backend_openvino.c +++ b/chromium/third_party/ffmpeg/libavfilter/dnn/dnn_backend_openvino.c @@ -32,7 +32,6 @@ #include "libavutil/avstring.h" #include "libavutil/detection_bbox.h" #include "../internal.h" -#include "queue.h" #include "safe_queue.h" #include <c_api/ie_c_api.h> #include "dnn_backend_common.h" @@ -40,6 +39,7 @@ typedef struct OVOptions{ char *device_type; int nireq; + uint8_t async; int batch_size; int input_resizable; } OVOptions; @@ -57,14 +57,14 @@ typedef struct OVModel{ ie_executable_network_t *exe_network; SafeQueue *request_queue; // holds OVRequestItem Queue *task_queue; // holds TaskItem - Queue *inference_queue; // holds InferenceItem + Queue *lltask_queue; // holds LastLevelTaskItem } OVModel; // one request for one call to openvino typedef struct OVRequestItem { ie_infer_request_t *infer_request; - InferenceItem **inferences; - uint32_t inference_count; + LastLevelTaskItem **lltasks; + uint32_t lltask_count; ie_complete_call_back_t callback; } OVRequestItem; @@ -121,12 +121,12 @@ static DNNReturnType fill_model_input_ov(OVModel *ov_model, OVRequestItem *reque IEStatusCode status; DNNData input; ie_blob_t *input_blob = NULL; - InferenceItem *inference; + LastLevelTaskItem *lltask; TaskItem *task; - inference = ff_queue_peek_front(ov_model->inference_queue); - av_assert0(inference); - task = inference->task; + lltask = ff_queue_peek_front(ov_model->lltask_queue); + av_assert0(lltask); + task = lltask->task; status = ie_infer_request_get_blob(request->infer_request, task->input_name, &input_blob); if (status != OK) { @@ -159,13 +159,13 @@ static DNNReturnType fill_model_input_ov(OVModel *ov_model, OVRequestItem *reque input.order = DCO_BGR; for (int i = 0; i < ctx->options.batch_size; ++i) { - inference = ff_queue_pop_front(ov_model->inference_queue); - if (!inference) { + lltask = ff_queue_pop_front(ov_model->lltask_queue); + if (!lltask) { break; } - request->inferences[i] = inference; - request->inference_count = i + 1; - task = inference->task; + request->lltasks[i] = lltask; + request->lltask_count = i + 1; + task = lltask->task; switch (ov_model->model->func_type) { case DFT_PROCESS_FRAME: if (task->do_ioproc) { @@ -180,7 +180,7 @@ static DNNReturnType fill_model_input_ov(OVModel *ov_model, OVRequestItem *reque ff_frame_to_dnn_detect(task->in_frame, &input, ctx); break; case DFT_ANALYTICS_CLASSIFY: - ff_frame_to_dnn_classify(task->in_frame, &input, inference->bbox_index, ctx); + ff_frame_to_dnn_classify(task->in_frame, &input, lltask->bbox_index, ctx); break; default: av_assert0(!"should not reach here"); @@ -200,8 +200,8 @@ static void infer_completion_callback(void *args) precision_e precision; IEStatusCode status; OVRequestItem *request = args; - InferenceItem *inference = request->inferences[0]; - TaskItem *task = inference->task; + LastLevelTaskItem *lltask = request->lltasks[0]; + TaskItem *task = lltask->task; OVModel *ov_model = task->model; SafeQueue *requestq = ov_model->request_queue; ie_blob_t *output_blob = NULL; @@ -248,10 +248,10 @@ static void infer_completion_callback(void *args) output.dt = precision_to_datatype(precision); output.data = blob_buffer.buffer; - av_assert0(request->inference_count <= dims.dims[0]); - av_assert0(request->inference_count >= 1); - for (int i = 0; i < request->inference_count; ++i) { - task = request->inferences[i]->task; + av_assert0(request->lltask_count <= dims.dims[0]); + av_assert0(request->lltask_count >= 1); + for (int i = 0; i < request->lltask_count; ++i) { + task = request->lltasks[i]->task; task->inference_done++; switch (ov_model->model->func_type) { @@ -272,27 +272,27 @@ static void infer_completion_callback(void *args) av_log(ctx, AV_LOG_ERROR, "detect filter needs to provide post proc\n"); return; } - ov_model->model->detect_post_proc(task->out_frame, &output, 1, ov_model->model->filter_ctx); + ov_model->model->detect_post_proc(task->in_frame, &output, 1, ov_model->model->filter_ctx); break; case DFT_ANALYTICS_CLASSIFY: if (!ov_model->model->classify_post_proc) { av_log(ctx, AV_LOG_ERROR, "classify filter needs to provide post proc\n"); return; } - ov_model->model->classify_post_proc(task->out_frame, &output, request->inferences[i]->bbox_index, ov_model->model->filter_ctx); + ov_model->model->classify_post_proc(task->in_frame, &output, request->lltasks[i]->bbox_index, ov_model->model->filter_ctx); break; default: av_assert0(!"should not reach here"); break; } - av_freep(&request->inferences[i]); + av_freep(&request->lltasks[i]); output.data = (uint8_t *)output.data + output.width * output.height * output.channels * get_datatype_size(output.dt); } ie_blob_free(&output_blob); - request->inference_count = 0; + request->lltask_count = 0; if (ff_safe_queue_push_back(requestq, request) < 0) { ie_infer_request_free(&request->infer_request); av_freep(&request); @@ -399,11 +399,11 @@ static DNNReturnType init_model_ov(OVModel *ov_model, const char *input_name, co goto err; } - item->inferences = av_malloc_array(ctx->options.batch_size, sizeof(*item->inferences)); - if (!item->inferences) { + item->lltasks = av_malloc_array(ctx->options.batch_size, sizeof(*item->lltasks)); + if (!item->lltasks) { goto err; } - item->inference_count = 0; + item->lltask_count = 0; } ov_model->task_queue = ff_queue_create(); @@ -411,8 +411,8 @@ static DNNReturnType init_model_ov(OVModel *ov_model, const char *input_name, co goto err; } - ov_model->inference_queue = ff_queue_create(); - if (!ov_model->inference_queue) { + ov_model->lltask_queue = ff_queue_create(); + if (!ov_model->lltask_queue) { goto err; } @@ -427,7 +427,7 @@ static DNNReturnType execute_model_ov(OVRequestItem *request, Queue *inferenceq) { IEStatusCode status; DNNReturnType ret; - InferenceItem *inference; + LastLevelTaskItem *lltask; TaskItem *task; OVContext *ctx; OVModel *ov_model; @@ -438,8 +438,8 @@ static DNNReturnType execute_model_ov(OVRequestItem *request, Queue *inferenceq) return DNN_SUCCESS; } - inference = ff_queue_peek_front(inferenceq); - task = inference->task; + lltask = ff_queue_peek_front(inferenceq); + task = lltask->task; ov_model = task->model; ctx = &ov_model->ctx; @@ -567,21 +567,21 @@ static int contain_valid_detection_bbox(AVFrame *frame) return 1; } -static DNNReturnType extract_inference_from_task(DNNFunctionType func_type, TaskItem *task, Queue *inference_queue, DNNExecBaseParams *exec_params) +static DNNReturnType extract_lltask_from_task(DNNFunctionType func_type, TaskItem *task, Queue *lltask_queue, DNNExecBaseParams *exec_params) { switch (func_type) { case DFT_PROCESS_FRAME: case DFT_ANALYTICS_DETECT: { - InferenceItem *inference = av_malloc(sizeof(*inference)); - if (!inference) { + LastLevelTaskItem *lltask = av_malloc(sizeof(*lltask)); + if (!lltask) { return DNN_ERROR; } task->inference_todo = 1; task->inference_done = 0; - inference->task = task; - if (ff_queue_push_back(inference_queue, inference) < 0) { - av_freep(&inference); + lltask->task = task; + if (ff_queue_push_back(lltask_queue, lltask) < 0) { + av_freep(&lltask); return DNN_ERROR; } return DNN_SUCCESS; @@ -604,7 +604,7 @@ static DNNReturnType extract_inference_from_task(DNNFunctionType func_type, Task header = (const AVDetectionBBoxHeader *)sd->data; for (uint32_t i = 0; i < header->nb_bboxes; i++) { - InferenceItem *inference; + LastLevelTaskItem *lltask; const AVDetectionBBox *bbox = av_get_detection_bbox(header, i); if (params->target) { @@ -613,15 +613,15 @@ static DNNReturnType extract_inference_from_task(DNNFunctionType func_type, Task } } - inference = av_malloc(sizeof(*inference)); - if (!inference) { + lltask = av_malloc(sizeof(*lltask)); + if (!lltask) { return DNN_ERROR; } task->inference_todo++; - inference->task = task; - inference->bbox_index = i; - if (ff_queue_push_back(inference_queue, inference) < 0) { - av_freep(&inference); + lltask->task = task; + lltask->bbox_index = i; + if (ff_queue_push_back(lltask_queue, lltask) < 0) { + av_freep(&lltask); return DNN_ERROR; } } @@ -641,10 +641,15 @@ static DNNReturnType get_output_ov(void *model, const char *input_name, int inpu OVContext *ctx = &ov_model->ctx; TaskItem task; OVRequestItem *request; - AVFrame *in_frame = NULL; - AVFrame *out_frame = NULL; IEStatusCode status; input_shapes_t input_shapes; + DNNExecBaseParams exec_params = { + .input_name = input_name, + .output_names = &output_name, + .nb_output = 1, + .in_frame = NULL, + .out_frame = NULL, + }; if (ov_model->model->func_type != DFT_PROCESS_FRAME) { av_log(ctx, AV_LOG_ERROR, "Get output dim only when processing frame.\n"); @@ -670,51 +675,29 @@ static DNNReturnType get_output_ov(void *model, const char *input_name, int inpu } } - in_frame = av_frame_alloc(); - if (!in_frame) { - av_log(ctx, AV_LOG_ERROR, "Failed to allocate memory for input frame\n"); + if (ff_dnn_fill_gettingoutput_task(&task, &exec_params, ov_model, input_height, input_width, ctx) != DNN_SUCCESS) { return DNN_ERROR; } - in_frame->width = input_width; - in_frame->height = input_height; - out_frame = av_frame_alloc(); - if (!out_frame) { - av_log(ctx, AV_LOG_ERROR, "Failed to allocate memory for output frame\n"); - av_frame_free(&in_frame); - return DNN_ERROR; - } - - task.do_ioproc = 0; - task.async = 0; - task.input_name = input_name; - task.in_frame = in_frame; - task.output_names = &output_name; - task.out_frame = out_frame; - task.nb_output = 1; - task.model = ov_model; - - if (extract_inference_from_task(ov_model->model->func_type, &task, ov_model->inference_queue, NULL) != DNN_SUCCESS) { - av_frame_free(&out_frame); - av_frame_free(&in_frame); - av_log(ctx, AV_LOG_ERROR, "unable to extract inference from task.\n"); - return DNN_ERROR; + if (extract_lltask_from_task(ov_model->model->func_type, &task, ov_model->lltask_queue, NULL) != DNN_SUCCESS) { + av_log(ctx, AV_LOG_ERROR, "unable to extract last level task from task.\n"); + ret = DNN_ERROR; + goto err; } request = ff_safe_queue_pop_front(ov_model->request_queue); if (!request) { - av_frame_free(&out_frame); - av_frame_free(&in_frame); av_log(ctx, AV_LOG_ERROR, "unable to get infer request.\n"); - return DNN_ERROR; + ret = DNN_ERROR; + goto err; } - ret = execute_model_ov(request, ov_model->inference_queue); - *output_width = out_frame->width; - *output_height = out_frame->height; - - av_frame_free(&out_frame); - av_frame_free(&in_frame); + ret = execute_model_ov(request, ov_model->lltask_queue); + *output_width = task.out_frame->width; + *output_height = task.out_frame->height; +err: + av_frame_free(&task.out_frame); + av_frame_free(&task.in_frame); return ret; } @@ -779,55 +762,6 @@ DNNReturnType ff_dnn_execute_model_ov(const DNNModel *model, DNNExecBaseParams * { OVModel *ov_model = model->model; OVContext *ctx = &ov_model->ctx; - TaskItem task; - OVRequestItem *request; - - if (ff_check_exec_params(ctx, DNN_OV, model->func_type, exec_params) != 0) { - return DNN_ERROR; - } - - if (model->func_type == DFT_ANALYTICS_CLASSIFY) { - // Once we add async support for tensorflow backend and native backend, - // we'll combine the two sync/async functions in dnn_interface.h to - // simplify the code in filter, and async will be an option within backends. - // so, do not support now, and classify filter will not call this function. - return DNN_ERROR; - } - - if (ctx->options.batch_size > 1) { - avpriv_report_missing_feature(ctx, "batch mode for sync execution"); - return DNN_ERROR; - } - - if (!ov_model->exe_network) { - if (init_model_ov(ov_model, exec_params->input_name, exec_params->output_names[0]) != DNN_SUCCESS) { - av_log(ctx, AV_LOG_ERROR, "Failed init OpenVINO exectuable network or inference request\n"); - return DNN_ERROR; - } - } - - if (ff_dnn_fill_task(&task, exec_params, ov_model, 0, 1) != DNN_SUCCESS) { - return DNN_ERROR; - } - - if (extract_inference_from_task(ov_model->model->func_type, &task, ov_model->inference_queue, exec_params) != DNN_SUCCESS) { - av_log(ctx, AV_LOG_ERROR, "unable to extract inference from task.\n"); - return DNN_ERROR; - } - - request = ff_safe_queue_pop_front(ov_model->request_queue); - if (!request) { - av_log(ctx, AV_LOG_ERROR, "unable to get infer request.\n"); - return DNN_ERROR; - } - - return execute_model_ov(request, ov_model->inference_queue); -} - -DNNReturnType ff_dnn_execute_model_async_ov(const DNNModel *model, DNNExecBaseParams *exec_params) -{ - OVModel *ov_model = model->model; - OVContext *ctx = &ov_model->ctx; OVRequestItem *request; TaskItem *task; DNNReturnType ret; @@ -849,7 +783,8 @@ DNNReturnType ff_dnn_execute_model_async_ov(const DNNModel *model, DNNExecBasePa return DNN_ERROR; } - if (ff_dnn_fill_task(task, exec_params, ov_model, 1, 1) != DNN_SUCCESS) { + if (ff_dnn_fill_task(task, exec_params, ov_model, ctx->options.async, 1) != DNN_SUCCESS) { + av_freep(&task); return DNN_ERROR; } @@ -859,46 +794,53 @@ DNNReturnType ff_dnn_execute_model_async_ov(const DNNModel *model, DNNExecBasePa return DNN_ERROR; } - if (extract_inference_from_task(model->func_type, task, ov_model->inference_queue, exec_params) != DNN_SUCCESS) { + if (extract_lltask_from_task(model->func_type, task, ov_model->lltask_queue, exec_params) != DNN_SUCCESS) { av_log(ctx, AV_LOG_ERROR, "unable to extract inference from task.\n"); return DNN_ERROR; } - while (ff_queue_size(ov_model->inference_queue) >= ctx->options.batch_size) { + if (ctx->options.async) { + while (ff_queue_size(ov_model->lltask_queue) >= ctx->options.batch_size) { + request = ff_safe_queue_pop_front(ov_model->request_queue); + if (!request) { + av_log(ctx, AV_LOG_ERROR, "unable to get infer request.\n"); + return DNN_ERROR; + } + + ret = execute_model_ov(request, ov_model->lltask_queue); + if (ret != DNN_SUCCESS) { + return ret; + } + } + + return DNN_SUCCESS; + } + else { + if (model->func_type == DFT_ANALYTICS_CLASSIFY) { + // Classification filter has not been completely + // tested with the sync mode. So, do not support now. + avpriv_report_missing_feature(ctx, "classify for sync execution"); + return DNN_ERROR; + } + + if (ctx->options.batch_size > 1) { + avpriv_report_missing_feature(ctx, "batch mode for sync execution"); + return DNN_ERROR; + } + request = ff_safe_queue_pop_front(ov_model->request_queue); if (!request) { av_log(ctx, AV_LOG_ERROR, "unable to get infer request.\n"); return DNN_ERROR; } - - ret = execute_model_ov(request, ov_model->inference_queue); - if (ret != DNN_SUCCESS) { - return ret; - } + return execute_model_ov(request, ov_model->lltask_queue); } - - return DNN_SUCCESS; } -DNNAsyncStatusType ff_dnn_get_async_result_ov(const DNNModel *model, AVFrame **in, AVFrame **out) +DNNAsyncStatusType ff_dnn_get_result_ov(const DNNModel *model, AVFrame **in, AVFrame **out) { OVModel *ov_model = model->model; - TaskItem *task = ff_queue_peek_front(ov_model->task_queue); - - if (!task) { - return DAST_EMPTY_QUEUE; - } - - if (task->inference_done != task->inference_todo) { - return DAST_NOT_READY; - } - - *in = task->in_frame; - *out = task->out_frame; - ff_queue_pop_front(ov_model->task_queue); - av_freep(&task); - - return DAST_SUCCESS; + return ff_dnn_get_result_common(ov_model->task_queue, in, out); } DNNReturnType ff_dnn_flush_ov(const DNNModel *model) @@ -909,7 +851,7 @@ DNNReturnType ff_dnn_flush_ov(const DNNModel *model) IEStatusCode status; DNNReturnType ret; - if (ff_queue_size(ov_model->inference_queue) == 0) { + if (ff_queue_size(ov_model->lltask_queue) == 0) { // no pending task need to flush return DNN_SUCCESS; } @@ -948,16 +890,16 @@ void ff_dnn_free_model_ov(DNNModel **model) if (item && item->infer_request) { ie_infer_request_free(&item->infer_request); } - av_freep(&item->inferences); + av_freep(&item->lltasks); av_freep(&item); } ff_safe_queue_destroy(ov_model->request_queue); - while (ff_queue_size(ov_model->inference_queue) != 0) { - InferenceItem *item = ff_queue_pop_front(ov_model->inference_queue); + while (ff_queue_size(ov_model->lltask_queue) != 0) { + LastLevelTaskItem *item = ff_queue_pop_front(ov_model->lltask_queue); av_freep(&item); } - ff_queue_destroy(ov_model->inference_queue); + ff_queue_destroy(ov_model->lltask_queue); while (ff_queue_size(ov_model->task_queue) != 0) { TaskItem *item = ff_queue_pop_front(ov_model->task_queue); diff --git a/chromium/third_party/ffmpeg/libavfilter/dnn/dnn_backend_openvino.h b/chromium/third_party/ffmpeg/libavfilter/dnn/dnn_backend_openvino.h index 046d0c5b5a1..0bbca0c057a 100644 --- a/chromium/third_party/ffmpeg/libavfilter/dnn/dnn_backend_openvino.h +++ b/chromium/third_party/ffmpeg/libavfilter/dnn/dnn_backend_openvino.h @@ -32,8 +32,7 @@ DNNModel *ff_dnn_load_model_ov(const char *model_filename, DNNFunctionType func_type, const char *options, AVFilterContext *filter_ctx); DNNReturnType ff_dnn_execute_model_ov(const DNNModel *model, DNNExecBaseParams *exec_params); -DNNReturnType ff_dnn_execute_model_async_ov(const DNNModel *model, DNNExecBaseParams *exec_params); -DNNAsyncStatusType ff_dnn_get_async_result_ov(const DNNModel *model, AVFrame **in, AVFrame **out); +DNNAsyncStatusType ff_dnn_get_result_ov(const DNNModel *model, AVFrame **in, AVFrame **out); DNNReturnType ff_dnn_flush_ov(const DNNModel *model); void ff_dnn_free_model_ov(DNNModel **model); diff --git a/chromium/third_party/ffmpeg/libavfilter/dnn/dnn_backend_tf.c b/chromium/third_party/ffmpeg/libavfilter/dnn/dnn_backend_tf.c index 6443c2fd1d3..c95cad7944b 100644 --- a/chromium/third_party/ffmpeg/libavfilter/dnn/dnn_backend_tf.c +++ b/chromium/third_party/ffmpeg/libavfilter/dnn/dnn_backend_tf.c @@ -31,17 +31,18 @@ #include "libavutil/avassert.h" #include "libavutil/avstring.h" #include "libavutil/cpu.h" +#include "libavcodec/defs.h" #include "../internal.h" #include "dnn_backend_native_layer_pad.h" #include "dnn_backend_native_layer_maximum.h" #include "dnn_io_proc.h" #include "dnn_backend_common.h" #include "safe_queue.h" -#include "queue.h" #include <tensorflow/c/c_api.h> typedef struct TFOptions{ char *sess_config; + uint8_t async; uint32_t nireq; } TFOptions; @@ -57,7 +58,8 @@ typedef struct TFModel{ TF_Session *session; TF_Status *status; SafeQueue *request_queue; - Queue *inference_queue; + Queue *lltask_queue; + Queue *task_queue; } TFModel; /** @@ -73,8 +75,9 @@ typedef struct TFInferRequest { typedef struct TFRequestItem { TFInferRequest *infer_request; - InferenceItem *inference; - // further properties will be added later for async + LastLevelTaskItem *lltask; + TF_Status *status; + DNNAsyncExecModule exec_module; } TFRequestItem; #define OFFSET(x) offsetof(TFContext, x) @@ -87,13 +90,22 @@ static const AVOption dnn_tensorflow_options[] = { AVFILTER_DEFINE_CLASS(dnn_tensorflow); -static DNNReturnType execute_model_tf(TFRequestItem *request, Queue *inference_queue); +static DNNReturnType execute_model_tf(TFRequestItem *request, Queue *lltask_queue); +static void infer_completion_callback(void *args); +static inline void destroy_request_item(TFRequestItem **arg); static void free_buffer(void *data, size_t length) { av_freep(&data); } +/** + * Free the contents of TensorFlow inference request. + * It does not free the TFInferRequest instance. + * + * @param request pointer to TFInferRequest instance. + * NULL pointer is allowed. + */ static void tf_free_request(TFInferRequest *request) { if (!request) @@ -116,9 +128,18 @@ static void tf_free_request(TFInferRequest *request) } } +/** + * Create a TensorFlow inference request. All properties + * are initially unallocated and set as NULL. + * + * @return pointer to the allocated TFInferRequest instance. + */ static TFInferRequest *tf_create_inference_request(void) { TFInferRequest *infer_request = av_malloc(sizeof(TFInferRequest)); + if (!infer_request) { + return NULL; + } infer_request->tf_outputs = NULL; infer_request->tf_input = NULL; infer_request->input_tensor = NULL; @@ -126,21 +147,76 @@ static TFInferRequest *tf_create_inference_request(void) return infer_request; } -static DNNReturnType extract_inference_from_task(TaskItem *task, Queue *inference_queue) +/** + * Start synchronous inference for the TensorFlow model. + * + * @param request pointer to the TFRequestItem for inference + * @retval DNN_SUCCESS if execution is successful + * @retval DNN_ERROR if execution fails + */ +static DNNReturnType tf_start_inference(void *args) +{ + TFRequestItem *request = args; + TFInferRequest *infer_request = request->infer_request; + LastLevelTaskItem *lltask = request->lltask; + TaskItem *task = lltask->task; + TFModel *tf_model = task->model; + + if (!request) { + av_log(&tf_model->ctx, AV_LOG_ERROR, "TFRequestItem is NULL\n"); + return DNN_ERROR; + } + + TF_SessionRun(tf_model->session, NULL, + infer_request->tf_input, &infer_request->input_tensor, 1, + infer_request->tf_outputs, infer_request->output_tensors, + task->nb_output, NULL, 0, NULL, + request->status); + if (TF_GetCode(request->status) != TF_OK) { + av_log(&tf_model->ctx, AV_LOG_ERROR, "%s", TF_Message(request->status)); + tf_free_request(infer_request); + if (ff_safe_queue_push_back(tf_model->request_queue, request) < 0) { + destroy_request_item(&request); + } + return DNN_ERROR; + } + return DNN_SUCCESS; +} + +/** + * Free the TFRequestItem completely. + * + * @param arg Address of the TFInferRequest instance. + */ +static inline void destroy_request_item(TFRequestItem **arg) { + TFRequestItem *request; + if (!arg) { + return; + } + request = *arg; + tf_free_request(request->infer_request); + av_freep(&request->infer_request); + av_freep(&request->lltask); + TF_DeleteStatus(request->status); + ff_dnn_async_module_cleanup(&request->exec_module); + av_freep(arg); +} + +static DNNReturnType extract_lltask_from_task(TaskItem *task, Queue *lltask_queue) { TFModel *tf_model = task->model; TFContext *ctx = &tf_model->ctx; - InferenceItem *inference = av_malloc(sizeof(*inference)); - if (!inference) { - av_log(ctx, AV_LOG_ERROR, "Unable to allocate space for InferenceItem\n"); + LastLevelTaskItem *lltask = av_malloc(sizeof(*lltask)); + if (!lltask) { + av_log(ctx, AV_LOG_ERROR, "Unable to allocate space for LastLevelTaskItem\n"); return DNN_ERROR; } task->inference_todo = 1; task->inference_done = 0; - inference->task = task; - if (ff_queue_push_back(inference_queue, inference) < 0) { - av_log(ctx, AV_LOG_ERROR, "Failed to push back inference_queue.\n"); - av_freep(&inference); + lltask->task = task; + if (ff_queue_push_back(lltask_queue, lltask) < 0) { + av_log(ctx, AV_LOG_ERROR, "Failed to push back lltask_queue.\n"); + av_freep(&lltask); return DNN_ERROR; } return DNN_SUCCESS; @@ -243,37 +319,21 @@ static DNNReturnType get_output_tf(void *model, const char *input_name, int inpu DNNReturnType ret; TFModel *tf_model = model; TFContext *ctx = &tf_model->ctx; - AVFrame *in_frame = av_frame_alloc(); - AVFrame *out_frame = NULL; TaskItem task; TFRequestItem *request; - - if (!in_frame) { - av_log(ctx, AV_LOG_ERROR, "Failed to allocate memory for input frame\n"); - ret = DNN_ERROR; - goto err; - } - - out_frame = av_frame_alloc(); - if (!out_frame) { - av_log(ctx, AV_LOG_ERROR, "Failed to allocate memory for output frame\n"); - ret = DNN_ERROR; + DNNExecBaseParams exec_params = { + .input_name = input_name, + .output_names = &output_name, + .nb_output = 1, + .in_frame = NULL, + .out_frame = NULL, + }; + + if (ff_dnn_fill_gettingoutput_task(&task, &exec_params, tf_model, input_height, input_width, ctx) != DNN_SUCCESS) { goto err; } - in_frame->width = input_width; - in_frame->height = input_height; - - task.do_ioproc = 0; - task.async = 0; - task.input_name = input_name; - task.in_frame = in_frame; - task.output_names = &output_name; - task.out_frame = out_frame; - task.model = tf_model; - task.nb_output = 1; - - if (extract_inference_from_task(&task, tf_model->inference_queue) != DNN_SUCCESS) { + if (extract_lltask_from_task(&task, tf_model->lltask_queue) != DNN_SUCCESS) { av_log(ctx, AV_LOG_ERROR, "unable to extract inference from task.\n"); ret = DNN_ERROR; goto err; @@ -286,13 +346,13 @@ static DNNReturnType get_output_tf(void *model, const char *input_name, int inpu goto err; } - ret = execute_model_tf(request, tf_model->inference_queue); - *output_width = out_frame->width; - *output_height = out_frame->height; + ret = execute_model_tf(request, tf_model->lltask_queue); + *output_width = task.out_frame->width; + *output_height = task.out_frame->height; err: - av_frame_free(&out_frame); - av_frame_free(&in_frame); + av_frame_free(&task.out_frame); + av_frame_free(&task.in_frame); return ret; } @@ -824,6 +884,13 @@ DNNModel *ff_dnn_load_model_tf(const char *model_filename, DNNFunctionType func_ ctx->options.nireq = av_cpu_count() / 2 + 1; } +#if !HAVE_PTHREAD_CANCEL + if (ctx->options.async) { + ctx->options.async = 0; + av_log(filter_ctx, AV_LOG_WARNING, "pthread is not supported, roll back to sync.\n"); + } +#endif + tf_model->request_queue = ff_safe_queue_create(); if (!tf_model->request_queue) { goto err; @@ -834,22 +901,31 @@ DNNModel *ff_dnn_load_model_tf(const char *model_filename, DNNFunctionType func_ if (!item) { goto err; } + item->lltask = NULL; item->infer_request = tf_create_inference_request(); if (!item->infer_request) { av_log(ctx, AV_LOG_ERROR, "Failed to allocate memory for TensorFlow inference request\n"); av_freep(&item); goto err; } + item->status = TF_NewStatus(); + item->exec_module.start_inference = &tf_start_inference; + item->exec_module.callback = &infer_completion_callback; + item->exec_module.args = item; if (ff_safe_queue_push_back(tf_model->request_queue, item) < 0) { - av_freep(&item->infer_request); - av_freep(&item); + destroy_request_item(&item); goto err; } } - tf_model->inference_queue = ff_queue_create(); - if (!tf_model->inference_queue) { + tf_model->lltask_queue = ff_queue_create(); + if (!tf_model->lltask_queue) { + goto err; + } + + tf_model->task_queue = ff_queue_create(); + if (!tf_model->task_queue) { goto err; } @@ -868,15 +944,15 @@ err: static DNNReturnType fill_model_input_tf(TFModel *tf_model, TFRequestItem *request) { DNNData input; - InferenceItem *inference; + LastLevelTaskItem *lltask; TaskItem *task; TFInferRequest *infer_request; TFContext *ctx = &tf_model->ctx; - inference = ff_queue_pop_front(tf_model->inference_queue); - av_assert0(inference); - task = inference->task; - request->inference = inference; + lltask = ff_queue_pop_front(tf_model->lltask_queue); + av_assert0(lltask); + task = lltask->task; + request->lltask = lltask; if (get_input_tf(tf_model, &input, task->input_name) != DNN_SUCCESS) { goto err; @@ -954,8 +1030,8 @@ err: static void infer_completion_callback(void *args) { TFRequestItem *request = args; - InferenceItem *inference = request->inference; - TaskItem *task = inference->task; + LastLevelTaskItem *lltask = request->lltask; + TaskItem *task = lltask->task; DNNData *outputs; TFInferRequest *infer_request = request->infer_request; TFModel *tf_model = task->model; @@ -993,7 +1069,7 @@ static void infer_completion_callback(void *args) { av_log(ctx, AV_LOG_ERROR, "Detect filter needs provide post proc\n"); return; } - tf_model->model->detect_post_proc(task->out_frame, outputs, task->nb_output, tf_model->model->filter_ctx); + tf_model->model->detect_post_proc(task->in_frame, outputs, task->nb_output, tf_model->model->filter_ctx); break; default: av_log(ctx, AV_LOG_ERROR, "Tensorflow backend does not support this kind of dnn filter now\n"); @@ -1005,70 +1081,82 @@ err: av_freep(&outputs); if (ff_safe_queue_push_back(tf_model->request_queue, request) < 0) { - av_freep(&request->infer_request); - av_freep(&request); + destroy_request_item(&request); av_log(ctx, AV_LOG_ERROR, "Failed to push back request_queue.\n"); } } -static DNNReturnType execute_model_tf(TFRequestItem *request, Queue *inference_queue) +static DNNReturnType execute_model_tf(TFRequestItem *request, Queue *lltask_queue) { TFModel *tf_model; TFContext *ctx; - TFInferRequest *infer_request; - InferenceItem *inference; + LastLevelTaskItem *lltask; TaskItem *task; - inference = ff_queue_peek_front(inference_queue); - if (!inference) { - av_log(NULL, AV_LOG_ERROR, "Failed to get inference item\n"); - return DNN_ERROR; + if (ff_queue_size(lltask_queue) == 0) { + destroy_request_item(&request); + return DNN_SUCCESS; } - task = inference->task; + + lltask = ff_queue_peek_front(lltask_queue); + task = lltask->task; tf_model = task->model; ctx = &tf_model->ctx; + if (fill_model_input_tf(tf_model, request) != DNN_SUCCESS) { + goto err; + } + if (task->async) { - avpriv_report_missing_feature(ctx, "Async execution not supported"); - return DNN_ERROR; - } else { - if (fill_model_input_tf(tf_model, request) != DNN_SUCCESS) { - return DNN_ERROR; + if (ff_dnn_start_inference_async(ctx, &request->exec_module) != DNN_SUCCESS) { + goto err; } - - infer_request = request->infer_request; - TF_SessionRun(tf_model->session, NULL, - infer_request->tf_input, &infer_request->input_tensor, 1, - infer_request->tf_outputs, infer_request->output_tensors, - task->nb_output, NULL, 0, NULL, - tf_model->status); - if (TF_GetCode(tf_model->status) != TF_OK) { - tf_free_request(infer_request); - av_log(ctx, AV_LOG_ERROR, "Failed to run session when executing model\n"); - return DNN_ERROR; + return DNN_SUCCESS; + } else { + if (tf_start_inference(request) != DNN_SUCCESS) { + goto err; } infer_completion_callback(request); return (task->inference_done == task->inference_todo) ? DNN_SUCCESS : DNN_ERROR; } +err: + tf_free_request(request->infer_request); + if (ff_safe_queue_push_back(tf_model->request_queue, request) < 0) { + destroy_request_item(&request); + } + return DNN_ERROR; } DNNReturnType ff_dnn_execute_model_tf(const DNNModel *model, DNNExecBaseParams *exec_params) { TFModel *tf_model = model->model; TFContext *ctx = &tf_model->ctx; - TaskItem task; + TaskItem *task; TFRequestItem *request; if (ff_check_exec_params(ctx, DNN_TF, model->func_type, exec_params) != 0) { return DNN_ERROR; } - if (ff_dnn_fill_task(&task, exec_params, tf_model, 0, 1) != DNN_SUCCESS) { + task = av_malloc(sizeof(*task)); + if (!task) { + av_log(ctx, AV_LOG_ERROR, "unable to alloc memory for task item.\n"); return DNN_ERROR; } - if (extract_inference_from_task(&task, tf_model->inference_queue) != DNN_SUCCESS) { - av_log(ctx, AV_LOG_ERROR, "unable to extract inference from task.\n"); + if (ff_dnn_fill_task(task, exec_params, tf_model, ctx->options.async, 1) != DNN_SUCCESS) { + av_freep(&task); + return DNN_ERROR; + } + + if (ff_queue_push_back(tf_model->task_queue, task) < 0) { + av_freep(&task); + av_log(ctx, AV_LOG_ERROR, "unable to push back task_queue.\n"); + return DNN_ERROR; + } + + if (extract_lltask_from_task(task, tf_model->lltask_queue) != DNN_SUCCESS) { + av_log(ctx, AV_LOG_ERROR, "unable to extract last level task from task.\n"); return DNN_ERROR; } @@ -1077,8 +1165,43 @@ DNNReturnType ff_dnn_execute_model_tf(const DNNModel *model, DNNExecBaseParams * av_log(ctx, AV_LOG_ERROR, "unable to get infer request.\n"); return DNN_ERROR; } + return execute_model_tf(request, tf_model->lltask_queue); +} + +DNNAsyncStatusType ff_dnn_get_result_tf(const DNNModel *model, AVFrame **in, AVFrame **out) +{ + TFModel *tf_model = model->model; + return ff_dnn_get_result_common(tf_model->task_queue, in, out); +} + +DNNReturnType ff_dnn_flush_tf(const DNNModel *model) +{ + TFModel *tf_model = model->model; + TFContext *ctx = &tf_model->ctx; + TFRequestItem *request; + DNNReturnType ret; + + if (ff_queue_size(tf_model->lltask_queue) == 0) { + // no pending task need to flush + return DNN_SUCCESS; + } - return execute_model_tf(request, tf_model->inference_queue); + request = ff_safe_queue_pop_front(tf_model->request_queue); + if (!request) { + av_log(ctx, AV_LOG_ERROR, "unable to get infer request.\n"); + return DNN_ERROR; + } + + ret = fill_model_input_tf(tf_model, request); + if (ret != DNN_SUCCESS) { + av_log(ctx, AV_LOG_ERROR, "Failed to fill model input.\n"); + if (ff_safe_queue_push_back(tf_model->request_queue, request) < 0) { + destroy_request_item(&request); + } + return ret; + } + + return ff_dnn_start_inference_async(ctx, &request->exec_module); } void ff_dnn_free_model_tf(DNNModel **model) @@ -1089,17 +1212,23 @@ void ff_dnn_free_model_tf(DNNModel **model) tf_model = (*model)->model; while (ff_safe_queue_size(tf_model->request_queue) != 0) { TFRequestItem *item = ff_safe_queue_pop_front(tf_model->request_queue); - tf_free_request(item->infer_request); - av_freep(&item->infer_request); - av_freep(&item); + destroy_request_item(&item); } ff_safe_queue_destroy(tf_model->request_queue); - while (ff_queue_size(tf_model->inference_queue) != 0) { - InferenceItem *item = ff_queue_pop_front(tf_model->inference_queue); + while (ff_queue_size(tf_model->lltask_queue) != 0) { + LastLevelTaskItem *item = ff_queue_pop_front(tf_model->lltask_queue); + av_freep(&item); + } + ff_queue_destroy(tf_model->lltask_queue); + + while (ff_queue_size(tf_model->task_queue) != 0) { + TaskItem *item = ff_queue_pop_front(tf_model->task_queue); + av_frame_free(&item->in_frame); + av_frame_free(&item->out_frame); av_freep(&item); } - ff_queue_destroy(tf_model->inference_queue); + ff_queue_destroy(tf_model->task_queue); if (tf_model->graph){ TF_DeleteGraph(tf_model->graph); diff --git a/chromium/third_party/ffmpeg/libavfilter/dnn/dnn_backend_tf.h b/chromium/third_party/ffmpeg/libavfilter/dnn/dnn_backend_tf.h index 3dfd6e4280f..f14ea8c47af 100644 --- a/chromium/third_party/ffmpeg/libavfilter/dnn/dnn_backend_tf.h +++ b/chromium/third_party/ffmpeg/libavfilter/dnn/dnn_backend_tf.h @@ -32,6 +32,8 @@ DNNModel *ff_dnn_load_model_tf(const char *model_filename, DNNFunctionType func_type, const char *options, AVFilterContext *filter_ctx); DNNReturnType ff_dnn_execute_model_tf(const DNNModel *model, DNNExecBaseParams *exec_params); +DNNAsyncStatusType ff_dnn_get_result_tf(const DNNModel *model, AVFrame **in, AVFrame **out); +DNNReturnType ff_dnn_flush_tf(const DNNModel *model); void ff_dnn_free_model_tf(DNNModel **model); diff --git a/chromium/third_party/ffmpeg/libavfilter/dnn/dnn_interface.c b/chromium/third_party/ffmpeg/libavfilter/dnn/dnn_interface.c index 02e532fc1b6..554a36b0dc7 100644 --- a/chromium/third_party/ffmpeg/libavfilter/dnn/dnn_interface.c +++ b/chromium/third_party/ffmpeg/libavfilter/dnn/dnn_interface.c @@ -42,12 +42,16 @@ DNNModule *ff_get_dnn_module(DNNBackendType backend_type) case DNN_NATIVE: dnn_module->load_model = &ff_dnn_load_model_native; dnn_module->execute_model = &ff_dnn_execute_model_native; + dnn_module->get_result = &ff_dnn_get_result_native; + dnn_module->flush = &ff_dnn_flush_native; dnn_module->free_model = &ff_dnn_free_model_native; break; case DNN_TF: #if (CONFIG_LIBTENSORFLOW == 1) dnn_module->load_model = &ff_dnn_load_model_tf; dnn_module->execute_model = &ff_dnn_execute_model_tf; + dnn_module->get_result = &ff_dnn_get_result_tf; + dnn_module->flush = &ff_dnn_flush_tf; dnn_module->free_model = &ff_dnn_free_model_tf; #else av_freep(&dnn_module); @@ -58,8 +62,7 @@ DNNModule *ff_get_dnn_module(DNNBackendType backend_type) #if (CONFIG_LIBOPENVINO == 1) dnn_module->load_model = &ff_dnn_load_model_ov; dnn_module->execute_model = &ff_dnn_execute_model_ov; - dnn_module->execute_model_async = &ff_dnn_execute_model_async_ov; - dnn_module->get_async_result = &ff_dnn_get_async_result_ov; + dnn_module->get_result = &ff_dnn_get_result_ov; dnn_module->flush = &ff_dnn_flush_ov; dnn_module->free_model = &ff_dnn_free_model_ov; #else diff --git a/chromium/third_party/ffmpeg/libavfilter/dnn/queue.h b/chromium/third_party/ffmpeg/libavfilter/dnn/queue.h index 2524d5fa59a..9ab5c89f65e 100644 --- a/chromium/third_party/ffmpeg/libavfilter/dnn/queue.h +++ b/chromium/third_party/ffmpeg/libavfilter/dnn/queue.h @@ -18,6 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include <stddef.h> #ifndef AVFILTER_DNN_QUEUE_H #define AVFILTER_DNN_QUEUE_H diff --git a/chromium/third_party/ffmpeg/libavfilter/dnn_filter_common.c b/chromium/third_party/ffmpeg/libavfilter/dnn_filter_common.c index fcee7482c3c..3045ce01315 100644 --- a/chromium/third_party/ffmpeg/libavfilter/dnn_filter_common.c +++ b/chromium/third_party/ffmpeg/libavfilter/dnn_filter_common.c @@ -84,18 +84,6 @@ int ff_dnn_init(DnnContext *ctx, DNNFunctionType func_type, AVFilterContext *fil return AVERROR(EINVAL); } - if (!ctx->dnn_module->execute_model_async && ctx->async) { - ctx->async = 0; - av_log(filter_ctx, AV_LOG_WARNING, "this backend does not support async execution, roll back to sync.\n"); - } - -#if !HAVE_PTHREAD_CANCEL - if (ctx->async) { - ctx->async = 0; - av_log(filter_ctx, AV_LOG_WARNING, "pthread is not supported, roll back to sync.\n"); - } -#endif - return 0; } @@ -141,18 +129,6 @@ DNNReturnType ff_dnn_execute_model(DnnContext *ctx, AVFrame *in_frame, AVFrame * return (ctx->dnn_module->execute_model)(ctx->model, &exec_params); } -DNNReturnType ff_dnn_execute_model_async(DnnContext *ctx, AVFrame *in_frame, AVFrame *out_frame) -{ - DNNExecBaseParams exec_params = { - .input_name = ctx->model_inputname, - .output_names = (const char **)ctx->model_outputnames, - .nb_output = ctx->nb_outputs, - .in_frame = in_frame, - .out_frame = out_frame, - }; - return (ctx->dnn_module->execute_model_async)(ctx->model, &exec_params); -} - DNNReturnType ff_dnn_execute_model_classification(DnnContext *ctx, AVFrame *in_frame, AVFrame *out_frame, const char *target) { DNNExecClassificationParams class_params = { @@ -165,12 +141,12 @@ DNNReturnType ff_dnn_execute_model_classification(DnnContext *ctx, AVFrame *in_f }, .target = target, }; - return (ctx->dnn_module->execute_model_async)(ctx->model, &class_params.base); + return (ctx->dnn_module->execute_model)(ctx->model, &class_params.base); } -DNNAsyncStatusType ff_dnn_get_async_result(DnnContext *ctx, AVFrame **in_frame, AVFrame **out_frame) +DNNAsyncStatusType ff_dnn_get_result(DnnContext *ctx, AVFrame **in_frame, AVFrame **out_frame) { - return (ctx->dnn_module->get_async_result)(ctx->model, in_frame, out_frame); + return (ctx->dnn_module->get_result)(ctx->model, in_frame, out_frame); } DNNReturnType ff_dnn_flush(DnnContext *ctx) diff --git a/chromium/third_party/ffmpeg/libavfilter/dnn_filter_common.h b/chromium/third_party/ffmpeg/libavfilter/dnn_filter_common.h index 8e43d8c8dc8..635ae631c14 100644 --- a/chromium/third_party/ffmpeg/libavfilter/dnn_filter_common.h +++ b/chromium/third_party/ffmpeg/libavfilter/dnn_filter_common.h @@ -46,7 +46,7 @@ typedef struct DnnContext { { "output", "output name of the model", OFFSET(model_outputnames_string), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, FLAGS },\ { "backend_configs", "backend configs", OFFSET(backend_options), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, FLAGS },\ { "options", "backend configs (deprecated, use backend_configs)", OFFSET(backend_options), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, FLAGS | AV_OPT_FLAG_DEPRECATED},\ - { "async", "use DNN async inference", OFFSET(async), AV_OPT_TYPE_BOOL, { .i64 = 1}, 0, 1, FLAGS}, + { "async", "use DNN async inference (ignored, use backend_configs='async=1')", OFFSET(async), AV_OPT_TYPE_BOOL, { .i64 = 1}, 0, 1, FLAGS}, int ff_dnn_init(DnnContext *ctx, DNNFunctionType func_type, AVFilterContext *filter_ctx); @@ -56,9 +56,8 @@ int ff_dnn_set_classify_post_proc(DnnContext *ctx, ClassifyPostProc post_proc); DNNReturnType ff_dnn_get_input(DnnContext *ctx, DNNData *input); DNNReturnType ff_dnn_get_output(DnnContext *ctx, int input_width, int input_height, int *output_width, int *output_height); DNNReturnType ff_dnn_execute_model(DnnContext *ctx, AVFrame *in_frame, AVFrame *out_frame); -DNNReturnType ff_dnn_execute_model_async(DnnContext *ctx, AVFrame *in_frame, AVFrame *out_frame); DNNReturnType ff_dnn_execute_model_classification(DnnContext *ctx, AVFrame *in_frame, AVFrame *out_frame, const char *target); -DNNAsyncStatusType ff_dnn_get_async_result(DnnContext *ctx, AVFrame **in_frame, AVFrame **out_frame); +DNNAsyncStatusType ff_dnn_get_result(DnnContext *ctx, AVFrame **in_frame, AVFrame **out_frame); DNNReturnType ff_dnn_flush(DnnContext *ctx); void ff_dnn_uninit(DnnContext *ctx); diff --git a/chromium/third_party/ffmpeg/libavfilter/dnn_interface.h b/chromium/third_party/ffmpeg/libavfilter/dnn_interface.h index 5e9ffeb0778..37e89d97895 100644 --- a/chromium/third_party/ffmpeg/libavfilter/dnn_interface.h +++ b/chromium/third_party/ffmpeg/libavfilter/dnn_interface.h @@ -114,10 +114,8 @@ typedef struct DNNModule{ DNNModel *(*load_model)(const char *model_filename, DNNFunctionType func_type, const char *options, AVFilterContext *filter_ctx); // Executes model with specified input and output. Returns DNN_ERROR otherwise. DNNReturnType (*execute_model)(const DNNModel *model, DNNExecBaseParams *exec_params); - // Executes model with specified input and output asynchronously. Returns DNN_ERROR otherwise. - DNNReturnType (*execute_model_async)(const DNNModel *model, DNNExecBaseParams *exec_params); // Retrieve inference result. - DNNAsyncStatusType (*get_async_result)(const DNNModel *model, AVFrame **in, AVFrame **out); + DNNAsyncStatusType (*get_result)(const DNNModel *model, AVFrame **in, AVFrame **out); // Flush all the pending tasks. DNNReturnType (*flush)(const DNNModel *model); // Frees memory allocated for model. diff --git a/chromium/third_party/ffmpeg/libavfilter/f_bench.c b/chromium/third_party/ffmpeg/libavfilter/f_bench.c index e7d7c5e299b..f7098adaf49 100644 --- a/chromium/third_party/ffmpeg/libavfilter/f_bench.c +++ b/chromium/third_party/ffmpeg/libavfilter/f_bench.c @@ -96,7 +96,6 @@ static const AVFilterPad bench_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad bench_outputs[] = { @@ -104,7 +103,6 @@ static const AVFilterPad bench_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_bench = { @@ -112,8 +110,8 @@ const AVFilter ff_vf_bench = { .description = NULL_IF_CONFIG_SMALL("Benchmark part of a filtergraph."), .priv_size = sizeof(BenchContext), .init = init, - .inputs = bench_inputs, - .outputs = bench_outputs, + FILTER_INPUTS(bench_inputs), + FILTER_OUTPUTS(bench_outputs), .priv_class = &bench_class, }; #endif /* CONFIG_BENCH_FILTER */ @@ -128,7 +126,6 @@ static const AVFilterPad abench_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad abench_outputs[] = { @@ -136,7 +133,6 @@ static const AVFilterPad abench_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_abench = { @@ -144,8 +140,8 @@ const AVFilter ff_af_abench = { .description = NULL_IF_CONFIG_SMALL("Benchmark part of a filtergraph."), .priv_size = sizeof(BenchContext), .init = init, - .inputs = abench_inputs, - .outputs = abench_outputs, + FILTER_INPUTS(abench_inputs), + FILTER_OUTPUTS(abench_outputs), .priv_class = &abench_class, }; #endif /* CONFIG_ABENCH_FILTER */ diff --git a/chromium/third_party/ffmpeg/libavfilter/f_cue.c b/chromium/third_party/ffmpeg/libavfilter/f_cue.c index 03804f16674..e87b7a67c75 100644 --- a/chromium/third_party/ffmpeg/libavfilter/f_cue.c +++ b/chromium/third_party/ffmpeg/libavfilter/f_cue.c @@ -103,7 +103,6 @@ static const AVFilterPad cue_inputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; static const AVFilterPad cue_outputs[] = { @@ -111,7 +110,6 @@ static const AVFilterPad cue_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_cue = { @@ -119,8 +117,8 @@ const AVFilter ff_vf_cue = { .description = NULL_IF_CONFIG_SMALL("Delay filtering to match a cue."), .priv_size = sizeof(CueContext), .priv_class = &cue_class, - .inputs = cue_inputs, - .outputs = cue_outputs, + FILTER_INPUTS(cue_inputs), + FILTER_OUTPUTS(cue_outputs), .activate = activate, }; #endif /* CONFIG_CUE_FILTER */ @@ -134,7 +132,6 @@ static const AVFilterPad acue_inputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; static const AVFilterPad acue_outputs[] = { @@ -142,7 +139,6 @@ static const AVFilterPad acue_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_acue = { @@ -150,8 +146,8 @@ const AVFilter ff_af_acue = { .description = NULL_IF_CONFIG_SMALL("Delay filtering to match a cue."), .priv_size = sizeof(CueContext), .priv_class = &acue_class, - .inputs = acue_inputs, - .outputs = acue_outputs, + FILTER_INPUTS(acue_inputs), + FILTER_OUTPUTS(acue_outputs), .activate = activate, }; #endif /* CONFIG_ACUE_FILTER */ diff --git a/chromium/third_party/ffmpeg/libavfilter/f_drawgraph.c b/chromium/third_party/ffmpeg/libavfilter/f_drawgraph.c index 70701e330e5..a9b47483adf 100644 --- a/chromium/third_party/ffmpeg/libavfilter/f_drawgraph.c +++ b/chromium/third_party/ffmpeg/libavfilter/f_drawgraph.c @@ -458,7 +458,6 @@ static const AVFilterPad drawgraph_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad drawgraph_outputs[] = { @@ -468,7 +467,6 @@ static const AVFilterPad drawgraph_outputs[] = { .config_props = config_output, .request_frame = request_frame, }, - { NULL } }; const AVFilter ff_vf_drawgraph = { @@ -479,8 +477,8 @@ const AVFilter ff_vf_drawgraph = { .query_formats = query_formats, .init = init, .uninit = uninit, - .inputs = drawgraph_inputs, - .outputs = drawgraph_outputs, + FILTER_INPUTS(drawgraph_inputs), + FILTER_OUTPUTS(drawgraph_outputs), }; #endif // CONFIG_DRAWGRAPH_FILTER @@ -496,7 +494,6 @@ static const AVFilterPad adrawgraph_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad adrawgraph_outputs[] = { @@ -506,7 +503,6 @@ static const AVFilterPad adrawgraph_outputs[] = { .config_props = config_output, .request_frame = request_frame, }, - { NULL } }; const AVFilter ff_avf_adrawgraph = { @@ -517,7 +513,7 @@ const AVFilter ff_avf_adrawgraph = { .query_formats = query_formats, .init = init, .uninit = uninit, - .inputs = adrawgraph_inputs, - .outputs = adrawgraph_outputs, + FILTER_INPUTS(adrawgraph_inputs), + FILTER_OUTPUTS(adrawgraph_outputs), }; #endif // CONFIG_ADRAWGRAPH_FILTER diff --git a/chromium/third_party/ffmpeg/libavfilter/f_ebur128.c b/chromium/third_party/ffmpeg/libavfilter/f_ebur128.c index bf7bb3af682..2ce8a749cfc 100644 --- a/chromium/third_party/ffmpeg/libavfilter/f_ebur128.c +++ b/chromium/third_party/ffmpeg/libavfilter/f_ebur128.c @@ -413,8 +413,7 @@ static int config_audio_input(AVFilterLink *inlink) * filter_frame()). */ if (ebur128->metadata || (ebur128->peak_mode & PEAK_MODE_TRUE_PEAKS)) inlink->min_samples = - inlink->max_samples = - inlink->partial_buf_size = inlink->sample_rate / 10; + inlink->max_samples = inlink->sample_rate / 10; return 0; } @@ -553,7 +552,7 @@ static av_cold int init(AVFilterContext *ctx) .type = AVMEDIA_TYPE_VIDEO, .config_props = config_video_output, }; - ret = ff_insert_outpad(ctx, 0, &pad); + ret = ff_append_outpad(ctx, &pad); if (ret < 0) return ret; } @@ -562,7 +561,7 @@ static av_cold int init(AVFilterContext *ctx) .type = AVMEDIA_TYPE_AUDIO, .config_props = config_audio_output, }; - ret = ff_insert_outpad(ctx, ebur128->do_video, &pad); + ret = ff_append_outpad(ctx, &pad); if (ret < 0) return ret; @@ -1018,7 +1017,6 @@ static const AVFilterPad ebur128_inputs[] = { .filter_frame = filter_frame, .config_props = config_audio_input, }, - { NULL } }; const AVFilter ff_af_ebur128 = { @@ -1028,7 +1026,7 @@ const AVFilter ff_af_ebur128 = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = ebur128_inputs, + FILTER_INPUTS(ebur128_inputs), .outputs = NULL, .priv_class = &ebur128_class, .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS, diff --git a/chromium/third_party/ffmpeg/libavfilter/f_graphmonitor.c b/chromium/third_party/ffmpeg/libavfilter/f_graphmonitor.c index ba17f1f6386..b712c2fdd6b 100644 --- a/chromium/third_party/ffmpeg/libavfilter/f_graphmonitor.c +++ b/chromium/third_party/ffmpeg/libavfilter/f_graphmonitor.c @@ -62,6 +62,8 @@ enum { MODE_SIZE = 1 << 7, MODE_RATE = 1 << 8, MODE_EOF = 1 << 9, + MODE_SCIN = 1 << 10, + MODE_SCOUT = 1 << 11, }; #define OFFSET(x) offsetof(GraphMonitorContext, x) @@ -88,6 +90,8 @@ static const AVOption graphmonitor_options[] = { { "size", NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_SIZE}, 0, 0, VF, "flags" }, { "rate", NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_RATE}, 0, 0, VF, "flags" }, { "eof", NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_EOF}, 0, 0, VF, "flags" }, + { "sample_count_in", NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_SCOUT}, 0, 0, VF, "flags" }, + { "sample_count_out", NULL, 0, AV_OPT_TYPE_CONST, {.i64=MODE_SCIN}, 0, 0, VF, "flags" }, { "rate", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, VF }, { "r", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, VF }, { NULL } @@ -229,6 +233,16 @@ static void draw_items(AVFilterContext *ctx, AVFrame *out, drawtext(out, xpos, ypos, buffer, s->white); xpos += strlen(buffer) * 8; } + if (s->flags & MODE_SCIN) { + snprintf(buffer, sizeof(buffer)-1, " | sin: %"PRId64, l->sample_count_in); + drawtext(out, xpos, ypos, buffer, s->white); + xpos += strlen(buffer) * 8; + } + if (s->flags & MODE_SCOUT) { + snprintf(buffer, sizeof(buffer)-1, " | sout: %"PRId64, l->sample_count_out); + drawtext(out, xpos, ypos, buffer, s->white); + xpos += strlen(buffer) * 8; + } if (s->flags & MODE_PTS) { snprintf(buffer, sizeof(buffer)-1, " | pts: %s", av_ts2str(l->current_pts_us)); drawtext(out, xpos, ypos, buffer, s->white); @@ -381,7 +395,6 @@ static const AVFilterPad graphmonitor_inputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; static const AVFilterPad graphmonitor_outputs[] = { @@ -390,7 +403,6 @@ static const AVFilterPad graphmonitor_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_graphmonitor = { @@ -400,8 +412,8 @@ const AVFilter ff_vf_graphmonitor = { .priv_class = &graphmonitor_class, .query_formats = query_formats, .activate = activate, - .inputs = graphmonitor_inputs, - .outputs = graphmonitor_outputs, + FILTER_INPUTS(graphmonitor_inputs), + FILTER_OUTPUTS(graphmonitor_outputs), }; #endif // CONFIG_GRAPHMONITOR_FILTER @@ -416,7 +428,6 @@ static const AVFilterPad agraphmonitor_inputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; static const AVFilterPad agraphmonitor_outputs[] = { @@ -425,7 +436,6 @@ static const AVFilterPad agraphmonitor_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_avf_agraphmonitor = { @@ -435,7 +445,7 @@ const AVFilter ff_avf_agraphmonitor = { .priv_class = &agraphmonitor_class, .query_formats = query_formats, .activate = activate, - .inputs = agraphmonitor_inputs, - .outputs = agraphmonitor_outputs, + FILTER_INPUTS(agraphmonitor_inputs), + FILTER_OUTPUTS(agraphmonitor_outputs), }; #endif // CONFIG_AGRAPHMONITOR_FILTER diff --git a/chromium/third_party/ffmpeg/libavfilter/f_interleave.c b/chromium/third_party/ffmpeg/libavfilter/f_interleave.c index 259952b5912..b60e89762fc 100644 --- a/chromium/third_party/ffmpeg/libavfilter/f_interleave.c +++ b/chromium/third_party/ffmpeg/libavfilter/f_interleave.c @@ -167,27 +167,19 @@ static av_cold int init(AVFilterContext *ctx) switch (outpad->type) { case AVMEDIA_TYPE_VIDEO: - inpad.get_video_buffer = ff_null_get_video_buffer; break; + inpad.get_buffer.video = ff_null_get_video_buffer; break; case AVMEDIA_TYPE_AUDIO: - inpad.get_audio_buffer = ff_null_get_audio_buffer; break; + inpad.get_buffer.audio = ff_null_get_audio_buffer; break; default: av_assert0(0); } - if ((ret = ff_insert_inpad(ctx, i, &inpad)) < 0) { - av_freep(&inpad.name); + if ((ret = ff_append_inpad_free_name(ctx, &inpad)) < 0) return ret; - } } return 0; } -static av_cold void uninit(AVFilterContext *ctx) -{ - for (int i = 0; i < ctx->nb_inputs; i++) - av_freep(&ctx->input_pads[i].name); -} - static int config_output(AVFilterLink *outlink) { AVFilterContext *ctx = outlink->src; @@ -235,7 +227,6 @@ static const AVFilterPad interleave_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_interleave = { @@ -243,9 +234,8 @@ const AVFilter ff_vf_interleave = { .description = NULL_IF_CONFIG_SMALL("Temporally interleave video inputs."), .priv_size = sizeof(InterleaveContext), .init = init, - .uninit = uninit, .activate = activate, - .outputs = interleave_outputs, + FILTER_OUTPUTS(interleave_outputs), .priv_class = &interleave_class, .flags = AVFILTER_FLAG_DYNAMIC_INPUTS, }; @@ -263,7 +253,6 @@ static const AVFilterPad ainterleave_outputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_af_ainterleave = { @@ -271,9 +260,8 @@ const AVFilter ff_af_ainterleave = { .description = NULL_IF_CONFIG_SMALL("Temporally interleave audio inputs."), .priv_size = sizeof(InterleaveContext), .init = init, - .uninit = uninit, .activate = activate, - .outputs = ainterleave_outputs, + FILTER_OUTPUTS(ainterleave_outputs), .priv_class = &ainterleave_class, .flags = AVFILTER_FLAG_DYNAMIC_INPUTS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/f_loop.c b/chromium/third_party/ffmpeg/libavfilter/f_loop.c index a06e8172d38..f8ae4a6a3a1 100644 --- a/chromium/third_party/ffmpeg/libavfilter/f_loop.c +++ b/chromium/third_party/ffmpeg/libavfilter/f_loop.c @@ -93,7 +93,7 @@ static int push_samples(AVFilterContext *ctx, int nb_samples) AVFilterLink *outlink = ctx->outputs[0]; LoopContext *s = ctx->priv; AVFrame *out; - int ret, i = 0; + int ret = 0, i = 0; while (s->loop != 0 && i < nb_samples) { out = ff_get_audio_buffer(outlink, FFMIN(nb_samples, s->nb_samples - s->current_sample)); @@ -269,7 +269,6 @@ static const AVFilterPad ainputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = aconfig_input, }, - { NULL } }; static const AVFilterPad aoutputs[] = { @@ -277,7 +276,6 @@ static const AVFilterPad aoutputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_aloop = { @@ -287,8 +285,8 @@ const AVFilter ff_af_aloop = { .priv_class = &aloop_class, .activate = aactivate, .uninit = auninit, - .inputs = ainputs, - .outputs = aoutputs, + FILTER_INPUTS(ainputs), + FILTER_OUTPUTS(aoutputs), }; #endif /* CONFIG_ALOOP_FILTER */ @@ -442,7 +440,6 @@ static const AVFilterPad inputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -450,7 +447,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_loop = { @@ -461,7 +457,7 @@ const AVFilter ff_vf_loop = { .init = init, .uninit = uninit, .activate = activate, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), }; #endif /* CONFIG_LOOP_FILTER */ diff --git a/chromium/third_party/ffmpeg/libavfilter/f_metadata.c b/chromium/third_party/ffmpeg/libavfilter/f_metadata.c index d0a78b00d0f..cecfe62a9c0 100644 --- a/chromium/third_party/ffmpeg/libavfilter/f_metadata.c +++ b/chromium/third_party/ffmpeg/libavfilter/f_metadata.c @@ -373,7 +373,6 @@ static const AVFilterPad ainputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad aoutputs[] = { @@ -381,7 +380,6 @@ static const AVFilterPad aoutputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_ametadata = { @@ -391,8 +389,8 @@ const AVFilter ff_af_ametadata = { .priv_class = &ametadata_class, .init = init, .uninit = uninit, - .inputs = ainputs, - .outputs = aoutputs, + FILTER_INPUTS(ainputs), + FILTER_OUTPUTS(aoutputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; #endif /* CONFIG_AMETADATA_FILTER */ @@ -408,7 +406,6 @@ static const AVFilterPad inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -416,7 +413,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_metadata = { @@ -426,8 +422,8 @@ const AVFilter ff_vf_metadata = { .priv_class = &metadata_class, .init = init, .uninit = uninit, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; #endif /* CONFIG_METADATA_FILTER */ diff --git a/chromium/third_party/ffmpeg/libavfilter/f_perms.c b/chromium/third_party/ffmpeg/libavfilter/f_perms.c index 0302ed765be..8c449fbdfc2 100644 --- a/chromium/third_party/ffmpeg/libavfilter/f_perms.c +++ b/chromium/third_party/ffmpeg/libavfilter/f_perms.c @@ -122,7 +122,6 @@ static const AVFilterPad aperms_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad aperms_outputs[] = { @@ -130,7 +129,6 @@ static const AVFilterPad aperms_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_aperms = { @@ -138,8 +136,8 @@ const AVFilter ff_af_aperms = { .description = NULL_IF_CONFIG_SMALL("Set permissions for the output audio frame."), .init = init, .priv_size = sizeof(PermsContext), - .inputs = aperms_inputs, - .outputs = aperms_outputs, + FILTER_INPUTS(aperms_inputs), + FILTER_OUTPUTS(aperms_outputs), .priv_class = &aperms_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; @@ -156,7 +154,6 @@ static const AVFilterPad perms_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad perms_outputs[] = { @@ -164,7 +161,6 @@ static const AVFilterPad perms_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_perms = { @@ -172,8 +168,8 @@ const AVFilter ff_vf_perms = { .description = NULL_IF_CONFIG_SMALL("Set permissions for the output video frame."), .init = init, .priv_size = sizeof(PermsContext), - .inputs = perms_inputs, - .outputs = perms_outputs, + FILTER_INPUTS(perms_inputs), + FILTER_OUTPUTS(perms_outputs), .priv_class = &perms_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/f_realtime.c b/chromium/third_party/ffmpeg/libavfilter/f_realtime.c index 332ef21ac58..125bd6131c3 100644 --- a/chromium/third_party/ffmpeg/libavfilter/f_realtime.c +++ b/chromium/third_party/ffmpeg/libavfilter/f_realtime.c @@ -81,7 +81,6 @@ static const AVFilterPad avfilter_vf_realtime_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad avfilter_vf_realtime_outputs[] = { @@ -89,7 +88,6 @@ static const AVFilterPad avfilter_vf_realtime_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_realtime = { @@ -97,8 +95,8 @@ const AVFilter ff_vf_realtime = { .description = NULL_IF_CONFIG_SMALL("Slow down filtering to match realtime."), .priv_size = sizeof(RealtimeContext), .priv_class = &realtime_class, - .inputs = avfilter_vf_realtime_inputs, - .outputs = avfilter_vf_realtime_outputs, + FILTER_INPUTS(avfilter_vf_realtime_inputs), + FILTER_OUTPUTS(avfilter_vf_realtime_outputs), }; #endif /* CONFIG_REALTIME_FILTER */ @@ -113,7 +111,6 @@ static const AVFilterPad arealtime_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad arealtime_outputs[] = { @@ -121,7 +118,6 @@ static const AVFilterPad arealtime_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_arealtime = { @@ -129,7 +125,7 @@ const AVFilter ff_af_arealtime = { .description = NULL_IF_CONFIG_SMALL("Slow down filtering to match realtime."), .priv_size = sizeof(RealtimeContext), .priv_class = &arealtime_class, - .inputs = arealtime_inputs, - .outputs = arealtime_outputs, + FILTER_INPUTS(arealtime_inputs), + FILTER_OUTPUTS(arealtime_outputs), }; #endif /* CONFIG_AREALTIME_FILTER */ diff --git a/chromium/third_party/ffmpeg/libavfilter/f_reverse.c b/chromium/third_party/ffmpeg/libavfilter/f_reverse.c index 2a85e6966e3..82f0c705a20 100644 --- a/chromium/third_party/ffmpeg/libavfilter/f_reverse.c +++ b/chromium/third_party/ffmpeg/libavfilter/f_reverse.c @@ -121,7 +121,6 @@ static const AVFilterPad reverse_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad reverse_outputs[] = { @@ -130,7 +129,6 @@ static const AVFilterPad reverse_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .request_frame = request_frame, }, - { NULL } }; const AVFilter ff_vf_reverse = { @@ -139,8 +137,8 @@ const AVFilter ff_vf_reverse = { .priv_size = sizeof(ReverseContext), .init = init, .uninit = uninit, - .inputs = reverse_inputs, - .outputs = reverse_outputs, + FILTER_INPUTS(reverse_inputs), + FILTER_OUTPUTS(reverse_outputs), }; #endif /* CONFIG_REVERSE_FILTER */ @@ -149,14 +147,7 @@ const AVFilter ff_vf_reverse = { static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; - AVFilterChannelLayouts *layouts; - int ret; - - layouts = ff_all_channel_counts(); - if (!layouts) - return AVERROR(ENOMEM); - ret = ff_set_common_channel_layouts(ctx, layouts); + int ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; @@ -164,10 +155,7 @@ static int query_formats(AVFilterContext *ctx) if (ret < 0) return ret; - formats = ff_all_samplerates(); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_samplerates(ctx, formats); + return ff_set_common_all_samplerates(ctx); } static void reverse_samples_planar(AVFrame *out) @@ -279,10 +267,9 @@ static const AVFilterPad areverse_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_AUDIO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = filter_frame, - .needs_writable = 1, }, - { NULL } }; static const AVFilterPad areverse_outputs[] = { @@ -291,7 +278,6 @@ static const AVFilterPad areverse_outputs[] = { .type = AVMEDIA_TYPE_AUDIO, .request_frame = areverse_request_frame, }, - { NULL } }; const AVFilter ff_af_areverse = { @@ -301,8 +287,8 @@ const AVFilter ff_af_areverse = { .priv_size = sizeof(ReverseContext), .init = init, .uninit = uninit, - .inputs = areverse_inputs, - .outputs = areverse_outputs, + FILTER_INPUTS(areverse_inputs), + FILTER_OUTPUTS(areverse_outputs), }; #endif /* CONFIG_AREVERSE_FILTER */ diff --git a/chromium/third_party/ffmpeg/libavfilter/f_segment.c b/chromium/third_party/ffmpeg/libavfilter/f_segment.c new file mode 100644 index 00000000000..70c8393972a --- /dev/null +++ b/chromium/third_party/ffmpeg/libavfilter/f_segment.c @@ -0,0 +1,330 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include <stdint.h> + +#include "libavutil/avstring.h" +#include "libavutil/channel_layout.h" +#include "libavutil/common.h" +#include "libavutil/log.h" +#include "libavutil/mathematics.h" +#include "libavutil/opt.h" +#include "libavutil/parseutils.h" +#include "libavutil/samplefmt.h" + +#include "audio.h" +#include "avfilter.h" +#include "filters.h" +#include "internal.h" + +typedef struct SegmentContext { + const AVClass *class; + + char *timestamps_str; + char *points_str; + int use_timestamps; + + int current_point; + int nb_points; + + int64_t *points; +} SegmentContext; + +static void count_points(char *item_str, int *nb_items) +{ + char *p; + + if (!item_str) + return; + + *nb_items = 1; + for (p = item_str; *p; p++) { + if (*p == '|') + (*nb_items)++; + } +} + +static int parse_points(AVFilterContext *ctx, char *item_str, int nb_points, int64_t *points) +{ + SegmentContext *s = ctx->priv; + char *arg, *p = item_str; + char *saveptr = NULL; + int64_t ref, cur = 0; + int ret = 0; + + for (int i = 0; i < nb_points; i++) { + if (!(arg = av_strtok(p, "|", &saveptr))) + return AVERROR(EINVAL); + + p = NULL; + ref = 0; + if (*arg == '+') { + ref = cur; + arg++; + } + + if (s->use_timestamps) { + ret = av_parse_time(&points[i], arg, s->use_timestamps); + } else { + if (sscanf(arg, "%"SCNd64, &points[i]) != 1) + ret = AVERROR(EINVAL); + } + + if (ret < 0) { + av_log(ctx, AV_LOG_ERROR, "Invalid splits supplied: %s\n", arg); + return ret; + } + + cur = points[i]; + points[i] += ref; + } + + return 0; +} + +static av_cold int init(AVFilterContext *ctx, enum AVMediaType type) +{ + SegmentContext *s = ctx->priv; + char *split_str; + int ret; + + if (s->timestamps_str && s->points_str) { + av_log(ctx, AV_LOG_ERROR, "Both timestamps and counts supplied.\n"); + return AVERROR(EINVAL); + } else if (s->timestamps_str) { + s->use_timestamps = 1; + split_str = s->timestamps_str; + } else if (s->points_str) { + split_str = s->points_str; + } else { + av_log(ctx, AV_LOG_ERROR, "Neither timestamps nor durations nor counts supplied.\n"); + return AVERROR(EINVAL); + } + + count_points(split_str, &s->nb_points); + s->nb_points++; + + s->points = av_calloc(s->nb_points, sizeof(*s->points)); + if (!s->points) + return AVERROR(ENOMEM); + + ret = parse_points(ctx, split_str, s->nb_points - 1, s->points); + if (ret < 0) + return ret; + + s->points[s->nb_points - 1] = INT64_MAX; + + for (int i = 0; i < s->nb_points; i++) { + AVFilterPad pad = { 0 }; + + pad.type = type; + pad.name = av_asprintf("output%d", i); + if (!pad.name) + return AVERROR(ENOMEM); + + if ((ret = ff_append_outpad_free_name(ctx, &pad)) < 0) + return ret; + } + + return 0; +} + +static int config_input(AVFilterLink *inlink) +{ + AVFilterContext *ctx = inlink->dst; + SegmentContext *s = ctx->priv; + AVRational tb = inlink->time_base; + + if (s->use_timestamps) { + for (int i = 0; i < s->nb_points - 1; i++) + s->points[i] = av_rescale_q(s->points[i], AV_TIME_BASE_Q, tb); + } + + return 0; +} + +static int current_segment_finished(AVFilterContext *ctx, AVFrame *frame) +{ + SegmentContext *s = ctx->priv; + AVFilterLink *inlink = ctx->inputs[0]; + int ret = 0; + + if (s->use_timestamps) { + ret = frame->pts >= s->points[s->current_point]; + } else { + switch (inlink->type) { + case AVMEDIA_TYPE_VIDEO: + ret = inlink->frame_count_out - 1 >= s->points[s->current_point]; + break; + case AVMEDIA_TYPE_AUDIO: + ret = inlink->sample_count_out - frame->nb_samples >= s->points[s->current_point]; + break; + } + } + + return ret; +} + +static int activate(AVFilterContext *ctx) +{ + AVFilterLink *inlink = ctx->inputs[0]; + SegmentContext *s = ctx->priv; + AVFrame *frame = NULL; + int ret, status; + int max_samples; + int64_t diff; + int64_t pts; + + for (int i = s->current_point; i < s->nb_points; i++) { + FF_FILTER_FORWARD_STATUS_BACK_ALL(ctx->outputs[i], ctx); + } + + switch (inlink->type) { + case AVMEDIA_TYPE_VIDEO: + ret = ff_inlink_consume_frame(inlink, &frame); + break; + case AVMEDIA_TYPE_AUDIO: + diff = s->points[s->current_point] - inlink->sample_count_out; + if (s->use_timestamps) { + max_samples = av_rescale_q(diff, av_make_q(1, inlink->sample_rate), inlink->time_base); + } else { + max_samples = FFMAX(1, FFMIN(diff, INT_MAX)); + } + ret = ff_inlink_consume_samples(inlink, 1, max_samples, &frame); + break; + default: + return AVERROR_BUG; + } + + if (ret > 0) { + while (current_segment_finished(ctx, frame)) { + ff_outlink_set_status(ctx->outputs[s->current_point], AVERROR_EOF, frame->pts); + s->current_point++; + } + + if (s->current_point >= s->nb_points) { + av_frame_free(&frame); + return AVERROR(EINVAL); + } + + ret = ff_filter_frame(ctx->outputs[s->current_point], frame); + } + + if (ret < 0) { + return ret; + } else if (ff_inlink_acknowledge_status(inlink, &status, &pts)) { + for (int i = s->current_point; i < s->nb_points; i++) + ff_outlink_set_status(ctx->outputs[i], status, pts); + return 0; + } else { + for (int i = s->current_point; i < s->nb_points; i++) { + if (ff_outlink_frame_wanted(ctx->outputs[i])) + ff_inlink_request_frame(inlink); + } + return 0; + } +} + +static av_cold void uninit(AVFilterContext *ctx) +{ + SegmentContext *s = ctx->priv; + + av_freep(&s->points); +} + +#define OFFSET(x) offsetof(SegmentContext, x) +#define COMMON_OPTS \ + { "timestamps", "timestamps of input at which to split input", OFFSET(timestamps_str), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, FLAGS }, \ + +#if CONFIG_SEGMENT_FILTER + +static av_cold int video_init(AVFilterContext *ctx) +{ + return init(ctx, AVMEDIA_TYPE_VIDEO); +} + +#define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM +static const AVOption segment_options[] = { + COMMON_OPTS + { "frames", "frames at which to split input", OFFSET(points_str), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, FLAGS }, + { NULL } +}; +#undef FLAGS + +AVFILTER_DEFINE_CLASS(segment); + +static const AVFilterPad segment_inputs[] = { + { + .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .config_props = config_input, + }, +}; + +const AVFilter ff_vf_segment = { + .name = "segment", + .description = NULL_IF_CONFIG_SMALL("Segment video stream."), + .init = video_init, + .uninit = uninit, + .priv_size = sizeof(SegmentContext), + .priv_class = &segment_class, + .activate = activate, + FILTER_INPUTS(segment_inputs), + .outputs = NULL, + .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS, +}; +#endif // CONFIG_SEGMENT_FILTER + +#if CONFIG_ASEGMENT_FILTER + +static av_cold int audio_init(AVFilterContext *ctx) +{ + return init(ctx, AVMEDIA_TYPE_AUDIO); +} + +#define FLAGS AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_FILTERING_PARAM +static const AVOption asegment_options[] = { + COMMON_OPTS + { "samples", "samples at which to split input", OFFSET(points_str), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, FLAGS }, + { NULL } +}; +#undef FLAGS + +AVFILTER_DEFINE_CLASS(asegment); + +static const AVFilterPad asegment_inputs[] = { + { + .name = "default", + .type = AVMEDIA_TYPE_AUDIO, + .config_props = config_input, + }, +}; + +const AVFilter ff_af_asegment = { + .name = "asegment", + .description = NULL_IF_CONFIG_SMALL("Segment audio stream."), + .init = audio_init, + .uninit = uninit, + .priv_size = sizeof(SegmentContext), + .priv_class = &asegment_class, + .activate = activate, + FILTER_INPUTS(asegment_inputs), + .outputs = NULL, + .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS, +}; +#endif // CONFIG_ASEGMENT_FILTER diff --git a/chromium/third_party/ffmpeg/libavfilter/f_select.c b/chromium/third_party/ffmpeg/libavfilter/f_select.c index f0468078e8f..187e98a1a76 100644 --- a/chromium/third_party/ffmpeg/libavfilter/f_select.c +++ b/chromium/third_party/ffmpeg/libavfilter/f_select.c @@ -192,10 +192,8 @@ static av_cold int init(AVFilterContext *ctx) return AVERROR(ENOMEM); pad.type = ctx->filter->inputs[0].type; pad.request_frame = request_frame; - if ((ret = ff_insert_outpad(ctx, i, &pad)) < 0) { - av_freep(&pad.name); + if ((ret = ff_append_outpad_free_name(ctx, &pad)) < 0) return ret; - } } return 0; @@ -432,14 +430,10 @@ static int request_frame(AVFilterLink *outlink) static av_cold void uninit(AVFilterContext *ctx) { SelectContext *select = ctx->priv; - int i; av_expr_free(select->expr); select->expr = NULL; - for (i = 0; i < ctx->nb_outputs; i++) - av_freep(&ctx->output_pads[i].name); - if (select->do_scene_detect) { av_frame_free(&select->prev_picref); } @@ -473,7 +467,6 @@ static const AVFilterPad avfilter_af_aselect_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; const AVFilter ff_af_aselect = { @@ -482,7 +475,7 @@ const AVFilter ff_af_aselect = { .init = aselect_init, .uninit = uninit, .priv_size = sizeof(SelectContext), - .inputs = avfilter_af_aselect_inputs, + FILTER_INPUTS(avfilter_af_aselect_inputs), .priv_class = &aselect_class, .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS, }; @@ -497,7 +490,6 @@ static int query_formats(AVFilterContext *ctx) if (!select->do_scene_detect) { return ff_default_query_formats(ctx); } else { - int ret; static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24, AV_PIX_FMT_RGBA, AV_PIX_FMT_ABGR, AV_PIX_FMT_BGRA, AV_PIX_FMT_GRAY8, @@ -506,15 +498,8 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUV420P10, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - - if (!fmts_list) - return AVERROR(ENOMEM); - ret = ff_set_common_formats(ctx, fmts_list); - if (ret < 0) - return ret; + return ff_set_common_formats_from_list(ctx, pix_fmts); } - return 0; } DEFINE_OPTIONS(select, AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM); @@ -537,7 +522,6 @@ static const AVFilterPad avfilter_vf_select_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; const AVFilter ff_vf_select = { @@ -548,7 +532,7 @@ const AVFilter ff_vf_select = { .query_formats = query_formats, .priv_size = sizeof(SelectContext), .priv_class = &select_class, - .inputs = avfilter_vf_select_inputs, + FILTER_INPUTS(avfilter_vf_select_inputs), .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS, }; #endif /* CONFIG_SELECT_FILTER */ diff --git a/chromium/third_party/ffmpeg/libavfilter/f_sendcmd.c b/chromium/third_party/ffmpeg/libavfilter/f_sendcmd.c index 71b0a5c4110..99d8ca939c4 100644 --- a/chromium/third_party/ffmpeg/libavfilter/f_sendcmd.c +++ b/chromium/third_party/ffmpeg/libavfilter/f_sendcmd.c @@ -583,7 +583,6 @@ static const AVFilterPad sendcmd_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad sendcmd_outputs[] = { @@ -591,7 +590,6 @@ static const AVFilterPad sendcmd_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_sendcmd = { @@ -600,8 +598,8 @@ const AVFilter ff_vf_sendcmd = { .init = init, .uninit = uninit, .priv_size = sizeof(SendCmdContext), - .inputs = sendcmd_inputs, - .outputs = sendcmd_outputs, + FILTER_INPUTS(sendcmd_inputs), + FILTER_OUTPUTS(sendcmd_outputs), .priv_class = &sendcmd_class, }; @@ -618,7 +616,6 @@ static const AVFilterPad asendcmd_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad asendcmd_outputs[] = { @@ -626,7 +623,6 @@ static const AVFilterPad asendcmd_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_asendcmd = { @@ -635,8 +631,8 @@ const AVFilter ff_af_asendcmd = { .init = init, .uninit = uninit, .priv_size = sizeof(SendCmdContext), - .inputs = asendcmd_inputs, - .outputs = asendcmd_outputs, + FILTER_INPUTS(asendcmd_inputs), + FILTER_OUTPUTS(asendcmd_outputs), .priv_class = &asendcmd_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/f_sidedata.c b/chromium/third_party/ffmpeg/libavfilter/f_sidedata.c index 9133fcb1e3b..5c9f905cc22 100644 --- a/chromium/third_party/ffmpeg/libavfilter/f_sidedata.c +++ b/chromium/third_party/ffmpeg/libavfilter/f_sidedata.c @@ -130,7 +130,6 @@ static const AVFilterPad ainputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad aoutputs[] = { @@ -138,7 +137,6 @@ static const AVFilterPad aoutputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_asidedata = { @@ -147,8 +145,8 @@ const AVFilter ff_af_asidedata = { .priv_size = sizeof(SideDataContext), .priv_class = &asidedata_class, .init = init, - .inputs = ainputs, - .outputs = aoutputs, + FILTER_INPUTS(ainputs), + FILTER_OUTPUTS(aoutputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; #endif /* CONFIG_ASIDEDATA_FILTER */ @@ -164,7 +162,6 @@ static const AVFilterPad inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -172,7 +169,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_sidedata = { @@ -181,8 +177,8 @@ const AVFilter ff_vf_sidedata = { .priv_size = sizeof(SideDataContext), .priv_class = &sidedata_class, .init = init, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; #endif /* CONFIG_SIDEDATA_FILTER */ diff --git a/chromium/third_party/ffmpeg/libavfilter/f_streamselect.c b/chromium/third_party/ffmpeg/libavfilter/f_streamselect.c index 22eb76d4d75..c5427672e2f 100644 --- a/chromium/third_party/ffmpeg/libavfilter/f_streamselect.c +++ b/chromium/third_party/ffmpeg/libavfilter/f_streamselect.c @@ -167,16 +167,13 @@ static int parse_definition(AVFilterContext *ctx, int nb_pads, int is_input, int av_log(ctx, AV_LOG_DEBUG, "Add %s pad %s\n", padtype, pad.name); if (is_input) { - ret = ff_insert_inpad(ctx, i, &pad); + ret = ff_append_inpad_free_name(ctx, &pad); } else { pad.config_props = config_output; - ret = ff_insert_outpad(ctx, i, &pad); + ret = ff_append_outpad_free_name(ctx, &pad); } - - if (ret < 0) { - av_freep(&pad.name); + if (ret < 0) return ret; - } } return 0; @@ -295,18 +292,11 @@ static av_cold void uninit(AVFilterContext *ctx) av_freep(&s->map); av_freep(&s->frames); ff_framesync_uninit(&s->fs); - - for (int i = 0; i < ctx->nb_inputs; i++) - av_freep(&ctx->input_pads[i].name); - - for (int i = 0; i < ctx->nb_outputs; i++) - av_freep(&ctx->output_pads[i].name); } static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats, *rates = NULL; - AVFilterChannelLayouts *layouts = NULL; + AVFilterFormats *formats; int ret, i; for (i = 0; i < ctx->nb_inputs; i++) { @@ -315,11 +305,8 @@ static int query_formats(AVFilterContext *ctx) return ret; if (ctx->inputs[i]->type == AVMEDIA_TYPE_AUDIO) { - rates = ff_all_samplerates(); - if ((ret = ff_set_common_samplerates(ctx, rates)) < 0) - return ret; - layouts = ff_all_channel_counts(); - if ((ret = ff_set_common_channel_layouts(ctx, layouts)) < 0) + if ((ret = ff_set_common_all_samplerates (ctx)) < 0 || + (ret = ff_set_common_all_channel_counts(ctx)) < 0) return ret; } } diff --git a/chromium/third_party/ffmpeg/libavfilter/f_zmq.c b/chromium/third_party/ffmpeg/libavfilter/f_zmq.c index 774a8908718..5de22e2fbee 100644 --- a/chromium/third_party/ffmpeg/libavfilter/f_zmq.c +++ b/chromium/third_party/ffmpeg/libavfilter/f_zmq.c @@ -214,7 +214,6 @@ static const AVFilterPad zmq_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad zmq_outputs[] = { @@ -222,7 +221,6 @@ static const AVFilterPad zmq_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_zmq = { @@ -231,8 +229,8 @@ const AVFilter ff_vf_zmq = { .init = init, .uninit = uninit, .priv_size = sizeof(ZMQContext), - .inputs = zmq_inputs, - .outputs = zmq_outputs, + FILTER_INPUTS(zmq_inputs), + FILTER_OUTPUTS(zmq_outputs), .priv_class = &zmq_class, }; @@ -249,7 +247,6 @@ static const AVFilterPad azmq_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad azmq_outputs[] = { @@ -257,7 +254,6 @@ static const AVFilterPad azmq_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_azmq = { @@ -266,8 +262,8 @@ const AVFilter ff_af_azmq = { .init = init, .uninit = uninit, .priv_size = sizeof(ZMQContext), - .inputs = azmq_inputs, - .outputs = azmq_outputs, + FILTER_INPUTS(azmq_inputs), + FILTER_OUTPUTS(azmq_outputs), .priv_class = &azmq_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/fifo.c b/chromium/third_party/ffmpeg/libavfilter/fifo.c index e0996ba5014..bb7d78f09c3 100644 --- a/chromium/third_party/ffmpeg/libavfilter/fifo.c +++ b/chromium/third_party/ffmpeg/libavfilter/fifo.c @@ -116,7 +116,6 @@ static const AVFilterPad avfilter_vf_fifo_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = add_to_queue, }, - { NULL } }; static const AVFilterPad avfilter_vf_fifo_outputs[] = { @@ -125,7 +124,6 @@ static const AVFilterPad avfilter_vf_fifo_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .request_frame = request_frame, }, - { NULL } }; const AVFilter ff_vf_fifo = { @@ -134,8 +132,8 @@ const AVFilter ff_vf_fifo = { .init = init, .uninit = uninit, .priv_size = sizeof(FifoContext), - .inputs = avfilter_vf_fifo_inputs, - .outputs = avfilter_vf_fifo_outputs, + FILTER_INPUTS(avfilter_vf_fifo_inputs), + FILTER_OUTPUTS(avfilter_vf_fifo_outputs), }; static const AVFilterPad avfilter_af_afifo_inputs[] = { @@ -144,7 +142,6 @@ static const AVFilterPad avfilter_af_afifo_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = add_to_queue, }, - { NULL } }; static const AVFilterPad avfilter_af_afifo_outputs[] = { @@ -153,7 +150,6 @@ static const AVFilterPad avfilter_af_afifo_outputs[] = { .type = AVMEDIA_TYPE_AUDIO, .request_frame = request_frame, }, - { NULL } }; const AVFilter ff_af_afifo = { @@ -162,6 +158,6 @@ const AVFilter ff_af_afifo = { .init = init, .uninit = uninit, .priv_size = sizeof(FifoContext), - .inputs = avfilter_af_afifo_inputs, - .outputs = avfilter_af_afifo_outputs, + FILTER_INPUTS(avfilter_af_afifo_inputs), + FILTER_OUTPUTS(avfilter_af_afifo_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/formats.c b/chromium/third_party/ffmpeg/libavfilter/formats.c index 6c05b118c9c..1bf7d361955 100644 --- a/chromium/third_party/ffmpeg/libavfilter/formats.c +++ b/chromium/third_party/ffmpeg/libavfilter/formats.c @@ -100,6 +100,8 @@ static int merge_formats_internal(AVFilterFormats *a, AVFilterFormats *b, int alpha1=0, alpha2=0; int chroma1=0, chroma2=0; + av_assert2(check || (a->refcount && b->refcount)); + if (a == b) return 1; @@ -132,43 +134,86 @@ static int merge_formats_internal(AVFilterFormats *a, AVFilterFormats *b, return 1; } -int ff_can_merge_formats(const AVFilterFormats *a, const AVFilterFormats *b, - enum AVMediaType type) + +/** + * Check the formats lists for compatibility for merging without actually + * merging. + * + * @return 1 if they are compatible, 0 if not. + */ +static int can_merge_pix_fmts(const void *a, const void *b) { return merge_formats_internal((AVFilterFormats *)a, - (AVFilterFormats *)b, type, 1); + (AVFilterFormats *)b, AVMEDIA_TYPE_VIDEO, 1); } -int ff_merge_formats(AVFilterFormats *a, AVFilterFormats *b, - enum AVMediaType type) +/** + * Merge the formats lists if they are compatible and update all the + * references of a and b to point to the combined list and free the old + * lists as needed. The combined list usually contains the intersection of + * the lists of a and b. + * + * Both a and b must have owners (i.e. refcount > 0) for these functions. + * + * @return 1 if merging succeeded, 0 if a and b are incompatible + * and negative AVERROR code on failure. + * a and b are unmodified if 0 is returned. + */ +static int merge_pix_fmts(void *a, void *b) { - av_assert2(a->refcount && b->refcount); - return merge_formats_internal(a, b, type, 0); + return merge_formats_internal(a, b, AVMEDIA_TYPE_VIDEO, 0); +} + +/** + * See can_merge_pix_fmts(). + */ +static int can_merge_sample_fmts(const void *a, const void *b) +{ + return merge_formats_internal((AVFilterFormats *)a, + (AVFilterFormats *)b, AVMEDIA_TYPE_AUDIO, 1); +} + +/** + * See merge_pix_fmts(). + */ +static int merge_sample_fmts(void *a, void *b) +{ + return merge_formats_internal(a, b, AVMEDIA_TYPE_AUDIO, 0); } static int merge_samplerates_internal(AVFilterFormats *a, AVFilterFormats *b, int check) { + av_assert2(check || (a->refcount && b->refcount)); if (a == b) return 1; MERGE_FORMATS(a, b, formats, nb_formats, AVFilterFormats, check, 1); return 1; } -int ff_can_merge_samplerates(const AVFilterFormats *a, const AVFilterFormats *b) +/** + * See can_merge_pix_fmts(). + */ +static int can_merge_samplerates(const void *a, const void *b) { return merge_samplerates_internal((AVFilterFormats *)a, (AVFilterFormats *)b, 1); } -int ff_merge_samplerates(AVFilterFormats *a, AVFilterFormats *b) +/** + * See merge_pix_fmts(). + */ +static int merge_samplerates(void *a, void *b) { - av_assert2(a->refcount && b->refcount); return merge_samplerates_internal(a, b, 0); } -int ff_merge_channel_layouts(AVFilterChannelLayouts *a, - AVFilterChannelLayouts *b) +/** + * See merge_pix_fmts(). + */ +static int merge_channel_layouts(void *va, void *vb) { + AVFilterChannelLayouts *a = va; + AVFilterChannelLayouts *b = vb; uint64_t *channel_layouts; unsigned a_all = a->all_layouts + a->all_counts; unsigned b_all = b->all_layouts + b->all_counts; @@ -255,6 +300,55 @@ int ff_merge_channel_layouts(AVFilterChannelLayouts *a, return 1; } +static const AVFilterFormatsMerger mergers_video[] = { + { + .offset = offsetof(AVFilterFormatsConfig, formats), + .merge = merge_pix_fmts, + .can_merge = can_merge_pix_fmts, + }, +}; + +static const AVFilterFormatsMerger mergers_audio[] = { + { + .offset = offsetof(AVFilterFormatsConfig, channel_layouts), + .merge = merge_channel_layouts, + .can_merge = NULL, + }, + { + .offset = offsetof(AVFilterFormatsConfig, samplerates), + .merge = merge_samplerates, + .can_merge = can_merge_samplerates, + }, + { + .offset = offsetof(AVFilterFormatsConfig, formats), + .merge = merge_sample_fmts, + .can_merge = can_merge_sample_fmts, + }, +}; + +static const AVFilterNegotiation negotiate_video = { + .nb_mergers = FF_ARRAY_ELEMS(mergers_video), + .mergers = mergers_video, + .conversion_filter = "scale", + .conversion_opts_offset = offsetof(AVFilterGraph, scale_sws_opts), +}; + +static const AVFilterNegotiation negotiate_audio = { + .nb_mergers = FF_ARRAY_ELEMS(mergers_audio), + .mergers = mergers_audio, + .conversion_filter = "aresample", + .conversion_opts_offset = offsetof(AVFilterGraph, aresample_swr_opts), +}; + +const AVFilterNegotiation *ff_filter_get_negotiation(AVFilterLink *link) +{ + switch (link->type) { + case AVMEDIA_TYPE_VIDEO: return &negotiate_video; + case AVMEDIA_TYPE_AUDIO: return &negotiate_audio; + default: return NULL; + } +} + int ff_fmt_is_in(int fmt, const int *fmts) { const int *p; @@ -528,51 +622,74 @@ void ff_formats_changeref(AVFilterFormats **oldref, AVFilterFormats **newref) FORMATS_CHANGEREF(oldref, newref); } -#define SET_COMMON_FORMATS(ctx, fmts, ref_fn, unref_fn) \ - int count = 0, i; \ +#define SET_COMMON_FORMATS(ctx, fmts, media_type, ref_fn, unref_fn) \ + int i; \ \ if (!fmts) \ return AVERROR(ENOMEM); \ \ for (i = 0; i < ctx->nb_inputs; i++) { \ - if (ctx->inputs[i] && !ctx->inputs[i]->outcfg.fmts) { \ + AVFilterLink *const link = ctx->inputs[i]; \ + if (link && !link->outcfg.fmts && \ + (media_type == AVMEDIA_TYPE_UNKNOWN || link->type == media_type)) { \ int ret = ref_fn(fmts, &ctx->inputs[i]->outcfg.fmts); \ if (ret < 0) { \ return ret; \ } \ - count++; \ } \ } \ for (i = 0; i < ctx->nb_outputs; i++) { \ - if (ctx->outputs[i] && !ctx->outputs[i]->incfg.fmts) { \ + AVFilterLink *const link = ctx->outputs[i]; \ + if (link && !link->incfg.fmts && \ + (media_type == AVMEDIA_TYPE_UNKNOWN || link->type == media_type)) { \ int ret = ref_fn(fmts, &ctx->outputs[i]->incfg.fmts); \ if (ret < 0) { \ return ret; \ } \ - count++; \ } \ } \ \ - if (!count) { \ + if (!fmts->refcount) \ unref_fn(&fmts); \ - } \ \ return 0; int ff_set_common_channel_layouts(AVFilterContext *ctx, AVFilterChannelLayouts *channel_layouts) { - SET_COMMON_FORMATS(ctx, channel_layouts, + SET_COMMON_FORMATS(ctx, channel_layouts, AVMEDIA_TYPE_AUDIO, ff_channel_layouts_ref, ff_channel_layouts_unref); } +int ff_set_common_channel_layouts_from_list(AVFilterContext *ctx, + const int64_t *fmts) +{ + return ff_set_common_channel_layouts(ctx, ff_make_format64_list(fmts)); +} + +int ff_set_common_all_channel_counts(AVFilterContext *ctx) +{ + return ff_set_common_channel_layouts(ctx, ff_all_channel_counts()); +} + int ff_set_common_samplerates(AVFilterContext *ctx, AVFilterFormats *samplerates) { - SET_COMMON_FORMATS(ctx, samplerates, + SET_COMMON_FORMATS(ctx, samplerates, AVMEDIA_TYPE_AUDIO, ff_formats_ref, ff_formats_unref); } +int ff_set_common_samplerates_from_list(AVFilterContext *ctx, + const int *samplerates) +{ + return ff_set_common_samplerates(ctx, ff_make_format_list(samplerates)); +} + +int ff_set_common_all_samplerates(AVFilterContext *ctx) +{ + return ff_set_common_samplerates(ctx, ff_all_samplerates()); +} + /** * A helper for query_formats() which sets all links to the same list of * formats. If there are no links hooked to this filter, the list of formats is @@ -580,10 +697,15 @@ int ff_set_common_samplerates(AVFilterContext *ctx, */ int ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats) { - SET_COMMON_FORMATS(ctx, formats, + SET_COMMON_FORMATS(ctx, formats, AVMEDIA_TYPE_UNKNOWN, ff_formats_ref, ff_formats_unref); } +int ff_set_common_formats_from_list(AVFilterContext *ctx, const int *fmts) +{ + return ff_set_common_formats(ctx, ff_make_format_list(fmts)); +} + int ff_default_query_formats(AVFilterContext *ctx) { int ret; @@ -595,10 +717,10 @@ int ff_default_query_formats(AVFilterContext *ctx) if (ret < 0) return ret; if (type == AVMEDIA_TYPE_AUDIO) { - ret = ff_set_common_channel_layouts(ctx, ff_all_channel_counts()); + ret = ff_set_common_all_channel_counts(ctx); if (ret < 0) return ret; - ret = ff_set_common_samplerates(ctx, ff_all_samplerates()); + ret = ff_set_common_all_samplerates(ctx); if (ret < 0) return ret; } diff --git a/chromium/third_party/ffmpeg/libavfilter/formats.h b/chromium/third_party/ffmpeg/libavfilter/formats.h index 65acc939e3e..471cb42bc4e 100644 --- a/chromium/third_party/ffmpeg/libavfilter/formats.h +++ b/chromium/third_party/ffmpeg/libavfilter/formats.h @@ -109,34 +109,6 @@ struct AVFilterChannelLayouts { (int)((l) & 0x7FFFFFFF) : 0) /** - * Check the formats/samplerates lists for compatibility for merging - * without actually merging. - * - * @return 1 if they are compatible, 0 if not. - */ -int ff_can_merge_formats(const AVFilterFormats *a, const AVFilterFormats *b, - enum AVMediaType type); -int ff_can_merge_samplerates(const AVFilterFormats *a, const AVFilterFormats *b); - -/** - * Merge the formats/channel layouts/samplerates lists if they are compatible - * and update all the references of a and b to point to the combined list and - * free the old lists as needed. The combined list usually contains the - * intersection of the lists of a and b. - * - * Both a and b must have owners (i.e. refcount > 0) for these functions. - * - * @return 1 if merging succeeded, 0 if a and b are incompatible - * and negative AVERROR code on failure. - * a and b are unmodified if 0 is returned. - */ -int ff_merge_channel_layouts(AVFilterChannelLayouts *a, - AVFilterChannelLayouts *b); -int ff_merge_formats(AVFilterFormats *a, AVFilterFormats *b, - enum AVMediaType type); -int ff_merge_samplerates(AVFilterFormats *a, AVFilterFormats *b); - -/** * Construct an empty AVFilterChannelLayouts/AVFilterFormats struct -- * representing any channel layout (with known disposition)/sample rate. */ @@ -157,16 +129,39 @@ av_warn_unused_result AVFilterChannelLayouts *ff_make_format64_list(const int64_t *fmts); /** - * A helper for query_formats() which sets all links to the same list of channel - * layouts/sample rates. If there are no links hooked to this filter, the list - * is freed. + * Helpers for query_formats() which set all free audio links to the same list + * of channel layouts/sample rates. If there are no links hooked to this list, + * the list is freed. */ av_warn_unused_result int ff_set_common_channel_layouts(AVFilterContext *ctx, AVFilterChannelLayouts *layouts); +/** + * Equivalent to ff_set_common_channel_layouts(ctx, ff_make_format64_list(fmts)) + */ +av_warn_unused_result +int ff_set_common_channel_layouts_from_list(AVFilterContext *ctx, + const int64_t *fmts); +/** + * Equivalent to ff_set_common_channel_layouts(ctx, ff_all_channel_counts()) + */ +av_warn_unused_result +int ff_set_common_all_channel_counts(AVFilterContext *ctx); + av_warn_unused_result int ff_set_common_samplerates(AVFilterContext *ctx, AVFilterFormats *samplerates); +/** + * Equivalent to ff_set_common_samplerates(ctx, ff_make_format_list(samplerates)) + */ +av_warn_unused_result +int ff_set_common_samplerates_from_list(AVFilterContext *ctx, + const int *samplerates); +/** + * Equivalent to ff_set_common_samplerates(ctx, ff_all_samplerates()) + */ +av_warn_unused_result +int ff_set_common_all_samplerates(AVFilterContext *ctx); /** * A helper for query_formats() which sets all links to the same list of @@ -176,6 +171,12 @@ int ff_set_common_samplerates(AVFilterContext *ctx, av_warn_unused_result int ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats); +/** + * Equivalent to ff_set_common_formats(ctx, ff_make_format_list(fmts)) + */ +av_warn_unused_result +int ff_set_common_formats_from_list(AVFilterContext *ctx, const int *fmts); + av_warn_unused_result int ff_add_channel_layout(AVFilterChannelLayouts **l, uint64_t channel_layout); @@ -314,4 +315,104 @@ int ff_formats_check_sample_rates(void *log, const AVFilterFormats *fmts); */ int ff_formats_check_channel_layouts(void *log, const AVFilterChannelLayouts *fmts); +typedef struct AVFilterFormatMerger { + unsigned offset; + int (*merge)(void *a, void *b); + int (*can_merge)(const void *a, const void *b); +} AVFilterFormatsMerger; + +/** + * Callbacks and properties to describe the steps of a format negotiation. + * + * The steps are: + * + * 1. query_formats(): call the callbacks on all filter to set lists of + * supported formats. + * When links on a filter must eventually have the same + * format, the lists of supported formats are the same + * object in memory. + * See: + * http://www.normalesup.org/~george/articles/format_negotiation_in_libavfilter/#12 + * + * + * 2. query_formats(): merge lists of supported formats or insert automatic + * conversion filters. + * Compute the intersection of the lists of supported + * formats on the ends of links. If it succeeds, replace + * both objects with the intersection everywhere they + * are referenced. + * If the intersection is empty, insert an automatic + * conversion filter. + * If several formats are negotiated at once (format, + * rate, layout), only merge if all three can be, since + * the conversion filter can convert all three at once. + * This process goes on as long as progress is made. + * See: + * http://www.normalesup.org/~george/articles/format_negotiation_in_libavfilter/#14 + * http://www.normalesup.org/~george/articles/format_negotiation_in_libavfilter/#29 + * + * 3. reduce_formats(): try to reduce format conversion within filters. + * For each link where there is only one supported + * formats on output, for each output of the connected + * filter, if the media type is the same and said + * format is supported, keep only this one. + * This process goes on as long as progress is made. + * Rationale: conversion filters will set a large list + * of supported formats on outputs but users will + * expect the output to be as close as possible as the + * input (examples: scale without changing the pixel + * format, resample without changint the layout). + * FIXME: this can probably be done by merging the + * input and output lists instead of re-implementing + * the logic. + * + * 4. swap_sample_fmts(): + * swap_samplerates(): + * swap_channel_layouts(): For each filter with an input with only one + * supported format, when outputs have several + * supported formats, put the best one with + * reference to the input at the beginning of the + * list, to prepare it for being picked up by + * pick_formats(). + * The best format is the one that is most + * similar to the input while not losing too much + * information. + * This process need to run only once. + * FIXME: reduce_formats() operates on all inputs + * with a single format, swap_*() operates on the + * first one only: check if the difference makes + * sense. + * TODO: the swapping done for one filter can + * override the swapping done for another filter + * connected to the same list of formats, maybe + * it would be better to compute a total score + * for all connected filters and use the score to + * pick the format instead of just swapping. + * TODO: make the similarity logic available as + * public functions in libavutil. + * + * 5. pick_formats(): Choose one format from the lists of supported formats, + * use it for the link and reduce the list to a single + * element to force other filters connected to the same + * list to use it. + * First process all links where there is a single format + * and the output links of all filters with an input, + * trying to preserve similarity between input and + * outputs. + * Repeat as long as process is made. + * Then do a final run for the remaining filters. + * FIXME: the similarity logic (the ref argument to + * pick_format()) added in FFmpeg duplicates and + * overrides the swapping logic added in libav. Better + * merge them into a score system. + */ +typedef struct AVFilterNegotiation { + unsigned nb_mergers; + const AVFilterFormatsMerger *mergers; + const char *conversion_filter; + unsigned conversion_opts_offset; +} AVFilterNegotiation; + +const AVFilterNegotiation *ff_filter_get_negotiation(AVFilterLink *link); + #endif /* AVFILTER_FORMATS_H */ diff --git a/chromium/third_party/ffmpeg/libavfilter/gblur.h b/chromium/third_party/ffmpeg/libavfilter/gblur.h index dce50671f62..3a66984b063 100644 --- a/chromium/third_party/ffmpeg/libavfilter/gblur.h +++ b/chromium/third_party/ffmpeg/libavfilter/gblur.h @@ -39,9 +39,11 @@ typedef struct GBlurContext { int flt; int depth; + int stride; int planewidth[4]; int planeheight[4]; float *buffer; + float *localbuf; ///< temporary buffer for horiz_slice. NULL if not used float boundaryscale; float boundaryscaleV; float postscale; @@ -49,7 +51,9 @@ typedef struct GBlurContext { float nu; float nuV; int nb_planes; - void (*horiz_slice)(float *buffer, int width, int height, int steps, float nu, float bscale); + void (*horiz_slice)(float *buffer, int width, int height, int steps, float nu, float bscale, float *localbuf); + void (*verti_slice)(float *buffer, int width, int height, int slice_start, int slice_end, int steps, + float nu, float bscale); void (*postscale_slice)(float *buffer, int length, float postscale, float min, float max); } GBlurContext; diff --git a/chromium/third_party/ffmpeg/libavfilter/graphdump.c b/chromium/third_party/ffmpeg/libavfilter/graphdump.c index 79ef1a733fe..cf8914b5589 100644 --- a/chromium/third_party/ffmpeg/libavfilter/graphdump.c +++ b/chromium/third_party/ffmpeg/libavfilter/graphdump.c @@ -29,12 +29,13 @@ static int print_link_prop(AVBPrint *buf, AVFilterLink *link) { - char *format; - char layout[64]; - AVBPrint dummy_buffer = { 0 }; + const char *format; + AVBPrint dummy_buffer; - if (!buf) + if (!buf) { buf = &dummy_buffer; + av_bprint_init(buf, 0, AV_BPRINT_SIZE_COUNT_ONLY); + } switch (link->type) { case AVMEDIA_TYPE_VIDEO: format = av_x_if_null(av_get_pix_fmt_name(link->format), "?"); @@ -45,11 +46,11 @@ static int print_link_prop(AVBPrint *buf, AVFilterLink *link) break; case AVMEDIA_TYPE_AUDIO: - av_get_channel_layout_string(layout, sizeof(layout), - link->channels, link->channel_layout); format = av_x_if_null(av_get_sample_fmt_name(link->format), "?"); - av_bprintf(buf, "[%dHz %s:%s]", - (int)link->sample_rate, format, layout); + av_bprintf(buf, "[%dHz %s:", + (int)link->sample_rate, format); + av_bprint_channel_layout(buf, link->channels, link->channel_layout); + av_bprint_chars(buf, ']', 1); break; default: @@ -158,8 +159,10 @@ char *avfilter_graph_dump(AVFilterGraph *graph, const char *options) av_bprint_init(&buf, 0, AV_BPRINT_SIZE_COUNT_ONLY); avfilter_graph_dump_to_buf(&buf, graph); - av_bprint_init(&buf, buf.len + 1, buf.len + 1); + dump = av_malloc(buf.len + 1); + if (!dump) + return NULL; + av_bprint_init_for_buffer(&buf, dump, buf.len + 1); avfilter_graph_dump_to_buf(&buf, graph); - av_bprint_finalize(&buf, &dump); return dump; } diff --git a/chromium/third_party/ffmpeg/libavfilter/internal.h b/chromium/third_party/ffmpeg/libavfilter/internal.h index 1bcfb830a14..e7c154aff02 100644 --- a/chromium/third_party/ffmpeg/libavfilter/internal.h +++ b/chromium/third_party/ffmpeg/libavfilter/internal.h @@ -27,13 +27,9 @@ #include "libavutil/internal.h" #include "avfilter.h" #include "formats.h" -#include "framepool.h" #include "framequeue.h" -#include "thread.h" #include "version.h" #include "video.h" -#include "libavcodec/avcodec.h" -#include "libavcodec/internal.h" typedef struct AVFilterCommand { double time; ///< time expressed in seconds @@ -65,20 +61,36 @@ struct AVFilterPad { enum AVMediaType type; /** - * Callback function to get a video buffer. If NULL, the filter system will - * use ff_default_get_video_buffer(). + * The filter expects writable frames from its input link, + * duplicating data buffers if needed. * - * Input video pads only. + * input pads only. + */ +#define AVFILTERPAD_FLAG_NEEDS_WRITABLE (1 << 0) + + /** + * The pad's name is allocated and should be freed generically. + */ +#define AVFILTERPAD_FLAG_FREE_NAME (1 << 1) + + /** + * A combination of AVFILTERPAD_FLAG_* flags. */ - AVFrame *(*get_video_buffer)(AVFilterLink *link, int w, int h); + int flags; /** - * Callback function to get an audio buffer. If NULL, the filter system will - * use ff_default_get_audio_buffer(). + * Callback functions to get a video/audio buffers. If NULL, + * the filter system will use ff_default_get_video_buffer() for video + * and ff_default_get_audio_buffer() for audio. + * + * The state of the union is determined by type. * - * Input audio pads only. + * Input pads only. */ - AVFrame *(*get_audio_buffer)(AVFilterLink *link, int nb_samples); + union { + AVFrame *(*video)(AVFilterLink *link, int w, int h); + AVFrame *(*audio)(AVFilterLink *link, int nb_samples); + } get_buffer; /** * Filtering callback. This is where a filter receives a frame with @@ -116,14 +128,6 @@ struct AVFilterPad { * and another value on error. */ int (*config_props)(AVFilterLink *link); - - /** - * The filter expects writable frames from its input link, - * duplicating data buffers if needed. - * - * input pads only. - */ - int needs_writable; }; struct AVFilterGraphInternal { @@ -136,6 +140,18 @@ struct AVFilterInternal { avfilter_execute_func *execute; }; +static av_always_inline int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, + void *arg, int *ret, int nb_jobs) +{ + return ctx->internal->execute(ctx, func, arg, ret, nb_jobs); +} + +#define FILTER_INOUTPADS(inout, array) \ + .inout = array, \ + .nb_ ## inout = FF_ARRAY_ELEMS(array) +#define FILTER_INPUTS(array) FILTER_INOUTPADS(inputs, (array)) +#define FILTER_OUTPUTS(array) FILTER_INOUTPADS(outputs, (array)) + /** * Tell if an integer is contained in the provided -1-terminated list of integers. * This is useful for determining (for instance) if an AVPixelFormat is in an @@ -219,38 +235,15 @@ void ff_tlog_ref(void *ctx, AVFrame *ref, int end); void ff_tlog_link(void *ctx, AVFilterLink *link, int end); /** - * Insert a new pad. + * Append a new input/output pad to the filter's list of such pads. * - * @param idx Insertion point. Pad is inserted at the end if this point - * is beyond the end of the list of pads. - * @param count Pointer to the number of pads in the list - * @param padidx_off Offset within an AVFilterLink structure to the element - * to increment when inserting a new pad causes link - * numbering to change - * @param pads Pointer to the pointer to the beginning of the list of pads - * @param links Pointer to the pointer to the beginning of the list of links - * @param newpad The new pad to add. A copy is made when adding. - * @return >= 0 in case of success, a negative AVERROR code on error + * The *_free_name versions will set the AVFILTERPAD_FLAG_FREE_NAME flag + * ensuring that the name will be freed generically (even on insertion error). */ -int ff_insert_pad(unsigned idx, unsigned *count, size_t padidx_off, - AVFilterPad **pads, AVFilterLink ***links, - AVFilterPad *newpad); - -/** Insert a new input pad for the filter. */ -static inline int ff_insert_inpad(AVFilterContext *f, unsigned index, - AVFilterPad *p) -{ - return ff_insert_pad(index, &f->nb_inputs, offsetof(AVFilterLink, dstpad), - &f->input_pads, &f->inputs, p); -} - -/** Insert a new output pad for the filter. */ -static inline int ff_insert_outpad(AVFilterContext *f, unsigned index, - AVFilterPad *p) -{ - return ff_insert_pad(index, &f->nb_outputs, offsetof(AVFilterLink, srcpad), - &f->output_pads, &f->outputs, p); -} +int ff_append_inpad (AVFilterContext *f, AVFilterPad *p); +int ff_append_outpad(AVFilterContext *f, AVFilterPad *p); +int ff_append_inpad_free_name (AVFilterContext *f, AVFilterPad *p); +int ff_append_outpad_free_name(AVFilterContext *f, AVFilterPad *p); /** * Request an input frame from the filter at the other end of the link. @@ -285,14 +278,16 @@ static inline int ff_insert_outpad(AVFilterContext *f, unsigned index, */ int ff_request_frame(AVFilterLink *link); -#define AVFILTER_DEFINE_CLASS(fname) \ - static const AVClass fname##_class = { \ - .class_name = #fname, \ +#define AVFILTER_DEFINE_CLASS_EXT(name, desc, options) \ + static const AVClass name##_class = { \ + .class_name = desc, \ .item_name = av_default_item_name, \ - .option = fname##_options, \ + .option = options, \ .version = LIBAVUTIL_VERSION_INT, \ .category = AV_CLASS_CATEGORY_FILTER, \ } +#define AVFILTER_DEFINE_CLASS(fname) \ + AVFILTER_DEFINE_CLASS_EXT(fname, #fname, fname##_options) /** * Find the index of a link. @@ -344,22 +339,6 @@ void ff_filter_graph_remove_filter(AVFilterGraph *graph, AVFilterContext *filter int ff_filter_graph_run_once(AVFilterGraph *graph); /** - * Normalize the qscale factor - * FIXME the H264 qscale is a log based scale, mpeg1/2 is not, the code below - * cannot be optimal - */ -static inline int ff_norm_qscale(int qscale, int type) -{ - switch (type) { - case FF_QSCALE_TYPE_MPEG1: return qscale; - case FF_QSCALE_TYPE_MPEG2: return qscale >> 1; - case FF_QSCALE_TYPE_H264: return qscale >> 2; - case FF_QSCALE_TYPE_VP56: return (63 - qscale + 2) >> 2; - } - return qscale; -} - -/** * Get number of threads for current filter instance. * This number is always same or less than graph->nb_threads. */ diff --git a/chromium/third_party/ffmpeg/libavfilter/opencl.c b/chromium/third_party/ffmpeg/libavfilter/opencl.c index 9c46cfdc092..f479182140c 100644 --- a/chromium/third_party/ffmpeg/libavfilter/opencl.c +++ b/chromium/third_party/ffmpeg/libavfilter/opencl.c @@ -31,13 +31,8 @@ int ff_opencl_filter_query_formats(AVFilterContext *avctx) AV_PIX_FMT_OPENCL, AV_PIX_FMT_NONE, }; - AVFilterFormats *formats; - formats = ff_make_format_list(pix_fmts); - if (!formats) - return AVERROR(ENOMEM); - - return ff_set_common_formats(avctx, formats); + return ff_set_common_formats_from_list(avctx, pix_fmts); } static int opencl_filter_set_device(AVFilterContext *avctx, diff --git a/chromium/third_party/ffmpeg/libavfilter/qp_table.h b/chromium/third_party/ffmpeg/libavfilter/qp_table.h index a552fe2e648..4758ee85380 100644 --- a/chromium/third_party/ffmpeg/libavfilter/qp_table.h +++ b/chromium/third_party/ffmpeg/libavfilter/qp_table.h @@ -22,6 +22,7 @@ #include <stdint.h> #include "libavutil/frame.h" +#include "libavcodec/internal.h" /** * Extract a libpostproc-compatible QP table - an 8-bit QP value per 16x16 @@ -30,4 +31,20 @@ int ff_qp_table_extract(AVFrame *frame, int8_t **table, int *table_w, int *table_h, int *qscale_type); +/** + * Normalize the qscale factor + * FIXME the H264 qscale is a log based scale, mpeg1/2 is not, the code below + * cannot be optimal + */ +static inline int ff_norm_qscale(int qscale, int type) +{ + switch (type) { + case FF_QSCALE_TYPE_MPEG1: return qscale; + case FF_QSCALE_TYPE_MPEG2: return qscale >> 1; + case FF_QSCALE_TYPE_H264: return qscale >> 2; + case FF_QSCALE_TYPE_VP56: return (63 - qscale + 2) >> 2; + } + return qscale; +} + #endif // AVFILTER_QP_TABLE_H diff --git a/chromium/third_party/ffmpeg/libavfilter/qsvvpp.c b/chromium/third_party/ffmpeg/libavfilter/qsvvpp.c index 4768f6208b4..135d4c4e369 100644 --- a/chromium/third_party/ffmpeg/libavfilter/qsvvpp.c +++ b/chromium/third_party/ffmpeg/libavfilter/qsvvpp.c @@ -36,12 +36,7 @@ MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET)) #define IS_OPAQUE_MEMORY(mode) (mode & MFX_MEMTYPE_OPAQUE_FRAME) #define IS_SYSTEM_MEMORY(mode) (mode & MFX_MEMTYPE_SYSTEM_MEMORY) - -static const mfxHandleType handle_types[] = { - MFX_HANDLE_VA_DISPLAY, - MFX_HANDLE_D3D9_DEVICE_MANAGER, - MFX_HANDLE_D3D11_DEVICE, -}; +#define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl)) static const AVRational default_tb = { 1, 90000 }; @@ -202,7 +197,13 @@ static mfxStatus frame_unlock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr) static mfxStatus frame_get_hdl(mfxHDL pthis, mfxMemId mid, mfxHDL *hdl) { - *hdl = mid; + mfxHDLPair *pair_dst = (mfxHDLPair*)hdl; + mfxHDLPair *pair_src = (mfxHDLPair*)mid; + + pair_dst->first = pair_src->first; + + if (pair_src->second != (mfxMemId)MFX_INFINITE) + pair_dst->second = pair_src->second; return MFX_ERR_NONE; } @@ -526,7 +527,7 @@ static int init_vpp_session(AVFilterContext *avctx, QSVVPPContext *s) s->out_mem_mode = IS_OPAQUE_MEMORY(s->in_mem_mode) ? MFX_MEMTYPE_OPAQUE_FRAME : - MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET; + MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET | MFX_MEMTYPE_FROM_VPPOUT; out_frames_ctx = (AVHWFramesContext *)out_frames_ref->data; out_frames_hwctx = out_frames_ctx->hwctx; @@ -572,14 +573,18 @@ static int init_vpp_session(AVFilterContext *avctx, QSVVPPContext *s) return AVERROR_UNKNOWN; } - for (i = 0; i < FF_ARRAY_ELEMS(handle_types); i++) { - ret = MFXVideoCORE_GetHandle(device_hwctx->session, handle_types[i], &handle); - if (ret == MFX_ERR_NONE) { - handle_type = handle_types[i]; - break; - } + if (MFX_IMPL_VIA_VAAPI == MFX_IMPL_VIA_MASK(impl)) { + handle_type = MFX_HANDLE_VA_DISPLAY; + } else if (MFX_IMPL_VIA_D3D11 == MFX_IMPL_VIA_MASK(impl)) { + handle_type = MFX_HANDLE_D3D11_DEVICE; + } else if (MFX_IMPL_VIA_D3D9 == MFX_IMPL_VIA_MASK(impl)) { + handle_type = MFX_HANDLE_D3D9_DEVICE_MANAGER; + } else { + av_log(avctx, AV_LOG_ERROR, "Error unsupported handle type\n"); + return AVERROR_UNKNOWN; } + ret = MFXVideoCORE_GetHandle(device_hwctx->session, handle_type, &handle); if (ret < 0) return ff_qsvvpp_print_error(avctx, ret, "Error getting the session handle"); else if (ret > 0) { @@ -807,8 +812,7 @@ int ff_qsvvpp_filter_frame(QSVVPPContext *s, AVFilterLink *inlink, AVFrame *picr filter_ret = s->filter_frame(outlink, tmp->frame); if (filter_ret < 0) { av_frame_free(&tmp->frame); - ret = filter_ret; - break; + return filter_ret; } tmp->queued--; s->got_frame = 1; @@ -842,7 +846,7 @@ int ff_qsvvpp_filter_frame(QSVVPPContext *s, AVFilterLink *inlink, AVFrame *picr if (ret < 0 && ret != MFX_ERR_MORE_SURFACE) { /* Ignore more_data error */ if (ret == MFX_ERR_MORE_DATA) - ret = AVERROR(EAGAIN); + return AVERROR(EAGAIN); break; } out_frame->frame->pts = av_rescale_q(out_frame->surface.Data.TimeStamp, @@ -864,8 +868,7 @@ int ff_qsvvpp_filter_frame(QSVVPPContext *s, AVFilterLink *inlink, AVFrame *picr filter_ret = s->filter_frame(outlink, tmp->frame); if (filter_ret < 0) { av_frame_free(&tmp->frame); - ret = filter_ret; - break; + return filter_ret; } tmp->queued--; @@ -874,5 +877,10 @@ int ff_qsvvpp_filter_frame(QSVVPPContext *s, AVFilterLink *inlink, AVFrame *picr } } while(ret == MFX_ERR_MORE_SURFACE); - return ret; + if (ret < 0) + return ff_qsvvpp_print_error(ctx, ret, "Error running VPP"); + else if (ret > 0) + ff_qsvvpp_print_warning(ctx, ret, "Warning in running VPP"); + + return 0; } diff --git a/chromium/third_party/ffmpeg/libavfilter/setpts.c b/chromium/third_party/ffmpeg/libavfilter/setpts.c index ac98974312f..fad92033e4c 100644 --- a/chromium/third_party/ffmpeg/libavfilter/setpts.c +++ b/chromium/third_party/ffmpeg/libavfilter/setpts.c @@ -279,7 +279,6 @@ static const AVFilterPad avfilter_vf_setpts_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_input, }, - { NULL } }; static const AVFilterPad avfilter_vf_setpts_outputs[] = { @@ -287,7 +286,6 @@ static const AVFilterPad avfilter_vf_setpts_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_setpts = { @@ -300,8 +298,8 @@ const AVFilter ff_vf_setpts = { .priv_size = sizeof(SetPTSContext), .priv_class = &setpts_class, - .inputs = avfilter_vf_setpts_inputs, - .outputs = avfilter_vf_setpts_outputs, + FILTER_INPUTS(avfilter_vf_setpts_inputs), + FILTER_OUTPUTS(avfilter_vf_setpts_outputs), }; #endif /* CONFIG_SETPTS_FILTER */ @@ -319,7 +317,6 @@ static const AVFilterPad asetpts_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_input, }, - { NULL } }; static const AVFilterPad asetpts_outputs[] = { @@ -327,7 +324,6 @@ static const AVFilterPad asetpts_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_asetpts = { @@ -338,7 +334,7 @@ const AVFilter ff_af_asetpts = { .uninit = uninit, .priv_size = sizeof(SetPTSContext), .priv_class = &asetpts_class, - .inputs = asetpts_inputs, - .outputs = asetpts_outputs, + FILTER_INPUTS(asetpts_inputs), + FILTER_OUTPUTS(asetpts_outputs), }; #endif /* CONFIG_ASETPTS_FILTER */ diff --git a/chromium/third_party/ffmpeg/libavfilter/settb.c b/chromium/third_party/ffmpeg/libavfilter/settb.c index 2f68e44c5b4..ae2cf9b888f 100644 --- a/chromium/third_party/ffmpeg/libavfilter/settb.c +++ b/chromium/third_party/ffmpeg/libavfilter/settb.c @@ -167,7 +167,6 @@ static const AVFilterPad avfilter_vf_settb_inputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; static const AVFilterPad avfilter_vf_settb_outputs[] = { @@ -176,7 +175,6 @@ static const AVFilterPad avfilter_vf_settb_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output_props, }, - { NULL } }; const AVFilter ff_vf_settb = { @@ -184,8 +182,8 @@ const AVFilter ff_vf_settb = { .description = NULL_IF_CONFIG_SMALL("Set timebase for the video output link."), .priv_size = sizeof(SetTBContext), .priv_class = &settb_class, - .inputs = avfilter_vf_settb_inputs, - .outputs = avfilter_vf_settb_outputs, + FILTER_INPUTS(avfilter_vf_settb_inputs), + FILTER_OUTPUTS(avfilter_vf_settb_outputs), .activate = activate, }; #endif /* CONFIG_SETTB_FILTER */ @@ -200,7 +198,6 @@ static const AVFilterPad avfilter_af_asettb_inputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; static const AVFilterPad avfilter_af_asettb_outputs[] = { @@ -209,15 +206,14 @@ static const AVFilterPad avfilter_af_asettb_outputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_output_props, }, - { NULL } }; const AVFilter ff_af_asettb = { .name = "asettb", .description = NULL_IF_CONFIG_SMALL("Set timebase for the audio output link."), .priv_size = sizeof(SetTBContext), - .inputs = avfilter_af_asettb_inputs, - .outputs = avfilter_af_asettb_outputs, + FILTER_INPUTS(avfilter_af_asettb_inputs), + FILTER_OUTPUTS(avfilter_af_asettb_outputs), .priv_class = &asettb_class, .activate = activate, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/signature_lookup.c b/chromium/third_party/ffmpeg/libavfilter/signature_lookup.c index 977f8980495..86dd0c66754 100644 --- a/chromium/third_party/ffmpeg/libavfilter/signature_lookup.c +++ b/chromium/third_party/ffmpeg/libavfilter/signature_lookup.c @@ -244,9 +244,9 @@ static MatchingInfo* get_matching_parameters(AVFilterContext *ctx, SignatureCont if (pairs[i].b[j] != pairs[k].b[l]) { /* linear regression */ m = (pairs[k].b_pos[l]-pairs[i].b_pos[j]) / (k-i); /* good value between 0.0 - 2.0 */ - framerate = (int) m*30 + 0.5; /* round up to 0 - 60 */ + framerate = (int) (m*30 + 0.5); /* round up to 0 - 60 */ if (framerate>0 && framerate <= MAX_FRAMERATE) { - offset = pairs[i].b_pos[j] - ((int) m*i + 0.5); /* only second part has to be rounded up */ + offset = pairs[i].b_pos[j] - ((int) (m*i + 0.5)); /* only second part has to be rounded up */ if (offset > -HOUGH_MAX_OFFSET && offset < HOUGH_MAX_OFFSET) { if (pairs[i].dist < pairs[k].dist) { if (pairs[i].dist < hspace[framerate-1][offset+HOUGH_MAX_OFFSET].dist) { diff --git a/chromium/third_party/ffmpeg/libavfilter/split.c b/chromium/third_party/ffmpeg/libavfilter/split.c index da5f681af85..b02584d0ab3 100644 --- a/chromium/third_party/ffmpeg/libavfilter/split.c +++ b/chromium/third_party/ffmpeg/libavfilter/split.c @@ -56,23 +56,13 @@ static av_cold int split_init(AVFilterContext *ctx) if (!pad.name) return AVERROR(ENOMEM); - if ((ret = ff_insert_outpad(ctx, i, &pad)) < 0) { - av_freep(&pad.name); + if ((ret = ff_append_outpad_free_name(ctx, &pad)) < 0) return ret; - } } return 0; } -static av_cold void split_uninit(AVFilterContext *ctx) -{ - int i; - - for (i = 0; i < ctx->nb_outputs; i++) - av_freep(&ctx->output_pads[i].name); -} - static int filter_frame(AVFilterLink *inlink, AVFrame *frame) { AVFilterContext *ctx = inlink->dst; @@ -116,7 +106,6 @@ static const AVFilterPad avfilter_vf_split_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; const AVFilter ff_vf_split = { @@ -125,8 +114,7 @@ const AVFilter ff_vf_split = { .priv_size = sizeof(SplitContext), .priv_class = &split_class, .init = split_init, - .uninit = split_uninit, - .inputs = avfilter_vf_split_inputs, + FILTER_INPUTS(avfilter_vf_split_inputs), .outputs = NULL, .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS, }; @@ -137,7 +125,6 @@ static const AVFilterPad avfilter_af_asplit_inputs[] = { .type = AVMEDIA_TYPE_AUDIO, .filter_frame = filter_frame, }, - { NULL } }; const AVFilter ff_af_asplit = { @@ -146,8 +133,7 @@ const AVFilter ff_af_asplit = { .priv_size = sizeof(SplitContext), .priv_class = &asplit_class, .init = split_init, - .uninit = split_uninit, - .inputs = avfilter_af_asplit_inputs, + FILTER_INPUTS(avfilter_af_asplit_inputs), .outputs = NULL, .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/src_movie.c b/chromium/third_party/ffmpeg/libavfilter/src_movie.c index 7d97295dd09..0d63c1e4bc1 100644 --- a/chromium/third_party/ffmpeg/libavfilter/src_movie.c +++ b/chromium/third_party/ffmpeg/libavfilter/src_movie.c @@ -306,10 +306,8 @@ static av_cold int movie_common_init(AVFilterContext *ctx) return AVERROR(ENOMEM); pad.config_props = movie_config_output_props; pad.request_frame = movie_request_frame; - if ((ret = ff_insert_outpad(ctx, i, &pad)) < 0) { - av_freep(&pad.name); + if ((ret = ff_append_outpad_free_name(ctx, &pad)) < 0) return ret; - } if ( movie->st[i].st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && !movie->st[i].st->codecpar->channel_layout) { ret = guess_channel_layout(&movie->st[i], i, ctx); @@ -334,7 +332,6 @@ static av_cold void movie_uninit(AVFilterContext *ctx) int i; for (i = 0; i < ctx->nb_outputs; i++) { - av_freep(&ctx->output_pads[i].name); if (movie->st[i].st) avcodec_free_context(&movie->st[i].codec_ctx); } diff --git a/chromium/third_party/ffmpeg/libavfilter/trim.c b/chromium/third_party/ffmpeg/libavfilter/trim.c index 261dacbc5c4..c260da3a0b6 100644 --- a/chromium/third_party/ffmpeg/libavfilter/trim.c +++ b/chromium/third_party/ffmpeg/libavfilter/trim.c @@ -195,7 +195,6 @@ static const AVFilterPad trim_inputs[] = { .filter_frame = trim_filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad trim_outputs[] = { @@ -203,7 +202,6 @@ static const AVFilterPad trim_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_trim = { @@ -212,8 +210,8 @@ const AVFilter ff_vf_trim = { .init = init, .priv_size = sizeof(TrimContext), .priv_class = &trim_class, - .inputs = trim_inputs, - .outputs = trim_outputs, + FILTER_INPUTS(trim_inputs), + FILTER_OUTPUTS(trim_outputs), }; #endif // CONFIG_TRIM_FILTER @@ -350,7 +348,6 @@ static const AVFilterPad atrim_inputs[] = { .filter_frame = atrim_filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad atrim_outputs[] = { @@ -358,7 +355,6 @@ static const AVFilterPad atrim_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, }, - { NULL } }; const AVFilter ff_af_atrim = { @@ -367,7 +363,7 @@ const AVFilter ff_af_atrim = { .init = init, .priv_size = sizeof(TrimContext), .priv_class = &atrim_class, - .inputs = atrim_inputs, - .outputs = atrim_outputs, + FILTER_INPUTS(atrim_inputs), + FILTER_OUTPUTS(atrim_outputs), }; #endif // CONFIG_ATRIM_FILTER diff --git a/chromium/third_party/ffmpeg/libavfilter/vaf_spectrumsynth.c b/chromium/third_party/ffmpeg/libavfilter/vaf_spectrumsynth.c index 36fb48c6300..a59170ea025 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vaf_spectrumsynth.c +++ b/chromium/third_party/ffmpeg/libavfilter/vaf_spectrumsynth.c @@ -24,9 +24,10 @@ * @todo support float pixel format */ -#include "libavcodec/avfft.h" +#include "libavutil/tx.h" #include "libavutil/avassert.h" #include "libavutil/channel_layout.h" +#include "libavutil/cpu.h" #include "libavutil/ffmath.h" #include "libavutil/opt.h" #include "libavutil/parseutils.h" @@ -53,9 +54,10 @@ typedef struct SpectrumSynthContext { int orientation; AVFrame *magnitude, *phase; - FFTContext *fft; ///< Fast Fourier Transform context - int fft_bits; ///< number of bits (FFT window size = 1<<fft_bits) - FFTComplex **fft_data; ///< bins holder for each (displayed) channels + AVTXContext *fft; ///< Fast Fourier Transform context + av_tx_fn tx_fn; + AVComplexFloat **fft_in; ///< bins holder for each (displayed) channels + AVComplexFloat **fft_out; ///< bins holder for each (displayed) channels int win_size; int size; int nb_freq; @@ -150,8 +152,8 @@ static int config_output(AVFilterLink *outlink) int height = ctx->inputs[0]->h; AVRational time_base = ctx->inputs[0]->time_base; AVRational frame_rate = ctx->inputs[0]->frame_rate; - int i, ch, fft_bits; - float factor, overlap; + float factor, overlap, scale; + int i, ch, ret; outlink->sample_rate = s->sample_rate; outlink->time_base = (AVRational){1, s->sample_rate}; @@ -182,23 +184,30 @@ static int config_output(AVFilterLink *outlink) s->size = s->orientation == VERTICAL ? height / s->channels : width / s->channels; s->xend = s->orientation == VERTICAL ? width : height; - for (fft_bits = 1; 1 << fft_bits < 2 * s->size; fft_bits++); + s->win_size = s->size * 2; + s->nb_freq = s->size; - s->win_size = 1 << fft_bits; - s->nb_freq = 1 << (fft_bits - 1); - - s->fft = av_fft_init(fft_bits, 1); - if (!s->fft) { + ret = av_tx_init(&s->fft, &s->tx_fn, AV_TX_FLOAT_FFT, 1, s->win_size, &scale, 0); + if (ret < 0) { av_log(ctx, AV_LOG_ERROR, "Unable to create FFT context. " "The window size might be too high.\n"); - return AVERROR(EINVAL); + return ret; } - s->fft_data = av_calloc(s->channels, sizeof(*s->fft_data)); - if (!s->fft_data) + + s->fft_in = av_calloc(s->channels, sizeof(*s->fft_in)); + if (!s->fft_in) + return AVERROR(ENOMEM); + s->fft_out = av_calloc(s->channels, sizeof(*s->fft_out)); + if (!s->fft_out) return AVERROR(ENOMEM); + for (ch = 0; ch < s->channels; ch++) { - s->fft_data[ch] = av_calloc(s->win_size, sizeof(**s->fft_data)); - if (!s->fft_data[ch]) + s->fft_in[ch] = av_calloc(FFALIGN(s->win_size, av_cpu_max_align()), sizeof(**s->fft_in)); + if (!s->fft_in[ch]) + return AVERROR(ENOMEM); + + s->fft_out[ch] = av_calloc(FFALIGN(s->win_size, av_cpu_max_align()), sizeof(**s->fft_out)); + if (!s->fft_out[ch]) return AVERROR(ENOMEM); } @@ -244,8 +253,8 @@ static void read16_fft_bin(SpectrumSynthContext *s, } phase = ((p[x] / (double)UINT16_MAX) * 2. - 1.) * M_PI; - s->fft_data[ch][f].re = magnitude * cos(phase); - s->fft_data[ch][f].im = magnitude * sin(phase); + s->fft_in[ch][f].re = magnitude * cos(phase); + s->fft_in[ch][f].im = magnitude * sin(phase); } static void read8_fft_bin(SpectrumSynthContext *s, @@ -269,8 +278,8 @@ static void read8_fft_bin(SpectrumSynthContext *s, } phase = ((p[x] / (double)UINT8_MAX) * 2. - 1.) * M_PI; - s->fft_data[ch][f].re = magnitude * cos(phase); - s->fft_data[ch][f].im = magnitude * sin(phase); + s->fft_in[ch][f].re = magnitude * cos(phase); + s->fft_in[ch][f].im = magnitude * sin(phase); } static void read_fft_data(AVFilterContext *ctx, int x, int h, int ch) @@ -330,17 +339,16 @@ static void synth_window(AVFilterContext *ctx, int x) read_fft_data(ctx, x, h, ch); for (y = h; y <= s->nb_freq; y++) { - s->fft_data[ch][y].re = 0; - s->fft_data[ch][y].im = 0; + s->fft_in[ch][y].re = 0; + s->fft_in[ch][y].im = 0; } for (y = s->nb_freq + 1, f = s->nb_freq - 1; y < nb; y++, f--) { - s->fft_data[ch][y].re = s->fft_data[ch][f].re; - s->fft_data[ch][y].im = -s->fft_data[ch][f].im; + s->fft_in[ch][y].re = s->fft_in[ch][f].re; + s->fft_in[ch][y].im = -s->fft_in[ch][f].im; } - av_fft_permute(s->fft, s->fft_data[ch]); - av_fft_calc(s->fft, s->fft_data[ch]); + s->tx_fn(s->fft, s->fft_out[ch], s->fft_in[ch], sizeof(float)); } } @@ -363,11 +371,11 @@ static int try_push_frame(AVFilterContext *ctx, int x) end = s->end; k = end; for (i = 0, j = start; j < k && i < s->win_size; i++, j++) { - buf[j] += s->fft_data[ch][i].re; + buf[j] += s->fft_out[ch][i].re; } for (; i < s->win_size; i++, j++) { - buf[j] = s->fft_data[ch][i].re; + buf[j] = s->fft_out[ch][i].re; } start += s->hop_size; @@ -499,12 +507,19 @@ static av_cold void uninit(AVFilterContext *ctx) av_frame_free(&s->magnitude); av_frame_free(&s->phase); av_frame_free(&s->buffer); - av_fft_end(s->fft); - if (s->fft_data) { + + av_tx_uninit(&s->fft); + + if (s->fft_in) { + for (i = 0; i < s->channels; i++) + av_freep(&s->fft_in[i]); + } + if (s->fft_out) { for (i = 0; i < s->channels; i++) - av_freep(&s->fft_data[i]); + av_freep(&s->fft_out[i]); } - av_freep(&s->fft_data); + av_freep(&s->fft_in); + av_freep(&s->fft_out); av_freep(&s->window_func_lut); } @@ -517,7 +532,6 @@ static const AVFilterPad spectrumsynth_inputs[] = { .name = "phase", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; static const AVFilterPad spectrumsynth_outputs[] = { @@ -526,7 +540,6 @@ static const AVFilterPad spectrumsynth_outputs[] = { .type = AVMEDIA_TYPE_AUDIO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vaf_spectrumsynth = { @@ -536,7 +549,7 @@ const AVFilter ff_vaf_spectrumsynth = { .query_formats = query_formats, .activate = activate, .priv_size = sizeof(SpectrumSynthContext), - .inputs = spectrumsynth_inputs, - .outputs = spectrumsynth_outputs, + FILTER_INPUTS(spectrumsynth_inputs), + FILTER_OUTPUTS(spectrumsynth_outputs), .priv_class = &spectrumsynth_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/version.h b/chromium/third_party/ffmpeg/libavfilter/version.h index 75cd10dccd7..24b59acde6b 100644 --- a/chromium/third_party/ffmpeg/libavfilter/version.h +++ b/chromium/third_party/ffmpeg/libavfilter/version.h @@ -30,8 +30,8 @@ #include "libavutil/version.h" #define LIBAVFILTER_VERSION_MAJOR 8 -#define LIBAVFILTER_VERSION_MINOR 1 -#define LIBAVFILTER_VERSION_MICRO 103 +#define LIBAVFILTER_VERSION_MINOR 9 +#define LIBAVFILTER_VERSION_MICRO 100 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ @@ -56,5 +56,8 @@ #ifndef FF_API_BUFFERSINK_ALLOC #define FF_API_BUFFERSINK_ALLOC (LIBAVFILTER_VERSION_MAJOR < 9) #endif +#ifndef FF_API_PAD_COUNT +#define FF_API_PAD_COUNT (LIBAVFILTER_VERSION_MAJOR < 9) +#endif #endif /* AVFILTER_VERSION_H */ diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_addroi.c b/chromium/third_party/ffmpeg/libavfilter/vf_addroi.c index 1d09f31879e..5f9ec217549 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_addroi.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_addroi.c @@ -244,7 +244,6 @@ static const AVFilterPad addroi_inputs[] = { .config_props = addroi_config_input, .filter_frame = addroi_filter_frame, }, - { NULL } }; static const AVFilterPad addroi_outputs[] = { @@ -252,7 +251,6 @@ static const AVFilterPad addroi_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_addroi = { @@ -264,6 +262,6 @@ const AVFilter ff_vf_addroi = { .priv_size = sizeof(AddROIContext), .priv_class = &addroi_class, - .inputs = addroi_inputs, - .outputs = addroi_outputs, + FILTER_INPUTS(addroi_inputs), + FILTER_OUTPUTS(addroi_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_alphamerge.c b/chromium/third_party/ffmpeg/libavfilter/vf_alphamerge.c index 9b01db66052..8fb601ce061 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_alphamerge.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_alphamerge.c @@ -170,7 +170,6 @@ static const AVFilterPad alphamerge_inputs[] = { .name = "alpha", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; static const AVFilterPad alphamerge_outputs[] = { @@ -179,7 +178,6 @@ static const AVFilterPad alphamerge_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; static const AVOption alphamerge_options[] = { @@ -197,8 +195,8 @@ const AVFilter ff_vf_alphamerge = { .priv_class = &alphamerge_class, .init = init, .query_formats = query_formats, - .inputs = alphamerge_inputs, - .outputs = alphamerge_outputs, + FILTER_INPUTS(alphamerge_inputs), + FILTER_OUTPUTS(alphamerge_outputs), .uninit = uninit, .activate = activate, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_amplify.c b/chromium/third_party/ffmpeg/libavfilter/vf_amplify.c index e9e0a90b415..713e1560b0f 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_amplify.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_amplify.c @@ -78,10 +78,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRAP, AV_PIX_FMT_GBRAP10, AV_PIX_FMT_GBRAP12, AV_PIX_FMT_GBRAP16, AV_PIX_FMT_NONE }; - AVFilterFormats *formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } static av_cold int init(AVFilterContext *ctx) @@ -267,7 +264,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.out = out; td.in = s->frames; - ctx->internal->execute(ctx, amplify_frame, &td, NULL, FFMIN(s->height[1], ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, amplify_frame, &td, NULL, + FFMIN(s->height[1], ff_filter_get_nb_threads(ctx))); } else { out = av_frame_clone(s->frames[s->radius]); if (!out) @@ -299,7 +297,6 @@ static const AVFilterPad inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -308,7 +305,6 @@ static const AVFilterPad outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; AVFILTER_DEFINE_CLASS(amplify); @@ -319,8 +315,8 @@ const AVFilter ff_vf_amplify = { .priv_size = sizeof(AmplifyContext), .priv_class = &lify_class, .query_formats = query_formats, - .outputs = outputs, - .inputs = inputs, + FILTER_OUTPUTS(outputs), + FILTER_INPUTS(inputs), .init = init, .uninit = uninit, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_aspect.c b/chromium/third_party/ffmpeg/libavfilter/vf_aspect.c index f0467b5247f..995c7f4f147 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_aspect.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_aspect.c @@ -173,7 +173,6 @@ static const AVFilterPad avfilter_vf_setdar_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad avfilter_vf_setdar_outputs[] = { @@ -182,7 +181,6 @@ static const AVFilterPad avfilter_vf_setdar_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = setdar_config_props, }, - { NULL } }; const AVFilter ff_vf_setdar = { @@ -190,8 +188,8 @@ const AVFilter ff_vf_setdar = { .description = NULL_IF_CONFIG_SMALL("Set the frame display aspect ratio."), .priv_size = sizeof(AspectContext), .priv_class = &setdar_class, - .inputs = avfilter_vf_setdar_inputs, - .outputs = avfilter_vf_setdar_outputs, + FILTER_INPUTS(avfilter_vf_setdar_inputs), + FILTER_OUTPUTS(avfilter_vf_setdar_outputs), }; #endif /* CONFIG_SETDAR_FILTER */ @@ -237,7 +235,6 @@ static const AVFilterPad avfilter_vf_setsar_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad avfilter_vf_setsar_outputs[] = { @@ -246,7 +243,6 @@ static const AVFilterPad avfilter_vf_setsar_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = setsar_config_props, }, - { NULL } }; const AVFilter ff_vf_setsar = { @@ -254,8 +250,8 @@ const AVFilter ff_vf_setsar = { .description = NULL_IF_CONFIG_SMALL("Set the pixel sample aspect ratio."), .priv_size = sizeof(AspectContext), .priv_class = &setsar_class, - .inputs = avfilter_vf_setsar_inputs, - .outputs = avfilter_vf_setsar_outputs, + FILTER_INPUTS(avfilter_vf_setsar_inputs), + FILTER_OUTPUTS(avfilter_vf_setsar_outputs), }; #endif /* CONFIG_SETSAR_FILTER */ diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_atadenoise.c b/chromium/third_party/ffmpeg/libavfilter/vf_atadenoise.c index 6b2f4a4e50e..d21726aa5e8 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_atadenoise.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_atadenoise.c @@ -120,10 +120,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRAP, AV_PIX_FMT_GBRAP10, AV_PIX_FMT_GBRAP12, AV_PIX_FMT_GBRAP16, AV_PIX_FMT_NONE }; - AVFilterFormats *formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } static av_cold int init(AVFilterContext *ctx) @@ -491,7 +488,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf) } td.in = in; td.out = out; - ctx->internal->execute(ctx, s->filter_slice, &td, NULL, + ff_filter_execute(ctx, s->filter_slice, &td, NULL, FFMIN3(s->planeheight[1], s->planeheight[2], ff_filter_get_nb_threads(ctx))); @@ -560,7 +557,6 @@ static const AVFilterPad inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -569,7 +565,6 @@ static const AVFilterPad outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .request_frame = request_frame, }, - { NULL } }; const AVFilter ff_vf_atadenoise = { @@ -580,8 +575,8 @@ const AVFilter ff_vf_atadenoise = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, .process_command = process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_avgblur.c b/chromium/third_party/ffmpeg/libavfilter/vf_avgblur.c index 361801e8fd5..3e222a43fab 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_avgblur.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_avgblur.c @@ -216,10 +216,12 @@ static void averageiir2d(AVFilterContext *ctx, AVFrame *in, AVFrame *out, int pl td.height = height; td.ptr = in->data[plane]; td.linesize = in->linesize[plane]; - ctx->internal->execute(ctx, s->filter_horizontally, &td, NULL, FFMIN(height, nb_threads)); + ff_filter_execute(ctx, s->filter_horizontally, &td, + NULL, FFMIN(height, nb_threads)); td.ptr = out->data[plane]; td.linesize = out->linesize[plane]; - ctx->internal->execute(ctx, s->filter_vertically, &td, NULL, FFMIN(width, nb_threads)); + ff_filter_execute(ctx, s->filter_vertically, &td, + NULL, FFMIN(width, nb_threads)); } static int query_formats(AVFilterContext *ctx) @@ -246,7 +248,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int filter_frame(AVFilterLink *inlink, AVFrame *in) @@ -302,7 +304,6 @@ static const AVFilterPad avgblur_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad avgblur_outputs[] = { @@ -310,7 +311,6 @@ static const AVFilterPad avgblur_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_avgblur = { @@ -320,8 +320,8 @@ const AVFilter ff_vf_avgblur = { .priv_class = &avgblur_class, .uninit = uninit, .query_formats = query_formats, - .inputs = avgblur_inputs, - .outputs = avgblur_outputs, + FILTER_INPUTS(avgblur_inputs), + FILTER_OUTPUTS(avgblur_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = ff_filter_process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_avgblur_opencl.c b/chromium/third_party/ffmpeg/libavfilter/vf_avgblur_opencl.c index 3b9e56b8790..e9a3bc6100f 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_avgblur_opencl.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_avgblur_opencl.c @@ -311,7 +311,6 @@ static const AVFilterPad avgblur_opencl_inputs[] = { .filter_frame = &avgblur_opencl_filter_frame, .config_props = &ff_opencl_filter_config_input, }, - { NULL } }; @@ -321,7 +320,6 @@ static const AVFilterPad avgblur_opencl_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = &ff_opencl_filter_config_output, }, - { NULL } }; @@ -348,8 +346,8 @@ const AVFilter ff_vf_avgblur_opencl = { .init = &ff_opencl_filter_init, .uninit = &avgblur_opencl_uninit, .query_formats = &ff_opencl_filter_query_formats, - .inputs = avgblur_opencl_inputs, - .outputs = avgblur_opencl_outputs, + FILTER_INPUTS(avgblur_opencl_inputs), + FILTER_OUTPUTS(avgblur_opencl_outputs), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; @@ -387,8 +385,8 @@ const AVFilter ff_vf_boxblur_opencl = { .init = &ff_opencl_filter_init, .uninit = &avgblur_opencl_uninit, .query_formats = &ff_opencl_filter_query_formats, - .inputs = avgblur_opencl_inputs, - .outputs = avgblur_opencl_outputs, + FILTER_INPUTS(avgblur_opencl_inputs), + FILTER_OUTPUTS(avgblur_opencl_outputs), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_avgblur_vulkan.c b/chromium/third_party/ffmpeg/libavfilter/vf_avgblur_vulkan.c index 1e485061cd6..5ae487fc8cc 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_avgblur_vulkan.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_avgblur_vulkan.c @@ -386,7 +386,6 @@ static const AVFilterPad avgblur_vulkan_inputs[] = { .filter_frame = &avgblur_vulkan_filter_frame, .config_props = &ff_vk_filter_config_input, }, - { NULL } }; static const AVFilterPad avgblur_vulkan_outputs[] = { @@ -395,7 +394,6 @@ static const AVFilterPad avgblur_vulkan_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = &ff_vk_filter_config_output, }, - { NULL } }; const AVFilter ff_vf_avgblur_vulkan = { @@ -405,8 +403,8 @@ const AVFilter ff_vf_avgblur_vulkan = { .init = &ff_vk_filter_init, .uninit = &avgblur_vulkan_uninit, .query_formats = &ff_vk_filter_query_formats, - .inputs = avgblur_vulkan_inputs, - .outputs = avgblur_vulkan_outputs, + FILTER_INPUTS(avgblur_vulkan_inputs), + FILTER_OUTPUTS(avgblur_vulkan_outputs), .priv_class = &avgblur_vulkan_class, .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_bbox.c b/chromium/third_party/ffmpeg/libavfilter/vf_bbox.c index 849e75646ba..9f03db3cfdb 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_bbox.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_bbox.c @@ -72,10 +72,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE, }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } #define SET_META(key, value) \ @@ -141,7 +138,6 @@ static const AVFilterPad bbox_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad bbox_outputs[] = { @@ -150,7 +146,6 @@ static const AVFilterPad bbox_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_bbox = { @@ -159,8 +154,8 @@ const AVFilter ff_vf_bbox = { .priv_size = sizeof(BBoxContext), .priv_class = &bbox_class, .query_formats = query_formats, - .inputs = bbox_inputs, - .outputs = bbox_outputs, + FILTER_INPUTS(bbox_inputs), + FILTER_OUTPUTS(bbox_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, .process_command = ff_filter_process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_bilateral.c b/chromium/third_party/ffmpeg/libavfilter/vf_bilateral.c index 7b9bd9737aa..6d7fa8b30df 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_bilateral.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_bilateral.c @@ -89,7 +89,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_params(AVFilterContext *ctx) @@ -368,7 +368,6 @@ static const AVFilterPad bilateral_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad bilateral_outputs[] = { @@ -376,7 +375,6 @@ static const AVFilterPad bilateral_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_bilateral = { @@ -386,8 +384,8 @@ const AVFilter ff_vf_bilateral = { .priv_class = &bilateral_class, .uninit = uninit, .query_formats = query_formats, - .inputs = bilateral_inputs, - .outputs = bilateral_outputs, + FILTER_INPUTS(bilateral_inputs), + FILTER_OUTPUTS(bilateral_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, .process_command = process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_bitplanenoise.c b/chromium/third_party/ffmpeg/libavfilter/vf_bitplanenoise.c index 284c2966cf9..d45dd7777f4 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_bitplanenoise.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_bitplanenoise.c @@ -67,10 +67,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *formats = ff_make_format_list(pixfmts); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixfmts); } static int config_input(AVFilterLink *inlink) @@ -203,7 +200,6 @@ static const AVFilterPad inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -211,7 +207,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_bitplanenoise = { @@ -219,8 +214,8 @@ const AVFilter ff_vf_bitplanenoise = { .description = NULL_IF_CONFIG_SMALL("Measure bit plane noise."), .priv_size = sizeof(BPNContext), .query_formats = query_formats, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .priv_class = &bitplanenoise_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_blackdetect.c b/chromium/third_party/ffmpeg/libavfilter/vf_blackdetect.c index 9f6b293b541..b3a03c6e91c 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_blackdetect.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_blackdetect.c @@ -98,10 +98,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) @@ -191,8 +188,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref) BlackDetectContext *s = ctx->priv; double picture_black_ratio = 0; - ctx->internal->execute(ctx, black_counter, picref, NULL, - FFMIN(inlink->h, s->nb_threads)); + ff_filter_execute(ctx, black_counter, picref, NULL, + FFMIN(inlink->h, s->nb_threads)); for (int i = 0; i < s->nb_threads; i++) s->nb_black_pixels += s->counter[i]; @@ -247,7 +244,6 @@ static const AVFilterPad blackdetect_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad blackdetect_outputs[] = { @@ -255,7 +251,6 @@ static const AVFilterPad blackdetect_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_blackdetect = { @@ -263,8 +258,8 @@ const AVFilter ff_vf_blackdetect = { .description = NULL_IF_CONFIG_SMALL("Detect video intervals that are (almost) black."), .priv_size = sizeof(BlackDetectContext), .query_formats = query_formats, - .inputs = blackdetect_inputs, - .outputs = blackdetect_outputs, + FILTER_INPUTS(blackdetect_inputs), + FILTER_OUTPUTS(blackdetect_outputs), .uninit = uninit, .priv_class = &blackdetect_class, .flags = AVFILTER_FLAG_SLICE_THREADS, diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_blackframe.c b/chromium/third_party/ffmpeg/libavfilter/vf_blackframe.c index b82c044f3ed..ac7f7347c6d 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_blackframe.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_blackframe.c @@ -54,10 +54,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } #define SET_META(key, format, value) \ @@ -121,7 +118,6 @@ static const AVFilterPad avfilter_vf_blackframe_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad avfilter_vf_blackframe_outputs[] = { @@ -129,7 +125,6 @@ static const AVFilterPad avfilter_vf_blackframe_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO }, - { NULL } }; const AVFilter ff_vf_blackframe = { @@ -138,6 +133,6 @@ const AVFilter ff_vf_blackframe = { .priv_size = sizeof(BlackFrameContext), .priv_class = &blackframe_class, .query_formats = query_formats, - .inputs = avfilter_vf_blackframe_inputs, - .outputs = avfilter_vf_blackframe_outputs, + FILTER_INPUTS(avfilter_vf_blackframe_inputs), + FILTER_OUTPUTS(avfilter_vf_blackframe_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_blend.c b/chromium/third_party/ffmpeg/libavfilter/vf_blend.c index 0b33107b79b..84f1e9f5bb8 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_blend.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_blend.c @@ -147,12 +147,12 @@ static void blend_normal_8bit(const uint8_t *top, ptrdiff_t top_linesize, ptrdiff_t width, ptrdiff_t height, FilterParams *param, double *values, int starty) { - const double opacity = param->opacity; + const float opacity = param->opacity; int i, j; for (i = 0; i < height; i++) { for (j = 0; j < width; j++) { - dst[j] = top[j] * opacity + bottom[j] * (1. - opacity); + dst[j] = top[j] * opacity + bottom[j] * (1.f - opacity); } dst += dst_linesize; top += top_linesize; @@ -169,7 +169,7 @@ static void blend_normal_16bit(const uint8_t *_top, ptrdiff_t top_linesize, const uint16_t *top = (uint16_t*)_top; const uint16_t *bottom = (uint16_t*)_bottom; uint16_t *dst = (uint16_t*)_dst; - const double opacity = param->opacity; + const float opacity = param->opacity; int i, j; dst_linesize /= 2; top_linesize /= 2; @@ -177,7 +177,7 @@ static void blend_normal_16bit(const uint8_t *_top, ptrdiff_t top_linesize, for (i = 0; i < height; i++) { for (j = 0; j < width; j++) { - dst[j] = top[j] * opacity + bottom[j] * (1. - opacity); + dst[j] = top[j] * opacity + bottom[j] * (1.f - opacity); } dst += dst_linesize; top += top_linesize; @@ -194,7 +194,7 @@ static void blend_normal_32bit(const uint8_t *_top, ptrdiff_t top_linesize, const float *top = (float*)_top; const float *bottom = (float*)_bottom; float *dst = (float*)_dst; - const double opacity = param->opacity; + const float opacity = param->opacity; int i, j; dst_linesize /= 4; top_linesize /= 4; @@ -202,7 +202,7 @@ static void blend_normal_32bit(const uint8_t *_top, ptrdiff_t top_linesize, for (i = 0; i < height; i++) { for (j = 0; j < width; j++) { - dst[j] = top[j] * opacity + bottom[j] * (1. - opacity); + dst[j] = top[j] * opacity + bottom[j] * (1.f - opacity); } dst += dst_linesize; top += top_linesize; @@ -217,7 +217,7 @@ static void blend_## name##_8bit(const uint8_t *top, ptrdiff_t top_linesize, ptrdiff_t width, ptrdiff_t height, \ FilterParams *param, double *values, int starty) \ { \ - double opacity = param->opacity; \ + const float opacity = param->opacity; \ int i, j; \ \ for (i = 0; i < height; i++) { \ @@ -240,7 +240,7 @@ static void blend_## name##_##depth##bit(const uint8_t *_top, ptrdiff_t top_line const uint16_t *top = (const uint16_t*)_top; \ const uint16_t *bottom = (const uint16_t*)_bottom; \ uint16_t *dst = (uint16_t*)_dst; \ - double opacity = param->opacity; \ + const float opacity = param->opacity; \ int i, j; \ dst_linesize /= 2; \ top_linesize /= 2; \ @@ -266,7 +266,7 @@ static void blend_## name##_##depth##bit(const uint8_t *_top, ptrdiff_t top_line const float *top = (const float*)_top; \ const float *bottom = (const float*)_bottom; \ float *dst = (float*)_dst; \ - double opacity = param->opacity; \ + const float opacity = param->opacity; \ int i, j; \ dst_linesize /= 4; \ top_linesize /= 4; \ @@ -624,7 +624,8 @@ static AVFrame *blend_frame(AVFilterContext *ctx, AVFrame *top_buf, .w = outw, .h = outh, .param = param, .plane = plane, .inlink = inlink }; - ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(outh, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_slice, &td, NULL, + FFMIN(outh, ff_filter_get_nb_threads(ctx))); } if (!s->tblend) @@ -680,10 +681,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static av_cold void uninit(AVFilterContext *ctx) @@ -894,7 +892,6 @@ static const AVFilterPad blend_inputs[] = { .name = "bottom", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; static const AVFilterPad blend_outputs[] = { @@ -903,7 +900,6 @@ static const AVFilterPad blend_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_blend = { @@ -915,8 +911,8 @@ const AVFilter ff_vf_blend = { .priv_size = sizeof(BlendContext), .query_formats = query_formats, .activate = activate, - .inputs = blend_inputs, - .outputs = blend_outputs, + FILTER_INPUTS(blend_inputs), + FILTER_OUTPUTS(blend_outputs), .priv_class = &blend_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, .process_command = process_command, @@ -956,7 +952,6 @@ static const AVFilterPad tblend_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = tblend_filter_frame, }, - { NULL } }; static const AVFilterPad tblend_outputs[] = { @@ -965,7 +960,6 @@ static const AVFilterPad tblend_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_tblend = { @@ -976,8 +970,8 @@ const AVFilter ff_vf_tblend = { .query_formats = query_formats, .init = init, .uninit = uninit, - .inputs = tblend_inputs, - .outputs = tblend_outputs, + FILTER_INPUTS(tblend_inputs), + FILTER_OUTPUTS(tblend_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, .process_command = process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_bm3d.c b/chromium/third_party/ffmpeg/libavfilter/vf_bm3d.c index f719e79cb0b..198fc432685 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_bm3d.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_bm3d.c @@ -188,10 +188,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int do_search_boundary(int pos, int plane_boundary, int search_range, int search_step) @@ -766,7 +763,7 @@ static int filter_frame(AVFilterContext *ctx, AVFrame **out, AVFrame *in, AVFram td.ref = ref->data[p]; td.ref_linesize = ref->linesize[p]; td.plane = p; - ctx->internal->execute(ctx, filter_slice, &td, NULL, nb_jobs); + ff_filter_execute(ctx, filter_slice, &td, NULL, nb_jobs); s->do_output(s, (*out)->data[p], (*out)->linesize[p], p, nb_jobs); } @@ -944,7 +941,7 @@ static av_cold int init(AVFilterContext *ctx) pad.name = "source"; pad.config_props = config_input; - if ((ret = ff_insert_inpad(ctx, 0, &pad)) < 0) + if ((ret = ff_append_inpad(ctx, &pad)) < 0) return ret; if (s->ref) { @@ -952,7 +949,7 @@ static av_cold int init(AVFilterContext *ctx) pad.name = "reference"; pad.config_props = NULL; - if ((ret = ff_insert_inpad(ctx, 1, &pad)) < 0) + if ((ret = ff_append_inpad(ctx, &pad)) < 0) return ret; } @@ -1051,7 +1048,6 @@ static const AVFilterPad bm3d_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_bm3d = { @@ -1063,7 +1059,7 @@ const AVFilter ff_vf_bm3d = { .activate = activate, .query_formats = query_formats, .inputs = NULL, - .outputs = bm3d_outputs, + FILTER_OUTPUTS(bm3d_outputs), .priv_class = &bm3d_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_DYNAMIC_INPUTS | diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_boxblur.c b/chromium/third_party/ffmpeg/libavfilter/vf_boxblur.c index bebbd4ef083..3ace88e5b6c 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_boxblur.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_boxblur.c @@ -293,7 +293,6 @@ static const AVFilterPad avfilter_vf_boxblur_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad avfilter_vf_boxblur_outputs[] = { @@ -301,7 +300,6 @@ static const AVFilterPad avfilter_vf_boxblur_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_boxblur = { @@ -311,7 +309,7 @@ const AVFilter ff_vf_boxblur = { .priv_class = &boxblur_class, .uninit = uninit, .query_formats = query_formats, - .inputs = avfilter_vf_boxblur_inputs, - .outputs = avfilter_vf_boxblur_outputs, + FILTER_INPUTS(avfilter_vf_boxblur_inputs), + FILTER_OUTPUTS(avfilter_vf_boxblur_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_bwdif.c b/chromium/third_party/ffmpeg/libavfilter/vf_bwdif.c index 228067c8e5f..7f3fb0034bf 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_bwdif.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_bwdif.c @@ -279,7 +279,8 @@ static void filter(AVFilterContext *ctx, AVFrame *dstpic, td.h = h; td.plane = i; - ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_slice, &td, NULL, + FFMIN(h, ff_filter_get_nb_threads(ctx))); } if (yadif->current_field == YADIF_FIELD_END) { yadif->current_field = YADIF_FIELD_NORMAL; @@ -321,11 +322,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_props(AVFilterLink *link) @@ -395,7 +392,6 @@ static const AVFilterPad avfilter_vf_bwdif_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = ff_yadif_filter_frame, }, - { NULL } }; static const AVFilterPad avfilter_vf_bwdif_outputs[] = { @@ -405,7 +401,6 @@ static const AVFilterPad avfilter_vf_bwdif_outputs[] = { .request_frame = ff_yadif_request_frame, .config_props = config_props, }, - { NULL } }; const AVFilter ff_vf_bwdif = { @@ -415,7 +410,7 @@ const AVFilter ff_vf_bwdif = { .priv_class = &bwdif_class, .uninit = uninit, .query_formats = query_formats, - .inputs = avfilter_vf_bwdif_inputs, - .outputs = avfilter_vf_bwdif_outputs, + FILTER_INPUTS(avfilter_vf_bwdif_inputs), + FILTER_OUTPUTS(avfilter_vf_bwdif_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_cas.c b/chromium/third_party/ffmpeg/libavfilter/vf_cas.c index c5a53adfe97..d28932a62b5 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_cas.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_cas.c @@ -193,8 +193,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) av_frame_copy_props(out, in); s->in = in; - ctx->internal->execute(ctx, s->do_slice, out, NULL, - FFMIN(in->height, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->do_slice, out, NULL, + FFMIN(in->height, ff_filter_get_nb_threads(ctx))); av_frame_free(&in); s->in = NULL; @@ -230,13 +230,7 @@ static av_cold int query_formats(AVFilterContext *avctx) AV_PIX_FMT_NONE }; - AVFilterFormats *formats = NULL; - - formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - - return ff_set_common_formats(avctx, formats); + return ff_set_common_formats_from_list(avctx, pixel_fmts); } static av_cold int config_input(AVFilterLink *inlink) @@ -264,7 +258,6 @@ static const AVFilterPad cas_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad cas_outputs[] = { @@ -272,7 +265,6 @@ static const AVFilterPad cas_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; #define OFFSET(x) offsetof(CASContext, x) @@ -292,8 +284,8 @@ const AVFilter ff_vf_cas = { .priv_size = sizeof(CASContext), .priv_class = &cas_class, .query_formats = query_formats, - .inputs = cas_inputs, - .outputs = cas_outputs, + FILTER_INPUTS(cas_inputs), + FILTER_OUTPUTS(cas_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = ff_filter_process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_chromaber_vulkan.c b/chromium/third_party/ffmpeg/libavfilter/vf_chromaber_vulkan.c index 2f5bf7bbb9d..96fdd7bd9ce 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_chromaber_vulkan.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_chromaber_vulkan.c @@ -321,7 +321,6 @@ static const AVFilterPad chromaber_vulkan_inputs[] = { .filter_frame = &chromaber_vulkan_filter_frame, .config_props = &ff_vk_filter_config_input, }, - { NULL } }; static const AVFilterPad chromaber_vulkan_outputs[] = { @@ -330,7 +329,6 @@ static const AVFilterPad chromaber_vulkan_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = &ff_vk_filter_config_output, }, - { NULL } }; const AVFilter ff_vf_chromaber_vulkan = { @@ -340,8 +338,8 @@ const AVFilter ff_vf_chromaber_vulkan = { .init = &ff_vk_filter_init, .uninit = &chromaber_vulkan_uninit, .query_formats = &ff_vk_filter_query_formats, - .inputs = chromaber_vulkan_inputs, - .outputs = chromaber_vulkan_outputs, + FILTER_INPUTS(chromaber_vulkan_inputs), + FILTER_OUTPUTS(chromaber_vulkan_outputs), .priv_class = &chromaber_vulkan_class, .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_chromakey.c b/chromium/third_party/ffmpeg/libavfilter/vf_chromakey.c index 45d8e43c2c8..304cb9ee6c8 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_chromakey.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_chromakey.c @@ -197,7 +197,7 @@ static int do_chromahold_slice(AVFilterContext *avctx, void *arg, int jobnr, int du = u - ctx->chromakey_uv[0]; dv = v - ctx->chromakey_uv[1]; - diff = sqrt((du * du + dv * dv) / (255.0 * 255.0)); + diff = sqrt((du * du + dv * dv) / (255.0 * 255.0 * 2.0)); alpha = diff > ctx->similarity; if (ctx->blend > 0.0001) { @@ -236,7 +236,7 @@ static int do_chromahold16_slice(AVFilterContext *avctx, void *arg, int jobnr, i du = u - ctx->chromakey_uv[0]; dv = v - ctx->chromakey_uv[1]; - diff = sqrt((du * du + dv * dv) / (max * max)); + diff = sqrt((du * du + dv * dv) / (max * max * 2.0)); alpha = diff > ctx->similarity; if (ctx->blend > 0.0001) { @@ -260,7 +260,8 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame) ChromakeyContext *ctx = avctx->priv; int res; - if (res = avctx->internal->execute(avctx, ctx->do_slice, frame, NULL, FFMIN(frame->height, ff_filter_get_nb_threads(avctx)))) + if (res = ff_filter_execute(avctx, ctx->do_slice, frame, NULL, + FFMIN(frame->height, ff_filter_get_nb_threads(avctx)))) return res; return ff_filter_frame(avctx->outputs[0], frame); @@ -331,14 +332,11 @@ static av_cold int query_formats(AVFilterContext *avctx) AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_YUVA422P16, AV_PIX_FMT_YUVA444P16, AV_PIX_FMT_NONE }; + const enum AVPixelFormat *pix_fmts; - AVFilterFormats *formats = NULL; + pix_fmts = !strcmp(avctx->filter->name, "chromahold") ? hold_pixel_fmts : pixel_fmts; - formats = ff_make_format_list(!strcmp(avctx->filter->name, "chromahold") ? hold_pixel_fmts : pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - - return ff_set_common_formats(avctx, formats); + return ff_set_common_formats_from_list(avctx, pix_fmts); } static av_cold int config_input(AVFilterLink *inlink) @@ -369,11 +367,10 @@ static const AVFilterPad chromakey_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .needs_writable = 1, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad chromakey_outputs[] = { @@ -382,7 +379,6 @@ static const AVFilterPad chromakey_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; #define OFFSET(x) offsetof(ChromakeyContext, x) @@ -404,8 +400,8 @@ const AVFilter ff_vf_chromakey = { .priv_size = sizeof(ChromakeyContext), .priv_class = &chromakey_class, .query_formats = query_formats, - .inputs = chromakey_inputs, - .outputs = chromakey_outputs, + FILTER_INPUTS(chromakey_inputs), + FILTER_OUTPUTS(chromakey_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = process_command, }; @@ -422,11 +418,10 @@ static const AVFilterPad chromahold_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .needs_writable = 1, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad chromahold_outputs[] = { @@ -435,7 +430,6 @@ static const AVFilterPad chromahold_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; AVFILTER_DEFINE_CLASS(chromahold); @@ -446,8 +440,8 @@ const AVFilter ff_vf_chromahold = { .priv_size = sizeof(ChromakeyContext), .priv_class = &chromahold_class, .query_formats = query_formats, - .inputs = chromahold_inputs, - .outputs = chromahold_outputs, + FILTER_INPUTS(chromahold_inputs), + FILTER_OUTPUTS(chromahold_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_chromanr.c b/chromium/third_party/ffmpeg/libavfilter/vf_chromanr.c index 810fd2ce9d1..fe9bca1d9dd 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_chromanr.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_chromanr.c @@ -74,10 +74,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } #define SQR(x) ((x)*(x)) @@ -211,10 +208,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) av_frame_copy_props(out, in); s->out = out; - ctx->internal->execute(ctx, s->filter_slice, in, NULL, - FFMIN3(s->planeheight[1], - s->planeheight[2], - ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->filter_slice, in, NULL, + FFMIN3(s->planeheight[1], + s->planeheight[2], + ff_filter_get_nb_threads(ctx))); av_frame_free(&in); return ff_filter_frame(outlink, out); @@ -267,7 +264,6 @@ static const AVFilterPad inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -275,7 +271,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; AVFILTER_DEFINE_CLASS(chromanr); @@ -286,8 +281,8 @@ const AVFilter ff_vf_chromanr = { .priv_size = sizeof(ChromaNRContext), .priv_class = &chromanr_class, .query_formats = query_formats, - .outputs = outputs, - .inputs = inputs, + FILTER_OUTPUTS(outputs), + FILTER_INPUTS(inputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = ff_filter_process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_chromashift.c b/chromium/third_party/ffmpeg/libavfilter/vf_chromashift.c index 3f172a8e2b3..bcff4144e3c 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_chromashift.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_chromashift.c @@ -76,17 +76,13 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; const enum AVPixelFormat *pix_fmts; - AVFilterFormats *fmts_list; if (!strcmp(ctx->filter->name, "rgbashift")) pix_fmts = rgb_pix_fmts; else pix_fmts = yuv_pix_fmts; - fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } #define DEFINE_SMEAR(depth, type, div) \ @@ -363,10 +359,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) in->data[0], in->linesize[0], s->linesize[0], s->height[0]); } - ctx->internal->execute(ctx, s->filter_slice, out, NULL, - FFMIN3(s->height[1], - s->height[2], - ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->filter_slice, out, NULL, + FFMIN3(s->height[1], + s->height[2], + ff_filter_get_nb_threads(ctx))); s->in = NULL; av_frame_free(&in); return ff_filter_frame(outlink, out); @@ -433,7 +429,6 @@ static const AVFilterPad inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -441,7 +436,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; AVFILTER_DEFINE_CLASS(chromashift); @@ -452,8 +446,8 @@ const AVFilter ff_vf_chromashift = { .priv_size = sizeof(ChromaShiftContext), .priv_class = &chromashift_class, .query_formats = query_formats, - .outputs = outputs, - .inputs = inputs, + FILTER_OUTPUTS(outputs), + FILTER_INPUTS(inputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = process_command, }; @@ -481,8 +475,8 @@ const AVFilter ff_vf_rgbashift = { .priv_size = sizeof(ChromaShiftContext), .priv_class = &rgbashift_class, .query_formats = query_formats, - .outputs = outputs, - .inputs = inputs, + FILTER_OUTPUTS(outputs), + FILTER_INPUTS(inputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_ciescope.c b/chromium/third_party/ffmpeg/libavfilter/vf_ciescope.c index cafdb915ea2..b09012920cd 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_ciescope.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_ciescope.c @@ -1492,7 +1492,6 @@ static const AVFilterPad inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -1501,7 +1500,6 @@ static const AVFilterPad outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_ciescope = { @@ -1511,6 +1509,6 @@ const AVFilter ff_vf_ciescope = { .priv_class = &ciescope_class, .query_formats = query_formats, .uninit = uninit, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_codecview.c b/chromium/third_party/ffmpeg/libavfilter/vf_codecview.c index e3c613f10c1..dc3d3acd824 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_codecview.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_codecview.c @@ -83,10 +83,7 @@ static int query_formats(AVFilterContext *ctx) // TODO: we can probably add way more pixel formats without any other // changes; anything with 8-bit luma in first plane should be working static const enum AVPixelFormat pix_fmts[] = {AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE}; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int clip_line(int *sx, int *sy, int *ex, int *ey, int maxx) @@ -303,11 +300,10 @@ static const AVFilterPad codecview_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = filter_frame, .config_props = config_input, - .needs_writable = 1, }, - { NULL } }; static const AVFilterPad codecview_outputs[] = { @@ -315,7 +311,6 @@ static const AVFilterPad codecview_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_codecview = { @@ -323,8 +318,8 @@ const AVFilter ff_vf_codecview = { .description = NULL_IF_CONFIG_SMALL("Visualize information about some codecs."), .priv_size = sizeof(CodecViewContext), .query_formats = query_formats, - .inputs = codecview_inputs, - .outputs = codecview_outputs, + FILTER_INPUTS(codecview_inputs), + FILTER_OUTPUTS(codecview_outputs), .priv_class = &codecview_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_colorbalance.c b/chromium/third_party/ffmpeg/libavfilter/vf_colorbalance.c index 4e13ce97b9a..23235347e9b 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_colorbalance.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_colorbalance.c @@ -92,10 +92,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRP16, AV_PIX_FMT_GBRAP16, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static float get_component(float v, float l, @@ -414,7 +411,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.in = in; td.out = out; - ctx->internal->execute(ctx, s->color_balance, &td, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->color_balance, &td, NULL, + FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); if (in != out) av_frame_free(&in); @@ -427,7 +425,6 @@ static const AVFilterPad colorbalance_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad colorbalance_outputs[] = { @@ -436,7 +433,6 @@ static const AVFilterPad colorbalance_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_colorbalance = { @@ -445,8 +441,8 @@ const AVFilter ff_vf_colorbalance = { .priv_size = sizeof(ColorBalanceContext), .priv_class = &colorbalance_class, .query_formats = query_formats, - .inputs = colorbalance_inputs, - .outputs = colorbalance_outputs, + FILTER_INPUTS(colorbalance_inputs), + FILTER_OUTPUTS(colorbalance_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = ff_filter_process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_colorchannelmixer.c b/chromium/third_party/ffmpeg/libavfilter/vf_colorchannelmixer.c index 9a538ddf5ff..76722523a76 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_colorchannelmixer.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_colorchannelmixer.c @@ -100,10 +100,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static float lerpf(float v0, float v1, float f) @@ -756,7 +753,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.in = in; td.out = out; - ctx->internal->execute(ctx, s->filter_slice[pl], &td, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->filter_slice[pl], &td, NULL, + FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); if (in != out) av_frame_free(&in); @@ -787,7 +785,6 @@ static const AVFilterPad colorchannelmixer_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad colorchannelmixer_outputs[] = { @@ -796,7 +793,6 @@ static const AVFilterPad colorchannelmixer_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_colorchannelmixer = { @@ -806,8 +802,8 @@ const AVFilter ff_vf_colorchannelmixer = { .priv_class = &colorchannelmixer_class, .uninit = uninit, .query_formats = query_formats, - .inputs = colorchannelmixer_inputs, - .outputs = colorchannelmixer_outputs, + FILTER_INPUTS(colorchannelmixer_inputs), + FILTER_OUTPUTS(colorchannelmixer_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_colorconstancy.c b/chromium/third_party/ffmpeg/libavfilter/vf_colorconstancy.c index e44d9afa019..25a17788c3d 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_colorconstancy.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_colorconstancy.c @@ -366,7 +366,8 @@ get_deriv(AVFilterContext *ctx, ThreadData *td, int ord, int dir, td->meta_data[INDEX_DIR] = dir; td->meta_data[INDEX_SRC] = src; td->meta_data[INDEX_DST] = dst; - ctx->internal->execute(ctx, slice_get_derivative, td, NULL, FFMIN(dim, nb_threads)); + ff_filter_execute(ctx, slice_get_derivative, td, + NULL, FFMIN(dim, nb_threads)); } /** @@ -500,10 +501,10 @@ static int filter_grey_edge(AVFilterContext *ctx, AVFrame *in) } get_derivative(ctx, &td); if (difford > 0) { - ctx->internal->execute(ctx, slice_normalize, &td, NULL, nb_jobs); + ff_filter_execute(ctx, slice_normalize, &td, NULL, nb_jobs); } - ctx->internal->execute(ctx, filter_slice_grey_edge, &td, NULL, nb_jobs); + ff_filter_execute(ctx, filter_slice_grey_edge, &td, NULL, nb_jobs); if (!minknorm) { for (plane = 0; plane < NUM_PLANES; ++plane) { white[plane] = 0; // All values are absolute @@ -631,7 +632,7 @@ static void chromatic_adaptation(AVFilterContext *ctx, AVFrame *in, AVFrame *out td.in = in; td.out = out; - ctx->internal->execute(ctx, diagonal_transformation, &td, NULL, nb_jobs); + ff_filter_execute(ctx, diagonal_transformation, &td, NULL, nb_jobs); } static int query_formats(AVFilterContext *ctx) @@ -643,7 +644,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_props(AVFilterLink *inlink) @@ -725,7 +726,6 @@ static const AVFilterPad colorconstancy_inputs[] = { .config_props = config_props, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad colorconstancy_outputs[] = { @@ -733,7 +733,6 @@ static const AVFilterPad colorconstancy_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; #if CONFIG_GREYEDGE_FILTER @@ -754,8 +753,8 @@ const AVFilter ff_vf_greyedge = { .priv_class = &greyedge_class, .query_formats = query_formats, .uninit = uninit, - .inputs = colorconstancy_inputs, - .outputs = colorconstancy_outputs, + FILTER_INPUTS(colorconstancy_inputs), + FILTER_OUTPUTS(colorconstancy_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_colorcontrast.c b/chromium/third_party/ffmpeg/libavfilter/vf_colorcontrast.c index b5b547b46f8..e89b3e7af43 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_colorcontrast.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_colorcontrast.c @@ -303,8 +303,8 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame) ColorContrastContext *s = ctx->priv; int res; - if (res = ctx->internal->execute(ctx, s->do_slice, frame, NULL, - FFMIN(frame->height, ff_filter_get_nb_threads(ctx)))) + if (res = ff_filter_execute(ctx, s->do_slice, frame, NULL, + FFMIN(frame->height, ff_filter_get_nb_threads(ctx)))) return res; return ff_filter_frame(ctx->outputs[0], frame); @@ -327,13 +327,7 @@ static av_cold int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *formats = NULL; - - formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } static av_cold int config_input(AVFilterLink *inlink) @@ -364,11 +358,10 @@ static const AVFilterPad colorcontrast_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .needs_writable = 1, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad colorcontrast_outputs[] = { @@ -376,7 +369,6 @@ static const AVFilterPad colorcontrast_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; #define OFFSET(x) offsetof(ColorContrastContext, x) @@ -401,8 +393,8 @@ const AVFilter ff_vf_colorcontrast = { .priv_size = sizeof(ColorContrastContext), .priv_class = &colorcontrast_class, .query_formats = query_formats, - .inputs = colorcontrast_inputs, - .outputs = colorcontrast_outputs, + FILTER_INPUTS(colorcontrast_inputs), + FILTER_OUTPUTS(colorcontrast_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = ff_filter_process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_colorcorrect.c b/chromium/third_party/ffmpeg/libavfilter/vf_colorcorrect.c index 13ef50ad1db..2570bb105c3 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_colorcorrect.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_colorcorrect.c @@ -27,26 +27,288 @@ #include "internal.h" #include "video.h" +typedef enum AnalyzeMode { + MANUAL, + AVERAGE, + MINMAX, + MEDIAN, + NB_ANALYZE +} AnalyzeMode; + typedef struct ColorCorrectContext { const AVClass *class; float rl, bl; float rh, bh; float saturation; + int analyze; int depth; + float max, imax; + + int chroma_w, chroma_h; + int planeheight[4]; + int planewidth[4]; + + unsigned *uhistogram; + unsigned *vhistogram; + float (*analyzeret)[4]; + + int (*do_analyze)(AVFilterContext *s, void *arg, + int jobnr, int nb_jobs); int (*do_slice)(AVFilterContext *s, void *arg, int jobnr, int nb_jobs); } ColorCorrectContext; +static int average_slice8(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) +{ + ColorCorrectContext *s = ctx->priv; + AVFrame *frame = arg; + const float imax = s->imax; + const int width = s->planewidth[1]; + const int height = s->planeheight[1]; + const int slice_start = (height * jobnr) / nb_jobs; + const int slice_end = (height * (jobnr + 1)) / nb_jobs; + const int ulinesize = frame->linesize[1]; + const int vlinesize = frame->linesize[2]; + const uint8_t *uptr = (const uint8_t *)frame->data[1] + slice_start * ulinesize; + const uint8_t *vptr = (const uint8_t *)frame->data[2] + slice_start * vlinesize; + int sum_u = 0, sum_v = 0; + + for (int y = slice_start; y < slice_end; y++) { + for (int x = 0; x < width; x++) { + sum_u += uptr[x]; + sum_v += vptr[x]; + } + + uptr += ulinesize; + vptr += vlinesize; + } + + s->analyzeret[jobnr][0] = s->analyzeret[jobnr][2] = imax * sum_u / (float)((slice_end - slice_start) * width) - 0.5f; + s->analyzeret[jobnr][1] = s->analyzeret[jobnr][3] = imax * sum_v / (float)((slice_end - slice_start) * width) - 0.5f; + + return 0; +} + +static int average_slice16(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) +{ + ColorCorrectContext *s = ctx->priv; + AVFrame *frame = arg; + const float imax = s->imax; + const int width = s->planewidth[1]; + const int height = s->planeheight[1]; + const int slice_start = (height * jobnr) / nb_jobs; + const int slice_end = (height * (jobnr + 1)) / nb_jobs; + const int ulinesize = frame->linesize[1] / 2; + const int vlinesize = frame->linesize[2] / 2; + const uint16_t *uptr = (const uint16_t *)frame->data[1] + slice_start * ulinesize; + const uint16_t *vptr = (const uint16_t *)frame->data[2] + slice_start * vlinesize; + int64_t sum_u = 0, sum_v = 0; + + for (int y = slice_start; y < slice_end; y++) { + for (int x = 0; x < width; x++) { + sum_u += uptr[x]; + sum_v += vptr[x]; + } + + uptr += ulinesize; + vptr += vlinesize; + } + + s->analyzeret[jobnr][0] = s->analyzeret[jobnr][2] = imax * sum_u / (float)((slice_end - slice_start) * width) - 0.5f; + s->analyzeret[jobnr][1] = s->analyzeret[jobnr][3] = imax * sum_v / (float)((slice_end - slice_start) * width) - 0.5f; + + return 0; +} + +static int minmax_slice8(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) +{ + ColorCorrectContext *s = ctx->priv; + AVFrame *frame = arg; + const float imax = s->imax; + const int width = s->planewidth[1]; + const int height = s->planeheight[1]; + const int slice_start = (height * jobnr) / nb_jobs; + const int slice_end = (height * (jobnr + 1)) / nb_jobs; + const int ulinesize = frame->linesize[1]; + const int vlinesize = frame->linesize[2]; + const uint8_t *uptr = (const uint8_t *)frame->data[1] + slice_start * ulinesize; + const uint8_t *vptr = (const uint8_t *)frame->data[2] + slice_start * vlinesize; + int min_u = 255, min_v = 255; + int max_u = 0, max_v = 0; + + for (int y = slice_start; y < slice_end; y++) { + for (int x = 0; x < width; x++) { + min_u = FFMIN(min_u, uptr[x]); + min_v = FFMIN(min_v, vptr[x]); + max_u = FFMAX(max_u, uptr[x]); + max_v = FFMAX(max_v, vptr[x]); + } + + uptr += ulinesize; + vptr += vlinesize; + } + + s->analyzeret[jobnr][0] = imax * min_u - 0.5f; + s->analyzeret[jobnr][1] = imax * min_v - 0.5f; + s->analyzeret[jobnr][2] = imax * max_u - 0.5f; + s->analyzeret[jobnr][3] = imax * max_v - 0.5f; + + return 0; +} + +static int minmax_slice16(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) +{ + ColorCorrectContext *s = ctx->priv; + AVFrame *frame = arg; + const float imax = s->imax; + const int width = s->planewidth[1]; + const int height = s->planeheight[1]; + const int slice_start = (height * jobnr) / nb_jobs; + const int slice_end = (height * (jobnr + 1)) / nb_jobs; + const int ulinesize = frame->linesize[1] / 2; + const int vlinesize = frame->linesize[2] / 2; + const uint16_t *uptr = (const uint16_t *)frame->data[1] + slice_start * ulinesize; + const uint16_t *vptr = (const uint16_t *)frame->data[2] + slice_start * vlinesize; + int min_u = INT_MAX, min_v = INT_MAX; + int max_u = INT_MIN, max_v = INT_MIN; + + for (int y = slice_start; y < slice_end; y++) { + for (int x = 0; x < width; x++) { + min_u = FFMIN(min_u, uptr[x]); + min_v = FFMIN(min_v, vptr[x]); + max_u = FFMAX(max_u, uptr[x]); + max_v = FFMAX(max_v, vptr[x]); + } + + uptr += ulinesize; + vptr += vlinesize; + } + + s->analyzeret[jobnr][0] = imax * min_u - 0.5f; + s->analyzeret[jobnr][1] = imax * min_v - 0.5f; + s->analyzeret[jobnr][2] = imax * max_u - 0.5f; + s->analyzeret[jobnr][3] = imax * max_v - 0.5f; + + return 0; +} + +static int median_8(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) +{ + ColorCorrectContext *s = ctx->priv; + AVFrame *frame = arg; + const float imax = s->imax; + const int width = s->planewidth[1]; + const int height = s->planeheight[1]; + const int ulinesize = frame->linesize[1]; + const int vlinesize = frame->linesize[2]; + const uint8_t *uptr = (const uint8_t *)frame->data[1]; + const uint8_t *vptr = (const uint8_t *)frame->data[2]; + unsigned *uhistogram = s->uhistogram; + unsigned *vhistogram = s->vhistogram; + const int half_size = width * height / 2; + int umedian = s->max, vmedian = s->max; + unsigned ucnt = 0, vcnt = 0; + + memset(uhistogram, 0, sizeof(*uhistogram) * (s->max + 1)); + memset(vhistogram, 0, sizeof(*vhistogram) * (s->max + 1)); + + for (int y = 0; y < height; y++) { + for (int x = 0; x < width; x++) { + uhistogram[uptr[x]]++; + vhistogram[vptr[x]]++; + } + + uptr += ulinesize; + vptr += vlinesize; + } + + for (int i = 0; i < s->max + 1; i++) { + ucnt += uhistogram[i]; + if (ucnt >= half_size) { + umedian = i; + break; + } + } + + for (int i = 0; i < s->max + 1; i++) { + vcnt += vhistogram[i]; + if (vcnt >= half_size) { + vmedian = i; + break; + } + } + + s->analyzeret[0][0] = imax * umedian - 0.5f; + s->analyzeret[0][1] = imax * vmedian - 0.5f; + s->analyzeret[0][2] = imax * umedian - 0.5f; + s->analyzeret[0][3] = imax * vmedian - 0.5f; + + return 0; +} + +static int median_16(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) +{ + ColorCorrectContext *s = ctx->priv; + AVFrame *frame = arg; + const float imax = s->imax; + const int width = s->planewidth[1]; + const int height = s->planeheight[1]; + const int ulinesize = frame->linesize[1] / 2; + const int vlinesize = frame->linesize[2] / 2; + const uint16_t *uptr = (const uint16_t *)frame->data[1]; + const uint16_t *vptr = (const uint16_t *)frame->data[2]; + unsigned *uhistogram = s->uhistogram; + unsigned *vhistogram = s->vhistogram; + const int half_size = width * height / 2; + int umedian = s->max, vmedian = s->max; + unsigned ucnt = 0, vcnt = 0; + + memset(uhistogram, 0, sizeof(*uhistogram) * (s->max + 1)); + memset(vhistogram, 0, sizeof(*vhistogram) * (s->max + 1)); + + for (int y = 0; y < height; y++) { + for (int x = 0; x < width; x++) { + uhistogram[uptr[x]]++; + vhistogram[vptr[x]]++; + } + + uptr += ulinesize; + vptr += vlinesize; + } + + for (int i = 0; i < s->max + 1; i++) { + ucnt += uhistogram[i]; + if (ucnt >= half_size) { + umedian = i; + break; + } + } + + for (int i = 0; i < s->max + 1; i++) { + vcnt += vhistogram[i]; + if (vcnt >= half_size) { + vmedian = i; + break; + } + } + + s->analyzeret[0][0] = imax * umedian - 0.5f; + s->analyzeret[0][1] = imax * vmedian - 0.5f; + s->analyzeret[0][2] = imax * umedian - 0.5f; + s->analyzeret[0][3] = imax * vmedian - 0.5f; + + return 0; +} + #define PROCESS() \ - float y = yptr[x] * imax; \ + float y = yptr[x * chroma_w] * imax; \ float u = uptr[x] * imax - .5f; \ float v = vptr[x] * imax - .5f; \ - float ny, nu, nv; \ + float nu, nv; \ \ - ny = y; \ nu = saturation * (u + y * bd + bl); \ nv = saturation * (v + y * rd + rl); @@ -54,17 +316,18 @@ static int colorcorrect_slice8(AVFilterContext *ctx, void *arg, int jobnr, int n { ColorCorrectContext *s = ctx->priv; AVFrame *frame = arg; - const int depth = s->depth; - const float max = (1 << depth) - 1; - const float imax = 1.f / max; - const int width = frame->width; - const int height = frame->height; + const float max = s->max; + const float imax = s->imax; + const int chroma_w = s->chroma_w; + const int chroma_h = s->chroma_h; + const int width = s->planewidth[1]; + const int height = s->planeheight[1]; const int slice_start = (height * jobnr) / nb_jobs; const int slice_end = (height * (jobnr + 1)) / nb_jobs; const int ylinesize = frame->linesize[0]; const int ulinesize = frame->linesize[1]; const int vlinesize = frame->linesize[2]; - uint8_t *yptr = frame->data[0] + slice_start * ylinesize; + uint8_t *yptr = frame->data[0] + slice_start * chroma_h * ylinesize; uint8_t *uptr = frame->data[1] + slice_start * ulinesize; uint8_t *vptr = frame->data[2] + slice_start * vlinesize; const float saturation = s->saturation; @@ -77,12 +340,11 @@ static int colorcorrect_slice8(AVFilterContext *ctx, void *arg, int jobnr, int n for (int x = 0; x < width; x++) { PROCESS() - yptr[x] = av_clip_uint8( ny * max); uptr[x] = av_clip_uint8((nu + 0.5f) * max); vptr[x] = av_clip_uint8((nv + 0.5f) * max); } - yptr += ylinesize; + yptr += ylinesize * chroma_h; uptr += ulinesize; vptr += vlinesize; } @@ -95,16 +357,18 @@ static int colorcorrect_slice16(AVFilterContext *ctx, void *arg, int jobnr, int ColorCorrectContext *s = ctx->priv; AVFrame *frame = arg; const int depth = s->depth; - const float max = (1 << depth) - 1; - const float imax = 1.f / max; - const int width = frame->width; - const int height = frame->height; + const float max = s->max; + const float imax = s->imax; + const int chroma_w = s->chroma_w; + const int chroma_h = s->chroma_h; + const int width = s->planewidth[1]; + const int height = s->planeheight[1]; const int slice_start = (height * jobnr) / nb_jobs; const int slice_end = (height * (jobnr + 1)) / nb_jobs; const int ylinesize = frame->linesize[0] / 2; const int ulinesize = frame->linesize[1] / 2; const int vlinesize = frame->linesize[2] / 2; - uint16_t *yptr = (uint16_t *)frame->data[0] + slice_start * ylinesize; + uint16_t *yptr = (uint16_t *)frame->data[0] + slice_start * chroma_h * ylinesize; uint16_t *uptr = (uint16_t *)frame->data[1] + slice_start * ulinesize; uint16_t *vptr = (uint16_t *)frame->data[2] + slice_start * vlinesize; const float saturation = s->saturation; @@ -117,12 +381,11 @@ static int colorcorrect_slice16(AVFilterContext *ctx, void *arg, int jobnr, int for (int x = 0; x < width; x++) { PROCESS() - yptr[x] = av_clip_uintp2_c( ny * max, depth); uptr[x] = av_clip_uintp2_c((nu + 0.5f) * max, depth); vptr[x] = av_clip_uintp2_c((nv + 0.5f) * max, depth); } - yptr += ylinesize; + yptr += ylinesize * chroma_h; uptr += ulinesize; vptr += vlinesize; } @@ -134,9 +397,33 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) { AVFilterContext *ctx = inlink->dst; ColorCorrectContext *s = ctx->priv; + const int nb_threads = s->analyze == MEDIAN ? 1 : FFMIN(s->planeheight[1], ff_filter_get_nb_threads(ctx)); + + if (s->analyze) { + const int nb_athreads = s->analyze == MEDIAN ? 1 : nb_threads; + float bl = 0.f, rl = 0.f, bh = 0.f, rh = 0.f; + + ff_filter_execute(ctx, s->do_analyze, frame, NULL, nb_athreads); + + for (int i = 0; i < nb_athreads; i++) { + bl += s->analyzeret[i][0]; + rl += s->analyzeret[i][1]; + bh += s->analyzeret[i][2]; + rh += s->analyzeret[i][3]; + } + + bl /= nb_athreads; + rl /= nb_athreads; + bh /= nb_athreads; + rh /= nb_athreads; + + s->bl = -bl; + s->rl = -rl; + s->bh = -bh; + s->rh = -rh; + } - ctx->internal->execute(ctx, s->do_slice, frame, NULL, - FFMIN(frame->height, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->do_slice, frame, NULL, nb_threads); return ff_filter_frame(ctx->outputs[0], frame); } @@ -144,19 +431,22 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) static av_cold int query_formats(AVFilterContext *ctx) { static const enum AVPixelFormat pixel_fmts[] = { - AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVJ444P, - AV_PIX_FMT_YUV444P9, AV_PIX_FMT_YUV444P10, AV_PIX_FMT_YUV444P12, AV_PIX_FMT_YUV444P14, AV_PIX_FMT_YUV444P16, - AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUVA444P9, AV_PIX_FMT_YUVA444P10, AV_PIX_FMT_YUVA444P12, AV_PIX_FMT_YUVA444P16, + AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV444P, + AV_PIX_FMT_YUVA420P, AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUVA444P, + AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ440P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ411P, + AV_PIX_FMT_YUV420P9, AV_PIX_FMT_YUV422P9, AV_PIX_FMT_YUV444P9, + AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV440P10, AV_PIX_FMT_YUV444P10, + AV_PIX_FMT_YUV444P12, AV_PIX_FMT_YUV422P12, AV_PIX_FMT_YUV440P12, AV_PIX_FMT_YUV420P12, + AV_PIX_FMT_YUV444P14, AV_PIX_FMT_YUV422P14, AV_PIX_FMT_YUV420P14, + AV_PIX_FMT_YUV420P16, AV_PIX_FMT_YUV422P16, AV_PIX_FMT_YUV444P16, + AV_PIX_FMT_YUVA420P9, AV_PIX_FMT_YUVA422P9, AV_PIX_FMT_YUVA444P9, + AV_PIX_FMT_YUVA420P10, AV_PIX_FMT_YUVA422P10, AV_PIX_FMT_YUVA444P10, + AV_PIX_FMT_YUVA422P12, AV_PIX_FMT_YUVA444P12, + AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_YUVA422P16, AV_PIX_FMT_YUVA444P16, AV_PIX_FMT_NONE }; - AVFilterFormats *formats = NULL; - - formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } static av_cold int config_input(AVFilterLink *inlink) @@ -166,20 +456,63 @@ static av_cold int config_input(AVFilterLink *inlink) const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); s->depth = desc->comp[0].depth; + s->max = (1 << s->depth) - 1; + s->imax = 1.f / s->max; s->do_slice = s->depth <= 8 ? colorcorrect_slice8 : colorcorrect_slice16; + s->uhistogram = av_calloc(s->max == 255 ? 256 : 65536, sizeof(*s->uhistogram)); + if (!s->uhistogram) + return AVERROR(ENOMEM); + + s->vhistogram = av_calloc(s->max == 255 ? 256 : 65536, sizeof(*s->vhistogram)); + if (!s->vhistogram) + return AVERROR(ENOMEM); + + s->analyzeret = av_calloc(inlink->h, sizeof(*s->analyzeret)); + if (!s->analyzeret) + return AVERROR(ENOMEM); + + switch (s->analyze) { + case MANUAL: + break; + case AVERAGE: + s->do_analyze = s->depth <= 8 ? average_slice8 : average_slice16; + break; + case MINMAX: + s->do_analyze = s->depth <= 8 ? minmax_slice8 : minmax_slice16; + break; + case MEDIAN: + s->do_analyze = s->depth <= 8 ? median_8 : median_16; + break; + default: + return AVERROR_BUG; + } + + s->chroma_w = 1 << desc->log2_chroma_w; + s->chroma_h = 1 << desc->log2_chroma_h; + s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h); + s->planeheight[0] = s->planeheight[3] = inlink->h; + s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w); + s->planewidth[0] = s->planewidth[3] = inlink->w; + return 0; } +static av_cold void uninit(AVFilterContext *ctx) +{ + ColorCorrectContext *s = ctx->priv; + + av_freep(&s->analyzeret); +} + static const AVFilterPad colorcorrect_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .needs_writable = 1, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad colorcorrect_outputs[] = { @@ -187,7 +520,6 @@ static const AVFilterPad colorcorrect_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; #define OFFSET(x) offsetof(ColorCorrectContext, x) @@ -199,6 +531,11 @@ static const AVOption colorcorrect_options[] = { { "rh", "set the red highlight spot", OFFSET(rh), AV_OPT_TYPE_FLOAT, {.dbl=0}, -1, 1, VF }, { "bh", "set the blue highlight spot", OFFSET(bh), AV_OPT_TYPE_FLOAT, {.dbl=0}, -1, 1, VF }, { "saturation", "set the amount of saturation", OFFSET(saturation), AV_OPT_TYPE_FLOAT, {.dbl=1}, -3, 3, VF }, + { "analyze", "set the analyze mode", OFFSET(analyze), AV_OPT_TYPE_INT, {.i64=0}, 0, NB_ANALYZE-1, VF, "analyze" }, + { "manual", "manually set options", 0, AV_OPT_TYPE_CONST, {.i64=MANUAL}, 0, 0, VF, "analyze" }, + { "average", "use average pixels", 0, AV_OPT_TYPE_CONST, {.i64=AVERAGE}, 0, 0, VF, "analyze" }, + { "minmax", "use minmax pixels", 0, AV_OPT_TYPE_CONST, {.i64=MINMAX}, 0, 0, VF, "analyze" }, + { "median", "use median pixels", 0, AV_OPT_TYPE_CONST, {.i64=MEDIAN}, 0, 0, VF, "analyze" }, { NULL } }; @@ -210,8 +547,9 @@ const AVFilter ff_vf_colorcorrect = { .priv_size = sizeof(ColorCorrectContext), .priv_class = &colorcorrect_class, .query_formats = query_formats, - .inputs = colorcorrect_inputs, - .outputs = colorcorrect_outputs, + .uninit = uninit, + FILTER_INPUTS(colorcorrect_inputs), + FILTER_OUTPUTS(colorcorrect_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = ff_filter_process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_colorize.c b/chromium/third_party/ffmpeg/libavfilter/vf_colorize.c index 653832ab92d..4b57998a225 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_colorize.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_colorize.c @@ -203,8 +203,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) hsl2rgb(s->hue, s->saturation, s->lightness, &c[0], &c[1], &c[2]); rgb2yuv(c[0], c[1], c[2], &s->c[0], &s->c[1], &s->c[2], s->depth); - ctx->internal->execute(ctx, do_slice, frame, NULL, - FFMIN(s->planeheight[1], ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, do_slice, frame, NULL, + FFMIN(s->planeheight[1], ff_filter_get_nb_threads(ctx))); return ff_filter_frame(ctx->outputs[0], frame); } @@ -232,13 +232,7 @@ static av_cold int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *formats = NULL; - - formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } static av_cold int config_input(AVFilterLink *inlink) @@ -265,11 +259,10 @@ static const AVFilterPad colorize_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .needs_writable = 1, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad colorize_outputs[] = { @@ -277,7 +270,6 @@ static const AVFilterPad colorize_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; #define OFFSET(x) offsetof(ColorizeContext, x) @@ -299,8 +291,8 @@ const AVFilter ff_vf_colorize = { .priv_size = sizeof(ColorizeContext), .priv_class = &colorize_class, .query_formats = query_formats, - .inputs = colorize_inputs, - .outputs = colorize_outputs, + FILTER_INPUTS(colorize_inputs), + FILTER_OUTPUTS(colorize_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = ff_filter_process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_colorkey.c b/chromium/third_party/ffmpeg/libavfilter/vf_colorkey.c index e0b43728426..bef3e37414e 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_colorkey.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_colorkey.c @@ -135,10 +135,8 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame) ColorkeyContext *ctx = avctx->priv; int res; - if (res = av_frame_make_writable(frame)) - return res; - - if (res = avctx->internal->execute(avctx, ctx->do_slice, frame, NULL, FFMIN(frame->height, ff_filter_get_nb_threads(avctx)))) + if (res = ff_filter_execute(avctx, ctx->do_slice, frame, NULL, + FFMIN(frame->height, ff_filter_get_nb_threads(avctx)))) return res; return ff_filter_frame(avctx->outputs[0], frame); @@ -171,22 +169,16 @@ static av_cold int query_formats(AVFilterContext *avctx) AV_PIX_FMT_NONE }; - AVFilterFormats *formats = NULL; - - formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - - return ff_set_common_formats(avctx, formats); + return ff_set_common_formats_from_list(avctx, pixel_fmts); } static const AVFilterPad colorkey_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad colorkey_outputs[] = { @@ -195,7 +187,6 @@ static const AVFilterPad colorkey_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; #define OFFSET(x) offsetof(ColorkeyContext, x) @@ -219,8 +210,8 @@ const AVFilter ff_vf_colorkey = { .priv_class = &colorkey_class, .query_formats = query_formats, .init = init_filter, - .inputs = colorkey_inputs, - .outputs = colorkey_outputs, + FILTER_INPUTS(colorkey_inputs), + FILTER_OUTPUTS(colorkey_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = ff_filter_process_command, }; @@ -244,8 +235,8 @@ const AVFilter ff_vf_colorhold = { .priv_class = &colorhold_class, .query_formats = query_formats, .init = init_filter, - .inputs = colorkey_inputs, - .outputs = colorkey_outputs, + FILTER_INPUTS(colorkey_inputs), + FILTER_OUTPUTS(colorkey_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = ff_filter_process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_colorkey_opencl.c b/chromium/third_party/ffmpeg/libavfilter/vf_colorkey_opencl.c index cd312ea53e5..f4015cbf210 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_colorkey_opencl.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_colorkey_opencl.c @@ -206,7 +206,6 @@ static const AVFilterPad colorkey_opencl_inputs[] = { .filter_frame = filter_frame, .config_props = &ff_opencl_filter_config_input, }, - { NULL } }; static const AVFilterPad colorkey_opencl_outputs[] = { @@ -215,7 +214,6 @@ static const AVFilterPad colorkey_opencl_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = &ff_opencl_filter_config_output, }, - { NULL } }; #define OFFSET(x) offsetof(ColorkeyOpenCLContext, x) @@ -238,7 +236,7 @@ const AVFilter ff_vf_colorkey_opencl = { .init = &ff_opencl_filter_init, .uninit = &colorkey_opencl_uninit, .query_formats = &ff_opencl_filter_query_formats, - .inputs = colorkey_opencl_inputs, - .outputs = colorkey_opencl_outputs, + FILTER_INPUTS(colorkey_opencl_inputs), + FILTER_OUTPUTS(colorkey_opencl_outputs), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_colorlevels.c b/chromium/third_party/ffmpeg/libavfilter/vf_colorlevels.c index 8bc0d96df09..418a3037d03 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_colorlevels.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_colorlevels.c @@ -87,10 +87,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } typedef struct ThreadData { @@ -289,8 +286,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) break; } - ctx->internal->execute(ctx, s->colorlevels_slice, &td, NULL, - FFMIN(inlink->h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->colorlevels_slice, &td, NULL, + FFMIN(inlink->h, ff_filter_get_nb_threads(ctx))); if (in != out) av_frame_free(&in); @@ -304,7 +301,6 @@ static const AVFilterPad colorlevels_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad colorlevels_outputs[] = { @@ -312,7 +308,6 @@ static const AVFilterPad colorlevels_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_colorlevels = { @@ -321,8 +316,8 @@ const AVFilter ff_vf_colorlevels = { .priv_size = sizeof(ColorLevelsContext), .priv_class = &colorlevels_class, .query_formats = query_formats, - .inputs = colorlevels_inputs, - .outputs = colorlevels_outputs, + FILTER_INPUTS(colorlevels_inputs), + FILTER_OUTPUTS(colorlevels_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = ff_filter_process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_colormatrix.c b/chromium/third_party/ffmpeg/libavfilter/vf_colormatrix.c index c304f2dba8a..87bf478398c 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_colormatrix.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_colormatrix.c @@ -413,10 +413,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_UYVY422, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int filter_frame(AVFilterLink *link, AVFrame *in) @@ -473,17 +470,17 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) td.c7 = color->yuv_convert[color->mode][2][2]; if (in->format == AV_PIX_FMT_YUV444P) - ctx->internal->execute(ctx, process_slice_yuv444p, &td, NULL, - FFMIN(in->height, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, process_slice_yuv444p, &td, NULL, + FFMIN(in->height, ff_filter_get_nb_threads(ctx))); else if (in->format == AV_PIX_FMT_YUV422P) - ctx->internal->execute(ctx, process_slice_yuv422p, &td, NULL, - FFMIN(in->height, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, process_slice_yuv422p, &td, NULL, + FFMIN(in->height, ff_filter_get_nb_threads(ctx))); else if (in->format == AV_PIX_FMT_YUV420P) - ctx->internal->execute(ctx, process_slice_yuv420p, &td, NULL, - FFMIN(in->height / 2, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, process_slice_yuv420p, &td, NULL, + FFMIN(in->height / 2, ff_filter_get_nb_threads(ctx))); else - ctx->internal->execute(ctx, process_slice_uyvy422, &td, NULL, - FFMIN(in->height, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, process_slice_uyvy422, &td, NULL, + FFMIN(in->height, ff_filter_get_nb_threads(ctx))); av_frame_free(&in); return ff_filter_frame(outlink, out); @@ -496,7 +493,6 @@ static const AVFilterPad colormatrix_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad colormatrix_outputs[] = { @@ -504,7 +500,6 @@ static const AVFilterPad colormatrix_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_colormatrix = { @@ -513,8 +508,8 @@ const AVFilter ff_vf_colormatrix = { .priv_size = sizeof(ColorMatrixContext), .init = init, .query_formats = query_formats, - .inputs = colormatrix_inputs, - .outputs = colormatrix_outputs, + FILTER_INPUTS(colormatrix_inputs), + FILTER_OUTPUTS(colormatrix_outputs), .priv_class = &colormatrix_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_colorspace.c b/chromium/third_party/ffmpeg/libavfilter/vf_colorspace.c index 65e072d137c..6b23b27ea55 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_colorspace.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_colorspace.c @@ -873,8 +873,8 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) return res; } } else { - ctx->internal->execute(ctx, convert, &td, NULL, - FFMIN((in->height + 1) >> 1, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, convert, &td, NULL, + FFMIN((in->height + 1) >> 1, ff_filter_get_nb_threads(ctx))); } av_frame_free(&in); @@ -1057,7 +1057,6 @@ static const AVFilterPad inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -1066,7 +1065,6 @@ static const AVFilterPad outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_props, }, - { NULL } }; const AVFilter ff_vf_colorspace = { @@ -1077,7 +1075,7 @@ const AVFilter ff_vf_colorspace = { .query_formats = query_formats, .priv_size = sizeof(ColorSpaceContext), .priv_class = &colorspace_class, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_colortemperature.c b/chromium/third_party/ffmpeg/libavfilter/vf_colortemperature.c index 1a4c9261f66..da2e3bf908d 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_colortemperature.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_colortemperature.c @@ -270,8 +270,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) kelvin2rgb(s->temperature, s->color); - ctx->internal->execute(ctx, s->do_slice, frame, NULL, - FFMIN(frame->height, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->do_slice, frame, NULL, + FFMIN(frame->height, ff_filter_get_nb_threads(ctx))); return ff_filter_frame(ctx->outputs[0], frame); } @@ -293,13 +293,7 @@ static av_cold int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *formats = NULL; - - formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } static av_cold int config_input(AVFilterLink *inlink) @@ -330,11 +324,10 @@ static const AVFilterPad inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = filter_frame, .config_props = config_input, - .needs_writable = 1, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -342,7 +335,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; #define OFFSET(x) offsetof(ColorTemperatureContext, x) @@ -363,8 +355,8 @@ const AVFilter ff_vf_colortemperature = { .priv_size = sizeof(ColorTemperatureContext), .priv_class = &colortemperature_class, .query_formats = query_formats, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = ff_filter_process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_convolution.c b/chromium/third_party/ffmpeg/libavfilter/vf_convolution.c index c0fc7356bd3..5f59307c165 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_convolution.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_convolution.c @@ -22,6 +22,7 @@ #include "libavutil/avstring.h" #include "libavutil/imgutils.h" #include "libavutil/intreadwrite.h" +#include "libavutil/mem_internal.h" #include "libavutil/opt.h" #include "libavutil/pixdesc.h" #include "avfilter.h" @@ -100,7 +101,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } typedef struct ThreadData { @@ -159,6 +160,26 @@ static void filter16_sobel(uint8_t *dstp, int width, } } +static void filter16_scharr(uint8_t *dstp, int width, + float scale, float delta, const int *const matrix, + const uint8_t *c[], int peak, int radius, + int dstride, int stride, int size) +{ + uint16_t *dst = (uint16_t *)dstp; + int x; + + for (x = 0; x < width; x++) { + float suma = AV_RN16A(&c[0][2 * x]) * -47 + AV_RN16A(&c[1][2 * x]) * -162 + AV_RN16A(&c[2][2 * x]) * -47 + + AV_RN16A(&c[6][2 * x]) * 47 + AV_RN16A(&c[7][2 * x]) * 162 + AV_RN16A(&c[8][2 * x]) * 47; + float sumb = AV_RN16A(&c[0][2 * x]) * -47 + AV_RN16A(&c[2][2 * x]) * 47 + AV_RN16A(&c[3][2 * x]) * -162 + + AV_RN16A(&c[5][2 * x]) * 162 + AV_RN16A(&c[6][2 * x]) * -47 + AV_RN16A(&c[8][2 * x]) * 47; + + suma /= 256.f; + sumb /= 256.f; + dst[x] = av_clip(sqrtf(suma*suma + sumb*sumb) * scale + delta, 0, peak); + } +} + static void filter16_kirsch(uint8_t *dstp, int width, float scale, float delta, const int *const matrix, const uint8_t *c[], int peak, int radius, @@ -263,6 +284,28 @@ static void filter_sobel(uint8_t *dst, int width, } } +static void filter_scharr(uint8_t *dst, int width, + float scale, float delta, const int *const matrix, + const uint8_t *c[], int peak, int radius, + int dstride, int stride, int size) +{ + const uint8_t *c0 = c[0], *c1 = c[1], *c2 = c[2]; + const uint8_t *c3 = c[3], *c5 = c[5]; + const uint8_t *c6 = c[6], *c7 = c[7], *c8 = c[8]; + int x; + + for (x = 0; x < width; x++) { + float suma = c0[x] * -47 + c1[x] * -162 + c2[x] * -47 + + c6[x] * 47 + c7[x] * 162 + c8[x] * 47; + float sumb = c0[x] * -47 + c2[x] * 47 + c3[x] * -162 + + c5[x] * 162 + c6[x] * -47 + c8[x] * 47; + + suma /= 256.f; + sumb /= 256.f; + dst[x] = av_clip_uint8(sqrtf(suma*suma + sumb*sumb) * scale + delta); + } +} + static void filter_kirsch(uint8_t *dst, int width, float scale, float delta, const int *const matrix, const uint8_t *c[], int peak, int radius, @@ -714,6 +757,10 @@ static int config_input(AVFilterLink *inlink) if (s->depth > 8) for (p = 0; p < s->nb_planes; p++) s->filter[p] = filter16_kirsch; + } else if (!strcmp(ctx->filter->name, "scharr")) { + if (s->depth > 8) + for (p = 0; p < s->nb_planes; p++) + s->filter[p] = filter16_scharr; } return 0; @@ -736,7 +783,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.in = in; td.out = out; - ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN3(s->planeheight[1], s->planewidth[1], s->nb_threads)); + ff_filter_execute(ctx, filter_slice, &td, NULL, + FFMIN3(s->planeheight[1], s->planewidth[1], s->nb_threads)); av_frame_free(&in); return ff_filter_frame(outlink, out); @@ -865,6 +913,17 @@ static av_cold int init(AVFilterContext *ctx) s->rdiv[i] = s->scale; s->bias[i] = s->delta; } + } else if (!strcmp(ctx->filter->name, "scharr")) { + for (i = 0; i < 4; i++) { + if ((1 << i) & s->planes) + s->filter[i] = filter_scharr; + else + s->copy[i] = 1; + s->size[i] = 3; + s->setup[i] = setup_3x3; + s->rdiv[i] = s->scale; + s->bias[i] = s->delta; + } } return 0; @@ -889,7 +948,6 @@ static const AVFilterPad convolution_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad convolution_outputs[] = { @@ -897,7 +955,6 @@ static const AVFilterPad convolution_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; #if CONFIG_CONVOLUTION_FILTER @@ -909,8 +966,8 @@ const AVFilter ff_vf_convolution = { .priv_class = &convolution_class, .init = init, .query_formats = query_formats, - .inputs = convolution_inputs, - .outputs = convolution_outputs, + FILTER_INPUTS(convolution_inputs), + FILTER_OUTPUTS(convolution_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = process_command, }; @@ -938,8 +995,8 @@ const AVFilter ff_vf_prewitt = { .priv_class = &prewitt_class, .init = init, .query_formats = query_formats, - .inputs = convolution_inputs, - .outputs = convolution_outputs, + FILTER_INPUTS(convolution_inputs), + FILTER_OUTPUTS(convolution_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = process_command, }; @@ -958,8 +1015,8 @@ const AVFilter ff_vf_sobel = { .priv_class = &sobel_class, .init = init, .query_formats = query_formats, - .inputs = convolution_inputs, - .outputs = convolution_outputs, + FILTER_INPUTS(convolution_inputs), + FILTER_OUTPUTS(convolution_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = process_command, }; @@ -978,8 +1035,8 @@ const AVFilter ff_vf_roberts = { .priv_class = &roberts_class, .init = init, .query_formats = query_formats, - .inputs = convolution_inputs, - .outputs = convolution_outputs, + FILTER_INPUTS(convolution_inputs), + FILTER_OUTPUTS(convolution_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = process_command, }; @@ -998,12 +1055,32 @@ const AVFilter ff_vf_kirsch = { .priv_class = &kirsch_class, .init = init, .query_formats = query_formats, - .inputs = convolution_inputs, - .outputs = convolution_outputs, + FILTER_INPUTS(convolution_inputs), + FILTER_OUTPUTS(convolution_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = process_command, }; #endif /* CONFIG_KIRSCH_FILTER */ -#endif /* CONFIG_PREWITT_FILTER || CONFIG_ROBERTS_FILTER || CONFIG_SOBEL_FILTER */ +#if CONFIG_SCHARR_FILTER + +#define scharr_options prewitt_roberts_sobel_options +AVFILTER_DEFINE_CLASS(scharr); + +const AVFilter ff_vf_scharr = { + .name = "scharr", + .description = NULL_IF_CONFIG_SMALL("Apply scharr operator."), + .priv_size = sizeof(ConvolutionContext), + .priv_class = &scharr_class, + .init = init, + .query_formats = query_formats, + FILTER_INPUTS(convolution_inputs), + FILTER_OUTPUTS(convolution_outputs), + .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, + .process_command = process_command, +}; + +#endif /* CONFIG_SCHARR_FILTER */ + +#endif /* CONFIG_PREWITT_FILTER || CONFIG_ROBERTS_FILTER || CONFIG_SOBEL_FILTER || CONFIG_SCHARR_FILTER */ diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_convolution_opencl.c b/chromium/third_party/ffmpeg/libavfilter/vf_convolution_opencl.c index c6218d3cd6f..6932eff2463 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_convolution_opencl.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_convolution_opencl.c @@ -327,7 +327,6 @@ static const AVFilterPad convolution_opencl_inputs[] = { .filter_frame = &convolution_opencl_filter_frame, .config_props = &ff_opencl_filter_config_input, }, - { NULL } }; static const AVFilterPad convolution_opencl_outputs[] = { @@ -336,7 +335,6 @@ static const AVFilterPad convolution_opencl_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = &ff_opencl_filter_config_output, }, - { NULL } }; #define OFFSET(x) offsetof(ConvolutionOpenCLContext, x) @@ -370,8 +368,8 @@ const AVFilter ff_vf_convolution_opencl = { .init = &ff_opencl_filter_init, .uninit = &convolution_opencl_uninit, .query_formats = &ff_opencl_filter_query_formats, - .inputs = convolution_opencl_inputs, - .outputs = convolution_opencl_outputs, + FILTER_INPUTS(convolution_opencl_inputs), + FILTER_OUTPUTS(convolution_opencl_outputs), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; @@ -396,8 +394,8 @@ const AVFilter ff_vf_sobel_opencl = { .init = &ff_opencl_filter_init, .uninit = &convolution_opencl_uninit, .query_formats = &ff_opencl_filter_query_formats, - .inputs = convolution_opencl_inputs, - .outputs = convolution_opencl_outputs, + FILTER_INPUTS(convolution_opencl_inputs), + FILTER_OUTPUTS(convolution_opencl_outputs), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; @@ -422,8 +420,8 @@ const AVFilter ff_vf_prewitt_opencl = { .init = &ff_opencl_filter_init, .uninit = &convolution_opencl_uninit, .query_formats = &ff_opencl_filter_query_formats, - .inputs = convolution_opencl_inputs, - .outputs = convolution_opencl_outputs, + FILTER_INPUTS(convolution_opencl_inputs), + FILTER_OUTPUTS(convolution_opencl_outputs), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; @@ -448,8 +446,8 @@ const AVFilter ff_vf_roberts_opencl = { .init = &ff_opencl_filter_init, .uninit = &convolution_opencl_uninit, .query_formats = &ff_opencl_filter_query_formats, - .inputs = convolution_opencl_inputs, - .outputs = convolution_opencl_outputs, + FILTER_INPUTS(convolution_opencl_inputs), + FILTER_OUTPUTS(convolution_opencl_outputs), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_convolve.c b/chromium/third_party/ffmpeg/libavfilter/vf_convolve.c index a0066bbd39f..ab6d1a271ff 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_convolve.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_convolve.c @@ -23,7 +23,7 @@ #include "libavutil/imgutils.h" #include "libavutil/opt.h" #include "libavutil/pixdesc.h" -#include "libavcodec/avfft.h" +#include "libavutil/tx.h" #include "avfilter.h" #include "formats.h" @@ -37,18 +37,24 @@ typedef struct ConvolveContext { const AVClass *class; FFFrameSync fs; - FFTContext *fft[4][MAX_THREADS]; - FFTContext *ifft[4][MAX_THREADS]; + AVTXContext *fft[4][MAX_THREADS]; + AVTXContext *ifft[4][MAX_THREADS]; + + av_tx_fn tx_fn[4]; + av_tx_fn itx_fn[4]; - int fft_bits[4]; int fft_len[4]; int planewidth[4]; int planeheight[4]; - FFTComplex *fft_hdata[4]; - FFTComplex *fft_vdata[4]; - FFTComplex *fft_hdata_impulse[4]; - FFTComplex *fft_vdata_impulse[4]; + AVComplexFloat *fft_hdata_in[4]; + AVComplexFloat *fft_vdata_in[4]; + AVComplexFloat *fft_hdata_out[4]; + AVComplexFloat *fft_vdata_out[4]; + AVComplexFloat *fft_hdata_impulse_in[4]; + AVComplexFloat *fft_vdata_impulse_in[4]; + AVComplexFloat *fft_hdata_impulse_out[4]; + AVComplexFloat *fft_vdata_impulse_out[4]; int depth; int planes; @@ -95,17 +101,14 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pixel_fmts_fftfilt); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pixel_fmts_fftfilt); } static int config_input_main(AVFilterLink *inlink) { ConvolveContext *s = inlink->dst->priv; const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); - int fft_bits, i; + int i; s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w); s->planewidth[0] = s->planewidth[3] = inlink->w; @@ -120,21 +123,30 @@ static int config_input_main(AVFilterLink *inlink) int h = s->planeheight[i]; int n = FFMAX(w, h); - for (fft_bits = 1; 1 << fft_bits < n; fft_bits++); + s->fft_len[i] = 1 << (av_log2(2 * n - 1)); + + if (!(s->fft_hdata_in[i] = av_calloc(s->fft_len[i], s->fft_len[i] * sizeof(AVComplexFloat)))) + return AVERROR(ENOMEM); + + if (!(s->fft_hdata_out[i] = av_calloc(s->fft_len[i], s->fft_len[i] * sizeof(AVComplexFloat)))) + return AVERROR(ENOMEM); + + if (!(s->fft_vdata_in[i] = av_calloc(s->fft_len[i], s->fft_len[i] * sizeof(AVComplexFloat)))) + return AVERROR(ENOMEM); - s->fft_bits[i] = fft_bits; - s->fft_len[i] = 1 << s->fft_bits[i]; + if (!(s->fft_vdata_out[i] = av_calloc(s->fft_len[i], s->fft_len[i] * sizeof(AVComplexFloat)))) + return AVERROR(ENOMEM); - if (!(s->fft_hdata[i] = av_calloc(s->fft_len[i], s->fft_len[i] * sizeof(FFTComplex)))) + if (!(s->fft_hdata_impulse_in[i] = av_calloc(s->fft_len[i], s->fft_len[i] * sizeof(AVComplexFloat)))) return AVERROR(ENOMEM); - if (!(s->fft_vdata[i] = av_calloc(s->fft_len[i], s->fft_len[i] * sizeof(FFTComplex)))) + if (!(s->fft_vdata_impulse_in[i] = av_calloc(s->fft_len[i], s->fft_len[i] * sizeof(AVComplexFloat)))) return AVERROR(ENOMEM); - if (!(s->fft_hdata_impulse[i] = av_calloc(s->fft_len[i], s->fft_len[i] * sizeof(FFTComplex)))) + if (!(s->fft_hdata_impulse_out[i] = av_calloc(s->fft_len[i], s->fft_len[i] * sizeof(AVComplexFloat)))) return AVERROR(ENOMEM); - if (!(s->fft_vdata_impulse[i] = av_calloc(s->fft_len[i], s->fft_len[i] * sizeof(FFTComplex)))) + if (!(s->fft_vdata_impulse_out[i] = av_calloc(s->fft_len[i], s->fft_len[i] * sizeof(AVComplexFloat)))) return AVERROR(ENOMEM); } @@ -159,7 +171,8 @@ static int config_input_impulse(AVFilterLink *inlink) } typedef struct ThreadData { - FFTComplex *hdata, *vdata; + AVComplexFloat *hdata_in, *vdata_in; + AVComplexFloat *hdata_out, *vdata_out; int plane, n; } ThreadData; @@ -167,7 +180,8 @@ static int fft_horizontal(AVFilterContext *ctx, void *arg, int jobnr, int nb_job { ConvolveContext *s = ctx->priv; ThreadData *td = arg; - FFTComplex *hdata = td->hdata; + AVComplexFloat *hdata_in = td->hdata_in; + AVComplexFloat *hdata_out = td->hdata_out; const int plane = td->plane; const int n = td->n; int start = (n * jobnr) / nb_jobs; @@ -175,14 +189,13 @@ static int fft_horizontal(AVFilterContext *ctx, void *arg, int jobnr, int nb_job int y; for (y = start; y < end; y++) { - av_fft_permute(s->fft[plane][jobnr], hdata + y * n); - av_fft_calc(s->fft[plane][jobnr], hdata + y * n); + s->tx_fn[plane](s->fft[plane][jobnr], hdata_out + y * n, hdata_in + y * n, sizeof(float)); } return 0; } -static void get_input(ConvolveContext *s, FFTComplex *fft_hdata, +static void get_input(ConvolveContext *s, AVComplexFloat *fft_hdata, AVFrame *in, int w, int h, int n, int plane, float scale) { const int iw = (n - w) / 2, ih = (n - h) / 2; @@ -261,8 +274,9 @@ static int fft_vertical(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) { ConvolveContext *s = ctx->priv; ThreadData *td = arg; - FFTComplex *hdata = td->hdata; - FFTComplex *vdata = td->vdata; + AVComplexFloat *hdata = td->hdata_out; + AVComplexFloat *vdata_in = td->vdata_in; + AVComplexFloat *vdata_out = td->vdata_out; const int plane = td->plane; const int n = td->n; int start = (n * jobnr) / nb_jobs; @@ -271,12 +285,11 @@ static int fft_vertical(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) for (y = start; y < end; y++) { for (x = 0; x < n; x++) { - vdata[y * n + x].re = hdata[x * n + y].re; - vdata[y * n + x].im = hdata[x * n + y].im; + vdata_in[y * n + x].re = hdata[x * n + y].re; + vdata_in[y * n + x].im = hdata[x * n + y].im; } - av_fft_permute(s->fft[plane][jobnr], vdata + y * n); - av_fft_calc(s->fft[plane][jobnr], vdata + y * n); + s->tx_fn[plane](s->fft[plane][jobnr], vdata_out + y * n, vdata_in + y * n, sizeof(float)); } return 0; @@ -286,8 +299,9 @@ static int ifft_vertical(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs { ConvolveContext *s = ctx->priv; ThreadData *td = arg; - FFTComplex *hdata = td->hdata; - FFTComplex *vdata = td->vdata; + AVComplexFloat *hdata = td->hdata_out; + AVComplexFloat *vdata_out = td->vdata_out; + AVComplexFloat *vdata_in = td->vdata_in; const int plane = td->plane; const int n = td->n; int start = (n * jobnr) / nb_jobs; @@ -295,12 +309,11 @@ static int ifft_vertical(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs int y, x; for (y = start; y < end; y++) { - av_fft_permute(s->ifft[plane][jobnr], vdata + y * n); - av_fft_calc(s->ifft[plane][jobnr], vdata + y * n); + s->itx_fn[plane](s->ifft[plane][jobnr], vdata_out + y * n, vdata_in + y * n, sizeof(float)); for (x = 0; x < n; x++) { - hdata[x * n + y].re = vdata[y * n + x].re; - hdata[x * n + y].im = vdata[y * n + x].im; + hdata[x * n + y].re = vdata_out[y * n + x].re; + hdata[x * n + y].im = vdata_out[y * n + x].im; } } @@ -311,7 +324,8 @@ static int ifft_horizontal(AVFilterContext *ctx, void *arg, int jobnr, int nb_jo { ConvolveContext *s = ctx->priv; ThreadData *td = arg; - FFTComplex *hdata = td->hdata; + AVComplexFloat *hdata_out = td->hdata_out; + AVComplexFloat *hdata_in = td->hdata_in; const int plane = td->plane; const int n = td->n; int start = (n * jobnr) / nb_jobs; @@ -319,14 +333,13 @@ static int ifft_horizontal(AVFilterContext *ctx, void *arg, int jobnr, int nb_jo int y; for (y = start; y < end; y++) { - av_fft_permute(s->ifft[plane][jobnr], hdata + y * n); - av_fft_calc(s->ifft[plane][jobnr], hdata + y * n); + s->itx_fn[plane](s->ifft[plane][jobnr], hdata_out + y * n, hdata_in + y * n, sizeof(float)); } return 0; } -static void get_output(ConvolveContext *s, FFTComplex *input, AVFrame *out, +static void get_output(ConvolveContext *s, AVComplexFloat *input, AVFrame *out, int w, int h, int n, int plane, float scale) { const int max = (1 << s->depth) - 1; @@ -383,8 +396,8 @@ static int complex_multiply(AVFilterContext *ctx, void *arg, int jobnr, int nb_j { ConvolveContext *s = ctx->priv; ThreadData *td = arg; - FFTComplex *input = td->hdata; - FFTComplex *filter = td->vdata; + AVComplexFloat *input = td->hdata_in; + AVComplexFloat *filter = td->vdata_in; const float noise = s->noise; const int n = td->n; int start = (n * jobnr) / nb_jobs; @@ -395,7 +408,7 @@ static int complex_multiply(AVFilterContext *ctx, void *arg, int jobnr, int nb_j int yn = y * n; for (x = 0; x < n; x++) { - FFTSample re, im, ire, iim; + float re, im, ire, iim; re = input[yn + x].re; im = input[yn + x].im; @@ -414,8 +427,8 @@ static int complex_divide(AVFilterContext *ctx, void *arg, int jobnr, int nb_job { ConvolveContext *s = ctx->priv; ThreadData *td = arg; - FFTComplex *input = td->hdata; - FFTComplex *filter = td->vdata; + AVComplexFloat *input = td->hdata_in; + AVComplexFloat *filter = td->vdata_in; const float noise = s->noise; const int n = td->n; int start = (n * jobnr) / nb_jobs; @@ -426,7 +439,7 @@ static int complex_divide(AVFilterContext *ctx, void *arg, int jobnr, int nb_job int yn = y * n; for (x = 0; x < n; x++) { - FFTSample re, im, ire, iim, div; + float re, im, ire, iim, div; re = input[yn + x].re; im = input[yn + x].im; @@ -457,8 +470,8 @@ static int do_convolve(FFFrameSync *fs) return ff_filter_frame(outlink, mainpic); for (plane = 0; plane < s->nb_planes; plane++) { - FFTComplex *filter = s->fft_vdata_impulse[plane]; - FFTComplex *input = s->fft_vdata[plane]; + AVComplexFloat *filter = s->fft_vdata_impulse_out[plane]; + AVComplexFloat *input = s->fft_vdata_out[plane]; const int n = s->fft_len[plane]; const int w = s->planewidth[plane]; const int h = s->planeheight[plane]; @@ -470,13 +483,17 @@ static int do_convolve(FFFrameSync *fs) } td.plane = plane, td.n = n; - get_input(s, s->fft_hdata[plane], mainpic, w, h, n, plane, 1.f); + get_input(s, s->fft_hdata_in[plane], mainpic, w, h, n, plane, 1.f); - td.hdata = s->fft_hdata[plane]; - td.vdata = s->fft_vdata[plane]; + td.hdata_in = s->fft_hdata_in[plane]; + td.vdata_in = s->fft_vdata_in[plane]; + td.hdata_out = s->fft_hdata_out[plane]; + td.vdata_out = s->fft_vdata_out[plane]; - ctx->internal->execute(ctx, fft_horizontal, &td, NULL, FFMIN3(MAX_THREADS, n, ff_filter_get_nb_threads(ctx))); - ctx->internal->execute(ctx, fft_vertical, &td, NULL, FFMIN3(MAX_THREADS, n, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, fft_horizontal, &td, NULL, + FFMIN3(MAX_THREADS, n, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, fft_vertical, &td, NULL, + FFMIN3(MAX_THREADS, n, ff_filter_get_nb_threads(ctx))); if ((!s->impulse && !s->got_impulse[plane]) || s->impulse) { if (s->depth == 8) { @@ -496,29 +513,42 @@ static int do_convolve(FFFrameSync *fs) } total = FFMAX(1, total); - get_input(s, s->fft_hdata_impulse[plane], impulsepic, w, h, n, plane, 1.f / total); + get_input(s, s->fft_hdata_impulse_in[plane], impulsepic, w, h, n, plane, 1.f / total); - td.hdata = s->fft_hdata_impulse[plane]; - td.vdata = s->fft_vdata_impulse[plane]; + td.hdata_in = s->fft_hdata_impulse_in[plane]; + td.vdata_in = s->fft_vdata_impulse_in[plane]; + td.hdata_out = s->fft_hdata_impulse_out[plane]; + td.vdata_out = s->fft_vdata_impulse_out[plane]; - ctx->internal->execute(ctx, fft_horizontal, &td, NULL, FFMIN3(MAX_THREADS, n, ff_filter_get_nb_threads(ctx))); - ctx->internal->execute(ctx, fft_vertical, &td, NULL, FFMIN3(MAX_THREADS, n, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, fft_horizontal, &td, NULL, + FFMIN3(MAX_THREADS, n, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, fft_vertical, &td, NULL, + FFMIN3(MAX_THREADS, n, ff_filter_get_nb_threads(ctx))); s->got_impulse[plane] = 1; } - td.hdata = input; - td.vdata = filter; + td.hdata_in = input; + td.vdata_in = filter; + + ff_filter_execute(ctx, s->filter, &td, NULL, + FFMIN3(MAX_THREADS, n, ff_filter_get_nb_threads(ctx))); + + td.hdata_in = s->fft_hdata_out[plane]; + td.vdata_in = s->fft_vdata_out[plane]; + td.hdata_out = s->fft_hdata_in[plane]; + td.vdata_out = s->fft_vdata_in[plane]; - ctx->internal->execute(ctx, s->filter, &td, NULL, FFMIN3(MAX_THREADS, n, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, ifft_vertical, &td, NULL, + FFMIN3(MAX_THREADS, n, ff_filter_get_nb_threads(ctx))); - td.hdata = s->fft_hdata[plane]; - td.vdata = s->fft_vdata[plane]; + td.hdata_out = s->fft_hdata_out[plane]; + td.hdata_in = s->fft_hdata_in[plane]; - ctx->internal->execute(ctx, ifft_vertical, &td, NULL, FFMIN3(MAX_THREADS, n, ff_filter_get_nb_threads(ctx))); - ctx->internal->execute(ctx, ifft_horizontal, &td, NULL, FFMIN3(MAX_THREADS, n, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, ifft_horizontal, &td, NULL, + FFMIN3(MAX_THREADS, n, ff_filter_get_nb_threads(ctx))); - get_output(s, s->fft_hdata[plane], mainpic, w, h, n, plane, 1.f / (n * n)); + get_output(s, s->fft_hdata_out[plane], mainpic, w, h, n, plane, 1.f / (n * n)); } return ff_filter_frame(outlink, mainpic); @@ -546,10 +576,14 @@ static int config_output(AVFilterLink *outlink) for (i = 0; i < s->nb_planes; i++) { for (j = 0; j < MAX_THREADS; j++) { - s->fft[i][j] = av_fft_init(s->fft_bits[i], 0); - s->ifft[i][j] = av_fft_init(s->fft_bits[i], 1); - if (!s->fft[i][j] || !s->ifft[i][j]) - return AVERROR(ENOMEM); + float scale; + + ret = av_tx_init(&s->fft[i][j], &s->tx_fn[i], AV_TX_FLOAT_FFT, 0, s->fft_len[i], &scale, 0); + if (ret < 0) + return ret; + ret = av_tx_init(&s->ifft[i][j], &s->itx_fn[i], AV_TX_FLOAT_FFT, 1, s->fft_len[i], &scale, 0); + if (ret < 0) + return ret; } } @@ -583,16 +617,18 @@ static av_cold void uninit(AVFilterContext *ctx) int i, j; for (i = 0; i < 4; i++) { - av_freep(&s->fft_hdata[i]); - av_freep(&s->fft_vdata[i]); - av_freep(&s->fft_hdata_impulse[i]); - av_freep(&s->fft_vdata_impulse[i]); + av_freep(&s->fft_hdata_in[i]); + av_freep(&s->fft_vdata_in[i]); + av_freep(&s->fft_hdata_out[i]); + av_freep(&s->fft_vdata_out[i]); + av_freep(&s->fft_hdata_impulse_in[i]); + av_freep(&s->fft_vdata_impulse_in[i]); + av_freep(&s->fft_hdata_impulse_out[i]); + av_freep(&s->fft_vdata_impulse_out[i]); for (j = 0; j < MAX_THREADS; j++) { - av_fft_end(s->fft[i][j]); - s->fft[i][j] = NULL; - av_fft_end(s->ifft[i][j]); - s->ifft[i][j] = NULL; + av_tx_uninit(&s->fft[i][j]); + av_tx_uninit(&s->ifft[i][j]); } } @@ -609,7 +645,6 @@ static const AVFilterPad convolve_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_input_impulse, }, - { NULL } }; static const AVFilterPad convolve_outputs[] = { @@ -618,7 +653,6 @@ static const AVFilterPad convolve_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; #if CONFIG_CONVOLVE_FILTER @@ -635,8 +669,8 @@ const AVFilter ff_vf_convolve = { .activate = activate, .priv_size = sizeof(ConvolveContext), .priv_class = &convolve_class, - .inputs = convolve_inputs, - .outputs = convolve_outputs, + FILTER_INPUTS(convolve_inputs), + FILTER_OUTPUTS(convolve_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, }; @@ -665,8 +699,8 @@ const AVFilter ff_vf_deconvolve = { .activate = activate, .priv_size = sizeof(ConvolveContext), .priv_class = &deconvolve_class, - .inputs = convolve_inputs, - .outputs = convolve_outputs, + FILTER_INPUTS(convolve_inputs), + FILTER_OUTPUTS(convolve_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_copy.c b/chromium/third_party/ffmpeg/libavfilter/vf_copy.c index f50ac70c922..16fbe438a18 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_copy.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_copy.c @@ -70,7 +70,6 @@ static const AVFilterPad avfilter_vf_copy_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad avfilter_vf_copy_outputs[] = { @@ -78,13 +77,12 @@ static const AVFilterPad avfilter_vf_copy_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_copy = { .name = "copy", .description = NULL_IF_CONFIG_SMALL("Copy the input video unchanged to the output."), - .inputs = avfilter_vf_copy_inputs, - .outputs = avfilter_vf_copy_outputs, + FILTER_INPUTS(avfilter_vf_copy_inputs), + FILTER_OUTPUTS(avfilter_vf_copy_outputs), .query_formats = query_formats, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_coreimage.m b/chromium/third_party/ffmpeg/libavfilter/vf_coreimage.m index 98f63861243..5642d0cd288 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_coreimage.m +++ b/chromium/third_party/ffmpeg/libavfilter/vf_coreimage.m @@ -608,7 +608,6 @@ static const AVFilterPad vf_coreimage_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad vf_coreimage_outputs[] = { @@ -616,7 +615,6 @@ static const AVFilterPad vf_coreimage_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; static const AVFilterPad vsrc_coreimagesrc_outputs[] = { @@ -626,7 +624,6 @@ static const AVFilterPad vsrc_coreimagesrc_outputs[] = { .request_frame = request_frame, .config_props = config_output, }, - { NULL } }; #define OFFSET(x) offsetof(CoreImageContext, x) @@ -663,8 +660,8 @@ const AVFilter ff_vf_coreimage = { .uninit = uninit, .priv_size = sizeof(CoreImageContext), .priv_class = &coreimage_class, - .inputs = vf_coreimage_inputs, - .outputs = vf_coreimage_outputs, + FILTER_INPUTS(vf_coreimage_inputs), + FILTER_OUTPUTS(vf_coreimage_outputs), .query_formats = query_formats, }; @@ -685,6 +682,6 @@ const AVFilter ff_vsrc_coreimagesrc = { .priv_size = sizeof(CoreImageContext), .priv_class = &coreimagesrc_class, .inputs = NULL, - .outputs = vsrc_coreimagesrc_outputs, + FILTER_OUTPUTS(vsrc_coreimagesrc_outputs), .query_formats = query_formats_src, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_cover_rect.c b/chromium/third_party/ffmpeg/libavfilter/vf_cover_rect.c index 337778224d2..0a8c10e06d6 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_cover_rect.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_cover_rect.c @@ -62,7 +62,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) @@ -236,7 +236,6 @@ static const AVFilterPad cover_rect_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad cover_rect_outputs[] = { @@ -244,7 +243,6 @@ static const AVFilterPad cover_rect_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_cover_rect = { @@ -254,7 +252,7 @@ const AVFilter ff_vf_cover_rect = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = cover_rect_inputs, - .outputs = cover_rect_outputs, + FILTER_INPUTS(cover_rect_inputs), + FILTER_OUTPUTS(cover_rect_outputs), .priv_class = &cover_rect_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_crop.c b/chromium/third_party/ffmpeg/libavfilter/vf_crop.c index 9cc9ec28441..76d375cdfcf 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_crop.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_crop.c @@ -380,7 +380,6 @@ static const AVFilterPad avfilter_vf_crop_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad avfilter_vf_crop_outputs[] = { @@ -389,7 +388,6 @@ static const AVFilterPad avfilter_vf_crop_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_crop = { @@ -399,7 +397,7 @@ const AVFilter ff_vf_crop = { .priv_class = &crop_class, .query_formats = query_formats, .uninit = uninit, - .inputs = avfilter_vf_crop_inputs, - .outputs = avfilter_vf_crop_outputs, + FILTER_INPUTS(avfilter_vf_crop_inputs), + FILTER_OUTPUTS(avfilter_vf_crop_outputs), .process_command = process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_cropdetect.c b/chromium/third_party/ffmpeg/libavfilter/vf_cropdetect.c index deeb9e480af..500ef7fa7ff 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_cropdetect.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_cropdetect.c @@ -63,10 +63,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int checkline(void *ctx, const unsigned char *src, int stride, int len, int bpp) @@ -263,7 +260,6 @@ static const AVFilterPad avfilter_vf_cropdetect_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad avfilter_vf_cropdetect_outputs[] = { @@ -271,7 +267,6 @@ static const AVFilterPad avfilter_vf_cropdetect_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO }, - { NULL } }; const AVFilter ff_vf_cropdetect = { @@ -281,7 +276,7 @@ const AVFilter ff_vf_cropdetect = { .priv_class = &cropdetect_class, .init = init, .query_formats = query_formats, - .inputs = avfilter_vf_cropdetect_inputs, - .outputs = avfilter_vf_cropdetect_outputs, + FILTER_INPUTS(avfilter_vf_cropdetect_inputs), + FILTER_OUTPUTS(avfilter_vf_cropdetect_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_curves.c b/chromium/third_party/ffmpeg/libavfilter/vf_curves.c index 64cfea1527f..570e8bded26 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_curves.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_curves.c @@ -531,10 +531,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRP16, AV_PIX_FMT_GBRAP16, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int filter_slice_packed(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) @@ -742,7 +739,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.in = in; td.out = out; - ctx->internal->execute(ctx, curves->filter_slice, &td, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, curves->filter_slice, &td, NULL, + FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); if (out != in) av_frame_free(&in); @@ -802,7 +800,6 @@ static const AVFilterPad curves_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad curves_outputs[] = { @@ -810,7 +807,6 @@ static const AVFilterPad curves_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_curves = { @@ -820,8 +816,8 @@ const AVFilter ff_vf_curves = { .init = curves_init, .uninit = curves_uninit, .query_formats = query_formats, - .inputs = curves_inputs, - .outputs = curves_outputs, + FILTER_INPUTS(curves_inputs), + FILTER_OUTPUTS(curves_outputs), .priv_class = &curves_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = process_command, diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_datascope.c b/chromium/third_party/ffmpeg/libavfilter/vf_datascope.c index 63c93fd98d5..a60d061d18b 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_datascope.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_datascope.c @@ -370,7 +370,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) } td.in = in; td.out = out, td.yoff = xmaxlen, td.xoff = ymaxlen, td.PP = PP; - ctx->internal->execute(ctx, s->filter, &td, NULL, FFMIN(ff_filter_get_nb_threads(ctx), FFMAX(outlink->w / 20, 1))); + ff_filter_execute(ctx, s->filter, &td, NULL, + FFMIN(ff_filter_get_nb_threads(ctx), FFMAX(outlink->w / 20, 1))); av_frame_free(&in); return ff_filter_frame(outlink, out); @@ -437,7 +438,6 @@ static const AVFilterPad inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -446,7 +446,6 @@ static const AVFilterPad outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_datascope = { @@ -455,8 +454,8 @@ const AVFilter ff_vf_datascope = { .priv_size = sizeof(DatascopeContext), .priv_class = &datascope_class, .query_formats = query_formats, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .flags = AVFILTER_FLAG_SLICE_THREADS, .process_command = process_command, }; @@ -727,7 +726,6 @@ static const AVFilterPad pixscope_inputs[] = { .filter_frame = pixscope_filter_frame, .config_props = pixscope_config_input, }, - { NULL } }; static const AVFilterPad pixscope_outputs[] = { @@ -735,7 +733,6 @@ static const AVFilterPad pixscope_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_pixscope = { @@ -744,8 +741,8 @@ const AVFilter ff_vf_pixscope = { .priv_size = sizeof(PixscopeContext), .priv_class = &pixscope_class, .query_formats = query_formats, - .inputs = pixscope_inputs, - .outputs = pixscope_outputs, + FILTER_INPUTS(pixscope_inputs), + FILTER_OUTPUTS(pixscope_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, .process_command = pixscope_process_command, }; @@ -1129,11 +1126,10 @@ static const AVFilterPad oscilloscope_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = oscilloscope_filter_frame, .config_props = oscilloscope_config_input, - .needs_writable = 1, }, - { NULL } }; static const AVFilterPad oscilloscope_outputs[] = { @@ -1141,7 +1137,6 @@ static const AVFilterPad oscilloscope_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_oscilloscope = { @@ -1151,8 +1146,8 @@ const AVFilter ff_vf_oscilloscope = { .priv_class = &oscilloscope_class, .query_formats = query_formats, .uninit = oscilloscope_uninit, - .inputs = oscilloscope_inputs, - .outputs = oscilloscope_outputs, + FILTER_INPUTS(oscilloscope_inputs), + FILTER_OUTPUTS(oscilloscope_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, .process_command = oscilloscope_process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_dblur.c b/chromium/third_party/ffmpeg/libavfilter/vf_dblur.c index dcb6635c957..931c6c689de 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_dblur.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_dblur.c @@ -136,7 +136,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) @@ -281,7 +281,6 @@ static const AVFilterPad dblur_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad dblur_outputs[] = { @@ -289,7 +288,6 @@ static const AVFilterPad dblur_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_dblur = { @@ -299,8 +297,8 @@ const AVFilter ff_vf_dblur = { .priv_class = &dblur_class, .uninit = uninit, .query_formats = query_formats, - .inputs = dblur_inputs, - .outputs = dblur_outputs, + FILTER_INPUTS(dblur_inputs), + FILTER_OUTPUTS(dblur_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, .process_command = ff_filter_process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_dctdnoiz.c b/chromium/third_party/ffmpeg/libavfilter/vf_dctdnoiz.c index c7f949f9f5c..3192a2f8aee 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_dctdnoiz.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_dctdnoiz.c @@ -661,10 +661,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRP, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } typedef struct ThreadData { @@ -748,7 +745,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) .src = s->cbuf[0][plane], .dst = s->cbuf[1][plane], }; - ctx->internal->execute(ctx, filter_slice, &td, NULL, s->nb_threads); + ff_filter_execute(ctx, filter_slice, &td, NULL, s->nb_threads); } s->color_correlation(out->data, out->linesize[0], s->cbuf[1], s->p_linesize, @@ -814,7 +811,6 @@ static const AVFilterPad dctdnoiz_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad dctdnoiz_outputs[] = { @@ -822,7 +818,6 @@ static const AVFilterPad dctdnoiz_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_dctdnoiz = { @@ -832,8 +827,8 @@ const AVFilter ff_vf_dctdnoiz = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = dctdnoiz_inputs, - .outputs = dctdnoiz_outputs, + FILTER_INPUTS(dctdnoiz_inputs), + FILTER_OUTPUTS(dctdnoiz_outputs), .priv_class = &dctdnoiz_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_deband.c b/chromium/third_party/ffmpeg/libavfilter/vf_deband.c index aa560bd9fb1..6d9fd2c52b6 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_deband.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_deband.c @@ -108,11 +108,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(s->coupling ? cpix_fmts : pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, s->coupling ? cpix_fmts : pix_fmts); } static float frand(int x, int y) @@ -426,9 +422,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) av_frame_copy_props(out, in); td.in = in; td.out = out; - ctx->internal->execute(ctx, s->deband, &td, NULL, FFMIN3(s->planeheight[1], - s->planeheight[2], - ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->deband, &td, NULL, + FFMIN3(s->planeheight[1], s->planeheight[2], + ff_filter_get_nb_threads(ctx))); av_frame_free(&in); return ff_filter_frame(outlink, out); @@ -460,7 +456,6 @@ static const AVFilterPad avfilter_vf_deband_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad avfilter_vf_deband_outputs[] = { @@ -468,7 +463,6 @@ static const AVFilterPad avfilter_vf_deband_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_deband = { @@ -478,8 +472,8 @@ const AVFilter ff_vf_deband = { .priv_class = &deband_class, .uninit = uninit, .query_formats = query_formats, - .inputs = avfilter_vf_deband_inputs, - .outputs = avfilter_vf_deband_outputs, + FILTER_INPUTS(avfilter_vf_deband_inputs), + FILTER_OUTPUTS(avfilter_vf_deband_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_deblock.c b/chromium/third_party/ffmpeg/libavfilter/vf_deblock.c index 2d91fe358ba..60f2d206bb0 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_deblock.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_deblock.c @@ -84,10 +84,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY9, AV_PIX_FMT_GRAY10, AV_PIX_FMT_GRAY12, AV_PIX_FMT_GRAY14, AV_PIX_FMT_GRAY16, AV_PIX_FMT_NONE }; - AVFilterFormats *formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } #define WEAK_HFILTER(name, type, ldiv) \ @@ -401,7 +398,6 @@ static const AVFilterPad inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -410,7 +406,6 @@ static const AVFilterPad outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; AVFILTER_DEFINE_CLASS(deblock); @@ -421,8 +416,8 @@ const AVFilter ff_vf_deblock = { .priv_size = sizeof(DeblockContext), .priv_class = &deblock_class, .query_formats = query_formats, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, .process_command = process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_decimate.c b/chromium/third_party/ffmpeg/libavfilter/vf_decimate.c index 72ed349427b..cc75aecf81d 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_decimate.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_decimate.c @@ -310,13 +310,13 @@ static av_cold int decimate_init(AVFilterContext *ctx) }; int ret; - if ((ret = ff_insert_inpad(ctx, INPUT_MAIN, &pad)) < 0) + if ((ret = ff_append_inpad(ctx, &pad)) < 0) return ret; if (dm->ppsrc) { pad.name = "clean_src"; pad.config_props = NULL; - if ((ret = ff_insert_inpad(ctx, INPUT_CLEANSRC, &pad)) < 0) + if ((ret = ff_append_inpad(ctx, &pad)) < 0) return ret; } @@ -365,10 +365,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GRAY16, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_output(AVFilterLink *outlink) @@ -431,7 +428,6 @@ static const AVFilterPad decimate_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_decimate = { @@ -442,7 +438,7 @@ const AVFilter ff_vf_decimate = { .uninit = decimate_uninit, .priv_size = sizeof(DecimateContext), .query_formats = query_formats, - .outputs = decimate_outputs, + FILTER_OUTPUTS(decimate_outputs), .priv_class = &decimate_class, .flags = AVFILTER_FLAG_DYNAMIC_INPUTS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_dedot.c b/chromium/third_party/ffmpeg/libavfilter/vf_dedot.c index b79d4a51c46..a61c08ab02c 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_dedot.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_dedot.c @@ -75,10 +75,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_YUVA422P16, AV_PIX_FMT_YUVA444P16, AV_PIX_FMT_NONE }; - AVFilterFormats *formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } #define DEFINE_DEDOTCRAWL(name, type, div) \ @@ -299,19 +296,19 @@ static int activate(AVFilterContext *ctx) ret = av_frame_make_writable(out); if (ret >= 0) { if (s->m & 1) - ctx->internal->execute(ctx, s->dedotcrawl, out, NULL, - FFMIN(s->planeheight[0], - ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->dedotcrawl, out, NULL, + FFMIN(ff_filter_get_nb_threads(ctx), + s->planeheight[0])); if (s->m & 2) { ThreadData td; td.out = out; td.plane = 1; - ctx->internal->execute(ctx, s->derainbow, &td, NULL, - FFMIN(s->planeheight[1], - ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->derainbow, &td, NULL, + FFMIN(ff_filter_get_nb_threads(ctx), + s->planeheight[1])); td.plane = 2; - ctx->internal->execute(ctx, s->derainbow, &td, NULL, - FFMIN(s->planeheight[2], - ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->derainbow, &td, NULL, + FFMIN(ff_filter_get_nb_threads(ctx), + s->planeheight[2])); } } else av_frame_free(&out); @@ -387,7 +384,6 @@ static const AVFilterPad inputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -396,7 +392,6 @@ static const AVFilterPad outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; AVFILTER_DEFINE_CLASS(dedot); @@ -409,7 +404,7 @@ const AVFilter ff_vf_dedot = { .query_formats = query_formats, .activate = activate, .uninit = uninit, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_deflicker.c b/chromium/third_party/ffmpeg/libavfilter/vf_deflicker.c index 1ce8a482e87..c15f8cec338 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_deflicker.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_deflicker.c @@ -115,10 +115,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUVA420P9, AV_PIX_FMT_YUVA420P10, AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_NONE }; - AVFilterFormats *formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } static int deflicker8(AVFilterContext *ctx, @@ -454,7 +451,6 @@ static const AVFilterPad inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -463,7 +459,6 @@ static const AVFilterPad outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .request_frame = request_frame, }, - { NULL } }; const AVFilter ff_vf_deflicker = { @@ -473,6 +468,6 @@ const AVFilter ff_vf_deflicker = { .priv_class = &deflicker_class, .uninit = uninit, .query_formats = query_formats, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_deinterlace_qsv.c b/chromium/third_party/ffmpeg/libavfilter/vf_deinterlace_qsv.c index 3c2d87c7c84..18b9a17760c 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_deinterlace_qsv.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_deinterlace_qsv.c @@ -42,6 +42,8 @@ #include "internal.h" #include "video.h" +#define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl)) + enum { QSVDEINT_MORE_OUTPUT = 1, QSVDEINT_MORE_INPUT, @@ -106,13 +108,8 @@ static int qsvdeint_query_formats(AVFilterContext *ctx) static const enum AVPixelFormat pixel_formats[] = { AV_PIX_FMT_QSV, AV_PIX_FMT_NONE, }; - AVFilterFormats *pix_fmts = ff_make_format_list(pixel_formats); - int ret; - - if ((ret = ff_set_common_formats(ctx, pix_fmts)) < 0) - return ret; - return 0; + return ff_set_common_formats_from_list(ctx, pixel_formats); } static mfxStatus frame_alloc(mfxHDL pthis, mfxFrameAllocRequest *req, @@ -149,16 +146,16 @@ static mfxStatus frame_unlock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr) static mfxStatus frame_get_hdl(mfxHDL pthis, mfxMemId mid, mfxHDL *hdl) { - *hdl = mid; + mfxHDLPair *pair_dst = (mfxHDLPair*)hdl; + mfxHDLPair *pair_src = (mfxHDLPair*)mid; + + pair_dst->first = pair_src->first; + + if (pair_src->second != (mfxMemId)MFX_INFINITE) + pair_dst->second = pair_src->second; return MFX_ERR_NONE; } -static const mfxHandleType handle_types[] = { - MFX_HANDLE_VA_DISPLAY, - MFX_HANDLE_D3D9_DEVICE_MANAGER, - MFX_HANDLE_D3D11_DEVICE, -}; - static int init_out_session(AVFilterContext *ctx) { @@ -186,14 +183,18 @@ static int init_out_session(AVFilterContext *ctx) return AVERROR_UNKNOWN; } - for (i = 0; i < FF_ARRAY_ELEMS(handle_types); i++) { - err = MFXVideoCORE_GetHandle(device_hwctx->session, handle_types[i], &handle); - if (err == MFX_ERR_NONE) { - handle_type = handle_types[i]; - break; - } + if (MFX_IMPL_VIA_VAAPI == MFX_IMPL_VIA_MASK(impl)) { + handle_type = MFX_HANDLE_VA_DISPLAY; + } else if (MFX_IMPL_VIA_D3D11 == MFX_IMPL_VIA_MASK(impl)) { + handle_type = MFX_HANDLE_D3D11_DEVICE; + } else if (MFX_IMPL_VIA_D3D9 == MFX_IMPL_VIA_MASK(impl)) { + handle_type = MFX_HANDLE_D3D9_DEVICE_MANAGER; + } else { + av_log(ctx, AV_LOG_ERROR, "Error unsupported handle type\n"); + return AVERROR_UNKNOWN; } + err = MFXVideoCORE_GetHandle(device_hwctx->session, handle_type, &handle); if (err < 0) return ff_qsvvpp_print_error(ctx, err, "Error getting the session handle"); else if (err > 0) { @@ -581,7 +582,6 @@ static const AVFilterPad qsvdeint_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = qsvdeint_filter_frame, }, - { NULL } }; static const AVFilterPad qsvdeint_outputs[] = { @@ -591,7 +591,6 @@ static const AVFilterPad qsvdeint_outputs[] = { .config_props = qsvdeint_config_props, .request_frame = qsvdeint_request_frame, }, - { NULL } }; const AVFilter ff_vf_deinterlace_qsv = { @@ -604,8 +603,8 @@ const AVFilter ff_vf_deinterlace_qsv = { .priv_size = sizeof(QSVDeintContext), .priv_class = &qsvdeint_class, - .inputs = qsvdeint_inputs, - .outputs = qsvdeint_outputs, + FILTER_INPUTS(qsvdeint_inputs), + FILTER_OUTPUTS(qsvdeint_outputs), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_deinterlace_vaapi.c b/chromium/third_party/ffmpeg/libavfilter/vf_deinterlace_vaapi.c index fa719470980..5ec830213e7 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_deinterlace_vaapi.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_deinterlace_vaapi.c @@ -369,7 +369,6 @@ static const AVFilterPad deint_vaapi_inputs[] = { .filter_frame = &deint_vaapi_filter_frame, .config_props = &ff_vaapi_vpp_config_input, }, - { NULL } }; static const AVFilterPad deint_vaapi_outputs[] = { @@ -378,7 +377,6 @@ static const AVFilterPad deint_vaapi_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = &deint_vaapi_config_output, }, - { NULL } }; const AVFilter ff_vf_deinterlace_vaapi = { @@ -388,8 +386,8 @@ const AVFilter ff_vf_deinterlace_vaapi = { .init = &deint_vaapi_init, .uninit = &ff_vaapi_vpp_ctx_uninit, .query_formats = &ff_vaapi_vpp_query_formats, - .inputs = deint_vaapi_inputs, - .outputs = deint_vaapi_outputs, + FILTER_INPUTS(deint_vaapi_inputs), + FILTER_OUTPUTS(deint_vaapi_outputs), .priv_class = &deint_vaapi_class, .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_dejudder.c b/chromium/third_party/ffmpeg/libavfilter/vf_dejudder.c index 5816f823228..0aa8ab7a1e1 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_dejudder.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_dejudder.c @@ -163,7 +163,6 @@ static const AVFilterPad dejudder_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad dejudder_outputs[] = { @@ -172,7 +171,6 @@ static const AVFilterPad dejudder_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_out_props, }, - { NULL } }; const AVFilter ff_vf_dejudder = { @@ -180,8 +178,8 @@ const AVFilter ff_vf_dejudder = { .description = NULL_IF_CONFIG_SMALL("Remove judder produced by pullup."), .priv_size = sizeof(DejudderContext), .priv_class = &dejudder_class, - .inputs = dejudder_inputs, - .outputs = dejudder_outputs, + FILTER_INPUTS(dejudder_inputs), + FILTER_OUTPUTS(dejudder_outputs), .init = dejudder_init, .uninit = dejudder_uninit, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_delogo.c b/chromium/third_party/ffmpeg/libavfilter/vf_delogo.c index 98383017026..f7320aa0feb 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_delogo.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_delogo.c @@ -234,10 +234,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUVA420P, AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static av_cold int init(AVFilterContext *ctx) @@ -387,7 +384,6 @@ static const AVFilterPad avfilter_vf_delogo_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad avfilter_vf_delogo_outputs[] = { @@ -395,7 +391,6 @@ static const AVFilterPad avfilter_vf_delogo_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_delogo = { @@ -406,7 +401,7 @@ const AVFilter ff_vf_delogo = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = avfilter_vf_delogo_inputs, - .outputs = avfilter_vf_delogo_outputs, + FILTER_INPUTS(avfilter_vf_delogo_inputs), + FILTER_OUTPUTS(avfilter_vf_delogo_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_derain.c b/chromium/third_party/ffmpeg/libavfilter/vf_derain.c index 5037f3a5f7c..97bdb4e843c 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_derain.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_derain.c @@ -58,19 +58,17 @@ AVFILTER_DEFINE_CLASS(derain); static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; const enum AVPixelFormat pixel_fmts[] = { AV_PIX_FMT_RGB24, AV_PIX_FMT_NONE }; - formats = ff_make_format_list(pixel_fmts); - - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } static int filter_frame(AVFilterLink *inlink, AVFrame *in) { + DNNAsyncStatusType async_state = 0; AVFilterContext *ctx = inlink->dst; AVFilterLink *outlink = ctx->outputs[0]; DRContext *dr_context = ctx->priv; @@ -91,6 +89,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) av_frame_free(&in); return AVERROR(EIO); } + do { + async_state = ff_dnn_get_result(&dr_context->dnnctx, &in, &out); + } while (async_state == DAST_NOT_READY); + + if (async_state != DAST_SUCCESS) + return AVERROR(EINVAL); av_frame_free(&in); @@ -115,7 +119,6 @@ static const AVFilterPad derain_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad derain_outputs[] = { @@ -123,7 +126,6 @@ static const AVFilterPad derain_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_derain = { @@ -133,8 +135,8 @@ const AVFilter ff_vf_derain = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = derain_inputs, - .outputs = derain_outputs, + FILTER_INPUTS(derain_inputs), + FILTER_OUTPUTS(derain_outputs), .priv_class = &derain_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_deshake.c b/chromium/third_party/ffmpeg/libavfilter/vf_deshake.c index 4ff6a947020..4d3d9501912 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_deshake.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_deshake.c @@ -379,10 +379,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ440P, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_props(AVFilterLink *link) @@ -540,7 +537,6 @@ static const AVFilterPad deshake_inputs[] = { .filter_frame = filter_frame, .config_props = config_props, }, - { NULL } }; static const AVFilterPad deshake_outputs[] = { @@ -548,7 +544,6 @@ static const AVFilterPad deshake_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_deshake = { @@ -558,7 +553,7 @@ const AVFilter ff_vf_deshake = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = deshake_inputs, - .outputs = deshake_outputs, + FILTER_INPUTS(deshake_inputs), + FILTER_OUTPUTS(deshake_outputs), .priv_class = &deshake_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_deshake_opencl.c b/chromium/third_party/ffmpeg/libavfilter/vf_deshake_opencl.c index 2fd682003f7..93c50a410dc 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_deshake_opencl.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_deshake_opencl.c @@ -2141,7 +2141,6 @@ static const AVFilterPad deshake_opencl_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = &ff_opencl_filter_config_input, }, - { NULL } }; static const AVFilterPad deshake_opencl_outputs[] = { @@ -2150,7 +2149,6 @@ static const AVFilterPad deshake_opencl_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = &ff_opencl_filter_config_output, }, - { NULL } }; #define OFFSET(x) offsetof(DeshakeOpenCLContext, x) @@ -2196,7 +2194,7 @@ const AVFilter ff_vf_deshake_opencl = { .uninit = &deshake_opencl_uninit, .query_formats = &ff_opencl_filter_query_formats, .activate = activate, - .inputs = deshake_opencl_inputs, - .outputs = deshake_opencl_outputs, + FILTER_INPUTS(deshake_opencl_inputs), + FILTER_OUTPUTS(deshake_opencl_outputs), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_despill.c b/chromium/third_party/ffmpeg/libavfilter/vf_despill.c index e0990d7443a..2c60112b48c 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_despill.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_despill.c @@ -94,10 +94,8 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame) AVFilterContext *ctx = link->dst; int ret; - if (ret = av_frame_make_writable(frame)) - return ret; - - if (ret = ctx->internal->execute(ctx, do_despill_slice, frame, NULL, FFMIN(frame->height, ff_filter_get_nb_threads(ctx)))) + if (ret = ff_filter_execute(ctx, do_despill_slice, frame, NULL, + FFMIN(frame->height, ff_filter_get_nb_threads(ctx)))) return ret; return ff_filter_frame(ctx->outputs[0], frame); @@ -125,22 +123,17 @@ static av_cold int query_formats(AVFilterContext *ctx) AV_PIX_FMT_BGRA, AV_PIX_FMT_NONE }; - AVFilterFormats *formats = NULL; - - formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } static const AVFilterPad despill_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad despill_outputs[] = { @@ -149,7 +142,6 @@ static const AVFilterPad despill_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; #define OFFSET(x) offsetof(DespillContext, x) @@ -177,8 +169,8 @@ const AVFilter ff_vf_despill = { .priv_size = sizeof(DespillContext), .priv_class = &despill_class, .query_formats = query_formats, - .inputs = despill_inputs, - .outputs = despill_outputs, + FILTER_INPUTS(despill_inputs), + FILTER_OUTPUTS(despill_outputs), .process_command = ff_filter_process_command, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_detelecine.c b/chromium/third_party/ffmpeg/libavfilter/vf_detelecine.c index e345e3062ab..7f34a882176 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_detelecine.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_detelecine.c @@ -360,7 +360,6 @@ static const AVFilterPad detelecine_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad detelecine_outputs[] = { @@ -369,7 +368,6 @@ static const AVFilterPad detelecine_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_detelecine = { @@ -380,6 +378,6 @@ const AVFilter ff_vf_detelecine = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = detelecine_inputs, - .outputs = detelecine_outputs, + FILTER_INPUTS(detelecine_inputs), + FILTER_OUTPUTS(detelecine_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_displace.c b/chromium/third_party/ffmpeg/libavfilter/vf_displace.c index 9c310e17400..0bd35b2516f 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_displace.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_displace.c @@ -78,7 +78,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static void displace_planar(DisplaceContext *s, const AVFrame *in, @@ -388,7 +388,6 @@ static const AVFilterPad displace_inputs[] = { .name = "ymap", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; static const AVFilterPad displace_outputs[] = { @@ -397,7 +396,6 @@ static const AVFilterPad displace_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_displace = { @@ -407,8 +405,8 @@ const AVFilter ff_vf_displace = { .uninit = uninit, .query_formats = query_formats, .activate = activate, - .inputs = displace_inputs, - .outputs = displace_outputs, + FILTER_INPUTS(displace_inputs), + FILTER_OUTPUTS(displace_outputs), .priv_class = &displace_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_dnn_classify.c b/chromium/third_party/ffmpeg/libavfilter/vf_dnn_classify.c index 7900255cfec..d1ba8dffbc6 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_dnn_classify.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_dnn_classify.c @@ -207,8 +207,7 @@ static int dnn_classify_query_formats(AVFilterContext *context) AV_PIX_FMT_NV12, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - return ff_set_common_formats(context, fmts_list); + return ff_set_common_formats_from_list(context, pix_fmts); } static int dnn_classify_flush_frame(AVFilterLink *outlink, int64_t pts, int64_t *out_pts) @@ -225,14 +224,13 @@ static int dnn_classify_flush_frame(AVFilterLink *outlink, int64_t pts, int64_t do { AVFrame *in_frame = NULL; AVFrame *out_frame = NULL; - async_state = ff_dnn_get_async_result(&ctx->dnnctx, &in_frame, &out_frame); - if (out_frame) { - av_assert0(in_frame == out_frame); - ret = ff_filter_frame(outlink, out_frame); + async_state = ff_dnn_get_result(&ctx->dnnctx, &in_frame, &out_frame); + if (async_state == DAST_SUCCESS) { + ret = ff_filter_frame(outlink, in_frame); if (ret < 0) return ret; if (out_pts) - *out_pts = out_frame->pts + pts; + *out_pts = in_frame->pts + pts; } av_usleep(5000); } while (async_state >= DAST_NOT_READY); @@ -259,7 +257,7 @@ static int dnn_classify_activate(AVFilterContext *filter_ctx) if (ret < 0) return ret; if (ret > 0) { - if (ff_dnn_execute_model_classification(&ctx->dnnctx, in, in, ctx->target) != DNN_SUCCESS) { + if (ff_dnn_execute_model_classification(&ctx->dnnctx, in, NULL, ctx->target) != DNN_SUCCESS) { return AVERROR(EIO); } } @@ -269,10 +267,9 @@ static int dnn_classify_activate(AVFilterContext *filter_ctx) do { AVFrame *in_frame = NULL; AVFrame *out_frame = NULL; - async_state = ff_dnn_get_async_result(&ctx->dnnctx, &in_frame, &out_frame); - if (out_frame) { - av_assert0(in_frame == out_frame); - ret = ff_filter_frame(outlink, out_frame); + async_state = ff_dnn_get_result(&ctx->dnnctx, &in_frame, &out_frame); + if (async_state == DAST_SUCCESS) { + ret = ff_filter_frame(outlink, in_frame); if (ret < 0) return ret; got_frame = 1; @@ -309,7 +306,6 @@ static const AVFilterPad dnn_classify_inputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; static const AVFilterPad dnn_classify_outputs[] = { @@ -317,7 +313,6 @@ static const AVFilterPad dnn_classify_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_dnn_classify = { @@ -327,8 +322,8 @@ const AVFilter ff_vf_dnn_classify = { .init = dnn_classify_init, .uninit = dnn_classify_uninit, .query_formats = dnn_classify_query_formats, - .inputs = dnn_classify_inputs, - .outputs = dnn_classify_outputs, + FILTER_INPUTS(dnn_classify_inputs), + FILTER_OUTPUTS(dnn_classify_outputs), .priv_class = &dnn_classify_class, .activate = dnn_classify_activate, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_dnn_detect.c b/chromium/third_party/ffmpeg/libavfilter/vf_dnn_detect.c index d23e30aedda..637874b2a12 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_dnn_detect.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_dnn_detect.c @@ -350,65 +350,7 @@ static int dnn_detect_query_formats(AVFilterContext *context) AV_PIX_FMT_NV12, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - return ff_set_common_formats(context, fmts_list); -} - -static int dnn_detect_filter_frame(AVFilterLink *inlink, AVFrame *in) -{ - AVFilterContext *context = inlink->dst; - AVFilterLink *outlink = context->outputs[0]; - DnnDetectContext *ctx = context->priv; - DNNReturnType dnn_result; - - dnn_result = ff_dnn_execute_model(&ctx->dnnctx, in, in); - if (dnn_result != DNN_SUCCESS){ - av_log(ctx, AV_LOG_ERROR, "failed to execute model\n"); - av_frame_free(&in); - return AVERROR(EIO); - } - - return ff_filter_frame(outlink, in); -} - -static int dnn_detect_activate_sync(AVFilterContext *filter_ctx) -{ - AVFilterLink *inlink = filter_ctx->inputs[0]; - AVFilterLink *outlink = filter_ctx->outputs[0]; - AVFrame *in = NULL; - int64_t pts; - int ret, status; - int got_frame = 0; - - FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink); - - do { - // drain all input frames - ret = ff_inlink_consume_frame(inlink, &in); - if (ret < 0) - return ret; - if (ret > 0) { - ret = dnn_detect_filter_frame(inlink, in); - if (ret < 0) - return ret; - got_frame = 1; - } - } while (ret > 0); - - // if frame got, schedule to next filter - if (got_frame) - return 0; - - if (ff_inlink_acknowledge_status(inlink, &status, &pts)) { - if (status == AVERROR_EOF) { - ff_outlink_set_status(outlink, status, pts); - return ret; - } - } - - FF_FILTER_FORWARD_WANTED(outlink, inlink); - - return FFERROR_NOT_READY; + return ff_set_common_formats_from_list(context, pix_fmts); } static int dnn_detect_flush_frame(AVFilterLink *outlink, int64_t pts, int64_t *out_pts) @@ -425,14 +367,13 @@ static int dnn_detect_flush_frame(AVFilterLink *outlink, int64_t pts, int64_t *o do { AVFrame *in_frame = NULL; AVFrame *out_frame = NULL; - async_state = ff_dnn_get_async_result(&ctx->dnnctx, &in_frame, &out_frame); - if (out_frame) { - av_assert0(in_frame == out_frame); - ret = ff_filter_frame(outlink, out_frame); + async_state = ff_dnn_get_result(&ctx->dnnctx, &in_frame, &out_frame); + if (async_state == DAST_SUCCESS) { + ret = ff_filter_frame(outlink, in_frame); if (ret < 0) return ret; if (out_pts) - *out_pts = out_frame->pts + pts; + *out_pts = in_frame->pts + pts; } av_usleep(5000); } while (async_state >= DAST_NOT_READY); @@ -440,7 +381,7 @@ static int dnn_detect_flush_frame(AVFilterLink *outlink, int64_t pts, int64_t *o return 0; } -static int dnn_detect_activate_async(AVFilterContext *filter_ctx) +static int dnn_detect_activate(AVFilterContext *filter_ctx) { AVFilterLink *inlink = filter_ctx->inputs[0]; AVFilterLink *outlink = filter_ctx->outputs[0]; @@ -459,7 +400,7 @@ static int dnn_detect_activate_async(AVFilterContext *filter_ctx) if (ret < 0) return ret; if (ret > 0) { - if (ff_dnn_execute_model_async(&ctx->dnnctx, in, in) != DNN_SUCCESS) { + if (ff_dnn_execute_model(&ctx->dnnctx, in, NULL) != DNN_SUCCESS) { return AVERROR(EIO); } } @@ -469,10 +410,9 @@ static int dnn_detect_activate_async(AVFilterContext *filter_ctx) do { AVFrame *in_frame = NULL; AVFrame *out_frame = NULL; - async_state = ff_dnn_get_async_result(&ctx->dnnctx, &in_frame, &out_frame); - if (out_frame) { - av_assert0(in_frame == out_frame); - ret = ff_filter_frame(outlink, out_frame); + async_state = ff_dnn_get_result(&ctx->dnnctx, &in_frame, &out_frame); + if (async_state == DAST_SUCCESS) { + ret = ff_filter_frame(outlink, in_frame); if (ret < 0) return ret; got_frame = 1; @@ -497,16 +437,6 @@ static int dnn_detect_activate_async(AVFilterContext *filter_ctx) return 0; } -static int dnn_detect_activate(AVFilterContext *filter_ctx) -{ - DnnDetectContext *ctx = filter_ctx->priv; - - if (ctx->dnnctx.async) - return dnn_detect_activate_async(filter_ctx); - else - return dnn_detect_activate_sync(filter_ctx); -} - static av_cold void dnn_detect_uninit(AVFilterContext *context) { DnnDetectContext *ctx = context->priv; @@ -519,7 +449,6 @@ static const AVFilterPad dnn_detect_inputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; static const AVFilterPad dnn_detect_outputs[] = { @@ -527,7 +456,6 @@ static const AVFilterPad dnn_detect_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_dnn_detect = { @@ -537,8 +465,8 @@ const AVFilter ff_vf_dnn_detect = { .init = dnn_detect_init, .uninit = dnn_detect_uninit, .query_formats = dnn_detect_query_formats, - .inputs = dnn_detect_inputs, - .outputs = dnn_detect_outputs, + FILTER_INPUTS(dnn_detect_inputs), + FILTER_OUTPUTS(dnn_detect_outputs), .priv_class = &dnn_detect_class, .activate = dnn_detect_activate, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_dnn_processing.c b/chromium/third_party/ffmpeg/libavfilter/vf_dnn_processing.c index e1d9d24683a..55634efde5a 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_dnn_processing.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_dnn_processing.c @@ -75,8 +75,7 @@ static int query_formats(AVFilterContext *context) AV_PIX_FMT_NV12, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - return ff_set_common_formats(context, fmts_list); + return ff_set_common_formats_from_list(context, pix_fmts); } #define LOG_FORMAT_CHANNEL_MISMATCH() \ @@ -245,76 +244,6 @@ static int copy_uv_planes(DnnProcessingContext *ctx, AVFrame *out, const AVFrame return 0; } -static int filter_frame(AVFilterLink *inlink, AVFrame *in) -{ - AVFilterContext *context = inlink->dst; - AVFilterLink *outlink = context->outputs[0]; - DnnProcessingContext *ctx = context->priv; - DNNReturnType dnn_result; - AVFrame *out; - - out = ff_get_video_buffer(outlink, outlink->w, outlink->h); - if (!out) { - av_frame_free(&in); - return AVERROR(ENOMEM); - } - av_frame_copy_props(out, in); - - dnn_result = ff_dnn_execute_model(&ctx->dnnctx, in, out); - if (dnn_result != DNN_SUCCESS){ - av_log(ctx, AV_LOG_ERROR, "failed to execute model\n"); - av_frame_free(&in); - av_frame_free(&out); - return AVERROR(EIO); - } - - if (isPlanarYUV(in->format)) - copy_uv_planes(ctx, out, in); - - av_frame_free(&in); - return ff_filter_frame(outlink, out); -} - -static int activate_sync(AVFilterContext *filter_ctx) -{ - AVFilterLink *inlink = filter_ctx->inputs[0]; - AVFilterLink *outlink = filter_ctx->outputs[0]; - AVFrame *in = NULL; - int64_t pts; - int ret, status; - int got_frame = 0; - - FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink); - - do { - // drain all input frames - ret = ff_inlink_consume_frame(inlink, &in); - if (ret < 0) - return ret; - if (ret > 0) { - ret = filter_frame(inlink, in); - if (ret < 0) - return ret; - got_frame = 1; - } - } while (ret > 0); - - // if frame got, schedule to next filter - if (got_frame) - return 0; - - if (ff_inlink_acknowledge_status(inlink, &status, &pts)) { - if (status == AVERROR_EOF) { - ff_outlink_set_status(outlink, status, pts); - return ret; - } - } - - FF_FILTER_FORWARD_WANTED(outlink, inlink); - - return FFERROR_NOT_READY; -} - static int flush_frame(AVFilterLink *outlink, int64_t pts, int64_t *out_pts) { DnnProcessingContext *ctx = outlink->src->priv; @@ -329,7 +258,7 @@ static int flush_frame(AVFilterLink *outlink, int64_t pts, int64_t *out_pts) do { AVFrame *in_frame = NULL; AVFrame *out_frame = NULL; - async_state = ff_dnn_get_async_result(&ctx->dnnctx, &in_frame, &out_frame); + async_state = ff_dnn_get_result(&ctx->dnnctx, &in_frame, &out_frame); if (out_frame) { if (isPlanarYUV(in_frame->format)) copy_uv_planes(ctx, out_frame, in_frame); @@ -346,7 +275,7 @@ static int flush_frame(AVFilterLink *outlink, int64_t pts, int64_t *out_pts) return 0; } -static int activate_async(AVFilterContext *filter_ctx) +static int activate(AVFilterContext *filter_ctx) { AVFilterLink *inlink = filter_ctx->inputs[0]; AVFilterLink *outlink = filter_ctx->outputs[0]; @@ -371,7 +300,7 @@ static int activate_async(AVFilterContext *filter_ctx) return AVERROR(ENOMEM); } av_frame_copy_props(out, in); - if (ff_dnn_execute_model_async(&ctx->dnnctx, in, out) != DNN_SUCCESS) { + if (ff_dnn_execute_model(&ctx->dnnctx, in, out) != DNN_SUCCESS) { return AVERROR(EIO); } } @@ -381,7 +310,7 @@ static int activate_async(AVFilterContext *filter_ctx) do { AVFrame *in_frame = NULL; AVFrame *out_frame = NULL; - async_state = ff_dnn_get_async_result(&ctx->dnnctx, &in_frame, &out_frame); + async_state = ff_dnn_get_result(&ctx->dnnctx, &in_frame, &out_frame); if (out_frame) { if (isPlanarYUV(in_frame->format)) copy_uv_planes(ctx, out_frame, in_frame); @@ -411,16 +340,6 @@ static int activate_async(AVFilterContext *filter_ctx) return 0; } -static int activate(AVFilterContext *filter_ctx) -{ - DnnProcessingContext *ctx = filter_ctx->priv; - - if (ctx->dnnctx.async) - return activate_async(filter_ctx); - else - return activate_sync(filter_ctx); -} - static av_cold void uninit(AVFilterContext *ctx) { DnnProcessingContext *context = ctx->priv; @@ -435,7 +354,6 @@ static const AVFilterPad dnn_processing_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_input, }, - { NULL } }; static const AVFilterPad dnn_processing_outputs[] = { @@ -444,7 +362,6 @@ static const AVFilterPad dnn_processing_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_dnn_processing = { @@ -454,8 +371,8 @@ const AVFilter ff_vf_dnn_processing = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = dnn_processing_inputs, - .outputs = dnn_processing_outputs, + FILTER_INPUTS(dnn_processing_inputs), + FILTER_OUTPUTS(dnn_processing_outputs), .priv_class = &dnn_processing_class, .activate = activate, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_drawbox.c b/chromium/third_party/ffmpeg/libavfilter/vf_drawbox.c index 1e9e0286500..2d36da89cda 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_drawbox.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_drawbox.c @@ -193,10 +193,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUVA420P, AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUVA444P, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) @@ -387,11 +384,10 @@ static const AVFilterPad drawbox_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .config_props = config_input, .filter_frame = filter_frame, - .needs_writable = 1, }, - { NULL } }; static const AVFilterPad drawbox_outputs[] = { @@ -399,7 +395,6 @@ static const AVFilterPad drawbox_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_drawbox = { @@ -409,8 +404,8 @@ const AVFilter ff_vf_drawbox = { .priv_class = &drawbox_class, .init = init, .query_formats = query_formats, - .inputs = drawbox_inputs, - .outputs = drawbox_outputs, + FILTER_INPUTS(drawbox_inputs), + FILTER_OUTPUTS(drawbox_outputs), .process_command = process_command, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; @@ -471,11 +466,10 @@ static const AVFilterPad drawgrid_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .config_props = config_input, .filter_frame = drawgrid_filter_frame, - .needs_writable = 1, }, - { NULL } }; static const AVFilterPad drawgrid_outputs[] = { @@ -483,7 +477,6 @@ static const AVFilterPad drawgrid_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_drawgrid = { @@ -493,8 +486,8 @@ const AVFilter ff_vf_drawgrid = { .priv_class = &drawgrid_class, .init = init, .query_formats = query_formats, - .inputs = drawgrid_inputs, - .outputs = drawgrid_outputs, + FILTER_INPUTS(drawgrid_inputs), + FILTER_OUTPUTS(drawgrid_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, .process_command = process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_drawtext.c b/chromium/third_party/ffmpeg/libavfilter/vf_drawtext.c index c4c09894e4d..b1ea58f30a8 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_drawtext.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_drawtext.c @@ -1615,11 +1615,10 @@ static const AVFilterPad avfilter_vf_drawtext_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = filter_frame, .config_props = config_input, - .needs_writable = 1, }, - { NULL } }; static const AVFilterPad avfilter_vf_drawtext_outputs[] = { @@ -1627,7 +1626,6 @@ static const AVFilterPad avfilter_vf_drawtext_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_drawtext = { @@ -1638,8 +1636,8 @@ const AVFilter ff_vf_drawtext = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = avfilter_vf_drawtext_inputs, - .outputs = avfilter_vf_drawtext_outputs, + FILTER_INPUTS(avfilter_vf_drawtext_inputs), + FILTER_OUTPUTS(avfilter_vf_drawtext_outputs), .process_command = command, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_edgedetect.c b/chromium/third_party/ffmpeg/libavfilter/vf_edgedetect.c index e21d341fd29..982ed729cf3 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_edgedetect.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_edgedetect.c @@ -101,7 +101,6 @@ static int query_formats(AVFilterContext *ctx) static const enum AVPixelFormat wires_pix_fmts[] = {AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE}; static const enum AVPixelFormat canny_pix_fmts[] = {AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_GBRP, AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE}; static const enum AVPixelFormat colormix_pix_fmts[] = {AV_PIX_FMT_GBRP, AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE}; - AVFilterFormats *fmts_list; const enum AVPixelFormat *pix_fmts = NULL; if (edgedetect->mode == MODE_WIRES) { @@ -113,10 +112,7 @@ static int query_formats(AVFilterContext *ctx) } else { av_assert0(0); } - fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_props(AVFilterLink *inlink) @@ -420,7 +416,6 @@ static const AVFilterPad edgedetect_inputs[] = { .config_props = config_props, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad edgedetect_outputs[] = { @@ -428,7 +423,6 @@ static const AVFilterPad edgedetect_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_edgedetect = { @@ -438,8 +432,8 @@ const AVFilter ff_vf_edgedetect = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = edgedetect_inputs, - .outputs = edgedetect_outputs, + FILTER_INPUTS(edgedetect_inputs), + FILTER_OUTPUTS(edgedetect_outputs), .priv_class = &edgedetect_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_elbg.c b/chromium/third_party/ffmpeg/libavfilter/vf_elbg.c index 008f4700689..8f97465f12c 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_elbg.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_elbg.c @@ -91,10 +91,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; if (!elbg->pal8) { - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } else { static const enum AVPixelFormat pal8_fmt[] = { AV_PIX_FMT_PAL8, @@ -238,11 +235,10 @@ static const AVFilterPad elbg_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .config_props = config_input, .filter_frame = filter_frame, - .needs_writable = 1, }, - { NULL } }; static const AVFilterPad elbg_outputs[] = { @@ -250,7 +246,6 @@ static const AVFilterPad elbg_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_elbg = { @@ -261,6 +256,6 @@ const AVFilter ff_vf_elbg = { .query_formats = query_formats, .init = init, .uninit = uninit, - .inputs = elbg_inputs, - .outputs = elbg_outputs, + FILTER_INPUTS(elbg_inputs), + FILTER_OUTPUTS(elbg_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_entropy.c b/chromium/third_party/ffmpeg/libavfilter/vf_entropy.c index 32f4bac95d0..bac962fbd99 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_entropy.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_entropy.c @@ -73,10 +73,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *formats = ff_make_format_list(pixfmts); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixfmts); } static int config_input(AVFilterLink *inlink) @@ -182,7 +179,6 @@ static const AVFilterPad inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -190,7 +186,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_entropy = { @@ -199,8 +194,8 @@ const AVFilter ff_vf_entropy = { .priv_size = sizeof(EntropyContext), .uninit = uninit, .query_formats = query_formats, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .priv_class = &entropy_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_epx.c b/chromium/third_party/ffmpeg/libavfilter/vf_epx.c index 676513c302e..4adf6d5a321 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_epx.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_epx.c @@ -228,10 +228,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE, }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int filter_frame(AVFilterLink *inlink, AVFrame *in) @@ -250,7 +247,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) av_frame_copy_props(out, in); td.in = in, td.out = out; - ctx->internal->execute(ctx, s->epx_slice, &td, NULL, FFMIN(inlink->h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->epx_slice, &td, NULL, + FFMIN(inlink->h, ff_filter_get_nb_threads(ctx))); av_frame_free(&in); return ff_filter_frame(outlink, out); @@ -262,7 +260,6 @@ static const AVFilterPad inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -271,14 +268,13 @@ static const AVFilterPad outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_epx = { .name = "epx", .description = NULL_IF_CONFIG_SMALL("Scale the input using EPX algorithm."), - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .query_formats = query_formats, .priv_size = sizeof(EPXContext), .priv_class = &epx_class, diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_eq.c b/chromium/third_party/ffmpeg/libavfilter/vf_eq.c index 7d740d501a4..77636019355 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_eq.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_eq.c @@ -243,10 +243,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUV444P, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pixel_fmts_eq); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pixel_fmts_eq); } static int filter_frame(AVFilterLink *inlink, AVFrame *in) @@ -338,7 +335,6 @@ static const AVFilterPad eq_inputs[] = { .filter_frame = filter_frame, .config_props = config_props, }, - { NULL } }; static const AVFilterPad eq_outputs[] = { @@ -346,7 +342,6 @@ static const AVFilterPad eq_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; #define OFFSET(x) offsetof(EQContext, x) @@ -382,8 +377,8 @@ const AVFilter ff_vf_eq = { .description = NULL_IF_CONFIG_SMALL("Adjust brightness, contrast, gamma, and saturation."), .priv_size = sizeof(EQContext), .priv_class = &eq_class, - .inputs = eq_inputs, - .outputs = eq_outputs, + FILTER_INPUTS(eq_inputs), + FILTER_OUTPUTS(eq_outputs), .process_command = process_command, .query_formats = query_formats, .init = initialize, diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_estdif.c b/chromium/third_party/ffmpeg/libavfilter/vf_estdif.c index 863d4537752..70e804a3c6a 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_estdif.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_estdif.c @@ -129,10 +129,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_output(AVFilterLink *outlink) @@ -444,8 +441,8 @@ static int filter(AVFilterContext *ctx, int is_second, AVFrame *in) out->pts = s->pts; td.out = out; td.in = in; - ctx->internal->execute(ctx, deinterlace_slice, &td, NULL, - FFMIN(s->planeheight[1] / 2, s->nb_threads)); + ff_filter_execute(ctx, deinterlace_slice, &td, NULL, + FFMIN(s->planeheight[1] / 2, s->nb_threads)); if (s->mode) s->field = !s->field; @@ -562,7 +559,6 @@ static const AVFilterPad estdif_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad estdif_outputs[] = { @@ -572,7 +568,6 @@ static const AVFilterPad estdif_outputs[] = { .config_props = config_output, .request_frame = request_frame, }, - { NULL } }; const AVFilter ff_vf_estdif = { @@ -582,8 +577,8 @@ const AVFilter ff_vf_estdif = { .priv_class = &estdif_class, .uninit = uninit, .query_formats = query_formats, - .inputs = estdif_inputs, - .outputs = estdif_outputs, + FILTER_INPUTS(estdif_inputs), + FILTER_OUTPUTS(estdif_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, .process_command = ff_filter_process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_exposure.c b/chromium/third_party/ffmpeg/libavfilter/vf_exposure.c index 5374a8396e4..2b6e6f1586f 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_exposure.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_exposure.c @@ -69,8 +69,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) ExposureContext *s = ctx->priv; s->scale = 1.f / (exp2f(-s->exposure) - s->black); - ctx->internal->execute(ctx, s->do_slice, frame, NULL, - FFMIN(frame->height, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->do_slice, frame, NULL, + FFMIN(frame->height, ff_filter_get_nb_threads(ctx))); return ff_filter_frame(ctx->outputs[0], frame); } @@ -82,13 +82,7 @@ static av_cold int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *formats = NULL; - - formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } static av_cold int config_input(AVFilterLink *inlink) @@ -105,11 +99,10 @@ static const AVFilterPad exposure_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .needs_writable = 1, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad exposure_outputs[] = { @@ -117,7 +110,6 @@ static const AVFilterPad exposure_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; #define OFFSET(x) offsetof(ExposureContext, x) @@ -137,8 +129,8 @@ const AVFilter ff_vf_exposure = { .priv_size = sizeof(ExposureContext), .priv_class = &exposure_class, .query_formats = query_formats, - .inputs = exposure_inputs, - .outputs = exposure_outputs, + FILTER_INPUTS(exposure_inputs), + FILTER_OUTPUTS(exposure_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = ff_filter_process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_extractplanes.c b/chromium/third_party/ffmpeg/libavfilter/vf_extractplanes.c index cede3d669ee..6e7931b3e39 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_extractplanes.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_extractplanes.c @@ -352,23 +352,13 @@ static av_cold int init(AVFilterContext *ctx) pad.type = AVMEDIA_TYPE_VIDEO; pad.config_props = config_output; - if ((ret = ff_insert_outpad(ctx, ctx->nb_outputs, &pad)) < 0) { - av_freep(&pad.name); + if ((ret = ff_append_outpad_free_name(ctx, &pad)) < 0) return ret; - } } return 0; } -static av_cold void uninit(AVFilterContext *ctx) -{ - int i; - - for (i = 0; i < ctx->nb_outputs; i++) - av_freep(&ctx->output_pads[i].name); -} - static const AVFilterPad extractplanes_inputs[] = { { .name = "default", @@ -376,7 +366,6 @@ static const AVFilterPad extractplanes_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; const AVFilter ff_vf_extractplanes = { @@ -385,9 +374,8 @@ const AVFilter ff_vf_extractplanes = { .priv_size = sizeof(ExtractPlanesContext), .priv_class = &extractplanes_class, .init = init, - .uninit = uninit, .query_formats = query_formats, - .inputs = extractplanes_inputs, + FILTER_INPUTS(extractplanes_inputs), .outputs = NULL, .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS, }; @@ -399,20 +387,27 @@ static av_cold int init_alphaextract(AVFilterContext *ctx) ExtractPlanesContext *s = ctx->priv; s->requested_planes = PLANE_A; + s->map[0] = 3; - return init(ctx); + return 0; } +static const AVFilterPad alphaextract_outputs[] = { + { + .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .config_props = config_output, + }, +}; + const AVFilter ff_vf_alphaextract = { .name = "alphaextract", .description = NULL_IF_CONFIG_SMALL("Extract an alpha channel as a " "grayscale image component."), .priv_size = sizeof(ExtractPlanesContext), .init = init_alphaextract, - .uninit = uninit, .query_formats = query_formats, - .inputs = extractplanes_inputs, - .outputs = NULL, - .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS, + FILTER_INPUTS(extractplanes_inputs), + FILTER_OUTPUTS(alphaextract_outputs), }; #endif /* CONFIG_ALPHAEXTRACT_FILTER */ diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_fade.c b/chromium/third_party/ffmpeg/libavfilter/vf_fade.c index 3c65b0f2acf..71d40c49282 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_fade.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_fade.c @@ -149,22 +149,20 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRAP, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list; + const enum AVPixelFormat *pixel_fmts; if (s->alpha) { if (s->black_fade) - fmts_list = ff_make_format_list(pix_fmts_alpha); + pixel_fmts = pix_fmts_alpha; else - fmts_list = ff_make_format_list(pix_fmts_rgba); + pixel_fmts = pix_fmts_rgba; } else { if (s->black_fade) - fmts_list = ff_make_format_list(pix_fmts); + pixel_fmts = pix_fmts; else - fmts_list = ff_make_format_list(pix_fmts_rgb); + pixel_fmts = pix_fmts_rgb; } - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } const static enum AVPixelFormat studio_level_pix_fmts[] = { @@ -495,20 +493,20 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) if (s->factor < UINT16_MAX) { if (s->alpha) { - ctx->internal->execute(ctx, s->filter_slice_alpha, frame, NULL, - FFMIN(frame->height, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->filter_slice_alpha, frame, NULL, + FFMIN(frame->height, ff_filter_get_nb_threads(ctx))); } else if (s->is_rgb && !s->black_fade) { - ctx->internal->execute(ctx, filter_slice_rgb, frame, NULL, - FFMIN(frame->height, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_slice_rgb, frame, NULL, + FFMIN(frame->height, ff_filter_get_nb_threads(ctx))); } else { /* luma, or rgb plane in case of black */ - ctx->internal->execute(ctx, s->filter_slice_luma, frame, NULL, - FFMIN(frame->height, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->filter_slice_luma, frame, NULL, + FFMIN(frame->height, ff_filter_get_nb_threads(ctx))); if (frame->data[1] && frame->data[2] && !s->is_rgb) { /* chroma planes */ - ctx->internal->execute(ctx, s->filter_slice_chroma, frame, NULL, - FFMIN(frame->height, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->filter_slice_chroma, frame, NULL, + FFMIN(frame->height, ff_filter_get_nb_threads(ctx))); } } } @@ -553,11 +551,10 @@ static const AVFilterPad avfilter_vf_fade_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .config_props = config_input, .filter_frame = filter_frame, - .needs_writable = 1, }, - { NULL } }; static const AVFilterPad avfilter_vf_fade_outputs[] = { @@ -565,7 +562,6 @@ static const AVFilterPad avfilter_vf_fade_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_fade = { @@ -575,8 +571,8 @@ const AVFilter ff_vf_fade = { .priv_size = sizeof(FadeContext), .priv_class = &fade_class, .query_formats = query_formats, - .inputs = avfilter_vf_fade_inputs, - .outputs = avfilter_vf_fade_outputs, + FILTER_INPUTS(avfilter_vf_fade_inputs), + FILTER_OUTPUTS(avfilter_vf_fade_outputs), .flags = AVFILTER_FLAG_SLICE_THREADS | AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_fftdnoiz.c b/chromium/third_party/ffmpeg/libavfilter/vf_fftdnoiz.c index 78dde44e80f..110674d5a12 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_fftdnoiz.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_fftdnoiz.c @@ -135,10 +135,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRAP, AV_PIX_FMT_GBRAP10, AV_PIX_FMT_GBRAP12, AV_PIX_FMT_GBRAP16, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } typedef struct ThreadData { @@ -672,7 +669,6 @@ static const AVFilterPad fftdnoiz_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad fftdnoiz_outputs[] = { @@ -681,7 +677,6 @@ static const AVFilterPad fftdnoiz_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .request_frame = request_frame, }, - { NULL } }; const AVFilter ff_vf_fftdnoiz = { @@ -691,8 +686,8 @@ const AVFilter ff_vf_fftdnoiz = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = fftdnoiz_inputs, - .outputs = fftdnoiz_outputs, + FILTER_INPUTS(fftdnoiz_inputs), + FILTER_OUTPUTS(fftdnoiz_outputs), .priv_class = &fftdnoiz_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_fftfilt.c b/chromium/third_party/ffmpeg/libavfilter/vf_fftfilt.c index bcef9ff7d26..b1b657596d3 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_fftfilt.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_fftfilt.c @@ -404,10 +404,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pixel_fmts_fftfilt); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pixel_fmts_fftfilt); } static const AVFilterPad fftfilt_inputs[] = { @@ -417,7 +414,6 @@ static const AVFilterPad fftfilt_inputs[] = { .config_props = config_props, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad fftfilt_outputs[] = { @@ -425,7 +421,6 @@ static const AVFilterPad fftfilt_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_fftfilt = { @@ -433,8 +428,8 @@ const AVFilter ff_vf_fftfilt = { .description = NULL_IF_CONFIG_SMALL("Apply arbitrary expressions to pixels in frequency domain."), .priv_size = sizeof(FFTFILTContext), .priv_class = &fftfilt_class, - .inputs = fftfilt_inputs, - .outputs = fftfilt_outputs, + FILTER_INPUTS(fftfilt_inputs), + FILTER_OUTPUTS(fftfilt_outputs), .query_formats = query_formats, .init = initialize, .uninit = uninit, diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_field.c b/chromium/third_party/ffmpeg/libavfilter/vf_field.c index 555e615d2e8..8d06ffe6636 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_field.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_field.c @@ -89,7 +89,6 @@ static const AVFilterPad field_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad field_outputs[] = { @@ -98,14 +97,13 @@ static const AVFilterPad field_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_props_output, }, - { NULL } }; const AVFilter ff_vf_field = { .name = "field", .description = NULL_IF_CONFIG_SMALL("Extract a field from the input video."), .priv_size = sizeof(FieldContext), - .inputs = field_inputs, - .outputs = field_outputs, + FILTER_INPUTS(field_inputs), + FILTER_OUTPUTS(field_outputs), .priv_class = &field_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_fieldhint.c b/chromium/third_party/ffmpeg/libavfilter/vf_fieldhint.c index a6c0237f028..c6c2a8eebe3 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_fieldhint.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_fieldhint.c @@ -284,7 +284,6 @@ static const AVFilterPad inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -293,7 +292,6 @@ static const AVFilterPad outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .request_frame = request_frame, }, - { NULL } }; const AVFilter ff_vf_fieldhint = { @@ -304,6 +302,6 @@ const AVFilter ff_vf_fieldhint = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_fieldmatch.c b/chromium/third_party/ffmpeg/libavfilter/vf_fieldmatch.c index 9626737b400..45285eade7e 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_fieldmatch.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_fieldmatch.c @@ -682,7 +682,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) int order, field, i, match, sc = 0, ret = 0; const int *fxo; AVFrame *gen_frames[] = { NULL, NULL, NULL, NULL, NULL }; - AVFrame *dst; + AVFrame *dst = NULL; /* update frames queue(s) */ #define SLIDING_FRAME_WINDOW(prv, src, nxt) do { \ @@ -970,13 +970,13 @@ static av_cold int fieldmatch_init(AVFilterContext *ctx) }; int ret; - if ((ret = ff_insert_inpad(ctx, INPUT_MAIN, &pad)) < 0) + if ((ret = ff_append_inpad(ctx, &pad)) < 0) return ret; if (fm->ppsrc) { pad.name = "clean_src"; pad.config_props = NULL; - if ((ret = ff_insert_inpad(ctx, INPUT_CLEANSRC, &pad)) < 0) + if ((ret = ff_append_inpad(ctx, &pad)) < 0) return ret; } @@ -1037,7 +1037,6 @@ static const AVFilterPad fieldmatch_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_fieldmatch = { @@ -1049,7 +1048,7 @@ const AVFilter ff_vf_fieldmatch = { .activate = activate, .uninit = fieldmatch_uninit, .inputs = NULL, - .outputs = fieldmatch_outputs, + FILTER_OUTPUTS(fieldmatch_outputs), .priv_class = &fieldmatch_class, .flags = AVFILTER_FLAG_DYNAMIC_INPUTS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_fieldorder.c b/chromium/third_party/ffmpeg/libavfilter/vf_fieldorder.c index eefa417fb33..d34119c9209 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_fieldorder.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_fieldorder.c @@ -58,9 +58,7 @@ static int query_formats(AVFilterContext *ctx) (ret = ff_add_format(&formats, pix_fmt)) < 0) return ret; } - if ((ret = ff_formats_ref(formats, &ctx->inputs[0]->outcfg.formats)) < 0 || - (ret = ff_formats_ref(formats, &ctx->outputs[0]->incfg.formats)) < 0) - return ret; + return ff_set_common_formats(ctx, formats); } return 0; @@ -173,7 +171,6 @@ static const AVFilterPad avfilter_vf_fieldorder_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad avfilter_vf_fieldorder_outputs[] = { @@ -181,7 +178,6 @@ static const AVFilterPad avfilter_vf_fieldorder_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_fieldorder = { @@ -190,7 +186,7 @@ const AVFilter ff_vf_fieldorder = { .priv_size = sizeof(FieldOrderContext), .priv_class = &fieldorder_class, .query_formats = query_formats, - .inputs = avfilter_vf_fieldorder_inputs, - .outputs = avfilter_vf_fieldorder_outputs, + FILTER_INPUTS(avfilter_vf_fieldorder_inputs), + FILTER_OUTPUTS(avfilter_vf_fieldorder_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_fillborders.c b/chromium/third_party/ffmpeg/libavfilter/vf_fillborders.c index 2515bc9de96..4a799422b45 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_fillborders.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_fillborders.c @@ -78,10 +78,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY9, AV_PIX_FMT_GRAY10, AV_PIX_FMT_GRAY12, AV_PIX_FMT_GRAY14, AV_PIX_FMT_GRAY16, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static void smear_borders8(FillBordersContext *s, AVFrame *frame) @@ -708,11 +705,10 @@ static const AVFilterPad fillborders_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .config_props = config_input, .filter_frame = filter_frame, - .needs_writable = 1, }, - { NULL } }; static const AVFilterPad fillborders_outputs[] = { @@ -720,7 +716,6 @@ static const AVFilterPad fillborders_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_fillborders = { @@ -729,8 +724,8 @@ const AVFilter ff_vf_fillborders = { .priv_size = sizeof(FillBordersContext), .priv_class = &fillborders_class, .query_formats = query_formats, - .inputs = fillborders_inputs, - .outputs = fillborders_outputs, + FILTER_INPUTS(fillborders_inputs), + FILTER_OUTPUTS(fillborders_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, .process_command = process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_find_rect.c b/chromium/third_party/ffmpeg/libavfilter/vf_find_rect.c index 1a94655b6b1..6c126af721e 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_find_rect.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_find_rect.c @@ -67,7 +67,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static AVFrame *downscale(AVFrame *in) @@ -225,8 +225,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) snprintf(buf, sizeof(buf), "%f", best_score); - av_frame_make_writable(in); - av_dict_set_int(&in->metadata, "lavfi.rect.w", foc->obj_frame->width, 0); av_dict_set_int(&in->metadata, "lavfi.rect.h", foc->obj_frame->height, 0); av_dict_set_int(&in->metadata, "lavfi.rect.x", best_x, 0); @@ -292,7 +290,6 @@ static const AVFilterPad foc_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad foc_outputs[] = { @@ -300,7 +297,6 @@ static const AVFilterPad foc_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_find_rect = { @@ -310,7 +306,7 @@ const AVFilter ff_vf_find_rect = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = foc_inputs, - .outputs = foc_outputs, + FILTER_INPUTS(foc_inputs), + FILTER_OUTPUTS(foc_outputs), .priv_class = &find_rect_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_floodfill.c b/chromium/third_party/ffmpeg/libavfilter/vf_floodfill.c index 3b17b04c61c..21741cdb4f6 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_floodfill.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_floodfill.c @@ -367,13 +367,8 @@ static av_cold int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUV444P12, AV_PIX_FMT_YUV444P14, AV_PIX_FMT_YUV444P16, AV_PIX_FMT_YUVA444P16, AV_PIX_FMT_NONE }; - AVFilterFormats *formats; - formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } static av_cold void uninit(AVFilterContext *ctx) @@ -390,7 +385,6 @@ static const AVFilterPad floodfill_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad floodfill_outputs[] = { @@ -398,7 +392,6 @@ static const AVFilterPad floodfill_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; #define OFFSET(x) offsetof(FloodfillContext, x) @@ -427,7 +420,7 @@ const AVFilter ff_vf_floodfill = { .priv_class = &floodfill_class, .query_formats = query_formats, .uninit = uninit, - .inputs = floodfill_inputs, - .outputs = floodfill_outputs, + FILTER_INPUTS(floodfill_inputs), + FILTER_OUTPUTS(floodfill_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_format.c b/chromium/third_party/ffmpeg/libavfilter/vf_format.c index 960d4b0acfa..b34675b8e09 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_format.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_format.c @@ -129,12 +129,8 @@ static av_cold int init(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { FormatContext *s = ctx->priv; - AVFilterFormats *formats = ff_make_format_list(s->formats); - if (!formats) - return AVERROR(ENOMEM); - - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, s->formats); } @@ -153,9 +149,8 @@ static const AVFilterPad avfilter_vf_format_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .get_video_buffer = ff_null_get_video_buffer, + .get_buffer.video = ff_null_get_video_buffer, }, - { NULL } }; static const AVFilterPad avfilter_vf_format_outputs[] = { @@ -163,7 +158,6 @@ static const AVFilterPad avfilter_vf_format_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO }, - { NULL } }; const AVFilter ff_vf_format = { @@ -178,8 +172,8 @@ const AVFilter ff_vf_format = { .priv_size = sizeof(FormatContext), .priv_class = &format_class, - .inputs = avfilter_vf_format_inputs, - .outputs = avfilter_vf_format_outputs, + FILTER_INPUTS(avfilter_vf_format_inputs), + FILTER_OUTPUTS(avfilter_vf_format_outputs), }; #endif /* CONFIG_FORMAT_FILTER */ @@ -192,9 +186,8 @@ static const AVFilterPad avfilter_vf_noformat_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .get_video_buffer = ff_null_get_video_buffer, + .get_buffer.video = ff_null_get_video_buffer, }, - { NULL } }; static const AVFilterPad avfilter_vf_noformat_outputs[] = { @@ -202,7 +195,6 @@ static const AVFilterPad avfilter_vf_noformat_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO }, - { NULL } }; const AVFilter ff_vf_noformat = { @@ -217,7 +209,7 @@ const AVFilter ff_vf_noformat = { .priv_size = sizeof(FormatContext), .priv_class = &noformat_class, - .inputs = avfilter_vf_noformat_inputs, - .outputs = avfilter_vf_noformat_outputs, + FILTER_INPUTS(avfilter_vf_noformat_inputs), + FILTER_OUTPUTS(avfilter_vf_noformat_outputs), }; #endif /* CONFIG_NOFORMAT_FILTER */ diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_fps.c b/chromium/third_party/ffmpeg/libavfilter/vf_fps.c index fbc845da1b9..b8714727fab 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_fps.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_fps.c @@ -370,7 +370,6 @@ static const AVFilterPad avfilter_vf_fps_inputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; static const AVFilterPad avfilter_vf_fps_outputs[] = { @@ -379,7 +378,6 @@ static const AVFilterPad avfilter_vf_fps_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_props, }, - { NULL } }; const AVFilter ff_vf_fps = { @@ -390,6 +388,6 @@ const AVFilter ff_vf_fps = { .priv_size = sizeof(FPSContext), .priv_class = &fps_class, .activate = activate, - .inputs = avfilter_vf_fps_inputs, - .outputs = avfilter_vf_fps_outputs, + FILTER_INPUTS(avfilter_vf_fps_inputs), + FILTER_OUTPUTS(avfilter_vf_fps_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_framepack.c b/chromium/third_party/ffmpeg/libavfilter/vf_framepack.c index 4fa9b4d144f..73c973036ab 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_framepack.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_framepack.c @@ -82,10 +82,7 @@ static const enum AVPixelFormat formats_supported[] = { static int query_formats(AVFilterContext *ctx) { // this will ensure that formats are the same on all pads - AVFilterFormats *fmts_list = ff_make_format_list(formats_supported); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, formats_supported); } static av_cold void framepack_uninit(AVFilterContext *ctx) @@ -457,7 +454,6 @@ static const AVFilterPad framepack_inputs[] = { .name = "right", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; static const AVFilterPad framepack_outputs[] = { @@ -466,7 +462,6 @@ static const AVFilterPad framepack_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_framepack = { @@ -475,8 +470,8 @@ const AVFilter ff_vf_framepack = { .priv_size = sizeof(FramepackContext), .priv_class = &framepack_class, .query_formats = query_formats, - .inputs = framepack_inputs, - .outputs = framepack_outputs, + FILTER_INPUTS(framepack_inputs), + FILTER_OUTPUTS(framepack_outputs), .activate = activate, .uninit = framepack_uninit, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_framerate.c b/chromium/third_party/ffmpeg/libavfilter/vf_framerate.c index 6b509443a63..0f9994e1ac1 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_framerate.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_framerate.c @@ -146,7 +146,8 @@ static int blend_frames(AVFilterContext *ctx, int interpolate) av_frame_copy_props(s->work, s->f0); ff_dlog(ctx, "blend_frames() INTERPOLATE to create work frame\n"); - ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(FFMAX(1, outlink->h >> 2), ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_slice, &td, NULL, + FFMIN(FFMAX(1, outlink->h >> 2), ff_filter_get_nb_threads(ctx))); return 1; } return 0; @@ -231,10 +232,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } #define BLEND_FRAME_FUNC(nbits) \ @@ -429,7 +427,6 @@ static const AVFilterPad framerate_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_input, }, - { NULL } }; static const AVFilterPad framerate_outputs[] = { @@ -438,7 +435,6 @@ static const AVFilterPad framerate_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_framerate = { @@ -449,8 +445,8 @@ const AVFilter ff_vf_framerate = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = framerate_inputs, - .outputs = framerate_outputs, + FILTER_INPUTS(framerate_inputs), + FILTER_OUTPUTS(framerate_outputs), .flags = AVFILTER_FLAG_SLICE_THREADS, .activate = activate, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_framestep.c b/chromium/third_party/ffmpeg/libavfilter/vf_framestep.c index d61ce0dc56e..5509df53e93 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_framestep.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_framestep.c @@ -77,7 +77,6 @@ static const AVFilterPad framestep_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad framestep_outputs[] = { @@ -86,7 +85,6 @@ static const AVFilterPad framestep_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output_props, }, - { NULL } }; const AVFilter ff_vf_framestep = { @@ -94,7 +92,7 @@ const AVFilter ff_vf_framestep = { .description = NULL_IF_CONFIG_SMALL("Select one frame every N frames."), .priv_size = sizeof(FrameStepContext), .priv_class = &framestep_class, - .inputs = framestep_inputs, - .outputs = framestep_outputs, + FILTER_INPUTS(framestep_inputs), + FILTER_OUTPUTS(framestep_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_freezedetect.c b/chromium/third_party/ffmpeg/libavfilter/vf_freezedetect.c index 9cf8fbab15c..152ffdbe30d 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_freezedetect.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_freezedetect.c @@ -90,10 +90,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) @@ -210,7 +207,6 @@ static const AVFilterPad freezedetect_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_input, }, - { NULL } }; static const AVFilterPad freezedetect_outputs[] = { @@ -218,7 +214,6 @@ static const AVFilterPad freezedetect_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_freezedetect = { @@ -228,7 +223,7 @@ const AVFilter ff_vf_freezedetect = { .priv_class = &freezedetect_class, .uninit = uninit, .query_formats = query_formats, - .inputs = freezedetect_inputs, - .outputs = freezedetect_outputs, + FILTER_INPUTS(freezedetect_inputs), + FILTER_OUTPUTS(freezedetect_outputs), .activate = activate, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_freezeframes.c b/chromium/third_party/ffmpeg/libavfilter/vf_freezeframes.c index e29eb07cecf..a272336ff2c 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_freezeframes.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_freezeframes.c @@ -142,7 +142,6 @@ static const AVFilterPad freezeframes_inputs[] = { .name = "replace", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL }, }; static const AVFilterPad freezeframes_outputs[] = { @@ -151,7 +150,6 @@ static const AVFilterPad freezeframes_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL }, }; const AVFilter ff_vf_freezeframes = { @@ -159,8 +157,8 @@ const AVFilter ff_vf_freezeframes = { .description = NULL_IF_CONFIG_SMALL("Freeze video frames."), .priv_size = sizeof(FreezeFramesContext), .priv_class = &freezeframes_class, - .inputs = freezeframes_inputs, - .outputs = freezeframes_outputs, + FILTER_INPUTS(freezeframes_inputs), + FILTER_OUTPUTS(freezeframes_outputs), .activate = activate, .uninit = uninit, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_frei0r.c b/chromium/third_party/ffmpeg/libavfilter/vf_frei0r.c index 00e5ff24446..65191e19321 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_frei0r.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_frei0r.c @@ -402,7 +402,6 @@ static const AVFilterPad avfilter_vf_frei0r_inputs[] = { .config_props = config_input_props, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad avfilter_vf_frei0r_outputs[] = { @@ -410,7 +409,6 @@ static const AVFilterPad avfilter_vf_frei0r_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_frei0r = { @@ -421,8 +419,8 @@ const AVFilter ff_vf_frei0r = { .uninit = uninit, .priv_size = sizeof(Frei0rContext), .priv_class = &frei0r_class, - .inputs = avfilter_vf_frei0r_inputs, - .outputs = avfilter_vf_frei0r_outputs, + FILTER_INPUTS(avfilter_vf_frei0r_inputs), + FILTER_OUTPUTS(avfilter_vf_frei0r_outputs), .process_command = process_command, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; @@ -498,7 +496,6 @@ static const AVFilterPad avfilter_vsrc_frei0r_src_outputs[] = { .request_frame = source_request_frame, .config_props = source_config_props }, - { NULL } }; const AVFilter ff_vsrc_frei0r_src = { @@ -510,5 +507,5 @@ const AVFilter ff_vsrc_frei0r_src = { .uninit = uninit, .query_formats = query_formats, .inputs = NULL, - .outputs = avfilter_vsrc_frei0r_src_outputs, + FILTER_OUTPUTS(avfilter_vsrc_frei0r_src_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_fspp.c b/chromium/third_party/ffmpeg/libavfilter/vf_fspp.c index 44d22fc1e44..238dbcb4299 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_fspp.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_fspp.c @@ -503,10 +503,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) @@ -656,7 +653,6 @@ static const AVFilterPad fspp_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad fspp_outputs[] = { @@ -664,7 +660,6 @@ static const AVFilterPad fspp_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_fspp = { @@ -673,8 +668,8 @@ const AVFilter ff_vf_fspp = { .priv_size = sizeof(FSPPContext), .uninit = uninit, .query_formats = query_formats, - .inputs = fspp_inputs, - .outputs = fspp_outputs, + FILTER_INPUTS(fspp_inputs), + FILTER_OUTPUTS(fspp_outputs), .priv_class = &fspp_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_gblur.c b/chromium/third_party/ffmpeg/libavfilter/vf_gblur.c index 3f61275658f..ad48eae6722 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_gblur.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_gblur.c @@ -64,7 +64,7 @@ static void postscale_c(float *buffer, int length, } static void horiz_slice_c(float *buffer, int width, int height, int steps, - float nu, float bscale) + float nu, float bscale, float *localbuf) { int step, x, y; float *ptr; @@ -97,9 +97,13 @@ static int filter_horizontally(AVFilterContext *ctx, void *arg, int jobnr, int n const int steps = s->steps; const float nu = s->nu; float *buffer = s->buffer; + float *localbuf = NULL; + + if (s->localbuf) + localbuf = s->localbuf + s->stride * width * slice_start; s->horiz_slice(buffer + width * slice_start, width, slice_end - slice_start, - steps, nu, boundaryscale); + steps, nu, boundaryscale, localbuf); emms_c(); return 0; } @@ -138,6 +142,19 @@ static void do_vertical_columns(float *buffer, int width, int height, } } +static void verti_slice_c(float *buffer, int width, int height, + int slice_start, int slice_end, int steps, + float nu, float boundaryscale) +{ + int aligned_end = slice_start + (((slice_end - slice_start) >> 3) << 3); + /* Filter vertically along columns (process 8 columns in each step) */ + do_vertical_columns(buffer, width, height, slice_start, aligned_end, + steps, nu, boundaryscale, 8); + /* Filter un-aligned columns one by one */ + do_vertical_columns(buffer, width, height, aligned_end, slice_end, + steps, nu, boundaryscale, 1); +} + static int filter_vertically(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) { GBlurContext *s = ctx->priv; @@ -150,16 +167,10 @@ static int filter_vertically(AVFilterContext *ctx, void *arg, int jobnr, int nb_ const int steps = s->steps; const float nu = s->nuV; float *buffer = s->buffer; - int aligned_end; - aligned_end = slice_start + (((slice_end - slice_start) >> 3) << 3); - /* Filter vertically along columns (process 8 columns in each step) */ - do_vertical_columns(buffer, width, height, slice_start, aligned_end, - steps, nu, boundaryscale, 8); + s->verti_slice(buffer, width, height, slice_start, slice_end, + steps, nu, boundaryscale); - /* Filter un-aligned columns one by one */ - do_vertical_columns(buffer, width, height, aligned_end, slice_end, - steps, nu, boundaryscale, 1); return 0; } @@ -196,9 +207,12 @@ static void gaussianiir2d(AVFilterContext *ctx, int plane) td.width = width; td.height = height; - ctx->internal->execute(ctx, filter_horizontally, &td, NULL, FFMIN(height, nb_threads)); - ctx->internal->execute(ctx, filter_vertically, &td, NULL, FFMIN(width, nb_threads)); - ctx->internal->execute(ctx, filter_postscale, &td, NULL, FFMIN(width * height, nb_threads)); + ff_filter_execute(ctx, filter_horizontally, &td, + NULL, FFMIN(height, nb_threads)); + ff_filter_execute(ctx, filter_vertically, &td, + NULL, FFMIN(width, nb_threads)); + ff_filter_execute(ctx, filter_postscale, &td, + NULL, FFMIN(width * height, nb_threads)); } static int query_formats(AVFilterContext *ctx) @@ -227,12 +241,14 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } void ff_gblur_init(GBlurContext *s) { + s->localbuf = NULL; s->horiz_slice = horiz_slice_c; + s->verti_slice = verti_slice_c; s->postscale_slice = postscale_c; if (ARCH_X86) ff_gblur_init_x86(s); @@ -373,6 +389,8 @@ static av_cold void uninit(AVFilterContext *ctx) GBlurContext *s = ctx->priv; av_freep(&s->buffer); + if (s->localbuf) + av_free(s->localbuf); } static const AVFilterPad gblur_inputs[] = { @@ -382,7 +400,6 @@ static const AVFilterPad gblur_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad gblur_outputs[] = { @@ -390,7 +407,6 @@ static const AVFilterPad gblur_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_gblur = { @@ -400,8 +416,8 @@ const AVFilter ff_vf_gblur = { .priv_class = &gblur_class, .uninit = uninit, .query_formats = query_formats, - .inputs = gblur_inputs, - .outputs = gblur_outputs, + FILTER_INPUTS(gblur_inputs), + FILTER_OUTPUTS(gblur_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = ff_filter_process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_geq.c b/chromium/third_party/ffmpeg/libavfilter/vf_geq.c index d9bb6ac256f..4a783365407 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_geq.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_geq.c @@ -335,15 +335,9 @@ static int geq_query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRP16, AV_PIX_FMT_GBRAP16, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list; + const enum AVPixelFormat *pix_fmts = geq->is_rgb ? rgb_pix_fmts : yuv_pix_fmts; - if (geq->is_rgb) { - fmts_list = ff_make_format_list(rgb_pix_fmts); - } else - fmts_list = ff_make_format_list(yuv_pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int geq_config_props(AVFilterLink *inlink) @@ -455,7 +449,8 @@ static int geq_filter_frame(AVFilterLink *inlink, AVFrame *in) if (geq->needs_sum[plane]) calculate_sums(geq, plane, width, height); - ctx->internal->execute(ctx, slice_geq_filter, &td, NULL, FFMIN(height, nb_threads)); + ff_filter_execute(ctx, slice_geq_filter, &td, + NULL, FFMIN(height, nb_threads)); } av_frame_free(&geq->picref); @@ -481,7 +476,6 @@ static const AVFilterPad geq_inputs[] = { .config_props = geq_config_props, .filter_frame = geq_filter_frame, }, - { NULL } }; static const AVFilterPad geq_outputs[] = { @@ -489,7 +483,6 @@ static const AVFilterPad geq_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_geq = { @@ -499,8 +492,8 @@ const AVFilter ff_vf_geq = { .init = geq_init, .uninit = geq_uninit, .query_formats = geq_query_formats, - .inputs = geq_inputs, - .outputs = geq_outputs, + FILTER_INPUTS(geq_inputs), + FILTER_OUTPUTS(geq_outputs), .priv_class = &geq_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_gradfun.c b/chromium/third_party/ffmpeg/libavfilter/vf_gradfun.c index af77b13d4d2..6171e75a286 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_gradfun.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_gradfun.c @@ -155,10 +155,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRP, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) @@ -240,7 +237,6 @@ static const AVFilterPad avfilter_vf_gradfun_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad avfilter_vf_gradfun_outputs[] = { @@ -248,7 +244,6 @@ static const AVFilterPad avfilter_vf_gradfun_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_gradfun = { @@ -259,7 +254,7 @@ const AVFilter ff_vf_gradfun = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = avfilter_vf_gradfun_inputs, - .outputs = avfilter_vf_gradfun_outputs, + FILTER_INPUTS(avfilter_vf_gradfun_inputs), + FILTER_OUTPUTS(avfilter_vf_gradfun_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_grayworld.c b/chromium/third_party/ffmpeg/libavfilter/vf_grayworld.c new file mode 100644 index 00000000000..fd424527e2d --- /dev/null +++ b/chromium/third_party/ffmpeg/libavfilter/vf_grayworld.c @@ -0,0 +1,337 @@ +/* + * Copyright (c) 2021 Paul Buxton + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + + /** + * @file + * Color correction filter based on + * https://www.researchgate.net/publication/275213614_A_New_Color_Correction_Method_for_Underwater_Imaging + * + */ + +#include "libavutil/imgutils.h" +#include "libavutil/opt.h" +#include "libavutil/pixdesc.h" + +#include "avfilter.h" +#include "formats.h" +#include "internal.h" +#include "video.h" + +typedef struct ThreadData { + AVFrame *in, *out; + float l_avg; + float a_avg; + float b_avg; +} ThreadData; + +typedef struct GrayWorldContext { + const AVClass *class; + float *tmpplab; + int *line_count_pels; + float *line_sum; +} GrayWorldContext; + +#define OFFSET(x) offsetof(GrayWorldContext, x) +#define FLAGS AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_RUNTIME_PARAM +static const AVOption grayworld_options[] = { + { NULL } +}; + +AVFILTER_DEFINE_CLASS(grayworld); + +static int query_formats(AVFilterContext *ctx) +{ + static const enum AVPixelFormat pix_fmts[] = { + AV_PIX_FMT_GBRPF32, AV_PIX_FMT_GBRAPF32, + AV_PIX_FMT_NONE, + }; + return ff_set_common_formats_from_list(ctx, pix_fmts); +} + +static void apply_matrix(const float matrix[3][3], const float input[3], float output[3]) +{ + output[0] = matrix[0][0] * input[0] + matrix[0][1] * input[1] + matrix[0][2] * input[2]; + output[1] = matrix[1][0] * input[0] + matrix[1][1] * input[1] + matrix[1][2] * input[2]; + output[2] = matrix[2][0] * input[0] + matrix[2][1] * input[1] + matrix[2][2] * input[2]; +} + +static const float lms2lab[3][3] = { + {0.5774, 0.5774, 0.5774}, + {0.40825, 0.40825, -0.816458}, + {0.707, -0.707, 0} +}; + +static const float lab2lms[3][3] = { + {0.57735, 0.40825, 0.707}, + {0.57735, 0.40825, -0.707}, + {0.57735, -0.8165, 0} +}; + +static const float rgb2lms[3][3] = { + {0.3811, 0.5783, 0.0402}, + {0.1967, 0.7244, 0.0782}, + {0.0241, 0.1288, 0.8444} +}; + +static const float lms2rgb[3][3] = { + {4.4679, -3.5873, 0.1193}, + {-1.2186, 2.3809, -0.1624}, + {0.0497, -0.2439, 1.2045} +}; + +/** + * Convert from Linear RGB to logspace LAB + * + * @param rgb Input array of rgb components + * @param lab output array of lab components + */ +static void rgb2lab(const float rgb[3], float lab[3]) +{ + float lms[3]; + + apply_matrix(rgb2lms, rgb, lms); + lms[0] = lms[0] > 0.f ? logf(lms[0]) : -1024.f; + lms[1] = lms[1] > 0.f ? logf(lms[1]) : -1024.f; + lms[2] = lms[2] > 0.f ? logf(lms[2]) : -1024.f; + apply_matrix(lms2lab, lms, lab); +} + +/** + * Convert from Logspace LAB to Linear RGB + * + * @param lab input array of lab components + * @param rgb output array of rgb components + */ +static void lab2rgb(const float lab[3], float rgb[3]) +{ + float lms[3]; + + apply_matrix(lab2lms, lab, lms); + lms[0] = expf(lms[0]); + lms[1] = expf(lms[1]); + lms[2] = expf(lms[2]); + apply_matrix(lms2rgb, lms, rgb); +} + +/** + * Convert a frame from linear RGB to logspace LAB, and accumulate channel totals for each row + * Convert from RGB -> lms using equation 4 in color transfer paper. + * + * @param ctx Filter context + * @param arg Thread data pointer + * @param jobnr job number + * @param nb_jobs number of jobs + */ +static int convert_frame(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) +{ + GrayWorldContext *s = ctx->priv; + ThreadData *td = arg; + AVFrame *in = td->in; + AVFrame *out = td->out; + AVFilterLink *outlink = ctx->outputs[0]; + const int slice_start = (out->height * jobnr) / nb_jobs; + const int slice_end = (out->height * (jobnr + 1)) / nb_jobs; + float rgb[3], lab[3]; + + for (int i = slice_start; i < slice_end; i++) { + float *b_in_row = (float *)(in->data[1] + i * in->linesize[1]); + float *g_in_row = (float *)(in->data[0] + i * in->linesize[0]); + float *r_in_row = (float *)(in->data[2] + i * in->linesize[2]); + float *acur = s->tmpplab + i * outlink->w + outlink->w * outlink->h; + float *bcur = s->tmpplab + i * outlink->w + 2 * outlink->w * outlink->h; + float *lcur = s->tmpplab + i * outlink->w; + + s->line_sum[i] = 0.f; + s->line_sum[i + outlink->h] = 0.f; + s->line_count_pels[i] = 0; + + for (int j = 0; j < outlink->w; j++) { + rgb[0] = r_in_row[j]; + rgb[1] = g_in_row[j]; + rgb[2] = b_in_row[j]; + rgb2lab(rgb, lab); + *(lcur++) = lab[0]; + *(acur++) = lab[1]; + *(bcur++) = lab[2]; + s->line_sum[i] += lab[1]; + s->line_sum[i + outlink->h] += lab[2]; + s->line_count_pels[i]++; + } + } + return 0; +} + +/** + * Sum the channel totals and compute the mean for each channel + * + * @param s Frame context + * @param td thread data + */ +static void compute_correction(GrayWorldContext *s, ThreadData *td) +{ + float asum = 0.f, bsum = 0.f; + int pixels = 0; + + for (int y = 0; y < td->out->height; y++) { + asum += s->line_sum[y]; + bsum += s->line_sum[y + td->out->height]; + pixels += s->line_count_pels[y]; + } + + td->a_avg = asum / pixels; + td->b_avg = bsum / pixels; +} + +/** + * Subtract the mean logspace AB values from each pixel. + * + * @param ctx Filter context + * @param arg Thread data pointer + * @param jobnr job number + * @param nb_jobs number of jobs + */ +static int correct_frame(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) +{ + GrayWorldContext *s = ctx->priv; + ThreadData *td = arg; + AVFrame *out = td->out; + AVFilterLink *outlink = ctx->outputs[0]; + const int slice_start = (out->height * jobnr) / nb_jobs; + const int slice_end = (out->height * (jobnr + 1)) / nb_jobs; + float rgb[3], lab[3]; + + for (int i = slice_start; i < slice_end; i++) { + float *g_out_row = (float *)(out->data[0] + i * out->linesize[0]); + float *b_out_row = (float *)(out->data[1] + i * out->linesize[1]); + float *r_out_row = (float *)(out->data[2] + i * out->linesize[2]); + float *lcur = s->tmpplab + i * outlink->w; + float *acur = s->tmpplab + i * outlink->w + outlink->w * outlink->h; + float *bcur = s->tmpplab + i * outlink->w + 2 * outlink->w * outlink->h; + + for (int j = 0; j < outlink->w; j++) { + lab[0] = *lcur++; + lab[1] = *acur++; + lab[2] = *bcur++; + + // subtract the average for the color channels + lab[1] -= td->a_avg; + lab[2] -= td->b_avg; + + //convert back to linear rgb + lab2rgb(lab, rgb); + r_out_row[j] = rgb[0]; + g_out_row[j] = rgb[1]; + b_out_row[j] = rgb[2]; + } + } + return 0; +} + +static int config_input(AVFilterLink *inlink) +{ + GrayWorldContext *s = inlink->dst->priv; + + FF_ALLOC_TYPED_ARRAY(s->tmpplab, inlink->h * inlink->w * 3); + FF_ALLOC_TYPED_ARRAY(s->line_count_pels, inlink->h); + FF_ALLOC_TYPED_ARRAY(s->line_sum, inlink->h * 2); + if (!s->tmpplab || !s->line_count_pels || !s->line_sum) + return AVERROR(ENOMEM); + + return 0; +} + +static av_cold void uninit(AVFilterContext *ctx) +{ + GrayWorldContext *s = ctx->priv; + + av_freep(&s->tmpplab); + av_freep(&s->line_count_pels); + av_freep(&s->line_sum); +} + +static int filter_frame(AVFilterLink *inlink, AVFrame *in) +{ + AVFilterContext *ctx = inlink->dst; + GrayWorldContext *s = ctx->priv; + AVFilterLink *outlink = ctx->outputs[0]; + ThreadData td; + AVFrame *out; + + if (av_frame_is_writable(in)) { + out = in; + } else { + out = ff_get_video_buffer(outlink, outlink->w, outlink->h); + if (!out) { + av_frame_free(&in); + return AVERROR(ENOMEM); + } + av_frame_copy_props(out, in); + } + /* input and output transfer will be linear */ + if (in->color_trc == AVCOL_TRC_UNSPECIFIED) { + av_log(s, AV_LOG_WARNING, "Untagged transfer, assuming linear light.\n"); + out->color_trc = AVCOL_TRC_LINEAR; + } else if (in->color_trc != AVCOL_TRC_LINEAR) { + av_log(s, AV_LOG_WARNING, "Gray world color correction works on linear light only.\n"); + } + + td.in = in; + td.out = out; + + ff_filter_execute(ctx, convert_frame, &td, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); + compute_correction(s, &td); + ff_filter_execute(ctx, correct_frame, &td, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); + + if (in != out) { + av_image_copy_plane(out->data[3], out->linesize[3], + in->data[3], in->linesize[3], outlink->w * 4, outlink->h); + av_frame_free(&in); + } + + return ff_filter_frame(outlink, out); +} + +static const AVFilterPad grayworld_inputs[] = { + { + .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .filter_frame = filter_frame, + .config_props = config_input, + } +}; + +static const AVFilterPad grayworld_outputs[] = { + { + .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + } +}; + +const AVFilter ff_vf_grayworld = { + .name = "grayworld", + .description = NULL_IF_CONFIG_SMALL("Adjust white balance using LAB gray world algorithm"), + .priv_size = sizeof(GrayWorldContext), + .priv_class = &grayworld_class, + .query_formats = query_formats, + FILTER_INPUTS(grayworld_inputs), + FILTER_OUTPUTS(grayworld_outputs), + .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, + .uninit = uninit, +}; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_guided.c b/chromium/third_party/ffmpeg/libavfilter/vf_guided.c index 202a6a0586f..f808ba10430 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_guided.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_guided.c @@ -150,7 +150,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) @@ -250,16 +250,16 @@ static int guided_##name(AVFilterContext *ctx, GuidedContext *s, t.dstStride = w; \ t.src = I; \ t.dst = meanI; \ - ctx->internal->execute(ctx, s->box_slice, &t, NULL, FFMIN(h, nb_threads)); \ + ff_filter_execute(ctx, s->box_slice, &t, NULL, FFMIN(h, nb_threads)); \ t.src = II; \ t.dst = meanII; \ - ctx->internal->execute(ctx, s->box_slice, &t, NULL, FFMIN(h, nb_threads)); \ + ff_filter_execute(ctx, s->box_slice, &t, NULL, FFMIN(h, nb_threads)); \ t.src = P; \ t.dst = meanP; \ - ctx->internal->execute(ctx, s->box_slice, &t, NULL, FFMIN(h, nb_threads)); \ + ff_filter_execute(ctx, s->box_slice, &t, NULL, FFMIN(h, nb_threads)); \ t.src = IP; \ t.dst = meanIP; \ - ctx->internal->execute(ctx, s->box_slice, &t, NULL, FFMIN(h, nb_threads)); \ + ff_filter_execute(ctx, s->box_slice, &t, NULL, FFMIN(h, nb_threads)); \ \ for (int i = 0;i < h;i++) { \ for (int j = 0;j < w;j++) { \ @@ -273,10 +273,10 @@ static int guided_##name(AVFilterContext *ctx, GuidedContext *s, \ t.src = A; \ t.dst = meanA; \ - ctx->internal->execute(ctx, s->box_slice, &t, NULL, FFMIN(h, nb_threads)); \ + ff_filter_execute(ctx, s->box_slice, &t, NULL, FFMIN(h, nb_threads)); \ t.src = B; \ t.dst = meanB; \ - ctx->internal->execute(ctx, s->box_slice, &t, NULL, FFMIN(h, nb_threads)); \ + ff_filter_execute(ctx, s->box_slice, &t, NULL, FFMIN(h, nb_threads)); \ \ for (int i = 0;i < height;i++) { \ for (int j = 0;j < width;j++) { \ @@ -442,7 +442,7 @@ static av_cold int init(AVFilterContext *ctx) pad.name = "source"; pad.config_props = config_input; - if ((ret = ff_insert_inpad(ctx, 0, &pad)) < 0) + if ((ret = ff_append_inpad(ctx, &pad)) < 0) return ret; if (s->guidance == ON) { @@ -450,7 +450,7 @@ static av_cold int init(AVFilterContext *ctx) pad.name = "guidance"; pad.config_props = NULL; - if ((ret = ff_insert_inpad(ctx, 1, &pad)) < 0) + if ((ret = ff_append_inpad(ctx, &pad)) < 0) return ret; } @@ -486,7 +486,6 @@ static const AVFilterPad guided_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_guided = { @@ -499,7 +498,8 @@ const AVFilter ff_vf_guided = { .priv_class = &guided_class, .activate = activate, .inputs = NULL, - .outputs = guided_outputs, - .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, + FILTER_OUTPUTS(guided_outputs), + .flags = AVFILTER_FLAG_DYNAMIC_INPUTS | AVFILTER_FLAG_SLICE_THREADS | + AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, .process_command = process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_hflip.c b/chromium/third_party/ffmpeg/libavfilter/vf_hflip.c index 2a0defda6c4..7b5650a821f 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_hflip.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_hflip.c @@ -221,7 +221,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) memcpy(out->data[1], in->data[1], AVPALETTE_SIZE); td.in = in, td.out = out; - ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_slice, &td, NULL, + FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); av_frame_free(&in); return ff_filter_frame(outlink, out); @@ -234,7 +235,6 @@ static const AVFilterPad avfilter_vf_hflip_inputs[] = { .filter_frame = filter_frame, .config_props = config_props, }, - { NULL } }; static const AVFilterPad avfilter_vf_hflip_outputs[] = { @@ -242,7 +242,6 @@ static const AVFilterPad avfilter_vf_hflip_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_hflip = { @@ -251,7 +250,7 @@ const AVFilter ff_vf_hflip = { .priv_size = sizeof(FlipContext), .priv_class = &hflip_class, .query_formats = query_formats, - .inputs = avfilter_vf_hflip_inputs, - .outputs = avfilter_vf_hflip_outputs, + FILTER_INPUTS(avfilter_vf_hflip_inputs), + FILTER_OUTPUTS(avfilter_vf_hflip_outputs), .flags = AVFILTER_FLAG_SLICE_THREADS | AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_histeq.c b/chromium/third_party/ffmpeg/libavfilter/vf_histeq.c index dea819e672d..d37dc073897 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_histeq.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_histeq.c @@ -100,10 +100,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) @@ -259,7 +256,6 @@ static const AVFilterPad histeq_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad histeq_outputs[] = { @@ -267,7 +263,6 @@ static const AVFilterPad histeq_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_histeq = { @@ -276,8 +271,8 @@ const AVFilter ff_vf_histeq = { .priv_size = sizeof(HisteqContext), .init = init, .query_formats = query_formats, - .inputs = histeq_inputs, - .outputs = histeq_outputs, + FILTER_INPUTS(histeq_inputs), + FILTER_OUTPUTS(histeq_outputs), .priv_class = &histeq_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_histogram.c b/chromium/third_party/ffmpeg/libavfilter/vf_histogram.c index bd9408c42d2..ff79d2130cd 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_histogram.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_histogram.c @@ -488,7 +488,6 @@ static const AVFilterPad inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -497,7 +496,6 @@ static const AVFilterPad outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; #if CONFIG_HISTOGRAM_FILTER @@ -507,8 +505,8 @@ const AVFilter ff_vf_histogram = { .description = NULL_IF_CONFIG_SMALL("Compute and draw a histogram."), .priv_size = sizeof(HistogramContext), .query_formats = query_formats, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .priv_class = &histogram_class, }; @@ -549,8 +547,8 @@ const AVFilter ff_vf_thistogram = { .description = NULL_IF_CONFIG_SMALL("Compute and draw a temporal histogram."), .priv_size = sizeof(HistogramContext), .query_formats = query_formats, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .uninit = uninit, .priv_class = &thistogram_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_hqdn3d.c b/chromium/third_party/ffmpeg/libavfilter/vf_hqdn3d.c index bd3eb2d01c0..f11fc46ae5f 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_hqdn3d.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_hqdn3d.c @@ -244,10 +244,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUV420P16, AV_PIX_FMT_YUV422P16, AV_PIX_FMT_YUV444P16, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static void calc_coefs(AVFilterContext *ctx) @@ -340,7 +337,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.out = out; td.direct = direct; /* one thread per plane */ - ctx->internal->execute(ctx, do_denoise, &td, NULL, 3); + ff_filter_execute(ctx, do_denoise, &td, NULL, 3); if (ctx->is_disabled) { av_frame_free(&out); @@ -386,7 +383,6 @@ static const AVFilterPad avfilter_vf_hqdn3d_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; @@ -395,7 +391,6 @@ static const AVFilterPad avfilter_vf_hqdn3d_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO }, - { NULL } }; const AVFilter ff_vf_hqdn3d = { @@ -406,8 +401,8 @@ const AVFilter ff_vf_hqdn3d = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = avfilter_vf_hqdn3d_inputs, - .outputs = avfilter_vf_hqdn3d_outputs, + FILTER_INPUTS(avfilter_vf_hqdn3d_inputs), + FILTER_OUTPUTS(avfilter_vf_hqdn3d_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, .process_command = process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_hqx.c b/chromium/third_party/ffmpeg/libavfilter/vf_hqx.c index 8b0d794b6e5..8adb1524b00 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_hqx.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_hqx.c @@ -464,10 +464,7 @@ HQX_FUNC(4) static int query_formats(AVFilterContext *ctx) { static const enum AVPixelFormat pix_fmts[] = {AV_PIX_FMT_RGB32, AV_PIX_FMT_NONE}; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_output(AVFilterLink *outlink) @@ -502,7 +499,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.in = in; td.out = out; td.rgbtoyuv = hqx->rgbtoyuv; - ctx->internal->execute(ctx, hqx->func, &td, NULL, FFMIN(inlink->h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, hqx->func, &td, NULL, + FFMIN(inlink->h, ff_filter_get_nb_threads(ctx))); av_frame_free(&in); return ff_filter_frame(outlink, out); @@ -541,7 +539,6 @@ static const AVFilterPad hqx_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad hqx_outputs[] = { @@ -550,7 +547,6 @@ static const AVFilterPad hqx_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_hqx = { @@ -559,8 +555,8 @@ const AVFilter ff_vf_hqx = { .priv_size = sizeof(HQXContext), .init = init, .query_formats = query_formats, - .inputs = hqx_inputs, - .outputs = hqx_outputs, + FILTER_INPUTS(hqx_inputs), + FILTER_OUTPUTS(hqx_outputs), .priv_class = &hqx_class, .flags = AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_hsvkey.c b/chromium/third_party/ffmpeg/libavfilter/vf_hsvkey.c new file mode 100644 index 00000000000..2f2f0377140 --- /dev/null +++ b/chromium/third_party/ffmpeg/libavfilter/vf_hsvkey.c @@ -0,0 +1,380 @@ +/* + * Copyright (c) 2021 Paul B Mahol + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include <float.h> + +#include "libavutil/opt.h" +#include "libavutil/imgutils.h" +#include "libavutil/intreadwrite.h" +#include "avfilter.h" +#include "formats.h" +#include "internal.h" +#include "video.h" + +typedef struct HSVKeyContext { + const AVClass *class; + + float hue, hue_opt, sat, val; + float similarity; + float blend; + + float scale; + + float half; + + int depth; + int max; + + int hsub_log2; + int vsub_log2; + + int (*do_slice)(AVFilterContext *ctx, void *arg, + int jobnr, int nb_jobs); +} HSVKeyContext; + +#define SQR(x) ((x)*(x)) + +static int do_hsvkey_pixel(HSVKeyContext *s, int y, int u, int v, + float hue_key, float sat_key, float val_key) +{ + const float similarity = s->similarity; + const float scale = s->scale; + const float blend = s->blend; + const int imax = s->max; + const float max = imax; + const float half = s->half; + const float uf = u - half; + const float vf = v - half; + const float hue = hue_key < 0.f ? -hue_key : atan2f(uf, vf) + M_PI; + const float sat = sat_key < 0.f ? -sat_key : sqrtf((uf * uf + vf * vf) / (half * half * 2.f)); + const float val = val_key < 0.f ? -val_key : scale * y; + float diff; + + hue_key = fabsf(hue_key); + sat_key = fabsf(sat_key); + val_key = fabsf(val_key); + + diff = sqrtf(fmaxf(SQR(sat) * SQR(val) + + SQR(sat_key) * SQR(val_key) - + 2.f * sat * val * sat_key * val_key * cosf(hue_key - hue) + + SQR(val - val_key), 0.f)); + if (diff < similarity) { + return 0; + } else if (blend > FLT_MIN) { + return av_clipf((diff - similarity) / blend, 0.f, 1.f) * max; + } else { + return imax; + } + + return 0; +} + +static int do_hsvkey_slice(AVFilterContext *avctx, void *arg, int jobnr, int nb_jobs) +{ + HSVKeyContext *s = avctx->priv; + AVFrame *frame = arg; + const int slice_start = (frame->height * jobnr) / nb_jobs; + const int slice_end = (frame->height * (jobnr + 1)) / nb_jobs; + const int hsub_log2 = s->hsub_log2; + const int vsub_log2 = s->vsub_log2; + const float hue = s->hue; + const float sat = s->sat; + const float val = s->val; + + for (int y = slice_start; y < slice_end; y++) { + for (int x = 0; x < frame->width; x++) { + int Y = frame->data[0][frame->linesize[0] * y + x]; + int u = frame->data[1][frame->linesize[1] * (y >> vsub_log2) + (x >> hsub_log2)]; + int v = frame->data[2][frame->linesize[2] * (y >> vsub_log2) + (x >> hsub_log2)]; + + frame->data[3][frame->linesize[3] * y + x] = do_hsvkey_pixel(s, Y, u, v, hue, sat, val); + } + } + + return 0; +} + +static int do_hsvkey16_slice(AVFilterContext *avctx, void *arg, int jobnr, int nb_jobs) +{ + HSVKeyContext *s = avctx->priv; + AVFrame *frame = arg; + const int slice_start = (frame->height * jobnr) / nb_jobs; + const int slice_end = (frame->height * (jobnr + 1)) / nb_jobs; + const int hsub_log2 = s->hsub_log2; + const int vsub_log2 = s->vsub_log2; + const float hue = s->hue; + const float sat = s->sat; + const float val = s->val; + + for (int y = slice_start; y < slice_end; ++y) { + for (int x = 0; x < frame->width; ++x) { + uint16_t *dst = (uint16_t *)(frame->data[3] + frame->linesize[3] * y); + int Y = AV_RN16(&frame->data[0][frame->linesize[0] * y + 2 * x]); + int u = AV_RN16(&frame->data[1][frame->linesize[1] * (y >> vsub_log2) + 2 * (x >> hsub_log2)]); + int v = AV_RN16(&frame->data[2][frame->linesize[2] * (y >> vsub_log2) + 2 * (x >> hsub_log2)]); + + dst[x] = do_hsvkey_pixel(s, Y, u, v, hue, sat, val); + } + } + + return 0; +} + +static int do_hsvhold_slice(AVFilterContext *avctx, void *arg, int jobnr, int nb_jobs) +{ + HSVKeyContext *s = avctx->priv; + AVFrame *frame = arg; + const int hsub_log2 = s->hsub_log2; + const int vsub_log2 = s->vsub_log2; + const int width = frame->width >> hsub_log2; + const int height = frame->height >> vsub_log2; + const int slice_start = (height * jobnr) / nb_jobs; + const int slice_end = (height * (jobnr + 1)) / nb_jobs; + const float scale = s->scale; + const float hue = s->hue; + const float sat = s->sat; + const float val = s->val; + + for (int y = slice_start; y < slice_end; ++y) { + for (int x = 0; x < width; ++x) { + uint8_t *dstu = frame->data[1] + frame->linesize[1] * y; + uint8_t *dstv = frame->data[2] + frame->linesize[2] * y; + int Y = frame->data[0][frame->linesize[0] * (y << vsub_log2) + (x << hsub_log2)]; + int u = frame->data[1][frame->linesize[1] * y + x]; + int v = frame->data[2][frame->linesize[2] * y + x]; + int t = do_hsvkey_pixel(s, Y, u, v, hue, sat, val); + + if (t > 0) { + float f = 1.f - t * scale; + + dstu[x] = 128 + (u - 128) * f; + dstv[x] = 128 + (v - 128) * f; + } + } + } + + return 0; +} + +static int do_hsvhold16_slice(AVFilterContext *avctx, void *arg, int jobnr, int nb_jobs) +{ + HSVKeyContext *s = avctx->priv; + AVFrame *frame = arg; + const int hsub_log2 = s->hsub_log2; + const int vsub_log2 = s->vsub_log2; + const int width = frame->width >> hsub_log2; + const int height = frame->height >> vsub_log2; + const int slice_start = (height * jobnr) / nb_jobs; + const int slice_end = (height * (jobnr + 1)) / nb_jobs; + const float scale = s->scale; + const float half = s->half; + const float hue = s->hue; + const float sat = s->sat; + const float val = s->val; + + for (int y = slice_start; y < slice_end; ++y) { + for (int x = 0; x < width; ++x) { + uint16_t *dstu = (uint16_t *)(frame->data[1] + frame->linesize[1] * y); + uint16_t *dstv = (uint16_t *)(frame->data[2] + frame->linesize[2] * y); + int Y = AV_RN16(&frame->data[0][frame->linesize[0] * (y << vsub_log2) + 2 * (x << hsub_log2)]); + int u = AV_RN16(&frame->data[1][frame->linesize[1] * y + 2 * x]); + int v = AV_RN16(&frame->data[2][frame->linesize[2] * y + 2 * x]); + int t = do_hsvkey_pixel(s, Y, u, v, hue, sat, val); + + if (t > 0) { + float f = 1.f - t * scale; + + dstu[x] = half + (u - half) * f; + dstv[x] = half + (v - half) * f; + } + } + } + + return 0; +} + +static int filter_frame(AVFilterLink *link, AVFrame *frame) +{ + AVFilterContext *avctx = link->dst; + HSVKeyContext *s = avctx->priv; + int res; + + s->hue = FFSIGN(s->hue_opt) *M_PI * fmodf(526.f - fabsf(s->hue_opt), 360.f) / 180.f; + if (res = ff_filter_execute(avctx, s->do_slice, frame, NULL, + FFMIN(frame->height, ff_filter_get_nb_threads(avctx)))) + return res; + + return ff_filter_frame(avctx->outputs[0], frame); +} + +static av_cold int config_output(AVFilterLink *outlink) +{ + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(outlink->format); + AVFilterContext *avctx = outlink->src; + HSVKeyContext *s = avctx->priv; + + s->depth = desc->comp[0].depth; + s->max = (1 << s->depth) - 1; + s->half = 0.5f * s->max; + s->scale = 1.f / s->max; + + if (!strcmp(avctx->filter->name, "hsvkey")) { + s->do_slice = s->depth <= 8 ? do_hsvkey_slice : do_hsvkey16_slice; + } else { + s->do_slice = s->depth <= 8 ? do_hsvhold_slice: do_hsvhold16_slice; + } + + return 0; +} + +static av_cold int query_formats(AVFilterContext *avctx) +{ + static const enum AVPixelFormat pixel_fmts[] = { + AV_PIX_FMT_YUVA420P, + AV_PIX_FMT_YUVA422P, + AV_PIX_FMT_YUVA444P, + AV_PIX_FMT_YUVA420P9, AV_PIX_FMT_YUVA422P9, AV_PIX_FMT_YUVA444P9, + AV_PIX_FMT_YUVA420P10, AV_PIX_FMT_YUVA422P10, AV_PIX_FMT_YUVA444P10, + AV_PIX_FMT_YUVA422P12, AV_PIX_FMT_YUVA444P12, + AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_YUVA422P16, AV_PIX_FMT_YUVA444P16, + AV_PIX_FMT_NONE + }; + + static const enum AVPixelFormat hold_pixel_fmts[] = { + AV_PIX_FMT_YUV420P, + AV_PIX_FMT_YUV422P, + AV_PIX_FMT_YUV444P, + AV_PIX_FMT_YUVA420P, + AV_PIX_FMT_YUVA422P, + AV_PIX_FMT_YUVA444P, + AV_PIX_FMT_YUV420P9, AV_PIX_FMT_YUV422P9, AV_PIX_FMT_YUV444P9, + AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV444P10, + AV_PIX_FMT_YUV444P12, AV_PIX_FMT_YUV422P12, AV_PIX_FMT_YUV420P12, + AV_PIX_FMT_YUV444P14, AV_PIX_FMT_YUV422P14, AV_PIX_FMT_YUV420P14, + AV_PIX_FMT_YUV420P16, AV_PIX_FMT_YUV422P16, AV_PIX_FMT_YUV444P16, + AV_PIX_FMT_YUVA420P9, AV_PIX_FMT_YUVA422P9, AV_PIX_FMT_YUVA444P9, + AV_PIX_FMT_YUVA420P10, AV_PIX_FMT_YUVA422P10, AV_PIX_FMT_YUVA444P10, + AV_PIX_FMT_YUVA422P12, AV_PIX_FMT_YUVA444P12, + AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_YUVA422P16, AV_PIX_FMT_YUVA444P16, + AV_PIX_FMT_NONE + }; + const enum AVPixelFormat *pix_fmts; + + pix_fmts = !strcmp(avctx->filter->name, "hsvhold") ? hold_pixel_fmts : pixel_fmts; + + return ff_set_common_formats_from_list(avctx, pix_fmts); +} + +static av_cold int config_input(AVFilterLink *inlink) +{ + AVFilterContext *avctx = inlink->dst; + HSVKeyContext *s = avctx->priv; + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); + + s->hsub_log2 = desc->log2_chroma_w; + s->vsub_log2 = desc->log2_chroma_h; + + return 0; +} + +static const AVFilterPad hsvkey_inputs[] = { + { + .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, + .filter_frame = filter_frame, + .config_props = config_input, + }, +}; + +static const AVFilterPad hsvkey_outputs[] = { + { + .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .config_props = config_output, + }, +}; + +#define OFFSET(x) offsetof(HSVKeyContext, x) +#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_RUNTIME_PARAM + +static const AVOption hsvkey_options[] = { + { "hue", "set the hue value", OFFSET(hue_opt), AV_OPT_TYPE_FLOAT, { .dbl = 0 }, -360, 360, FLAGS }, + { "sat", "set the saturation value", OFFSET(sat), AV_OPT_TYPE_FLOAT, { .dbl = 0 }, -1, 1, FLAGS }, + { "val", "set the value value", OFFSET(val), AV_OPT_TYPE_FLOAT, { .dbl = 0 }, -1, 1, FLAGS }, + { "similarity", "set the hsvkey similarity value", OFFSET(similarity), AV_OPT_TYPE_FLOAT, { .dbl = 0.01}, 0.00001, 1.0, FLAGS }, + { "blend", "set the hsvkey blend value", OFFSET(blend), AV_OPT_TYPE_FLOAT, { .dbl = 0.0 }, 0.0, 1.0, FLAGS }, + { NULL } +}; + +AVFILTER_DEFINE_CLASS(hsvkey); + +const AVFilter ff_vf_hsvkey = { + .name = "hsvkey", + .description = NULL_IF_CONFIG_SMALL("Turns a certain HSV range into transparency. Operates on YUV colors."), + .priv_size = sizeof(HSVKeyContext), + .priv_class = &hsvkey_class, + .query_formats = query_formats, + FILTER_INPUTS(hsvkey_inputs), + FILTER_OUTPUTS(hsvkey_outputs), + .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, + .process_command = ff_filter_process_command, +}; + +static const AVOption hsvhold_options[] = { + { "hue", "set the hue value", OFFSET(hue_opt), AV_OPT_TYPE_FLOAT, { .dbl = 0 }, -360, 360, FLAGS }, + { "sat", "set the saturation value", OFFSET(sat), AV_OPT_TYPE_FLOAT, { .dbl = 0 }, -1, 1, FLAGS }, + { "val", "set the value value", OFFSET(val), AV_OPT_TYPE_FLOAT, { .dbl = 0 }, -1, 1, FLAGS }, + { "similarity", "set the hsvhold similarity value", OFFSET(similarity), AV_OPT_TYPE_FLOAT, { .dbl = 0.01 }, 0.00001, 1.0, FLAGS }, + { "blend", "set the hsvhold blend value", OFFSET(blend), AV_OPT_TYPE_FLOAT, { .dbl = 0.0 }, 0.0, 1.0, FLAGS }, + { NULL } +}; + +static const AVFilterPad hsvhold_inputs[] = { + { + .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, + .filter_frame = filter_frame, + .config_props = config_input, + }, +}; + +static const AVFilterPad hsvhold_outputs[] = { + { + .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .config_props = config_output, + }, +}; + +AVFILTER_DEFINE_CLASS(hsvhold); + +const AVFilter ff_vf_hsvhold = { + .name = "hsvhold", + .description = NULL_IF_CONFIG_SMALL("Turns a certain HSV range into gray."), + .priv_size = sizeof(HSVKeyContext), + .priv_class = &hsvhold_class, + .query_formats = query_formats, + FILTER_INPUTS(hsvhold_inputs), + FILTER_OUTPUTS(hsvhold_outputs), + .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, + .process_command = ff_filter_process_command, +}; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_hue.c b/chromium/third_party/ffmpeg/libavfilter/vf_hue.c index 3d250dbe250..c35722eb4b9 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_hue.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_hue.c @@ -263,10 +263,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUVA420P10, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_props(AVFilterLink *inlink) @@ -505,7 +502,6 @@ static const AVFilterPad hue_inputs[] = { .filter_frame = filter_frame, .config_props = config_props, }, - { NULL } }; static const AVFilterPad hue_outputs[] = { @@ -513,7 +509,6 @@ static const AVFilterPad hue_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_hue = { @@ -524,8 +519,8 @@ const AVFilter ff_vf_hue = { .uninit = uninit, .query_formats = query_formats, .process_command = process_command, - .inputs = hue_inputs, - .outputs = hue_outputs, + FILTER_INPUTS(hue_inputs), + FILTER_OUTPUTS(hue_outputs), .priv_class = &hue_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_hwdownload.c b/chromium/third_party/ffmpeg/libavfilter/vf_hwdownload.c index 4a8fed0688d..f00f105f841 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_hwdownload.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_hwdownload.c @@ -180,7 +180,6 @@ static const AVFilterPad hwdownload_inputs[] = { .config_props = hwdownload_config_input, .filter_frame = hwdownload_filter_frame, }, - { NULL } }; static const AVFilterPad hwdownload_outputs[] = { @@ -189,7 +188,6 @@ static const AVFilterPad hwdownload_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = hwdownload_config_output, }, - { NULL } }; const AVFilter ff_vf_hwdownload = { @@ -199,7 +197,7 @@ const AVFilter ff_vf_hwdownload = { .query_formats = hwdownload_query_formats, .priv_size = sizeof(HWDownloadContext), .priv_class = &hwdownload_class, - .inputs = hwdownload_inputs, - .outputs = hwdownload_outputs, + FILTER_INPUTS(hwdownload_inputs), + FILTER_OUTPUTS(hwdownload_outputs), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_hwmap.c b/chromium/third_party/ffmpeg/libavfilter/vf_hwmap.c index d829b47b448..be29261223c 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_hwmap.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_hwmap.c @@ -404,10 +404,9 @@ static const AVFilterPad hwmap_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .get_video_buffer = hwmap_get_buffer, + .get_buffer.video = hwmap_get_buffer, .filter_frame = hwmap_filter_frame, }, - { NULL } }; static const AVFilterPad hwmap_outputs[] = { @@ -416,7 +415,6 @@ static const AVFilterPad hwmap_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = hwmap_config_output, }, - { NULL } }; const AVFilter ff_vf_hwmap = { @@ -426,7 +424,7 @@ const AVFilter ff_vf_hwmap = { .priv_size = sizeof(HWMapContext), .priv_class = &hwmap_class, .query_formats = hwmap_query_formats, - .inputs = hwmap_inputs, - .outputs = hwmap_outputs, + FILTER_INPUTS(hwmap_inputs), + FILTER_OUTPUTS(hwmap_outputs), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_hwupload.c b/chromium/third_party/ffmpeg/libavfilter/vf_hwupload.c index 8263829a396..4cbc621af31 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_hwupload.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_hwupload.c @@ -238,7 +238,6 @@ static const AVFilterPad hwupload_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = hwupload_filter_frame, }, - { NULL } }; static const AVFilterPad hwupload_outputs[] = { @@ -247,7 +246,6 @@ static const AVFilterPad hwupload_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = hwupload_config_output, }, - { NULL } }; const AVFilter ff_vf_hwupload = { @@ -257,7 +255,7 @@ const AVFilter ff_vf_hwupload = { .query_formats = hwupload_query_formats, .priv_size = sizeof(HWUploadContext), .priv_class = &hwupload_class, - .inputs = hwupload_inputs, - .outputs = hwupload_outputs, + FILTER_INPUTS(hwupload_inputs), + FILTER_OUTPUTS(hwupload_outputs), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_hwupload_cuda.c b/chromium/third_party/ffmpeg/libavfilter/vf_hwupload_cuda.c index 138949a5ed6..31c1cdbddbe 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_hwupload_cuda.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_hwupload_cuda.c @@ -171,7 +171,6 @@ static const AVFilterPad cudaupload_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = cudaupload_filter_frame, }, - { NULL } }; static const AVFilterPad cudaupload_outputs[] = { @@ -180,7 +179,6 @@ static const AVFilterPad cudaupload_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = cudaupload_config_output, }, - { NULL } }; const AVFilter ff_vf_hwupload_cuda = { @@ -195,8 +193,8 @@ const AVFilter ff_vf_hwupload_cuda = { .priv_size = sizeof(CudaUploadContext), .priv_class = &cudaupload_class, - .inputs = cudaupload_inputs, - .outputs = cudaupload_outputs, + FILTER_INPUTS(cudaupload_inputs), + FILTER_OUTPUTS(cudaupload_outputs), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_hysteresis.c b/chromium/third_party/ffmpeg/libavfilter/vf_hysteresis.c index 3732ed5c22d..cbbee2691b9 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_hysteresis.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_hysteresis.c @@ -81,7 +81,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int process_frame(FFFrameSync *fs) @@ -362,7 +362,6 @@ static const AVFilterPad hysteresis_inputs[] = { .name = "alt", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; static const AVFilterPad hysteresis_outputs[] = { @@ -371,7 +370,6 @@ static const AVFilterPad hysteresis_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_hysteresis = { @@ -382,8 +380,8 @@ const AVFilter ff_vf_hysteresis = { .uninit = uninit, .query_formats = query_formats, .activate = activate, - .inputs = hysteresis_inputs, - .outputs = hysteresis_outputs, + FILTER_INPUTS(hysteresis_inputs), + FILTER_OUTPUTS(hysteresis_outputs), .priv_class = &hysteresis_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_identity.c b/chromium/third_party/ffmpeg/libavfilter/vf_identity.c index f47611924e4..fd721373445 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_identity.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_identity.c @@ -196,7 +196,8 @@ static int do_identity(FFFrameSync *fs) td.planeheight[c] = s->planeheight[c]; } - ctx->internal->execute(ctx, s->filter_slice, &td, NULL, FFMIN(s->planeheight[1], s->nb_threads)); + ff_filter_execute(ctx, s->filter_slice, &td, NULL, + FFMIN(s->planeheight[1], s->nb_threads)); for (int j = 0; j < s->nb_threads; j++) { for (int c = 0; c < s->nb_components; c++) @@ -257,10 +258,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input_ref(AVFilterLink *inlink) @@ -392,7 +390,6 @@ static const AVFilterPad identity_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_input_ref, }, - { NULL } }; static const AVFilterPad identity_outputs[] = { @@ -401,7 +398,6 @@ static const AVFilterPad identity_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; static const AVOption options[] = { @@ -423,8 +419,8 @@ const AVFilter ff_vf_identity = { .activate = activate, .priv_size = sizeof(IdentityContext), .priv_class = &identity_class, - .inputs = identity_inputs, - .outputs = identity_outputs, + FILTER_INPUTS(identity_inputs), + FILTER_OUTPUTS(identity_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, }; @@ -445,8 +441,8 @@ const AVFilter ff_vf_msad = { .activate = activate, .priv_size = sizeof(IdentityContext), .priv_class = &msad_class, - .inputs = identity_inputs, - .outputs = identity_outputs, + FILTER_INPUTS(identity_inputs), + FILTER_OUTPUTS(identity_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_idet.c b/chromium/third_party/ffmpeg/libavfilter/vf_idet.c index 54fc08e915c..e006e72da9b 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_idet.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_idet.c @@ -395,10 +395,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUVA444P, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static av_cold int init(AVFilterContext *ctx) @@ -428,7 +425,6 @@ static const AVFilterPad idet_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad idet_outputs[] = { @@ -437,7 +433,6 @@ static const AVFilterPad idet_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .request_frame = request_frame }, - { NULL } }; const AVFilter ff_vf_idet = { @@ -447,7 +442,7 @@ const AVFilter ff_vf_idet = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = idet_inputs, - .outputs = idet_outputs, + FILTER_INPUTS(idet_inputs), + FILTER_OUTPUTS(idet_outputs), .priv_class = &idet_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_il.c b/chromium/third_party/ffmpeg/libavfilter/vf_il.c index 9b21f2e7a71..8e829b2f694 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_il.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_il.c @@ -187,7 +187,6 @@ static const AVFilterPad inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -195,7 +194,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_il = { @@ -203,8 +201,8 @@ const AVFilter ff_vf_il = { .description = NULL_IF_CONFIG_SMALL("Deinterleave or interleave fields."), .priv_size = sizeof(IlContext), .query_formats = query_formats, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .priv_class = &il_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, .process_command = ff_filter_process_command, diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_kerndeint.c b/chromium/third_party/ffmpeg/libavfilter/vf_kerndeint.c index a86407beb04..85b426d0b05 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_kerndeint.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_kerndeint.c @@ -78,10 +78,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_props(AVFilterLink *inlink) @@ -295,7 +292,6 @@ static const AVFilterPad kerndeint_inputs[] = { .filter_frame = filter_frame, .config_props = config_props, }, - { NULL } }; static const AVFilterPad kerndeint_outputs[] = { @@ -303,7 +299,6 @@ static const AVFilterPad kerndeint_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; @@ -314,6 +309,6 @@ const AVFilter ff_vf_kerndeint = { .priv_class = &kerndeint_class, .uninit = uninit, .query_formats = query_formats, - .inputs = kerndeint_inputs, - .outputs = kerndeint_outputs, + FILTER_INPUTS(kerndeint_inputs), + FILTER_OUTPUTS(kerndeint_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_lagfun.c b/chromium/third_party/ffmpeg/libavfilter/vf_lagfun.c index e1474796710..fee371b25fe 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_lagfun.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_lagfun.c @@ -67,10 +67,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRP14, AV_PIX_FMT_GBRP16, AV_PIX_FMT_NONE }; - AVFilterFormats *formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } typedef struct ThreadData { @@ -176,7 +173,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.out = out; td.in = in; - ctx->internal->execute(ctx, s->lagfun, &td, NULL, FFMIN(s->planeheight[1], ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->lagfun, &td, NULL, + FFMIN(s->planeheight[1], ff_filter_get_nb_threads(ctx))); av_frame_free(&in); return ff_filter_frame(outlink, out); @@ -205,7 +203,6 @@ static const AVFilterPad inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -214,7 +211,6 @@ static const AVFilterPad outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; AVFILTER_DEFINE_CLASS(lagfun); @@ -226,8 +222,8 @@ const AVFilter ff_vf_lagfun = { .priv_class = &lagfun_class, .query_formats = query_formats, .uninit = uninit, - .outputs = outputs, - .inputs = inputs, + FILTER_OUTPUTS(outputs), + FILTER_INPUTS(inputs), .flags = AVFILTER_FLAG_SLICE_THREADS | AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, .process_command = ff_filter_process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_lenscorrection.c b/chromium/third_party/ffmpeg/libavfilter/vf_lenscorrection.c index 7bd008d3d81..1140e1d484a 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_lenscorrection.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_lenscorrection.c @@ -203,10 +203,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRAP, AV_PIX_FMT_GBRAP10, AV_PIX_FMT_GBRAP12, AV_PIX_FMT_GBRAP16, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static av_cold void uninit(AVFilterContext *ctx) @@ -318,7 +315,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) av_frame_copy_props(out, in); td.in = in; td.out = out; - ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(rect->planeheight[1], ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_slice, &td, NULL, + FFMIN(rect->planeheight[1], ff_filter_get_nb_threads(ctx))); av_frame_free(&in); return ff_filter_frame(outlink, out); @@ -345,7 +343,6 @@ static const AVFilterPad lenscorrection_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad lenscorrection_outputs[] = { @@ -354,7 +351,6 @@ static const AVFilterPad lenscorrection_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_lenscorrection = { @@ -362,8 +358,8 @@ const AVFilter ff_vf_lenscorrection = { .description = NULL_IF_CONFIG_SMALL("Rectify the image by correcting for lens distortion."), .priv_size = sizeof(LenscorrectionCtx), .query_formats = query_formats, - .inputs = lenscorrection_inputs, - .outputs = lenscorrection_outputs, + FILTER_INPUTS(lenscorrection_inputs), + FILTER_OUTPUTS(lenscorrection_outputs), .priv_class = &lenscorrection_class, .uninit = uninit, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_lensfun.c b/chromium/third_party/ffmpeg/libavfilter/vf_lensfun.c index f34add961ac..38375004816 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_lensfun.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_lensfun.c @@ -197,8 +197,7 @@ static int query_formats(AVFilterContext *ctx) { // Some of the functions provided by lensfun require pixels in RGB format static const enum AVPixelFormat fmts[] = {AV_PIX_FMT_RGB24, AV_PIX_FMT_NONE}; - AVFilterFormats *fmts_list = ff_make_format_list(fmts); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, fmts); } static float lanczos_kernel(float x) @@ -462,11 +461,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) .modifier = lensfun->modifier }; - ctx->internal->execute(ctx, - vignetting_filter_slice, - &vignetting_thread_data, - NULL, - FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, vignetting_filter_slice, + &vignetting_thread_data, NULL, + FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); } if (lensfun->mode & (GEOMETRY_DISTORTION | SUBPIXEL_DISTORTION)) { @@ -490,11 +487,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) .interpolation_type = lensfun->interpolation_type }; - ctx->internal->execute(ctx, - distortion_correction_filter_slice, - &distortion_correction_thread_data, - NULL, - FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, distortion_correction_filter_slice, + &distortion_correction_thread_data, NULL, + FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); av_frame_free(&in); return ff_filter_frame(outlink, out); @@ -524,7 +519,6 @@ static const AVFilterPad lensfun_inputs[] = { .config_props = config_props, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad lensfun_outputs[] = { @@ -532,7 +526,6 @@ static const AVFilterPad lensfun_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_lensfun = { @@ -542,8 +535,8 @@ const AVFilter ff_vf_lensfun = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = lensfun_inputs, - .outputs = lensfun_outputs, + FILTER_INPUTS(lensfun_inputs), + FILTER_OUTPUTS(lensfun_outputs), .priv_class = &lensfun_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_libopencv.c b/chromium/third_party/ffmpeg/libavfilter/vf_libopencv.c index 221a8ac4c2a..4a5bc068714 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_libopencv.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_libopencv.c @@ -69,10 +69,7 @@ static int query_formats(AVFilterContext *ctx) static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_BGR24, AV_PIX_FMT_BGRA, AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } typedef struct OCVContext { @@ -416,7 +413,6 @@ static const AVFilterPad avfilter_vf_ocv_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad avfilter_vf_ocv_outputs[] = { @@ -424,7 +420,6 @@ static const AVFilterPad avfilter_vf_ocv_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_ocv = { @@ -435,6 +430,6 @@ const AVFilter ff_vf_ocv = { .query_formats = query_formats, .init = init, .uninit = uninit, - .inputs = avfilter_vf_ocv_inputs, - .outputs = avfilter_vf_ocv_outputs, + FILTER_INPUTS(avfilter_vf_ocv_inputs), + FILTER_OUTPUTS(avfilter_vf_ocv_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_libvmaf.c b/chromium/third_party/ffmpeg/libavfilter/vf_libvmaf.c index d2621c7a9f1..d3e9f62e334 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_libvmaf.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_libvmaf.c @@ -256,10 +256,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } @@ -353,7 +350,6 @@ static const AVFilterPad libvmaf_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_input_ref, }, - { NULL } }; static const AVFilterPad libvmaf_outputs[] = { @@ -362,7 +358,6 @@ static const AVFilterPad libvmaf_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_libvmaf = { @@ -375,6 +370,6 @@ const AVFilter ff_vf_libvmaf = { .activate = activate, .priv_size = sizeof(LIBVMAFContext), .priv_class = &libvmaf_class, - .inputs = libvmaf_inputs, - .outputs = libvmaf_outputs, + FILTER_INPUTS(libvmaf_inputs), + FILTER_OUTPUTS(libvmaf_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_limiter.c b/chromium/third_party/ffmpeg/libavfilter/vf_limiter.c index 04bfbb63d1d..022b9ebf39d 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_limiter.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_limiter.c @@ -90,10 +90,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static void limiter8(const uint8_t *src, uint8_t *dst, @@ -222,8 +219,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.out = out; td.in = in; - ctx->internal->execute(ctx, filter_slice, &td, NULL, - FFMIN(s->height[2], ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_slice, &td, NULL, + FFMIN(s->height[2], ff_filter_get_nb_threads(ctx))); if (out != in) av_frame_free(&in); @@ -249,7 +246,6 @@ static const AVFilterPad inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -257,7 +253,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_limiter = { @@ -267,8 +262,8 @@ const AVFilter ff_vf_limiter = { .priv_class = &limiter_class, .init = init, .query_formats = query_formats, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_lumakey.c b/chromium/third_party/ffmpeg/libavfilter/vf_lumakey.c index 3f98d5077dd..b3bfb0a2786 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_lumakey.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_lumakey.c @@ -135,10 +135,8 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame) LumakeyContext *s = ctx->priv; int ret; - if (ret = av_frame_make_writable(frame)) - return ret; - - if (ret = ctx->internal->execute(ctx, s->do_lumakey_slice, frame, NULL, FFMIN(frame->height, ff_filter_get_nb_threads(ctx)))) + if (ret = ff_filter_execute(ctx, s->do_lumakey_slice, frame, NULL, + FFMIN(frame->height, ff_filter_get_nb_threads(ctx)))) return ret; return ff_filter_frame(ctx->outputs[0], frame); @@ -154,13 +152,8 @@ static av_cold int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUVA444P16, AV_PIX_FMT_YUVA422P16, AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_NONE }; - AVFilterFormats *formats; - - formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, @@ -179,10 +172,10 @@ static const AVFilterPad lumakey_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad lumakey_outputs[] = { @@ -190,7 +183,6 @@ static const AVFilterPad lumakey_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; #define OFFSET(x) offsetof(LumakeyContext, x) @@ -211,8 +203,8 @@ const AVFilter ff_vf_lumakey = { .priv_size = sizeof(LumakeyContext), .priv_class = &lumakey_class, .query_formats = query_formats, - .inputs = lumakey_inputs, - .outputs = lumakey_outputs, + FILTER_INPUTS(lumakey_inputs), + FILTER_OUTPUTS(lumakey_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_lut.c b/chromium/third_party/ffmpeg/libavfilter/vf_lut.c index 47c2416da71..812a5c1ee12 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_lut.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_lut.c @@ -150,10 +150,7 @@ static int query_formats(AVFilterContext *ctx) const enum AVPixelFormat *pix_fmts = s->is_rgb ? rgb_pix_fmts : s->is_yuv ? yuv_pix_fmts : all_pix_fmts; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } /** @@ -541,23 +538,23 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) if (s->is_rgb && s->is_16bit && !s->is_planar) { /* packed, 16-bit */ PACKED_THREAD_DATA - ctx->internal->execute(ctx, lut_packed_16bits, &td, NULL, - FFMIN(in->height, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, lut_packed_16bits, &td, NULL, + FFMIN(in->height, ff_filter_get_nb_threads(ctx))); } else if (s->is_rgb && !s->is_planar) { /* packed 8 bits */ PACKED_THREAD_DATA - ctx->internal->execute(ctx, lut_packed_8bits, &td, NULL, - FFMIN(in->height, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, lut_packed_8bits, &td, NULL, + FFMIN(in->height, ff_filter_get_nb_threads(ctx))); } else if (s->is_16bit) { /* planar >8 bit depth */ PLANAR_THREAD_DATA - ctx->internal->execute(ctx, lut_planar_16bits, &td, NULL, - FFMIN(in->height, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, lut_planar_16bits, &td, NULL, + FFMIN(in->height, ff_filter_get_nb_threads(ctx))); } else { /* planar 8bit depth */ PLANAR_THREAD_DATA - ctx->internal->execute(ctx, lut_planar_8bits, &td, NULL, - FFMIN(in->height, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, lut_planar_8bits, &td, NULL, + FFMIN(in->height, ff_filter_get_nb_threads(ctx))); } if (!direct) @@ -583,13 +580,11 @@ static const AVFilterPad inputs[] = { .filter_frame = filter_frame, .config_props = config_props, }, - { NULL } }; static const AVFilterPad outputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; #define DEFINE_LUT_FILTER(name_, description_) \ @@ -601,8 +596,8 @@ static const AVFilterPad outputs[] = { .init = name_##_init, \ .uninit = uninit, \ .query_formats = query_formats, \ - .inputs = inputs, \ - .outputs = outputs, \ + FILTER_INPUTS(inputs), \ + FILTER_OUTPUTS(outputs), \ .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | \ AVFILTER_FLAG_SLICE_THREADS, \ .process_command = process_command, \ diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_lut2.c b/chromium/third_party/ffmpeg/libavfilter/vf_lut2.c index 658a0bfa567..9fde3a08eee 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_lut2.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_lut2.c @@ -176,7 +176,7 @@ static int query_formats(AVFilterContext *ctx) int ret; if (s->tlut2 || !s->odepth) - return ff_set_common_formats(ctx, ff_make_format_list(all_pix_fmts)); + return ff_set_common_formats_from_list(ctx, all_pix_fmts); ret = ff_formats_ref(ff_make_format_list(all_pix_fmts), &ctx->inputs[0]->outcfg.formats); if (ret < 0) @@ -316,7 +316,8 @@ static int process_frame(FFFrameSync *fs) td.out = out; td.srcx = srcx; td.srcy = srcy; - ctx->internal->execute(ctx, s->lut2, &td, NULL, FFMIN(s->heightx[1], ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->lut2, &td, NULL, + FFMIN(s->heightx[1], ff_filter_get_nb_threads(ctx))); } out->pts = av_rescale_q(s->fs.pts, s->fs.time_base, outlink->time_base); @@ -533,7 +534,6 @@ static const AVFilterPad inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_inputy, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -542,7 +542,6 @@ static const AVFilterPad outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = lut2_config_output, }, - { NULL } }; static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, @@ -569,8 +568,8 @@ const AVFilter ff_vf_lut2 = { .uninit = uninit, .query_formats = query_formats, .activate = activate, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, .process_command = process_command, @@ -613,7 +612,8 @@ static int tlut2_filter_frame(AVFilterLink *inlink, AVFrame *frame) td.out = out; td.srcx = frame; td.srcy = s->prev_frame; - ctx->internal->execute(ctx, s->lut2, &td, NULL, FFMIN(s->heightx[1], ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->lut2, &td, NULL, + FFMIN(s->heightx[1], ff_filter_get_nb_threads(ctx))); } av_frame_free(&s->prev_frame); s->prev_frame = frame; @@ -640,7 +640,6 @@ static const AVFilterPad tlut2_inputs[] = { .filter_frame = tlut2_filter_frame, .config_props = config_inputx, }, - { NULL } }; static const AVFilterPad tlut2_outputs[] = { @@ -649,7 +648,6 @@ static const AVFilterPad tlut2_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_tlut2 = { @@ -660,8 +658,8 @@ const AVFilter ff_vf_tlut2 = { .query_formats = query_formats, .init = init, .uninit = uninit, - .inputs = tlut2_inputs, - .outputs = tlut2_outputs, + FILTER_INPUTS(tlut2_inputs), + FILTER_OUTPUTS(tlut2_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, .process_command = process_command, diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_lut3d.c b/chromium/third_party/ffmpeg/libavfilter/vf_lut3d.c index c86585cf09c..111e624dc3e 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_lut3d.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_lut3d.c @@ -1166,10 +1166,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRPF32, AV_PIX_FMT_GBRAPF32, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) @@ -1234,7 +1231,8 @@ static AVFrame *apply_lut(AVFilterLink *inlink, AVFrame *in) td.in = in; td.out = out; - ctx->internal->execute(ctx, lut3d->interp, &td, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, lut3d->interp, &td, NULL, + FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); if (out != in) av_frame_free(&in); @@ -1342,7 +1340,6 @@ static const AVFilterPad lut3d_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad lut3d_outputs[] = { @@ -1350,7 +1347,6 @@ static const AVFilterPad lut3d_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_lut3d = { @@ -1360,8 +1356,8 @@ const AVFilter ff_vf_lut3d = { .init = lut3d_init, .uninit = lut3d_uninit, .query_formats = query_formats, - .inputs = lut3d_inputs, - .outputs = lut3d_outputs, + FILTER_INPUTS(lut3d_inputs), + FILTER_OUTPUTS(lut3d_outputs), .priv_class = &lut3d_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = process_command, @@ -1608,7 +1604,6 @@ static const AVFilterPad haldclut_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_clut, }, - { NULL } }; static const AVFilterPad haldclut_outputs[] = { @@ -1617,7 +1612,6 @@ static const AVFilterPad haldclut_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_haldclut = { @@ -1629,8 +1623,8 @@ const AVFilter ff_vf_haldclut = { .uninit = haldclut_uninit, .query_formats = query_formats, .activate = activate, - .inputs = haldclut_inputs, - .outputs = haldclut_outputs, + FILTER_INPUTS(haldclut_inputs), + FILTER_OUTPUTS(haldclut_outputs), .priv_class = &haldclut_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, .process_command = process_command, @@ -2232,7 +2226,8 @@ static AVFrame *apply_1d_lut(AVFilterLink *inlink, AVFrame *in) td.in = in; td.out = out; - ctx->internal->execute(ctx, lut1d->interp, &td, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, lut1d->interp, &td, NULL, + FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); if (out != in) av_frame_free(&in); @@ -2274,7 +2269,6 @@ static const AVFilterPad lut1d_inputs[] = { .filter_frame = filter_frame_1d, .config_props = config_input_1d, }, - { NULL } }; static const AVFilterPad lut1d_outputs[] = { @@ -2282,7 +2276,6 @@ static const AVFilterPad lut1d_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_lut1d = { @@ -2291,8 +2284,8 @@ const AVFilter ff_vf_lut1d = { .priv_size = sizeof(LUT1DContext), .init = lut1d_init, .query_formats = query_formats, - .inputs = lut1d_inputs, - .outputs = lut1d_outputs, + FILTER_INPUTS(lut1d_inputs), + FILTER_OUTPUTS(lut1d_outputs), .priv_class = &lut1d_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = lut1d_process_command, diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_maskedclamp.c b/chromium/third_party/ffmpeg/libavfilter/vf_maskedclamp.c index 050e3ae6e44..c19bc9d849e 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_maskedclamp.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_maskedclamp.c @@ -84,7 +84,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int maskedclamp_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) @@ -159,8 +159,8 @@ static int process_frame(FFFrameSync *fs) td.m = bright; td.d = out; - ctx->internal->execute(ctx, maskedclamp_slice, &td, NULL, FFMIN(s->height[0], - ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, maskedclamp_slice, &td, NULL, + FFMIN(s->height[0], ff_filter_get_nb_threads(ctx))); } out->pts = av_rescale_q(s->fs.pts, s->fs.time_base, outlink->time_base); @@ -304,7 +304,6 @@ static const AVFilterPad maskedclamp_inputs[] = { .name = "bright", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; static const AVFilterPad maskedclamp_outputs[] = { @@ -313,7 +312,6 @@ static const AVFilterPad maskedclamp_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_maskedclamp = { @@ -323,8 +321,8 @@ const AVFilter ff_vf_maskedclamp = { .uninit = uninit, .activate = activate, .query_formats = query_formats, - .inputs = maskedclamp_inputs, - .outputs = maskedclamp_outputs, + FILTER_INPUTS(maskedclamp_inputs), + FILTER_OUTPUTS(maskedclamp_outputs), .priv_class = &maskedclamp_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, .process_command = ff_filter_process_command, diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_maskedmerge.c b/chromium/third_party/ffmpeg/libavfilter/vf_maskedmerge.c index 28ac0dd52d4..00e93086227 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_maskedmerge.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_maskedmerge.c @@ -61,7 +61,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } typedef struct ThreadData { @@ -134,8 +134,8 @@ static int process_frame(FFFrameSync *fs) td.base = base; td.overlay = overlay; td.mask = mask; - ctx->internal->execute(ctx, filter_slice, &td, NULL, - FFMIN(s->height[2], ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_slice, &td, NULL, + FFMIN(s->height[2], ff_filter_get_nb_threads(ctx))); } out->pts = av_rescale_q(s->fs.pts, s->fs.time_base, outlink->time_base); @@ -305,7 +305,6 @@ static const AVFilterPad maskedmerge_inputs[] = { .name = "mask", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; static const AVFilterPad maskedmerge_outputs[] = { @@ -314,7 +313,6 @@ static const AVFilterPad maskedmerge_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_maskedmerge = { @@ -324,8 +322,8 @@ const AVFilter ff_vf_maskedmerge = { .uninit = uninit, .query_formats = query_formats, .activate = activate, - .inputs = maskedmerge_inputs, - .outputs = maskedmerge_outputs, + FILTER_INPUTS(maskedmerge_inputs), + FILTER_OUTPUTS(maskedmerge_outputs), .priv_class = &maskedmerge_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, .process_command = ff_filter_process_command, diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_maskedminmax.c b/chromium/third_party/ffmpeg/libavfilter/vf_maskedminmax.c index 0d79fc177fb..f0c499a0d5e 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_maskedminmax.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_maskedminmax.c @@ -54,11 +54,11 @@ static const AVOption maskedminmax_options[] = { { NULL } }; -static av_cold int init(AVFilterContext *ctx) +static av_cold int maskedmin_init(AVFilterContext *ctx) { MaskedMinMaxContext *s = ctx->priv; - s->maskedmin = !strcmp(ctx->filter->name, "maskedmin"); + s->maskedmin = 1; return 0; } @@ -87,7 +87,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static void maskedmin8(const uint8_t *src, uint8_t *dst, const uint8_t *f1, const uint8_t *f2, int w) @@ -221,8 +221,8 @@ static int process_frame(FFFrameSync *fs) td.f2 = f2; td.dst = out; - ctx->internal->execute(ctx, maskedminmax_slice, &td, NULL, FFMIN(s->planeheight[0], - ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, maskedminmax_slice, &td, NULL, + FFMIN(s->planeheight[0], ff_filter_get_nb_threads(ctx))); } out->pts = av_rescale_q(s->fs.pts, s->fs.time_base, outlink->time_base); @@ -313,7 +313,6 @@ static const AVFilterPad maskedminmax_inputs[] = { .name = "filter2", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; static const AVFilterPad maskedminmax_outputs[] = { @@ -322,7 +321,6 @@ static const AVFilterPad maskedminmax_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; #define maskedmin_options maskedminmax_options @@ -333,12 +331,12 @@ const AVFilter ff_vf_maskedmin = { .description = NULL_IF_CONFIG_SMALL("Apply filtering with minimum difference of two streams."), .priv_class = &maskedmin_class, .priv_size = sizeof(MaskedMinMaxContext), - .init = init, + .init = maskedmin_init, .uninit = uninit, .activate = activate, .query_formats = query_formats, - .inputs = maskedminmax_inputs, - .outputs = maskedminmax_outputs, + FILTER_INPUTS(maskedminmax_inputs), + FILTER_OUTPUTS(maskedminmax_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, .process_command = ff_filter_process_command, }; @@ -351,12 +349,11 @@ const AVFilter ff_vf_maskedmax = { .description = NULL_IF_CONFIG_SMALL("Apply filtering with maximum difference of two streams."), .priv_class = &maskedmax_class, .priv_size = sizeof(MaskedMinMaxContext), - .init = init, .uninit = uninit, .activate = activate, .query_formats = query_formats, - .inputs = maskedminmax_inputs, - .outputs = maskedminmax_outputs, + FILTER_INPUTS(maskedminmax_inputs), + FILTER_OUTPUTS(maskedminmax_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, .process_command = ff_filter_process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_maskedthreshold.c b/chromium/third_party/ffmpeg/libavfilter/vf_maskedthreshold.c index 518ab545465..4b183eb9fd6 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_maskedthreshold.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_maskedthreshold.c @@ -79,7 +79,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static void threshold8(const uint8_t *src, const uint8_t *ref, uint8_t *dst, int threshold, int w) @@ -191,8 +191,8 @@ static int process_frame(FFFrameSync *fs) td.ref = ref; td.dst = out; - ctx->internal->execute(ctx, threshold_slice, &td, NULL, FFMIN(s->planeheight[2], - ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, threshold_slice, &td, NULL, + FFMIN(s->planeheight[2], ff_filter_get_nb_threads(ctx))); } out->pts = av_rescale_q(s->fs.pts, s->fs.time_base, outlink->time_base); @@ -270,7 +270,6 @@ static const AVFilterPad maskedthreshold_inputs[] = { .name = "reference", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; static const AVFilterPad maskedthreshold_outputs[] = { @@ -279,7 +278,6 @@ static const AVFilterPad maskedthreshold_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; AVFILTER_DEFINE_CLASS(maskedthreshold); @@ -292,8 +290,8 @@ const AVFilter ff_vf_maskedthreshold = { .uninit = uninit, .activate = activate, .query_formats = query_formats, - .inputs = maskedthreshold_inputs, - .outputs = maskedthreshold_outputs, + FILTER_INPUTS(maskedthreshold_inputs), + FILTER_OUTPUTS(maskedthreshold_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, .process_command = ff_filter_process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_maskfun.c b/chromium/third_party/ffmpeg/libavfilter/vf_maskfun.c index 0f3e3545b3b..5f323385eed 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_maskfun.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_maskfun.c @@ -83,7 +83,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int filter_frame(AVFilterLink *inlink, AVFrame *frame) @@ -105,8 +105,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) return ff_filter_frame(outlink, out); } - ctx->internal->execute(ctx, s->maskfun, frame, NULL, - FFMIN(s->height[1], ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->maskfun, frame, NULL, + FFMIN(s->height[1], ff_filter_get_nb_threads(ctx))); return ff_filter_frame(outlink, frame); } @@ -294,11 +294,10 @@ static const AVFilterPad maskfun_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = filter_frame, .config_props = config_input, - .needs_writable = 1, }, - { NULL } }; static const AVFilterPad maskfun_outputs[] = { @@ -306,7 +305,6 @@ static const AVFilterPad maskfun_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_maskfun = { @@ -315,8 +313,8 @@ const AVFilter ff_vf_maskfun = { .priv_size = sizeof(MaskFunContext), .query_formats = query_formats, .uninit = uninit, - .inputs = maskfun_inputs, - .outputs = maskfun_outputs, + FILTER_INPUTS(maskfun_inputs), + FILTER_OUTPUTS(maskfun_outputs), .priv_class = &maskfun_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = process_command, diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_mcdeint.c b/chromium/third_party/ffmpeg/libavfilter/vf_mcdeint.c index 1a49829d5b4..88c8b25a6da 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_mcdeint.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_mcdeint.c @@ -167,10 +167,7 @@ static int query_formats(AVFilterContext *ctx) static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int filter_frame(AVFilterLink *inlink, AVFrame *inpic) @@ -293,7 +290,6 @@ static const AVFilterPad mcdeint_inputs[] = { .filter_frame = filter_frame, .config_props = config_props, }, - { NULL } }; static const AVFilterPad mcdeint_outputs[] = { @@ -301,7 +297,6 @@ static const AVFilterPad mcdeint_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_mcdeint = { @@ -310,7 +305,7 @@ const AVFilter ff_vf_mcdeint = { .priv_size = sizeof(MCDeintContext), .uninit = uninit, .query_formats = query_formats, - .inputs = mcdeint_inputs, - .outputs = mcdeint_outputs, + FILTER_INPUTS(mcdeint_inputs), + FILTER_OUTPUTS(mcdeint_outputs), .priv_class = &mcdeint_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_median.c b/chromium/third_party/ffmpeg/libavfilter/vf_median.c index 1e66ab87ff9..61a2656244f 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_median.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_median.c @@ -107,7 +107,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static void check_params(MedianContext *s, AVFilterLink *inlink) @@ -230,7 +230,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) av_frame_copy_props(out, in); td.in = in; td.out = out; - ctx->internal->execute(ctx, filter_slice, &td, NULL, s->nb_threads); + ff_filter_execute(ctx, filter_slice, &td, NULL, s->nb_threads); av_frame_free(&in); return ff_filter_frame(outlink, out); @@ -273,7 +273,6 @@ static const AVFilterPad median_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad median_outputs[] = { @@ -281,7 +280,6 @@ static const AVFilterPad median_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_median = { @@ -291,8 +289,8 @@ const AVFilter ff_vf_median = { .priv_class = &median_class, .uninit = uninit, .query_formats = query_formats, - .inputs = median_inputs, - .outputs = median_outputs, + FILTER_INPUTS(median_inputs), + FILTER_OUTPUTS(median_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_mergeplanes.c b/chromium/third_party/ffmpeg/libavfilter/vf_mergeplanes.c index 30888f62afe..638a7065f2b 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_mergeplanes.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_mergeplanes.c @@ -96,10 +96,8 @@ static av_cold int init(AVFilterContext *ctx) if (!pad.name) return AVERROR(ENOMEM); - if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0){ - av_freep(&pad.name); + if ((ret = ff_append_inpad_free_name(ctx, &pad)) < 0) return ret; - } } return 0; @@ -279,12 +277,8 @@ static int activate(AVFilterContext *ctx) static av_cold void uninit(AVFilterContext *ctx) { MergePlanesContext *s = ctx->priv; - int i; ff_framesync_uninit(&s->fs); - - for (i = 0; i < ctx->nb_inputs; i++) - av_freep(&ctx->input_pads[i].name); } static const AVFilterPad mergeplanes_outputs[] = { @@ -293,7 +287,6 @@ static const AVFilterPad mergeplanes_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_mergeplanes = { @@ -306,6 +299,6 @@ const AVFilter ff_vf_mergeplanes = { .query_formats = query_formats, .activate = activate, .inputs = NULL, - .outputs = mergeplanes_outputs, + FILTER_OUTPUTS(mergeplanes_outputs), .flags = AVFILTER_FLAG_DYNAMIC_INPUTS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_mestimate.c b/chromium/third_party/ffmpeg/libavfilter/vf_mestimate.c index f57f2578ecf..582da485686 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_mestimate.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_mestimate.c @@ -81,10 +81,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) @@ -356,7 +353,6 @@ static const AVFilterPad mestimate_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad mestimate_outputs[] = { @@ -364,7 +360,6 @@ static const AVFilterPad mestimate_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_mestimate = { @@ -374,6 +369,6 @@ const AVFilter ff_vf_mestimate = { .priv_class = &mestimate_class, .uninit = uninit, .query_formats = query_formats, - .inputs = mestimate_inputs, - .outputs = mestimate_outputs, + FILTER_INPUTS(mestimate_inputs), + FILTER_OUTPUTS(mestimate_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_midequalizer.c b/chromium/third_party/ffmpeg/libavfilter/vf_midequalizer.c index ba50fa0a828..0e87723609b 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_midequalizer.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_midequalizer.c @@ -83,7 +83,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int process_frame(FFFrameSync *fs) @@ -363,7 +363,6 @@ static const AVFilterPad midequalizer_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_input1, }, - { NULL } }; static const AVFilterPad midequalizer_outputs[] = { @@ -372,7 +371,6 @@ static const AVFilterPad midequalizer_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_midequalizer = { @@ -382,8 +380,8 @@ const AVFilter ff_vf_midequalizer = { .uninit = uninit, .query_formats = query_formats, .activate = activate, - .inputs = midequalizer_inputs, - .outputs = midequalizer_outputs, + FILTER_INPUTS(midequalizer_inputs), + FILTER_OUTPUTS(midequalizer_outputs), .priv_class = &midequalizer_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_minterpolate.c b/chromium/third_party/ffmpeg/libavfilter/vf_minterpolate.c index c6aed7755f5..33a40590424 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_minterpolate.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_minterpolate.c @@ -249,10 +249,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static uint64_t get_sbad(AVMotionEstContext *me_ctx, int x, int y, int x_mv, int y_mv) @@ -1245,7 +1242,6 @@ static const AVFilterPad minterpolate_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad minterpolate_outputs[] = { @@ -1254,7 +1250,6 @@ static const AVFilterPad minterpolate_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_minterpolate = { @@ -1264,6 +1259,6 @@ const AVFilter ff_vf_minterpolate = { .priv_class = &minterpolate_class, .uninit = uninit, .query_formats = query_formats, - .inputs = minterpolate_inputs, - .outputs = minterpolate_outputs, + FILTER_INPUTS(minterpolate_inputs), + FILTER_OUTPUTS(minterpolate_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_misc_vaapi.c b/chromium/third_party/ffmpeg/libavfilter/vf_misc_vaapi.c index ca0d46ff194..83aedcdc319 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_misc_vaapi.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_misc_vaapi.c @@ -222,7 +222,6 @@ static const AVFilterPad misc_vaapi_inputs[] = { .filter_frame = &misc_vaapi_filter_frame, .config_props = &ff_vaapi_vpp_config_input, }, - { NULL } }; static const AVFilterPad misc_vaapi_outputs[] = { @@ -231,7 +230,6 @@ static const AVFilterPad misc_vaapi_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = &ff_vaapi_vpp_config_output, }, - { NULL } }; const AVFilter ff_vf_denoise_vaapi = { @@ -241,8 +239,8 @@ const AVFilter ff_vf_denoise_vaapi = { .init = &denoise_vaapi_init, .uninit = &ff_vaapi_vpp_ctx_uninit, .query_formats = &ff_vaapi_vpp_query_formats, - .inputs = misc_vaapi_inputs, - .outputs = misc_vaapi_outputs, + FILTER_INPUTS(misc_vaapi_inputs), + FILTER_OUTPUTS(misc_vaapi_outputs), .priv_class = &denoise_vaapi_class, .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; @@ -254,8 +252,8 @@ const AVFilter ff_vf_sharpness_vaapi = { .init = &sharpness_vaapi_init, .uninit = &ff_vaapi_vpp_ctx_uninit, .query_formats = &ff_vaapi_vpp_query_formats, - .inputs = misc_vaapi_inputs, - .outputs = misc_vaapi_outputs, + FILTER_INPUTS(misc_vaapi_inputs), + FILTER_OUTPUTS(misc_vaapi_outputs), .priv_class = &sharpness_vaapi_class, .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_mix.c b/chromium/third_party/ffmpeg/libavfilter/vf_mix.c index 0ca60d5522e..ce662025578 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_mix.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_mix.c @@ -125,10 +125,8 @@ static av_cold int init(AVFilterContext *ctx) if (!pad.name) return AVERROR(ENOMEM); - if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0) { - av_freep(&pad.name); + if ((ret = ff_append_inpad_free_name(ctx, &pad)) < 0) return ret; - } } } @@ -226,7 +224,8 @@ static int process_frame(FFFrameSync *fs) td.in = in; td.out = out; - ctx->internal->execute(ctx, mix_frames, &td, NULL, FFMIN(s->height[0], ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, mix_frames, &td, NULL, + FFMIN(s->height[0], ff_filter_get_nb_threads(ctx))); return ff_filter_frame(outlink, out); } @@ -303,10 +302,7 @@ static av_cold void uninit(AVFilterContext *ctx) ff_framesync_uninit(&s->fs); av_freep(&s->weights); - if (!s->tmix) { - for (i = 0; i < ctx->nb_inputs; i++) - av_freep(&ctx->input_pads[i].name); - } else { + if (s->tmix) { for (i = 0; i < s->nb_frames && s->frames; i++) av_frame_free(&s->frames[i]); } @@ -352,7 +348,6 @@ static const AVFilterPad outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; #if CONFIG_MIX_FILTER @@ -364,7 +359,7 @@ const AVFilter ff_vf_mix = { .priv_size = sizeof(MixContext), .priv_class = &mix_class, .query_formats = query_formats, - .outputs = outputs, + FILTER_OUTPUTS(outputs), .init = init, .uninit = uninit, .activate = activate, @@ -412,7 +407,8 @@ static int tmix_filter_frame(AVFilterLink *inlink, AVFrame *in) td.out = out; td.in = s->frames; - ctx->internal->execute(ctx, mix_frames, &td, NULL, FFMIN(s->height[0], ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, mix_frames, &td, NULL, + FFMIN(s->height[0], ff_filter_get_nb_threads(ctx))); return ff_filter_frame(outlink, out); } @@ -430,7 +426,6 @@ static const AVFilterPad inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = tmix_filter_frame, }, - { NULL } }; AVFILTER_DEFINE_CLASS(tmix); @@ -441,8 +436,8 @@ const AVFilter ff_vf_tmix = { .priv_size = sizeof(MixContext), .priv_class = &tmix_class, .query_formats = query_formats, - .outputs = outputs, - .inputs = inputs, + FILTER_OUTPUTS(outputs), + FILTER_INPUTS(inputs), .init = init, .uninit = uninit, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_monochrome.c b/chromium/third_party/ffmpeg/libavfilter/vf_monochrome.c index 29e70f8c25d..5792e27cb93 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_monochrome.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_monochrome.c @@ -214,10 +214,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) AVFilterContext *ctx = inlink->dst; MonochromeContext *s = ctx->priv; - ctx->internal->execute(ctx, s->do_slice, frame, NULL, - FFMIN(frame->height, ff_filter_get_nb_threads(ctx))); - ctx->internal->execute(ctx, s->clear_uv, frame, NULL, - FFMIN(frame->height >> s->subh, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->do_slice, frame, NULL, + FFMIN(frame->height, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->clear_uv, frame, NULL, + FFMIN(frame->height >> s->subh, ff_filter_get_nb_threads(ctx))); return ff_filter_frame(ctx->outputs[0], frame); } @@ -245,13 +245,7 @@ static av_cold int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *formats = NULL; - - formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } static av_cold int config_input(AVFilterLink *inlink) @@ -273,11 +267,10 @@ static const AVFilterPad monochrome_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .needs_writable = 1, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad monochrome_outputs[] = { @@ -285,7 +278,6 @@ static const AVFilterPad monochrome_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; #define OFFSET(x) offsetof(MonochromeContext, x) @@ -307,8 +299,8 @@ const AVFilter ff_vf_monochrome = { .priv_size = sizeof(MonochromeContext), .priv_class = &monochrome_class, .query_formats = query_formats, - .inputs = monochrome_inputs, - .outputs = monochrome_outputs, + FILTER_INPUTS(monochrome_inputs), + FILTER_OUTPUTS(monochrome_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = ff_filter_process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_mpdecimate.c b/chromium/third_party/ffmpeg/libavfilter/vf_mpdecimate.c index 53f5a56ef43..8d515396f3c 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_mpdecimate.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_mpdecimate.c @@ -178,10 +178,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) @@ -231,7 +228,6 @@ static const AVFilterPad mpdecimate_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad mpdecimate_outputs[] = { @@ -239,7 +235,6 @@ static const AVFilterPad mpdecimate_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_mpdecimate = { @@ -250,6 +245,6 @@ const AVFilter ff_vf_mpdecimate = { .priv_size = sizeof(DecimateContext), .priv_class = &mpdecimate_class, .query_formats = query_formats, - .inputs = mpdecimate_inputs, - .outputs = mpdecimate_outputs, + FILTER_INPUTS(mpdecimate_inputs), + FILTER_OUTPUTS(mpdecimate_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_neighbor.c b/chromium/third_party/ffmpeg/libavfilter/vf_neighbor.c index a2e9a511658..16a092c7615 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_neighbor.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_neighbor.c @@ -73,7 +73,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static void erosion(uint8_t *dst, const uint8_t *p1, int width, @@ -328,7 +328,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.in = in; td.out = out; - ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(s->planeheight[1], ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_slice, &td, NULL, + FFMIN(s->planeheight[1], ff_filter_get_nb_threads(ctx))); av_frame_free(&in); return ff_filter_frame(outlink, out); @@ -341,7 +342,6 @@ static const AVFilterPad neighbor_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad neighbor_outputs[] = { @@ -349,7 +349,6 @@ static const AVFilterPad neighbor_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; #define OFFSET(x) offsetof(NContext, x) @@ -364,8 +363,8 @@ const AVFilter ff_vf_##name_ = { \ .priv_size = sizeof(NContext), \ .priv_class = &name_##_class, \ .query_formats = query_formats, \ - .inputs = neighbor_inputs, \ - .outputs = neighbor_outputs, \ + FILTER_INPUTS(neighbor_inputs), \ + FILTER_OUTPUTS(neighbor_outputs), \ .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC| \ AVFILTER_FLAG_SLICE_THREADS, \ .process_command = ff_filter_process_command, \ diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_neighbor_opencl.c b/chromium/third_party/ffmpeg/libavfilter/vf_neighbor_opencl.c index e00245089d6..68becfe1432 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_neighbor_opencl.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_neighbor_opencl.c @@ -245,7 +245,6 @@ static const AVFilterPad neighbor_opencl_inputs[] = { .filter_frame = &neighbor_opencl_filter_frame, .config_props = &ff_opencl_filter_config_input, }, - { NULL } }; static const AVFilterPad neighbor_opencl_outputs[] = { @@ -254,7 +253,6 @@ static const AVFilterPad neighbor_opencl_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = &ff_opencl_filter_config_output, }, - { NULL } }; #define OFFSET(x) offsetof(NeighborOpenCLContext, x) @@ -281,8 +279,8 @@ const AVFilter ff_vf_erosion_opencl = { .init = &ff_opencl_filter_init, .uninit = &neighbor_opencl_uninit, .query_formats = &ff_opencl_filter_query_formats, - .inputs = neighbor_opencl_inputs, - .outputs = neighbor_opencl_outputs, + FILTER_INPUTS(neighbor_opencl_inputs), + FILTER_OUTPUTS(neighbor_opencl_outputs), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; @@ -309,8 +307,8 @@ const AVFilter ff_vf_dilation_opencl = { .init = &ff_opencl_filter_init, .uninit = &neighbor_opencl_uninit, .query_formats = &ff_opencl_filter_query_formats, - .inputs = neighbor_opencl_inputs, - .outputs = neighbor_opencl_outputs, + FILTER_INPUTS(neighbor_opencl_inputs), + FILTER_OUTPUTS(neighbor_opencl_outputs), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_nlmeans.c b/chromium/third_party/ffmpeg/libavfilter/vf_nlmeans.c index 7451bec4ae6..39ed37368a4 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_nlmeans.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_nlmeans.c @@ -90,10 +90,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } /** @@ -458,8 +455,8 @@ static int nlmeans_plane(AVFilterContext *ctx, int w, int h, int p, int r, compute_ssd_integral_image(&s->dsp, s->ii, s->ii_lz_32, src, src_linesize, offx, offy, e, w, h); - ctx->internal->execute(ctx, nlmeans_slice, &td, NULL, - FFMIN(td.endy - td.starty, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, nlmeans_slice, &td, NULL, + FFMIN(td.endy - td.starty, ff_filter_get_nb_threads(ctx))); } } } @@ -566,7 +563,6 @@ static const AVFilterPad nlmeans_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad nlmeans_outputs[] = { @@ -574,7 +570,6 @@ static const AVFilterPad nlmeans_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_nlmeans = { @@ -584,8 +579,8 @@ const AVFilter ff_vf_nlmeans = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = nlmeans_inputs, - .outputs = nlmeans_outputs, + FILTER_INPUTS(nlmeans_inputs), + FILTER_OUTPUTS(nlmeans_outputs), .priv_class = &nlmeans_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_nlmeans_opencl.c b/chromium/third_party/ffmpeg/libavfilter/vf_nlmeans_opencl.c index 0f16b2fe496..6e28f4be7ae 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_nlmeans_opencl.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_nlmeans_opencl.c @@ -417,7 +417,6 @@ static const AVFilterPad nlmeans_opencl_inputs[] = { .filter_frame = &nlmeans_opencl_filter_frame, .config_props = &ff_opencl_filter_config_input, }, - { NULL } }; static const AVFilterPad nlmeans_opencl_outputs[] = { @@ -426,7 +425,6 @@ static const AVFilterPad nlmeans_opencl_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = &ff_opencl_filter_config_output, }, - { NULL } }; const AVFilter ff_vf_nlmeans_opencl = { @@ -437,7 +435,7 @@ const AVFilter ff_vf_nlmeans_opencl = { .init = &ff_opencl_filter_init, .uninit = &nlmeans_opencl_uninit, .query_formats = &ff_opencl_filter_query_formats, - .inputs = nlmeans_opencl_inputs, - .outputs = nlmeans_opencl_outputs, + FILTER_INPUTS(nlmeans_opencl_inputs), + FILTER_OUTPUTS(nlmeans_opencl_outputs), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_nnedi.c b/chromium/third_party/ffmpeg/libavfilter/vf_nnedi.c index b802ca5433d..944736a2794 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_nnedi.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_nnedi.c @@ -205,10 +205,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static float dot_dsp(const NNEDIContext *const s, const float *kernel, const float *input, @@ -674,7 +671,8 @@ static int get_frame(AVFilterContext *ctx, int is_second) dst->interlaced_frame = 0; dst->pts = s->pts; - ctx->internal->execute(ctx, filter_slice, dst, NULL, FFMIN(s->planeheight[1] / 2, s->nb_threads)); + ff_filter_execute(ctx, filter_slice, dst, NULL, + FFMIN(s->planeheight[1] / 2, s->nb_threads)); if (s->field == -2 || s->field > 1) s->field_n = !s->field_n; @@ -1143,7 +1141,6 @@ static const AVFilterPad inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -1153,7 +1150,6 @@ static const AVFilterPad outputs[] = { .config_props = config_output, .request_frame = request_frame, }, - { NULL } }; const AVFilter ff_vf_nnedi = { @@ -1164,8 +1160,8 @@ const AVFilter ff_vf_nnedi = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, .process_command = ff_filter_process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_noise.c b/chromium/third_party/ffmpeg/libavfilter/vf_noise.c index 73e88063e93..50febf230d2 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_noise.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_noise.c @@ -272,7 +272,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref) } td.in = inpicref; td.out = out; - ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(n->height[0], ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_slice, &td, NULL, + FFMIN(n->height[0], ff_filter_get_nb_threads(ctx))); emms_c(); if (inpicref != out) @@ -326,7 +327,6 @@ static const AVFilterPad noise_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad noise_outputs[] = { @@ -334,7 +334,6 @@ static const AVFilterPad noise_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_noise = { @@ -344,8 +343,8 @@ const AVFilter ff_vf_noise = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = noise_inputs, - .outputs = noise_outputs, + FILTER_INPUTS(noise_inputs), + FILTER_OUTPUTS(noise_outputs), .priv_class = &noise_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_normalize.c b/chromium/third_party/ffmpeg/libavfilter/vf_normalize.c index 3a2127ade32..26f8e2f4262 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_normalize.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_normalize.c @@ -411,10 +411,7 @@ static int query_formats(AVFilterContext *ctx) // According to filter_design.txt, using ff_set_common_formats() this way // ensures the pixel formats of the input and output will be the same. That // saves a bit of effort possibly needing to handle format conversions. - AVFilterFormats *formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } // At this point we know the pixel format used for both input and output. We @@ -519,7 +516,6 @@ static const AVFilterPad inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -527,7 +523,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_normalize = { @@ -537,8 +532,8 @@ const AVFilter ff_vf_normalize = { .priv_class = &normalize_class, .uninit = uninit, .query_formats = query_formats, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, .process_command = ff_filter_process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_null.c b/chromium/third_party/ffmpeg/libavfilter/vf_null.c index 1f0e85e9007..33b1185ce00 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_null.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_null.c @@ -31,7 +31,6 @@ static const AVFilterPad avfilter_vf_null_inputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; static const AVFilterPad avfilter_vf_null_outputs[] = { @@ -39,12 +38,11 @@ static const AVFilterPad avfilter_vf_null_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_null = { .name = "null", .description = NULL_IF_CONFIG_SMALL("Pass the source unchanged to the output."), - .inputs = avfilter_vf_null_inputs, - .outputs = avfilter_vf_null_outputs, + FILTER_INPUTS(avfilter_vf_null_inputs), + FILTER_OUTPUTS(avfilter_vf_null_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_ocr.c b/chromium/third_party/ffmpeg/libavfilter/vf_ocr.c index 6de474025a2..7691f419326 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_ocr.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_ocr.c @@ -87,10 +87,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int filter_frame(AVFilterLink *inlink, AVFrame *in) @@ -135,7 +132,6 @@ static const AVFilterPad ocr_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad ocr_outputs[] = { @@ -143,7 +139,6 @@ static const AVFilterPad ocr_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_ocr = { @@ -154,6 +149,6 @@ const AVFilter ff_vf_ocr = { .query_formats = query_formats, .init = init, .uninit = uninit, - .inputs = ocr_inputs, - .outputs = ocr_outputs, + FILTER_INPUTS(ocr_inputs), + FILTER_OUTPUTS(ocr_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_overlay.c b/chromium/third_party/ffmpeg/libavfilter/vf_overlay.c index 9155de3736c..afa694e100d 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_overlay.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_overlay.c @@ -255,7 +255,7 @@ static int query_formats(AVFilterContext *ctx) overlay_formats = overlay_pix_fmts_gbrp; break; case OVERLAY_FORMAT_AUTO: - return ff_set_common_formats(ctx, ff_make_format_list(alpha_pix_fmts)); + return ff_set_common_formats_from_list(ctx, alpha_pix_fmts); default: av_assert0(0); } @@ -1029,8 +1029,8 @@ static int do_blend(FFFrameSync *fs) td.dst = mainpic; td.src = second; - ctx->internal->execute(ctx, s->blend_slice, &td, NULL, FFMIN(FFMAX(1, FFMIN3(s->y + second->height, FFMIN(second->height, mainpic->height), mainpic->height - s->y)), - ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->blend_slice, &td, NULL, FFMIN(FFMAX(1, FFMIN3(s->y + second->height, FFMIN(second->height, mainpic->height), mainpic->height - s->y)), + ff_filter_get_nb_threads(ctx))); } return ff_filter_frame(ctx->outputs[0], mainpic); } @@ -1094,7 +1094,6 @@ static const AVFilterPad avfilter_vf_overlay_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_input_overlay, }, - { NULL } }; static const AVFilterPad avfilter_vf_overlay_outputs[] = { @@ -1103,7 +1102,6 @@ static const AVFilterPad avfilter_vf_overlay_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_overlay = { @@ -1117,8 +1115,8 @@ const AVFilter ff_vf_overlay = { .query_formats = query_formats, .activate = activate, .process_command = process_command, - .inputs = avfilter_vf_overlay_inputs, - .outputs = avfilter_vf_overlay_outputs, + FILTER_INPUTS(avfilter_vf_overlay_inputs), + FILTER_OUTPUTS(avfilter_vf_overlay_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_overlay_cuda.c b/chromium/third_party/ffmpeg/libavfilter/vf_overlay_cuda.c index 37af4e2fa09..4c0719871b1 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_overlay_cuda.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_overlay_cuda.c @@ -423,9 +423,7 @@ static int overlay_cuda_query_formats(AVFilterContext *avctx) AV_PIX_FMT_CUDA, AV_PIX_FMT_NONE, }; - AVFilterFormats *pix_fmts = ff_make_format_list(pixel_formats); - - return ff_set_common_formats(avctx, pix_fmts); + return ff_set_common_formats_from_list(avctx, pixel_formats); } /** @@ -567,7 +565,6 @@ static const AVFilterPad overlay_cuda_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_input_overlay, }, - { NULL } }; static const AVFilterPad overlay_cuda_outputs[] = { @@ -576,7 +573,6 @@ static const AVFilterPad overlay_cuda_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = &overlay_cuda_config_output, }, - { NULL } }; const AVFilter ff_vf_overlay_cuda = { @@ -588,8 +584,8 @@ const AVFilter ff_vf_overlay_cuda = { .uninit = &overlay_cuda_uninit, .activate = &overlay_cuda_activate, .query_formats = &overlay_cuda_query_formats, - .inputs = overlay_cuda_inputs, - .outputs = overlay_cuda_outputs, + FILTER_INPUTS(overlay_cuda_inputs), + FILTER_OUTPUTS(overlay_cuda_outputs), .preinit = overlay_cuda_framesync_preinit, .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_overlay_opencl.c b/chromium/third_party/ffmpeg/libavfilter/vf_overlay_opencl.c index 6ba622baaa0..4f1d6bbdd28 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_overlay_opencl.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_overlay_opencl.c @@ -300,7 +300,6 @@ static const AVFilterPad overlay_opencl_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = &ff_opencl_filter_config_input, }, - { NULL } }; static const AVFilterPad overlay_opencl_outputs[] = { @@ -309,7 +308,6 @@ static const AVFilterPad overlay_opencl_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = &overlay_opencl_config_output, }, - { NULL } }; const AVFilter ff_vf_overlay_opencl = { @@ -321,7 +319,7 @@ const AVFilter ff_vf_overlay_opencl = { .uninit = &overlay_opencl_uninit, .query_formats = &ff_opencl_filter_query_formats, .activate = &overlay_opencl_activate, - .inputs = overlay_opencl_inputs, - .outputs = overlay_opencl_outputs, + FILTER_INPUTS(overlay_opencl_inputs), + FILTER_OUTPUTS(overlay_opencl_outputs), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_overlay_qsv.c b/chromium/third_party/ffmpeg/libavfilter/vf_overlay_qsv.c index 14c4c37a3ce..578ef47e88c 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_overlay_qsv.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_overlay_qsv.c @@ -403,7 +403,6 @@ static const AVFilterPad overlay_qsv_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_overlay_input, }, - { NULL } }; static const AVFilterPad overlay_qsv_outputs[] = { @@ -412,7 +411,6 @@ static const AVFilterPad overlay_qsv_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_overlay_qsv = { @@ -424,8 +422,8 @@ const AVFilter ff_vf_overlay_qsv = { .init = overlay_qsv_init, .uninit = overlay_qsv_uninit, .activate = activate, - .inputs = overlay_qsv_inputs, - .outputs = overlay_qsv_outputs, + FILTER_INPUTS(overlay_qsv_inputs), + FILTER_OUTPUTS(overlay_qsv_outputs), .priv_class = &overlay_qsv_class, .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_overlay_vulkan.c b/chromium/third_party/ffmpeg/libavfilter/vf_overlay_vulkan.c index 8dd3bd20927..1815709d82c 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_overlay_vulkan.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_overlay_vulkan.c @@ -463,7 +463,6 @@ static const AVFilterPad overlay_vulkan_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = &ff_vk_filter_config_input, }, - { NULL } }; static const AVFilterPad overlay_vulkan_outputs[] = { @@ -472,7 +471,6 @@ static const AVFilterPad overlay_vulkan_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = &overlay_vulkan_config_output, }, - { NULL } }; const AVFilter ff_vf_overlay_vulkan = { @@ -483,8 +481,8 @@ const AVFilter ff_vf_overlay_vulkan = { .uninit = &overlay_vulkan_uninit, .query_formats = &ff_vk_filter_query_formats, .activate = &overlay_vulkan_activate, - .inputs = overlay_vulkan_inputs, - .outputs = overlay_vulkan_outputs, + FILTER_INPUTS(overlay_vulkan_inputs), + FILTER_OUTPUTS(overlay_vulkan_outputs), .priv_class = &overlay_vulkan_class, .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_owdenoise.c b/chromium/third_party/ffmpeg/libavfilter/vf_owdenoise.c index f16a06e3b83..80ce3ca6542 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_owdenoise.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_owdenoise.c @@ -309,10 +309,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUV420P16, AV_PIX_FMT_YUV422P16, AV_PIX_FMT_YUV444P16, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) @@ -354,7 +351,6 @@ static const AVFilterPad owdenoise_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad owdenoise_outputs[] = { @@ -362,7 +358,6 @@ static const AVFilterPad owdenoise_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_owdenoise = { @@ -371,8 +366,8 @@ const AVFilter ff_vf_owdenoise = { .priv_size = sizeof(OWDenoiseContext), .uninit = uninit, .query_formats = query_formats, - .inputs = owdenoise_inputs, - .outputs = owdenoise_outputs, + FILTER_INPUTS(owdenoise_inputs), + FILTER_OUTPUTS(owdenoise_outputs), .priv_class = &owdenoise_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_pad.c b/chromium/third_party/ffmpeg/libavfilter/vf_pad.c index 871f2930afd..ba1728f8205 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_pad.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_pad.c @@ -438,10 +438,9 @@ static const AVFilterPad avfilter_vf_pad_inputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, .config_props = config_input, - .get_video_buffer = get_video_buffer, + .get_buffer.video = get_video_buffer, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad avfilter_vf_pad_outputs[] = { @@ -450,7 +449,6 @@ static const AVFilterPad avfilter_vf_pad_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_pad = { @@ -459,6 +457,6 @@ const AVFilter ff_vf_pad = { .priv_size = sizeof(PadContext), .priv_class = &pad_class, .query_formats = query_formats, - .inputs = avfilter_vf_pad_inputs, - .outputs = avfilter_vf_pad_outputs, + FILTER_INPUTS(avfilter_vf_pad_inputs), + FILTER_OUTPUTS(avfilter_vf_pad_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_pad_opencl.c b/chromium/third_party/ffmpeg/libavfilter/vf_pad_opencl.c index 8155a96e03a..9e6fc940978 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_pad_opencl.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_pad_opencl.c @@ -354,7 +354,6 @@ static const AVFilterPad pad_opencl_inputs[] = { .filter_frame = filter_frame, .config_props = &ff_opencl_filter_config_input, }, - { NULL } }; static const AVFilterPad pad_opencl_outputs[] = { @@ -363,7 +362,6 @@ static const AVFilterPad pad_opencl_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = &pad_opencl_config_output, }, - { NULL } }; #define OFFSET(x) offsetof(PadOpenCLContext, x) @@ -391,7 +389,7 @@ const AVFilter ff_vf_pad_opencl = { .init = &ff_opencl_filter_init, .uninit = &pad_opencl_uninit, .query_formats = &ff_opencl_filter_query_formats, - .inputs = pad_opencl_inputs, - .outputs = pad_opencl_outputs, + FILTER_INPUTS(pad_opencl_inputs), + FILTER_OUTPUTS(pad_opencl_outputs), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_palettegen.c b/chromium/third_party/ffmpeg/libavfilter/vf_palettegen.c index ef8bc181c53..4c2fbd36d7f 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_palettegen.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_palettegen.c @@ -113,8 +113,8 @@ static int cmp_##name(const void *pa, const void *pb) \ { \ const struct color_ref * const *a = pa; \ const struct color_ref * const *b = pb; \ - return ((*a)->color >> (8 * (2 - (pos))) & 0xff) \ - - ((*b)->color >> (8 * (2 - (pos))) & 0xff); \ + return (int)((*a)->color >> (8 * (2 - (pos))) & 0xff) \ + - (int)((*b)->color >> (8 * (2 - (pos))) & 0xff); \ } DECLARE_CMP_FUNC(r, 0) @@ -557,7 +557,6 @@ static const AVFilterPad palettegen_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad palettegen_outputs[] = { @@ -567,7 +566,6 @@ static const AVFilterPad palettegen_outputs[] = { .config_props = config_output, .request_frame = request_frame, }, - { NULL } }; const AVFilter ff_vf_palettegen = { @@ -576,7 +574,7 @@ const AVFilter ff_vf_palettegen = { .priv_size = sizeof(PaletteGenContext), .uninit = uninit, .query_formats = query_formats, - .inputs = palettegen_inputs, - .outputs = palettegen_outputs, + FILTER_INPUTS(palettegen_inputs), + FILTER_OUTPUTS(palettegen_outputs), .priv_class = &palettegen_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_paletteuse.c b/chromium/third_party/ffmpeg/libavfilter/vf_paletteuse.c index f07ef5d7600..f9bc28f7d02 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_paletteuse.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_paletteuse.c @@ -380,9 +380,13 @@ static av_always_inline int get_dst_color_err(PaletteUseContext *s, if (dstx < 0) return dstx; dstc = s->palette[dstx]; - *er = r - (dstc >> 16 & 0xff); - *eg = g - (dstc >> 8 & 0xff); - *eb = b - (dstc & 0xff); + if (dstx == s->transparency_index) { + *er = *eg = *eb = 0; + } else { + *er = (int)r - (int)(dstc >> 16 & 0xff); + *eg = (int)g - (int)(dstc >> 8 & 0xff); + *eb = (int)b - (int)(dstc & 0xff); + } return dstx; } @@ -597,8 +601,8 @@ static int cmp_##name(const void *pa, const void *pb) \ { \ const struct color *a = pa; \ const struct color *b = pb; \ - return (a->value >> (8 * (3 - (pos))) & 0xff) \ - - (b->value >> (8 * (3 - (pos))) & 0xff); \ + return (int)(a->value >> (8 * (3 - (pos))) & 0xff) \ + - (int)(b->value >> (8 * (3 - (pos))) & 0xff); \ } DECLARE_CMP_FUNC(a, 0) @@ -704,7 +708,7 @@ static int colormap_insert(struct color_node *map, /* get the two boxes this node creates */ box1 = box2 = *box; box1.max[component-1] = node->val[component]; - box2.min[component-1] = node->val[component] + 1; + box2.min[component-1] = FFMIN(node->val[component] + 1, 255); node_left_id = colormap_insert(map, color_used, nb_used, palette, trans_thresh, &box1); @@ -731,18 +735,13 @@ static void load_colormap(PaletteUseContext *s) uint32_t last_color = 0; struct color_rect box; - /* disable transparent colors and dups */ - qsort(s->palette, AVPALETTE_COUNT, sizeof(*s->palette), cmp_pal_entry); - // update transparency index: if (s->transparency_index >= 0) { - for (i = 0; i < AVPALETTE_COUNT; i++) { - if ((s->palette[i]>>24 & 0xff) == 0) { - s->transparency_index = i; // we are assuming at most one transparent color in palette - break; - } - } + FFSWAP(uint32_t, s->palette[s->transparency_index], s->palette[255]); } + /* disable transparent colors and dups */ + qsort(s->palette, AVPALETTE_COUNT-(s->transparency_index >= 0), sizeof(*s->palette), cmp_pal_entry); + for (i = 0; i < AVPALETTE_COUNT; i++) { const uint32_t c = s->palette[i]; if (i != 0 && c == last_color) { @@ -1076,11 +1075,8 @@ static av_cold int init(AVFilterContext *ctx) s->last_in = av_frame_alloc(); s->last_out = av_frame_alloc(); - if (!s->last_in || !s->last_out) { - av_frame_free(&s->last_in); - av_frame_free(&s->last_out); + if (!s->last_in || !s->last_out) return AVERROR(ENOMEM); - } s->set_frame = set_frame_lut[s->color_search_method][s->dither]; @@ -1122,7 +1118,6 @@ static const AVFilterPad paletteuse_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_input_palette, }, - { NULL } }; static const AVFilterPad paletteuse_outputs[] = { @@ -1131,7 +1126,6 @@ static const AVFilterPad paletteuse_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_paletteuse = { @@ -1142,7 +1136,7 @@ const AVFilter ff_vf_paletteuse = { .init = init, .uninit = uninit, .activate = activate, - .inputs = paletteuse_inputs, - .outputs = paletteuse_outputs, + FILTER_INPUTS(paletteuse_inputs), + FILTER_OUTPUTS(paletteuse_outputs), .priv_class = &paletteuse_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_perspective.c b/chromium/third_party/ffmpeg/libavfilter/vf_perspective.c index a3fa080f21c..5fa661862fe 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_perspective.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_perspective.c @@ -103,10 +103,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP, AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static inline double get_coeff(double d) @@ -479,7 +476,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) .h = s->height[plane], .hsub = hsub, .vsub = vsub }; - ctx->internal->execute(ctx, s->perspective, &td, NULL, FFMIN(td.h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->perspective, &td, NULL, + FFMIN(td.h, ff_filter_get_nb_threads(ctx))); } av_frame_free(&frame); @@ -500,7 +498,6 @@ static const AVFilterPad perspective_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad perspective_outputs[] = { @@ -508,7 +505,6 @@ static const AVFilterPad perspective_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_perspective = { @@ -518,8 +514,8 @@ const AVFilter ff_vf_perspective = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = perspective_inputs, - .outputs = perspective_outputs, + FILTER_INPUTS(perspective_inputs), + FILTER_OUTPUTS(perspective_outputs), .priv_class = &perspective_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_phase.c b/chromium/third_party/ffmpeg/libavfilter/vf_phase.c index 556620d36cb..cab6174d72d 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_phase.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_phase.c @@ -125,10 +125,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) @@ -224,7 +221,6 @@ static const AVFilterPad phase_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad phase_outputs[] = { @@ -232,7 +228,6 @@ static const AVFilterPad phase_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_phase = { @@ -242,8 +237,8 @@ const AVFilter ff_vf_phase = { .priv_class = &phase_class, .uninit = uninit, .query_formats = query_formats, - .inputs = phase_inputs, - .outputs = phase_outputs, + FILTER_INPUTS(phase_inputs), + FILTER_OUTPUTS(phase_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, .process_command = ff_filter_process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_photosensitivity.c b/chromium/third_party/ffmpeg/libavfilter/vf_photosensitivity.c index dd3d957bfa7..a5a86133f1b 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_photosensitivity.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_photosensitivity.c @@ -77,10 +77,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_BGR24, AV_PIX_FMT_NONE }; - AVFilterFormats *formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } typedef struct ThreadData_convert_frame @@ -146,7 +143,8 @@ static void convert_frame(AVFilterContext *ctx, AVFrame *in, PhotosensitivityFra td.in = in; td.out = out; td.skip = skip; - ctx->internal->execute(ctx, convert_frame_partial, &td, NULL, FFMIN(NUM_CELLS, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, convert_frame_partial, &td, NULL, + FFMIN(NUM_CELLS, ff_filter_get_nb_threads(ctx))); } typedef struct ThreadData_blend_frame @@ -185,7 +183,8 @@ static void blend_frame(AVFilterContext *ctx, AVFrame *target, AVFrame *source, td.target = target; td.source = source; td.s_mul = (uint16_t)(factor * 0x100); - ctx->internal->execute(ctx, blend_frame_partial, &td, NULL, FFMIN(ctx->outputs[0]->h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, blend_frame_partial, &td, NULL, + FFMIN(ctx->outputs[0]->h, ff_filter_get_nb_threads(ctx))); } static int get_badness(PhotosensitivityFrame *a, PhotosensitivityFrame *b) @@ -318,7 +317,6 @@ static const AVFilterPad inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -326,7 +324,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_photosensitivity = { @@ -336,6 +333,6 @@ const AVFilter ff_vf_photosensitivity = { .priv_class = &photosensitivity_class, .uninit = uninit, .query_formats = query_formats, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_pixdesctest.c b/chromium/third_party/ffmpeg/libavfilter/vf_pixdesctest.c index b56839d9947..12815aea9c4 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_pixdesctest.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_pixdesctest.c @@ -113,7 +113,6 @@ static const AVFilterPad avfilter_vf_pixdesctest_inputs[] = { .filter_frame = filter_frame, .config_props = config_props, }, - { NULL } }; static const AVFilterPad avfilter_vf_pixdesctest_outputs[] = { @@ -121,7 +120,6 @@ static const AVFilterPad avfilter_vf_pixdesctest_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_pixdesctest = { @@ -129,6 +127,6 @@ const AVFilter ff_vf_pixdesctest = { .description = NULL_IF_CONFIG_SMALL("Test pixel format definitions."), .priv_size = sizeof(PixdescTestContext), .uninit = uninit, - .inputs = avfilter_vf_pixdesctest_inputs, - .outputs = avfilter_vf_pixdesctest_outputs, + FILTER_INPUTS(avfilter_vf_pixdesctest_inputs), + FILTER_OUTPUTS(avfilter_vf_pixdesctest_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_pp.c b/chromium/third_party/ffmpeg/libavfilter/vf_pp.c index 5cd89932f8d..c27c2029c00 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_pp.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_pp.c @@ -88,10 +88,7 @@ static int pp_query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int pp_config_props(AVFilterLink *inlink) @@ -180,7 +177,6 @@ static const AVFilterPad pp_inputs[] = { .config_props = pp_config_props, .filter_frame = pp_filter_frame, }, - { NULL } }; static const AVFilterPad pp_outputs[] = { @@ -188,7 +184,6 @@ static const AVFilterPad pp_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_pp = { @@ -198,8 +193,8 @@ const AVFilter ff_vf_pp = { .init = pp_init, .uninit = pp_uninit, .query_formats = pp_query_formats, - .inputs = pp_inputs, - .outputs = pp_outputs, + FILTER_INPUTS(pp_inputs), + FILTER_OUTPUTS(pp_outputs), .process_command = pp_process_command, .priv_class = &pp_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_pp7.c b/chromium/third_party/ffmpeg/libavfilter/vf_pp7.c index a9a2fa3d198..74f20365e04 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_pp7.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_pp7.c @@ -276,10 +276,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) @@ -390,7 +387,6 @@ static const AVFilterPad pp7_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad pp7_outputs[] = { @@ -398,7 +394,6 @@ static const AVFilterPad pp7_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_pp7 = { @@ -407,8 +402,8 @@ const AVFilter ff_vf_pp7 = { .priv_size = sizeof(PP7Context), .uninit = uninit, .query_formats = query_formats, - .inputs = pp7_inputs, - .outputs = pp7_outputs, + FILTER_INPUTS(pp7_inputs), + FILTER_OUTPUTS(pp7_outputs), .priv_class = &pp7_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_premultiply.c b/chromium/third_party/ffmpeg/libavfilter/vf_premultiply.c index b5d0ca6d67d..70a5bf3b11f 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_premultiply.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_premultiply.c @@ -86,7 +86,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(s->inplace ? alpha_pix_fmts : no_alpha_pix_fmts)); + return ff_set_common_formats_from_list(ctx, s->inplace ? alpha_pix_fmts : no_alpha_pix_fmts); } static void premultiply8(const uint8_t *msrc, const uint8_t *asrc, @@ -635,8 +635,8 @@ static int filter_frame(AVFilterContext *ctx, td.d = *out; td.a = alpha; td.m = base; - ctx->internal->execute(ctx, premultiply_slice, &td, NULL, FFMIN(s->height[0], - ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, premultiply_slice, &td, NULL, + FFMIN(s->height[0], ff_filter_get_nb_threads(ctx))); } return 0; @@ -790,7 +790,7 @@ static av_cold int init(AVFilterContext *ctx) pad.name = "main"; pad.config_props = config_input; - if ((ret = ff_insert_inpad(ctx, 0, &pad)) < 0) + if ((ret = ff_append_inpad(ctx, &pad)) < 0) return ret; if (!s->inplace) { @@ -798,7 +798,7 @@ static av_cold int init(AVFilterContext *ctx) pad.name = "alpha"; pad.config_props = NULL; - if ((ret = ff_insert_inpad(ctx, 1, &pad)) < 0) + if ((ret = ff_append_inpad(ctx, &pad)) < 0) return ret; } @@ -819,7 +819,6 @@ static const AVFilterPad premultiply_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; #if CONFIG_PREMULTIPLY_FILTER @@ -833,7 +832,7 @@ const AVFilter ff_vf_premultiply = { .query_formats = query_formats, .activate = activate, .inputs = NULL, - .outputs = premultiply_outputs, + FILTER_OUTPUTS(premultiply_outputs), .priv_class = &premultiply_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_DYNAMIC_INPUTS | @@ -856,7 +855,7 @@ const AVFilter ff_vf_unpremultiply = { .query_formats = query_formats, .activate = activate, .inputs = NULL, - .outputs = premultiply_outputs, + FILTER_OUTPUTS(premultiply_outputs), .priv_class = &unpremultiply_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_DYNAMIC_INPUTS | diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_procamp_vaapi.c b/chromium/third_party/ffmpeg/libavfilter/vf_procamp_vaapi.c index 5527556d099..758546abf99 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_procamp_vaapi.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_procamp_vaapi.c @@ -219,7 +219,6 @@ static const AVFilterPad procamp_vaapi_inputs[] = { .filter_frame = &procamp_vaapi_filter_frame, .config_props = &ff_vaapi_vpp_config_input, }, - { NULL } }; static const AVFilterPad procamp_vaapi_outputs[] = { @@ -228,7 +227,6 @@ static const AVFilterPad procamp_vaapi_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = &ff_vaapi_vpp_config_output, }, - { NULL } }; const AVFilter ff_vf_procamp_vaapi = { @@ -238,8 +236,8 @@ const AVFilter ff_vf_procamp_vaapi = { .init = &procamp_vaapi_init, .uninit = &ff_vaapi_vpp_ctx_uninit, .query_formats = &ff_vaapi_vpp_query_formats, - .inputs = procamp_vaapi_inputs, - .outputs = procamp_vaapi_outputs, + FILTER_INPUTS(procamp_vaapi_inputs), + FILTER_OUTPUTS(procamp_vaapi_outputs), .priv_class = &procamp_vaapi_class, .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_program_opencl.c b/chromium/third_party/ffmpeg/libavfilter/vf_program_opencl.c index 4b38baeb3c7..fdc6b4dcd1d 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_program_opencl.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_program_opencl.c @@ -287,11 +287,9 @@ static av_cold int program_opencl_init(AVFilterContext *avctx) input.config_props = &ff_opencl_filter_config_input; - err = ff_insert_inpad(avctx, i, &input); - if (err < 0) { - av_freep(&input.name); + err = ff_append_inpad_free_name(avctx, &input); + if (err < 0) return err; - } } } @@ -302,14 +300,11 @@ static av_cold void program_opencl_uninit(AVFilterContext *avctx) { ProgramOpenCLContext *ctx = avctx->priv; cl_int cle; - int i; if (ctx->nb_inputs > 0) { ff_framesync_uninit(&ctx->fs); av_freep(&ctx->frames); - for (i = 0; i < avctx->nb_inputs; i++) - av_freep(&avctx->input_pads[i].name); } if (ctx->kernel) { @@ -359,7 +354,6 @@ static const AVFilterPad program_opencl_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = &program_opencl_config_output, }, - { NULL } }; const AVFilter ff_vf_program_opencl = { @@ -367,13 +361,14 @@ const AVFilter ff_vf_program_opencl = { .description = NULL_IF_CONFIG_SMALL("Filter video using an OpenCL program"), .priv_size = sizeof(ProgramOpenCLContext), .priv_class = &program_opencl_class, + .flags = AVFILTER_FLAG_DYNAMIC_INPUTS, .preinit = &program_opencl_framesync_preinit, .init = &program_opencl_init, .uninit = &program_opencl_uninit, .query_formats = &ff_opencl_filter_query_formats, .activate = &program_opencl_activate, .inputs = NULL, - .outputs = program_opencl_outputs, + FILTER_OUTPUTS(program_opencl_outputs), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; @@ -412,7 +407,6 @@ static const AVFilterPad openclsrc_outputs[] = { .config_props = &program_opencl_config_output, .request_frame = &program_opencl_request_frame, }, - { NULL } }; const AVFilter ff_vsrc_openclsrc = { @@ -424,7 +418,7 @@ const AVFilter ff_vsrc_openclsrc = { .uninit = &program_opencl_uninit, .query_formats = &ff_opencl_filter_query_formats, .inputs = NULL, - .outputs = openclsrc_outputs, + FILTER_OUTPUTS(openclsrc_outputs), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_pseudocolor.c b/chromium/third_party/ffmpeg/libavfilter/vf_pseudocolor.c index ec14a0c363f..44cb01ef9a6 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_pseudocolor.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_pseudocolor.c @@ -281,10 +281,7 @@ static const enum AVPixelFormat pix_fmts[] = { static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static inline float lerpf(float v0, float v1, float f) @@ -872,7 +869,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) av_frame_copy_props(out, in); td.out = out, td.in = in; - ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(s->height[1], ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_slice, &td, NULL, + FFMIN(s->height[1], ff_filter_get_nb_threads(ctx))); av_frame_free(&in); return ff_filter_frame(outlink, out); @@ -896,7 +894,6 @@ static const AVFilterPad inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -904,7 +901,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; static av_cold void uninit(AVFilterContext *ctx) @@ -927,8 +923,8 @@ const AVFilter ff_vf_pseudocolor = { .priv_class = &pseudocolor_class, .uninit = uninit, .query_formats = query_formats, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_psnr.c b/chromium/third_party/ffmpeg/libavfilter/vf_psnr.c index e5459d3f347..d254d0cb55b 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_psnr.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_psnr.c @@ -189,7 +189,8 @@ static int do_psnr(FFFrameSync *fs) td.planeheight[c] = s->planeheight[c]; } - ctx->internal->execute(ctx, compute_images_mse, &td, NULL, FFMIN(s->planeheight[1], s->nb_threads)); + ff_filter_execute(ctx, compute_images_mse, &td, NULL, + FFMIN(s->planeheight[1], s->nb_threads)); for (int j = 0; j < s->nb_threads; j++) { for (int c = 0; c < s->nb_components; c++) @@ -312,10 +313,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input_ref(AVFilterLink *inlink) @@ -455,7 +453,6 @@ static const AVFilterPad psnr_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_input_ref, }, - { NULL } }; static const AVFilterPad psnr_outputs[] = { @@ -464,7 +461,6 @@ static const AVFilterPad psnr_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_psnr = { @@ -477,7 +473,7 @@ const AVFilter ff_vf_psnr = { .activate = activate, .priv_size = sizeof(PSNRContext), .priv_class = &psnr_class, - .inputs = psnr_inputs, - .outputs = psnr_outputs, + FILTER_INPUTS(psnr_inputs), + FILTER_OUTPUTS(psnr_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_pullup.c b/chromium/third_party/ffmpeg/libavfilter/vf_pullup.c index 00d3a8dc51a..57e86e9c897 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_pullup.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_pullup.c @@ -64,10 +64,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } #define ABS(a) (((a) ^ ((a) >> 31)) - ((a) >> 31)) @@ -753,7 +750,6 @@ static const AVFilterPad pullup_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad pullup_outputs[] = { @@ -761,7 +757,6 @@ static const AVFilterPad pullup_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_pullup = { @@ -771,6 +766,6 @@ const AVFilter ff_vf_pullup = { .priv_class = &pullup_class, .uninit = uninit, .query_formats = query_formats, - .inputs = pullup_inputs, - .outputs = pullup_outputs, + FILTER_INPUTS(pullup_inputs), + FILTER_OUTPUTS(pullup_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_qp.c b/chromium/third_party/ffmpeg/libavfilter/vf_qp.c index c932d45a76c..d942ba15790 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_qp.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_qp.c @@ -182,7 +182,6 @@ static const AVFilterPad qp_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad qp_outputs[] = { @@ -190,15 +189,14 @@ static const AVFilterPad qp_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_qp = { .name = "qp", .description = NULL_IF_CONFIG_SMALL("Change video quantization parameters."), .priv_size = sizeof(QPContext), - .inputs = qp_inputs, - .outputs = qp_outputs, + FILTER_INPUTS(qp_inputs), + FILTER_OUTPUTS(qp_outputs), .priv_class = &qp_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_random.c b/chromium/third_party/ffmpeg/libavfilter/vf_random.c index 5e4c30a3b5f..b3acdd1fcf6 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_random.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_random.c @@ -127,7 +127,6 @@ static const AVFilterPad random_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad random_outputs[] = { @@ -136,7 +135,6 @@ static const AVFilterPad random_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .request_frame = request_frame, }, - { NULL } }; const AVFilter ff_vf_random = { @@ -146,6 +144,6 @@ const AVFilter ff_vf_random = { .priv_class = &random_class, .init = init, .uninit = uninit, - .inputs = random_inputs, - .outputs = random_outputs, + FILTER_INPUTS(random_inputs), + FILTER_OUTPUTS(random_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_readeia608.c b/chromium/third_party/ffmpeg/libavfilter/vf_readeia608.c index 9558e938ab8..2d6d0653a18 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_readeia608.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_readeia608.c @@ -125,10 +125,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUVA420P9, AV_PIX_FMT_YUVA420P10, AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_NONE }; - AVFilterFormats *formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } static int config_filter(AVFilterContext *ctx, int start, int end) @@ -474,8 +471,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) ReadEIA608Context *s = ctx->priv; int nb_found; - ctx->internal->execute(ctx, extract_lines, in, NULL, FFMIN(FFMAX(s->end - s->start + 1, 1), - ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, extract_lines, in, NULL, + FFMIN(FFMAX(s->end - s->start + 1, 1), ff_filter_get_nb_threads(ctx))); nb_found = 0; for (int i = 0; i < s->end - s->start + 1; i++) { @@ -545,7 +542,6 @@ static const AVFilterPad readeia608_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad readeia608_outputs[] = { @@ -553,7 +549,6 @@ static const AVFilterPad readeia608_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_readeia608 = { @@ -562,8 +557,8 @@ const AVFilter ff_vf_readeia608 = { .priv_size = sizeof(ReadEIA608Context), .priv_class = &readeia608_class, .query_formats = query_formats, - .inputs = readeia608_inputs, - .outputs = readeia608_outputs, + FILTER_INPUTS(readeia608_inputs), + FILTER_OUTPUTS(readeia608_outputs), .uninit = uninit, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = process_command, diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_readvitc.c b/chromium/third_party/ffmpeg/libavfilter/vf_readvitc.c index 25cfa5f32d3..d117a812847 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_readvitc.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_readvitc.c @@ -207,10 +207,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pixel_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } static int filter_frame(AVFilterLink *inlink, AVFrame *frame) @@ -235,7 +232,6 @@ static const AVFilterPad inputs[] = { .filter_frame = filter_frame, .config_props = config_props, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -243,7 +239,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_readvitc = { @@ -251,8 +246,8 @@ const AVFilter ff_vf_readvitc = { .description = NULL_IF_CONFIG_SMALL("Read vertical interval timecode and write it to frame metadata."), .priv_size = sizeof(ReadVitcContext), .priv_class = &readvitc_class, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .init = init, .query_formats = query_formats, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_remap.c b/chromium/third_party/ffmpeg/libavfilter/vf_remap.c index 5ab6199d71b..d372ac1d7d2 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_remap.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_remap.c @@ -302,7 +302,8 @@ static int process_frame(FFFrameSync *fs) td.nb_planes = s->nb_planes; td.nb_components = s->nb_components; td.step = s->step; - ctx->internal->execute(ctx, s->remap_slice, &td, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->remap_slice, &td, NULL, + FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); } out->pts = av_rescale_q(s->fs.pts, s->fs.time_base, outlink->time_base); @@ -386,7 +387,6 @@ static const AVFilterPad remap_inputs[] = { .name = "ymap", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; static const AVFilterPad remap_outputs[] = { @@ -395,7 +395,6 @@ static const AVFilterPad remap_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_remap = { @@ -405,8 +404,8 @@ const AVFilter ff_vf_remap = { .uninit = uninit, .query_formats = query_formats, .activate = activate, - .inputs = remap_inputs, - .outputs = remap_outputs, + FILTER_INPUTS(remap_inputs), + FILTER_OUTPUTS(remap_outputs), .priv_class = &remap_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_removegrain.c b/chromium/third_party/ffmpeg/libavfilter/vf_removegrain.c index 75b3ec35bb8..1d1d756057a 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_removegrain.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_removegrain.c @@ -57,10 +57,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } #define REMOVE_GRAIN_SORT_AXIS \ @@ -618,8 +615,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) memcpy(dst, src, s->planewidth[i]); td.in = in; td.out = out; td.plane = i; - ctx->internal->execute(ctx, filter_slice, &td, NULL, - FFMIN(s->planeheight[i], ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_slice, &td, NULL, + FFMIN(s->planeheight[i], ff_filter_get_nb_threads(ctx))); src = in->data[i] + (s->planeheight[i] - 1) * in->linesize[i]; dst = out->data[i] + (s->planeheight[i] - 1) * out->linesize[i]; @@ -637,7 +634,6 @@ static const AVFilterPad removegrain_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad removegrain_outputs[] = { @@ -645,7 +641,6 @@ static const AVFilterPad removegrain_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_removegrain = { @@ -653,8 +648,8 @@ const AVFilter ff_vf_removegrain = { .description = NULL_IF_CONFIG_SMALL("Remove grain."), .priv_size = sizeof(RemoveGrainContext), .query_formats = query_formats, - .inputs = removegrain_inputs, - .outputs = removegrain_outputs, + FILTER_INPUTS(removegrain_inputs), + FILTER_OUTPUTS(removegrain_outputs), .priv_class = &removegrain_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_removelogo.c b/chromium/third_party/ffmpeg/libavfilter/vf_removelogo.c index 4bb81a8a5bc..acf09960ff1 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_removelogo.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_removelogo.c @@ -206,10 +206,7 @@ static void convert_mask_to_strength_mask(uint8_t *data, int linesize, static int query_formats(AVFilterContext *ctx) { static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int load_mask(uint8_t **mask, int *w, int *h, @@ -562,7 +559,6 @@ static const AVFilterPad removelogo_inputs[] = { .config_props = config_props_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad removelogo_outputs[] = { @@ -570,7 +566,6 @@ static const AVFilterPad removelogo_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_removelogo = { @@ -580,8 +575,8 @@ const AVFilter ff_vf_removelogo = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = removelogo_inputs, - .outputs = removelogo_outputs, + FILTER_INPUTS(removelogo_inputs), + FILTER_OUTPUTS(removelogo_outputs), .priv_class = &removelogo_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_repeatfields.c b/chromium/third_party/ffmpeg/libavfilter/vf_repeatfields.c index 1e2abd3a826..ca4bd97b2f8 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_repeatfields.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_repeatfields.c @@ -50,10 +50,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pixel_fmts_eq); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pixel_fmts_eq); } static int config_input(AVFilterLink *inlink) @@ -170,7 +167,6 @@ static const AVFilterPad repeatfields_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad repeatfields_outputs[] = { @@ -178,7 +174,6 @@ static const AVFilterPad repeatfields_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_repeatfields = { @@ -186,7 +181,7 @@ const AVFilter ff_vf_repeatfields = { .description = NULL_IF_CONFIG_SMALL("Hard repeat fields based on MPEG repeat field flag."), .priv_size = sizeof(RepeatFieldsContext), .uninit = uninit, - .inputs = repeatfields_inputs, - .outputs = repeatfields_outputs, + FILTER_INPUTS(repeatfields_inputs), + FILTER_OUTPUTS(repeatfields_outputs), .query_formats = query_formats, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_rotate.c b/chromium/third_party/ffmpeg/libavfilter/vf_rotate.c index f16207cbffe..c74e1adff9d 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_rotate.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_rotate.c @@ -157,10 +157,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static double get_rotated_w(void *opaque, double angle) @@ -551,8 +548,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) .yprime = -(outh-1) * c / 2, .plane = plane, .c = c, .s = s }; - - ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(outh, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_slice, &td, NULL, + FFMIN(outh, ff_filter_get_nb_threads(ctx))); } av_frame_free(&in); @@ -588,7 +585,6 @@ static const AVFilterPad rotate_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad rotate_outputs[] = { @@ -597,7 +593,6 @@ static const AVFilterPad rotate_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_props, }, - { NULL } }; const AVFilter ff_vf_rotate = { @@ -608,8 +603,8 @@ const AVFilter ff_vf_rotate = { .uninit = uninit, .query_formats = query_formats, .process_command = process_command, - .inputs = rotate_inputs, - .outputs = rotate_outputs, + FILTER_INPUTS(rotate_inputs), + FILTER_OUTPUTS(rotate_outputs), .priv_class = &rotate_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_sab.c b/chromium/third_party/ffmpeg/libavfilter/vf_sab.c index 12fbe40655f..bc7e7e30ed0 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_sab.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_sab.c @@ -65,10 +65,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUV411P, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } #define RADIUS_MIN 0.1 @@ -312,7 +309,6 @@ static const AVFilterPad sab_inputs[] = { .filter_frame = filter_frame, .config_props = config_props, }, - { NULL } }; static const AVFilterPad sab_outputs[] = { @@ -320,7 +316,6 @@ static const AVFilterPad sab_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_sab = { @@ -330,8 +325,8 @@ const AVFilter ff_vf_sab = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = sab_inputs, - .outputs = sab_outputs, + FILTER_INPUTS(sab_inputs), + FILTER_OUTPUTS(sab_outputs), .priv_class = &sab_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_scale.c b/chromium/third_party/ffmpeg/libavfilter/vf_scale.c index f07e01bf90c..6c7f4dc9ab8 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_scale.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_scale.c @@ -148,8 +148,6 @@ typedef struct ScaleContext { int force_original_aspect_ratio; int force_divisible_by; - int nb_slices; - int eval_mode; ///< expression evaluation mode } ScaleContext; @@ -313,7 +311,7 @@ static av_cold int init_dict(AVFilterContext *ctx, AVDictionary **opts) scale->flags = 0; - if (scale->flags_str) { + if (scale->flags_str && *scale->flags_str) { const AVClass *class = sws_get_class(); const AVOption *o = av_opt_find(&class, "sws_flags", NULL, 0, AV_OPT_SEARCH_FAKE_OBJ); @@ -530,31 +528,32 @@ static int config_props(AVFilterLink *outlink) for (i = 0; i < 3; i++) { int in_v_chr_pos = scale->in_v_chr_pos, out_v_chr_pos = scale->out_v_chr_pos; - struct SwsContext **s = swscs[i]; - *s = sws_alloc_context(); - if (!*s) + struct SwsContext *const s = sws_alloc_context(); + if (!s) return AVERROR(ENOMEM); - - av_opt_set_int(*s, "srcw", inlink0 ->w, 0); - av_opt_set_int(*s, "srch", inlink0 ->h >> !!i, 0); - av_opt_set_int(*s, "src_format", inlink0->format, 0); - av_opt_set_int(*s, "dstw", outlink->w, 0); - av_opt_set_int(*s, "dsth", outlink->h >> !!i, 0); - av_opt_set_int(*s, "dst_format", outfmt, 0); - av_opt_set_int(*s, "sws_flags", scale->flags, 0); - av_opt_set_int(*s, "param0", scale->param[0], 0); - av_opt_set_int(*s, "param1", scale->param[1], 0); + *swscs[i] = s; + + av_opt_set_int(s, "srcw", inlink0 ->w, 0); + av_opt_set_int(s, "srch", inlink0 ->h >> !!i, 0); + av_opt_set_int(s, "src_format", inlink0->format, 0); + av_opt_set_int(s, "dstw", outlink->w, 0); + av_opt_set_int(s, "dsth", outlink->h >> !!i, 0); + av_opt_set_int(s, "dst_format", outfmt, 0); + av_opt_set_int(s, "sws_flags", scale->flags, 0); + av_opt_set_int(s, "param0", scale->param[0], 0); + av_opt_set_int(s, "param1", scale->param[1], 0); + av_opt_set_int(s, "threads", ff_filter_get_nb_threads(ctx), 0); if (scale->in_range != AVCOL_RANGE_UNSPECIFIED) - av_opt_set_int(*s, "src_range", + av_opt_set_int(s, "src_range", scale->in_range == AVCOL_RANGE_JPEG, 0); if (scale->out_range != AVCOL_RANGE_UNSPECIFIED) - av_opt_set_int(*s, "dst_range", + av_opt_set_int(s, "dst_range", scale->out_range == AVCOL_RANGE_JPEG, 0); if (scale->opts) { AVDictionaryEntry *e = NULL; while ((e = av_dict_get(scale->opts, "", e, AV_DICT_IGNORE_SUFFIX))) { - if ((ret = av_opt_set(*s, e->key, e->value, 0)) < 0) + if ((ret = av_opt_set(s, e->key, e->value, 0)) < 0) return ret; } } @@ -569,12 +568,12 @@ static int config_props(AVFilterLink *outlink) out_v_chr_pos = (i == 0) ? 128 : (i == 1) ? 64 : 192; } - av_opt_set_int(*s, "src_h_chr_pos", scale->in_h_chr_pos, 0); - av_opt_set_int(*s, "src_v_chr_pos", in_v_chr_pos, 0); - av_opt_set_int(*s, "dst_h_chr_pos", scale->out_h_chr_pos, 0); - av_opt_set_int(*s, "dst_v_chr_pos", out_v_chr_pos, 0); + av_opt_set_int(s, "src_h_chr_pos", scale->in_h_chr_pos, 0); + av_opt_set_int(s, "src_v_chr_pos", in_v_chr_pos, 0); + av_opt_set_int(s, "dst_h_chr_pos", scale->out_h_chr_pos, 0); + av_opt_set_int(s, "dst_v_chr_pos", out_v_chr_pos, 0); - if ((ret = sws_init_context(*s, NULL, NULL)) < 0) + if ((ret = sws_init_context(s, NULL, NULL)) < 0) return ret; if (!scale->interlaced) break; @@ -621,29 +620,54 @@ static int request_frame_ref(AVFilterLink *outlink) return ff_request_frame(outlink->src->inputs[1]); } -static int scale_slice(ScaleContext *scale, AVFrame *out_buf, AVFrame *cur_pic, struct SwsContext *sws, int y, int h, int mul, int field) +static void frame_offset(AVFrame *frame, int dir, int is_pal) { - const uint8_t *in[4]; - uint8_t *out[4]; - int in_stride[4],out_stride[4]; - int i; - - for (i=0; i<4; i++) { - int vsub= ((i+1)&2) ? scale->vsub : 0; - ptrdiff_t in_offset = ((y>>vsub)+field) * cur_pic->linesize[i]; - ptrdiff_t out_offset = field * out_buf->linesize[i]; - in_stride[i] = cur_pic->linesize[i] * mul; - out_stride[i] = out_buf->linesize[i] * mul; - in[i] = FF_PTR_ADD(cur_pic->data[i], in_offset); - out[i] = FF_PTR_ADD(out_buf->data[i], out_offset); + for (int i = 0; i < 4 && frame->data[i]; i++) { + if (i == 1 && is_pal) + break; + frame->data[i] += frame->linesize[i] * dir; } - if (scale->input_is_pal) - in[1] = cur_pic->data[1]; - if (scale->output_is_pal) - out[1] = out_buf->data[1]; +} + +static int scale_field(ScaleContext *scale, AVFrame *dst, AVFrame *src, + int field) +{ + int orig_h_src = src->height; + int orig_h_dst = dst->height; + int ret; + + // offset the data pointers for the bottom field + if (field) { + frame_offset(src, 1, scale->input_is_pal); + frame_offset(dst, 1, scale->output_is_pal); + } + + // take every second line + for (int i = 0; i < 4; i++) { + src->linesize[i] *= 2; + dst->linesize[i] *= 2; + } + src->height /= 2; + dst->height /= 2; + + ret = sws_scale_frame(scale->isws[field], dst, src); + if (ret < 0) + return ret; - return sws_scale(sws, in, in_stride, y/mul, h, - out,out_stride); + // undo the changes we made above + for (int i = 0; i < 4; i++) { + src->linesize[i] /= 2; + dst->linesize[i] /= 2; + } + src->height = orig_h_src; + dst->height = orig_h_dst; + + if (field) { + frame_offset(src, -1, scale->input_is_pal); + frame_offset(dst, -1, scale->output_is_pal); + } + + return 0; } static int scale_frame(AVFilterLink *link, AVFrame *in, AVFrame **frame_out) @@ -738,6 +762,18 @@ scale: out->width = outlink->w; out->height = outlink->h; + // Sanity checks: + // 1. If the output is RGB, set the matrix coefficients to RGB. + // 2. If the output is not RGB and we've got the RGB/XYZ (identity) + // matrix configured, unset the matrix. + // In theory these should be in swscale itself as the AVFrame + // based API gets in, so that not every swscale API user has + // to go through duplicating such sanity checks. + if (av_pix_fmt_desc_get(out->format)->flags & AV_PIX_FMT_FLAG_RGB) + out->colorspace = AVCOL_SPC_RGB; + else if (out->colorspace == AVCOL_SPC_RGB) + out->colorspace = AVCOL_SPC_UNSPECIFIED; + if (scale->output_is_pal) avpriv_set_systematic_pal2((uint32_t*)out->data[1], outlink->format == AV_PIX_FMT_PAL8 ? AV_PIX_FMT_BGR8 : outlink->format); @@ -790,22 +826,11 @@ scale: INT_MAX); if (scale->interlaced>0 || (scale->interlaced<0 && in->interlaced_frame)) { - ret = scale_slice(scale, out, in, scale->isws[0], 0, (link->h+1)/2, 2, 0); + ret = scale_field(scale, out, in, 0); if (ret >= 0) - ret = scale_slice(scale, out, in, scale->isws[1], 0, link->h /2, 2, 1); - } else if (scale->nb_slices) { - int i, slice_h, slice_start, slice_end = 0; - const int nb_slices = FFMIN(scale->nb_slices, link->h); - for (i = 0; i < nb_slices; i++) { - slice_start = slice_end; - slice_end = (link->h * (i+1)) / nb_slices; - slice_h = slice_end - slice_start; - ret = scale_slice(scale, out, in, scale->sws, slice_start, slice_h, 1, 0); - if (ret < 0) - break; - } + ret = scale_field(scale, out, in, 1); } else { - ret = scale_slice(scale, out, in, scale->sws, 0, link->h, 1, 0); + ret = sws_scale_frame(scale->sws, out, in); } av_frame_free(&in); @@ -900,7 +925,7 @@ static const AVOption scale_options[] = { { "width", "Output video width", OFFSET(w_expr), AV_OPT_TYPE_STRING, .flags = TFLAGS }, { "h", "Output video height", OFFSET(h_expr), AV_OPT_TYPE_STRING, .flags = TFLAGS }, { "height","Output video height", OFFSET(h_expr), AV_OPT_TYPE_STRING, .flags = TFLAGS }, - { "flags", "Flags to pass to libswscale", OFFSET(flags_str), AV_OPT_TYPE_STRING, { .str = "bilinear" }, .flags = FLAGS }, + { "flags", "Flags to pass to libswscale", OFFSET(flags_str), AV_OPT_TYPE_STRING, { .str = "" }, .flags = FLAGS }, { "interl", "set interlacing", OFFSET(interlaced), AV_OPT_TYPE_BOOL, {.i64 = 0 }, -1, 1, FLAGS }, { "size", "set video size", OFFSET(size_str), AV_OPT_TYPE_STRING, {.str = NULL}, 0, FLAGS }, { "s", "set video size", OFFSET(size_str), AV_OPT_TYPE_STRING, {.str = NULL}, 0, FLAGS }, @@ -935,7 +960,6 @@ static const AVOption scale_options[] = { { "force_divisible_by", "enforce that the output resolution is divisible by a defined integer when force_original_aspect_ratio is used", OFFSET(force_divisible_by), AV_OPT_TYPE_INT, { .i64 = 1}, 1, 256, FLAGS }, { "param0", "Scaler param 0", OFFSET(param[0]), AV_OPT_TYPE_DOUBLE, { .dbl = SWS_PARAM_DEFAULT }, INT_MIN, INT_MAX, FLAGS }, { "param1", "Scaler param 1", OFFSET(param[1]), AV_OPT_TYPE_DOUBLE, { .dbl = SWS_PARAM_DEFAULT }, INT_MIN, INT_MAX, FLAGS }, - { "nb_slices", "set the number of slices (debug purpose only)", OFFSET(nb_slices), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS }, { "eval", "specify when to evaluate expressions", OFFSET(eval_mode), AV_OPT_TYPE_INT, {.i64 = EVAL_MODE_INIT}, 0, EVAL_MODE_NB-1, FLAGS, "eval" }, { "init", "eval expressions once during initialization", 0, AV_OPT_TYPE_CONST, {.i64=EVAL_MODE_INIT}, .flags = FLAGS, .unit = "eval" }, { "frame", "eval expressions during initialization and per-frame", 0, AV_OPT_TYPE_CONST, {.i64=EVAL_MODE_FRAME}, .flags = FLAGS, .unit = "eval" }, @@ -957,7 +981,6 @@ static const AVFilterPad avfilter_vf_scale_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad avfilter_vf_scale_outputs[] = { @@ -966,7 +989,6 @@ static const AVFilterPad avfilter_vf_scale_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_props, }, - { NULL } }; const AVFilter ff_vf_scale = { @@ -977,8 +999,8 @@ const AVFilter ff_vf_scale = { .query_formats = query_formats, .priv_size = sizeof(ScaleContext), .priv_class = &scale_class, - .inputs = avfilter_vf_scale_inputs, - .outputs = avfilter_vf_scale_outputs, + FILTER_INPUTS(avfilter_vf_scale_inputs), + FILTER_OUTPUTS(avfilter_vf_scale_outputs), .process_command = process_command, }; @@ -1002,7 +1024,6 @@ static const AVFilterPad avfilter_vf_scale2ref_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame_ref, }, - { NULL } }; static const AVFilterPad avfilter_vf_scale2ref_outputs[] = { @@ -1018,7 +1039,6 @@ static const AVFilterPad avfilter_vf_scale2ref_outputs[] = { .config_props = config_props_ref, .request_frame= request_frame_ref, }, - { NULL } }; const AVFilter ff_vf_scale2ref = { @@ -1029,7 +1049,7 @@ const AVFilter ff_vf_scale2ref = { .query_formats = query_formats, .priv_size = sizeof(ScaleContext), .priv_class = &scale2ref_class, - .inputs = avfilter_vf_scale2ref_inputs, - .outputs = avfilter_vf_scale2ref_outputs, + FILTER_INPUTS(avfilter_vf_scale2ref_inputs), + FILTER_OUTPUTS(avfilter_vf_scale2ref_outputs), .process_command = process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_scale_cuda.c b/chromium/third_party/ffmpeg/libavfilter/vf_scale_cuda.c index f3ea01634b9..fa7b799e0ea 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_scale_cuda.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_scale_cuda.c @@ -150,11 +150,8 @@ static int cudascale_query_formats(AVFilterContext *ctx) static const enum AVPixelFormat pixel_formats[] = { AV_PIX_FMT_CUDA, AV_PIX_FMT_NONE, }; - AVFilterFormats *pix_fmts = ff_make_format_list(pixel_formats); - if (!pix_fmts) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, pix_fmts); + return ff_set_common_formats_from_list(ctx, pixel_formats); } static av_cold int init_hwframe_ctx(CUDAScaleContext *s, AVBufferRef *device_ctx, int width, int height) @@ -626,9 +623,8 @@ static const AVFilterPad cudascale_inputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, .filter_frame = cudascale_filter_frame, - .get_video_buffer = cudascale_get_video_buffer, + .get_buffer.video = cudascale_get_video_buffer, }, - { NULL } }; static const AVFilterPad cudascale_outputs[] = { @@ -637,7 +633,6 @@ static const AVFilterPad cudascale_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = cudascale_config_props, }, - { NULL } }; const AVFilter ff_vf_scale_cuda = { @@ -651,8 +646,8 @@ const AVFilter ff_vf_scale_cuda = { .priv_size = sizeof(CUDAScaleContext), .priv_class = &cudascale_class, - .inputs = cudascale_inputs, - .outputs = cudascale_outputs, + FILTER_INPUTS(cudascale_inputs), + FILTER_OUTPUTS(cudascale_outputs), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_scale_npp.c b/chromium/third_party/ffmpeg/libavfilter/vf_scale_npp.c index 8d2ad3aab70..3e25c2c95ff 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_scale_npp.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_scale_npp.c @@ -148,9 +148,7 @@ static int nppscale_query_formats(AVFilterContext *ctx) static const enum AVPixelFormat pixel_formats[] = { AV_PIX_FMT_CUDA, AV_PIX_FMT_NONE, }; - AVFilterFormats *pix_fmts = ff_make_format_list(pixel_formats); - - return ff_set_common_formats(ctx, pix_fmts); + return ff_set_common_formats_from_list(ctx, pixel_formats); } static int init_stage(NPPScaleStageContext *stage, AVBufferRef *device_ctx) @@ -579,7 +577,6 @@ static const AVFilterPad nppscale_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = nppscale_filter_frame, }, - { NULL } }; static const AVFilterPad nppscale_outputs[] = { @@ -588,7 +585,6 @@ static const AVFilterPad nppscale_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = nppscale_config_props, }, - { NULL } }; const AVFilter ff_vf_scale_npp = { @@ -603,8 +599,8 @@ const AVFilter ff_vf_scale_npp = { .priv_size = sizeof(NPPScaleContext), .priv_class = &nppscale_class, - .inputs = nppscale_inputs, - .outputs = nppscale_outputs, + FILTER_INPUTS(nppscale_inputs), + FILTER_OUTPUTS(nppscale_outputs), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_scale_qsv.c b/chromium/third_party/ffmpeg/libavfilter/vf_scale_qsv.c index 189223a58a3..2ab04457a91 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_scale_qsv.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_scale_qsv.c @@ -70,6 +70,7 @@ enum var_name { }; #define QSV_HAVE_SCALING_CONFIG QSV_VERSION_ATLEAST(1, 19) +#define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl)) typedef struct QSVScaleContext { const AVClass *class; @@ -160,13 +161,8 @@ static int qsvscale_query_formats(AVFilterContext *ctx) static const enum AVPixelFormat pixel_formats[] = { AV_PIX_FMT_QSV, AV_PIX_FMT_NONE, }; - AVFilterFormats *pix_fmts = ff_make_format_list(pixel_formats); - int ret; - - if ((ret = ff_set_common_formats(ctx, pix_fmts)) < 0) - return ret; - return 0; + return ff_set_common_formats_from_list(ctx, pixel_formats); } static int init_out_pool(AVFilterContext *ctx, @@ -206,7 +202,7 @@ static int init_out_pool(AVFilterContext *ctx, out_frames_ctx->sw_format = out_format; out_frames_ctx->initial_pool_size = 4; - out_frames_hwctx->frame_type = in_frames_hwctx->frame_type; + out_frames_hwctx->frame_type = in_frames_hwctx->frame_type | MFX_MEMTYPE_FROM_VPPOUT; ret = ff_filter_init_hw_frames(ctx, outlink, 32); if (ret < 0) @@ -264,16 +260,16 @@ static mfxStatus frame_unlock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr) static mfxStatus frame_get_hdl(mfxHDL pthis, mfxMemId mid, mfxHDL *hdl) { - *hdl = mid; + mfxHDLPair *pair_dst = (mfxHDLPair*)hdl; + mfxHDLPair *pair_src = (mfxHDLPair*)mid; + + pair_dst->first = pair_src->first; + + if (pair_src->second != (mfxMemId)MFX_INFINITE) + pair_dst->second = pair_src->second; return MFX_ERR_NONE; } -static const mfxHandleType handle_types[] = { - MFX_HANDLE_VA_DISPLAY, - MFX_HANDLE_D3D9_DEVICE_MANAGER, - MFX_HANDLE_D3D11_DEVICE, -}; - static int init_out_session(AVFilterContext *ctx) { @@ -305,14 +301,18 @@ static int init_out_session(AVFilterContext *ctx) return AVERROR_UNKNOWN; } - for (i = 0; i < FF_ARRAY_ELEMS(handle_types); i++) { - err = MFXVideoCORE_GetHandle(device_hwctx->session, handle_types[i], &handle); - if (err == MFX_ERR_NONE) { - handle_type = handle_types[i]; - break; - } + if (MFX_IMPL_VIA_VAAPI == MFX_IMPL_VIA_MASK(impl)) { + handle_type = MFX_HANDLE_VA_DISPLAY; + } else if (MFX_IMPL_VIA_D3D11 == MFX_IMPL_VIA_MASK(impl)) { + handle_type = MFX_HANDLE_D3D11_DEVICE; + } else if (MFX_IMPL_VIA_D3D9 == MFX_IMPL_VIA_MASK(impl)) { + handle_type = MFX_HANDLE_D3D9_DEVICE_MANAGER; + } else { + av_log(ctx, AV_LOG_ERROR, "Error unsupported handle type\n"); + return AVERROR_UNKNOWN; } + err = MFXVideoCORE_GetHandle(device_hwctx->session, handle_type, &handle); if (err < 0) return ff_qsvvpp_print_error(ctx, err, "Error getting the session handle"); else if (err > 0) { @@ -655,7 +655,6 @@ static const AVFilterPad qsvscale_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = qsvscale_filter_frame, }, - { NULL } }; static const AVFilterPad qsvscale_outputs[] = { @@ -664,7 +663,6 @@ static const AVFilterPad qsvscale_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = qsvscale_config_props, }, - { NULL } }; const AVFilter ff_vf_scale_qsv = { @@ -678,8 +676,8 @@ const AVFilter ff_vf_scale_qsv = { .priv_size = sizeof(QSVScaleContext), .priv_class = &qsvscale_class, - .inputs = qsvscale_inputs, - .outputs = qsvscale_outputs, + FILTER_INPUTS(qsvscale_inputs), + FILTER_OUTPUTS(qsvscale_outputs), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_scale_vaapi.c b/chromium/third_party/ffmpeg/libavfilter/vf_scale_vaapi.c index 41ff93156d8..554b7bac4f2 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_scale_vaapi.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_scale_vaapi.c @@ -269,7 +269,6 @@ static const AVFilterPad scale_vaapi_inputs[] = { .filter_frame = &scale_vaapi_filter_frame, .config_props = &ff_vaapi_vpp_config_input, }, - { NULL } }; static const AVFilterPad scale_vaapi_outputs[] = { @@ -278,7 +277,6 @@ static const AVFilterPad scale_vaapi_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = &scale_vaapi_config_output, }, - { NULL } }; const AVFilter ff_vf_scale_vaapi = { @@ -288,8 +286,8 @@ const AVFilter ff_vf_scale_vaapi = { .init = &scale_vaapi_init, .uninit = &ff_vaapi_vpp_ctx_uninit, .query_formats = &ff_vaapi_vpp_query_formats, - .inputs = scale_vaapi_inputs, - .outputs = scale_vaapi_outputs, + FILTER_INPUTS(scale_vaapi_inputs), + FILTER_OUTPUTS(scale_vaapi_outputs), .priv_class = &scale_vaapi_class, .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_scale_vulkan.c b/chromium/third_party/ffmpeg/libavfilter/vf_scale_vulkan.c index 95503480ef5..4eb4fe5664b 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_scale_vulkan.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_scale_vulkan.c @@ -512,7 +512,6 @@ static const AVFilterPad scale_vulkan_inputs[] = { .filter_frame = &scale_vulkan_filter_frame, .config_props = &ff_vk_filter_config_input, }, - { NULL } }; static const AVFilterPad scale_vulkan_outputs[] = { @@ -521,7 +520,6 @@ static const AVFilterPad scale_vulkan_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = &scale_vulkan_config_output, }, - { NULL } }; const AVFilter ff_vf_scale_vulkan = { @@ -531,8 +529,8 @@ const AVFilter ff_vf_scale_vulkan = { .init = &ff_vk_filter_init, .uninit = &scale_vulkan_uninit, .query_formats = &ff_vk_filter_query_formats, - .inputs = scale_vulkan_inputs, - .outputs = scale_vulkan_outputs, + FILTER_INPUTS(scale_vulkan_inputs), + FILTER_OUTPUTS(scale_vulkan_outputs), .priv_class = &scale_vulkan_class, .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_scdet.c b/chromium/third_party/ffmpeg/libavfilter/vf_scdet.c index ff8bf21a9c1..b8017a00e56 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_scdet.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_scdet.c @@ -74,10 +74,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) @@ -199,7 +196,6 @@ static const AVFilterPad scdet_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_input, }, - { NULL } }; static const AVFilterPad scdet_outputs[] = { @@ -207,7 +203,6 @@ static const AVFilterPad scdet_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_scdet = { @@ -217,7 +212,7 @@ const AVFilter ff_vf_scdet = { .priv_class = &scdet_class, .uninit = uninit, .query_formats = query_formats, - .inputs = scdet_inputs, - .outputs = scdet_outputs, + FILTER_INPUTS(scdet_inputs), + FILTER_OUTPUTS(scdet_outputs), .activate = activate, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_scroll.c b/chromium/third_party/ffmpeg/libavfilter/vf_scroll.c index 4b7b45f52ab..5e9cf760951 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_scroll.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_scroll.c @@ -66,10 +66,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } typedef struct ThreadData { @@ -131,8 +128,8 @@ static void scroll(AVFilterContext *ctx, AVFrame *in, AVFrame *out) s->pos_h[0] = s->pos_h[3] = h_pos * s->bytes; td.in = in; td.out = out; - ctx->internal->execute(ctx, scroll_slice, &td, NULL, - FFMIN(out->height, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, scroll_slice, &td, NULL, + FFMIN(out->height, ff_filter_get_nb_threads(ctx))); s->h_pos += s->h_speed * in->width; s->v_pos += s->v_speed * in->height; @@ -200,7 +197,6 @@ static const AVFilterPad scroll_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad scroll_outputs[] = { @@ -208,7 +204,6 @@ static const AVFilterPad scroll_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_scroll = { @@ -217,8 +212,8 @@ const AVFilter ff_vf_scroll = { .priv_size = sizeof(ScrollContext), .priv_class = &scroll_class, .query_formats = query_formats, - .inputs = scroll_inputs, - .outputs = scroll_outputs, + FILTER_INPUTS(scroll_inputs), + FILTER_OUTPUTS(scroll_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = ff_filter_process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_selectivecolor.c b/chromium/third_party/ffmpeg/libavfilter/vf_selectivecolor.c index 4733cc48f21..ebbba9157f2 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_selectivecolor.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_selectivecolor.c @@ -297,10 +297,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_RGBA64, AV_PIX_FMT_BGRA64, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static inline int comp_adjust(int scale, float value, float adjust, float k, int correction_method) @@ -444,8 +441,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.in = in; td.out = out; - ctx->internal->execute(ctx, funcs[s->is_16bit][direct][s->correction_method], - &td, NULL, FFMIN(inlink->h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, funcs[s->is_16bit][direct][s->correction_method], + &td, NULL, FFMIN(inlink->h, ff_filter_get_nb_threads(ctx))); if (!direct) av_frame_free(&in); @@ -459,7 +456,6 @@ static const AVFilterPad selectivecolor_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad selectivecolor_outputs[] = { @@ -467,7 +463,6 @@ static const AVFilterPad selectivecolor_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_selectivecolor = { @@ -475,8 +470,8 @@ const AVFilter ff_vf_selectivecolor = { .description = NULL_IF_CONFIG_SMALL("Apply CMYK adjustments to specific color ranges."), .priv_size = sizeof(SelectiveColorContext), .query_formats = query_formats, - .inputs = selectivecolor_inputs, - .outputs = selectivecolor_outputs, + FILTER_INPUTS(selectivecolor_inputs), + FILTER_OUTPUTS(selectivecolor_outputs), .priv_class = &selectivecolor_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_separatefields.c b/chromium/third_party/ffmpeg/libavfilter/vf_separatefields.c index c2c7352ad19..7db64c54798 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_separatefields.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_separatefields.c @@ -161,7 +161,6 @@ static const AVFilterPad separatefields_inputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; static const AVFilterPad separatefields_outputs[] = { @@ -170,7 +169,6 @@ static const AVFilterPad separatefields_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_props_output, }, - { NULL } }; const AVFilter ff_vf_separatefields = { @@ -179,6 +177,6 @@ const AVFilter ff_vf_separatefields = { .priv_size = sizeof(SeparateFieldsContext), .activate = activate, .uninit = uninit, - .inputs = separatefields_inputs, - .outputs = separatefields_outputs, + FILTER_INPUTS(separatefields_inputs), + FILTER_OUTPUTS(separatefields_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_setparams.c b/chromium/third_party/ffmpeg/libavfilter/vf_setparams.c index 0cb3af33ed4..0a79599bab6 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_setparams.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_setparams.c @@ -151,7 +151,6 @@ static const AVFilterPad inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -159,7 +158,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_setparams = { @@ -167,8 +165,8 @@ const AVFilter ff_vf_setparams = { .description = NULL_IF_CONFIG_SMALL("Force field, or color property for the output video frame."), .priv_size = sizeof(SetParamsContext), .priv_class = &setparams_class, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), }; #if CONFIG_SETRANGE_FILTER @@ -206,8 +204,8 @@ const AVFilter ff_vf_setrange = { .priv_size = sizeof(SetParamsContext), .init = init_setrange, .priv_class = &setrange_class, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), }; #endif /* CONFIG_SETRANGE_FILTER */ @@ -240,7 +238,7 @@ const AVFilter ff_vf_setfield = { .priv_size = sizeof(SetParamsContext), .init = init_setfield, .priv_class = &setfield_class, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), }; #endif /* CONFIG_SETFIELD_FILTER */ diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_shear.c b/chromium/third_party/ffmpeg/libavfilter/vf_shear.c index 6b9db161d95..e58084d3cdd 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_shear.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_shear.c @@ -114,10 +114,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } #define NN(type, name) \ @@ -246,7 +243,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) 0, 0, outlink->w, outlink->h); td.in = in, td.out = out; - ctx->internal->execute(ctx, s->filter_slice[s->interp], &td, NULL, FFMIN(s->planeheight[1], ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->filter_slice[s->interp], &td, NULL, + FFMIN(s->planeheight[1], ff_filter_get_nb_threads(ctx))); av_frame_free(&in); return ff_filter_frame(outlink, out); @@ -304,7 +302,6 @@ static const AVFilterPad inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -313,7 +310,6 @@ static const AVFilterPad outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_shear = { @@ -322,8 +318,8 @@ const AVFilter ff_vf_shear = { .priv_size = sizeof(ShearContext), .init = init, .query_formats = query_formats, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .priv_class = &shear_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = process_command, diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_showinfo.c b/chromium/third_party/ffmpeg/libavfilter/vf_showinfo.c index 5e1c4dc2e36..87c2bed73d3 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_showinfo.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_showinfo.c @@ -29,6 +29,7 @@ #include "libavutil/display.h" #include "libavutil/imgutils.h" #include "libavutil/internal.h" +#include "libavutil/film_grain_params.h" #include "libavutil/hdr_dynamic_metadata.h" #include "libavutil/opt.h" #include "libavutil/pixdesc.h" @@ -361,6 +362,73 @@ static void dump_sei_unregistered_metadata(AVFilterContext *ctx, const AVFrameSi av_log(ctx, AV_LOG_INFO, "\n"); } +static void dump_sei_film_grain_params_metadata(AVFilterContext *ctx, const AVFrameSideData *sd) +{ + const AVFilmGrainParams *fgp = (const AVFilmGrainParams *)sd->data; + const char *const film_grain_type_names[] = { + [AV_FILM_GRAIN_PARAMS_NONE] = "none", + [AV_FILM_GRAIN_PARAMS_AV1] = "av1", + [AV_FILM_GRAIN_PARAMS_H274] = "h274", + }; + + if (fgp->type >= FF_ARRAY_ELEMS(film_grain_type_names)) { + av_log(ctx, AV_LOG_ERROR, "invalid data\n"); + return; + } + + av_log(ctx, AV_LOG_INFO, "film grain parameters: type %s; ", film_grain_type_names[fgp->type]); + av_log(ctx, AV_LOG_INFO, "seed=%"PRIu64"; ", fgp->seed); + + switch (fgp->type) { + case AV_FILM_GRAIN_PARAMS_NONE: + case AV_FILM_GRAIN_PARAMS_AV1: + return; + case AV_FILM_GRAIN_PARAMS_H274: { + const AVFilmGrainH274Params *h274 = &fgp->codec.h274; + const char *color_range_str = av_color_range_name(h274->color_range); + const char *color_primaries_str = av_color_primaries_name(h274->color_primaries); + const char *color_trc_str = av_color_transfer_name(h274->color_trc); + const char *colorspace_str = av_color_space_name(h274->color_space); + + av_log(ctx, AV_LOG_INFO, "model_id=%d; ", h274->model_id); + av_log(ctx, AV_LOG_INFO, "bit_depth_luma=%d; ", h274->bit_depth_luma); + av_log(ctx, AV_LOG_INFO, "bit_depth_chroma=%d; ", h274->bit_depth_chroma); + av_log(ctx, AV_LOG_INFO, "color_range=%s; ", color_range_str ? color_range_str : "unknown"); + av_log(ctx, AV_LOG_INFO, "color_primaries=%s; ", color_primaries_str ? color_primaries_str : "unknown"); + av_log(ctx, AV_LOG_INFO, "color_trc=%s; ", color_trc_str ? color_trc_str : "unknown"); + av_log(ctx, AV_LOG_INFO, "color_space=%s; ", colorspace_str ? colorspace_str : "unknown"); + av_log(ctx, AV_LOG_INFO, "blending_mode_id=%d; ", h274->blending_mode_id); + av_log(ctx, AV_LOG_INFO, "log2_scale_factor=%d; ", h274->log2_scale_factor); + + for (int c = 0; c < 3; c++) + if (h274->component_model_present[c] && (h274->num_model_values[c] > 6 || + h274->num_intensity_intervals[c] < 1 || + h274->num_intensity_intervals[c] > 256)) { + av_log(ctx, AV_LOG_ERROR, "invalid data\n"); + return; + } + + for (int c = 0; c < 3; c++) { + if (!h274->component_model_present[c]) + continue; + + av_log(ctx, AV_LOG_INFO, "num_intensity_intervals[%d]=%u; ", c, h274->num_intensity_intervals[c]); + av_log(ctx, AV_LOG_INFO, "num_model_values[%d]=%u; ", c, h274->num_model_values[c]); + for (int i = 0; i < h274->num_intensity_intervals[c]; i++) { + av_log(ctx, AV_LOG_INFO, "intensity_interval_lower_bound[%d][%d]=%u; ", + c, i, h274->intensity_interval_lower_bound[c][i]); + av_log(ctx, AV_LOG_INFO, "intensity_interval_upper_bound[%d][%d]=%u; ", + c, i, h274->intensity_interval_upper_bound[c][i]); + for (int j = 0; j < h274->num_model_values[c]; j++) + av_log(ctx, AV_LOG_INFO, "comp_model_value[%d][%d][%d]=%d; ", + c, i, j, h274->comp_model_value[c][i][j]); + } + } + break; + } + } +} + static void dump_color_property(AVFilterContext *ctx, AVFrame *frame) { const char *color_range_str = av_color_range_name(frame->color_range); @@ -546,6 +614,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) case AV_FRAME_DATA_SEI_UNREGISTERED: dump_sei_unregistered_metadata(ctx, sd); break; + case AV_FRAME_DATA_FILM_GRAIN_PARAMS: + dump_sei_film_grain_params_metadata(ctx, sd); + break; default: av_log(ctx, AV_LOG_WARNING, "unknown side data type %d " "(%"SIZE_SPECIFIER" bytes)\n", sd->type, sd->size); @@ -590,7 +661,6 @@ static const AVFilterPad avfilter_vf_showinfo_inputs[] = { .filter_frame = filter_frame, .config_props = config_props_in, }, - { NULL } }; static const AVFilterPad avfilter_vf_showinfo_outputs[] = { @@ -599,14 +669,13 @@ static const AVFilterPad avfilter_vf_showinfo_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_props_out, }, - { NULL } }; const AVFilter ff_vf_showinfo = { .name = "showinfo", .description = NULL_IF_CONFIG_SMALL("Show textual information for each video frame."), - .inputs = avfilter_vf_showinfo_inputs, - .outputs = avfilter_vf_showinfo_outputs, + FILTER_INPUTS(avfilter_vf_showinfo_inputs), + FILTER_OUTPUTS(avfilter_vf_showinfo_outputs), .priv_size = sizeof(ShowInfoContext), .priv_class = &showinfo_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_showpalette.c b/chromium/third_party/ffmpeg/libavfilter/vf_showpalette.c index 2455af687c7..569f5040d0c 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_showpalette.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_showpalette.c @@ -100,7 +100,6 @@ static const AVFilterPad showpalette_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad showpalette_outputs[] = { @@ -109,7 +108,6 @@ static const AVFilterPad showpalette_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_showpalette = { @@ -117,7 +115,7 @@ const AVFilter ff_vf_showpalette = { .description = NULL_IF_CONFIG_SMALL("Display frame palette."), .priv_size = sizeof(ShowPaletteContext), .query_formats = query_formats, - .inputs = showpalette_inputs, - .outputs = showpalette_outputs, + FILTER_INPUTS(showpalette_inputs), + FILTER_OUTPUTS(showpalette_outputs), .priv_class = &showpalette_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_shuffleframes.c b/chromium/third_party/ffmpeg/libavfilter/vf_shuffleframes.c index cdc70f552e8..14b90e64461 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_shuffleframes.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_shuffleframes.c @@ -144,7 +144,6 @@ static const AVFilterPad shuffleframes_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL }, }; static const AVFilterPad shuffleframes_outputs[] = { @@ -152,7 +151,6 @@ static const AVFilterPad shuffleframes_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL }, }; const AVFilter ff_vf_shuffleframes = { @@ -162,7 +160,7 @@ const AVFilter ff_vf_shuffleframes = { .priv_class = &shuffleframes_class, .init = init, .uninit = uninit, - .inputs = shuffleframes_inputs, - .outputs = shuffleframes_outputs, + FILTER_INPUTS(shuffleframes_inputs), + FILTER_OUTPUTS(shuffleframes_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_shufflepixels.c b/chromium/third_party/ffmpeg/libavfilter/vf_shufflepixels.c index b5e757c9292..aa8c726971f 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_shufflepixels.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_shufflepixels.c @@ -68,10 +68,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUV444P12, AV_PIX_FMT_YUV444P14, AV_PIX_FMT_YUV444P16, AV_PIX_FMT_YUVA444P16, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static void make_horizontal_map(AVFilterContext *ctx) @@ -390,7 +387,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.out = out; td.in = in; - ctx->internal->execute(ctx, s->shuffle_pixels, &td, NULL, FFMIN(s->planeheight[1], ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->shuffle_pixels, &td, NULL, + FFMIN(s->planeheight[1], ff_filter_get_nb_threads(ctx))); av_frame_free(&in); return ff_filter_frame(ctx->outputs[0], out); @@ -436,7 +434,6 @@ static const AVFilterPad shufflepixels_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL }, }; static const AVFilterPad shufflepixels_outputs[] = { @@ -445,7 +442,6 @@ static const AVFilterPad shufflepixels_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL }, }; const AVFilter ff_vf_shufflepixels = { @@ -455,7 +451,7 @@ const AVFilter ff_vf_shufflepixels = { .priv_class = &shufflepixels_class, .query_formats = query_formats, .uninit = uninit, - .inputs = shufflepixels_inputs, - .outputs = shufflepixels_outputs, + FILTER_INPUTS(shufflepixels_inputs), + FILTER_OUTPUTS(shufflepixels_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_shuffleplanes.c b/chromium/third_party/ffmpeg/libavfilter/vf_shuffleplanes.c index d1e1d11074c..3ca4aa976d4 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_shuffleplanes.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_shuffleplanes.c @@ -151,7 +151,6 @@ static const AVFilterPad shuffleplanes_inputs[] = { .config_props = shuffleplanes_config_input, .filter_frame = shuffleplanes_filter_frame, }, - { NULL }, }; static const AVFilterPad shuffleplanes_outputs[] = { @@ -159,7 +158,6 @@ static const AVFilterPad shuffleplanes_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL }, }; const AVFilter ff_vf_shuffleplanes = { @@ -168,7 +166,7 @@ const AVFilter ff_vf_shuffleplanes = { .priv_size = sizeof(ShufflePlanesContext), .priv_class = &shuffleplanes_class, .query_formats = query_formats, - .inputs = shuffleplanes_inputs, - .outputs = shuffleplanes_outputs, + FILTER_INPUTS(shuffleplanes_inputs), + FILTER_OUTPUTS(shuffleplanes_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_signalstats.c b/chromium/third_party/ffmpeg/libavfilter/vf_signalstats.c index 6f0ff53029c..1bfa7f158d3 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_signalstats.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_signalstats.c @@ -134,10 +134,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static AVFrame *alloc_frame(enum AVPixelFormat pixfmt, int w, int h) @@ -488,8 +485,8 @@ static int compute_sat_hue_metrics8(AVFilterContext *ctx, void *arg, int jobnr, for (i = 0; i < s->chromaw; i++) { const int yuvu = p_u[i]; const int yuvv = p_v[i]; - p_sat[i] = hypot(yuvu - 128, yuvv - 128); // int or round? - ((int16_t*)p_hue)[i] = fmod(floor((180 / M_PI) * atan2f(yuvu-128, yuvv-128) + 180), 360.); + p_sat[i] = hypotf(yuvu - 128, yuvv - 128); // int or round? + ((int16_t*)p_hue)[i] = fmodf(floorf((180.f / M_PI) * atan2f(yuvu-128, yuvv-128) + 180.f), 360.f); } p_u += lsz_u; p_v += lsz_v; @@ -527,8 +524,8 @@ static int compute_sat_hue_metrics16(AVFilterContext *ctx, void *arg, int jobnr, for (i = 0; i < s->chromaw; i++) { const int yuvu = p_u[i]; const int yuvv = p_v[i]; - p_sat[i] = hypot(yuvu - mid, yuvv - mid); // int or round? - ((int16_t*)p_hue)[i] = fmod(floor((180 / M_PI) * atan2f(yuvu-mid, yuvv-mid) + 180), 360.); + p_sat[i] = hypotf(yuvu - mid, yuvv - mid); // int or round? + ((int16_t*)p_hue)[i] = fmodf(floorf((180.f / M_PI) * atan2f(yuvu-mid, yuvv-mid) + 180.f), 360.f); } p_u += lsz_u; p_v += lsz_v; @@ -599,8 +596,8 @@ static int filter_frame8(AVFilterLink *link, AVFrame *in) av_frame_make_writable(out); } - ctx->internal->execute(ctx, compute_sat_hue_metrics8, &td_huesat, - NULL, FFMIN(s->chromah, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, compute_sat_hue_metrics8, &td_huesat, + NULL, FFMIN(s->chromah, ff_filter_get_nb_threads(ctx))); // Calculate luma histogram and difference with previous frame or field. memset(s->histy, 0, s->maxsize * sizeof(*s->histy)); @@ -648,8 +645,8 @@ static int filter_frame8(AVFilterLink *link, AVFrame *in) .out = out != in && s->outfilter == fil ? out : NULL, }; memset(s->jobs_rets, 0, s->nb_jobs * sizeof(*s->jobs_rets)); - ctx->internal->execute(ctx, filters_def[fil].process8, - &td, s->jobs_rets, s->nb_jobs); + ff_filter_execute(ctx, filters_def[fil].process8, + &td, s->jobs_rets, s->nb_jobs); for (i = 0; i < s->nb_jobs; i++) filtot[fil] += s->jobs_rets[i]; } @@ -821,8 +818,8 @@ static int filter_frame16(AVFilterLink *link, AVFrame *in) av_frame_make_writable(out); } - ctx->internal->execute(ctx, compute_sat_hue_metrics16, &td_huesat, - NULL, FFMIN(s->chromah, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, compute_sat_hue_metrics16, &td_huesat, + NULL, FFMIN(s->chromah, ff_filter_get_nb_threads(ctx))); // Calculate luma histogram and difference with previous frame or field. memset(s->histy, 0, s->maxsize * sizeof(*s->histy)); @@ -870,8 +867,8 @@ static int filter_frame16(AVFilterLink *link, AVFrame *in) .out = out != in && s->outfilter == fil ? out : NULL, }; memset(s->jobs_rets, 0, s->nb_jobs * sizeof(*s->jobs_rets)); - ctx->internal->execute(ctx, filters_def[fil].process16, - &td, s->jobs_rets, s->nb_jobs); + ff_filter_execute(ctx, filters_def[fil].process16, + &td, s->jobs_rets, s->nb_jobs); for (i = 0; i < s->nb_jobs; i++) filtot[fil] += s->jobs_rets[i]; } @@ -1000,7 +997,6 @@ static const AVFilterPad signalstats_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad signalstats_outputs[] = { @@ -1009,7 +1005,6 @@ static const AVFilterPad signalstats_outputs[] = { .config_props = config_output, .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_signalstats = { @@ -1019,8 +1014,8 @@ const AVFilter ff_vf_signalstats = { .uninit = uninit, .query_formats = query_formats, .priv_size = sizeof(SignalstatsContext), - .inputs = signalstats_inputs, - .outputs = signalstats_outputs, + FILTER_INPUTS(signalstats_inputs), + FILTER_OUTPUTS(signalstats_outputs), .priv_class = &signalstats_class, .flags = AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_signature.c b/chromium/third_party/ffmpeg/libavfilter/vf_signature.c index a345ad6ebdf..784869a7ae7 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_signature.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_signature.c @@ -84,7 +84,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) @@ -664,10 +664,8 @@ static av_cold int init(AVFilterContext *ctx) if (!pad.name) return AVERROR(ENOMEM); - if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0) { - av_freep(&pad.name); + if ((ret = ff_append_inpad_free_name(ctx, &pad)) < 0) return ret; - } sc = &(sic->streamcontexts[i]); @@ -730,8 +728,6 @@ static av_cold void uninit(AVFilterContext *ctx) } av_freep(&sic->streamcontexts); } - for (unsigned i = 0; i < ctx->nb_inputs; i++) - av_freep(&ctx->input_pads[i].name); } static int config_output(AVFilterLink *outlink) @@ -755,7 +751,6 @@ static const AVFilterPad signature_outputs[] = { .request_frame = request_frame, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_signature = { @@ -766,7 +761,7 @@ const AVFilter ff_vf_signature = { .init = init, .uninit = uninit, .query_formats = query_formats, - .outputs = signature_outputs, + FILTER_OUTPUTS(signature_outputs), .inputs = NULL, .flags = AVFILTER_FLAG_DYNAMIC_INPUTS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_smartblur.c b/chromium/third_party/ffmpeg/libavfilter/vf_smartblur.c index 36ed72a12c3..24aa533fd78 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_smartblur.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_smartblur.c @@ -124,10 +124,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int alloc_sws_context(FilterParam *f, int width, int height, unsigned int flags) @@ -280,7 +277,6 @@ static const AVFilterPad smartblur_inputs[] = { .filter_frame = filter_frame, .config_props = config_props, }, - { NULL } }; static const AVFilterPad smartblur_outputs[] = { @@ -288,7 +284,6 @@ static const AVFilterPad smartblur_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_smartblur = { @@ -298,8 +293,8 @@ const AVFilter ff_vf_smartblur = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = smartblur_inputs, - .outputs = smartblur_outputs, + FILTER_INPUTS(smartblur_inputs), + FILTER_OUTPUTS(smartblur_outputs), .priv_class = &smartblur_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_spp.c b/chromium/third_party/ffmpeg/libavfilter/vf_spp.c index cfa1cb77c47..b3a52fc99b7 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_spp.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_spp.c @@ -328,10 +328,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) @@ -498,7 +495,6 @@ static const AVFilterPad spp_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad spp_outputs[] = { @@ -506,7 +502,6 @@ static const AVFilterPad spp_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_spp = { @@ -516,8 +511,8 @@ const AVFilter ff_vf_spp = { .init_dict = init_dict, .uninit = uninit, .query_formats = query_formats, - .inputs = spp_inputs, - .outputs = spp_outputs, + FILTER_INPUTS(spp_inputs), + FILTER_OUTPUTS(spp_outputs), .process_command = process_command, .priv_class = &spp_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_sr.c b/chromium/third_party/ffmpeg/libavfilter/vf_sr.c index f930b38748f..f4fc84d251e 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_sr.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_sr.c @@ -71,15 +71,8 @@ static int query_formats(AVFilterContext *context) const enum AVPixelFormat pixel_formats[] = {AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV411P, AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE}; - AVFilterFormats *formats_list; - formats_list = ff_make_format_list(pixel_formats); - if (!formats_list){ - av_log(context, AV_LOG_ERROR, "could not create formats list\n"); - return AVERROR(ENOMEM); - } - - return ff_set_common_formats(context, formats_list); + return ff_set_common_formats_from_list(context, pixel_formats); } static int config_output(AVFilterLink *outlink) @@ -126,6 +119,7 @@ static int config_output(AVFilterLink *outlink) static int filter_frame(AVFilterLink *inlink, AVFrame *in) { + DNNAsyncStatusType async_state = 0; AVFilterContext *context = inlink->dst; SRContext *ctx = context->priv; AVFilterLink *outlink = context->outputs[0]; @@ -155,6 +149,13 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) return AVERROR(EIO); } + do { + async_state = ff_dnn_get_result(&ctx->dnnctx, &in, &out); + } while (async_state == DAST_NOT_READY); + + if (async_state != DAST_SUCCESS) + return AVERROR(EINVAL); + if (ctx->sws_uv_scale) { sws_scale(ctx->sws_uv_scale, (const uint8_t **)(in->data + 1), in->linesize + 1, 0, ctx->sws_uv_height, out->data + 1, out->linesize + 1); @@ -181,7 +182,6 @@ static const AVFilterPad sr_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad sr_outputs[] = { @@ -190,7 +190,6 @@ static const AVFilterPad sr_outputs[] = { .config_props = config_output, .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_sr = { @@ -200,7 +199,7 @@ const AVFilter ff_vf_sr = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = sr_inputs, - .outputs = sr_outputs, + FILTER_INPUTS(sr_inputs), + FILTER_OUTPUTS(sr_outputs), .priv_class = &sr_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_ssim.c b/chromium/third_party/ffmpeg/libavfilter/vf_ssim.c index c6e4fe286a5..41e35ac6ee5 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_ssim.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_ssim.c @@ -359,7 +359,8 @@ static int do_ssim(FFFrameSync *fs) td.planeheight[n] = s->planeheight[n]; } - ctx->internal->execute(ctx, s->ssim_plane, &td, NULL, FFMIN((s->planeheight[1] + 3) >> 2, s->nb_threads)); + ff_filter_execute(ctx, s->ssim_plane, &td, NULL, + FFMIN((s->planeheight[1] + 3) >> 2, s->nb_threads)); for (i = 0; i < s->nb_components; i++) { for (int j = 0; j < s->nb_threads; j++) @@ -434,10 +435,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input_ref(AVFilterLink *inlink) @@ -581,7 +579,6 @@ static const AVFilterPad ssim_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_input_ref, }, - { NULL } }; static const AVFilterPad ssim_outputs[] = { @@ -590,7 +587,6 @@ static const AVFilterPad ssim_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_ssim = { @@ -603,7 +599,7 @@ const AVFilter ff_vf_ssim = { .activate = activate, .priv_size = sizeof(SSIMContext), .priv_class = &ssim_class, - .inputs = ssim_inputs, - .outputs = ssim_outputs, + FILTER_INPUTS(ssim_inputs), + FILTER_OUTPUTS(ssim_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_stack.c b/chromium/third_party/ffmpeg/libavfilter/vf_stack.c index 3368e25c9c4..a87cffc491a 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_stack.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_stack.c @@ -123,10 +123,8 @@ static av_cold int init(AVFilterContext *ctx) if (!pad.name) return AVERROR(ENOMEM); - if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0) { - av_freep(&pad.name); + if ((ret = ff_append_inpad_free_name(ctx, &pad)) < 0) return ret; - } } return 0; @@ -179,7 +177,8 @@ static int process_frame(FFFrameSync *fs) ff_fill_rectangle(&s->draw, &s->color, out->data, out->linesize, 0, 0, outlink->w, outlink->h); - ctx->internal->execute(ctx, process_slice, out, NULL, FFMIN(s->nb_inputs, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, process_slice, out, NULL, + FFMIN(s->nb_inputs, ff_filter_get_nb_threads(ctx))); return ff_filter_frame(outlink, out); } @@ -371,14 +370,10 @@ static int config_output(AVFilterLink *outlink) static av_cold void uninit(AVFilterContext *ctx) { StackContext *s = ctx->priv; - int i; ff_framesync_uninit(&s->fs); av_freep(&s->frames); av_freep(&s->items); - - for (i = 0; i < ctx->nb_inputs; i++) - av_freep(&ctx->input_pads[i].name); } static int activate(AVFilterContext *ctx) @@ -401,7 +396,6 @@ static const AVFilterPad outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; #if CONFIG_HSTACK_FILTER @@ -415,7 +409,7 @@ const AVFilter ff_vf_hstack = { .priv_size = sizeof(StackContext), .priv_class = &hstack_class, .query_formats = query_formats, - .outputs = outputs, + FILTER_OUTPUTS(outputs), .init = init, .uninit = uninit, .activate = activate, @@ -435,7 +429,7 @@ const AVFilter ff_vf_vstack = { .priv_size = sizeof(StackContext), .priv_class = &vstack_class, .query_formats = query_formats, - .outputs = outputs, + FILTER_OUTPUTS(outputs), .init = init, .uninit = uninit, .activate = activate, @@ -462,7 +456,7 @@ const AVFilter ff_vf_xstack = { .priv_size = sizeof(StackContext), .priv_class = &xstack_class, .query_formats = query_formats, - .outputs = outputs, + FILTER_OUTPUTS(outputs), .init = init, .uninit = uninit, .activate = activate, diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_stereo3d.c b/chromium/third_party/ffmpeg/libavfilter/vf_stereo3d.c index ec7d410f766..10aade7bd9b 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_stereo3d.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_stereo3d.c @@ -283,7 +283,6 @@ static int query_formats(AVFilterContext *ctx) { Stereo3DContext *s = ctx->priv; const enum AVPixelFormat *pix_fmts; - AVFilterFormats *fmts_list; switch (s->out.format) { case ANAGLYPH_GM_COLOR: @@ -306,10 +305,7 @@ static int query_formats(AVFilterContext *ctx) pix_fmts = other_pix_fmts; } - fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static inline uint8_t ana_convert(const int *coeff, const uint8_t *left, const uint8_t *right) @@ -941,8 +937,8 @@ copy: ThreadData td; td.ileft = ileft; td.iright = iright; td.out = out; - ctx->internal->execute(ctx, filter_slice, &td, NULL, - FFMIN(s->out.height, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_slice, &td, NULL, + FFMIN(s->out.height, ff_filter_get_nb_threads(ctx))); } break; } @@ -1100,7 +1096,6 @@ static const AVFilterPad stereo3d_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad stereo3d_outputs[] = { @@ -1109,7 +1104,6 @@ static const AVFilterPad stereo3d_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_stereo3d = { @@ -1118,8 +1112,8 @@ const AVFilter ff_vf_stereo3d = { .priv_size = sizeof(Stereo3DContext), .uninit = uninit, .query_formats = query_formats, - .inputs = stereo3d_inputs, - .outputs = stereo3d_outputs, + FILTER_INPUTS(stereo3d_inputs), + FILTER_OUTPUTS(stereo3d_outputs), .priv_class = &stereo3d_class, .flags = AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_subtitles.c b/chromium/third_party/ffmpeg/libavfilter/vf_subtitles.c index ab32e1b7f32..d0bafcd3cff 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_subtitles.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_subtitles.c @@ -198,11 +198,10 @@ static const AVFilterPad ass_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = filter_frame, .config_props = config_input, - .needs_writable = 1, }, - { NULL } }; static const AVFilterPad ass_outputs[] = { @@ -210,7 +209,6 @@ static const AVFilterPad ass_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; #if CONFIG_ASS_FILTER @@ -254,8 +252,8 @@ const AVFilter ff_vf_ass = { .init = init_ass, .uninit = uninit, .query_formats = query_formats, - .inputs = ass_inputs, - .outputs = ass_outputs, + FILTER_INPUTS(ass_inputs), + FILTER_OUTPUTS(ass_outputs), .priv_class = &ass_class, }; #endif @@ -488,8 +486,8 @@ const AVFilter ff_vf_subtitles = { .init = init_subtitles, .uninit = uninit, .query_formats = query_formats, - .inputs = ass_inputs, - .outputs = ass_outputs, + FILTER_INPUTS(ass_inputs), + FILTER_OUTPUTS(ass_outputs), .priv_class = &subtitles_class, }; #endif diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_super2xsai.c b/chromium/third_party/ffmpeg/libavfilter/vf_super2xsai.c index 00e88eafe34..3e99d53ceee 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_super2xsai.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_super2xsai.c @@ -255,10 +255,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) @@ -334,7 +331,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) out->height = outlink->h; td.in = in, td.out = out; - ctx->internal->execute(ctx, super2xsai, &td, NULL, FFMIN(in->height, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, super2xsai, &td, NULL, + FFMIN(in->height, ff_filter_get_nb_threads(ctx))); av_frame_free(&in); return ff_filter_frame(outlink, out); @@ -347,7 +345,6 @@ static const AVFilterPad super2xsai_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad super2xsai_outputs[] = { @@ -356,7 +353,6 @@ static const AVFilterPad super2xsai_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_super2xsai = { @@ -364,7 +360,7 @@ const AVFilter ff_vf_super2xsai = { .description = NULL_IF_CONFIG_SMALL("Scale the input by 2x using the Super2xSaI pixel art algorithm."), .priv_size = sizeof(Super2xSaIContext), .query_formats = query_formats, - .inputs = super2xsai_inputs, - .outputs = super2xsai_outputs, + FILTER_INPUTS(super2xsai_inputs), + FILTER_OUTPUTS(super2xsai_outputs), .flags = AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_swaprect.c b/chromium/third_party/ffmpeg/libavfilter/vf_swaprect.c index 3b96790798e..4a5f4a12a65 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_swaprect.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_swaprect.c @@ -228,11 +228,10 @@ static const AVFilterPad inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = filter_frame, .config_props = config_input, - .needs_writable = 1, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -240,7 +239,6 @@ static const AVFilterPad outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_swaprect = { @@ -250,8 +248,8 @@ const AVFilter ff_vf_swaprect = { .priv_class = &swaprect_class, .query_formats = query_formats, .uninit = uninit, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, .process_command = ff_filter_process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_swapuv.c b/chromium/third_party/ffmpeg/libavfilter/vf_swapuv.c index 34868eb0c97..0c285e547c8 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_swapuv.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_swapuv.c @@ -97,10 +97,9 @@ static const AVFilterPad swapuv_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .get_video_buffer = get_video_buffer, + .get_buffer.video = get_video_buffer, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad swapuv_outputs[] = { @@ -108,7 +107,6 @@ static const AVFilterPad swapuv_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_swapuv = { @@ -117,7 +115,7 @@ const AVFilter ff_vf_swapuv = { .query_formats = query_formats, .priv_size = sizeof(SwapUVContext), .priv_class = &swapuv_class, - .inputs = swapuv_inputs, - .outputs = swapuv_outputs, + FILTER_INPUTS(swapuv_inputs), + FILTER_OUTPUTS(swapuv_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_telecine.c b/chromium/third_party/ffmpeg/libavfilter/vf_telecine.c index 52a3f2f353b..99c6d22b7d7 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_telecine.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_telecine.c @@ -275,7 +275,6 @@ static const AVFilterPad telecine_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad telecine_outputs[] = { @@ -284,7 +283,6 @@ static const AVFilterPad telecine_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_telecine = { @@ -295,6 +293,6 @@ const AVFilter ff_vf_telecine = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = telecine_inputs, - .outputs = telecine_outputs, + FILTER_INPUTS(telecine_inputs), + FILTER_OUTPUTS(telecine_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_threshold.c b/chromium/third_party/ffmpeg/libavfilter/vf_threshold.c index 0c8787e3315..828f7a87467 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_threshold.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_threshold.c @@ -67,7 +67,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } typedef struct ThreadData { @@ -146,8 +146,8 @@ static int process_frame(FFFrameSync *fs) td.threshold = threshold; td.min = min; td.max = max; - ctx->internal->execute(ctx, filter_slice, &td, NULL, - FFMIN(s->height[2], ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_slice, &td, NULL, + FFMIN(s->height[2], ff_filter_get_nb_threads(ctx))); } out->pts = av_rescale_q(s->fs.pts, s->fs.time_base, outlink->time_base); @@ -342,7 +342,6 @@ static const AVFilterPad inputs[] = { .name = "max", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -351,7 +350,6 @@ static const AVFilterPad outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_threshold = { @@ -362,8 +360,8 @@ const AVFilter ff_vf_threshold = { .uninit = uninit, .query_formats = query_formats, .activate = activate, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, .process_command = ff_filter_process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_thumbnail.c b/chromium/third_party/ffmpeg/libavfilter/vf_thumbnail.c index 825e536e67a..acfc0ce481e 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_thumbnail.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_thumbnail.c @@ -262,10 +262,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static const AVFilterPad thumbnail_inputs[] = { @@ -275,7 +272,6 @@ static const AVFilterPad thumbnail_inputs[] = { .config_props = config_props, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad thumbnail_outputs[] = { @@ -284,7 +280,6 @@ static const AVFilterPad thumbnail_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .request_frame = request_frame, }, - { NULL } }; const AVFilter ff_vf_thumbnail = { @@ -294,8 +289,8 @@ const AVFilter ff_vf_thumbnail = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = thumbnail_inputs, - .outputs = thumbnail_outputs, + FILTER_INPUTS(thumbnail_inputs), + FILTER_OUTPUTS(thumbnail_outputs), .priv_class = &thumbnail_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_thumbnail_cuda.c b/chromium/third_party/ffmpeg/libavfilter/vf_thumbnail_cuda.c index ceac10f72f7..df9bba22e0f 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_thumbnail_cuda.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_thumbnail_cuda.c @@ -418,10 +418,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_CUDA, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static const AVFilterPad thumbnail_cuda_inputs[] = { @@ -431,7 +428,6 @@ static const AVFilterPad thumbnail_cuda_inputs[] = { .config_props = config_props, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad thumbnail_cuda_outputs[] = { @@ -440,7 +436,6 @@ static const AVFilterPad thumbnail_cuda_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .request_frame = request_frame, }, - { NULL } }; const AVFilter ff_vf_thumbnail_cuda = { @@ -450,8 +445,8 @@ const AVFilter ff_vf_thumbnail_cuda = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = thumbnail_cuda_inputs, - .outputs = thumbnail_cuda_outputs, + FILTER_INPUTS(thumbnail_cuda_inputs), + FILTER_OUTPUTS(thumbnail_cuda_outputs), .priv_class = &thumbnail_cuda_class, .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_tile.c b/chromium/third_party/ffmpeg/libavfilter/vf_tile.c index 11392169e49..13bd53bba6f 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_tile.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_tile.c @@ -272,7 +272,6 @@ static const AVFilterPad tile_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad tile_outputs[] = { @@ -282,7 +281,6 @@ static const AVFilterPad tile_outputs[] = { .config_props = config_props, .request_frame = request_frame, }, - { NULL } }; const AVFilter ff_vf_tile = { @@ -292,7 +290,7 @@ const AVFilter ff_vf_tile = { .uninit = uninit, .query_formats = query_formats, .priv_size = sizeof(TileContext), - .inputs = tile_inputs, - .outputs = tile_outputs, + FILTER_INPUTS(tile_inputs), + FILTER_OUTPUTS(tile_outputs), .priv_class = &tile_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_tinterlace.c b/chromium/third_party/ffmpeg/libavfilter/vf_tinterlace.c index 40d88798710..7c0f00898b1 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_tinterlace.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_tinterlace.c @@ -103,10 +103,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static void lowpass_line_c(uint8_t *dstp, ptrdiff_t width, const uint8_t *srcp, @@ -543,7 +540,6 @@ static const AVFilterPad tinterlace_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad tinterlace_outputs[] = { @@ -552,7 +548,6 @@ static const AVFilterPad tinterlace_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_out_props, }, - { NULL } }; const AVFilter ff_vf_tinterlace = { @@ -561,8 +556,8 @@ const AVFilter ff_vf_tinterlace = { .priv_size = sizeof(TInterlaceContext), .uninit = uninit, .query_formats = query_formats, - .inputs = tinterlace_inputs, - .outputs = tinterlace_outputs, + FILTER_INPUTS(tinterlace_inputs), + FILTER_OUTPUTS(tinterlace_outputs), .priv_class = &tinterlace_class, }; @@ -574,7 +569,7 @@ const AVFilter ff_vf_interlace = { .init = init_interlace, .uninit = uninit, .query_formats = query_formats, - .inputs = tinterlace_inputs, - .outputs = tinterlace_outputs, + FILTER_INPUTS(tinterlace_inputs), + FILTER_OUTPUTS(tinterlace_outputs), .priv_class = &interlace_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_tmidequalizer.c b/chromium/third_party/ffmpeg/libavfilter/vf_tmidequalizer.c index 24e1d557e25..cf9fcf90471 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_tmidequalizer.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_tmidequalizer.c @@ -93,7 +93,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static void compute_contrast_function(const float *const histograms[256], @@ -415,7 +415,6 @@ static const AVFilterPad tmidequalizer_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad tmidequalizer_outputs[] = { @@ -424,7 +423,6 @@ static const AVFilterPad tmidequalizer_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .request_frame = request_frame, }, - { NULL } }; const AVFilter ff_vf_tmidequalizer = { @@ -433,8 +431,8 @@ const AVFilter ff_vf_tmidequalizer = { .priv_size = sizeof(TMidEqualizerContext), .uninit = uninit, .query_formats = query_formats, - .inputs = tmidequalizer_inputs, - .outputs = tmidequalizer_outputs, + FILTER_INPUTS(tmidequalizer_inputs), + FILTER_OUTPUTS(tmidequalizer_outputs), .priv_class = &tmidequalizer_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_tonemap.c b/chromium/third_party/ffmpeg/libavfilter/vf_tonemap.c index 4d04118eac3..8ea54ecafb9 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_tonemap.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_tonemap.c @@ -79,7 +79,7 @@ static const enum AVPixelFormat pix_fmts[] = { static int query_formats(AVFilterContext *ctx) { - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static av_cold int init(AVFilterContext *ctx) @@ -275,7 +275,8 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) td.in = in; td.desc = desc; td.peak = peak; - ctx->internal->execute(ctx, tonemap_slice, &td, NULL, FFMIN(in->height, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, tonemap_slice, &td, NULL, + FFMIN(in->height, ff_filter_get_nb_threads(ctx))); /* copy/generate alpha if needed */ if (desc->flags & AV_PIX_FMT_FLAG_ALPHA && odesc->flags & AV_PIX_FMT_FLAG_ALPHA) { @@ -323,7 +324,6 @@ static const AVFilterPad tonemap_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad tonemap_outputs[] = { @@ -331,7 +331,6 @@ static const AVFilterPad tonemap_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_tonemap = { @@ -341,7 +340,7 @@ const AVFilter ff_vf_tonemap = { .query_formats = query_formats, .priv_size = sizeof(TonemapContext), .priv_class = &tonemap_class, - .inputs = tonemap_inputs, - .outputs = tonemap_outputs, + FILTER_INPUTS(tonemap_inputs), + FILTER_OUTPUTS(tonemap_outputs), .flags = AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_tonemap_opencl.c b/chromium/third_party/ffmpeg/libavfilter/vf_tonemap_opencl.c index 8cf7c099eec..f6596691593 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_tonemap_opencl.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_tonemap_opencl.c @@ -527,7 +527,6 @@ static const AVFilterPad tonemap_opencl_inputs[] = { .filter_frame = &tonemap_opencl_filter_frame, .config_props = &ff_opencl_filter_config_input, }, - { NULL } }; static const AVFilterPad tonemap_opencl_outputs[] = { @@ -536,7 +535,6 @@ static const AVFilterPad tonemap_opencl_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = &tonemap_opencl_config_output, }, - { NULL } }; const AVFilter ff_vf_tonemap_opencl = { @@ -547,7 +545,7 @@ const AVFilter ff_vf_tonemap_opencl = { .init = &ff_opencl_filter_init, .uninit = &tonemap_opencl_uninit, .query_formats = &ff_opencl_filter_query_formats, - .inputs = tonemap_opencl_inputs, - .outputs = tonemap_opencl_outputs, + FILTER_INPUTS(tonemap_opencl_inputs), + FILTER_OUTPUTS(tonemap_opencl_outputs), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_tonemap_vaapi.c b/chromium/third_party/ffmpeg/libavfilter/vf_tonemap_vaapi.c index d33c4f8f6de..a5cf9b0d8dc 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_tonemap_vaapi.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_tonemap_vaapi.c @@ -391,7 +391,6 @@ static const AVFilterPad tonemap_vaapi_inputs[] = { .filter_frame = &tonemap_vaapi_filter_frame, .config_props = &ff_vaapi_vpp_config_input, }, - { NULL } }; static const AVFilterPad tonemap_vaapi_outputs[] = { @@ -400,7 +399,6 @@ static const AVFilterPad tonemap_vaapi_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = &ff_vaapi_vpp_config_output, }, - { NULL } }; const AVFilter ff_vf_tonemap_vaapi = { @@ -410,8 +408,8 @@ const AVFilter ff_vf_tonemap_vaapi = { .init = &tonemap_vaapi_init, .uninit = &ff_vaapi_vpp_ctx_uninit, .query_formats = &ff_vaapi_vpp_query_formats, - .inputs = tonemap_vaapi_inputs, - .outputs = tonemap_vaapi_outputs, + FILTER_INPUTS(tonemap_vaapi_inputs), + FILTER_OUTPUTS(tonemap_vaapi_outputs), .priv_class = &tonemap_vaapi_class, .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_tpad.c b/chromium/third_party/ffmpeg/libavfilter/vf_tpad.c index d23869f3e26..59b4a60d7ce 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_tpad.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_tpad.c @@ -125,6 +125,7 @@ static int activate(AVFilterContext *ctx) if (!s->eof && ff_inlink_acknowledge_status(inlink, &status, &pts)) { if (status == AVERROR_EOF) { + pts = av_rescale_q(pts, inlink->time_base, outlink->time_base); if (!s->pad_stop) { ff_outlink_set_status(outlink, status, pts); return 0; @@ -193,7 +194,6 @@ static const AVFilterPad tpad_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_input, }, - { NULL } }; static const AVFilterPad tpad_outputs[] = { @@ -201,7 +201,6 @@ static const AVFilterPad tpad_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_tpad = { @@ -212,6 +211,6 @@ const AVFilter ff_vf_tpad = { .query_formats = query_formats, .activate = activate, .uninit = uninit, - .inputs = tpad_inputs, - .outputs = tpad_outputs, + FILTER_INPUTS(tpad_inputs), + FILTER_OUTPUTS(tpad_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_transpose.c b/chromium/third_party/ffmpeg/libavfilter/vf_transpose.c index 6affbed0a69..9ed132fc0f4 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_transpose.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_transpose.c @@ -352,7 +352,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) } td.in = in, td.out = out; - ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_slice, &td, NULL, + FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); av_frame_free(&in); return ff_filter_frame(outlink, out); } @@ -382,10 +383,9 @@ static const AVFilterPad avfilter_vf_transpose_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .get_video_buffer = get_video_buffer, + .get_buffer.video = get_video_buffer, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad avfilter_vf_transpose_outputs[] = { @@ -394,7 +394,6 @@ static const AVFilterPad avfilter_vf_transpose_outputs[] = { .config_props = config_props_output, .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_transpose = { @@ -403,7 +402,7 @@ const AVFilter ff_vf_transpose = { .priv_size = sizeof(TransContext), .priv_class = &transpose_class, .query_formats = query_formats, - .inputs = avfilter_vf_transpose_inputs, - .outputs = avfilter_vf_transpose_outputs, + FILTER_INPUTS(avfilter_vf_transpose_inputs), + FILTER_OUTPUTS(avfilter_vf_transpose_outputs), .flags = AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_transpose_npp.c b/chromium/third_party/ffmpeg/libavfilter/vf_transpose_npp.c index 2a68a832fff..14b9d62488e 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_transpose_npp.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_transpose_npp.c @@ -117,8 +117,7 @@ static int npptranspose_query_formats(AVFilterContext *ctx) AV_PIX_FMT_CUDA, AV_PIX_FMT_NONE, }; - AVFilterFormats *pix_fmts = ff_make_format_list(pixel_formats); - return ff_set_common_formats(ctx, pix_fmts); + return ff_set_common_formats_from_list(ctx, pixel_formats); } static int init_stage(NPPTransposeStageContext *stage, AVBufferRef *device_ctx) @@ -461,7 +460,6 @@ static const AVFilterPad npptranspose_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = npptranspose_filter_frame, }, - { NULL } }; static const AVFilterPad npptranspose_outputs[] = { @@ -470,7 +468,6 @@ static const AVFilterPad npptranspose_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = npptranspose_config_props, }, - { NULL } }; const AVFilter ff_vf_transpose_npp = { @@ -481,7 +478,7 @@ const AVFilter ff_vf_transpose_npp = { .query_formats = npptranspose_query_formats, .priv_size = sizeof(NPPTransposeContext), .priv_class = &npptranspose_class, - .inputs = npptranspose_inputs, - .outputs = npptranspose_outputs, + FILTER_INPUTS(npptranspose_inputs), + FILTER_OUTPUTS(npptranspose_outputs), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_transpose_opencl.c b/chromium/third_party/ffmpeg/libavfilter/vf_transpose_opencl.c index 2877d3c8264..05e7aa19e01 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_transpose_opencl.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_transpose_opencl.c @@ -256,11 +256,10 @@ static const AVFilterPad transpose_opencl_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .get_video_buffer = get_video_buffer, + .get_buffer.video = get_video_buffer, .filter_frame = &transpose_opencl_filter_frame, .config_props = &ff_opencl_filter_config_input, }, - { NULL } }; static const AVFilterPad transpose_opencl_outputs[] = { @@ -269,7 +268,6 @@ static const AVFilterPad transpose_opencl_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = &transpose_opencl_config_output, }, - { NULL } }; const AVFilter ff_vf_transpose_opencl = { @@ -280,7 +278,7 @@ const AVFilter ff_vf_transpose_opencl = { .init = &ff_opencl_filter_init, .uninit = &transpose_opencl_uninit, .query_formats = &ff_opencl_filter_query_formats, - .inputs = transpose_opencl_inputs, - .outputs = transpose_opencl_outputs, + FILTER_INPUTS(transpose_opencl_inputs), + FILTER_OUTPUTS(transpose_opencl_outputs), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_transpose_vaapi.c b/chromium/third_party/ffmpeg/libavfilter/vf_transpose_vaapi.c index 79413e0eeba..f0d356da710 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_transpose_vaapi.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_transpose_vaapi.c @@ -257,10 +257,9 @@ static const AVFilterPad transpose_vaapi_inputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, .filter_frame = &transpose_vaapi_filter_frame, - .get_video_buffer = get_video_buffer, + .get_buffer.video = get_video_buffer, .config_props = &ff_vaapi_vpp_config_input, }, - { NULL } }; static const AVFilterPad transpose_vaapi_outputs[] = { @@ -269,7 +268,6 @@ static const AVFilterPad transpose_vaapi_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = &transpose_vaapi_vpp_config_output, }, - { NULL } }; const AVFilter ff_vf_transpose_vaapi = { @@ -279,8 +277,8 @@ const AVFilter ff_vf_transpose_vaapi = { .init = &transpose_vaapi_init, .uninit = &ff_vaapi_vpp_ctx_uninit, .query_formats = &ff_vaapi_vpp_query_formats, - .inputs = transpose_vaapi_inputs, - .outputs = transpose_vaapi_outputs, + FILTER_INPUTS(transpose_vaapi_inputs), + FILTER_OUTPUTS(transpose_vaapi_outputs), .priv_class = &transpose_vaapi_class, .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_unsharp.c b/chromium/third_party/ffmpeg/libavfilter/vf_unsharp.c index 0bf72169a9c..98399b804a8 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_unsharp.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_unsharp.c @@ -164,7 +164,8 @@ static int apply_unsharp_c(AVFilterContext *ctx, AVFrame *in, AVFrame *out) td.height = plane_h[i]; td.dst_stride = out->linesize[i]; td.src_stride = in->linesize[i]; - ctx->internal->execute(ctx, s->unsharp_slice, &td, NULL, FFMIN(plane_h[i], s->nb_threads)); + ff_filter_execute(ctx, s->unsharp_slice, &td, NULL, + FFMIN(plane_h[i], s->nb_threads)); } return 0; } @@ -208,10 +209,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ440P, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int init_filter_param(AVFilterContext *ctx, UnsharpFilterParam *fp, const char *effect_type, int width) @@ -345,7 +343,6 @@ static const AVFilterPad avfilter_vf_unsharp_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad avfilter_vf_unsharp_outputs[] = { @@ -353,7 +350,6 @@ static const AVFilterPad avfilter_vf_unsharp_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_unsharp = { @@ -364,7 +360,7 @@ const AVFilter ff_vf_unsharp = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = avfilter_vf_unsharp_inputs, - .outputs = avfilter_vf_unsharp_outputs, + FILTER_INPUTS(avfilter_vf_unsharp_inputs), + FILTER_OUTPUTS(avfilter_vf_unsharp_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_unsharp_opencl.c b/chromium/third_party/ffmpeg/libavfilter/vf_unsharp_opencl.c index 200350de9f2..129611c70dc 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_unsharp_opencl.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_unsharp_opencl.c @@ -386,7 +386,6 @@ static const AVFilterPad unsharp_opencl_inputs[] = { .filter_frame = &unsharp_opencl_filter_frame, .config_props = &ff_opencl_filter_config_input, }, - { NULL } }; static const AVFilterPad unsharp_opencl_outputs[] = { @@ -395,7 +394,6 @@ static const AVFilterPad unsharp_opencl_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = &ff_opencl_filter_config_output, }, - { NULL } }; const AVFilter ff_vf_unsharp_opencl = { @@ -406,7 +404,7 @@ const AVFilter ff_vf_unsharp_opencl = { .init = &ff_opencl_filter_init, .uninit = &unsharp_opencl_uninit, .query_formats = &ff_opencl_filter_query_formats, - .inputs = unsharp_opencl_inputs, - .outputs = unsharp_opencl_outputs, + FILTER_INPUTS(unsharp_opencl_inputs), + FILTER_OUTPUTS(unsharp_opencl_outputs), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_untile.c b/chromium/third_party/ffmpeg/libavfilter/vf_untile.c index 9035e819d45..2bf5146591b 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_untile.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_untile.c @@ -172,7 +172,6 @@ static const AVFilterPad untile_inputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; static const AVFilterPad untile_outputs[] = { @@ -181,7 +180,6 @@ static const AVFilterPad untile_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_untile = { @@ -192,7 +190,7 @@ const AVFilter ff_vf_untile = { .query_formats = query_formats, .activate = activate, .priv_size = sizeof(UntileContext), - .inputs = untile_inputs, - .outputs = untile_outputs, + FILTER_INPUTS(untile_inputs), + FILTER_OUTPUTS(untile_outputs), .priv_class = &untile_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_uspp.c b/chromium/third_party/ffmpeg/libavfilter/vf_uspp.c index b70d48e515e..ba6ae816a81 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_uspp.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_uspp.c @@ -32,6 +32,7 @@ #include "libavutil/mem_internal.h" #include "libavutil/opt.h" #include "libavutil/pixdesc.h" +#include "libavcodec/avcodec.h" #include "internal.h" #include "qp_table.h" #include "avfilter.h" @@ -304,10 +305,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) @@ -482,7 +480,6 @@ static const AVFilterPad uspp_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad uspp_outputs[] = { @@ -490,7 +487,6 @@ static const AVFilterPad uspp_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_uspp = { @@ -499,8 +495,8 @@ const AVFilter ff_vf_uspp = { .priv_size = sizeof(USPPContext), .uninit = uninit, .query_formats = query_formats, - .inputs = uspp_inputs, - .outputs = uspp_outputs, + FILTER_INPUTS(uspp_inputs), + FILTER_OUTPUTS(uspp_outputs), .priv_class = &uspp_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_v360.c b/chromium/third_party/ffmpeg/libavfilter/vf_v360.c index 692fa43c4dd..58915c54875 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_v360.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_v360.c @@ -247,10 +247,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(s->alpha ? alpha_pix_fmts : pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, s->alpha ? alpha_pix_fmts : pix_fmts); } #define DEFINE_REMAP1_LINE(bits, div) \ @@ -1376,6 +1373,11 @@ static void process_cube_coordinates(const V360Context *s, rotate_cube_face(new_uf, new_vf, s->in_cubemap_face_rotation[*face]); } +static av_always_inline float rescale(int x, int s) +{ + return (2.f * x + 1.f) / s - 1.f; +} + /** * Calculate 3D coordinates on sphere for corresponding frame position in cubemap3x2 format. * @@ -1405,8 +1407,8 @@ static int cube3x2_to_xyz(const V360Context *s, const int ewi = ceilf(ew * (u_face + 1)) - u_shift; const int ehi = ceilf(eh * (v_face + 1)) - v_shift; - const float uf = 2.f * (i - u_shift + 0.5f) / ewi - 1.f; - const float vf = 2.f * (j - v_shift + 0.5f) / ehi - 1.f; + const float uf = rescale(i - u_shift, ewi); + const float vf = rescale(j - v_shift, ehi); cube_to_xyz(s, uf, vf, face, vec, scalew, scaleh); @@ -1529,8 +1531,8 @@ static int cube1x6_to_xyz(const V360Context *s, const int v_shift = ceilf(eh * face); const int ehi = ceilf(eh * (face + 1)) - v_shift; - const float uf = 2.f * (i + 0.5f) / ew - 1.f; - const float vf = 2.f * (j - v_shift + 0.5f) / ehi - 1.f; + const float uf = rescale(i, ew); + const float vf = rescale(j - v_shift, ehi); cube_to_xyz(s, uf, vf, face, vec, scalew, scaleh); @@ -1562,8 +1564,8 @@ static int cube6x1_to_xyz(const V360Context *s, const int u_shift = ceilf(ew * face); const int ewi = ceilf(ew * (face + 1)) - u_shift; - const float uf = 2.f * (i - u_shift + 0.5f) / ewi - 1.f; - const float vf = 2.f * (j + 0.5f) / eh - 1.f; + const float uf = rescale(i - u_shift, ewi); + const float vf = rescale(j, eh); cube_to_xyz(s, uf, vf, face, vec, scalew, scaleh); @@ -1761,8 +1763,8 @@ static int equirect_to_xyz(const V360Context *s, int i, int j, int width, int height, float *vec) { - const float phi = ((2.f * i + 0.5f) / width - 1.f) * s->flat_range[0]; - const float theta = ((2.f * j + 0.5f) / height - 1.f) * s->flat_range[1]; + const float phi = rescale(i, width) * s->flat_range[0]; + const float theta = rescale(j, height) * s->flat_range[1]; const float sin_phi = sinf(phi); const float cos_phi = cosf(phi); @@ -1790,8 +1792,8 @@ static int hequirect_to_xyz(const V360Context *s, int i, int j, int width, int height, float *vec) { - const float phi = ((2.f * i + 0.5f) / width - 1.f) * M_PI_2; - const float theta = ((2.f * j + 0.5f) / height - 1.f) * M_PI_2; + const float phi = rescale(i, width) * M_PI_2; + const float theta = rescale(j, height) * M_PI_2; const float sin_phi = sinf(phi); const float cos_phi = cosf(phi); @@ -1836,8 +1838,8 @@ static int stereographic_to_xyz(const V360Context *s, int i, int j, int width, int height, float *vec) { - const float x = ((2.f * i + 1.f) / width - 1.f) * s->flat_range[0]; - const float y = ((2.f * j + 1.f) / height - 1.f) * s->flat_range[1]; + const float x = rescale(i, width) * s->flat_range[0]; + const float y = rescale(j, height) * s->flat_range[1]; const float r = hypotf(x, y); const float theta = atanf(r) * 2.f; const float sin_theta = sinf(theta); @@ -1942,8 +1944,8 @@ static int equisolid_to_xyz(const V360Context *s, int i, int j, int width, int height, float *vec) { - const float x = ((2.f * i + 1.f) / width - 1.f) * s->flat_range[0]; - const float y = ((2.f * j + 1.f) / height - 1.f) * s->flat_range[1]; + const float x = rescale(i, width) * s->flat_range[0]; + const float y = rescale(j, height) * s->flat_range[1]; const float r = hypotf(x, y); const float theta = asinf(r) * 2.f; const float sin_theta = sinf(theta); @@ -2048,18 +2050,25 @@ static int orthographic_to_xyz(const V360Context *s, int i, int j, int width, int height, float *vec) { - const float x = ((2.f * i + 1.f) / width - 1.f) * s->flat_range[0]; - const float y = ((2.f * j + 1.f) / height - 1.f) * s->flat_range[1]; + const float x = rescale(i, width) * s->flat_range[0]; + const float y = rescale(j, height) * s->flat_range[1]; const float r = hypotf(x, y); const float theta = asinf(r); - vec[0] = x; - vec[1] = y; vec[2] = cosf(theta); + if (vec[2] > 0) { + vec[0] = x; + vec[1] = y; - normalize_vector(vec); + normalize_vector(vec); + return 1; + } else { + vec[0] = 0; + vec[1] = 0; + vec[2] = 1; - return 1; + return 0; + } } /** @@ -2158,8 +2167,8 @@ static int xyz_to_equirect(const V360Context *s, const float phi = atan2f(vec[0], vec[2]); const float theta = asinf(vec[1]); - const float uf = (phi / s->iflat_range[0] + 1.f) * width / 2.f; - const float vf = (theta / s->iflat_range[1] + 1.f) * height / 2.f; + const float uf = (phi / s->iflat_range[0] + 1.f) * width / 2.f - 0.5f; + const float vf = (theta / s->iflat_range[1] + 1.f) * height / 2.f - 0.5f; const int ui = floorf(uf); const int vi = floorf(vf); @@ -2336,8 +2345,8 @@ static int mercator_to_xyz(const V360Context *s, int i, int j, int width, int height, float *vec) { - const float phi = ((2.f * i + 1.f) / width - 1.f) * M_PI + M_PI_2; - const float y = ((2.f * j + 1.f) / height - 1.f) * M_PI; + const float phi = rescale(i, width) * M_PI + M_PI_2; + const float y = rescale(j, height) * M_PI; const float div = expf(2.f * y) + 1.f; const float sin_phi = sinf(phi); @@ -2404,8 +2413,8 @@ static int ball_to_xyz(const V360Context *s, int i, int j, int width, int height, float *vec) { - const float x = (2.f * i + 1.f) / width - 1.f; - const float y = (2.f * j + 1.f) / height - 1.f; + const float x = rescale(i, width); + const float y = rescale(j, height); const float l = hypotf(x, y); if (l <= 1.f) { @@ -2438,8 +2447,8 @@ static int hammer_to_xyz(const V360Context *s, int i, int j, int width, int height, float *vec) { - const float x = ((2.f * i + 1.f) / width - 1.f); - const float y = ((2.f * j + 1.f) / height - 1.f); + const float x = rescale(i, width); + const float y = rescale(j, height); const float xx = x * x; const float yy = y * y; @@ -2518,8 +2527,8 @@ static int sinusoidal_to_xyz(const V360Context *s, int i, int j, int width, int height, float *vec) { - const float theta = ((2.f * j + 1.f) / height - 1.f) * M_PI_2; - const float phi = ((2.f * i + 1.f) / width - 1.f) * M_PI / cosf(theta); + const float theta = rescale(j, height) * M_PI_2; + const float phi = rescale(i, width) * M_PI / cosf(theta); const float sin_phi = sinf(phi); const float cos_phi = cosf(phi); @@ -2823,8 +2832,8 @@ static int flat_to_xyz(const V360Context *s, int i, int j, int width, int height, float *vec) { - const float l_x = s->flat_range[0] * ((2.f * i + 0.5f) / width - 1.f); - const float l_y = s->flat_range[1] * ((2.f * j + 0.5f) / height - 1.f); + const float l_x = s->flat_range[0] * rescale(i, width); + const float l_y = s->flat_range[1] * rescale(j, height); vec[0] = l_x; vec[1] = l_y; @@ -2866,8 +2875,8 @@ static int fisheye_to_xyz(const V360Context *s, int i, int j, int width, int height, float *vec) { - const float uf = s->flat_range[0] * ((2.f * i) / width - 1.f); - const float vf = s->flat_range[1] * ((2.f * j + 1.f) / height - 1.f); + const float uf = s->flat_range[0] * rescale(i, width); + const float vf = s->flat_range[1] * rescale(j, height); const float phi = atan2f(vf, uf); const float theta = M_PI_2 * (1.f - hypotf(uf, vf)); @@ -2962,8 +2971,8 @@ static int pannini_to_xyz(const V360Context *s, int i, int j, int width, int height, float *vec) { - const float uf = ((2.f * i + 1.f) / width - 1.f); - const float vf = ((2.f * j + 1.f) / height - 1.f); + const float uf = rescale(i, width); + const float vf = rescale(j, height); const float d = s->h_fov; const float k = uf * uf / ((d + 1.f) * (d + 1.f)); @@ -3007,8 +3016,8 @@ static int xyz_to_pannini(const V360Context *s, const float x = S * sinf(phi); const float y = S * tanf(theta); - const float uf = (x + 1.f) * width / 2.f; - const float vf = (y + 1.f) * height / 2.f; + const float uf = (x + 1.f) * width / 2.f - 0.5f; + const float vf = (y + 1.f) * height / 2.f - 0.5f; const int ui = floorf(uf); const int vi = floorf(vf); @@ -3059,8 +3068,8 @@ static int cylindrical_to_xyz(const V360Context *s, int i, int j, int width, int height, float *vec) { - const float uf = s->flat_range[0] * ((2.f * i + 1.f) / width - 1.f); - const float vf = s->flat_range[1] * ((2.f * j + 1.f) / height - 1.f); + const float uf = s->flat_range[0] * rescale(i, width); + const float vf = s->flat_range[1] * rescale(j, height); const float phi = uf; const float theta = atanf(vf); @@ -3186,8 +3195,8 @@ static int cylindricalea_to_xyz(const V360Context *s, int i, int j, int width, int height, float *vec) { - const float uf = s->flat_range[0] * ((2.f * i + 1.f) / width - 1.f); - const float vf = s->flat_range[1] * ((2.f * j + 1.f) / height - 1.f); + const float uf = s->flat_range[0] * rescale(i, width); + const float vf = s->flat_range[1] * rescale(j, height); const float phi = uf; const float theta = asinf(vf); @@ -3262,8 +3271,8 @@ static int perspective_to_xyz(const V360Context *s, int i, int j, int width, int height, float *vec) { - const float uf = ((2.f * i + 1.f) / width - 1.f); - const float vf = ((2.f * j + 1.f) / height - 1.f); + const float uf = rescale(i, width); + const float vf = rescale(j, height); const float rh = hypotf(uf, vf); const float sinzz = 1.f - rh * rh; const float h = 1.f + s->v_fov; @@ -3308,8 +3317,8 @@ static int tetrahedron_to_xyz(const V360Context *s, int i, int j, int width, int height, float *vec) { - const float uf = (float)i / width; - const float vf = (float)j / height; + const float uf = ((float)i + 0.5f) / width; + const float vf = ((float)j + 0.5f) / height; vec[0] = uf < 0.5f ? uf * 4.f - 1.f : 3.f - uf * 4.f; vec[1] = 1.f - vf * 2.f; @@ -3397,8 +3406,8 @@ static int dfisheye_to_xyz(const V360Context *s, const int ei = i >= ew ? i - ew : i; const float m = i >= ew ? 1.f : -1.f; - const float uf = s->flat_range[0] * ((2.f * ei) / ew - 1.f); - const float vf = s->flat_range[1] * ((2.f * j + 1.f) / eh - 1.f); + const float uf = s->flat_range[0] * rescale(ei, ew); + const float vf = s->flat_range[1] * rescale(j, eh); const float h = hypotf(uf, vf); const float lh = h > 0.f ? h : 1.f; @@ -3491,8 +3500,8 @@ static int barrel_to_xyz(const V360Context *s, const int ew = 4 * width / 5; const int eh = height; - const float phi = ((2.f * i) / ew - 1.f) * M_PI / scale; - const float theta = ((2.f * j) / eh - 1.f) * theta_range / scale; + const float phi = rescale(i, ew) * M_PI / scale; + const float theta = rescale(j, eh) * theta_range / scale; const float sin_phi = sinf(phi); const float cos_phi = cosf(phi); @@ -3509,8 +3518,8 @@ static int barrel_to_xyz(const V360Context *s, float uf, vf; if (j < eh) { // UP - uf = 2.f * (i - 4 * ew) / ew - 1.f; - vf = 2.f * (j ) / eh - 1.f; + uf = rescale(i - 4 * ew, ew); + vf = rescale(j, eh); uf /= scale; vf /= scale; @@ -3519,8 +3528,8 @@ static int barrel_to_xyz(const V360Context *s, l_y = -1.f; l_z = vf; } else { // DOWN - uf = 2.f * (i - 4 * ew) / ew - 1.f; - vf = 2.f * (j - eh) / eh - 1.f; + uf = rescale(i - 4 * ew, ew); + vf = rescale(j - eh, eh); uf /= scale; vf /= scale; @@ -3940,8 +3949,8 @@ static int octahedron_to_xyz(const V360Context *s, int i, int j, int width, int height, float *vec) { - const float x = ((i + 0.5f) / width) * 2.f - 1.f; - const float y = ((j + 0.5f) / height) * 2.f - 1.f; + const float x = rescale(i, width); + const float y = rescale(j, height); const float ax = fabsf(x); const float ay = fabsf(y); @@ -4890,7 +4899,7 @@ static int config_output(AVFilterLink *outlink) set_mirror_modifier(s->h_flip, s->v_flip, s->d_flip, s->output_mirror_modifier); - ctx->internal->execute(ctx, v360_slice, NULL, NULL, s->nb_threads); + ff_filter_execute(ctx, v360_slice, NULL, NULL, s->nb_threads); return 0; } @@ -4913,7 +4922,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.in = in; td.out = out; - ctx->internal->execute(ctx, s->remap_slice, &td, NULL, s->nb_threads); + ff_filter_execute(ctx, s->remap_slice, &td, NULL, s->nb_threads); av_frame_free(&in); return ff_filter_frame(outlink, out); @@ -4969,7 +4978,6 @@ static const AVFilterPad inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -4978,7 +4986,6 @@ static const AVFilterPad outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_v360 = { @@ -4988,8 +4995,8 @@ const AVFilter ff_vf_v360 = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .priv_class = &v360_class, .flags = AVFILTER_FLAG_SLICE_THREADS, .process_command = process_command, diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_vaguedenoiser.c b/chromium/third_party/ffmpeg/libavfilter/vf_vaguedenoiser.c index 481fc774e51..ea23067110e 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_vaguedenoiser.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_vaguedenoiser.c @@ -132,10 +132,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRAP, AV_PIX_FMT_GBRAP10, AV_PIX_FMT_GBRAP12, AV_PIX_FMT_GBRAP16, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) @@ -598,7 +595,6 @@ static const AVFilterPad vaguedenoiser_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; @@ -607,7 +603,6 @@ static const AVFilterPad vaguedenoiser_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO }, - { NULL } }; const AVFilter ff_vf_vaguedenoiser = { @@ -618,7 +613,7 @@ const AVFilter ff_vf_vaguedenoiser = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = vaguedenoiser_inputs, - .outputs = vaguedenoiser_outputs, + FILTER_INPUTS(vaguedenoiser_inputs), + FILTER_OUTPUTS(vaguedenoiser_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_vectorscope.c b/chromium/third_party/ffmpeg/libavfilter/vf_vectorscope.c index 0669230890d..b8b406430c1 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_vectorscope.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_vectorscope.c @@ -1575,7 +1575,6 @@ static const AVFilterPad inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -1584,7 +1583,6 @@ static const AVFilterPad outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_vectorscope = { @@ -1594,6 +1592,6 @@ const AVFilter ff_vf_vectorscope = { .priv_class = &vectorscope_class, .query_formats = query_formats, .uninit = uninit, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_vflip.c b/chromium/third_party/ffmpeg/libavfilter/vf_vflip.c index 95a693a7e1d..0d624512f9f 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_vflip.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_vflip.c @@ -129,11 +129,10 @@ static const AVFilterPad avfilter_vf_vflip_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .get_video_buffer = get_video_buffer, + .get_buffer.video = get_video_buffer, .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad avfilter_vf_vflip_outputs[] = { @@ -141,7 +140,6 @@ static const AVFilterPad avfilter_vf_vflip_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_vflip = { @@ -149,7 +147,7 @@ const AVFilter ff_vf_vflip = { .description = NULL_IF_CONFIG_SMALL("Flip the input video vertically."), .priv_size = sizeof(FlipContext), .priv_class = &vflip_class, - .inputs = avfilter_vf_vflip_inputs, - .outputs = avfilter_vf_vflip_outputs, + FILTER_INPUTS(avfilter_vf_vflip_inputs), + FILTER_OUTPUTS(avfilter_vf_vflip_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_vfrdet.c b/chromium/third_party/ffmpeg/libavfilter/vf_vfrdet.c index 7e37036aef8..fda8c2d485d 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_vfrdet.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_vfrdet.c @@ -93,7 +93,6 @@ static const AVFilterPad vfrdet_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad vfrdet_outputs[] = { @@ -101,7 +100,6 @@ static const AVFilterPad vfrdet_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_vfrdet = { @@ -110,6 +108,6 @@ const AVFilter ff_vf_vfrdet = { .priv_size = sizeof(VFRDETContext), .init = init, .uninit = uninit, - .inputs = vfrdet_inputs, - .outputs = vfrdet_outputs, + FILTER_INPUTS(vfrdet_inputs), + FILTER_OUTPUTS(vfrdet_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_vibrance.c b/chromium/third_party/ffmpeg/libavfilter/vf_vibrance.c index cca677ee78e..7253ebd5943 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_vibrance.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_vibrance.c @@ -285,8 +285,8 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame) VibranceContext *s = avctx->priv; int res; - if (res = avctx->internal->execute(avctx, s->do_slice, frame, NULL, - FFMIN(frame->height, ff_filter_get_nb_threads(avctx)))) + if (res = ff_filter_execute(avctx, s->do_slice, frame, NULL, + FFMIN(frame->height, ff_filter_get_nb_threads(avctx)))) return res; return ff_filter_frame(avctx->outputs[0], frame); @@ -309,13 +309,7 @@ static av_cold int query_formats(AVFilterContext *avctx) AV_PIX_FMT_NONE }; - AVFilterFormats *formats = NULL; - - formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - - return ff_set_common_formats(avctx, formats); + return ff_set_common_formats_from_list(avctx, pixel_fmts); } static av_cold int config_input(AVFilterLink *inlink) @@ -346,11 +340,10 @@ static const AVFilterPad vibrance_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .needs_writable = 1, + .flags = AVFILTERPAD_FLAG_NEEDS_WRITABLE, .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad vibrance_outputs[] = { @@ -358,7 +351,6 @@ static const AVFilterPad vibrance_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; #define OFFSET(x) offsetof(VibranceContext, x) @@ -384,8 +376,8 @@ const AVFilter ff_vf_vibrance = { .priv_size = sizeof(VibranceContext), .priv_class = &vibrance_class, .query_formats = query_formats, - .inputs = vibrance_inputs, - .outputs = vibrance_outputs, + FILTER_INPUTS(vibrance_inputs), + FILTER_OUTPUTS(vibrance_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = ff_filter_process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_vidstabdetect.c b/chromium/third_party/ffmpeg/libavfilter/vf_vidstabdetect.c index 475d0381bc4..5e12d31d0ee 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_vidstabdetect.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_vidstabdetect.c @@ -93,10 +93,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) @@ -196,7 +193,6 @@ static const AVFilterPad avfilter_vf_vidstabdetect_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad avfilter_vf_vidstabdetect_outputs[] = { @@ -204,7 +200,6 @@ static const AVFilterPad avfilter_vf_vidstabdetect_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_vidstabdetect = { @@ -216,7 +211,7 @@ const AVFilter ff_vf_vidstabdetect = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = avfilter_vf_vidstabdetect_inputs, - .outputs = avfilter_vf_vidstabdetect_outputs, + FILTER_INPUTS(avfilter_vf_vidstabdetect_inputs), + FILTER_OUTPUTS(avfilter_vf_vidstabdetect_outputs), .priv_class = &vidstabdetect_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_vidstabtransform.c b/chromium/third_party/ffmpeg/libavfilter/vf_vidstabtransform.c index 79e62c1f58c..3499b9afe4d 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_vidstabtransform.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_vidstabtransform.c @@ -132,10 +132,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } @@ -297,7 +294,6 @@ static const AVFilterPad avfilter_vf_vidstabtransform_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad avfilter_vf_vidstabtransform_outputs[] = { @@ -305,7 +301,6 @@ static const AVFilterPad avfilter_vf_vidstabtransform_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_vidstabtransform = { @@ -317,7 +312,7 @@ const AVFilter ff_vf_vidstabtransform = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = avfilter_vf_vidstabtransform_inputs, - .outputs = avfilter_vf_vidstabtransform_outputs, + FILTER_INPUTS(avfilter_vf_vidstabtransform_inputs), + FILTER_OUTPUTS(avfilter_vf_vidstabtransform_outputs), .priv_class = &vidstabtransform_class, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_vif.c b/chromium/third_party/ffmpeg/libavfilter/vf_vif.c index a136d038fb7..da3069c1f61 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_vif.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_vif.c @@ -35,9 +35,10 @@ #include "drawutils.h" #include "formats.h" #include "internal.h" -#include "vif.h" #include "video.h" +#define NUM_DATA_BUFS 13 + typedef struct VIFContext { const AVClass *class; FFFrameSync fs; @@ -46,7 +47,7 @@ typedef struct VIFContext { int height; int nb_threads; float factor; - float *data_buf[13]; + float *data_buf[NUM_DATA_BUFS]; float **temp; float *ref_data; float *main_data; @@ -283,11 +284,11 @@ static int vif_filter1d(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) return 0; } -int ff_compute_vif2(AVFilterContext *ctx, - const float *ref, const float *main, int w, int h, - int ref_stride, int main_stride, float *score, - float *data_buf[14], float **temp, - int gnb_threads) +static int compute_vif2(AVFilterContext *ctx, + const float *ref, const float *main, int w, int h, + int ref_stride, int main_stride, float *score, + float *const data_buf[NUM_DATA_BUFS], float **temp, + int gnb_threads) { ThreadData td; float *ref_scale = data_buf[0]; @@ -330,12 +331,12 @@ int ff_compute_vif2(AVFilterContext *ctx, td.src_stride = curr_ref_stride; td.dst_stride = w; td.temp = temp; - ctx->internal->execute(ctx, vif_filter1d, &td, NULL, nb_threads); + ff_filter_execute(ctx, vif_filter1d, &td, NULL, nb_threads); td.src = curr_main_scale; td.dst = mu2; td.src_stride = curr_main_stride; - ctx->internal->execute(ctx, vif_filter1d, &td, NULL, nb_threads); + ff_filter_execute(ctx, vif_filter1d, &td, NULL, nb_threads); vif_dec2(mu1, ref_scale, buf_valid_w, buf_valid_h, w, w); vif_dec2(mu2, main_scale, buf_valid_w, buf_valid_h, w, w); @@ -360,12 +361,12 @@ int ff_compute_vif2(AVFilterContext *ctx, td.src_stride = curr_ref_stride; td.dst_stride = w; td.temp = temp; - ctx->internal->execute(ctx, vif_filter1d, &td, NULL, nb_threads); + ff_filter_execute(ctx, vif_filter1d, &td, NULL, nb_threads); td.src = curr_main_scale; td.dst = mu2; td.src_stride = curr_main_stride; - ctx->internal->execute(ctx, vif_filter1d, &td, NULL, nb_threads); + ff_filter_execute(ctx, vif_filter1d, &td, NULL, nb_threads); vif_xx_yy_xy(mu1, mu2, mu1_sq, mu2_sq, mu1_mu2, w, h); @@ -374,16 +375,16 @@ int ff_compute_vif2(AVFilterContext *ctx, td.src = ref_sq; td.dst = ref_sq_filt; td.src_stride = w; - ctx->internal->execute(ctx, vif_filter1d, &td, NULL, nb_threads); + ff_filter_execute(ctx, vif_filter1d, &td, NULL, nb_threads); td.src = main_sq; td.dst = main_sq_filt; td.src_stride = w; - ctx->internal->execute(ctx, vif_filter1d, &td, NULL, nb_threads); + ff_filter_execute(ctx, vif_filter1d, &td, NULL, nb_threads); td.src = ref_main; td.dst = ref_main_filt; - ctx->internal->execute(ctx, vif_filter1d, &td, NULL, nb_threads); + ff_filter_execute(ctx, vif_filter1d, &td, NULL, nb_threads); vif_statistic(mu1_sq, mu2_sq, mu1_mu2, ref_sq_filt, main_sq_filt, ref_main_filt, &num, &den, w, h); @@ -448,11 +449,9 @@ static AVFrame *do_vif(AVFilterContext *ctx, AVFrame *main, const AVFrame *ref) offset_16bit(s, ref, main, s->width); } - ff_compute_vif2(ctx, - s->ref_data, s->main_data, s->width, - s->height, s->width, s->width, - score, s->data_buf, s->temp, - s->nb_threads); + compute_vif2(ctx, s->ref_data, s->main_data, + s->width, s->height, s->width, s->width, + score, s->data_buf, s->temp, s->nb_threads); set_meta(metadata, "lavfi.vif.scale.0", score[0]); set_meta(metadata, "lavfi.vif.scale.1", score[1]); @@ -484,10 +483,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_input_ref(AVFilterLink *inlink) @@ -515,7 +511,7 @@ static int config_input_ref(AVFilterLink *inlink) s->vif_max[i] = -DBL_MAX; } - for (int i = 0; i < 13; i++) { + for (int i = 0; i < NUM_DATA_BUFS; i++) { if (!(s->data_buf[i] = av_calloc(s->width, s->height * sizeof(float)))) return AVERROR(ENOMEM); } @@ -608,7 +604,7 @@ static av_cold void uninit(AVFilterContext *ctx) i, s->vif_sum[i] / s->nb_frames, s->vif_min[i], s->vif_max[i]); } - for (int i = 0; i < 13; i++) + for (int i = 0; i < NUM_DATA_BUFS; i++) av_freep(&s->data_buf[i]); av_freep(&s->ref_data); @@ -631,7 +627,6 @@ static const AVFilterPad vif_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_input_ref, }, - { NULL } }; static const AVFilterPad vif_outputs[] = { @@ -640,7 +635,6 @@ static const AVFilterPad vif_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_vif = { @@ -651,7 +645,7 @@ const AVFilter ff_vf_vif = { .priv_size = sizeof(VIFContext), .priv_class = &vif_class, .activate = activate, - .inputs = vif_inputs, - .outputs = vif_outputs, + FILTER_INPUTS(vif_inputs), + FILTER_OUTPUTS(vif_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_vignette.c b/chromium/third_party/ffmpeg/libavfilter/vf_vignette.c index 91754306aed..8e9f196ab9d 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_vignette.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_vignette.c @@ -135,10 +135,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static double get_natural_factor(const VignetteContext *s, int x, int y) @@ -330,7 +327,6 @@ static const AVFilterPad vignette_inputs[] = { .filter_frame = filter_frame, .config_props = config_props, }, - { NULL } }; static const AVFilterPad vignette_outputs[] = { @@ -338,7 +334,6 @@ static const AVFilterPad vignette_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_vignette = { @@ -348,8 +343,8 @@ const AVFilter ff_vf_vignette = { .init = init, .uninit = uninit, .query_formats = query_formats, - .inputs = vignette_inputs, - .outputs = vignette_outputs, + FILTER_INPUTS(vignette_inputs), + FILTER_OUTPUTS(vignette_outputs), .priv_class = &vignette_class, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_vmafmotion.c b/chromium/third_party/ffmpeg/libavfilter/vf_vmafmotion.c index 454ebb8afa6..67cc012b181 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_vmafmotion.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_vmafmotion.c @@ -347,7 +347,6 @@ static const AVFilterPad vmafmotion_inputs[] = { .filter_frame = filter_frame, .config_props = config_input_ref, }, - { NULL } }; static const AVFilterPad vmafmotion_outputs[] = { @@ -355,7 +354,6 @@ static const AVFilterPad vmafmotion_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; const AVFilter ff_vf_vmafmotion = { @@ -366,6 +364,6 @@ const AVFilter ff_vf_vmafmotion = { .query_formats = query_formats, .priv_size = sizeof(VMAFMotionContext), .priv_class = &vmafmotion_class, - .inputs = vmafmotion_inputs, - .outputs = vmafmotion_outputs, + FILTER_INPUTS(vmafmotion_inputs), + FILTER_OUTPUTS(vmafmotion_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_vpp_qsv.c b/chromium/third_party/ffmpeg/libavfilter/vf_vpp_qsv.c index 11ee4909359..c268b5dba8a 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_vpp_qsv.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_vpp_qsv.c @@ -25,6 +25,7 @@ #include "libavutil/opt.h" #include "libavutil/eval.h" +#include "libavutil/hwcontext.h" #include "libavutil/pixdesc.h" #include "libavutil/mathematics.h" @@ -42,9 +43,10 @@ #define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM) /* number of video enhancement filters */ -#define ENH_FILTERS_COUNT (7) -#define QSV_HAVE_ROTATION QSV_VERSION_ATLEAST(1, 17) -#define QSV_HAVE_MIRRORING QSV_VERSION_ATLEAST(1, 19) +#define ENH_FILTERS_COUNT (8) +#define QSV_HAVE_ROTATION QSV_VERSION_ATLEAST(1, 17) +#define QSV_HAVE_MIRRORING QSV_VERSION_ATLEAST(1, 19) +#define QSV_HAVE_SCALING_CONFIG QSV_VERSION_ATLEAST(1, 19) typedef struct VPPContext{ const AVClass *class; @@ -59,6 +61,9 @@ typedef struct VPPContext{ mfxExtVPPProcAmp procamp_conf; mfxExtVPPRotation rotation_conf; mfxExtVPPMirroring mirroring_conf; +#ifdef QSV_HAVE_SCALING_CONFIG + mfxExtVPPScaling scale_conf; +#endif int out_width; int out_height; @@ -83,6 +88,8 @@ typedef struct VPPContext{ int rotate; /* rotate angle : [0, 90, 180, 270] */ int hflip; /* flip mode : 0 = off, 1 = HORIZONTAL flip */ + int scale_mode; /* scale mode : 0 = auto, 1 = low power, 2 = high quality */ + /* param for the procamp */ int procamp; /* enable procamp */ float hue; @@ -132,6 +139,7 @@ static const AVOption options[] = { { "height", "Output video height", OFFSET(oh), AV_OPT_TYPE_STRING, { .str="w*ch/cw" }, 0, 255, .flags = FLAGS }, { "format", "Output pixel format", OFFSET(output_format_str), AV_OPT_TYPE_STRING, { .str = "same" }, .flags = FLAGS }, { "async_depth", "Internal parallelization depth, the higher the value the higher the latency.", OFFSET(async_depth), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, .flags = FLAGS }, + { "scale_mode", "scale mode: 0=auto, 1=low power, 2=high quality", OFFSET(scale_mode), AV_OPT_TYPE_INT, { .i64 = MFX_SCALING_MODE_DEFAULT }, MFX_SCALING_MODE_DEFAULT, MFX_SCALING_MODE_QUALITY, .flags = FLAGS, "scale mode" }, { NULL } }; @@ -459,6 +467,20 @@ static int config_output(AVFilterLink *outlink) #endif } + if (inlink->w != outlink->w || inlink->h != outlink->h) { +#ifdef QSV_HAVE_SCALING_CONFIG + memset(&vpp->scale_conf, 0, sizeof(mfxExtVPPScaling)); + vpp->scale_conf.Header.BufferId = MFX_EXTBUFF_VPP_SCALING; + vpp->scale_conf.Header.BufferSz = sizeof(mfxExtVPPScaling); + vpp->scale_conf.ScalingMode = vpp->scale_mode; + + param.ext_buf[param.num_ext_buf++] = (mfxExtBuffer*)&vpp->scale_conf; +#else + av_log(ctx, AV_LOG_WARNING, "The QSV VPP Scale option is " + "not supported with this MSDK version.\n"); +#endif + } + if (vpp->use_frc || vpp->use_crop || vpp->deinterlace || vpp->denoise || vpp->detail || vpp->procamp || vpp->rotate || vpp->hflip || inlink->w != outlink->w || inlink->h != outlink->h || in_format != vpp->out_format) @@ -578,7 +600,6 @@ static const AVFilterPad vpp_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_input, }, - { NULL } }; static const AVFilterPad vpp_outputs[] = { @@ -587,7 +608,6 @@ static const AVFilterPad vpp_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_vpp_qsv = { @@ -597,8 +617,8 @@ const AVFilter ff_vf_vpp_qsv = { .query_formats = query_formats, .init = vpp_init, .uninit = vpp_uninit, - .inputs = vpp_inputs, - .outputs = vpp_outputs, + FILTER_INPUTS(vpp_inputs), + FILTER_OUTPUTS(vpp_outputs), .activate = activate, .priv_class = &vpp_class, .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_w3fdif.c b/chromium/third_party/ffmpeg/libavfilter/vf_w3fdif.c index 5edb826f0aa..9d073e9c34c 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_w3fdif.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_w3fdif.c @@ -101,10 +101,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static void filter_simple_low(int32_t *work_line, @@ -507,7 +504,8 @@ static int filter(AVFilterContext *ctx, int is_second) adj = s->field ? s->next : s->prev; td.out = out; td.cur = s->cur; td.adj = adj; - ctx->internal->execute(ctx, deinterlace_slice, &td, NULL, FFMIN(s->planeheight[1], s->nb_threads)); + ff_filter_execute(ctx, deinterlace_slice, &td, NULL, + FFMIN(s->planeheight[1], s->nb_threads)); if (s->mode) s->field = !s->field; @@ -600,7 +598,6 @@ static const AVFilterPad w3fdif_inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad w3fdif_outputs[] = { @@ -610,7 +607,6 @@ static const AVFilterPad w3fdif_outputs[] = { .config_props = config_output, .request_frame = request_frame, }, - { NULL } }; const AVFilter ff_vf_w3fdif = { @@ -620,8 +616,8 @@ const AVFilter ff_vf_w3fdif = { .priv_class = &w3fdif_class, .uninit = uninit, .query_formats = query_formats, - .inputs = w3fdif_inputs, - .outputs = w3fdif_outputs, + FILTER_INPUTS(w3fdif_inputs), + FILTER_OUTPUTS(w3fdif_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, .process_command = ff_filter_process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_waveform.c b/chromium/third_party/ffmpeg/libavfilter/vf_waveform.c index 977ebad9cef..431740705b8 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_waveform.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_waveform.c @@ -36,6 +36,12 @@ typedef struct ThreadData { int offset_x; } ThreadData; +enum FitMode { + FM_NONE, + FM_SIZE, + NB_FITMODES +}; + enum FilterType { LOWPASS, FLAT, @@ -113,6 +119,7 @@ typedef struct WaveformContext { int rgb; float ftint[2]; int tint[2]; + int fitmode; int (*waveform_slice)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs); @@ -184,6 +191,10 @@ static const AVOption waveform_options[] = { { "t0", "set 1st tint", OFFSET(ftint[0]), AV_OPT_TYPE_FLOAT, {.dbl=0}, -1, 1, FLAGS}, { "tint1", "set 2nd tint", OFFSET(ftint[1]), AV_OPT_TYPE_FLOAT, {.dbl=0}, -1, 1, FLAGS}, { "t1", "set 2nd tint", OFFSET(ftint[1]), AV_OPT_TYPE_FLOAT, {.dbl=0}, -1, 1, FLAGS}, + { "fitmode", "set fit mode", OFFSET(fitmode), AV_OPT_TYPE_INT, {.i64=0}, 0, NB_FITMODES-1, FLAGS, "fitmode" }, + { "fm", "set fit mode", OFFSET(fitmode), AV_OPT_TYPE_INT, {.i64=0}, 0, NB_FITMODES-1, FLAGS, "fitmode" }, + { "none", NULL, 0, AV_OPT_TYPE_CONST, {.i64=FM_NONE}, 0, 0, FLAGS, "fitmode" }, + { "size", NULL, 0, AV_OPT_TYPE_CONST, {.i64=FM_SIZE}, 0, 0, FLAGS, "fitmode" }, { NULL } }; @@ -3357,7 +3368,20 @@ static int config_output(AVFilterLink *outlink) } } - outlink->sample_aspect_ratio = (AVRational){1,1}; + switch (s->fitmode) { + case FM_NONE: + outlink->sample_aspect_ratio = (AVRational){ 1, 1 }; + break; + case FM_SIZE: + if (s->mode) + outlink->sample_aspect_ratio = (AVRational){ s->size * comp, inlink->h }; + else + outlink->sample_aspect_ratio = (AVRational){ inlink->w, s->size * comp }; + break; + } + + av_reduce(&outlink->sample_aspect_ratio.num, &outlink->sample_aspect_ratio.den, + outlink->sample_aspect_ratio.num, outlink->sample_aspect_ratio.den, INT_MAX); return 0; } @@ -3416,7 +3440,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.component = k; td.offset_y = offset_y; td.offset_x = offset_x; - ctx->internal->execute(ctx, s->waveform_slice, &td, NULL, ff_filter_get_nb_threads(ctx)); + ff_filter_execute(ctx, s->waveform_slice, &td, NULL, + ff_filter_get_nb_threads(ctx)); switch (s->filter) { case LOWPASS: if (s->bits <= 8) @@ -3460,6 +3485,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) s->graticulef(s, out); av_frame_free(&in); + out->sample_aspect_ratio = outlink->sample_aspect_ratio; return ff_filter_frame(outlink, out); } @@ -3477,7 +3503,6 @@ static const AVFilterPad inputs[] = { .filter_frame = filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -3486,7 +3511,6 @@ static const AVFilterPad outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_waveform = { @@ -3496,7 +3520,7 @@ const AVFilter ff_vf_waveform = { .priv_class = &waveform_class, .query_formats = query_formats, .uninit = uninit, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), .flags = AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_weave.c b/chromium/third_party/ffmpeg/libavfilter/vf_weave.c index 98b8d0bd06b..5d20f652255 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_weave.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_weave.c @@ -150,8 +150,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) av_frame_copy_props(out, in); td.out = out, td.in = in; - ctx->internal->execute(ctx, weave_slice, &td, NULL, FFMIN(s->planeheight[1], - ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, weave_slice, &td, NULL, + FFMIN(s->planeheight[1], ff_filter_get_nb_threads(ctx))); out->pts = s->double_weave ? s->prev->pts : in->pts / 2; out->interlaced_frame = 1; @@ -178,7 +178,6 @@ static const AVFilterPad weave_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad weave_outputs[] = { @@ -187,7 +186,6 @@ static const AVFilterPad weave_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_props_output, }, - { NULL } }; const AVFilter ff_vf_weave = { @@ -197,8 +195,8 @@ const AVFilter ff_vf_weave = { .priv_class = &weave_class, .query_formats = query_formats, .uninit = uninit, - .inputs = weave_inputs, - .outputs = weave_outputs, + FILTER_INPUTS(weave_inputs), + FILTER_OUTPUTS(weave_outputs), .flags = AVFILTER_FLAG_SLICE_THREADS, }; @@ -223,7 +221,7 @@ const AVFilter ff_vf_doubleweave = { .query_formats = query_formats, .init = init, .uninit = uninit, - .inputs = weave_inputs, - .outputs = weave_outputs, + FILTER_INPUTS(weave_inputs), + FILTER_OUTPUTS(weave_outputs), .flags = AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_xbr.c b/chromium/third_party/ffmpeg/libavfilter/vf_xbr.c index 1300693bac3..bb7b704abb2 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_xbr.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_xbr.c @@ -346,10 +346,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_0RGB32, AV_PIX_FMT_NONE, }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int filter_frame(AVFilterLink *inlink, AVFrame *in) @@ -370,7 +367,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.in = in; td.out = out; td.rgbtoyuv = s->rgbtoyuv; - ctx->internal->execute(ctx, s->func, &td, NULL, FFMIN(inlink->h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->func, &td, NULL, + FFMIN(inlink->h, ff_filter_get_nb_threads(ctx))); out->width = outlink->w; out->height = outlink->h; @@ -412,7 +410,6 @@ static const AVFilterPad xbr_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad xbr_outputs[] = { @@ -421,14 +418,13 @@ static const AVFilterPad xbr_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_xbr = { .name = "xbr", .description = NULL_IF_CONFIG_SMALL("Scale the input using xBR algorithm."), - .inputs = xbr_inputs, - .outputs = xbr_outputs, + FILTER_INPUTS(xbr_inputs), + FILTER_OUTPUTS(xbr_outputs), .query_formats = query_formats, .priv_size = sizeof(XBRContext), .priv_class = &xbr_class, diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_xfade.c b/chromium/third_party/ffmpeg/libavfilter/vf_xfade.c index 2e075cfb9aa..eff8a8b8549 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_xfade.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_xfade.c @@ -73,6 +73,7 @@ enum XFadeTransitions { WIPEBR, SQUEEZEH, SQUEEZEV, + ZOOMIN, NB_TRANSITIONS, }; @@ -137,10 +138,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static av_cold void uninit(AVFilterContext *ctx) @@ -199,6 +197,7 @@ static const AVOption xfade_options[] = { { "wipebr", "wipe br transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPEBR}, 0, 0, FLAGS, "transition" }, { "squeezeh", "squeeze h transition", 0, AV_OPT_TYPE_CONST, {.i64=SQUEEZEH}, 0, 0, FLAGS, "transition" }, { "squeezev", "squeeze v transition", 0, AV_OPT_TYPE_CONST, {.i64=SQUEEZEV}, 0, 0, FLAGS, "transition" }, + { "zoomin", "zoom in transition", 0, AV_OPT_TYPE_CONST, {.i64=ZOOMIN}, 0, 0, FLAGS, "transition" }, { "duration", "set cross fade duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64=1000000}, 0, 60000000, FLAGS }, { "offset", "set cross fade start relative to first input stream", OFFSET(offset), AV_OPT_TYPE_DURATION, {.i64=0}, INT64_MIN, INT64_MAX, FLAGS }, { "expr", "set expression for custom transition", OFFSET(custom_str), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS }, @@ -1632,6 +1631,50 @@ static void squeezev##name##_transition(AVFilterContext *ctx, SQUEEZEV_TRANSITION(8, uint8_t, 1) SQUEEZEV_TRANSITION(16, uint16_t, 2) +static void zoom(float *u, float *v, float amount) +{ + *u = 0.5f + ((*u - 0.5f) * amount); + *v = 0.5f + ((*v - 0.5f) * amount); +} + +#define ZOOMIN_TRANSITION(name, type, div) \ +static void zoomin##name##_transition(AVFilterContext *ctx, \ + const AVFrame *a, const AVFrame *b, AVFrame *out, \ + float progress, \ + int slice_start, int slice_end, int jobnr) \ +{ \ + XFadeContext *s = ctx->priv; \ + const float w = out->width; \ + const float h = out->height; \ + const float zf = smoothstep(0.5f, 1.f, progress); \ + \ + for (int p = 0; p < s->nb_planes; p++) { \ + const type *xf0 = (const type *)(a->data[p]); \ + const type *xf1 = (const type *)(b->data[p] + slice_start * b->linesize[p]); \ + type *dst = (type *)(out->data[p] + slice_start * out->linesize[p]); \ + \ + for (int y = slice_start; y < slice_end; y++) { \ + for (int x = 0; x < w; x++) { \ + float zv, u, v; \ + int iu, iv; \ + \ + u = x / w; \ + v = y / h; \ + zoom(&u, &v, zf); \ + iu = ceilf(u * (w - 1)); \ + iv = ceilf(v * (h - 1)); \ + zv = xf0[iu + iv * a->linesize[p] / div]; \ + dst[x] = mix(zv, xf1[x], smoothstep(0.f, 0.5f, progress)); \ + } \ + dst += out->linesize[p] / div; \ + xf1 += b->linesize[p] / div; \ + } \ + } \ +} + +ZOOMIN_TRANSITION(8, uint8_t, 1) +ZOOMIN_TRANSITION(16, uint16_t, 2) + static inline double getpix(void *priv, double x, double y, int plane, int nb) { XFadeContext *s = priv; @@ -1781,6 +1824,8 @@ static int config_output(AVFilterLink *outlink) case WIPEBR: s->transitionf = s->depth <= 8 ? wipebr8_transition : wipebr16_transition; break; case SQUEEZEH: s->transitionf = s->depth <= 8 ? squeezeh8_transition : squeezeh16_transition; break; case SQUEEZEV: s->transitionf = s->depth <= 8 ? squeezev8_transition : squeezev16_transition; break; + case ZOOMIN: s->transitionf = s->depth <= 8 ? zoomin8_transition : zoomin16_transition; break; + default: return AVERROR_BUG; } if (s->transition == CUSTOM) { @@ -1833,7 +1878,8 @@ static int xfade_frame(AVFilterContext *ctx, AVFrame *a, AVFrame *b) av_frame_copy_props(out, a); td.xf[0] = a, td.xf[1] = b, td.out = out, td.progress = progress; - ctx->internal->execute(ctx, xfade_slice, &td, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, xfade_slice, &td, NULL, + FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); out->pts = s->pts; @@ -1944,7 +1990,6 @@ static const AVFilterPad xfade_inputs[] = { .name = "xfade", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; static const AVFilterPad xfade_outputs[] = { @@ -1953,7 +1998,6 @@ static const AVFilterPad xfade_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_xfade = { @@ -1964,7 +2008,7 @@ const AVFilter ff_vf_xfade = { .query_formats = query_formats, .activate = xfade_activate, .uninit = uninit, - .inputs = xfade_inputs, - .outputs = xfade_outputs, + FILTER_INPUTS(xfade_inputs), + FILTER_OUTPUTS(xfade_outputs), .flags = AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_xfade_opencl.c b/chromium/third_party/ffmpeg/libavfilter/vf_xfade_opencl.c index 5b64ea2f08c..c24528eb890 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_xfade_opencl.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_xfade_opencl.c @@ -402,16 +402,15 @@ static const AVFilterPad xfade_opencl_inputs[] = { { .name = "main", .type = AVMEDIA_TYPE_VIDEO, - .get_video_buffer = get_video_buffer, + .get_buffer.video = get_video_buffer, .config_props = &ff_opencl_filter_config_input, }, { .name = "xfade", .type = AVMEDIA_TYPE_VIDEO, - .get_video_buffer = get_video_buffer, + .get_buffer.video = get_video_buffer, .config_props = &ff_opencl_filter_config_input, }, - { NULL } }; static const AVFilterPad xfade_opencl_outputs[] = { @@ -420,7 +419,6 @@ static const AVFilterPad xfade_opencl_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = &xfade_opencl_config_output, }, - { NULL } }; const AVFilter ff_vf_xfade_opencl = { @@ -432,7 +430,7 @@ const AVFilter ff_vf_xfade_opencl = { .uninit = &xfade_opencl_uninit, .query_formats = &ff_opencl_filter_query_formats, .activate = &xfade_opencl_activate, - .inputs = xfade_opencl_inputs, - .outputs = xfade_opencl_outputs, + FILTER_INPUTS(xfade_opencl_inputs), + FILTER_OUTPUTS(xfade_opencl_outputs), .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_xmedian.c b/chromium/third_party/ffmpeg/libavfilter/vf_xmedian.c index 168a5944dbb..a9e3255a2a7 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_xmedian.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_xmedian.c @@ -39,7 +39,7 @@ typedef struct XMedianContext { int planes; float percentile; - int tmedian; + int xmedian; int radius; int index; int depth; @@ -86,24 +86,15 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRAP, AV_PIX_FMT_GBRAP10, AV_PIX_FMT_GBRAP12, AV_PIX_FMT_GBRAP16, AV_PIX_FMT_NONE }; - AVFilterFormats *formats = ff_make_format_list(pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } static av_cold int init(AVFilterContext *ctx) { XMedianContext *s = ctx->priv; - int ret; - - s->tmedian = !strcmp(ctx->filter->name, "tmedian"); - if (!s->tmedian) { - s->radius = s->nb_inputs / 2; - } else { + if (!s->xmedian) s->nb_inputs = s->radius * 2 + 1; - } if (s->nb_inputs & 1) s->index = s->radius * 2.f * s->percentile; @@ -113,20 +104,6 @@ static av_cold int init(AVFilterContext *ctx) if (!s->frames) return AVERROR(ENOMEM); - for (int i = 0; i < s->nb_inputs && !s->tmedian; i++) { - AVFilterPad pad = { 0 }; - - pad.type = AVMEDIA_TYPE_VIDEO; - pad.name = av_asprintf("input%d", i); - if (!pad.name) - return AVERROR(ENOMEM); - - if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0) { - av_freep(&pad.name); - return ret; - } - } - return 0; } @@ -256,7 +233,8 @@ static int process_frame(FFFrameSync *fs) if (!ctx->is_disabled) { td.in = in; td.out = out; - ctx->internal->execute(ctx, s->median_frames, &td, NULL, FFMIN(s->height[1], ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->median_frames, &td, NULL, + FFMIN(s->height[1], ff_filter_get_nb_threads(ctx))); } return ff_filter_frame(outlink, out); @@ -274,7 +252,7 @@ static int config_output(AVFilterLink *outlink) FFFrameSyncIn *in; int i, ret; - for (int i = 1; i < s->nb_inputs && !s->tmedian; i++) { + for (int i = 1; i < s->nb_inputs && s->xmedian; i++) { if (ctx->inputs[i]->h != height || ctx->inputs[i]->w != width) { av_log(ctx, AV_LOG_ERROR, "Input %d size (%dx%d) does not match input %d size (%dx%d).\n", i, ctx->inputs[i]->w, ctx->inputs[i]->h, 0, width, height); return AVERROR(EINVAL); @@ -301,7 +279,7 @@ static int config_output(AVFilterLink *outlink) s->height[1] = s->height[2] = AV_CEIL_RSHIFT(inlink->h, s->desc->log2_chroma_h); s->height[0] = s->height[3] = inlink->h; - if (s->tmedian) + if (!s->xmedian) return 0; outlink->w = width; @@ -337,9 +315,7 @@ static av_cold void uninit(AVFilterContext *ctx) ff_framesync_uninit(&s->fs); - for (int i = 0; i < ctx->nb_inputs && !s->tmedian; i++) - av_freep(&ctx->input_pads[i].name); - for (int i = 0; i < s->nb_frames && s->frames && s->tmedian; i++) + for (int i = 0; i < s->nb_frames && s->frames && !s->xmedian; i++) av_frame_free(&s->frames[i]); av_freep(&s->frames); } @@ -368,6 +344,31 @@ static int process_command(AVFilterContext *ctx, const char *cmd, const char *ar return 0; } +#if CONFIG_XMEDIAN_FILTER +static av_cold int xmedian_init(AVFilterContext *ctx) +{ + XMedianContext *s = ctx->priv; + int ret; + + s->xmedian = 1; + + s->radius = s->nb_inputs / 2; + + for (int i = 0; i < s->nb_inputs; i++) { + AVFilterPad pad = { 0 }; + + pad.type = AVMEDIA_TYPE_VIDEO; + pad.name = av_asprintf("input%d", i); + if (!pad.name) + return AVERROR(ENOMEM); + + if ((ret = ff_append_inpad_free_name(ctx, &pad)) < 0) + return ret; + } + + return init(ctx); +} + #define OFFSET(x) offsetof(XMedianContext, x) #define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM #define TFLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_RUNTIME_PARAM @@ -385,10 +386,8 @@ static const AVFilterPad outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; -#if CONFIG_XMEDIAN_FILTER FRAMESYNC_DEFINE_CLASS(xmedian, XMedianContext, fs); const AVFilter ff_vf_xmedian = { @@ -397,9 +396,9 @@ const AVFilter ff_vf_xmedian = { .priv_size = sizeof(XMedianContext), .priv_class = &xmedian_class, .query_formats = query_formats, - .outputs = outputs, + FILTER_OUTPUTS(outputs), .preinit = xmedian_framesync_preinit, - .init = init, + .init = xmedian_init, .uninit = uninit, .activate = activate, .flags = AVFILTER_FLAG_DYNAMIC_INPUTS | AVFILTER_FLAG_SLICE_THREADS | @@ -443,7 +442,8 @@ static int tmedian_filter_frame(AVFilterLink *inlink, AVFrame *in) td.out = out; td.in = s->frames; - ctx->internal->execute(ctx, s->median_frames, &td, NULL, FFMIN(s->height[0], ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->median_frames, &td, NULL, + FFMIN(s->height[0], ff_filter_get_nb_threads(ctx))); return ff_filter_frame(outlink, out); } @@ -461,7 +461,6 @@ static const AVFilterPad tmedian_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = tmedian_filter_frame, }, - { NULL } }; static const AVFilterPad tmedian_outputs[] = { @@ -470,7 +469,6 @@ static const AVFilterPad tmedian_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; AVFILTER_DEFINE_CLASS(tmedian); @@ -481,8 +479,8 @@ const AVFilter ff_vf_tmedian = { .priv_size = sizeof(XMedianContext), .priv_class = &tmedian_class, .query_formats = query_formats, - .inputs = tmedian_inputs, - .outputs = tmedian_outputs, + FILTER_INPUTS(tmedian_inputs), + FILTER_OUTPUTS(tmedian_outputs), .init = init, .uninit = uninit, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_yadif.c b/chromium/third_party/ffmpeg/libavfilter/vf_yadif.c index 17269d6b96b..8b71e0584d6 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_yadif.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_yadif.c @@ -249,7 +249,8 @@ static void filter(AVFilterContext *ctx, AVFrame *dstpic, td.h = h; td.plane = i; - ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, filter_slice, &td, NULL, + FFMIN(h, ff_filter_get_nb_threads(ctx))); } emms_c(); @@ -284,10 +285,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_output(AVFilterLink *outlink) @@ -339,7 +337,6 @@ static const AVFilterPad avfilter_vf_yadif_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = ff_yadif_filter_frame, }, - { NULL } }; static const AVFilterPad avfilter_vf_yadif_outputs[] = { @@ -349,7 +346,6 @@ static const AVFilterPad avfilter_vf_yadif_outputs[] = { .request_frame = ff_yadif_request_frame, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_yadif = { @@ -359,7 +355,7 @@ const AVFilter ff_vf_yadif = { .priv_class = &yadif_class, .uninit = uninit, .query_formats = query_formats, - .inputs = avfilter_vf_yadif_inputs, - .outputs = avfilter_vf_yadif_outputs, + FILTER_INPUTS(avfilter_vf_yadif_inputs), + FILTER_OUTPUTS(avfilter_vf_yadif_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_yadif_cuda.c b/chromium/third_party/ffmpeg/libavfilter/vf_yadif_cuda.c index 5099f0a806b..5ddb9a9324b 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_yadif_cuda.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_yadif_cuda.c @@ -19,6 +19,7 @@ */ #include "libavutil/avassert.h" +#include "libavutil/hwcontext.h" #include "libavutil/hwcontext_cuda_internal.h" #include "libavutil/cuda_check.h" #include "internal.h" @@ -362,7 +363,6 @@ static const AVFilterPad deint_cuda_inputs[] = { .filter_frame = ff_yadif_filter_frame, .config_props = config_input, }, - { NULL } }; static const AVFilterPad deint_cuda_outputs[] = { @@ -372,7 +372,6 @@ static const AVFilterPad deint_cuda_outputs[] = { .request_frame = ff_yadif_request_frame, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_yadif_cuda = { @@ -382,8 +381,8 @@ const AVFilter ff_vf_yadif_cuda = { .priv_class = &yadif_cuda_class, .uninit = deint_cuda_uninit, .query_formats = deint_cuda_query_formats, - .inputs = deint_cuda_inputs, - .outputs = deint_cuda_outputs, + FILTER_INPUTS(deint_cuda_inputs), + FILTER_OUTPUTS(deint_cuda_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_yaepblur.c b/chromium/third_party/ffmpeg/libavfilter/vf_yaepblur.c index 3380f7112a6..983a2fec4f7 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_yaepblur.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_yaepblur.c @@ -83,7 +83,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } typedef struct ThreadData { @@ -253,12 +253,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) td.height = s->planeheight[plane]; td.src = in->data[plane]; td.src_linesize = in->linesize[plane]; - ctx->internal->execute(ctx, s->pre_calculate_row, &td, NULL, FFMIN(td.height, nb_threads)); - ctx->internal->execute(ctx, pre_calculate_col, &td, NULL, FFMIN(td.width, nb_threads)); + ff_filter_execute(ctx, s->pre_calculate_row, &td, NULL, + FFMIN(td.height, nb_threads)); + ff_filter_execute(ctx, pre_calculate_col, &td, NULL, + FFMIN(td.width, nb_threads)); td.dst = out->data[plane]; td.dst_linesize = out->linesize[plane]; - ctx->internal->execute(ctx, s->filter_slice, &td, NULL, FFMIN(td.height, nb_threads)); + ff_filter_execute(ctx, s->filter_slice, &td, NULL, + FFMIN(td.height, nb_threads)); } if (out != in) @@ -309,7 +312,6 @@ static const AVFilterPad yaep_inputs[] = { .config_props = config_input, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad yaep_outputs[] = { @@ -317,7 +319,6 @@ static const AVFilterPad yaep_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; #define OFFSET(x) offsetof(YAEPContext, x) @@ -342,8 +343,8 @@ const AVFilter ff_vf_yaepblur = { .priv_class = &yaepblur_class, .uninit = uninit, .query_formats = query_formats, - .inputs = yaep_inputs, - .outputs = yaep_outputs, + FILTER_INPUTS(yaep_inputs), + FILTER_OUTPUTS(yaep_outputs), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, .process_command = ff_filter_process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_zoompan.c b/chromium/third_party/ffmpeg/libavfilter/vf_zoompan.c index 9115c23dc48..92769f1fd17 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_zoompan.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_zoompan.c @@ -341,10 +341,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static av_cold void uninit(AVFilterContext *ctx) @@ -364,7 +361,6 @@ static const AVFilterPad inputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, - { NULL } }; static const AVFilterPad outputs[] = { @@ -373,7 +369,6 @@ static const AVFilterPad outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vf_zoompan = { @@ -385,6 +380,6 @@ const AVFilter ff_vf_zoompan = { .uninit = uninit, .query_formats = query_formats, .activate = activate, - .inputs = inputs, - .outputs = outputs, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vf_zscale.c b/chromium/third_party/ffmpeg/libavfilter/vf_zscale.c index d21de8d9dba..dfea00f9eb4 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vf_zscale.c +++ b/chromium/third_party/ffmpeg/libavfilter/vf_zscale.c @@ -914,7 +914,6 @@ static const AVFilterPad avfilter_vf_zscale_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL } }; static const AVFilterPad avfilter_vf_zscale_outputs[] = { @@ -923,7 +922,6 @@ static const AVFilterPad avfilter_vf_zscale_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_props, }, - { NULL } }; const AVFilter ff_vf_zscale = { @@ -934,7 +932,7 @@ const AVFilter ff_vf_zscale = { .priv_size = sizeof(ZScaleContext), .priv_class = &zscale_class, .uninit = uninit, - .inputs = avfilter_vf_zscale_inputs, - .outputs = avfilter_vf_zscale_outputs, + FILTER_INPUTS(avfilter_vf_zscale_inputs), + FILTER_OUTPUTS(avfilter_vf_zscale_outputs), .process_command = process_command, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/video.c b/chromium/third_party/ffmpeg/libavfilter/video.c index 0771268c40f..7ef04144e4d 100644 --- a/chromium/third_party/ffmpeg/libavfilter/video.c +++ b/chromium/third_party/ffmpeg/libavfilter/video.c @@ -28,6 +28,7 @@ #include "libavutil/imgutils.h" #include "avfilter.h" +#include "framepool.h" #include "internal.h" #include "video.h" @@ -100,8 +101,8 @@ AVFrame *ff_get_video_buffer(AVFilterLink *link, int w, int h) FF_TPRINTF_START(NULL, get_video_buffer); ff_tlog_link(NULL, link, 0); - if (link->dstpad->get_video_buffer) - ret = link->dstpad->get_video_buffer(link, w, h); + if (link->dstpad->get_buffer.video) + ret = link->dstpad->get_buffer.video(link, w, h); if (!ret) ret = ff_default_get_video_buffer(link, w, h); diff --git a/chromium/third_party/ffmpeg/libavfilter/vsink_nullsink.c b/chromium/third_party/ffmpeg/libavfilter/vsink_nullsink.c index 1c796b7cb8d..f21299c6f05 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vsink_nullsink.c +++ b/chromium/third_party/ffmpeg/libavfilter/vsink_nullsink.c @@ -32,13 +32,12 @@ static const AVFilterPad avfilter_vsink_nullsink_inputs[] = { .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, - { NULL }, }; const AVFilter ff_vsink_nullsink = { .name = "nullsink", .description = NULL_IF_CONFIG_SMALL("Do absolutely nothing with the input video."), .priv_size = 0, - .inputs = avfilter_vsink_nullsink_inputs, + FILTER_INPUTS(avfilter_vsink_nullsink_inputs), .outputs = NULL, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vsrc_cellauto.c b/chromium/third_party/ffmpeg/libavfilter/vsrc_cellauto.c index 250c88c8da7..9a62cfedc35 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vsrc_cellauto.c +++ b/chromium/third_party/ffmpeg/libavfilter/vsrc_cellauto.c @@ -311,10 +311,7 @@ static int request_frame(AVFilterLink *outlink) static int query_formats(AVFilterContext *ctx) { static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_MONOBLACK, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static const AVFilterPad cellauto_outputs[] = { @@ -324,7 +321,6 @@ static const AVFilterPad cellauto_outputs[] = { .request_frame = request_frame, .config_props = config_props, }, - { NULL } }; const AVFilter ff_vsrc_cellauto = { @@ -336,5 +332,5 @@ const AVFilter ff_vsrc_cellauto = { .uninit = uninit, .query_formats = query_formats, .inputs = NULL, - .outputs = cellauto_outputs, + FILTER_OUTPUTS(cellauto_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vsrc_gradients.c b/chromium/third_party/ffmpeg/libavfilter/vsrc_gradients.c index 904baf13606..863cfe9b5e0 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vsrc_gradients.c +++ b/chromium/third_party/ffmpeg/libavfilter/vsrc_gradients.c @@ -91,10 +91,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static uint32_t lerp_color(uint8_t c0[4], uint8_t c1[4], float x) @@ -280,8 +277,8 @@ static int activate(AVFilterContext *ctx) frame->sample_aspect_ratio = (AVRational) {1, 1}; frame->pts = s->pts++; - ctx->internal->execute(ctx, s->draw_slice, frame, NULL, - FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->draw_slice, frame, NULL, + FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); return ff_filter_frame(outlink, frame); } @@ -295,7 +292,6 @@ static const AVFilterPad gradients_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vsrc_gradients = { @@ -305,7 +301,7 @@ const AVFilter ff_vsrc_gradients = { .priv_class = &gradients_class, .query_formats = query_formats, .inputs = NULL, - .outputs = gradients_outputs, + FILTER_OUTPUTS(gradients_outputs), .activate = activate, .flags = AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vsrc_life.c b/chromium/third_party/ffmpeg/libavfilter/vsrc_life.c index ca12f294b85..2165d1a70f7 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vsrc_life.c +++ b/chromium/third_party/ffmpeg/libavfilter/vsrc_life.c @@ -416,7 +416,6 @@ static int query_formats(AVFilterContext *ctx) { LifeContext *life = ctx->priv; enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_NONE, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list; if (life->mold || memcmp(life-> life_color, "\xff\xff\xff", 3) || memcmp(life->death_color, "\x00\x00\x00", 3)) { @@ -427,8 +426,7 @@ static int query_formats(AVFilterContext *ctx) life->draw = fill_picture_monoblack; } - fmts_list = ff_make_format_list(pix_fmts); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static const AVFilterPad life_outputs[] = { @@ -438,7 +436,6 @@ static const AVFilterPad life_outputs[] = { .request_frame = request_frame, .config_props = config_props, }, - { NULL} }; const AVFilter ff_vsrc_life = { @@ -450,5 +447,5 @@ const AVFilter ff_vsrc_life = { .uninit = uninit, .query_formats = query_formats, .inputs = NULL, - .outputs = life_outputs, + FILTER_OUTPUTS(life_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vsrc_mandelbrot.c b/chromium/third_party/ffmpeg/libavfilter/vsrc_mandelbrot.c index 88c14f0d489..df8584b37ca 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vsrc_mandelbrot.c +++ b/chromium/third_party/ffmpeg/libavfilter/vsrc_mandelbrot.c @@ -153,10 +153,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int config_props(AVFilterLink *inlink) @@ -416,7 +413,6 @@ static const AVFilterPad mandelbrot_outputs[] = { .request_frame = request_frame, .config_props = config_props, }, - { NULL } }; const AVFilter ff_vsrc_mandelbrot = { @@ -428,5 +424,5 @@ const AVFilter ff_vsrc_mandelbrot = { .uninit = uninit, .query_formats = query_formats, .inputs = NULL, - .outputs = mandelbrot_outputs, + FILTER_OUTPUTS(mandelbrot_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vsrc_mptestsrc.c b/chromium/third_party/ffmpeg/libavfilter/vsrc_mptestsrc.c index 8aa75a24acb..f94a78fb848 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vsrc_mptestsrc.c +++ b/chromium/third_party/ffmpeg/libavfilter/vsrc_mptestsrc.c @@ -296,10 +296,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int request_frame(AVFilterLink *outlink) @@ -354,7 +351,6 @@ static const AVFilterPad mptestsrc_outputs[] = { .request_frame = request_frame, .config_props = config_props, }, - { NULL } }; const AVFilter ff_vsrc_mptestsrc = { @@ -365,5 +361,5 @@ const AVFilter ff_vsrc_mptestsrc = { .init = init, .query_formats = query_formats, .inputs = NULL, - .outputs = mptestsrc_outputs, + FILTER_OUTPUTS(mptestsrc_outputs), }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vsrc_sierpinski.c b/chromium/third_party/ffmpeg/libavfilter/vsrc_sierpinski.c index 7db4852892b..d3d136f7ae7 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vsrc_sierpinski.c +++ b/chromium/third_party/ffmpeg/libavfilter/vsrc_sierpinski.c @@ -78,10 +78,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int fill_sierpinski(SierpinskiContext *s, int x, int y) @@ -194,7 +191,8 @@ static void draw_sierpinski(AVFilterContext *ctx, AVFrame *frame) s->pos_y--; } - ctx->internal->execute(ctx, s->draw_slice, frame, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); + ff_filter_execute(ctx, s->draw_slice, frame, NULL, + FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); } static int sierpinski_request_frame(AVFilterLink *link) @@ -220,7 +218,6 @@ static const AVFilterPad sierpinski_outputs[] = { .request_frame = sierpinski_request_frame, .config_props = config_output, }, - { NULL } }; const AVFilter ff_vsrc_sierpinski = { @@ -230,6 +227,6 @@ const AVFilter ff_vsrc_sierpinski = { .priv_class = &sierpinski_class, .query_formats = query_formats, .inputs = NULL, - .outputs = sierpinski_outputs, + FILTER_OUTPUTS(sierpinski_outputs), .flags = AVFILTER_FLAG_SLICE_THREADS, }; diff --git a/chromium/third_party/ffmpeg/libavfilter/vsrc_testsrc.c b/chromium/third_party/ffmpeg/libavfilter/vsrc_testsrc.c index 0ced726f5e0..646e8257aab 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vsrc_testsrc.c +++ b/chromium/third_party/ffmpeg/libavfilter/vsrc_testsrc.c @@ -263,7 +263,6 @@ static const AVFilterPad color_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = color_config_props, }, - { NULL } }; const AVFilter ff_vsrc_color = { @@ -276,7 +275,7 @@ const AVFilter ff_vsrc_color = { .activate = activate, .query_formats = color_query_formats, .inputs = NULL, - .outputs = color_outputs, + FILTER_OUTPUTS(color_outputs), .process_command = color_process_command, }; @@ -376,10 +375,7 @@ static int haldclutsrc_query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE, }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int haldclutsrc_config_props(AVFilterLink *outlink) @@ -397,7 +393,6 @@ static const AVFilterPad haldclutsrc_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = haldclutsrc_config_props, }, - { NULL } }; const AVFilter ff_vsrc_haldclutsrc = { @@ -410,7 +405,7 @@ const AVFilter ff_vsrc_haldclutsrc = { .query_formats = haldclutsrc_query_formats, .activate = activate, .inputs = NULL, - .outputs = haldclutsrc_outputs, + FILTER_OUTPUTS(haldclutsrc_outputs), }; #endif /* CONFIG_HALDCLUTSRC_FILTER */ @@ -435,7 +430,6 @@ static const AVFilterPad nullsrc_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_props, }, - { NULL }, }; const AVFilter ff_vsrc_nullsrc = { @@ -447,7 +441,7 @@ const AVFilter ff_vsrc_nullsrc = { .priv_size = sizeof(TestSourceContext), .priv_class = &nullsrc_class, .inputs = NULL, - .outputs = nullsrc_outputs, + FILTER_OUTPUTS(nullsrc_outputs), }; #endif /* CONFIG_NULLSRC_FILTER */ @@ -659,10 +653,7 @@ static int test_query_formats(AVFilterContext *ctx) AV_PIX_FMT_RGB24, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static const AVFilterPad avfilter_vsrc_testsrc_outputs[] = { @@ -671,7 +662,6 @@ static const AVFilterPad avfilter_vsrc_testsrc_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_props, }, - { NULL } }; const AVFilter ff_vsrc_testsrc = { @@ -684,7 +674,7 @@ const AVFilter ff_vsrc_testsrc = { .query_formats = test_query_formats, .activate = activate, .inputs = NULL, - .outputs = avfilter_vsrc_testsrc_outputs, + FILTER_OUTPUTS(avfilter_vsrc_testsrc_outputs), }; #endif /* CONFIG_TESTSRC_FILTER */ @@ -718,8 +708,8 @@ static uint32_t color_gradient(unsigned index) case 3: return 0x0000FF + (sd << 8); case 4: return 0x0000FF + (si << 16); case 5: return 0xFF0000 + (sd << 0); + default: av_assert0(0); return 0; } - av_assert0(0); } static void draw_text(TestSourceContext *s, AVFrame *frame, FFDrawColor *color, @@ -944,7 +934,6 @@ static const AVFilterPad avfilter_vsrc_testsrc2_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = test2_config_props, }, - { NULL } }; const AVFilter ff_vsrc_testsrc2 = { @@ -957,7 +946,7 @@ const AVFilter ff_vsrc_testsrc2 = { .query_formats = test2_query_formats, .activate = activate, .inputs = NULL, - .outputs = avfilter_vsrc_testsrc2_outputs, + FILTER_OUTPUTS(avfilter_vsrc_testsrc2_outputs), }; #endif /* CONFIG_TESTSRC2_FILTER */ @@ -1097,10 +1086,7 @@ static int rgbtest_query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int rgbtest_config_props(AVFilterLink *outlink) @@ -1119,7 +1105,6 @@ static const AVFilterPad avfilter_vsrc_rgbtestsrc_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = rgbtest_config_props, }, - { NULL } }; const AVFilter ff_vsrc_rgbtestsrc = { @@ -1132,7 +1117,7 @@ const AVFilter ff_vsrc_rgbtestsrc = { .query_formats = rgbtest_query_formats, .activate = activate, .inputs = NULL, - .outputs = avfilter_vsrc_rgbtestsrc_outputs, + FILTER_OUTPUTS(avfilter_vsrc_rgbtestsrc_outputs), }; #endif /* CONFIG_RGBTESTSRC_FILTER */ @@ -1274,10 +1259,7 @@ static int yuvtest_query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static int yuvtest_config_props(AVFilterLink *outlink) @@ -1295,7 +1277,6 @@ static const AVFilterPad avfilter_vsrc_yuvtestsrc_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = yuvtest_config_props, }, - { NULL } }; const AVFilter ff_vsrc_yuvtestsrc = { @@ -1308,7 +1289,7 @@ const AVFilter ff_vsrc_yuvtestsrc = { .query_formats = yuvtest_query_formats, .activate = activate, .inputs = NULL, - .outputs = avfilter_vsrc_yuvtestsrc_outputs, + FILTER_OUTPUTS(avfilter_vsrc_yuvtestsrc_outputs), }; #endif /* CONFIG_YUVTESTSRC_FILTER */ @@ -1426,10 +1407,7 @@ static int smptebars_query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE, }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static const AVFilterPad smptebars_outputs[] = { @@ -1438,7 +1416,6 @@ static const AVFilterPad smptebars_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_props, }, - { NULL } }; #if CONFIG_PAL75BARS_FILTER @@ -1485,7 +1462,7 @@ const AVFilter ff_vsrc_pal75bars = { .query_formats = smptebars_query_formats, .activate = activate, .inputs = NULL, - .outputs = smptebars_outputs, + FILTER_OUTPUTS(smptebars_outputs), }; #endif /* CONFIG_PAL75BARS_FILTER */ @@ -1532,7 +1509,7 @@ const AVFilter ff_vsrc_pal100bars = { .query_formats = smptebars_query_formats, .activate = activate, .inputs = NULL, - .outputs = smptebars_outputs, + FILTER_OUTPUTS(smptebars_outputs), }; #endif /* CONFIG_PAL100BARS_FILTER */ @@ -1600,7 +1577,7 @@ const AVFilter ff_vsrc_smptebars = { .query_formats = smptebars_query_formats, .activate = activate, .inputs = NULL, - .outputs = smptebars_outputs, + FILTER_OUTPUTS(smptebars_outputs), }; #endif /* CONFIG_SMPTEBARS_FILTER */ @@ -1706,7 +1683,7 @@ const AVFilter ff_vsrc_smptehdbars = { .query_formats = smptebars_query_formats, .activate = activate, .inputs = NULL, - .outputs = smptebars_outputs, + FILTER_OUTPUTS(smptebars_outputs), }; #endif /* CONFIG_SMPTEHDBARS_FILTER */ @@ -1759,10 +1736,7 @@ static int allyuv_query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static const AVFilterPad avfilter_vsrc_allyuv_outputs[] = { @@ -1771,7 +1745,6 @@ static const AVFilterPad avfilter_vsrc_allyuv_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = config_props, }, - { NULL } }; const AVFilter ff_vsrc_allyuv = { @@ -1784,7 +1757,7 @@ const AVFilter ff_vsrc_allyuv = { .query_formats = allyuv_query_formats, .activate = activate, .inputs = NULL, - .outputs = avfilter_vsrc_allyuv_outputs, + FILTER_OUTPUTS(avfilter_vsrc_allyuv_outputs), }; #endif /* CONFIG_ALLYUV_FILTER */ @@ -1836,10 +1809,7 @@ static int allrgb_query_formats(AVFilterContext *ctx) AV_PIX_FMT_RGB24, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static const AVFilterPad avfilter_vsrc_allrgb_outputs[] = { @@ -1848,7 +1818,6 @@ static const AVFilterPad avfilter_vsrc_allrgb_outputs[] = { .type = AVMEDIA_TYPE_VIDEO, .config_props = allrgb_config_props, }, - { NULL } }; const AVFilter ff_vsrc_allrgb = { @@ -1861,7 +1830,7 @@ const AVFilter ff_vsrc_allrgb = { .query_formats = allrgb_query_formats, .activate = activate, .inputs = NULL, - .outputs = avfilter_vsrc_allrgb_outputs, + FILTER_OUTPUTS(avfilter_vsrc_allrgb_outputs), }; #endif /* CONFIG_ALLRGB_FILTER */ diff --git a/chromium/third_party/ffmpeg/libavfilter/vulkan.c b/chromium/third_party/ffmpeg/libavfilter/vulkan.c index 0ac5711182e..337c8d7d5ad 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vulkan.c +++ b/chromium/third_party/ffmpeg/libavfilter/vulkan.c @@ -594,11 +594,8 @@ int ff_vk_filter_query_formats(AVFilterContext *avctx) static const enum AVPixelFormat pixel_formats[] = { AV_PIX_FMT_VULKAN, AV_PIX_FMT_NONE, }; - AVFilterFormats *pix_fmts = ff_make_format_list(pixel_formats); - if (!pix_fmts) - return AVERROR(ENOMEM); - return ff_set_common_formats(avctx, pix_fmts); + return ff_set_common_formats_from_list(avctx, pixel_formats); } static int vulkan_filter_set_device(AVFilterContext *avctx, diff --git a/chromium/third_party/ffmpeg/libavfilter/x86/vf_gblur.asm b/chromium/third_party/ffmpeg/libavfilter/x86/vf_gblur.asm index 4d84e6d011c..c0d57cc82b3 100644 --- a/chromium/third_party/ffmpeg/libavfilter/x86/vf_gblur.asm +++ b/chromium/third_party/ffmpeg/libavfilter/x86/vf_gblur.asm @@ -20,17 +20,616 @@ %include "libavutil/x86/x86util.asm" +SECTION .data + +gblur_transpose_16x16_indices1: dq 2, 3, 0, 1, 6, 7, 4, 5 +gblur_transpose_16x16_indices2: dq 1, 0, 3, 2, 5, 4, 7, 6 +gblur_transpose_16x16_indices3: dd 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 +gblur_transpose_16x16_mask: dw 0xcc, 0x33, 0xaa, 0x55, 0xaaaa, 0x5555 +gblur_vindex_width: dd 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 + SECTION .text -; void ff_horiz_slice_sse4(float *ptr, int width, int height, int steps, -; float nu, float bscale) +%xdefine AVX2_MMSIZE 32 +%xdefine AVX512_MMSIZE 64 + +%macro MOVSXDIFNIDN 1-* + %rep %0 + movsxdifnidn %1q, %1d + %rotate 1 + %endrep +%endmacro + +%macro KXNOR 2-* +%if mmsize == AVX512_MMSIZE + kxnorw %2, %2, %2 +%else + %if %0 == 3 + mov %3, -1 + %else + vpcmpeqd %1, %1, %1 + %endif +%endif +%endmacro + +%macro KMOVW 2-4 +%if mmsize == AVX2_MMSIZE && %0 == 4 + mova %1, %2 +%elif mmsize == AVX512_MMSIZE + %if %0 == 4 + %rotate 2 + %endif + kmovw %1, %2 +%endif +%endmacro + +%macro PUSH_MASK 5 +%if mmsize == AVX2_MMSIZE + %assign %%n mmsize/4 + %assign %%i 0 + %rep %%n + mov %4, %3 + and %4, 1 + neg %4 + mov dword [%5 + %%i*4], %4 + sar %3, 1 + %assign %%i %%i+1 + %endrep + movu %1, [%5] +%else + kmovd %2, %3 +%endif +%endmacro + +%macro VMASKMOVPS 4 +%if mmsize == AVX2_MMSIZE + vpmaskmovd %1, %3, %2 +%else + kmovw k7, %4 + vmovups %1{k7}, %2 +%endif +%endmacro + +%macro VGATHERDPS 4 +%if mmsize == AVX2_MMSIZE + vgatherdps %1, %2, %3 +%else + vgatherdps %1{%4}, %2 +%endif +%endmacro + +%macro VSCATTERDPS128 7 + %rep 4 + mov %7, %6 + and %7, 1 + cmp %7, 0 + je %%end_scatter + movss [%2 + %3*%4], xm%1 + vpshufd m%1, m%1, 0x39 + add %3, %5 + sar %6, 1 + %endrep + %%end_scatter: +%endmacro + +; %1=register index +; %2=base address %3=vindex +; %4=scale %5=width +; %6=mask %7=tmp +; m15=reserved +%macro VSCATTERDPS256 7 + mova m15, m%1 + xor %3, %3 + VSCATTERDPS128 15, %2, %3, %4, %5, %6, %7 + vextractf128 xm15, m%1, 1 + VSCATTERDPS128 15, %2, %3, %4, %5, %6, %7 +%endmacro + +; %1=base address %2=avx2 vindex +; %3=avx512 vindex %4=avx2 mask +; %5=avx512 mask %6=register index +; %7=width %8-*=tmp +%macro VSCATTERDPS 8-* +%if mmsize == AVX2_MMSIZE + %if %0 == 9 + mov %9, %4 + VSCATTERDPS256 %6, %1, %2, 4, %7, %9, %8 + %else + VSCATTERDPS256 %6, %1, %2, 4, %7, %4, %8 + %endif +%else + vscatterdps [%1 + %3*4]{%5}, m%6 +%endif +%endmacro + +%macro INIT_WORD_MASK 1-* + %assign %%i 0 + %rep %0 + kmovw %1, [gblur_transpose_16x16_mask + %%i * 2] + %assign %%i %%i+1 + %rotate 1 + %endrep +%endmacro + +%macro INIT_INDICES 1-* + %assign %%i 1 + %rep %0 + movu %1, [gblur_transpose_16x16_indices %+ %%i] + %assign %%i %%i+1 + %rotate 1 + %endrep +%endmacro + +%assign stack_offset 0 +%macro PUSH_MM 1 +%if mmsize == AVX2_MMSIZE + movu [rsp + stack_offset], %1 + %assign stack_offset stack_offset+mmsize +%endif +%endmacro + +%macro POP_MM 1 +%if mmsize == AVX2_MMSIZE + %assign stack_offset stack_offset-mmsize + movu %1, [rsp + stack_offset] +%endif +%endmacro + +%macro READ_LOCAL_BUFFER 1 + %if mmsize == AVX512_MMSIZE + %assign %%i 19 + %else + %assign %%i 9 + %endif + %assign %%j %%i-1 + %assign %%k %1-1 + %xdefine %%m m %+ %%i + mova %%m, m3 + FMULADD_PS %%m, %%m, m0, [localbufq + %%k * mmsize], %%m + %assign %%k %%k-1 + %rep %1-1 + %xdefine %%m m %+ %%j + mova %%m, m %+ %%i + FMULADD_PS %%m, %%m, m0, [localbufq + %%k * mmsize], %%m + %assign %%i %%i-1 + %assign %%j %%j-1 + %assign %%k %%k-1 + %endrep + %if mmsize == AVX512_MMSIZE + mova m3, m %+ %%i + %endif +%endmacro + +%macro FMADD_WRITE 4 + FMULADD_PS %1, %1, %2, %3, %1 + mova %4, %1 +%endmacro + +%macro WRITE_LOCAL_BUFFER_INTERNAL 8-16 + %assign %%i 0 + %rep %0 + FMADD_WRITE m3, m0, m %+ %1, [localbufq + %%i * mmsize] + %assign %%i %%i+1 + %rotate 1 + %endrep +%endmacro + +%macro GATHERPS 1 + %if mmsize == AVX512_MMSIZE + %assign %%i 4 + %else + %assign %%i 2 + %endif + movu m %+ %%i, [ptrq] + mov strideq, widthq + %assign %%i %%i+1 + %rep %1-2 + movu m %+ %%i, [ptrq + strideq*4] + add strideq, widthq + %assign %%i %%i+1 + %endrep + movu m %+ %%i, [ptrq + strideq*4] +%endmacro + +%macro SCATTERPS_INTERNAL 8-16 + movu [ptrq + strideq*0], m %+ %1 + mov strideq, widthq + %rotate 1 + %rep %0-2 + movu [ptrq + strideq*4], m %+ %1 + add strideq, widthq + %rotate 1 + %endrep + movu [ptrq + strideq*4], m %+ %1 +%endmacro + +%macro BATCH_INSERT64X4 4-* + %assign %%imm8 %1 + %rotate 1 + %rep (%0-1)/3 + vinserti64x4 m%1, m%2, ym%3, %%imm8 + %rotate 3 + %endrep +%endmacro + +%macro BATCH_EXTRACT_INSERT 2-* + %assign %%imm8 %1 + %rotate 1 + %rep (%0-1)/2 + vextractf64x4 ym%1, m%1, %%imm8 + vextractf64x4 ym%2, m%2, %%imm8 + vinserti64x4 m%1, m%1, ym%2, %%imm8 + %rotate 2 + %endrep +%endmacro + +%macro BATCH_MOVE 2-* + %rep %0/2 + mova m%1, m%2 + %rotate 2 + %endrep +%endmacro + +%macro BATCH_PERMUTE 3-* + %xdefine %%decorator %1 + %xdefine %%mask %2 + %assign %%index %3 + %rotate 3 + %rep (%0-3)/2 + vperm %+ %%decorator m%1{%%mask}, m %+ %%index, m%2 + %rotate 2 + %endrep +%endmacro + +; input : m3-m19 +; output: m8 m5 m9 m15 m16 m7 m17 m27 m24 m21 m25 m19 m12 m23 m13 m11 +%macro TRANSPOSE_16X16_AVX512 0 + BATCH_INSERT64X4 0x1, 20,4,12, 21,5,13, 22,6,14, 23,7,15 + BATCH_INSERT64X4 0x1, 24,8,16, 25,9,17, 26,10,18, 27,11,19 + + BATCH_EXTRACT_INSERT 0x1, 4,12, 5,13, 6,14, 7,15 + BATCH_EXTRACT_INSERT 0x1, 8,16, 9,17, 10,18, 11,19 + + BATCH_MOVE 12,20, 13,21, 14,22, 15,23 + BATCH_PERMUTE q, k6, 28, 12,24, 13,25, 14,26, 15,27 + BATCH_PERMUTE q, k5, 28, 24,20, 25,21, 26,22, 27,23 + + BATCH_MOVE 16,4, 17,5, 18,6, 19,7 + BATCH_PERMUTE q, k6, 28, 16,8, 17,9, 18,10, 19,11 + BATCH_PERMUTE q, k5, 28, 8,4, 9,5, 10,6, 11,7 + + BATCH_MOVE 4,12, 5,13, 6,24, 7,25 + BATCH_MOVE 20,16, 21,17, 22,8, 23,9 + + BATCH_PERMUTE q, k4, 29, 4,14, 5,15, 6,26, 7,27 + BATCH_PERMUTE q, k3, 29, 14,12, 15,13, 26,24, 27,25 + BATCH_PERMUTE q, k4, 29, 20,18, 21,19, 22,10, 23,11 + BATCH_PERMUTE q, k3, 29, 18,16, 19,17, 10,8, 11,9 + + BATCH_MOVE 8,4, 9,14, 16,6, 17,26 + BATCH_MOVE 24,20, 25,18, 12,22, 13,10 + + BATCH_PERMUTE d, k2, 30, 8,5, 9,15, 16,7, 17,27 + BATCH_PERMUTE d, k1, 30, 5,4, 15,14, 7,6, 27,26 + BATCH_PERMUTE d, k2, 30, 24,21, 25,19, 12,23, 13,11 + BATCH_PERMUTE d, k1, 30, 21,20, 19,18, 23,22, 11,10 +%endmacro + +%macro INSERT_UNPACK 8 + vinsertf128 m%5, m%1, xm%3, 0x1 + vinsertf128 m%6, m%2, xm%4, 0x1 + vunpcklpd m%7, m%5, m%6 + vunpckhpd m%8, m%5, m%6 +%endmacro + +%macro SHUFFLE 4 + vshufps m%3, m%1, m%2, 0x88 + vshufps m%4, m%1, m%2, 0xDD + mova m%1, m%3 + mova m%2, m%4 +%endmacro + +%macro EXTRACT_INSERT_UNPACK 6 + vextractf128 xm%1, m%1, 0x1 + vextractf128 xm%2, m%2, 0x1 + vinsertf128 m%3, m%3, xm%1, 0x0 + vinsertf128 m%4, m%4, xm%2, 0x0 + vunpcklpd m%5, m%3, m%4 + vunpckhpd m%6, m%3, m%4 +%endmacro + +; Transpose 8x8 AVX2 +; Limit the number ym# register to 16 for compatibility +; Used up registers instead of using stack memory +; Input: m2-m9 +; Output: m12, m14, m13, m15, m8, m10, m9, m11 +%macro TRANSPOSE_8X8_AVX2 0 + INSERT_UNPACK 2, 3, 6, 7, 10, 11, 12, 13 + INSERT_UNPACK 4, 5, 8, 9, 10, 11, 14, 15 + + SHUFFLE 12, 14, 10, 11 + SHUFFLE 13, 15, 10, 11 + + EXTRACT_INSERT_UNPACK 4, 5, 8, 9, 10, 11 + EXTRACT_INSERT_UNPACK 2, 3, 6, 7, 8, 9 + + SHUFFLE 8, 10, 6, 7 + SHUFFLE 9, 11, 6, 7 +%endmacro + +%macro TRANSPOSE 0 + %if cpuflag(avx512) + TRANSPOSE_16X16_AVX512 + %elif cpuflag(avx2) + TRANSPOSE_8X8_AVX2 + %endif +%endmacro + +%macro WRITE_LOCAL_BUFFER 0 + %if cpuflag(avx512) + WRITE_LOCAL_BUFFER_INTERNAL 8, 5, 9, 15, 16, 7, 17, 27, \ + 24, 21, 25, 19, 12, 23, 13, 11 + %elif cpuflag(avx2) + WRITE_LOCAL_BUFFER_INTERNAL 12, 14, 13, 15, 8, 10, 9, 11 + %endif +%endmacro + +%macro SCATTERPS 0 + %if cpuflag(avx512) + SCATTERPS_INTERNAL 8, 5, 9, 15, 16, 7, 17, 27, \ + 24, 21, 25, 19, 12, 23, 13, 11 + %elif cpuflag(avx2) + SCATTERPS_INTERNAL 12, 14, 13, 15, 8, 10, 9, 11 + %endif +%endmacro + +%macro OPTIMIZED_LOOP_STEP 0 + lea stepd, [stepsd - 1] + cmp stepd, 0 + jle %%bscale_scalar +%%loop_step: + sub localbufq, mmsize + mulps m3, m1 + movu [localbufq], m3 + + ; Filter leftwards + lea xq, [widthq - 1] + %%loop_step_x_back: + sub localbufq, mmsize + FMULADD_PS m3, m3, m0, [localbufq], m3 + movu [localbufq], m3 + + dec xq + cmp xq, 0 + jg %%loop_step_x_back + + ; Filter rightwards + mulps m3, m1 + movu [localbufq], m3 + add localbufq, mmsize + + lea xq, [widthq - 1] + %%loop_step_x: + FMULADD_PS m3, m3, m0, [localbufq], m3 + movu [localbufq], m3 + add localbufq, mmsize + + dec xq + cmp xq, 0 + jg %%loop_step_x + + dec stepd + cmp stepd, 0 + jg %%loop_step + +%%bscale_scalar: +%endmacro +;*************************************************************************** +; void ff_horiz_slice(float *ptr, int width, int height, int steps, +; float nu, float bscale) +;*************************************************************************** %macro HORIZ_SLICE 0 %if UNIX64 +%if cpuflag(avx512) || cpuflag(avx2) +cglobal horiz_slice, 5, 12, mmnum, 0-mmsize*4, buffer, width, height, steps, \ + localbuf, x, y, step, stride, remain, ptr, mask +%else cglobal horiz_slice, 4, 9, 9, ptr, width, height, steps, x, y, step, stride, remain +%endif +%else +%if cpuflag(avx512) || cpuflag(avx2) +cglobal horiz_slice, 5, 12, mmnum, 0-mmsize*4, buffer, width, height, steps, nu, bscale, \ + localbuf, x, y, step, stride, remain, ptr, mask %else cglobal horiz_slice, 4, 9, 9, ptr, width, height, steps, nu, bscale, x, y, step, stride, remain %endif +%endif +%if cpuflag(avx512) || cpuflag(avx2) +%assign rows mmsize/4 +%assign cols mmsize/4 +%if WIN64 + VBROADCASTSS m0, num ; nu + VBROADCASTSS m1, bscalem ; bscale + + mov nuq, localbufm + DEFINE_ARGS buffer, width, height, steps, \ + localbuf, x, y, step, stride, remain, ptr, mask + MOVSXDIFNIDN width, height, steps +%else + VBROADCASTSS m0, xmm0 ; nu + VBROADCASTSS m1, xmm1 ; bscale +%endif + +%if cpuflag(avx512) + vpbroadcastd m2, widthd + INIT_WORD_MASK k6, k5, k4, k3, k2, k1 + INIT_INDICES m28, m29, m30 +%else + movd xm2, widthd + VBROADCASTSS m2, xm2 +%endif + + vpmulld m2, m2, [gblur_vindex_width] ; vindex width + + xor yq, yq ; y = 0 + xor xq, xq ; x = 0 + + cmp heightq, rows + jl .y_scalar + sub heightq, rows + +.loop_y: + ; ptr = buffer + y * width; + mov ptrq, yq + imul ptrq, widthq + lea ptrq, [bufferq + ptrq*4] + + KXNOR m5, k7 + VGATHERDPS m3, [ptrq + m2*4], m5, k7 + mulps m3, m1 + movu [localbufq], m3 + add ptrq, 4 + add localbufq, mmsize + + ; Filter rightwards + PUSH_MM m2 + lea xq, [widthq - 1] + .loop_x: + PUSH_MM m3 + GATHERPS cols + TRANSPOSE + POP_MM m3 + WRITE_LOCAL_BUFFER + + add ptrq, mmsize + add localbufq, rows * mmsize + sub xq, cols + cmp xq, cols + jge .loop_x + POP_MM m2 + + cmp xq, 0 + jle .bscale_scalar + .loop_x_scalar: + KXNOR m5, k7 + VGATHERDPS m4, [ptrq + m2*4], m5, k7 + FMULADD_PS m3, m3, m0, m4, m3 + movu [localbufq], m3 + + add ptrq, 0x4 + add localbufq, mmsize + dec xq + cmp xq, 0 + jg .loop_x_scalar + + OPTIMIZED_LOOP_STEP + + .bscale_scalar: + sub ptrq, 4 + sub localbufq, mmsize + mulps m3, m1 + KXNOR m5, k7, maskq + VSCATTERDPS ptrq, strideq, m2, maskq, k7, 3, widthq, remainq + + ; Filter leftwards + PUSH_MM m2 + lea xq, [widthq - 1] + .loop_x_back: + sub localbufq, rows * mmsize + READ_LOCAL_BUFFER cols + PUSH_MM m2 + TRANSPOSE + POP_MM m3 + sub ptrq, mmsize + SCATTERPS + + sub xq, cols + cmp xq, cols + jge .loop_x_back + POP_MM m2 + + cmp xq, 0 + jle .end_loop_x + .loop_x_back_scalar: + sub ptrq, 0x4 + sub localbufq, mmsize + FMULADD_PS m3, m3, m0, [localbufq], m3 + KXNOR m5, k7, maskq + VSCATTERDPS ptrq, strideq, m2, maskq, k7, 3, widthq, remainq + + dec xq + cmp xq, 0 + jg .loop_x_back_scalar + + .end_loop_x: + + add yq, rows + cmp yq, heightq + jle .loop_y + + add heightq, rows + cmp yq, heightq + jge .end_scalar + + mov remainq, widthq + imul remainq, mmsize + add ptrq, remainq + +.y_scalar: + mov remainq, heightq + sub remainq, yq + mov maskq, 1 + shlx maskq, maskq, remainq + sub maskq, 1 + mov remainq, maskq + PUSH_MASK m5, k1, remaind, xd, rsp + 0x20 + + mov ptrq, yq + imul ptrq, widthq + lea ptrq, [bufferq + ptrq * 4] ; ptrq = buffer + y * width + KMOVW m6, m5, k7, k1 + VGATHERDPS m3, [ptrq + m2 * 4], m6, k7 + mulps m3, m1 ; p0 *= bscale + movu [localbufq], m3 + add localbufq, mmsize + + ; Filter rightwards + lea xq, [widthq - 1] + .y_scalar_loop_x: + add ptrq, 4 + KMOVW m6, m5, k7, k1 + VGATHERDPS m4, [ptrq + m2 * 4], m6, k7 + FMULADD_PS m3, m3, m0, m4, m3 + movu [localbufq], m3 + add localbufq, mmsize + + dec xq + cmp xq, 0 + jg .y_scalar_loop_x + + OPTIMIZED_LOOP_STEP + + sub localbufq, mmsize + mulps m3, m1 ; p0 *= bscale + KMOVW k7, k1 + VSCATTERDPS ptrq, strideq, m2, maskq, k7, 3, widthq, remainq, heightq + + ; Filter leftwards + lea xq, [widthq - 1] + .y_scalar_loop_x_back: + sub ptrq, 4 + sub localbufq, mmsize + FMULADD_PS m3, m3, m0, [localbufq], m3 + KMOVW k7, k1 + VSCATTERDPS ptrq, strideq, m2, maskq, k7, 3, widthq, remainq, heightq + dec xq + cmp xq, 0 + jg .y_scalar_loop_x_back + +.end_scalar: + RET +%else %if WIN64 movss m0, num movss m1, bscalem @@ -174,15 +773,25 @@ cglobal horiz_slice, 4, 9, 9, ptr, width, height, steps, nu, bscale, x, y, step, jl .loop_y RET +%endif %endmacro %if ARCH_X86_64 INIT_XMM sse4 HORIZ_SLICE -INIT_XMM avx2 +%if HAVE_AVX2_EXTERNAL +INIT_YMM avx2 +%xdefine mmnum 16 +HORIZ_SLICE +%endif + +%if HAVE_AVX512_EXTERNAL +INIT_ZMM avx512 +%xdefine mmnum 32 HORIZ_SLICE %endif +%endif %macro POSTSCALE_SLICE 0 cglobal postscale_slice, 2, 2, 4, ptr, length, postscale, min, max @@ -194,19 +803,17 @@ cglobal postscale_slice, 2, 2, 4, ptr, length, postscale, min, max VBROADCASTSS m1, minm VBROADCASTSS m2, maxm %elif WIN64 - SWAP 0, 2 - SWAP 1, 3 - VBROADCASTSS m0, xm0 - VBROADCASTSS m1, xm1 + VBROADCASTSS m0, xmm2 + VBROADCASTSS m1, xmm3 VBROADCASTSS m2, maxm -%else ; UNIX64 - VBROADCASTSS m0, xm0 - VBROADCASTSS m1, xm1 - VBROADCASTSS m2, xm2 +%else ; UNIX + VBROADCASTSS m0, xmm0 + VBROADCASTSS m1, xmm1 + VBROADCASTSS m2, xmm2 %endif .loop: -%if cpuflag(avx2) +%if cpuflag(avx2) || cpuflag(avx512) mulps m3, m0, [ptrq + lengthq] %else movu m3, [ptrq + lengthq] @@ -229,3 +836,159 @@ POSTSCALE_SLICE INIT_YMM avx2 POSTSCALE_SLICE %endif + +%if HAVE_AVX512_EXTERNAL +INIT_ZMM avx512 +POSTSCALE_SLICE +%endif + +;******************************************************************************* +; void ff_verti_slice(float *buffer, int width, int height, int column_begin, +; int column_end, int steps, float nu, float bscale); +;******************************************************************************* +%macro VERTI_SLICE 0 +%if UNIX64 +cglobal verti_slice, 6, 12, 9, 0-mmsize*2, buffer, width, height, cbegin, cend, \ + steps, x, y, cwidth, step, ptr, stride +%else +cglobal verti_slice, 6, 12, 9, 0-mmsize*2, buffer, width, height, cbegin, cend, \ + steps, nu, bscale, x, y, cwidth, step, \ + ptr, stride +%endif +%assign cols mmsize/4 +%if WIN64 + VBROADCASTSS m0, num + VBROADCASTSS m1, bscalem + DEFINE_ARGS buffer, width, height, cbegin, cend, \ + steps, x, y, cwidth, step, ptr, stride + MOVSXDIFNIDN width, height, cbegin, cend, steps +%else + VBROADCASTSS m0, xmm0 ; nu + VBROADCASTSS m1, xmm1 ; bscale +%endif + mov cwidthq, cendq + sub cwidthq, cbeginq + lea strideq, [widthq * 4] + + xor xq, xq ; x = 0 + cmp cwidthq, cols + jl .x_scalar + cmp cwidthq, 0x0 + je .end_scalar + + sub cwidthq, cols +.loop_x: + xor stepq, stepq + .loop_step: + ; ptr = buffer + x + column_begin; + lea ptrq, [xq + cbeginq] + lea ptrq, [bufferq + ptrq*4] + + ; ptr[15:0] *= bcale; + movu m2, [ptrq] + mulps m2, m1 + movu [ptrq], m2 + + ; Filter downwards + mov yq, 1 + .loop_y_down: + add ptrq, strideq ; ptrq += width + movu m3, [ptrq] + FMULADD_PS m2, m2, m0, m3, m2 + movu [ptrq], m2 + + inc yq + cmp yq, heightq + jl .loop_y_down + + mulps m2, m1 + movu [ptrq], m2 + + ; Filter upwards + dec yq + .loop_y_up: + sub ptrq, strideq + movu m3, [ptrq] + FMULADD_PS m2, m2, m0, m3, m2 + movu [ptrq], m2 + + dec yq + cmp yq, 0 + jg .loop_y_up + + inc stepq + cmp stepq, stepsq + jl .loop_step + + add xq, cols + cmp xq, cwidthq + jle .loop_x + + add cwidthq, cols + cmp xq, cwidthq + jge .end_scalar + +.x_scalar: + xor stepq, stepq + mov qword [rsp + 0x10], xq + sub cwidthq, xq + mov xq, 1 + shlx cwidthq, xq, cwidthq + sub cwidthq, 1 + PUSH_MASK m4, k1, cwidthd, xd, rsp + 0x20 + mov xq, qword [rsp + 0x10] + + .loop_step_scalar: + lea ptrq, [xq + cbeginq] + lea ptrq, [bufferq + ptrq*4] + + VMASKMOVPS m2, [ptrq], m4, k1 + mulps m2, m1 + VMASKMOVPS [ptrq], m2, m4, k1 + + ; Filter downwards + mov yq, 1 + .x_scalar_loop_y_down: + add ptrq, strideq + VMASKMOVPS m3, [ptrq], m4, k1 + FMULADD_PS m2, m2, m0, m3, m2 + VMASKMOVPS [ptrq], m2, m4, k1 + + inc yq + cmp yq, heightq + jl .x_scalar_loop_y_down + + mulps m2, m1 + VMASKMOVPS [ptrq], m2, m4, k1 + + ; Filter upwards + dec yq + .x_scalar_loop_y_up: + sub ptrq, strideq + VMASKMOVPS m3, [ptrq], m4, k1 + FMULADD_PS m2, m2, m0, m3, m2 + VMASKMOVPS [ptrq], m2, m4, k1 + + dec yq + cmp yq, 0 + jg .x_scalar_loop_y_up + + inc stepq + cmp stepq, stepsq + jl .loop_step_scalar + +.end_scalar: + RET +%endmacro + +%if ARCH_X86_64 +%if HAVE_AVX2_EXTERNAL +INIT_YMM avx2 +VERTI_SLICE +%endif + +%if HAVE_AVX512_EXTERNAL +INIT_ZMM avx512 +VERTI_SLICE +%endif +%endif diff --git a/chromium/third_party/ffmpeg/libavfilter/x86/vf_gblur_init.c b/chromium/third_party/ffmpeg/libavfilter/x86/vf_gblur_init.c index d80fb46fe47..b47f6fbffb9 100644 --- a/chromium/third_party/ffmpeg/libavfilter/x86/vf_gblur_init.c +++ b/chromium/third_party/ffmpeg/libavfilter/x86/vf_gblur_init.c @@ -24,11 +24,18 @@ #include "libavutil/x86/cpu.h" #include "libavfilter/gblur.h" -void ff_horiz_slice_sse4(float *ptr, int width, int height, int steps, float nu, float bscale); -void ff_horiz_slice_avx2(float *ptr, int width, int height, int steps, float nu, float bscale); +void ff_horiz_slice_sse4(float *ptr, int width, int height, int steps, float nu, float bscale, float *localbuf); +void ff_horiz_slice_avx2(float *ptr, int width, int height, int steps, float nu, float bscale, float *localbuf); +void ff_horiz_slice_avx512(float *ptr, int width, int height, int steps, float nu, float bscale, float *localbuf); void ff_postscale_slice_sse(float *ptr, int length, float postscale, float min, float max); void ff_postscale_slice_avx2(float *ptr, int length, float postscale, float min, float max); +void ff_postscale_slice_avx512(float *ptr, int length, float postscale, float min, float max); + +void ff_verti_slice_avx2(float *buffer, int width, int height, int column_begin, int column_end, + int steps, float nu, float bscale); +void ff_verti_slice_avx512(float *buffer, int width, int height, int column_begin, int column_end, + int steps, float nu, float bscale); av_cold void ff_gblur_init_x86(GBlurContext *s) { @@ -45,7 +52,22 @@ av_cold void ff_gblur_init_x86(GBlurContext *s) s->horiz_slice = ff_horiz_slice_sse4; } if (EXTERNAL_AVX2(cpu_flags)) { + s->verti_slice = ff_verti_slice_avx2; + } + if (EXTERNAL_AVX512(cpu_flags)) { + s->postscale_slice = ff_postscale_slice_avx512; + s->verti_slice = ff_verti_slice_avx512; + } + if (EXTERNAL_AVX2(cpu_flags)) { + s->stride = EXTERNAL_AVX512(cpu_flags) ? 16 : 8; + s->localbuf = av_malloc(s->stride * sizeof(float) * s->planewidth[0] * s->planeheight[0]); + if (!s->localbuf) + return; + s->horiz_slice = ff_horiz_slice_avx2; + if (EXTERNAL_AVX512(cpu_flags)) { + s->horiz_slice = ff_horiz_slice_avx512; + } } #endif } diff --git a/chromium/third_party/ffmpeg/libavformat/Makefile b/chromium/third_party/ffmpeg/libavformat/Makefile index 813ddd3c206..f7e47563dab 100644 --- a/chromium/third_party/ffmpeg/libavformat/Makefile +++ b/chromium/third_party/ffmpeg/libavformat/Makefile @@ -337,7 +337,7 @@ OBJS-$(CONFIG_MOV_DEMUXER) += mov.o mov_chan.o mov_esds.o \ qtpalette.o replaygain.o OBJS-$(CONFIG_MOV_MUXER) += movenc.o av1.o avc.o hevc.o vpcc.o \ movenchint.o mov_chan.o rtp.o \ - movenccenc.o rawutils.o + movenccenc.o movenc_ttml.o rawutils.o OBJS-$(CONFIG_MP2_MUXER) += rawenc.o OBJS-$(CONFIG_MP3_DEMUXER) += mp3dec.o replaygain.o OBJS-$(CONFIG_MP3_MUXER) += mp3enc.o rawenc.o id3v2enc.o @@ -379,6 +379,7 @@ OBJS-$(CONFIG_NUT_MUXER) += nutenc.o nut.o OBJS-$(CONFIG_NUV_DEMUXER) += nuv.o OBJS-$(CONFIG_AV1_DEMUXER) += av1dec.o OBJS-$(CONFIG_OBU_DEMUXER) += av1dec.o +OBJS-$(CONFIG_OBU_MUXER) += rawenc.o OBJS-$(CONFIG_OGG_DEMUXER) += oggdec.o \ oggparsecelt.o \ oggparsedirac.o \ diff --git a/chromium/third_party/ffmpeg/libavformat/aacdec.c b/chromium/third_party/ffmpeg/libavformat/aacdec.c index 94e39f592fb..1f68f17bc95 100644 --- a/chromium/third_party/ffmpeg/libavformat/aacdec.c +++ b/chromium/third_party/ffmpeg/libavformat/aacdec.c @@ -135,7 +135,7 @@ static int adts_aac_read_header(AVFormatContext *s) static int handle_id3(AVFormatContext *s, AVPacket *pkt) { AVDictionary *metadata = NULL; - AVIOContext ioctx; + FFIOContext pb; ID3v2ExtraMeta *id3v2_extra_meta; int ret; @@ -144,8 +144,8 @@ static int handle_id3(AVFormatContext *s, AVPacket *pkt) return ret; } - ffio_init_context(&ioctx, pkt->data, pkt->size, 0, NULL, NULL, NULL, NULL); - ff_id3v2_read_dict(&ioctx, &metadata, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta); + ffio_init_context(&pb, pkt->data, pkt->size, 0, NULL, NULL, NULL, NULL); + ff_id3v2_read_dict(&pb.pub, &metadata, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta); if ((ret = ff_id3v2_parse_priv_dict(&metadata, id3v2_extra_meta)) < 0) goto error; diff --git a/chromium/third_party/ffmpeg/libavformat/aaxdec.c b/chromium/third_party/ffmpeg/libavformat/aaxdec.c index ea0f2af1c9f..b08ee036ed1 100644 --- a/chromium/third_party/ffmpeg/libavformat/aaxdec.c +++ b/chromium/third_party/ffmpeg/libavformat/aaxdec.c @@ -21,6 +21,7 @@ #include "libavutil/intreadwrite.h" #include "avformat.h" +#include "avio_internal.h" #include "internal.h" typedef struct AAXColumn { @@ -215,12 +216,9 @@ static int aax_read_header(AVFormatContext *s) if (ret64 < 0) return ret; - ret = avio_read(pb, a->string_table, a->strings_size); - if (ret != a->strings_size) { - if (ret < 0) - return ret; - return AVERROR(EIO); - } + ret = ffio_read_size(pb, a->string_table, a->strings_size); + if (ret < 0) + return ret; for (int c = 0; c < a->columns; c++) { int64_t data_offset = 0; diff --git a/chromium/third_party/ffmpeg/libavformat/act.c b/chromium/third_party/ffmpeg/libavformat/act.c index 5688952a316..a3691576470 100644 --- a/chromium/third_party/ffmpeg/libavformat/act.c +++ b/chromium/third_party/ffmpeg/libavformat/act.c @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avformat.h" +#include "avio_internal.h" #include "riff.h" #include "internal.h" #include "libavcodec/get_bits.h" @@ -126,12 +127,10 @@ static int read_packet(AVFormatContext *s, if(s->streams[0]->codecpar->sample_rate==4400 && !ctx->second_packet) { - ret = avio_read(pb, ctx->audio_buffer, frame_size); + ret = ffio_read_size(pb, ctx->audio_buffer, frame_size); if(ret<0) return ret; - if(ret!=frame_size) - return AVERROR(EIO); pkt->data[0]=ctx->audio_buffer[11]; pkt->data[1]=ctx->audio_buffer[0]; @@ -165,12 +164,10 @@ static int read_packet(AVFormatContext *s, } else // 8000 Hz { - ret = avio_read(pb, ctx->audio_buffer, frame_size); + ret = ffio_read_size(pb, ctx->audio_buffer, frame_size); if(ret<0) return ret; - if(ret!=frame_size) - return AVERROR(EIO); pkt->data[0]=ctx->audio_buffer[5]; pkt->data[1]=ctx->audio_buffer[0]; diff --git a/chromium/third_party/ffmpeg/libavformat/adtsenc.c b/chromium/third_party/ffmpeg/libavformat/adtsenc.c index ba15c0a7249..3924e678d91 100644 --- a/chromium/third_party/ffmpeg/libavformat/adtsenc.c +++ b/chromium/third_party/ffmpeg/libavformat/adtsenc.c @@ -53,9 +53,11 @@ static int adts_decode_extradata(AVFormatContext *s, ADTSContext *adts, const ui GetBitContext gb; PutBitContext pb; MPEG4AudioConfig m4ac; - int off; + int off, ret; - init_get_bits(&gb, buf, size * 8); + ret = init_get_bits8(&gb, buf, size); + if (ret < 0) + return ret; off = avpriv_mpeg4audio_get_config2(&m4ac, buf, size, 1, s); if (off < 0) return off; diff --git a/chromium/third_party/ffmpeg/libavformat/aiffdec.c b/chromium/third_party/ffmpeg/libavformat/aiffdec.c index cade05a9d6f..a826bc998ad 100644 --- a/chromium/third_party/ffmpeg/libavformat/aiffdec.c +++ b/chromium/third_party/ffmpeg/libavformat/aiffdec.c @@ -100,6 +100,9 @@ static int get_aiff_header(AVFormatContext *s, int size, int sample_rate; unsigned int num_frames; + if (size == INT_MAX) + return AVERROR_INVALIDDATA; + if (size & 1) size++; par->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/chromium/third_party/ffmpeg/libavformat/allformats.c b/chromium/third_party/ffmpeg/libavformat/allformats.c index 111ca3cbf04..5471f7c16f1 100644 --- a/chromium/third_party/ffmpeg/libavformat/allformats.c +++ b/chromium/third_party/ffmpeg/libavformat/allformats.c @@ -305,6 +305,7 @@ extern const AVInputFormat ff_nut_demuxer; extern const AVOutputFormat ff_nut_muxer; extern const AVInputFormat ff_nuv_demuxer; extern const AVInputFormat ff_obu_demuxer; +extern const AVOutputFormat ff_obu_muxer; extern const AVOutputFormat ff_oga_muxer; extern const AVInputFormat ff_ogg_demuxer; extern const AVOutputFormat ff_ogg_muxer; diff --git a/chromium/third_party/ffmpeg/libavformat/asfdec_f.c b/chromium/third_party/ffmpeg/libavformat/asfdec_f.c index 053c815977c..ff6ddfb9674 100644 --- a/chromium/third_party/ffmpeg/libavformat/asfdec_f.c +++ b/chromium/third_party/ffmpeg/libavformat/asfdec_f.c @@ -415,7 +415,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) tag1 = avio_rl32(pb); avio_skip(pb, 20); if (sizeX > 40) { - if (size < sizeX - 40) + if (size < sizeX - 40 || sizeX - 40 > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE) return AVERROR_INVALIDDATA; st->codecpar->extradata_size = ffio_limit(pb, sizeX - 40); st->codecpar->extradata = av_mallocz(st->codecpar->extradata_size + diff --git a/chromium/third_party/ffmpeg/libavformat/asfenc.c b/chromium/third_party/ffmpeg/libavformat/asfenc.c index a8a844ce6ef..b294431aecb 100644 --- a/chromium/third_party/ffmpeg/libavformat/asfenc.c +++ b/chromium/third_party/ffmpeg/libavformat/asfenc.c @@ -236,7 +236,7 @@ typedef struct ASFContext { int64_t packet_timestamp_end; unsigned int packet_nb_payloads; uint8_t packet_buf[PACKET_SIZE_MAX]; - AVIOContext pb; + FFIOContext pb; /* only for reading */ uint64_t data_offset; ///< beginning of the first data packet @@ -911,7 +911,7 @@ static void put_payload_header(AVFormatContext *s, ASFStream *stream, int m_obj_offset, int payload_len, int flags) { ASFContext *asf = s->priv_data; - AVIOContext *pb = &asf->pb; + AVIOContext *const pb = &asf->pb.pub; int val; val = stream->num; @@ -983,7 +983,7 @@ static void put_frame(AVFormatContext *s, ASFStream *stream, AVStream *avst, put_payload_header(s, stream, timestamp + PREROLL_TIME, m_obj_size, m_obj_offset, payload_len, flags); - avio_write(&asf->pb, buf, payload_len); + avio_write(&asf->pb.pub, buf, payload_len); if (asf->multi_payloads_present) asf->packet_size_left -= (payload_len + PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS); @@ -1125,7 +1125,7 @@ static int asf_write_trailer(AVFormatContext *s) int ret; /* flush the current packet */ - if (asf->pb.buf_ptr > asf->pb.buffer) + if (asf->pb.pub.buf_ptr > asf->pb.pub.buffer) flush_packet(s); /* write index */ diff --git a/chromium/third_party/ffmpeg/libavformat/av1.c b/chromium/third_party/ffmpeg/libavformat/av1.c index 5512c4e0f77..1fcfac23568 100644 --- a/chromium/third_party/ffmpeg/libavformat/av1.c +++ b/chromium/third_party/ffmpeg/libavformat/av1.c @@ -86,7 +86,7 @@ int ff_av1_filter_obus(AVIOContext *pb, const uint8_t *buf, int size) int ff_av1_filter_obus_buf(const uint8_t *in, uint8_t **out, int *size, int *offset) { - AVIOContext pb; + FFIOContext pb; uint8_t *buf; int len, off, ret; @@ -108,7 +108,7 @@ int ff_av1_filter_obus_buf(const uint8_t *in, uint8_t **out, ffio_init_context(&pb, buf, len, 1, NULL, NULL, NULL, NULL); - ret = av1_filter_obus(&pb, in, *size, NULL); + ret = av1_filter_obus(&pb.pub, in, *size, NULL); av_assert1(ret == len); memset(buf + len, 0, AV_INPUT_BUFFER_PADDING_SIZE); diff --git a/chromium/third_party/ffmpeg/libavformat/av1dec.c b/chromium/third_party/ffmpeg/libavformat/av1dec.c index f6c575069e4..e9943122536 100644 --- a/chromium/third_party/ffmpeg/libavformat/av1dec.c +++ b/chromium/third_party/ffmpeg/libavformat/av1dec.c @@ -22,7 +22,6 @@ #include "config.h" #include "libavutil/common.h" -#include "libavutil/fifo.h" #include "libavutil/opt.h" #include "libavcodec/av1_parse.h" #include "libavcodec/bsf.h" @@ -30,6 +29,14 @@ #include "avio_internal.h" #include "internal.h" +typedef struct AV1DemuxContext { + const AVClass *class; + AVBSFContext *bsf; + AVRational framerate; + uint32_t temporal_unit_size; + uint32_t frame_unit_size; +} AV1DemuxContext; + //return < 0 if we need more data static int get_score(int type, int *seq) { @@ -49,14 +56,15 @@ static int get_score(int type, int *seq) return 0; } -static int read_header(AVFormatContext *s, const AVRational *framerate, AVBSFContext **bsf, void *logctx) +static int av1_read_header(AVFormatContext *s) { + AV1DemuxContext *const c = s->priv_data; const AVBitStreamFilter *filter = av_bsf_get_by_name("av1_frame_merge"); AVStream *st; int ret; if (!filter) { - av_log(logctx, AV_LOG_ERROR, "av1_frame_merge bitstream filter " + av_log(s, AV_LOG_ERROR, "av1_frame_merge bitstream filter " "not found. This is a bug, please report it.\n"); return AVERROR_BUG; } @@ -69,35 +77,49 @@ static int read_header(AVFormatContext *s, const AVRational *framerate, AVBSFCon st->codecpar->codec_id = AV_CODEC_ID_AV1; st->internal->need_parsing = AVSTREAM_PARSE_HEADERS; - st->internal->avctx->framerate = *framerate; + st->internal->avctx->framerate = c->framerate; // taken from rawvideo demuxers avpriv_set_pts_info(st, 64, 1, 1200000); - ret = av_bsf_alloc(filter, bsf); + ret = av_bsf_alloc(filter, &c->bsf); if (ret < 0) return ret; - ret = avcodec_parameters_copy((*bsf)->par_in, st->codecpar); + ret = avcodec_parameters_copy(c->bsf->par_in, st->codecpar); if (ret < 0) return ret; - ret = av_bsf_init(*bsf); + ret = av_bsf_init(c->bsf); if (ret < 0) return ret; return 0; } +static int av1_read_close(AVFormatContext *s) +{ + AV1DemuxContext *const c = s->priv_data; + + av_bsf_free(&c->bsf); + return 0; +} + #define DEC AV_OPT_FLAG_DECODING_PARAM +#define OFFSET(x) offsetof(AV1DemuxContext, x) +static const AVOption av1_options[] = { + { "framerate", "", OFFSET(framerate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, DEC}, + { NULL }, +}; +#undef OFFSET + +static const AVClass av1_demuxer_class = { + .class_name = "AV1 Annex B/low overhead OBU demuxer", + .item_name = av_default_item_name, + .option = av1_options, + .version = LIBAVUTIL_VERSION_INT, +}; #if CONFIG_AV1_DEMUXER -typedef struct AnnexBContext { - const AVClass *class; - AVBSFContext *bsf; - uint32_t temporal_unit_size; - uint32_t frame_unit_size; - AVRational framerate; -} AnnexBContext; static int leb(AVIOContext *pb, uint32_t *len) { int more, i = 0; @@ -135,32 +157,33 @@ static int read_obu(const uint8_t *buf, int size, int64_t *obu_size, int *type) static int annexb_probe(const AVProbeData *p) { - AVIOContext pb; + FFIOContext ctx; + AVIOContext *const pb = &ctx.pub; int64_t obu_size; uint32_t temporal_unit_size, frame_unit_size, obu_unit_size; int seq = 0; int ret, type, cnt = 0; - ffio_init_context(&pb, p->buf, p->buf_size, 0, + ffio_init_context(&ctx, p->buf, p->buf_size, 0, NULL, NULL, NULL, NULL); - ret = leb(&pb, &temporal_unit_size); + ret = leb(pb, &temporal_unit_size); if (ret < 0) return 0; cnt += ret; - ret = leb(&pb, &frame_unit_size); + ret = leb(pb, &frame_unit_size); if (ret < 0 || ((int64_t)frame_unit_size + ret) > temporal_unit_size) return 0; cnt += ret; - ret = leb(&pb, &obu_unit_size); + ret = leb(pb, &obu_unit_size); if (ret < 0 || ((int64_t)obu_unit_size + ret) >= frame_unit_size) return 0; cnt += ret; frame_unit_size -= obu_unit_size + ret; - avio_skip(&pb, obu_unit_size); - if (pb.eof_reached || pb.error) + avio_skip(pb, obu_unit_size); + if (pb->eof_reached || pb->error) return 0; // Check that the first OBU is a Temporal Delimiter. @@ -170,13 +193,13 @@ static int annexb_probe(const AVProbeData *p) cnt += obu_unit_size; do { - ret = leb(&pb, &obu_unit_size); + ret = leb(pb, &obu_unit_size); if (ret < 0 || ((int64_t)obu_unit_size + ret) > frame_unit_size) return 0; cnt += ret; - avio_skip(&pb, obu_unit_size); - if (pb.eof_reached || pb.error) + avio_skip(pb, obu_unit_size); + if (pb->eof_reached || pb->error) return 0; ret = read_obu(p->buf + cnt, FFMIN(p->buf_size - cnt, obu_unit_size), &obu_size, &type); @@ -194,15 +217,9 @@ static int annexb_probe(const AVProbeData *p) return 0; } -static int annexb_read_header(AVFormatContext *s) -{ - AnnexBContext *c = s->priv_data; - return read_header(s, &c->framerate, &c->bsf, c); -} - static int annexb_read_packet(AVFormatContext *s, AVPacket *pkt) { - AnnexBContext *c = s->priv_data; + AV1DemuxContext *const c = s->priv_data; uint32_t obu_unit_size; int ret, len; @@ -257,51 +274,22 @@ end: return ret; } -static int annexb_read_close(AVFormatContext *s) -{ - AnnexBContext *c = s->priv_data; - - av_bsf_free(&c->bsf); - return 0; -} - -#define OFFSET(x) offsetof(AnnexBContext, x) -static const AVOption annexb_options[] = { - { "framerate", "", OFFSET(framerate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, DEC}, - { NULL }, -}; -#undef OFFSET - -static const AVClass annexb_demuxer_class = { - .class_name = "AV1 Annex B demuxer", - .item_name = av_default_item_name, - .option = annexb_options, - .version = LIBAVUTIL_VERSION_INT, -}; - const AVInputFormat ff_av1_demuxer = { .name = "av1", .long_name = NULL_IF_CONFIG_SMALL("AV1 Annex B"), - .priv_data_size = sizeof(AnnexBContext), + .priv_data_size = sizeof(AV1DemuxContext), .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = annexb_probe, - .read_header = annexb_read_header, + .read_header = av1_read_header, .read_packet = annexb_read_packet, - .read_close = annexb_read_close, + .read_close = av1_read_close, .extensions = "obu", .flags = AVFMT_GENERIC_INDEX, - .priv_class = &annexb_demuxer_class, + .priv_class = &av1_demuxer_class, }; #endif #if CONFIG_OBU_DEMUXER -typedef struct ObuContext { - const AVClass *class; - AVBSFContext *bsf; - AVRational framerate; - AVFifoBuffer *fifo; -} ObuContext; - //For low overhead obu, we can't foresee the obu size before we parsed the header. //So, we can't use parse_obu_header here, since it will check size <= buf_size //see c27c7b49dc for more details @@ -369,63 +357,50 @@ static int obu_probe(const AVProbeData *p) return 0; } -static int obu_read_header(AVFormatContext *s) -{ - ObuContext *c = s->priv_data; - c->fifo = av_fifo_alloc(MAX_OBU_HEADER_SIZE); - if (!c->fifo) - return AVERROR(ENOMEM); - return read_header(s, &c->framerate, &c->bsf, c); -} - static int obu_get_packet(AVFormatContext *s, AVPacket *pkt) { - ObuContext *c = s->priv_data; + AV1DemuxContext *const c = s->priv_data; uint8_t header[MAX_OBU_HEADER_SIZE + AV_INPUT_BUFFER_PADDING_SIZE]; int64_t obu_size; - int size = av_fifo_space(c->fifo); + int size; int ret, len, type; - av_fifo_generic_write(c->fifo, s->pb, size, - (int (*)(void*, void*, int))avio_read); - size = av_fifo_size(c->fifo); - if (!size) - return 0; - - av_fifo_generic_peek(c->fifo, header, size, NULL); + if ((ret = ffio_ensure_seekback(s->pb, MAX_OBU_HEADER_SIZE)) < 0) + return ret; + size = avio_read(s->pb, header, MAX_OBU_HEADER_SIZE); + if (size < 0) + return size; len = read_obu_with_size(header, size, &obu_size, &type); if (len < 0) { av_log(c, AV_LOG_ERROR, "Failed to read obu\n"); return len; } + avio_seek(s->pb, -size, SEEK_CUR); - ret = av_new_packet(pkt, len); - if (ret < 0) { - av_log(c, AV_LOG_ERROR, "Failed to allocate packet for obu\n"); - return ret; - } - size = FFMIN(size, len); - av_fifo_generic_read(c->fifo, pkt->data, size, NULL); - len -= size; - if (len > 0) { - ret = avio_read(s->pb, pkt->data + size, len); - if (ret != len) { - av_log(c, AV_LOG_ERROR, "Failed to read %d frome file\n", len); - return ret < 0 ? ret : AVERROR_INVALIDDATA; - } + ret = av_get_packet(s->pb, pkt, len); + if (ret != len) { + av_log(c, AV_LOG_ERROR, "Failed to get packet for obu\n"); + return ret < 0 ? ret : AVERROR_INVALIDDATA; } return 0; } static int obu_read_packet(AVFormatContext *s, AVPacket *pkt) { - ObuContext *c = s->priv_data; + AV1DemuxContext *const c = s->priv_data; int ret; + if (s->io_repositioned) { + av_bsf_flush(c->bsf); + s->io_repositioned = 0; + } while (1) { ret = obu_get_packet(s, pkt); - if (ret < 0) + /* In case of AVERROR_EOF we need to flush the BSF. Conveniently + * obu_get_packet() returns a blank pkt in this case which + * can be used to signal that the BSF should be flushed. */ + if (ret < 0 && ret != AVERROR_EOF) return ret; ret = av_bsf_send_packet(c->bsf, pkt); if (ret < 0) { @@ -444,40 +419,17 @@ static int obu_read_packet(AVFormatContext *s, AVPacket *pkt) return ret; } -static int obu_read_close(AVFormatContext *s) -{ - ObuContext *c = s->priv_data; - - av_fifo_freep(&c->fifo); - av_bsf_free(&c->bsf); - return 0; -} - -#define OFFSET(x) offsetof(ObuContext, x) -static const AVOption obu_options[] = { - { "framerate", "", OFFSET(framerate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, DEC}, - { NULL }, -}; -#undef OFFSET - -static const AVClass obu_demuxer_class = { - .class_name = "AV1 low overhead OBU demuxer", - .item_name = av_default_item_name, - .option = obu_options, - .version = LIBAVUTIL_VERSION_INT, -}; - const AVInputFormat ff_obu_demuxer = { .name = "obu", .long_name = NULL_IF_CONFIG_SMALL("AV1 low overhead OBU"), - .priv_data_size = sizeof(ObuContext), + .priv_data_size = sizeof(AV1DemuxContext), .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = obu_probe, - .read_header = obu_read_header, + .read_header = av1_read_header, .read_packet = obu_read_packet, - .read_close = obu_read_close, + .read_close = av1_read_close, .extensions = "obu", - .flags = AVFMT_GENERIC_INDEX, - .priv_class = &obu_demuxer_class, + .flags = AVFMT_GENERIC_INDEX | AVFMT_NO_BYTE_SEEK, + .priv_class = &av1_demuxer_class, }; #endif diff --git a/chromium/third_party/ffmpeg/libavformat/avidec.c b/chromium/third_party/ffmpeg/libavformat/avidec.c index 2e261c94e62..b1dea1362eb 100644 --- a/chromium/third_party/ffmpeg/libavformat/avidec.c +++ b/chromium/third_party/ffmpeg/libavformat/avidec.c @@ -164,7 +164,7 @@ static int get_riff(AVFormatContext *s, AVIOContext *pb) return 0; } -static int read_odml_index(AVFormatContext *s, int frame_num) +static int read_odml_index(AVFormatContext *s, int64_t frame_num) { AVIContext *avi = s->priv_data; AVIOContext *pb = s->pb; @@ -184,7 +184,7 @@ static int read_odml_index(AVFormatContext *s, int frame_num) av_log(s, AV_LOG_TRACE, "longs_per_entry:%d index_type:%d entries_in_use:%d " - "chunk_id:%X base:%16"PRIX64" frame_num:%d\n", + "chunk_id:%X base:%16"PRIX64" frame_num:%"PRId64"\n", longs_per_entry, index_type, entries_in_use, @@ -1776,7 +1776,10 @@ static int avi_load_index(AVFormatContext *s) size = avio_rl32(pb); if (avio_feof(pb)) break; - next = avio_tell(pb) + size + (size & 1); + next = avio_tell(pb); + if (next < 0 || next > INT64_MAX - size - (size & 1)) + break; + next += size + (size & 1LL); if (tag == MKTAG('i', 'd', 'x', '1') && avi_read_idx1(s, size) >= 0) { diff --git a/chromium/third_party/ffmpeg/libavformat/avio.h b/chromium/third_party/ffmpeg/libavformat/avio.h index 0b35409787c..a7b56ab6674 100644 --- a/chromium/third_party/ffmpeg/libavformat/avio.h +++ b/chromium/third_party/ffmpeg/libavformat/avio.h @@ -148,9 +148,9 @@ enum AVIODataMarkerType { /** * Bytestream IO Context. - * New fields can be added to the end with minor version bumps. - * Removal, reordering and changes to existing fields require a major - * version bump. + * New public fields can be added with minor version bumps. + * Removal, reordering and changes to existing public fields require + * a major version bump. * sizeof(AVIOContext) must not be used outside libav*. * * @note None of the function pointers in AVIOContext should be called @@ -237,12 +237,14 @@ typedef struct AVIOContext { int64_t (*seek)(void *opaque, int64_t offset, int whence); int64_t pos; /**< position in the file of the current buffer */ int eof_reached; /**< true if was unable to read due to error or eof */ + int error; /**< contains the error code or 0 if no error happened */ int write_flag; /**< true if open for writing */ int max_packet_size; + int min_packet_size; /**< Try to buffer at least this amount of data + before flushing it. */ unsigned long checksum; unsigned char *checksum_ptr; unsigned long (*update_checksum)(unsigned long checksum, const uint8_t *buf, unsigned int size); - int error; /**< contains the error code or 0 if no error happened */ /** * Pause or resume playback for network streaming protocols - e.g. MMS. */ @@ -260,12 +262,6 @@ typedef struct AVIOContext { int seekable; /** - * max filesize, used to limit allocations - * This field is internal to libavformat and access from outside is not allowed. - */ - int64_t maxsize; - - /** * avio_read and avio_write should if possible be satisfied directly * instead of going through a buffer, and avio_seek will always * call the underlying seek function directly. @@ -273,37 +269,6 @@ typedef struct AVIOContext { int direct; /** - * Bytes read statistic - * This field is internal to libavformat and access from outside is not allowed. - */ - int64_t bytes_read; - - /** - * seek statistic - * This field is internal to libavformat and access from outside is not allowed. - */ - int seek_count; - - /** - * writeout statistic - * This field is internal to libavformat and access from outside is not allowed. - */ - int writeout_count; - - /** - * Original buffer size - * used internally after probing and ensure seekback to reset the buffer size - * This field is internal to libavformat and access from outside is not allowed. - */ - int orig_buffer_size; - - /** - * Threshold to favor readahead over seek. - * This is current internal only, do not use from outside. - */ - int short_seek_threshold; - - /** * ',' separated list of allowed protocols. */ const char *protocol_whitelist; @@ -325,18 +290,6 @@ typedef struct AVIOContext { */ int ignore_boundary_point; - /** - * Internal, not meant to be used from outside of AVIOContext. - */ - enum AVIODataMarkerType current_type; - int64_t last_time; - - /** - * A callback that is used instead of short_seek_threshold. - * This is current internal only, do not use from outside. - */ - int (*short_seek_get)(void *opaque); - int64_t written; /** @@ -344,11 +297,6 @@ typedef struct AVIOContext { * used keeping track of already written data for a later flush. */ unsigned char *buf_ptr_max; - - /** - * Try to buffer at least this amount of data before flushing it - */ - int min_packet_size; } AVIOContext; /** diff --git a/chromium/third_party/ffmpeg/libavformat/avio_internal.h b/chromium/third_party/ffmpeg/libavformat/avio_internal.h index 2c6d00b5ffc..8b9e048f739 100644 --- a/chromium/third_party/ffmpeg/libavformat/avio_internal.h +++ b/chromium/third_party/ffmpeg/libavformat/avio_internal.h @@ -26,7 +26,54 @@ extern const AVClass ff_avio_class; -int ffio_init_context(AVIOContext *s, +typedef struct FFIOContext { + AVIOContext pub; + /** + * A callback that is used instead of short_seek_threshold. + */ + int (*short_seek_get)(void *opaque); + + /** + * Threshold to favor readahead over seek. + */ + int short_seek_threshold; + + enum AVIODataMarkerType current_type; + int64_t last_time; + + /** + * max filesize, used to limit allocations + */ + int64_t maxsize; + + /** + * Bytes read statistic + */ + int64_t bytes_read; + + /** + * seek statistic + */ + int seek_count; + + /** + * writeout statistic + */ + int writeout_count; + + /** + * Original buffer size + * used after probing to ensure seekback and to reset the buffer size + */ + int orig_buffer_size; +} FFIOContext; + +static av_always_inline FFIOContext *ffiocontext(AVIOContext *ctx) +{ + return (FFIOContext*)ctx; +} + +void ffio_init_context(FFIOContext *s, unsigned char *buffer, int buffer_size, int write_flag, @@ -83,9 +130,6 @@ uint64_t ffio_read_varlen(AVIOContext *bc); */ int ffio_read_size(AVIOContext *s, unsigned char *buf, int size); -/** @warning must be called before any I/O */ -int ffio_set_buf_size(AVIOContext *s, int buf_size); - /** * Reallocate a given buffer for AVIOContext. * diff --git a/chromium/third_party/ffmpeg/libavformat/aviobuf.c b/chromium/third_party/ffmpeg/libavformat/aviobuf.c index 66fddf14330..28db2c7dbdd 100644 --- a/chromium/third_party/ffmpeg/libavformat/aviobuf.c +++ b/chromium/third_party/ffmpeg/libavformat/aviobuf.c @@ -26,7 +26,7 @@ #include "libavutil/log.h" #include "libavutil/opt.h" #include "libavutil/avassert.h" -#include "avformat.h" +#include "libavcodec/defs.h" #include "avio.h" #include "avio_internal.h" #include "internal.h" @@ -74,8 +74,10 @@ const AVClass ff_avio_class = { static void fill_buffer(AVIOContext *s); static int url_resetbuf(AVIOContext *s, int flags); +/** @warning must be called before any I/O */ +static int set_buf_size(AVIOContext *s, int buf_size); -int ffio_init_context(AVIOContext *s, +void ffio_init_context(FFIOContext *ctx, unsigned char *buffer, int buffer_size, int write_flag, @@ -84,10 +86,12 @@ int ffio_init_context(AVIOContext *s, int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), int64_t (*seek)(void *opaque, int64_t offset, int whence)) { - memset(s, 0, sizeof(AVIOContext)); + AVIOContext *const s = &ctx->pub; + + memset(ctx, 0, sizeof(*ctx)); s->buffer = buffer; - s->orig_buffer_size = + ctx->orig_buffer_size = s->buffer_size = buffer_size; s->buf_ptr = buffer; s->buf_ptr_max = buffer; @@ -106,7 +110,7 @@ int ffio_init_context(AVIOContext *s, s->min_packet_size = 0; s->max_packet_size = 0; s->update_checksum = NULL; - s->short_seek_threshold = SHORT_SEEK_THRESHOLD; + ctx->short_seek_threshold = SHORT_SEEK_THRESHOLD; if (!read_packet && !write_flag) { s->pos = buffer_size; @@ -117,12 +121,10 @@ int ffio_init_context(AVIOContext *s, s->write_data_type = NULL; s->ignore_boundary_point = 0; - s->current_type = AVIO_DATA_MARKER_UNKNOWN; - s->last_time = AV_NOPTS_VALUE; - s->short_seek_get = NULL; + ctx->current_type = AVIO_DATA_MARKER_UNKNOWN; + ctx->last_time = AV_NOPTS_VALUE; + ctx->short_seek_get = NULL; s->written = 0; - - return 0; } AVIOContext *avio_alloc_context( @@ -134,12 +136,12 @@ AVIOContext *avio_alloc_context( int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), int64_t (*seek)(void *opaque, int64_t offset, int whence)) { - AVIOContext *s = av_malloc(sizeof(AVIOContext)); + FFIOContext *s = av_malloc(sizeof(*s)); if (!s) return NULL; ffio_init_context(s, buffer, buffer_size, write_flag, opaque, read_packet, write_packet, seek); - return s; + return &s->pub; } void avio_context_free(AVIOContext **ps) @@ -149,13 +151,14 @@ void avio_context_free(AVIOContext **ps) static void writeout(AVIOContext *s, const uint8_t *data, int len) { + FFIOContext *const ctx = ffiocontext(s); if (!s->error) { int ret = 0; if (s->write_data_type) ret = s->write_data_type(s->opaque, (uint8_t *)data, len, - s->current_type, - s->last_time); + ctx->current_type, + ctx->last_time); else if (s->write_packet) ret = s->write_packet(s->opaque, (uint8_t *)data, len); if (ret < 0) { @@ -165,12 +168,12 @@ static void writeout(AVIOContext *s, const uint8_t *data, int len) s->written = s->pos + len; } } - if (s->current_type == AVIO_DATA_MARKER_SYNC_POINT || - s->current_type == AVIO_DATA_MARKER_BOUNDARY_POINT) { - s->current_type = AVIO_DATA_MARKER_UNKNOWN; + if (ctx->current_type == AVIO_DATA_MARKER_SYNC_POINT || + ctx->current_type == AVIO_DATA_MARKER_BOUNDARY_POINT) { + ctx->current_type = AVIO_DATA_MARKER_UNKNOWN; } - s->last_time = AV_NOPTS_VALUE; - s->writeout_count ++; + ctx->last_time = AV_NOPTS_VALUE; + ctx->writeout_count++; s->pos += len; } @@ -242,6 +245,7 @@ void avio_flush(AVIOContext *s) int64_t avio_seek(AVIOContext *s, int64_t offset, int whence) { + FFIOContext *const ctx = ffiocontext(s); int64_t offset1; int64_t pos; int force = whence & AVSEEK_FORCE; @@ -273,9 +277,11 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence) if (offset < 0) return AVERROR(EINVAL); - short_seek = s->short_seek_threshold; - if (s->short_seek_get) - short_seek = FFMAX(s->short_seek_get(s->opaque), short_seek); + short_seek = ctx->short_seek_threshold; + if (ctx->short_seek_get) { + int tmp = ctx->short_seek_get(s->opaque); + short_seek = FFMAX(tmp, short_seek); + } offset1 = offset - pos; // "offset1" is the relative offset from the beginning of s->buffer s->buf_ptr_max = FFMAX(s->buf_ptr_max, s->buf_ptr); @@ -314,7 +320,7 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence) return AVERROR(EPIPE); if ((res = s->seek(s->opaque, offset, SEEK_SET)) < 0) return res; - s->seek_count ++; + ctx->seek_count++; if (!s->write_flag) s->buf_end = s->buffer; s->buf_ptr = s->buf_ptr_max = s->buffer; @@ -468,6 +474,7 @@ void avio_wb24(AVIOContext *s, unsigned int val) void avio_write_marker(AVIOContext *s, int64_t time, enum AVIODataMarkerType type) { + FFIOContext *const ctx = ffiocontext(s); if (type == AVIO_DATA_MARKER_FLUSH_POINT) { if (s->buf_ptr - s->buffer >= s->min_packet_size) avio_flush(s); @@ -481,8 +488,8 @@ void avio_write_marker(AVIOContext *s, int64_t time, enum AVIODataMarkerType typ // Avoid unnecessary flushes if we are already in non-header/trailer // data and setting the type to unknown if (type == AVIO_DATA_MARKER_UNKNOWN && - (s->current_type != AVIO_DATA_MARKER_HEADER && - s->current_type != AVIO_DATA_MARKER_TRAILER)) + (ctx->current_type != AVIO_DATA_MARKER_HEADER && + ctx->current_type != AVIO_DATA_MARKER_TRAILER)) return; switch (type) { @@ -490,7 +497,7 @@ void avio_write_marker(AVIOContext *s, int64_t time, enum AVIODataMarkerType typ case AVIO_DATA_MARKER_TRAILER: // For header/trailer, ignore a new marker of the same type; // consecutive header/trailer markers can be merged. - if (type == s->current_type) + if (type == ctx->current_type) return; break; } @@ -498,8 +505,8 @@ void avio_write_marker(AVIOContext *s, int64_t time, enum AVIODataMarkerType typ // If we've reached here, we have a new, noteworthy marker. // Flush the previous data and mark the start of the new data. avio_flush(s); - s->current_type = type; - s->last_time = time; + ctx->current_type = type; + ctx->last_time = time; } static int read_packet_wrapper(AVIOContext *s, uint8_t *buf, int size) @@ -517,6 +524,7 @@ static int read_packet_wrapper(AVIOContext *s, uint8_t *buf, int size) static void fill_buffer(AVIOContext *s) { + FFIOContext *const ctx = (FFIOContext *)s; int max_buffer_size = s->max_packet_size ? s->max_packet_size : IO_BUFFER_SIZE; uint8_t *dst = s->buf_end - s->buffer + max_buffer_size <= s->buffer_size ? @@ -539,15 +547,16 @@ static void fill_buffer(AVIOContext *s) } /* make buffer smaller in case it ended up large after probing */ - if (s->read_packet && s->orig_buffer_size && s->buffer_size > s->orig_buffer_size && len >= s->orig_buffer_size) { + if (s->read_packet && ctx->orig_buffer_size && + s->buffer_size > ctx->orig_buffer_size && len >= ctx->orig_buffer_size) { if (dst == s->buffer && s->buf_ptr != dst) { - int ret = ffio_set_buf_size(s, s->orig_buffer_size); + int ret = set_buf_size(s, ctx->orig_buffer_size); if (ret < 0) av_log(s, AV_LOG_WARNING, "Failed to decrease buffer size\n"); s->checksum_ptr = dst = s->buffer; } - len = s->orig_buffer_size; + len = ctx->orig_buffer_size; } len = read_packet_wrapper(s, dst, len); @@ -562,7 +571,7 @@ static void fill_buffer(AVIOContext *s) s->pos += len; s->buf_ptr = dst; s->buf_end = dst + len; - s->bytes_read += len; + ffiocontext(s)->bytes_read += len; } } @@ -635,7 +644,7 @@ int avio_read(AVIOContext *s, unsigned char *buf, int size) break; } else { s->pos += len; - s->bytes_read += len; + ffiocontext(s)->bytes_read += len; size -= len; buf += len; // reset the buffer @@ -951,7 +960,7 @@ int ffio_fdopen(AVIOContext **s, URLContext *h) if (h->prot->url_read_seek) (*s)->seekable |= AVIO_SEEKABLE_TIME; } - (*s)->short_seek_get = (int (*)(void *))ffurl_get_short_seek; + ((FFIOContext*)(*s))->short_seek_get = (int (*)(void *))ffurl_get_short_seek; (*s)->av_class = &ff_avio_class; return 0; fail: @@ -1013,7 +1022,33 @@ int ffio_ensure_seekback(AVIOContext *s, int64_t buf_size) return 0; } -int ffio_set_buf_size(AVIOContext *s, int buf_size) +int ffio_limit(AVIOContext *s, int size) +{ + FFIOContext *const ctx = ffiocontext(s); + if (ctx->maxsize >= 0) { + int64_t pos = avio_tell(s); + int64_t remaining = ctx->maxsize - pos; + if (remaining < size) { + int64_t newsize = avio_size(s); + if (!ctx->maxsize || ctx->maxsize < newsize) + ctx->maxsize = newsize - !newsize; + if (pos > ctx->maxsize && ctx->maxsize >= 0) + ctx->maxsize = AVERROR(EIO); + if (ctx->maxsize >= 0) + remaining = ctx->maxsize - pos; + } + + if (ctx->maxsize >= 0 && remaining < size && size > 1) { + av_log(NULL, remaining ? AV_LOG_ERROR : AV_LOG_DEBUG, + "Truncating packet of size %d to %"PRId64"\n", + size, remaining + !remaining); + size = remaining + !remaining; + } + } + return size; +} + +static int set_buf_size(AVIOContext *s, int buf_size) { uint8_t *buffer; buffer = av_malloc(buf_size); @@ -1022,7 +1057,7 @@ int ffio_set_buf_size(AVIOContext *s, int buf_size) av_free(s->buffer); s->buffer = buffer; - s->orig_buffer_size = + ffiocontext(s)->orig_buffer_size = s->buffer_size = buf_size; s->buf_ptr = s->buf_ptr_max = buffer; url_resetbuf(s, s->write_flag ? AVIO_FLAG_WRITE : AVIO_FLAG_READ); @@ -1035,7 +1070,7 @@ int ffio_realloc_buf(AVIOContext *s, int buf_size) int data_size; if (!s->buffer_size) - return ffio_set_buf_size(s, buf_size); + return set_buf_size(s, buf_size); if (buf_size <= s->buffer_size) return 0; @@ -1049,7 +1084,7 @@ int ffio_realloc_buf(AVIOContext *s, int buf_size) memcpy(buffer, s->write_flag ? s->buffer : s->buf_ptr, data_size); av_free(s->buffer); s->buffer = buffer; - s->orig_buffer_size = buf_size; + ffiocontext(s)->orig_buffer_size = buf_size; s->buffer_size = buf_size; s->buf_ptr = s->write_flag ? (s->buffer + data_size) : s->buffer; if (s->write_flag) @@ -1151,6 +1186,7 @@ int avio_open2(AVIOContext **s, const char *filename, int flags, int avio_close(AVIOContext *s) { + FFIOContext *const ctx = ffiocontext(s); URLContext *h; if (!s) @@ -1162,9 +1198,11 @@ int avio_close(AVIOContext *s) av_freep(&s->buffer); if (s->write_flag) - av_log(s, AV_LOG_VERBOSE, "Statistics: %d seeks, %d writeouts\n", s->seek_count, s->writeout_count); + av_log(s, AV_LOG_VERBOSE, "Statistics: %d seeks, %d writeouts\n", + ctx->seek_count, ctx->writeout_count); else - av_log(s, AV_LOG_VERBOSE, "Statistics: %"PRId64" bytes read, %d seeks\n", s->bytes_read, s->seek_count); + av_log(s, AV_LOG_VERBOSE, "Statistics: %"PRId64" bytes read, %d seeks\n", + ctx->bytes_read, ctx->seek_count); av_opt_free(s); avio_context_free(&s); @@ -1339,22 +1377,21 @@ static int64_t dyn_buf_seek(void *opaque, int64_t offset, int whence) static int url_open_dyn_buf_internal(AVIOContext **s, int max_packet_size) { + struct { FFIOContext pb; DynBuffer d; } *ret; DynBuffer *d; unsigned io_buffer_size = max_packet_size ? max_packet_size : 1024; - if (sizeof(DynBuffer) + io_buffer_size < io_buffer_size) + if (sizeof(*ret) + io_buffer_size < io_buffer_size) return AVERROR(ERANGE); - d = av_mallocz(sizeof(DynBuffer) + io_buffer_size); - if (!d) + ret = av_mallocz(sizeof(*ret) + io_buffer_size); + if (!ret) return AVERROR(ENOMEM); + d = &ret->d; d->io_buffer_size = io_buffer_size; - *s = avio_alloc_context(d->io_buffer, d->io_buffer_size, 1, d, NULL, - max_packet_size ? dyn_packet_buf_write : dyn_buf_write, - max_packet_size ? NULL : dyn_buf_seek); - if(!*s) { - av_free(d); - return AVERROR(ENOMEM); - } + ffio_init_context(&ret->pb, d->io_buffer, d->io_buffer_size, 1, d, NULL, + max_packet_size ? dyn_packet_buf_write : dyn_buf_write, + max_packet_size ? NULL : dyn_buf_seek); + *s = &ret->pb.pub; (*s)->max_packet_size = max_packet_size; return 0; } @@ -1398,8 +1435,8 @@ void ffio_reset_dyn_buf(AVIOContext *s) DynBuffer *d = s->opaque; int max_packet_size = s->max_packet_size; - ffio_init_context(s, d->io_buffer, d->io_buffer_size, 1, d, NULL, - s->write_packet, s->seek); + ffio_init_context(ffiocontext(s), d->io_buffer, d->io_buffer_size, + 1, d, NULL, s->write_packet, s->seek); s->max_packet_size = max_packet_size; d->pos = d->size = 0; } @@ -1408,7 +1445,6 @@ int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer) { DynBuffer *d; int size; - static const char padbuf[AV_INPUT_BUFFER_PADDING_SIZE] = {0}; int padding = 0; if (!s) { @@ -1418,7 +1454,7 @@ int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer) /* don't attempt to pad fixed-size packet buffers */ if (!s->max_packet_size) { - avio_write(s, padbuf, sizeof(padbuf)); + ffio_fill(s, 0, AV_INPUT_BUFFER_PADDING_SIZE); padding = AV_INPUT_BUFFER_PADDING_SIZE; } @@ -1427,7 +1463,6 @@ int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer) d = s->opaque; *pbuffer = d->buffer; size = d->size; - av_free(d); avio_context_free(&s); @@ -1443,7 +1478,6 @@ void ffio_free_dyn_buf(AVIOContext **s) d = (*s)->opaque; av_free(d->buffer); - av_free(d); avio_context_free(s); } @@ -1475,7 +1509,6 @@ int ffio_close_null_buf(AVIOContext *s) avio_flush(s); size = d->size; - av_free(d); avio_context_free(&s); diff --git a/chromium/third_party/ffmpeg/libavformat/bfi.c b/chromium/third_party/ffmpeg/libavformat/bfi.c index bff6f0154ec..69000118fa0 100644 --- a/chromium/third_party/ffmpeg/libavformat/bfi.c +++ b/chromium/third_party/ffmpeg/libavformat/bfi.c @@ -73,6 +73,8 @@ static int bfi_read_header(AVFormatContext * s) return AVERROR_INVALIDDATA; bfi->nframes = avio_rl32(pb); + if (bfi->nframes < 0) + return AVERROR_INVALIDDATA; avio_rl32(pb); avio_rl32(pb); avio_rl32(pb); diff --git a/chromium/third_party/ffmpeg/libavformat/cafdec.c b/chromium/third_party/ffmpeg/libavformat/cafdec.c index e9d171e36be..4df8744b79b 100644 --- a/chromium/third_party/ffmpeg/libavformat/cafdec.c +++ b/chromium/third_party/ffmpeg/libavformat/cafdec.c @@ -328,7 +328,7 @@ static int read_header(AVFormatContext *s) break; } - if (size > 0) { + if (size > 0 && (pb->seekable & AVIO_SEEKABLE_NORMAL)) { if (pos > INT64_MAX - size) return AVERROR_INVALIDDATA; avio_skip(pb, FFMAX(0, pos + size - avio_tell(pb))); diff --git a/chromium/third_party/ffmpeg/libavformat/concatdec.c b/chromium/third_party/ffmpeg/libavformat/concatdec.c index 934e9c02fca..30db456b0eb 100644 --- a/chromium/third_party/ffmpeg/libavformat/concatdec.c +++ b/chromium/third_party/ffmpeg/libavformat/concatdec.c @@ -52,6 +52,7 @@ typedef struct { int64_t inpoint; int64_t outpoint; AVDictionary *metadata; + AVDictionary *options; int nb_streams; } ConcatFile; @@ -118,7 +119,7 @@ static int add_file(AVFormatContext *avf, char *filename, ConcatFile **rfile, size_t url_len; int ret; - if (cat->safe > 0 && !safe_filename(filename)) { + if (cat->safe && !safe_filename(filename)) { av_log(avf, AV_LOG_ERROR, "Unsafe file name '%s'\n", filename); FAIL(AVERROR(EPERM)); } @@ -330,6 +331,7 @@ static int open_file(AVFormatContext *avf, unsigned fileno) { ConcatContext *cat = avf->priv_data; ConcatFile *file = &cat->files[fileno]; + AVDictionary *options = NULL; int ret; if (cat->avf) @@ -345,12 +347,22 @@ static int open_file(AVFormatContext *avf, unsigned fileno) if ((ret = ff_copy_whiteblacklists(cat->avf, avf)) < 0) return ret; - if ((ret = avformat_open_input(&cat->avf, file->url, NULL, NULL)) < 0 || + ret = av_dict_copy(&options, file->options, 0); + if (ret < 0) + return ret; + + if ((ret = avformat_open_input(&cat->avf, file->url, NULL, &options)) < 0 || (ret = avformat_find_stream_info(cat->avf, NULL)) < 0) { av_log(avf, AV_LOG_ERROR, "Impossible to open '%s'\n", file->url); + av_dict_free(&options); avformat_close_input(&cat->avf); return ret; } + if (options) { + av_log(avf, AV_LOG_WARNING, "Unused options for '%s'.\n", file->url); + /* TODO log unused options once we have a proper string API */ + av_dict_free(&options); + } cat->cur_file = file; file->start_time = !fileno ? 0 : cat->files[fileno - 1].start_time + @@ -387,6 +399,7 @@ static int concat_read_close(AVFormatContext *avf) } av_freep(&cat->files[i].streams); av_dict_free(&cat->files[i].metadata); + av_dict_free(&cat->files[i].options); } if (cat->avf) avformat_close_input(&cat->avf); @@ -458,6 +471,26 @@ static int concat_read_header(AVFormatContext *avf) FAIL(AVERROR_INVALIDDATA); } av_freep(&metadata); + } else if (!strcmp(keyword, "option")) { + char *key, *val; + if (cat->safe) { + av_log(avf, AV_LOG_ERROR, "Options not permitted in safe mode.\n"); + FAIL(AVERROR(EPERM)); + } + if (!file) { + av_log(avf, AV_LOG_ERROR, "Line %d: %s without file\n", + line, keyword); + FAIL(AVERROR_INVALIDDATA); + } + if (!(key = av_get_token((const char **)&cursor, SPACE_CHARS)) || + !(val = av_get_token((const char **)&cursor, SPACE_CHARS))) { + av_freep(&key); + FAIL(AVERROR(ENOMEM)); + } + ret = av_dict_set(&file->options, key, val, + AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL); + if (ret < 0) + FAIL(ret); } else if (!strcmp(keyword, "stream")) { if (!avformat_new_stream(avf, NULL)) FAIL(AVERROR(ENOMEM)); @@ -476,8 +509,6 @@ static int concat_read_header(AVFormatContext *avf) av_log(avf, AV_LOG_ERROR, "Line %d: invalid version\n", line); FAIL(AVERROR_INVALIDDATA); } - if (cat->safe < 0) - cat->safe = 1; } else { av_log(avf, AV_LOG_ERROR, "Line %d: unknown keyword '%s'\n", line, keyword); @@ -757,7 +788,7 @@ static int concat_seek(AVFormatContext *avf, int stream, static const AVOption options[] = { { "safe", "enable safe mode", - OFFSET(safe), AV_OPT_TYPE_BOOL, {.i64 = 1}, -1, 1, DEC }, + OFFSET(safe), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, DEC }, { "auto_convert", "automatically convert bitstream format", OFFSET(auto_convert), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, DEC }, { "segment_time_metadata", "output file segment start time and duration as packet metadata", diff --git a/chromium/third_party/ffmpeg/libavformat/crcenc.c b/chromium/third_party/ffmpeg/libavformat/crcenc.c index 4fdc448141c..c58fbd6c883 100644 --- a/chromium/third_party/ffmpeg/libavformat/crcenc.c +++ b/chromium/third_party/ffmpeg/libavformat/crcenc.c @@ -48,10 +48,8 @@ static int crc_write_packet(struct AVFormatContext *s, AVPacket *pkt) static int crc_write_trailer(struct AVFormatContext *s) { CRCState *crc = s->priv_data; - char buf[64]; - snprintf(buf, sizeof(buf), "CRC=0x%08"PRIx32"\n", crc->crcval); - avio_write(s->pb, buf, strlen(buf)); + avio_printf(s->pb, "CRC=0x%08"PRIx32"\n", crc->crcval); return 0; } diff --git a/chromium/third_party/ffmpeg/libavformat/dashdec.c b/chromium/third_party/ffmpeg/libavformat/dashdec.c index 6105ec46d9b..983dc85d654 100644 --- a/chromium/third_party/ffmpeg/libavformat/dashdec.c +++ b/chromium/third_party/ffmpeg/libavformat/dashdec.c @@ -77,7 +77,7 @@ struct timeline { */ struct representation { char *url_template; - AVIOContext pb; + FFIOContext pb; AVIOContext *input; AVFormatContext *parent; AVFormatContext *ctx; @@ -353,7 +353,7 @@ static void free_representation(struct representation *pls) free_fragment(&pls->cur_seg); free_fragment(&pls->init_section); av_freep(&pls->init_sec_buf); - av_freep(&pls->pb.buffer); + av_freep(&pls->pb.pub.buffer); ff_format_io_close(pls->parent, &pls->input); if (pls->ctx) { pls->ctx->pb = NULL; @@ -1871,8 +1871,8 @@ static int nested_io_open(AVFormatContext *s, AVIOContext **pb, const char *url, static void close_demux_for_component(struct representation *pls) { /* note: the internal buffer could have changed */ - av_freep(&pls->pb.buffer); - memset(&pls->pb, 0x00, sizeof(AVIOContext)); + av_freep(&pls->pb.pub.buffer); + memset(&pls->pb, 0x00, sizeof(pls->pb)); pls->ctx->pb = NULL; avformat_close_input(&pls->ctx); } @@ -1908,7 +1908,7 @@ static int reopen_demux_for_component(AVFormatContext *s, struct representation } ffio_init_context(&pls->pb, avio_ctx_buffer, INITIAL_BUFFER_SIZE, 0, pls, read_data, NULL, c->is_live ? NULL : seek_data); - pls->pb.seekable = 0; + pls->pb.pub.seekable = 0; if ((ret = ff_copy_whiteblacklists(pls->ctx, s)) < 0) goto fail; @@ -1917,7 +1917,7 @@ static int reopen_demux_for_component(AVFormatContext *s, struct representation pls->ctx->probesize = s->probesize > 0 ? s->probesize : 1024 * 4; pls->ctx->max_analyze_duration = s->max_analyze_duration > 0 ? s->max_analyze_duration : 4 * AV_TIME_BASE; pls->ctx->interrupt_callback = s->interrupt_callback; - ret = av_probe_input_buffer(&pls->pb, &in_fmt, "", NULL, 0, 0); + ret = av_probe_input_buffer(&pls->pb.pub, &in_fmt, "", NULL, 0, 0); if (ret < 0) { av_log(s, AV_LOG_ERROR, "Error when loading first fragment of playlist\n"); avformat_free_context(pls->ctx); @@ -1925,7 +1925,7 @@ static int reopen_demux_for_component(AVFormatContext *s, struct representation goto fail; } - pls->ctx->pb = &pls->pb; + pls->ctx->pb = &pls->pb.pub; pls->ctx->io_open = nested_io_open; // provide additional information from mpd if available diff --git a/chromium/third_party/ffmpeg/libavformat/dhav.c b/chromium/third_party/ffmpeg/libavformat/dhav.c index 92bbfab7c5c..28c476d9c1f 100644 --- a/chromium/third_party/ffmpeg/libavformat/dhav.c +++ b/chromium/third_party/ffmpeg/libavformat/dhav.c @@ -47,6 +47,7 @@ typedef struct DHAVContext { } DHAVContext; typedef struct DHAVStream { + int64_t last_frame_number; int64_t last_timestamp; int64_t last_time; int64_t pts; @@ -314,6 +315,8 @@ static int64_t get_pts(AVFormatContext *s, int stream_index) if (diff < 0) diff += 65535; + if (diff == 0) + diff = av_rescale(dhav->frame_number - dst->last_frame_number, 1000, dhav->frame_rate); dst->pts += diff; } else { dst->pts = t * 1000LL; @@ -321,6 +324,7 @@ static int64_t get_pts(AVFormatContext *s, int stream_index) dst->last_time = t; dst->last_timestamp = dhav->timestamp; + dst->last_frame_number = dhav->frame_number; return dst->pts; } diff --git a/chromium/third_party/ffmpeg/libavformat/dsfdec.c b/chromium/third_party/ffmpeg/libavformat/dsfdec.c index 02ee4c12317..c872f98cc24 100644 --- a/chromium/third_party/ffmpeg/libavformat/dsfdec.c +++ b/chromium/third_party/ffmpeg/libavformat/dsfdec.c @@ -130,7 +130,7 @@ static int dsf_read_header(AVFormatContext *s) return AVERROR_INVALIDDATA; } st->codecpar->block_align *= st->codecpar->channels; - st->codecpar->bit_rate = st->codecpar->channels * st->codecpar->sample_rate * 8LL; + st->codecpar->bit_rate = st->codecpar->channels * 8LL * st->codecpar->sample_rate; avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); avio_skip(pb, 4); diff --git a/chromium/third_party/ffmpeg/libavformat/dsicin.c b/chromium/third_party/ffmpeg/libavformat/dsicin.c index 5693b11e8ce..481f365a53c 100644 --- a/chromium/third_party/ffmpeg/libavformat/dsicin.c +++ b/chromium/third_party/ffmpeg/libavformat/dsicin.c @@ -166,7 +166,8 @@ static int cin_read_packet(AVFormatContext *s, AVPacket *pkt) CinDemuxContext *cin = s->priv_data; AVIOContext *pb = s->pb; CinFrameHeader *hdr = &cin->frame_header; - int rc, palette_type, pkt_size; + int rc, palette_type; + int64_t pkt_size; int ret; if (cin->audio_buffer_size == 0) { @@ -182,7 +183,9 @@ static int cin_read_packet(AVFormatContext *s, AVPacket *pkt) } /* palette and video packet */ - pkt_size = (palette_type + 3) * hdr->pal_colors_count + hdr->video_frame_size; + pkt_size = (palette_type + 3LL) * hdr->pal_colors_count + hdr->video_frame_size; + if (pkt_size + 4 > INT_MAX) + return AVERROR_INVALIDDATA; pkt_size = ffio_limit(pb, pkt_size); diff --git a/chromium/third_party/ffmpeg/libavformat/dv.c b/chromium/third_party/ffmpeg/libavformat/dv.c index d7909683c3e..b2b74162df4 100644 --- a/chromium/third_party/ffmpeg/libavformat/dv.c +++ b/chromium/third_party/ffmpeg/libavformat/dv.c @@ -48,6 +48,7 @@ struct DVPacket { int stream_index; int flags; int64_t pos; + int64_t duration; }; struct DVDemuxContext { @@ -276,6 +277,7 @@ static int dv_extract_audio_info(DVDemuxContext *c, const uint8_t *frame) c->audio_pkt[i].stream_index = c->ast[i]->index; c->audio_pkt[i].flags |= AV_PKT_FLAG_KEY; c->audio_pkt[i].pts = AV_NOPTS_VALUE; + c->audio_pkt[i].duration = 0; c->audio_pkt[i].pos = -1; } c->ast[i]->codecpar->sample_rate = dv_audio_frequency[freq]; @@ -374,6 +376,7 @@ int avpriv_dv_get_packet(DVDemuxContext *c, AVPacket *pkt) pkt->stream_index = c->audio_pkt[i].stream_index; pkt->flags = c->audio_pkt[i].flags; pkt->pts = c->audio_pkt[i].pts; + pkt->duration = c->audio_pkt[i].duration; pkt->pos = c->audio_pkt[i].pos; c->audio_pkt[i].size = 0; @@ -404,6 +407,7 @@ int avpriv_dv_produce_packet(DVDemuxContext *c, AVPacket *pkt, c->audio_pkt[i].pos = pos; c->audio_pkt[i].size = size; c->audio_pkt[i].pts = (c->sys->height == 720) ? (c->frames & ~1) : c->frames; + c->audio_pkt[i].duration = 1; ppcm[i] = c->audio_buf[i]; } if (c->ach) diff --git a/chromium/third_party/ffmpeg/libavformat/fifo.c b/chromium/third_party/ffmpeg/libavformat/fifo.c index a9b59b65892..10511167cd4 100644 --- a/chromium/third_party/ffmpeg/libavformat/fifo.c +++ b/chromium/third_party/ffmpeg/libavformat/fifo.c @@ -129,7 +129,7 @@ static int fifo_thread_write_header(FifoThreadContext *ctx) ret = av_dict_copy(&format_options, fifo->format_options, 0); if (ret < 0) - return ret; + goto end; ret = ff_format_output_open(avf2, avf->url, &format_options); if (ret < 0) { diff --git a/chromium/third_party/ffmpeg/libavformat/file.c b/chromium/third_party/ffmpeg/libavformat/file.c index 8303436be09..9c23f680cd1 100644 --- a/chromium/third_party/ffmpeg/libavformat/file.c +++ b/chromium/third_party/ffmpeg/libavformat/file.c @@ -167,6 +167,8 @@ static int file_check(URLContext *h, int mask) return ret; } +#if CONFIG_FILE_PROTOCOL + static int file_delete(URLContext *h) { #if HAVE_UNISTD_H @@ -203,8 +205,6 @@ static int file_move(URLContext *h_src, URLContext *h_dst) return 0; } -#if CONFIG_FILE_PROTOCOL - static int file_open(URLContext *h, const char *filename, int flags) { FileContext *c = h->priv_data; diff --git a/chromium/third_party/ffmpeg/libavformat/flac_picture.c b/chromium/third_party/ffmpeg/libavformat/flac_picture.c index 96e14f76c90..0effbf04f6b 100644 --- a/chromium/third_party/ffmpeg/libavformat/flac_picture.c +++ b/chromium/third_party/ffmpeg/libavformat/flac_picture.c @@ -29,12 +29,14 @@ #define MAX_TRUNC_PICTURE_SIZE (500 * 1024 * 1024) -int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size, int truncate_workaround) +int ff_flac_parse_picture(AVFormatContext *s, uint8_t **bufp, int buf_size, + int truncate_workaround) { const CodecMime *mime = ff_id3v2_mime_tags; enum AVCodecID id = AV_CODEC_ID_NONE; AVBufferRef *data = NULL; - uint8_t mimetype[64], *desc = NULL; + uint8_t mimetype[64], *buf = *bufp; + const uint8_t *desc = NULL; GetByteContext g; AVStream *st; int width, height, ret = 0; @@ -102,16 +104,13 @@ int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size, int tr return 0; } if (len > 0) { - if (!(desc = av_malloc(len + 1))) { - return AVERROR(ENOMEM); - } - - bytestream2_get_bufferu(&g, desc, len); - desc[len] = 0; + desc = g.buffer; + bytestream2_skipu(&g, len); } /* picture metadata */ width = bytestream2_get_be32u(&g); + ((uint8_t*)g.buffer)[-4] = '\0'; // NUL-terminate desc. height = bytestream2_get_be32u(&g); bytestream2_skipu(&g, 8); @@ -123,8 +122,8 @@ int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size, int tr if (len > MAX_TRUNC_PICTURE_SIZE || len >= INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE) { av_log(s, AV_LOG_ERROR, "Attached picture metadata block too big %u\n", len); if (s->error_recognition & AV_EF_EXPLODE) - ret = AVERROR_INVALIDDATA; - goto fail; + return AVERROR_INVALIDDATA; + return 0; } // Workaround bug for flac muxers that writs truncated metadata picture block size if @@ -138,22 +137,31 @@ int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size, int tr } else { av_log(s, AV_LOG_ERROR, "Attached picture metadata block too short\n"); if (s->error_recognition & AV_EF_EXPLODE) - ret = AVERROR_INVALIDDATA; - goto fail; + return AVERROR_INVALIDDATA; + return 0; } } - if (!(data = av_buffer_alloc(len + AV_INPUT_BUFFER_PADDING_SIZE))) { - RETURN_ERROR(AVERROR(ENOMEM)); - } - - if (trunclen == 0) { - bytestream2_get_bufferu(&g, data->data, len); + if (trunclen == 0 && len >= buf_size - (buf_size >> 4)) { + data = av_buffer_create(buf, buf_size + AV_INPUT_BUFFER_PADDING_SIZE, + av_buffer_default_free, NULL, 0); + if (!data) + return AVERROR(ENOMEM); + *bufp = NULL; + data->data += bytestream2_tell(&g); + data->size = len + AV_INPUT_BUFFER_PADDING_SIZE; } else { - // If truncation was detected copy all data from block and read missing bytes - // not included in the block size - bytestream2_get_bufferu(&g, data->data, left); - if (avio_read(s->pb, data->data + len - trunclen, trunclen) < trunclen) - RETURN_ERROR(AVERROR_INVALIDDATA); + if (!(data = av_buffer_alloc(len + AV_INPUT_BUFFER_PADDING_SIZE))) + return AVERROR(ENOMEM); + + if (trunclen == 0) { + bytestream2_get_bufferu(&g, data->data, len); + } else { + // If truncation was detected copy all data from block and + // read missing bytes not included in the block size. + bytestream2_get_bufferu(&g, data->data, left); + if (avio_read(s->pb, data->data + len - trunclen, trunclen) < trunclen) + RETURN_ERROR(AVERROR_INVALIDDATA); + } } memset(data->data + len, 0, AV_INPUT_BUFFER_PADDING_SIZE); @@ -170,13 +178,12 @@ int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size, int tr st->codecpar->height = height; av_dict_set(&st->metadata, "comment", ff_id3v2_picture_types[type], 0); if (desc) - av_dict_set(&st->metadata, "title", desc, AV_DICT_DONT_STRDUP_VAL); + av_dict_set(&st->metadata, "title", desc, 0); return 0; fail: av_buffer_unref(&data); - av_freep(&desc); return ret; } diff --git a/chromium/third_party/ffmpeg/libavformat/flac_picture.h b/chromium/third_party/ffmpeg/libavformat/flac_picture.h index 61fd0c88065..db074e531d9 100644 --- a/chromium/third_party/ffmpeg/libavformat/flac_picture.h +++ b/chromium/third_party/ffmpeg/libavformat/flac_picture.h @@ -26,6 +26,18 @@ #define RETURN_ERROR(code) do { ret = (code); goto fail; } while (0) -int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size, int truncate_workaround); +/** + * Parse a FLAC METADATA_BLOCK_PICTURE + * + * @param s AVFormatContext for logging and the attached picture stream. + * @param buf `*buf` points to the actual data which must be padded by + * AV_INPUT_BUFFER_PADDING_SIZE bytes not counted in buf_size. + * This function may take ownership of `*buf` and reset it. + * @param buf_size size of `*buf` (excluding padding) + * @param truncate_workaround If set, additional data may be read from s->pb if + * truncation has been detected. + */ +int ff_flac_parse_picture(AVFormatContext *s, uint8_t **buf, int buf_size, + int truncate_workaround); #endif /* AVFORMAT_FLAC_PICTURE_H */ diff --git a/chromium/third_party/ffmpeg/libavformat/flacdec.c b/chromium/third_party/ffmpeg/libavformat/flacdec.c index bfa464c5086..2060b48c696 100644 --- a/chromium/third_party/ffmpeg/libavformat/flacdec.c +++ b/chromium/third_party/ffmpeg/libavformat/flacdec.c @@ -145,7 +145,7 @@ static int flac_read_header(AVFormatContext *s) } av_freep(&buffer); } else if (metadata_type == FLAC_METADATA_TYPE_PICTURE) { - ret = ff_flac_parse_picture(s, buffer, metadata_size, 1); + ret = ff_flac_parse_picture(s, &buffer, metadata_size, 1); av_freep(&buffer); if (ret < 0) { av_log(s, AV_LOG_ERROR, "Error parsing attached picture.\n"); diff --git a/chromium/third_party/ffmpeg/libavformat/hls.c b/chromium/third_party/ffmpeg/libavformat/hls.c index 3c1b80f60cb..421a60a4762 100644 --- a/chromium/third_party/ffmpeg/libavformat/hls.c +++ b/chromium/third_party/ffmpeg/libavformat/hls.c @@ -92,7 +92,7 @@ enum PlaylistType { */ struct playlist { char url[MAX_URL_SIZE]; - AVIOContext pb; + FFIOContext pb; uint8_t* read_buffer; AVIOContext *input; int input_read_done; @@ -258,7 +258,7 @@ static void free_playlist_list(HLSContext *c) ff_id3v2_free_extra_meta(&pls->id3_deferred_extra); av_freep(&pls->init_sec_buf); av_packet_free(&pls->pkt); - av_freep(&pls->pb.buffer); + av_freep(&pls->pb.pub.buffer); ff_format_io_close(c->ctx, &pls->input); pls->input_read_done = 0; ff_format_io_close(c->ctx, &pls->input_next); @@ -1222,9 +1222,9 @@ static void intercept_id3(struct playlist *pls, uint8_t *buf, if (pls->id3_buf) { /* Now parse all the ID3 tags */ - AVIOContext id3ioctx; + FFIOContext id3ioctx; ffio_init_context(&id3ioctx, pls->id3_buf, id3_buf_pos, 0, NULL, NULL, NULL, NULL); - handle_id3(&id3ioctx, pls); + handle_id3(&id3ioctx.pub, pls); } if (pls->is_id3_timestamped == -1) @@ -1995,7 +1995,7 @@ static int hls_read_header(AVFormatContext *s) pls->ctx->max_analyze_duration = s->max_analyze_duration > 0 ? s->max_analyze_duration : 4 * AV_TIME_BASE; pls->ctx->interrupt_callback = s->interrupt_callback; url = av_strdup(pls->segments[0]->url); - ret = av_probe_input_buffer(&pls->pb, &in_fmt, url, NULL, 0, 0); + ret = av_probe_input_buffer(&pls->pb.pub, &in_fmt, url, NULL, 0, 0); if (ret < 0) { /* Free the ctx - it isn't initialized properly at this point, * so avformat_close_input shouldn't be called. If @@ -2008,7 +2008,7 @@ static int hls_read_header(AVFormatContext *s) return ret; } av_free(url); - pls->ctx->pb = &pls->pb; + pls->ctx->pb = &pls->pb.pub; pls->ctx->io_open = nested_io_open; pls->ctx->flags |= s->flags & ~AVFMT_FLAG_CUSTOM_IO; @@ -2087,7 +2087,7 @@ static int recheck_discard_flags(AVFormatContext *s, int first) pls->needed = 1; changed = 1; pls->cur_seq_no = select_cur_seq_no(c, pls); - pls->pb.eof_reached = 0; + pls->pb.pub.eof_reached = 0; if (c->cur_timestamp != AV_NOPTS_VALUE) { /* catch up */ pls->seek_timestamp = c->cur_timestamp; @@ -2168,7 +2168,7 @@ static int hls_read_packet(AVFormatContext *s, AVPacket *pkt) AVRational tb; ret = av_read_frame(pls->ctx, pls->pkt); if (ret < 0) { - if (!avio_feof(&pls->pb) && ret != AVERROR_EOF) + if (!avio_feof(&pls->pb.pub) && ret != AVERROR_EOF) return ret; break; } else { @@ -2336,16 +2336,17 @@ static int hls_read_seek(AVFormatContext *s, int stream_index, for (i = 0; i < c->n_playlists; i++) { /* Reset reading */ struct playlist *pls = c->playlists[i]; + AVIOContext *const pb = &pls->pb.pub; ff_format_io_close(pls->parent, &pls->input); pls->input_read_done = 0; ff_format_io_close(pls->parent, &pls->input_next); pls->input_next_requested = 0; av_packet_unref(pls->pkt); - pls->pb.eof_reached = 0; + pb->eof_reached = 0; /* Clear any buffered data */ - pls->pb.buf_end = pls->pb.buf_ptr = pls->pb.buffer; + pb->buf_end = pb->buf_ptr = pb->buffer; /* Reset the pos, to let the mpegts demuxer know we've seeked. */ - pls->pb.pos = 0; + pb->pos = 0; /* Flush the packet queue of the subdemuxer. */ ff_read_frame_flush(pls->ctx); diff --git a/chromium/third_party/ffmpeg/libavformat/hlsenc.c b/chromium/third_party/ffmpeg/libavformat/hlsenc.c index 6447f9bf48d..7c37bc50b9a 100644 --- a/chromium/third_party/ffmpeg/libavformat/hlsenc.c +++ b/chromium/third_party/ffmpeg/libavformat/hlsenc.c @@ -571,6 +571,7 @@ static int hls_delete_file(HLSContext *hls, AVFormatContext *avf, AVDictionary *opt = NULL; AVIOContext *out = NULL; int ret; + set_http_options(avf, &opt, hls); av_dict_set(&opt, "method", "DELETE", 0); ret = avf->io_open(avf, &out, path, AVIO_FLAG_WRITE, &opt); av_dict_free(&opt); @@ -2292,6 +2293,7 @@ static int hls_write_header(AVFormatContext *s) VariantStream *vs = NULL; for (i = 0; i < hls->nb_varstreams; i++) { + int subtitle_streams = 0; vs = &hls->var_streams[i]; ret = avformat_write_header(vs->avf, NULL); @@ -2312,10 +2314,11 @@ static int hls_write_header(AVFormatContext *s) } if (outer_st->codecpar->codec_type != AVMEDIA_TYPE_SUBTITLE) - inner_st = vs->avf->streams[j]; - else if (vs->vtt_avf) + inner_st = vs->avf->streams[j - subtitle_streams]; + else if (vs->vtt_avf) { inner_st = vs->vtt_avf->streams[0]; - else { + subtitle_streams++; + } else { /* We have a subtitle stream, when the user does not want one */ inner_st = NULL; continue; @@ -2402,6 +2405,7 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt) int is_ref_pkt = 1; int ret = 0, can_split = 1, i, j; int stream_index = 0; + int subtitle_streams = 0; int range_length = 0; const char *proto = NULL; int use_temp_file = 0; @@ -2411,13 +2415,16 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt) for (i = 0; i < hls->nb_varstreams; i++) { vs = &hls->var_streams[i]; for (j = 0; j < vs->nb_streams; j++) { + if (vs->streams[j]->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) { + subtitle_streams++; + } if (vs->streams[j] == st) { if (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) { oc = vs->vtt_avf; stream_index = 0; } else { oc = vs->avf; - stream_index = j; + stream_index = j - subtitle_streams; } break; } @@ -2646,7 +2653,6 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt) if (ret < 0) { return ret; } - } vs->packets_written++; diff --git a/chromium/third_party/ffmpeg/libavformat/id3v2.c b/chromium/third_party/ffmpeg/libavformat/id3v2.c index 96226193c1d..ff27c062e53 100644 --- a/chromium/third_party/ffmpeg/libavformat/id3v2.c +++ b/chromium/third_party/ffmpeg/libavformat/id3v2.c @@ -827,7 +827,7 @@ static void id3v2_parse(AVIOContext *pb, AVDictionary **metadata, int64_t next, end = avio_tell(pb); int taghdrlen; const char *reason = NULL; - AVIOContext pb_local; + FFIOContext pb_local; AVIOContext *pbx; unsigned char *buffer = NULL; int buffer_size = 0; @@ -999,7 +999,7 @@ static void id3v2_parse(AVIOContext *pb, AVDictionary **metadata, ffio_init_context(&pb_local, buffer, b - buffer, 0, NULL, NULL, NULL, NULL); tlen = b - buffer; - pbx = &pb_local; // read from sync buffer + pbx = &pb_local.pub; // read from sync buffer } #if CONFIG_ZLIB @@ -1035,7 +1035,7 @@ static void id3v2_parse(AVIOContext *pb, AVDictionary **metadata, } ffio_init_context(&pb_local, uncompressed_buffer, dlen, 0, NULL, NULL, NULL, NULL); tlen = dlen; - pbx = &pb_local; // read from sync buffer + pbx = &pb_local.pub; // read from sync buffer } #endif if (tag[0] == 'T') diff --git a/chromium/third_party/ffmpeg/libavformat/ilbc.c b/chromium/third_party/ffmpeg/libavformat/ilbc.c index efa5339089e..0cbdd3d5b8e 100644 --- a/chromium/third_party/ffmpeg/libavformat/ilbc.c +++ b/chromium/third_party/ffmpeg/libavformat/ilbc.c @@ -99,15 +99,11 @@ static int ilbc_read_packet(AVFormatContext *s, AVCodecParameters *par = s->streams[0]->codecpar; int ret; - if ((ret = av_new_packet(pkt, par->block_align)) < 0) - return ret; + if ((ret = av_get_packet(s->pb, pkt, par->block_align)) != par->block_align) + return ret < 0 ? ret : AVERROR_INVALIDDATA; pkt->stream_index = 0; - pkt->pos = avio_tell(s->pb); pkt->duration = par->block_align == 38 ? 160 : 240; - if ((ret = avio_read(s->pb, pkt->data, par->block_align)) != par->block_align) { - return ret < 0 ? ret : AVERROR(EIO); - } return 0; } diff --git a/chromium/third_party/ffmpeg/libavformat/internal.h b/chromium/third_party/ffmpeg/libavformat/internal.h index 002aeb66015..9d7312c0e2f 100644 --- a/chromium/third_party/ffmpeg/libavformat/internal.h +++ b/chromium/third_party/ffmpeg/libavformat/internal.h @@ -506,7 +506,8 @@ void ff_sdp_write_media(char *buff, int size, AVStream *st, int idx, * * @param dst the muxer to write the packet to * @param dst_stream the stream index within dst to write the packet to - * @param pkt the packet to be written + * @param pkt the packet to be written. It will be returned blank when + * av_interleaved_write_frame() is used, unchanged otherwise. * @param src the muxer the packet originally was intended for * @param interleave 0->use av_write_frame, 1->av_interleaved_write_frame * @return the value av_write_frame returned @@ -715,12 +716,6 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, void ff_free_stream(AVFormatContext *s, AVStream *st); -/** - * Return the frame duration in seconds. Return 0 if not available. - */ -void ff_compute_frame_duration(AVFormatContext *s, int *pnum, int *pden, AVStream *st, - AVCodecParserContext *pc, AVPacket *pkt); - unsigned int ff_codec_get_tag(const AVCodecTag *tags, enum AVCodecID id); enum AVCodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag); diff --git a/chromium/third_party/ffmpeg/libavformat/isom.h b/chromium/third_party/ffmpeg/libavformat/isom.h index ac1b3f3d56c..34a58c79b7e 100644 --- a/chromium/third_party/ffmpeg/libavformat/isom.h +++ b/chromium/third_party/ffmpeg/libavformat/isom.h @@ -387,4 +387,7 @@ static inline enum AVCodecID ff_mov_get_lpcm_codec_id(int bps, int flags) return ff_get_pcm_codec_id(bps, flags & 1, flags & 2, flags & 4 ? -1 : 0); } +#define MOV_ISMV_TTML_TAG MKTAG('d', 'f', 'x', 'p') +#define MOV_MP4_TTML_TAG MKTAG('s', 't', 'p', 'p') + #endif /* AVFORMAT_ISOM_H */ diff --git a/chromium/third_party/ffmpeg/libavformat/isom_tags.c b/chromium/third_party/ffmpeg/libavformat/isom_tags.c index 1666b9d4a50..d0400b18fc0 100644 --- a/chromium/third_party/ffmpeg/libavformat/isom_tags.c +++ b/chromium/third_party/ffmpeg/libavformat/isom_tags.c @@ -314,6 +314,8 @@ const AVCodecTag ff_codec_movaudio_tags[] = { { AV_CODEC_ID_PCM_S16LE, MKTAG('l', 'p', 'c', 'm') }, { AV_CODEC_ID_PCM_S24BE, MKTAG('i', 'n', '2', '4') }, { AV_CODEC_ID_PCM_S24LE, MKTAG('i', 'n', '2', '4') }, + { AV_CODEC_ID_PCM_S24BE, MKTAG('i', 'p', 'c', 'm') }, + { AV_CODEC_ID_PCM_S24LE, MKTAG('i', 'p', 'c', 'm') }, { AV_CODEC_ID_PCM_S32BE, MKTAG('i', 'n', '3', '2') }, { AV_CODEC_ID_PCM_S32LE, MKTAG('i', 'n', '3', '2') }, { AV_CODEC_ID_PCM_S8, MKTAG('s', 'o', 'w', 't') }, diff --git a/chromium/third_party/ffmpeg/libavformat/kvag.c b/chromium/third_party/ffmpeg/libavformat/kvag.c index 0be253fb3ca..a277c281282 100644 --- a/chromium/third_party/ffmpeg/libavformat/kvag.c +++ b/chromium/third_party/ffmpeg/libavformat/kvag.c @@ -22,6 +22,7 @@ #include "libavutil/channel_layout.h" #include "avformat.h" +#include "avio_internal.h" #include "internal.h" #include "rawenc.h" #include "libavutil/intreadwrite.h" @@ -57,10 +58,8 @@ static int kvag_read_header(AVFormatContext *s) if (!(st = avformat_new_stream(s, NULL))) return AVERROR(ENOMEM); - if ((ret = avio_read(s->pb, buf, KVAG_HEADER_SIZE)) < 0) + if ((ret = ffio_read_size(s->pb, buf, KVAG_HEADER_SIZE)) < 0) return ret; - else if (ret != KVAG_HEADER_SIZE) - return AVERROR(EIO); hdr.magic = AV_RL32(buf + 0); hdr.data_size = AV_RL32(buf + 4); diff --git a/chromium/third_party/ffmpeg/libavformat/matroskadec.c b/chromium/third_party/ffmpeg/libavformat/matroskadec.c index d7bae597f55..bf1a05ed3ec 100644 --- a/chromium/third_party/ffmpeg/libavformat/matroskadec.c +++ b/chromium/third_party/ffmpeg/libavformat/matroskadec.c @@ -35,6 +35,7 @@ #include "libavutil/avstring.h" #include "libavutil/base64.h" +#include "libavutil/bprint.h" #include "libavutil/dict.h" #include "libavutil/intfloat.h" #include "libavutil/intreadwrite.h" @@ -2354,7 +2355,7 @@ static int matroska_parse_tracks(AVFormatContext *s) int extradata_size = 0; int extradata_offset = 0; uint32_t fourcc = 0; - AVIOContext b; + FFIOContext b; char* key_id_base64 = NULL; int bit_depth = -1; @@ -2515,7 +2516,8 @@ static int matroska_parse_tracks(AVFormatContext *s) ffio_init_context(&b, track->codec_priv.data, track->codec_priv.size, 0, NULL, NULL, NULL, NULL); - ret = ff_get_wav_header(s, &b, st->codecpar, track->codec_priv.size, 0); + ret = ff_get_wav_header(s, &b.pub, st->codecpar, + track->codec_priv.size, 0); if (ret < 0) return ret; codec_id = st->codecpar->codec_id; @@ -2561,7 +2563,7 @@ static int matroska_parse_tracks(AVFormatContext *s) ffio_init_context(&b, track->codec_priv.data, track->codec_priv.size, 0, NULL, NULL, NULL, NULL); - if (ff_get_qtpalette(codec_id, &b, track->palette)) { + if (ff_get_qtpalette(codec_id, &b.pub, track->palette)) { bit_depth &= 0x1F; track->has_palette = 1; } @@ -2665,18 +2667,18 @@ static int matroska_parse_tracks(AVFormatContext *s) codec_id == AV_CODEC_ID_SIPR) && track->codec_priv.data) { #if CONFIG_RA_288_DECODER || CONFIG_COOK_DECODER || CONFIG_ATRAC3_DECODER || CONFIG_SIPR_DECODER + const uint8_t *ptr = track->codec_priv.data; int flavor; - ffio_init_context(&b, track->codec_priv.data, - track->codec_priv.size, - 0, NULL, NULL, NULL, NULL); - avio_skip(&b, 22); - flavor = avio_rb16(&b); - track->audio.coded_framesize = avio_rb32(&b); - avio_skip(&b, 12); - track->audio.sub_packet_h = avio_rb16(&b); - track->audio.frame_size = avio_rb16(&b); - track->audio.sub_packet_size = avio_rb16(&b); + if (track->codec_priv.size < 46) + return AVERROR_INVALIDDATA; + ptr += 22; + flavor = bytestream_get_be16(&ptr); + track->audio.coded_framesize = bytestream_get_be32(&ptr); + ptr += 12; + track->audio.sub_packet_h = bytestream_get_be16(&ptr); + track->audio.frame_size = bytestream_get_be16(&ptr); + track->audio.sub_packet_size = bytestream_get_be16(&ptr); if (track->audio.coded_framesize <= 0 || track->audio.sub_packet_h <= 0 || track->audio.frame_size <= 0) @@ -3600,7 +3602,7 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, AVBufferRef *buf { uint64_t timecode = AV_NOPTS_VALUE; MatroskaTrack *track; - AVIOContext pb; + FFIOContext pb; int res = 0; AVStream *st; int16_t block_time; @@ -3611,7 +3613,7 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, AVBufferRef *buf ffio_init_context(&pb, data, size, 0, NULL, NULL, NULL, NULL); - if ((n = ebml_read_num(matroska, &pb, 8, &num, 1)) < 0) + if ((n = ebml_read_num(matroska, &pb.pub, 8, &num, 1)) < 0) return n; data += n; size -= n; @@ -3669,7 +3671,7 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, AVBufferRef *buf } res = matroska_parse_laces(matroska, &data, size, (flags & 0x06) >> 1, - &pb, lace_size, &laces); + &pb.pub, lace_size, &laces); if (res < 0) { av_log(matroska->ctx, AV_LOG_ERROR, "Error parsing frame sizes.\n"); return res; @@ -3899,6 +3901,7 @@ static int matroska_read_close(AVFormatContext *s) return 0; } +#if CONFIG_WEBM_DASH_MANIFEST_DEMUXER typedef struct { int64_t start_time_ns; int64_t end_time_ns; @@ -4158,10 +4161,12 @@ static int webm_dash_manifest_cues(AVFormatContext *s, int64_t init_range) MatroskaDemuxContext *matroska = s->priv_data; EbmlList *seekhead_list = &matroska->seekhead; MatroskaSeekhead *seekhead = seekhead_list->elem; + AVStream *const st = s->streams[0]; + AVBPrint bprint; char *buf; int64_t cues_start = -1, cues_end = -1, before_pos, bandwidth; int i; - int end = 0; + int ret; // determine cues start and end positions for (i = 0; i < seekhead_list->nb_elem; i++) @@ -4192,6 +4197,9 @@ static int webm_dash_manifest_cues(AVFormatContext *s, int64_t init_range) // parse the cues matroska_parse_cues(matroska); + if (!st->internal->nb_index_entries) + return AVERROR_INVALIDDATA; + // cues start av_dict_set_int(&s->streams[0]->metadata, CUES_START, cues_start, 0); @@ -4211,22 +4219,19 @@ static int webm_dash_manifest_cues(AVFormatContext *s, int64_t init_range) // check if all clusters start with key frames av_dict_set_int(&s->streams[0]->metadata, CLUSTER_KEYFRAME, webm_clusters_start_with_keyframe(s), 0); - // store cue point timestamps as a comma separated list for checking subsegment alignment in - // the muxer. assumes that each timestamp cannot be more than 20 characters long. - buf = av_malloc_array(s->streams[0]->internal->nb_index_entries, 20); - if (!buf) return -1; - strcpy(buf, ""); - for (i = 0; i < s->streams[0]->internal->nb_index_entries; i++) { - int ret = snprintf(buf + end, 20, - "%" PRId64"%s", s->streams[0]->internal->index_entries[i].timestamp, - i != s->streams[0]->internal->nb_index_entries - 1 ? "," : ""); - if (ret <= 0 || (ret == 20 && i == s->streams[0]->internal->nb_index_entries - 1)) { - av_log(s, AV_LOG_ERROR, "timestamp too long.\n"); - av_free(buf); - return AVERROR_INVALIDDATA; - } - end += ret; + // Store cue point timestamps as a comma separated list + // for checking subsegment alignment in the muxer. + av_bprint_init(&bprint, 0, AV_BPRINT_SIZE_UNLIMITED); + for (int i = 0; i < st->internal->nb_index_entries; i++) + av_bprintf(&bprint, "%" PRId64",", st->internal->index_entries[i].timestamp); + if (!av_bprint_is_complete(&bprint)) { + av_bprint_finalize(&bprint, NULL); + return AVERROR(ENOMEM); } + // Remove the trailing ',' + bprint.str[--bprint.len] = '\0'; + if ((ret = av_bprint_finalize(&bprint, &buf)) < 0) + return ret; av_dict_set(&s->streams[0]->metadata, CUE_TIMESTAMPS, buf, AV_DICT_DONT_STRDUP_VAL); @@ -4306,6 +4311,18 @@ static const AVClass webm_dash_class = { .version = LIBAVUTIL_VERSION_INT, }; +const AVInputFormat ff_webm_dash_manifest_demuxer = { + .name = "webm_dash_manifest", + .long_name = NULL_IF_CONFIG_SMALL("WebM DASH Manifest"), + .priv_class = &webm_dash_class, + .priv_data_size = sizeof(MatroskaDemuxContext), + .flags_internal = FF_FMT_INIT_CLEANUP, + .read_header = webm_dash_manifest_read_header, + .read_packet = webm_dash_manifest_read_packet, + .read_close = matroska_read_close, +}; +#endif + const AVInputFormat ff_matroska_demuxer = { .name = "matroska,webm", .long_name = NULL_IF_CONFIG_SMALL("Matroska / WebM"), @@ -4319,14 +4336,3 @@ const AVInputFormat ff_matroska_demuxer = { .read_seek = matroska_read_seek, .mime_type = "audio/webm,audio/x-matroska,video/webm,video/x-matroska" }; - -const AVInputFormat ff_webm_dash_manifest_demuxer = { - .name = "webm_dash_manifest", - .long_name = NULL_IF_CONFIG_SMALL("WebM DASH Manifest"), - .priv_data_size = sizeof(MatroskaDemuxContext), - .flags_internal = FF_FMT_INIT_CLEANUP, - .read_header = webm_dash_manifest_read_header, - .read_packet = webm_dash_manifest_read_packet, - .read_close = matroska_read_close, - .priv_class = &webm_dash_class, -}; diff --git a/chromium/third_party/ffmpeg/libavformat/matroskaenc.c b/chromium/third_party/ffmpeg/libavformat/matroskaenc.c index 899a3388cd2..6e34243f6b6 100644 --- a/chromium/third_party/ffmpeg/libavformat/matroskaenc.c +++ b/chromium/third_party/ffmpeg/libavformat/matroskaenc.c @@ -839,11 +839,12 @@ static void mkv_write_video_color(AVIOContext *pb, const AVStream *st, * a master element with two bytes ID and one byte length field * plus another byte to stay clear of the end. */ uint8_t colour[(2 + 1 + 8) * 18 + (2 + 1) + 1]; - AVIOContext buf, *dyn_cp = &buf; + FFIOContext buf; + AVIOContext *const dyn_cp = &buf.pub; int colorinfo_size; const void *side_data; - ffio_init_context(dyn_cp, colour, sizeof(colour), 1, NULL, NULL, NULL, NULL); + ffio_init_context(&buf, colour, sizeof(colour), 1, NULL, NULL, NULL, NULL); if (par->color_trc != AVCOL_TRC_UNSPECIFIED && par->color_trc < AVCOL_TRC_NB) { @@ -1395,7 +1396,8 @@ static int mkv_write_tracks(AVFormatContext *s) { MatroskaMuxContext *mkv = s->priv_data; AVIOContext *pb = s->pb; - int i, ret, video_default_idx, audio_default_idx, subtitle_default_idx; + int video_default_idx = -1, audio_default_idx = -1, subtitle_default_idx = -1; + int i, ret; if (mkv->nb_attachments == s->nb_streams) return 0; @@ -1405,11 +1407,7 @@ static int mkv_write_tracks(AVFormatContext *s) return ret; if (mkv->default_mode != DEFAULT_MODE_PASSTHROUGH) { - int video_idx, audio_idx, subtitle_idx; - - video_idx = video_default_idx = - audio_idx = audio_default_idx = - subtitle_idx = subtitle_default_idx = -1; + int video_idx = -1, audio_idx = -1, subtitle_idx = -1; for (i = s->nb_streams - 1; i >= 0; i--) { AVStream *st = s->streams[i]; @@ -1435,8 +1433,7 @@ static int mkv_write_tracks(AVFormatContext *s) } for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; - int is_default = mkv->default_mode == DEFAULT_MODE_PASSTHROUGH ? - st->disposition & AV_DISPOSITION_DEFAULT : + int is_default = st->disposition & AV_DISPOSITION_DEFAULT || i == video_default_idx || i == audio_default_idx || i == subtitle_default_idx; ret = mkv_write_track(s, mkv, st, &mkv->tracks[i], @@ -2636,33 +2633,6 @@ after_cues: return ret2; } -static int mkv_query_codec(enum AVCodecID codec_id, int std_compliance) -{ - int i; - for (i = 0; ff_mkv_codec_tags[i].id != AV_CODEC_ID_NONE; i++) - if (ff_mkv_codec_tags[i].id == codec_id) - return 1; - - if (std_compliance < FF_COMPLIANCE_NORMAL) { - enum AVMediaType type = avcodec_get_type(codec_id); - // mkv theoretically supports any video/audio through VFW/ACM - if (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO) - return 1; - } - - return 0; -} - -static int webm_query_codec(enum AVCodecID codec_id, int std_compliance) -{ - int i; - for (i = 0; ff_webm_codec_tags[i].id != AV_CODEC_ID_NONE; i++) - if (ff_webm_codec_tags[i].id == codec_id) - return 1; - - return 0; -} - static uint64_t mkv_get_uid(const mkv_track *tracks, int i, AVLFG *c) { while (1) { @@ -2822,9 +2792,9 @@ static const AVOption options[] = { { "allow_raw_vfw", "allow RAW VFW mode", OFFSET(allow_raw_vfw), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS }, { "flipped_raw_rgb", "Raw RGB bitmaps in VFW mode are stored bottom-up", OFFSET(flipped_raw_rgb), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS }, { "write_crc32", "write a CRC32 element inside every Level 1 element", OFFSET(write_crc), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, FLAGS }, - { "default_mode", "Controls how a track's FlagDefault is inferred", OFFSET(default_mode), AV_OPT_TYPE_INT, { .i64 = DEFAULT_MODE_INFER }, DEFAULT_MODE_INFER, DEFAULT_MODE_PASSTHROUGH, FLAGS, "default_mode" }, - { "infer", "For each track type, mark the first track of disposition default as default; if none exists, mark the first track as default.", 0, AV_OPT_TYPE_CONST, { .i64 = DEFAULT_MODE_INFER }, 0, 0, FLAGS, "default_mode" }, - { "infer_no_subs", "For each track type, mark the first track of disposition default as default; for audio and video: if none exists, mark the first track as default.", 0, AV_OPT_TYPE_CONST, { .i64 = DEFAULT_MODE_INFER_NO_SUBS }, 0, 0, FLAGS, "default_mode" }, + { "default_mode", "Controls how a track's FlagDefault is inferred", OFFSET(default_mode), AV_OPT_TYPE_INT, { .i64 = DEFAULT_MODE_PASSTHROUGH }, DEFAULT_MODE_INFER, DEFAULT_MODE_PASSTHROUGH, FLAGS, "default_mode" }, + { "infer", "For each track type, mark each track of disposition default as default; if none exists, mark the first track as default.", 0, AV_OPT_TYPE_CONST, { .i64 = DEFAULT_MODE_INFER }, 0, 0, FLAGS, "default_mode" }, + { "infer_no_subs", "For each track type, mark each track of disposition default as default; for audio and video: if none exists, mark the first track as default.", 0, AV_OPT_TYPE_CONST, { .i64 = DEFAULT_MODE_INFER_NO_SUBS }, 0, 0, FLAGS, "default_mode" }, { "passthrough", "Use the disposition flag as-is", 0, AV_OPT_TYPE_CONST, { .i64 = DEFAULT_MODE_PASSTHROUGH }, 0, 0, FLAGS, "default_mode" }, { NULL }, }; @@ -2837,6 +2807,22 @@ static const AVClass matroska_webm_class = { }; #if CONFIG_MATROSKA_MUXER +static int mkv_query_codec(enum AVCodecID codec_id, int std_compliance) +{ + for (int i = 0; ff_mkv_codec_tags[i].id != AV_CODEC_ID_NONE; i++) + if (ff_mkv_codec_tags[i].id == codec_id) + return 1; + + if (std_compliance < FF_COMPLIANCE_NORMAL) { + enum AVMediaType type = avcodec_get_type(codec_id); + // mkv theoretically supports any video/audio through VFW/ACM + if (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO) + return 1; + } + + return 0; +} + const AVOutputFormat ff_matroska_muxer = { .name = "matroska", .long_name = NULL_IF_CONFIG_SMALL("Matroska"), @@ -2866,6 +2852,15 @@ const AVOutputFormat ff_matroska_muxer = { #endif #if CONFIG_WEBM_MUXER +static int webm_query_codec(enum AVCodecID codec_id, int std_compliance) +{ + for (int i = 0; ff_webm_codec_tags[i].id != AV_CODEC_ID_NONE; i++) + if (ff_webm_codec_tags[i].id == codec_id) + return 1; + + return 0; +} + const AVOutputFormat ff_webm_muxer = { .name = "webm", .long_name = NULL_IF_CONFIG_SMALL("WebM"), diff --git a/chromium/third_party/ffmpeg/libavformat/mlpdec.c b/chromium/third_party/ffmpeg/libavformat/mlpdec.c index 8f0aabb5106..f0996fef31e 100644 --- a/chromium/third_party/ffmpeg/libavformat/mlpdec.c +++ b/chromium/third_party/ffmpeg/libavformat/mlpdec.c @@ -22,8 +22,12 @@ */ #include "avformat.h" +#include "avio_internal.h" +#include "internal.h" #include "rawdec.h" #include "libavutil/intreadwrite.h" +#include "libavcodec/mlp.h" +#include "libavcodec/mlp_parse.h" static int av_always_inline mlp_thd_probe(const AVProbeData *p, uint32_t sync) { @@ -50,6 +54,40 @@ static int av_always_inline mlp_thd_probe(const AVProbeData *p, uint32_t sync) return 0; } +static int mlp_read_header(AVFormatContext *s) +{ + int ret = ff_raw_audio_read_header(s); + + if (ret < 0) + return ret; + + ret = ffio_ensure_seekback(s->pb, 10); + if (ret == 0) { + uint8_t buffer[10]; + int read, sample_rate = 0; + + read = avio_read(s->pb, buffer, 10); + if (read == 10) { + switch (buffer[7]) { + case SYNC_TRUEHD: + sample_rate = mlp_samplerate(buffer[8] >> 4); + break; + case SYNC_MLP: + sample_rate = mlp_samplerate(buffer[9] >> 4); + break; + } + + if (sample_rate) + avpriv_set_pts_info(s->streams[0], 64, 1, sample_rate); + } + + if (read > 0) + avio_seek(s->pb, -read, SEEK_CUR); + } + + return 0; +} + #if CONFIG_MLP_DEMUXER static int mlp_probe(const AVProbeData *p) { @@ -60,7 +98,7 @@ const AVInputFormat ff_mlp_demuxer = { .name = "mlp", .long_name = NULL_IF_CONFIG_SMALL("raw MLP"), .read_probe = mlp_probe, - .read_header = ff_raw_audio_read_header, + .read_header = mlp_read_header, .read_packet = ff_raw_read_partial_packet, .flags = AVFMT_GENERIC_INDEX | AVFMT_NOTIMESTAMPS, .extensions = "mlp", @@ -80,7 +118,7 @@ const AVInputFormat ff_truehd_demuxer = { .name = "truehd", .long_name = NULL_IF_CONFIG_SMALL("raw TrueHD"), .read_probe = thd_probe, - .read_header = ff_raw_audio_read_header, + .read_header = mlp_read_header, .read_packet = ff_raw_read_partial_packet, .flags = AVFMT_GENERIC_INDEX | AVFMT_NOTIMESTAMPS, .extensions = "thd", @@ -89,4 +127,3 @@ const AVInputFormat ff_truehd_demuxer = { .priv_class = &ff_raw_demuxer_class, }; #endif - diff --git a/chromium/third_party/ffmpeg/libavformat/mmst.c b/chromium/third_party/ffmpeg/libavformat/mmst.c index fa6e86ac260..20b04b12aa7 100644 --- a/chromium/third_party/ffmpeg/libavformat/mmst.c +++ b/chromium/third_party/ffmpeg/libavformat/mmst.c @@ -154,13 +154,13 @@ static int send_command_packet(MMSTContext *mmst) static int mms_put_utf16(MMSContext *mms, const uint8_t *src) { - AVIOContext bic; + FFIOContext bic; int size = mms->write_out_ptr - mms->out_buffer; int len; ffio_init_context(&bic, mms->write_out_ptr, sizeof(mms->out_buffer) - size, 1, NULL, NULL, NULL, NULL); - len = avio_put_str16le(&bic, src); + len = avio_put_str16le(&bic.pub, src); if (len < 0) return len; mms->write_out_ptr += len; diff --git a/chromium/third_party/ffmpeg/libavformat/mov.c b/chromium/third_party/ffmpeg/libavformat/mov.c index 7e9f14baafb..257c1eca5cc 100644 --- a/chromium/third_party/ffmpeg/libavformat/mov.c +++ b/chromium/third_party/ffmpeg/libavformat/mov.c @@ -3628,7 +3628,7 @@ static void mov_fix_index(MOVContext *mov, AVStream *st) if (ctts_data_old && ctts_index_old < ctts_count_old) { curr_ctts = ctts_data_old[ctts_index_old].duration; - av_log(mov->fc, AV_LOG_DEBUG, "stts: %"PRId64" ctts: %"PRId64", ctts_index: %"PRId64", ctts_count: %"PRId64"\n", + av_log(mov->fc, AV_LOG_TRACE, "stts: %"PRId64" ctts: %"PRId64", ctts_index: %"PRId64", ctts_count: %"PRId64"\n", curr_cts, curr_ctts, ctts_index_old, ctts_count_old); curr_cts += curr_ctts; ctts_sample_old++; @@ -4984,6 +4984,8 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom) "size %u, distance %d, keyframe %d\n", st->index, index_entry_pos, offset, dts, sample_size, distance, keyframe); distance++; + if (av_sat_add64(dts, sample_duration) != dts + (uint64_t)sample_duration) + return AVERROR_INVALIDDATA; dts += sample_duration; offset += sample_size; sc->data_size += sample_size; @@ -5212,7 +5214,7 @@ static int mov_read_wide(MOVContext *c, AVIOContext *pb, MOVAtom atom) static int mov_read_cmov(MOVContext *c, AVIOContext *pb, MOVAtom atom) { #if CONFIG_ZLIB - AVIOContext ctx; + FFIOContext ctx; uint8_t *cmov_data; uint8_t *moov_data; /* uncompressed data */ long cmov_len, moov_len; @@ -5246,12 +5248,11 @@ static int mov_read_cmov(MOVContext *c, AVIOContext *pb, MOVAtom atom) ret = AVERROR_INVALIDDATA; if (uncompress (moov_data, (uLongf *) &moov_len, (const Bytef *)cmov_data, cmov_len) != Z_OK) goto free_and_return; - if (ffio_init_context(&ctx, moov_data, moov_len, 0, NULL, NULL, NULL, NULL) != 0) - goto free_and_return; - ctx.seekable = AVIO_SEEKABLE_NORMAL; + ffio_init_context(&ctx, moov_data, moov_len, 0, NULL, NULL, NULL, NULL); + ctx.pub.seekable = AVIO_SEEKABLE_NORMAL; atom.type = MKTAG('m','o','o','v'); atom.size = moov_len; - ret = mov_read_default(c, &ctx, atom); + ret = mov_read_default(c, &ctx.pub, atom); free_and_return: av_free(moov_data); av_free(cmov_data); @@ -8253,5 +8254,5 @@ const AVInputFormat ff_mov_demuxer = { .read_packet = mov_read_packet, .read_close = mov_read_close, .read_seek = mov_read_seek, - .flags = AVFMT_NO_BYTE_SEEK | AVFMT_SEEK_TO_PTS, + .flags = AVFMT_NO_BYTE_SEEK | AVFMT_SEEK_TO_PTS | AVFMT_SHOW_IDS, }; diff --git a/chromium/third_party/ffmpeg/libavformat/mov_chan.c b/chromium/third_party/ffmpeg/libavformat/mov_chan.c index 4ec16f15c28..349634094c9 100644 --- a/chromium/third_party/ffmpeg/libavformat/mov_chan.c +++ b/chromium/third_party/ffmpeg/libavformat/mov_chan.c @@ -451,7 +451,14 @@ static const struct { { AV_CODEC_ID_NONE, NULL }, }; -uint64_t ff_mov_get_channel_layout(uint32_t tag, uint32_t bitmap) +/** + * Get the channel layout for the specified channel layout tag. + * + * @param[in] tag channel layout tag + * @param[out] bitmap channel bitmap (only used if needed) + * @return channel layout + */ +static uint64_t mov_get_channel_layout(uint32_t tag, uint32_t bitmap) { int i, channels; const struct MovChannelLayoutMap *layout_map; @@ -591,7 +598,7 @@ int ff_mov_read_chan(AVFormatContext *s, AVIOContext *pb, AVStream *st, if (label_mask) st->codecpar->channel_layout = label_mask; } else - st->codecpar->channel_layout = ff_mov_get_channel_layout(layout_tag, bitmap); + st->codecpar->channel_layout = mov_get_channel_layout(layout_tag, bitmap); avio_skip(pb, size - 12); return 0; diff --git a/chromium/third_party/ffmpeg/libavformat/mov_chan.h b/chromium/third_party/ffmpeg/libavformat/mov_chan.h index 978b8a3732d..f7916e98997 100644 --- a/chromium/third_party/ffmpeg/libavformat/mov_chan.h +++ b/chromium/third_party/ffmpeg/libavformat/mov_chan.h @@ -32,15 +32,6 @@ #include "avformat.h" /** - * Get the channel layout for the specified channel layout tag. - * - * @param[in] tag channel layout tag - * @param[out] bitmap channel bitmap (only used if needed) - * @return channel layout - */ -uint64_t ff_mov_get_channel_layout(uint32_t tag, uint32_t bitmap); - -/** * Get the channel layout tag for the specified codec id and channel layout. * If the layout tag was not found, use a channel bitmap if possible. * diff --git a/chromium/third_party/ffmpeg/libavformat/movenc.c b/chromium/third_party/ffmpeg/libavformat/movenc.c index 57062f45c57..d5929e63955 100644 --- a/chromium/third_party/ffmpeg/libavformat/movenc.c +++ b/chromium/third_party/ffmpeg/libavformat/movenc.c @@ -57,6 +57,8 @@ #include "hevc.h" #include "rtpenc.h" #include "mov_chan.h" +#include "movenc_ttml.h" +#include "ttmlenc.h" #include "vpcc.h" static const AVOption options[] = { @@ -120,6 +122,7 @@ static const AVClass mov_isobmff_muxer_class = { }; static int get_moov_size(AVFormatContext *s); +static int mov_write_single_packet(AVFormatContext *s, AVPacket *pkt); static int utf8len(const uint8_t *b) { @@ -1788,7 +1791,29 @@ static int mov_write_subtitle_tag(AVIOContext *pb, MOVTrack *track) if (track->par->codec_id == AV_CODEC_ID_DVD_SUBTITLE) mov_write_esds_tag(pb, track); - else if (track->par->extradata_size) + else if (track->par->codec_id == AV_CODEC_ID_TTML) { + switch (track->par->codec_tag) { + case MOV_ISMV_TTML_TAG: + // ISMV dfxp requires no extradata. + break; + case MOV_MP4_TTML_TAG: + // As specified in 14496-30, XMLSubtitleSampleEntry + // Namespace + avio_put_str(pb, "http://www.w3.org/ns/ttml"); + // Empty schema_location + avio_w8(pb, 0); + // Empty auxiliary_mime_types + avio_w8(pb, 0); + break; + default: + av_log(NULL, AV_LOG_ERROR, + "Unknown codec tag '%s' utilized for TTML stream with " + "index %d (track id %d)!\n", + av_fourcc2str(track->par->codec_tag), track->st->index, + track->track_id); + return AVERROR(EINVAL); + } + } else if (track->par->extradata_size) avio_write(pb, track->par->extradata, track->par->extradata_size); if (track->mode == MODE_MP4 && @@ -2662,6 +2687,14 @@ static int mov_write_nmhd_tag(AVIOContext *pb) return 12; } +static int mov_write_sthd_tag(AVIOContext *pb) +{ + avio_wb32(pb, 12); + ffio_wfourcc(pb, "sthd"); + avio_wb32(pb, 0); + return 12; +} + static int mov_write_tcmi_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = avio_tell(pb); @@ -2766,6 +2799,7 @@ static int mov_write_hdlr_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *tra MOVMuxContext *mov = s->priv_data; const char *hdlr, *descr = NULL, *hdlr_type = NULL; int64_t pos = avio_tell(pb); + size_t descr_len; hdlr = "dhlr"; hdlr_type = "url "; @@ -2788,6 +2822,8 @@ static int mov_write_hdlr_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *tra hdlr_type = "sbtl"; } else if (track->tag == MKTAG('m','p','4','s')) { hdlr_type = "subp"; + } else if (track->tag == MOV_MP4_TTML_TAG) { + hdlr_type = "subt"; } else { hdlr_type = "text"; } @@ -2829,9 +2865,10 @@ static int mov_write_hdlr_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *tra avio_wb32(pb, 0); /* reserved */ avio_wb32(pb, 0); /* reserved */ avio_wb32(pb, 0); /* reserved */ + descr_len = strlen(descr); if (!track || track->mode == MODE_MOV) - avio_w8(pb, strlen(descr)); /* pascal string */ - avio_write(pb, descr, strlen(descr)); /* handler description */ + avio_w8(pb, descr_len); /* pascal string */ + avio_write(pb, descr, descr_len); /* handler description */ if (track && track->mode != MODE_MOV) avio_w8(pb, 0); /* c string */ return update_size(pb, pos); @@ -2866,6 +2903,8 @@ static int mov_write_minf_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContext else if (track->par->codec_type == AVMEDIA_TYPE_SUBTITLE) { if (track->tag == MKTAG('t','e','x','t') || is_clcp_track(track)) { mov_write_gmhd_tag(pb, track); + } else if (track->tag == MOV_MP4_TTML_TAG) { + mov_write_sthd_tag(pb); } else { mov_write_nmhd_tag(pb); } @@ -3502,21 +3541,22 @@ static int mov_write_itunes_hdlr_tag(AVIOContext *pb, MOVMuxContext *mov, /* helper function to write a data tag with the specified string as data */ static int mov_write_string_data_tag(AVIOContext *pb, const char *data, int lang, int long_style) { + size_t data_len = strlen(data); if (long_style) { - int size = 16 + strlen(data); + int size = 16 + data_len; avio_wb32(pb, size); /* size */ ffio_wfourcc(pb, "data"); avio_wb32(pb, 1); avio_wb32(pb, 0); - avio_write(pb, data, strlen(data)); + avio_write(pb, data, data_len); return size; } else { + avio_wb16(pb, data_len); /* string length */ if (!lang) lang = ff_mov_iso639_to_lang("und", 1); - avio_wb16(pb, strlen(data)); /* string length */ avio_wb16(pb, lang); - avio_write(pb, data, strlen(data)); - return strlen(data) + 4; + avio_write(pb, data, data_len); + return data_len + 4; } } @@ -3792,9 +3832,10 @@ static int mov_write_mdta_keys_tag(AVIOContext *pb, MOVMuxContext *mov, avio_wb32(pb, 0); /* entry count */ while (t = av_dict_get(s->metadata, "", t, AV_DICT_IGNORE_SUFFIX)) { - avio_wb32(pb, strlen(t->key) + 8); + size_t key_len = strlen(t->key); + avio_wb32(pb, key_len + 8); ffio_wfourcc(pb, "mdta"); - avio_write(pb, t->key, strlen(t->key)); + avio_write(pb, t->key, key_len); count += 1; } curpos = avio_tell(pb); @@ -4483,8 +4524,7 @@ static int mov_write_tfxd_tag(AVIOContext *pb, MOVTrack *track) avio_write(pb, uuid, sizeof(uuid)); avio_w8(pb, 1); avio_wb24(pb, 0); - avio_wb64(pb, track->start_dts + track->frag_start + - track->cluster[0].cts); + avio_wb64(pb, track->cluster[0].dts + track->cluster[0].cts); avio_wb64(pb, track->end_pts - (track->cluster[0].dts + track->cluster[0].cts)); @@ -4563,8 +4603,7 @@ static int mov_add_tfra_entries(AVIOContext *pb, MOVMuxContext *mov, int tracks, info->size = size; // Try to recreate the original pts for the first packet // from the fields we have stored - info->time = track->start_dts + track->frag_start + - track->cluster[0].cts; + info->time = track->cluster[0].dts + track->cluster[0].cts; info->duration = track->end_pts - (track->cluster[0].dts + track->cluster[0].cts); // If the pts is less than zero, we will have trimmed @@ -4602,7 +4641,7 @@ static int mov_write_tfdt_tag(AVIOContext *pb, MOVTrack *track) ffio_wfourcc(pb, "tfdt"); avio_w8(pb, 1); /* version */ avio_wb24(pb, 0); - avio_wb64(pb, track->frag_start); + avio_wb64(pb, track->cluster[0].dts - track->start_dts); return update_size(pb, pos); } @@ -4679,8 +4718,7 @@ static int mov_write_sidx_tag(AVIOContext *pb, if (track->entry) { entries = 1; - presentation_time = track->start_dts + track->frag_start + - track->cluster[0].cts; + presentation_time = track->cluster[0].dts + track->cluster[0].cts; duration = track->end_pts - (track->cluster[0].dts + track->cluster[0].cts); starts_with_SAP = track->cluster[0].flags & MOV_SYNC_SAMPLE; @@ -5254,6 +5292,68 @@ static int mov_flush_fragment_interleaving(AVFormatContext *s, MOVTrack *track) return 0; } +static int mov_write_squashed_packet(AVFormatContext *s, MOVTrack *track) +{ + MOVMuxContext *mov = s->priv_data; + AVPacket *squashed_packet = mov->pkt; + int ret = AVERROR_BUG; + + switch (track->st->codecpar->codec_id) { + case AV_CODEC_ID_TTML: { + int had_packets = !!track->squashed_packet_queue; + + if ((ret = ff_mov_generate_squashed_ttml_packet(s, track, squashed_packet)) < 0) { + goto finish_squash; + } + + // We have generated a padding packet (no actual input packets in + // queue) and its duration is zero. Skipping writing it. + if (!had_packets && squashed_packet->duration == 0) { + goto finish_squash; + } + + track->end_reliable = 1; + break; + } + default: + ret = AVERROR(EINVAL); + goto finish_squash; + } + + squashed_packet->stream_index = track->st->index; + + ret = mov_write_single_packet(s, squashed_packet); + +finish_squash: + av_packet_unref(squashed_packet); + + return ret; +} + +static int mov_write_squashed_packets(AVFormatContext *s) +{ + MOVMuxContext *mov = s->priv_data; + + for (int i = 0; i < s->nb_streams; i++) { + MOVTrack *track = &mov->tracks[i]; + int ret = AVERROR_BUG; + + if (track->squash_fragment_samples_to_one && !track->entry) { + if ((ret = mov_write_squashed_packet(s, track)) < 0) { + av_log(s, AV_LOG_ERROR, + "Failed to write squashed packet for %s stream with " + "index %d and track id %d. Error: %s\n", + avcodec_get_name(track->st->codecpar->codec_id), + track->st->index, track->track_id, + av_err2str(ret)); + return ret; + } + } + } + + return 0; +} + static int mov_flush_fragment(AVFormatContext *s, int force) { MOVMuxContext *mov = s->priv_data; @@ -5265,6 +5365,11 @@ static int mov_flush_fragment(AVFormatContext *s, int force) if (!(mov->flags & FF_MOV_FLAG_FRAGMENT)) return 0; + // Check if we have any tracks that require squashing. + // In that case, we'll have to write the packet here. + if ((ret = mov_write_squashed_packets(s)) < 0) + return ret; + // Try to fill in the duration of the last packet in each stream // from queued packets in the interleave queues. If the flushing // of fragments was triggered automatically by an AVPacket, we @@ -5359,10 +5464,6 @@ static int mov_flush_fragment(AVFormatContext *s, int force) mov->moov_written = 1; mov->mdat_size = 0; for (i = 0; i < mov->nb_streams; i++) { - if (mov->tracks[i].entry) - mov->tracks[i].frag_start += mov->tracks[i].start_dts + - mov->tracks[i].track_duration - - mov->tracks[i].cluster[0].dts; mov->tracks[i].entry = 0; mov->tracks[i].end_reliable = 0; } @@ -5416,13 +5517,9 @@ static int mov_flush_fragment(AVFormatContext *s, int force) MOVTrack *track = &mov->tracks[i]; int buf_size, write_moof = 1, moof_tracks = -1; uint8_t *buf; - int64_t duration = 0; - if (track->entry) - duration = track->start_dts + track->track_duration - - track->cluster[0].dts; if (mov->flags & FF_MOV_FLAG_SEPARATE_MOOF) { - if (!track->mdat_buf) + if (!track->entry) continue; mdat_size = avio_tell(track->mdat_buf); moof_tracks = i; @@ -5440,8 +5537,6 @@ static int mov_flush_fragment(AVFormatContext *s, int force) ffio_wfourcc(s->pb, "mdat"); } - if (track->entry) - track->frag_start += duration; track->entry = 0; track->entries_flushed = 0; track->end_reliable = 0; @@ -5740,7 +5835,8 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) trk->cluster[trk->entry].entries = samples_in_chunk; trk->cluster[trk->entry].dts = pkt->dts; trk->cluster[trk->entry].pts = pkt->pts; - if (!trk->entry && trk->start_dts != AV_NOPTS_VALUE) { + if (!trk->squash_fragment_samples_to_one && + !trk->entry && trk->start_dts != AV_NOPTS_VALUE) { if (!trk->frag_discont) { /* First packet of a new fragment. We already wrote the duration * of the last packet of the previous fragment based on track_duration, @@ -5760,7 +5856,6 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) /* New fragment, but discontinuous from previous fragments. * Pretend the duration sum of the earlier fragments is * pkt->dts - trk->start_dts. */ - trk->frag_start = pkt->dts - trk->start_dts; trk->end_pts = AV_NOPTS_VALUE; trk->frag_discont = 0; } @@ -5782,12 +5877,10 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) /* Pretend the whole stream started at pts=0, with earlier fragments * already written. If the stream started at pts=0, the duration sum * of earlier fragments would have been pkt->pts. */ - trk->frag_start = pkt->pts; trk->start_dts = pkt->dts - pkt->pts; } else { /* Pretend the whole stream started at dts=0, with earlier fragments * already written, with a duration summing up to pkt->dts. */ - trk->frag_start = pkt->dts; trk->start_dts = 0; } trk->frag_discont = 0; @@ -5931,16 +6024,21 @@ static int mov_write_single_packet(AVFormatContext *s, AVPacket *pkt) trk->entry && pkt->flags & AV_PKT_FLAG_KEY) || (mov->flags & FF_MOV_FLAG_FRAG_EVERY_FRAME)) { if (frag_duration >= mov->min_fragment_duration) { - // Set the duration of this track to line up with the next - // sample in this track. This avoids relying on AVPacket - // duration, but only helps for this particular track, not - // for the other ones that are flushed at the same time. - trk->track_duration = pkt->dts - trk->start_dts; - if (pkt->pts != AV_NOPTS_VALUE) - trk->end_pts = pkt->pts; - else - trk->end_pts = pkt->dts; - trk->end_reliable = 1; + if (trk->entry) { + // Set the duration of this track to line up with the next + // sample in this track. This avoids relying on AVPacket + // duration, but only helps for this particular track, not + // for the other ones that are flushed at the same time. + // + // If we have trk->entry == 0, no fragment will be written + // for this track, and we can't adjust the track end here. + trk->track_duration = pkt->dts - trk->start_dts; + if (pkt->pts != AV_NOPTS_VALUE) + trk->end_pts = pkt->pts; + else + trk->end_pts = pkt->dts; + trk->end_reliable = 1; + } mov_auto_flush_fragment(s, 0); } } @@ -6033,6 +6131,33 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt) } } + if (trk->squash_fragment_samples_to_one) { + /* + * If the track has to have its samples squashed into one sample, + * we just take it into the track's queue. + * This will then be utilized as the samples get written in either + * mov_flush_fragment or when the mux is finalized in + * mov_write_trailer. + */ + int ret = AVERROR_BUG; + + if (pkt->pts == AV_NOPTS_VALUE) { + av_log(s, AV_LOG_ERROR, + "Packets without a valid presentation timestamp are " + "not supported with packet squashing!\n"); + return AVERROR(EINVAL); + } + + if ((ret = avpriv_packet_list_put(&trk->squashed_packet_queue, + &trk->squashed_packet_queue_end, + pkt, av_packet_ref, 0)) < 0) { + return ret; + } + + return 0; + } + + if (trk->mode == MODE_MOV && trk->par->codec_type == AVMEDIA_TYPE_VIDEO) { AVPacket *opkt = pkt; int reshuffle_ret, ret; @@ -6311,6 +6436,11 @@ static void mov_free(AVFormatContext *s) ff_mov_cenc_free(&mov->tracks[i].cenc); ffio_free_dyn_buf(&mov->tracks[i].mdat_buf); + + if (mov->tracks[i].squashed_packet_queue) { + avpriv_packet_list_free(&(mov->tracks[i].squashed_packet_queue), + &(mov->tracks[i].squashed_packet_queue_end)); + } } av_freep(&mov->tracks); @@ -6701,6 +6831,36 @@ static int mov_init(AVFormatContext *s) } } else if (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) { track->timescale = st->time_base.den; + + if (track->par->codec_id == AV_CODEC_ID_TTML) { + /* 14496-30 requires us to use a single sample per fragment + for TTML, for which we define a per-track flag. + + We set the flag in case we are receiving TTML paragraphs + from the input, in other words in case we are not doing + stream copy. */ + track->squash_fragment_samples_to_one = + ff_is_ttml_stream_paragraph_based(track->par); + + if (mov->flags & FF_MOV_FLAG_FRAGMENT && + track->squash_fragment_samples_to_one) { + av_log(s, AV_LOG_ERROR, + "Fragmentation is not currently supported for " + "TTML in MP4/ISMV (track synchronization between " + "subtitles and other media is not yet implemented)!\n"); + return AVERROR_PATCHWELCOME; + } + + if (track->mode != MODE_ISM && + track->par->codec_tag == MOV_ISMV_TTML_TAG && + s->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) { + av_log(s, AV_LOG_ERROR, + "ISMV style TTML support with the 'dfxp' tag in " + "non-ISMV formats is not officially supported. Add " + "'-strict unofficial' if you want to use it.\n"); + return AVERROR_EXPERIMENTAL; + } + } } else if (st->codecpar->codec_type == AVMEDIA_TYPE_DATA) { track->timescale = st->time_base.den; } else { @@ -7047,6 +7207,11 @@ static int mov_write_trailer(AVFormatContext *s) } } + // Check if we have any tracks that require squashing. + // In that case, we'll have to write the packet here. + if ((res = mov_write_squashed_packets(s)) < 0) + return res; + // If there were no chapters when the header was written, but there // are chapters now, write them in the trailer. This only works // when we are not doing fragments. @@ -7191,6 +7356,8 @@ static const AVCodecTag codec_mp4_tags[] = { { AV_CODEC_ID_MOV_TEXT, MKTAG('t', 'x', '3', 'g') }, { AV_CODEC_ID_BIN_DATA, MKTAG('g', 'p', 'm', 'd') }, { AV_CODEC_ID_MPEGH_3D_AUDIO, MKTAG('m', 'h', 'm', '1') }, + { AV_CODEC_ID_TTML, MOV_MP4_TTML_TAG }, + { AV_CODEC_ID_TTML, MOV_ISMV_TTML_TAG }, { AV_CODEC_ID_NONE, 0 }, }; #if CONFIG_MP4_MUXER || CONFIG_PSP_MUXER @@ -7199,6 +7366,7 @@ static const AVCodecTag *const mp4_codec_tags_list[] = { codec_mp4_tags, NULL }; static const AVCodecTag codec_ism_tags[] = { { AV_CODEC_ID_WMAPRO , MKTAG('w', 'm', 'a', ' ') }, + { AV_CODEC_ID_TTML , MOV_ISMV_TTML_TAG }, { AV_CODEC_ID_NONE , 0 }, }; diff --git a/chromium/third_party/ffmpeg/libavformat/movenc.h b/chromium/third_party/ffmpeg/libavformat/movenc.h index af1ea0bce64..40077b1afea 100644 --- a/chromium/third_party/ffmpeg/libavformat/movenc.h +++ b/chromium/third_party/ffmpeg/libavformat/movenc.h @@ -26,6 +26,7 @@ #include "avformat.h" #include "movenccenc.h" +#include "libavcodec/packet_internal.h" #define MOV_FRAG_INFO_ALLOC_INCREMENT 64 #define MOV_INDEX_CLUSTER_SIZE 1024 @@ -138,7 +139,6 @@ typedef struct MOVTrack { AVIOContext *mdat_buf; int64_t data_offset; - int64_t frag_start; int frag_discont; int entries_flushed; @@ -164,6 +164,10 @@ typedef struct MOVTrack { int pal_done; int is_unaligned_qt_rgb; + + unsigned int squash_fragment_samples_to_one; //< flag to note formats where all samples for a fragment are to be squashed + + PacketList *squashed_packet_queue, *squashed_packet_queue_end; } MOVTrack; typedef enum { diff --git a/chromium/third_party/ffmpeg/libavformat/movenc_ttml.c b/chromium/third_party/ffmpeg/libavformat/movenc_ttml.c new file mode 100644 index 00000000000..472572b45aa --- /dev/null +++ b/chromium/third_party/ffmpeg/libavformat/movenc_ttml.c @@ -0,0 +1,171 @@ +/* + * MP4, ISMV Muxer TTML helpers + * Copyright (c) 2021 24i + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "avformat.h" +#include "avio_internal.h" +#include "isom.h" +#include "movenc.h" +#include "movenc_ttml.h" +#include "libavcodec/packet_internal.h" + +static const unsigned char empty_ttml_document[] = + "<tt xml:lang=\"\" xmlns=\"http://www.w3.org/ns/ttml\" />"; + +static int mov_init_ttml_writer(MOVTrack *track, AVFormatContext **out_ctx) +{ + AVStream *movenc_stream = track->st, *ttml_stream = NULL; + int ret = AVERROR_BUG; + + if ((ret = avformat_alloc_output_context2(out_ctx, NULL, + "ttml", NULL)) < 0) + return ret; + + if ((ret = avio_open_dyn_buf(&(*out_ctx)->pb)) < 0) + return ret; + + if (!(ttml_stream = avformat_new_stream(*out_ctx, NULL))) { + return AVERROR(ENOMEM); + } + + if ((ret = avcodec_parameters_copy(ttml_stream->codecpar, + movenc_stream->codecpar)) < 0) + return ret; + + ttml_stream->time_base = movenc_stream->time_base; + + return 0; +} + +static int mov_write_ttml_document_from_queue(AVFormatContext *s, + AVFormatContext *ttml_ctx, + MOVTrack *track, + AVPacket *pkt, + int64_t *out_start_ts, + int64_t *out_duration) +{ + int ret = AVERROR_BUG; + int64_t start_ts = track->start_dts == AV_NOPTS_VALUE ? + 0 : (track->start_dts + track->track_duration); + int64_t end_ts = start_ts; + + if ((ret = avformat_write_header(ttml_ctx, NULL)) < 0) { + return ret; + } + + while (!avpriv_packet_list_get(&track->squashed_packet_queue, + &track->squashed_packet_queue_end, + pkt)) { + end_ts = FFMAX(end_ts, pkt->pts + pkt->duration); + + // in case of the 'dfxp' muxing mode, each written document is offset + // to its containing sample's beginning. + if (track->par->codec_tag == MOV_ISMV_TTML_TAG) { + pkt->dts = pkt->pts = (pkt->pts - start_ts); + } + + pkt->stream_index = 0; + + av_packet_rescale_ts(pkt, track->st->time_base, + ttml_ctx->streams[pkt->stream_index]->time_base); + + if ((ret = av_write_frame(ttml_ctx, pkt)) < 0) { + goto cleanup; + } + + av_packet_unref(pkt); + } + + if ((ret = av_write_trailer(ttml_ctx)) < 0) + goto cleanup; + + *out_start_ts = start_ts; + *out_duration = end_ts - start_ts; + + ret = 0; + +cleanup: + return ret; +} + +int ff_mov_generate_squashed_ttml_packet(AVFormatContext *s, + MOVTrack *track, AVPacket *pkt) +{ + AVFormatContext *ttml_ctx = NULL; + // values for the generated AVPacket + int64_t start_ts = 0; + int64_t duration = 0; + + int ret = AVERROR_BUG; + + if ((ret = mov_init_ttml_writer(track, &ttml_ctx)) < 0) { + av_log(s, AV_LOG_ERROR, "Failed to initialize the TTML writer: %s\n", + av_err2str(ret)); + goto cleanup; + } + + if (!track->squashed_packet_queue) { + // empty queue, write minimal empty document with zero duration + avio_write(ttml_ctx->pb, empty_ttml_document, + sizeof(empty_ttml_document) - 1); + start_ts = 0; + duration = 0; + goto generate_packet; + } + + if ((ret = mov_write_ttml_document_from_queue(s, ttml_ctx, track, pkt, + &start_ts, + &duration)) < 0) { + av_log(s, AV_LOG_ERROR, + "Failed to generate a squashed TTML packet from the packet " + "queue: %s\n", + av_err2str(ret)); + goto cleanup; + } + +generate_packet: + { + // Generate an AVPacket from the data written into the dynamic buffer. + uint8_t *buf = NULL; + int buf_len = avio_close_dyn_buf(ttml_ctx->pb, &buf); + ttml_ctx->pb = NULL; + + if ((ret = av_packet_from_data(pkt, buf, buf_len)) < 0) { + av_log(s, AV_LOG_ERROR, + "Failed to create a TTML AVPacket from AVIO data: %s\n", + av_err2str(ret)); + av_freep(&buf); + goto cleanup; + } + + pkt->pts = pkt->dts = start_ts; + pkt->duration = duration; + pkt->flags |= AV_PKT_FLAG_KEY; + } + + ret = 0; + +cleanup: + if (ttml_ctx) + ffio_free_dyn_buf(&ttml_ctx->pb); + + avformat_free_context(ttml_ctx); + return ret; +} diff --git a/chromium/third_party/ffmpeg/libavfilter/vif.h b/chromium/third_party/ffmpeg/libavformat/movenc_ttml.h index 5b0d86da00e..c71ecd0997d 100644 --- a/chromium/third_party/ffmpeg/libavfilter/vif.h +++ b/chromium/third_party/ffmpeg/libavformat/movenc_ttml.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2017 Ronald S. Bultje <rsbultje@gmail.com> - * Copyright (c) 2017 Ashish Pratap Singh <ashk43712@gmail.com> + * MP4, ISMV Muxer TTML helpers + * Copyright (c) 2021 24i * * This file is part of FFmpeg. * @@ -19,14 +19,13 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef AVFILTER_VIF_H -#define AVFILTER_VIF_H +#ifndef AVFORMAT_MOVENC_TTML_H +#define AVFORMAT_MOVENC_TTML_H -#include "avfilter.h" +#include "avformat.h" +#include "movenc.h" -int ff_compute_vif2(AVFilterContext *ctx, - const float *ref, const float *main, int w, int h, - int ref_stride, int main_stride, float *score, - float *data_buf[13], float **temp, int nb_threads); +int ff_mov_generate_squashed_ttml_packet(AVFormatContext *s, + MOVTrack *track, AVPacket *pkt); -#endif /* AVFILTER_VIF_H */ +#endif /* AVFORMAT_MOVENC_TTML_H */ diff --git a/chromium/third_party/ffmpeg/libavformat/mp3dec.c b/chromium/third_party/ffmpeg/libavformat/mp3dec.c index a9c6ad2e142..5d63e073f5d 100644 --- a/chromium/third_party/ffmpeg/libavformat/mp3dec.c +++ b/chromium/third_party/ffmpeg/libavformat/mp3dec.c @@ -389,7 +389,7 @@ static int mp3_read_header(AVFormatContext *s) // lcm of all mp3 sample rates avpriv_set_pts_info(st, 64, 1, 14112000); - s->pb->maxsize = -1; + ffiocontext(s->pb)->maxsize = -1; off = avio_tell(s->pb); if (!skip_id3v1 && !av_dict_get(s->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX)) diff --git a/chromium/third_party/ffmpeg/libavformat/mpc8.c b/chromium/third_party/ffmpeg/libavformat/mpc8.c index df5d345f857..a0e661c2ab0 100644 --- a/chromium/third_party/ffmpeg/libavformat/mpc8.c +++ b/chromium/third_party/ffmpeg/libavformat/mpc8.c @@ -177,7 +177,13 @@ static void mpc8_parse_seektable(AVFormatContext *s, int64_t off) } seekd = get_bits(&gb, 4); for(i = 0; i < 2; i++){ - pos = gb_get_v(&gb) + c->header_pos; + pos = gb_get_v(&gb); + if (av_sat_add64(pos, c->header_pos) != pos + (uint64_t)c->header_pos) { + av_free(buf); + return; + } + + pos += c->header_pos; ppos[1 - i] = pos; av_add_index_entry(s->streams[0], pos, i, 0, 0, AVINDEX_KEYFRAME); } diff --git a/chromium/third_party/ffmpeg/libavformat/mpegts.c b/chromium/third_party/ffmpeg/libavformat/mpegts.c index a02965bacff..fe89d4fb9f3 100644 --- a/chromium/third_party/ffmpeg/libavformat/mpegts.c +++ b/chromium/third_party/ffmpeg/libavformat/mpegts.c @@ -1427,7 +1427,7 @@ static PESContext *add_pes_stream(MpegTSContext *ts, int pid, int pcr_pid) #define MAX_LEVEL 4 typedef struct MP4DescrParseContext { AVFormatContext *s; - AVIOContext pb; + FFIOContext pb; Mp4Descr *descr; Mp4Descr *active_descr; int descr_count; @@ -1440,13 +1440,11 @@ static int init_MP4DescrParseContext(MP4DescrParseContext *d, AVFormatContext *s const uint8_t *buf, unsigned size, Mp4Descr *descr, int max_descr_count) { - int ret; if (size > (1 << 30)) return AVERROR_INVALIDDATA; - if ((ret = ffio_init_context(&d->pb, (unsigned char *)buf, size, 0, - NULL, NULL, NULL, NULL)) < 0) - return ret; + ffio_init_context(&d->pb, (unsigned char *)buf, size, + 0, NULL, NULL, NULL, NULL); d->s = s; d->level = 0; @@ -1474,20 +1472,21 @@ static int parse_mp4_descr_arr(MP4DescrParseContext *d, int64_t off, int len) int ret = parse_mp4_descr(d, off, len, 0); if (ret < 0) return ret; - update_offsets(&d->pb, &off, &len); + update_offsets(&d->pb.pub, &off, &len); } return 0; } static int parse_MP4IODescrTag(MP4DescrParseContext *d, int64_t off, int len) { - avio_rb16(&d->pb); // ID - avio_r8(&d->pb); - avio_r8(&d->pb); - avio_r8(&d->pb); - avio_r8(&d->pb); - avio_r8(&d->pb); - update_offsets(&d->pb, &off, &len); + AVIOContext *const pb = &d->pb.pub; + avio_rb16(pb); // ID + avio_r8(pb); + avio_r8(pb); + avio_r8(pb); + avio_r8(pb); + avio_r8(pb); + update_offsets(pb, &off, &len); return parse_mp4_descr_arr(d, off, len); } @@ -1496,9 +1495,9 @@ static int parse_MP4ODescrTag(MP4DescrParseContext *d, int64_t off, int len) int id_flags; if (len < 2) return 0; - id_flags = avio_rb16(&d->pb); + id_flags = avio_rb16(&d->pb.pub); if (!(id_flags & 0x0020)) { // URL_Flag - update_offsets(&d->pb, &off, &len); + update_offsets(&d->pb.pub, &off, &len); return parse_mp4_descr_arr(d, off, len); // ES_Descriptor[] } else { return 0; @@ -1507,19 +1506,20 @@ static int parse_MP4ODescrTag(MP4DescrParseContext *d, int64_t off, int len) static int parse_MP4ESDescrTag(MP4DescrParseContext *d, int64_t off, int len) { + AVIOContext *const pb = &d->pb.pub; int es_id = 0; int ret = 0; if (d->descr_count >= d->max_descr_count) return AVERROR_INVALIDDATA; - ff_mp4_parse_es_descr(&d->pb, &es_id); + ff_mp4_parse_es_descr(pb, &es_id); d->active_descr = d->descr + (d->descr_count++); d->active_descr->es_id = es_id; - update_offsets(&d->pb, &off, &len); + update_offsets(pb, &off, &len); if ((ret = parse_mp4_descr(d, off, len, MP4DecConfigDescrTag)) < 0) return ret; - update_offsets(&d->pb, &off, &len); + update_offsets(pb, &off, &len); if (len > 0) ret = parse_mp4_descr(d, off, len, MP4SLDescrTag); d->active_descr = NULL; @@ -1536,42 +1536,43 @@ static int parse_MP4DecConfigDescrTag(MP4DescrParseContext *d, int64_t off, if (!descr->dec_config_descr) return AVERROR(ENOMEM); descr->dec_config_descr_len = len; - avio_read(&d->pb, descr->dec_config_descr, len); + avio_read(&d->pb.pub, descr->dec_config_descr, len); return 0; } static int parse_MP4SLDescrTag(MP4DescrParseContext *d, int64_t off, int len) { Mp4Descr *descr = d->active_descr; + AVIOContext *const pb = &d->pb.pub; int predefined; if (!descr) return AVERROR_INVALIDDATA; #define R8_CHECK_CLIP_MAX(dst, maxv) do { \ - descr->sl.dst = avio_r8(&d->pb); \ + descr->sl.dst = avio_r8(pb); \ if (descr->sl.dst > maxv) { \ descr->sl.dst = maxv; \ return AVERROR_INVALIDDATA; \ } \ } while (0) - predefined = avio_r8(&d->pb); + predefined = avio_r8(pb); if (!predefined) { int lengths; - int flags = avio_r8(&d->pb); + int flags = avio_r8(pb); descr->sl.use_au_start = !!(flags & 0x80); descr->sl.use_au_end = !!(flags & 0x40); descr->sl.use_rand_acc_pt = !!(flags & 0x20); descr->sl.use_padding = !!(flags & 0x08); descr->sl.use_timestamps = !!(flags & 0x04); descr->sl.use_idle = !!(flags & 0x02); - descr->sl.timestamp_res = avio_rb32(&d->pb); - avio_rb32(&d->pb); + descr->sl.timestamp_res = avio_rb32(pb); + avio_rb32(pb); R8_CHECK_CLIP_MAX(timestamp_len, 63); R8_CHECK_CLIP_MAX(ocr_len, 63); R8_CHECK_CLIP_MAX(au_len, 31); - descr->sl.inst_bitrate_len = avio_r8(&d->pb); - lengths = avio_rb16(&d->pb); + descr->sl.inst_bitrate_len = avio_r8(pb); + lengths = avio_rb16(pb); descr->sl.degr_prior_len = lengths >> 12; descr->sl.au_seq_num_len = (lengths >> 7) & 0x1f; descr->sl.packet_seq_num_len = (lengths >> 2) & 0x1f; @@ -1586,10 +1587,11 @@ static int parse_mp4_descr(MP4DescrParseContext *d, int64_t off, int len, int target_tag) { int tag; - int len1 = ff_mp4_read_descr(d->s, &d->pb, &tag); + AVIOContext *const pb = &d->pb.pub; + int len1 = ff_mp4_read_descr(d->s, pb, &tag); int ret = 0; - update_offsets(&d->pb, &off, &len); + update_offsets(pb, &off, &len); if (len < 0 || len1 > len || len1 <= 0) { av_log(d->s, AV_LOG_ERROR, "Tag %x length violation new length %d bytes remaining %d\n", @@ -1631,7 +1633,7 @@ static int parse_mp4_descr(MP4DescrParseContext *d, int64_t off, int len, done: d->level--; - avio_seek(&d->pb, off + len1, SEEK_SET); + avio_seek(pb, off + len1, SEEK_SET); return ret; } @@ -1645,7 +1647,7 @@ static int mp4_read_iods(AVFormatContext *s, const uint8_t *buf, unsigned size, if (ret < 0) return ret; - ret = parse_mp4_descr(&d, avio_tell(&d.pb), size, MP4IODescrTag); + ret = parse_mp4_descr(&d, avio_tell(&d.pb.pub), size, MP4IODescrTag); *descr_count = d.descr_count; return ret; @@ -1661,7 +1663,7 @@ static int mp4_read_od(AVFormatContext *s, const uint8_t *buf, unsigned size, if (ret < 0) return ret; - ret = parse_mp4_descr_arr(&d, avio_tell(&d.pb), size); + ret = parse_mp4_descr_arr(&d, avio_tell(&d.pb.pub), size); *descr_count = d.descr_count; return ret; @@ -1674,7 +1676,6 @@ static void m4sl_cb(MpegTSFilter *filter, const uint8_t *section, MpegTSSectionFilter *tssf = &filter->u.section_filter; SectionHeader h; const uint8_t *p, *p_end; - AVIOContext pb; int mp4_descr_count = 0; Mp4Descr mp4_descr[MAX_MP4_DESCR_COUNT] = { { 0 } }; int i, pid; @@ -1698,6 +1699,7 @@ static void m4sl_cb(MpegTSFilter *filter, const uint8_t *section, for (i = 0; i < mp4_descr_count; i++) { PESContext *pes; AVStream *st; + FFIOContext pb; if (ts->pids[pid]->es_id != mp4_descr[i].es_id) continue; if (ts->pids[pid]->type != MPEGTS_PES) { @@ -1714,7 +1716,7 @@ static void m4sl_cb(MpegTSFilter *filter, const uint8_t *section, ffio_init_context(&pb, mp4_descr[i].dec_config_descr, mp4_descr[i].dec_config_descr_len, 0, NULL, NULL, NULL, NULL); - ff_mp4_read_dec_config_descr(s, st, &pb); + ff_mp4_read_dec_config_descr(s, st, &pb.pub); if (st->codecpar->codec_id == AV_CODEC_ID_AAC && st->codecpar->extradata_size > 0) st->internal->need_parsing = 0; @@ -1819,11 +1821,11 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type for (i = 0; i < mp4_descr_count; i++) if (mp4_descr[i].dec_config_descr_len && mp4_descr[i].es_id == desc_es_id) { - AVIOContext pb; + FFIOContext pb; ffio_init_context(&pb, mp4_descr[i].dec_config_descr, mp4_descr[i].dec_config_descr_len, 0, NULL, NULL, NULL, NULL); - ff_mp4_read_dec_config_descr(fc, st, &pb); + ff_mp4_read_dec_config_descr(fc, st, &pb.pub); if (st->codecpar->codec_id == AV_CODEC_ID_AAC && st->codecpar->extradata_size > 0) { st->internal->need_parsing = 0; @@ -1841,11 +1843,11 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type (st->internal->request_probe == 0 && st->codecpar->codec_id == AV_CODEC_ID_NONE) || st->internal->request_probe > 0) && mp4_descr->dec_config_descr_len && mp4_descr->es_id == pid) { - AVIOContext pb; + FFIOContext pb; ffio_init_context(&pb, mp4_descr->dec_config_descr, mp4_descr->dec_config_descr_len, 0, NULL, NULL, NULL, NULL); - ff_mp4_read_dec_config_descr(fc, st, &pb); + ff_mp4_read_dec_config_descr(fc, st, &pb.pub); if (st->codecpar->codec_id == AV_CODEC_ID_AAC && st->codecpar->extradata_size > 0) { st->internal->request_probe = st->internal->need_parsing = 0; diff --git a/chromium/third_party/ffmpeg/libavformat/mpjpegdec.c b/chromium/third_party/ffmpeg/libavformat/mpjpegdec.c index 28a24184a27..559a375d8d7 100644 --- a/chromium/third_party/ffmpeg/libavformat/mpjpegdec.c +++ b/chromium/third_party/ffmpeg/libavformat/mpjpegdec.c @@ -113,7 +113,7 @@ static int mpjpeg_read_close(AVFormatContext *s) static int mpjpeg_read_probe(const AVProbeData *p) { - AVIOContext pb; + FFIOContext pb; int ret = 0; int size = 0; @@ -122,7 +122,7 @@ static int mpjpeg_read_probe(const AVProbeData *p) ffio_init_context(&pb, p->buf, p->buf_size, 0, NULL, NULL, NULL, NULL); - ret = (parse_multipart_header(&pb, &size, "--", NULL) >= 0) ? AVPROBE_SCORE_MAX : 0; + ret = (parse_multipart_header(&pb.pub, &size, "--", NULL) >= 0) ? AVPROBE_SCORE_MAX : 0; return ret; } diff --git a/chromium/third_party/ffmpeg/libavformat/mux.c b/chromium/third_party/ffmpeg/libavformat/mux.c index 6fa1c5495bd..6ba1306f2bc 100644 --- a/chromium/third_party/ffmpeg/libavformat/mux.c +++ b/chromium/third_party/ffmpeg/libavformat/mux.c @@ -509,7 +509,7 @@ FF_DISABLE_DEPRECATION_WARNINGS //FIXME merge with compute_pkt_fields static int compute_muxer_pkt_fields(AVFormatContext *s, AVStream *st, AVPacket *pkt) { - int delay = FFMAX(st->codecpar->video_delay, st->internal->avctx->max_b_frames > 0); + int delay = st->codecpar->video_delay; int i; int frame_size; @@ -643,12 +643,12 @@ static void guess_pkt_duration(AVFormatContext *s, AVStream *st, AVPacket *pkt) */ static int write_packet(AVFormatContext *s, AVPacket *pkt) { + AVStream *const st = s->streams[pkt->stream_index]; int ret; // If the timestamp offsetting below is adjusted, adjust // ff_interleaved_peek similarly. if (s->output_ts_offset) { - AVStream *st = s->streams[pkt->stream_index]; int64_t offset = av_rescale_q(s->output_ts_offset, AV_TIME_BASE_Q, st->time_base); if (pkt->dts != AV_NOPTS_VALUE) @@ -658,7 +658,6 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) } if (s->avoid_negative_ts > 0) { - AVStream *st = s->streams[pkt->stream_index]; int64_t offset = st->internal->mux_ts_offset; int64_t ts = s->internal->avoid_negative_ts_use_pts ? pkt->pts : pkt->dts; @@ -719,7 +718,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) } if (ret >= 0) - s->streams[pkt->stream_index]->nb_frames++; + st->nb_frames++; return ret; } @@ -1192,6 +1191,7 @@ int av_write_frame(AVFormatContext *s, AVPacket *in) pkt = in; } else { /* We don't own in, so we have to make sure not to modify it. + * (ff_write_chained() relies on this fact.) * The following avoids copying in's data unnecessarily. * Copying side data is unavoidable as a bitstream filter * may change it, e.g. free it on errors. */ @@ -1291,21 +1291,30 @@ int av_get_output_timestamp(struct AVFormatContext *s, int stream, int ff_write_chained(AVFormatContext *dst, int dst_stream, AVPacket *pkt, AVFormatContext *src, int interleave) { - AVPacket local_pkt; + int64_t pts = pkt->pts, dts = pkt->dts, duration = pkt->duration; + int stream_index = pkt->stream_index; + AVRational time_base = pkt->time_base; int ret; - local_pkt = *pkt; - local_pkt.stream_index = dst_stream; + pkt->stream_index = dst_stream; - av_packet_rescale_ts(&local_pkt, - src->streams[pkt->stream_index]->time_base, + av_packet_rescale_ts(pkt, + src->streams[stream_index]->time_base, dst->streams[dst_stream]->time_base); - if (interleave) ret = av_interleaved_write_frame(dst, &local_pkt); - else ret = av_write_frame(dst, &local_pkt); - pkt->buf = local_pkt.buf; - pkt->side_data = local_pkt.side_data; - pkt->side_data_elems = local_pkt.side_data_elems; + if (!interleave) { + ret = av_write_frame(dst, pkt); + /* We only have to backup and restore the fields that + * we changed ourselves, because av_write_frame() does not + * modify the packet given to it. */ + pkt->pts = pts; + pkt->dts = dts; + pkt->duration = duration; + pkt->stream_index = stream_index; + pkt->time_base = time_base; + } else + ret = av_interleaved_write_frame(dst, pkt); + return ret; } diff --git a/chromium/third_party/ffmpeg/libavformat/mxfdec.c b/chromium/third_party/ffmpeg/libavformat/mxfdec.c index f491914bf17..ebe411b04d7 100644 --- a/chromium/third_party/ffmpeg/libavformat/mxfdec.c +++ b/chromium/third_party/ffmpeg/libavformat/mxfdec.c @@ -106,15 +106,19 @@ typedef struct MXFPartition { KLVPacket first_essence_klv; } MXFPartition; -typedef struct MXFCryptoContext { +typedef struct MXFMetadataSet { UID uid; + uint64_t partition_score; enum MXFMetadataSetType type; +} MXFMetadataSet; + +typedef struct MXFCryptoContext { + MXFMetadataSet meta; UID source_container_ul; } MXFCryptoContext; typedef struct MXFStructuralComponent { - UID uid; - enum MXFMetadataSetType type; + MXFMetadataSet meta; UID source_package_ul; UID source_package_uid; UID data_definition_ul; @@ -124,8 +128,7 @@ typedef struct MXFStructuralComponent { } MXFStructuralComponent; typedef struct MXFSequence { - UID uid; - enum MXFMetadataSetType type; + MXFMetadataSet meta; UID data_definition_ul; UID *structural_components_refs; int structural_components_count; @@ -134,8 +137,7 @@ typedef struct MXFSequence { } MXFSequence; typedef struct MXFTimecodeComponent { - UID uid; - enum MXFMetadataSetType type; + MXFMetadataSet meta; int drop_frame; int start_frame; struct AVRational rate; @@ -143,29 +145,25 @@ typedef struct MXFTimecodeComponent { } MXFTimecodeComponent; typedef struct { - UID uid; - enum MXFMetadataSetType type; + MXFMetadataSet meta; UID input_segment_ref; } MXFPulldownComponent; typedef struct { - UID uid; - enum MXFMetadataSetType type; + MXFMetadataSet meta; UID *structural_components_refs; int structural_components_count; int64_t duration; } MXFEssenceGroup; typedef struct { - UID uid; - enum MXFMetadataSetType type; + MXFMetadataSet meta; char *name; char *value; } MXFTaggedValue; typedef struct { - UID uid; - enum MXFMetadataSetType type; + MXFMetadataSet meta; MXFSequence *sequence; /* mandatory, and only one */ UID sequence_ref; int track_id; @@ -182,8 +180,7 @@ typedef struct { } MXFTrack; typedef struct MXFDescriptor { - UID uid; - enum MXFMetadataSetType type; + MXFMetadataSet meta; UID essence_container_ul; UID essence_codec_ul; UID codec_ul; @@ -221,8 +218,7 @@ typedef struct MXFDescriptor { } MXFDescriptor; typedef struct MXFIndexTableSegment { - UID uid; - enum MXFMetadataSetType type; + MXFMetadataSet meta; int edit_unit_byte_count; int index_sid; int body_sid; @@ -236,8 +232,7 @@ typedef struct MXFIndexTableSegment { } MXFIndexTableSegment; typedef struct MXFPackage { - UID uid; - enum MXFMetadataSetType type; + MXFMetadataSet meta; UID package_uid; UID package_ul; UID *tracks_refs; @@ -250,19 +245,13 @@ typedef struct MXFPackage { } MXFPackage; typedef struct MXFEssenceContainerData { - UID uid; - enum MXFMetadataSetType type; + MXFMetadataSet meta; UID package_uid; UID package_ul; int index_sid; int body_sid; } MXFEssenceContainerData; -typedef struct MXFMetadataSet { - UID uid; - enum MXFMetadataSetType type; -} MXFMetadataSet; - /* decoded index table */ typedef struct MXFIndexTable { int index_sid; @@ -563,6 +552,10 @@ static int mxf_get_d10_aes3_packet(AVIOContext *pb, AVStream *st, AVPacket *pkt, data_ptr = pkt->data; end_ptr = pkt->data + length; buf_ptr = pkt->data + 4; /* skip SMPTE 331M header */ + + if (st->codecpar->channels > 8) + return AVERROR_INVALIDDATA; + for (; end_ptr - buf_ptr >= st->codecpar->channels * 4; ) { for (i = 0; i < st->codecpar->channels; i++) { uint32_t sample = bytestream_get_le32(&buf_ptr); @@ -842,10 +835,42 @@ static int mxf_read_partition_pack(void *arg, AVIOContext *pb, int tag, int size return 0; } +static uint64_t partition_score(MXFPartition *p) +{ + uint64_t score; + if (!p) + return 0; + if (p->type == Footer) + score = 5; + else if (p->complete) + score = 4; + else if (p->closed) + score = 3; + else + score = 1; + return (score << 60) | ((uint64_t)p->this_partition >> 4); +} + static int mxf_add_metadata_set(MXFContext *mxf, MXFMetadataSet **metadata_set) { MXFMetadataSet **tmp; - + enum MXFMetadataSetType type = (*metadata_set)->type; + + // Index Table is special because it might be added manually without + // partition and we iterate thorugh all instances of them. Also some files + // use the same Instance UID for different index tables... + if (type != IndexTableSegment) { + for (int i = 0; i < mxf->metadata_sets_count; i++) { + if (!memcmp((*metadata_set)->uid, mxf->metadata_sets[i]->uid, 16) && type == mxf->metadata_sets[i]->type) { + uint64_t old_s = mxf->metadata_sets[i]->partition_score; + uint64_t new_s = (*metadata_set)->partition_score; + if (old_s > new_s) { + mxf_free_metadataset(metadata_set, 1); + return 0; + } + } + } + } tmp = av_realloc_array(mxf->metadata_sets, mxf->metadata_sets_count + 1, sizeof(*mxf->metadata_sets)); if (!tmp) { mxf_free_metadataset(metadata_set, 1); @@ -1400,7 +1425,7 @@ static void *mxf_resolve_strong_ref(MXFContext *mxf, UID *strong_ref, enum MXFMe if (!strong_ref) return NULL; - for (i = 0; i < mxf->metadata_sets_count; i++) { + for (i = mxf->metadata_sets_count - 1; i >= 0; i--) { if (!memcmp(*strong_ref, mxf->metadata_sets[i]->uid, 16) && (type == AnyType || mxf->metadata_sets[i]->type == type)) { return mxf->metadata_sets[i]; @@ -2018,7 +2043,7 @@ static MXFTimecodeComponent* mxf_resolve_timecode_component(MXFContext *mxf, UID if (!component) return NULL; - switch (component->type) { + switch (component->meta.type) { case TimecodeComponent: return (MXFTimecodeComponent*)component; case PulldownComponent: /* timcode component may be located on a pulldown component */ @@ -2054,7 +2079,7 @@ static MXFDescriptor* mxf_resolve_multidescriptor(MXFContext *mxf, MXFDescriptor if (!descriptor) return NULL; - if (descriptor->type == MultipleDescriptor) { + if (descriptor->meta.type == MultipleDescriptor) { for (i = 0; i < descriptor->sub_descriptors_count; i++) { sub_descriptor = mxf_resolve_strong_ref(mxf, &descriptor->sub_descriptors_refs[i], Descriptor); @@ -2066,7 +2091,7 @@ static MXFDescriptor* mxf_resolve_multidescriptor(MXFContext *mxf, MXFDescriptor return sub_descriptor; } } - } else if (descriptor->type == Descriptor) + } else if (descriptor->meta.type == Descriptor) return descriptor; return NULL; @@ -2106,7 +2131,7 @@ static MXFStructuralComponent* mxf_resolve_sourceclip(MXFContext *mxf, UID *stro component = mxf_resolve_strong_ref(mxf, strong_ref, AnyType); if (!component) return NULL; - switch (component->type) { + switch (component->meta.type) { case SourceClip: return component; case EssenceGroup: @@ -2873,9 +2898,10 @@ static const MXFMetadataReadTableEntry mxf_metadata_read_table[] = { { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, NULL, 0, AnyType }, }; -static int mxf_metadataset_init(MXFMetadataSet *ctx, enum MXFMetadataSetType type) +static int mxf_metadataset_init(MXFMetadataSet *ctx, enum MXFMetadataSetType type, MXFPartition *partition) { ctx->type = type; + ctx->partition_score = partition_score(partition); switch (type){ case MultipleDescriptor: case Descriptor: @@ -2900,7 +2926,7 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadF if (!meta) return AVERROR(ENOMEM); ctx = meta; - mxf_metadataset_init(meta, type); + mxf_metadataset_init(meta, type, mxf->current_partition); } else { meta = NULL; ctx = mxf; @@ -3269,7 +3295,7 @@ static int mxf_handle_missing_index_segment(MXFContext *mxf, AVStream *st) if (!track->index_sid) track->index_sid = track->body_sid; - segment->type = IndexTableSegment; + segment->meta.type = IndexTableSegment; /* stream will be treated as small EditUnitByteCount */ segment->edit_unit_byte_count = edit_unit_byte_count; segment->index_start_position = 0; diff --git a/chromium/third_party/ffmpeg/libavformat/mxfenc.c b/chromium/third_party/ffmpeg/libavformat/mxfenc.c index 5ec619675bb..229817dba6f 100644 --- a/chromium/third_party/ffmpeg/libavformat/mxfenc.c +++ b/chromium/third_party/ffmpeg/libavformat/mxfenc.c @@ -507,6 +507,7 @@ static const MXFLocalTagPair* mxf_lookup_local_tag(int tag) // this assert can only be hit during development av_assert0(0 && "you forgot to add your new tag to mxf_local_tag_batch"); + return NULL; } static void mxf_mark_tag_unused(MXFContext *mxf, int tag) diff --git a/chromium/third_party/ffmpeg/libavformat/nuv.c b/chromium/third_party/ffmpeg/libavformat/nuv.c index 1d25d3b1258..73521ec8e4e 100644 --- a/chromium/third_party/ffmpeg/libavformat/nuv.c +++ b/chromium/third_party/ffmpeg/libavformat/nuv.c @@ -24,6 +24,7 @@ #include "libavutil/intreadwrite.h" #include "libavutil/intfloat.h" #include "avformat.h" +#include "avio_internal.h" #include "internal.h" #include "riff.h" @@ -258,9 +259,9 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) int copyhdrsize = ctx->rtjpg_video ? HDRSIZE : 0; uint64_t pos = avio_tell(pb); - ret = avio_read(pb, hdr, HDRSIZE); - if (ret < HDRSIZE) - return ret < 0 ? ret : AVERROR(EIO); + ret = ffio_read_size(pb, hdr, HDRSIZE); + if (ret < 0) + return ret; frametype = hdr[0]; size = PKTSIZE(AV_RL32(&hdr[8])); diff --git a/chromium/third_party/ffmpeg/libavformat/oggdec.c b/chromium/third_party/ffmpeg/libavformat/oggdec.c index 285ba12ef72..f2d50bb8628 100644 --- a/chromium/third_party/ffmpeg/libavformat/oggdec.c +++ b/chromium/third_party/ffmpeg/libavformat/oggdec.c @@ -263,7 +263,6 @@ static int ogg_new_stream(AVFormatContext *s, uint32_t serial) int idx = ogg->nstreams; AVStream *st; struct ogg_stream *os; - size_t size; if (ogg->state) { av_log(s, AV_LOG_ERROR, "New streams are not supposed to be added " @@ -272,8 +271,8 @@ static int ogg_new_stream(AVFormatContext *s, uint32_t serial) } /* Allocate and init a new Ogg Stream */ - if (av_size_mult(ogg->nstreams + 1, sizeof(*ogg->streams), &size) < 0 || - !(os = av_realloc(ogg->streams, size))) + if (!(os = av_realloc_array(ogg->streams, ogg->nstreams + 1, + sizeof(*ogg->streams)))) return AVERROR(ENOMEM); ogg->streams = os; os = ogg->streams + idx; diff --git a/chromium/third_party/ffmpeg/libavformat/oggdec.h b/chromium/third_party/ffmpeg/libavformat/oggdec.h index 4cce53de415..1d28e50aa88 100644 --- a/chromium/third_party/ffmpeg/libavformat/oggdec.h +++ b/chromium/third_party/ffmpeg/libavformat/oggdec.h @@ -130,9 +130,25 @@ extern const struct ogg_codec ff_theora_codec; extern const struct ogg_codec ff_vorbis_codec; extern const struct ogg_codec ff_vp8_codec; +/** + * Parse Vorbis comments + * + * @note The buffer will be temporarily modifed by this function, + * so it needs to be writable. Furthermore it must be padded + * by a single byte (not counted in size). + * All changes will have been reverted upon return. + */ int ff_vorbis_comment(AVFormatContext *ms, AVDictionary **m, const uint8_t *buf, int size, int parse_picture); +/** + * Parse Vorbis comments and add metadata to an AVStream + * + * @note The buffer will be temporarily modifed by this function, + * so it needs to be writable. Furthermore it must be padded + * by a single byte (not counted in size). + * All changes will have been reverted upon return. + */ int ff_vorbis_stream_comment(AVFormatContext *as, AVStream *st, const uint8_t *buf, int size); diff --git a/chromium/third_party/ffmpeg/libavformat/oggenc.c b/chromium/third_party/ffmpeg/libavformat/oggenc.c index aff0ca6b969..a88dab8ccc1 100644 --- a/chromium/third_party/ffmpeg/libavformat/oggenc.c +++ b/chromium/third_party/ffmpeg/libavformat/oggenc.c @@ -275,7 +275,7 @@ static uint8_t *ogg_write_vorbiscomment(int64_t offset, int bitexact, AVChapter **chapters, unsigned int nb_chapters) { const char *vendor = bitexact ? "ffmpeg" : LIBAVFORMAT_IDENT; - AVIOContext pb; + FFIOContext pb; int64_t size; uint8_t *p; @@ -289,9 +289,9 @@ static uint8_t *ogg_write_vorbiscomment(int64_t offset, int bitexact, return NULL; ffio_init_context(&pb, p + offset, size - offset, 1, NULL, NULL, NULL, NULL); - ff_vorbiscomment_write(&pb, *m, vendor, chapters, nb_chapters); + ff_vorbiscomment_write(&pb.pub, *m, vendor, chapters, nb_chapters); if (framing_bit) - avio_w8(&pb, 1); + avio_w8(&pb.pub, 1); *header_len = size; return p; diff --git a/chromium/third_party/ffmpeg/libavformat/oggparsevorbis.c b/chromium/third_party/ffmpeg/libavformat/oggparsevorbis.c index b438bc03fcd..b3bc3087309 100644 --- a/chromium/third_party/ffmpeg/libavformat/oggparsevorbis.c +++ b/chromium/third_party/ffmpeg/libavformat/oggparsevorbis.c @@ -39,7 +39,7 @@ #include "vorbiscomment.h" #include "replaygain.h" -static int ogm_chapter(AVFormatContext *as, uint8_t *key, uint8_t *val) +static int ogm_chapter(AVFormatContext *as, const uint8_t *key, const uint8_t *val) { int i, cnum, h, m, s, ms, keylen = strlen(key); AVChapter *chapter = NULL; @@ -54,7 +54,6 @@ static int ogm_chapter(AVFormatContext *as, uint8_t *key, uint8_t *val) avpriv_new_chapter(as, cnum, (AVRational) { 1, 1000 }, ms + 1000 * (s + 60 * (m + 60 * h)), AV_NOPTS_VALUE, NULL); - av_free(val); } else if (!av_strcasecmp(key + keylen - 4, "NAME")) { for (i = 0; i < as->nb_chapters; i++) if (as->chapters[i]->id == cnum) { @@ -64,11 +63,10 @@ static int ogm_chapter(AVFormatContext *as, uint8_t *key, uint8_t *val) if (!chapter) return 0; - av_dict_set(&chapter->metadata, "title", val, AV_DICT_DONT_STRDUP_VAL); + av_dict_set(&chapter->metadata, "title", val, 0); } else return 0; - av_free(key); return 1; } @@ -84,6 +82,69 @@ int ff_vorbis_stream_comment(AVFormatContext *as, AVStream *st, return updates; } +/** + * This function temporarily modifies the (const qualified) input buffer + * and reverts its changes before return. The input buffer needs to have + * at least one byte of padding. + */ +static int vorbis_parse_single_comment(AVFormatContext *as, AVDictionary **m, + const uint8_t *buf, uint32_t size, + int *updates, int parse_picture) +{ + char *t = (char*)buf, *v = memchr(t, '=', size); + int tl, vl; + char backup; + + if (!v) + return 0; + + tl = v - t; + vl = size - tl - 1; + v++; + + if (!tl || !vl) + return 0; + + t[tl] = 0; + + backup = v[vl]; + v[vl] = 0; + + /* The format in which the pictures are stored is the FLAC format. + * Xiph says: "The binary FLAC picture structure is base64 encoded + * and placed within a VorbisComment with the tag name + * 'METADATA_BLOCK_PICTURE'. This is the preferred and + * recommended way of embedding cover art within VorbisComments." + */ + if (!av_strcasecmp(t, "METADATA_BLOCK_PICTURE") && parse_picture) { + int ret, len = AV_BASE64_DECODE_SIZE(vl); + uint8_t *pict = av_malloc(len + AV_INPUT_BUFFER_PADDING_SIZE); + + if (!pict) { + av_log(as, AV_LOG_WARNING, "out-of-memory error. Skipping cover art block.\n"); + goto end; + } + ret = av_base64_decode(pict, v, len); + if (ret > 0) + ret = ff_flac_parse_picture(as, &pict, ret, 0); + av_freep(&pict); + if (ret < 0) { + av_log(as, AV_LOG_WARNING, "Failed to parse cover art block.\n"); + goto end; + } + } else if (!ogm_chapter(as, t, v)) { + (*updates)++; + if (av_dict_get(*m, t, NULL, 0)) + av_dict_set(m, t, ";", AV_DICT_APPEND); + av_dict_set(m, t, v, AV_DICT_APPEND); + } +end: + t[tl] = '='; + v[vl] = backup; + + return 0; +} + int ff_vorbis_comment(AVFormatContext *as, AVDictionary **m, const uint8_t *buf, int size, int parse_picture) @@ -92,7 +153,7 @@ int ff_vorbis_comment(AVFormatContext *as, AVDictionary **m, const uint8_t *end = buf + size; int updates = 0; unsigned n; - int s; + int s, ret; /* must have vendor_length and user_comment_list_length */ if (size < 8) @@ -108,79 +169,16 @@ int ff_vorbis_comment(AVFormatContext *as, AVDictionary **m, n = bytestream_get_le32(&p); while (end - p >= 4 && n > 0) { - const char *t, *v; - int tl, vl; - s = bytestream_get_le32(&p); if (end - p < s || s < 0) break; - t = p; + ret = vorbis_parse_single_comment(as, m, p, s, &updates, parse_picture); + if (ret < 0) + return ret; p += s; n--; - - v = memchr(t, '=', s); - if (!v) - continue; - - tl = v - t; - vl = s - tl - 1; - v++; - - if (tl && vl) { - char *tt, *ct; - - tt = av_malloc(tl + 1); - ct = av_malloc(vl + 1); - if (!tt || !ct) { - av_freep(&tt); - av_freep(&ct); - return AVERROR(ENOMEM); - } - - memcpy(tt, t, tl); - tt[tl] = 0; - - memcpy(ct, v, vl); - ct[vl] = 0; - - /* The format in which the pictures are stored is the FLAC format. - * Xiph says: "The binary FLAC picture structure is base64 encoded - * and placed within a VorbisComment with the tag name - * 'METADATA_BLOCK_PICTURE'. This is the preferred and - * recommended way of embedding cover art within VorbisComments." - */ - if (!av_strcasecmp(tt, "METADATA_BLOCK_PICTURE") && parse_picture) { - int ret, len = AV_BASE64_DECODE_SIZE(vl); - char *pict = av_malloc(len); - - if (!pict) { - av_log(as, AV_LOG_WARNING, "out-of-memory error. Skipping cover art block.\n"); - av_freep(&tt); - av_freep(&ct); - continue; - } - ret = av_base64_decode(pict, ct, len); - av_freep(&tt); - av_freep(&ct); - if (ret > 0) - ret = ff_flac_parse_picture(as, pict, ret, 0); - av_freep(&pict); - if (ret < 0) { - av_log(as, AV_LOG_WARNING, "Failed to parse cover art block.\n"); - continue; - } - } else if (!ogm_chapter(as, tt, ct)) { - updates++; - if (av_dict_get(*m, tt, NULL, 0)) { - av_dict_set(m, tt, ";", AV_DICT_APPEND); - } - av_dict_set(m, tt, ct, - AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL | - AV_DICT_APPEND); - } - } } if (p != end) diff --git a/chromium/third_party/ffmpeg/libavformat/paf.c b/chromium/third_party/ffmpeg/libavformat/paf.c index 2d2d7f8dd89..140e0567e14 100644 --- a/chromium/third_party/ffmpeg/libavformat/paf.c +++ b/chromium/third_party/ffmpeg/libavformat/paf.c @@ -94,7 +94,7 @@ static int read_header(AVFormatContext *s) PAFDemuxContext *p = s->priv_data; AVIOContext *pb = s->pb; AVStream *ast, *vst; - int ret = 0; + int frame_ms, ret = 0; avio_skip(pb, 132); @@ -106,7 +106,9 @@ static int read_header(AVFormatContext *s) vst->nb_frames = vst->duration = p->nb_frames = avio_rl32(pb); - avio_skip(pb, 4); + frame_ms = avio_rl32(pb); + if (frame_ms < 1) + return AVERROR_INVALIDDATA; vst->codecpar->width = avio_rl32(pb); vst->codecpar->height = avio_rl32(pb); @@ -115,7 +117,7 @@ static int read_header(AVFormatContext *s) vst->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; vst->codecpar->codec_tag = 0; vst->codecpar->codec_id = AV_CODEC_ID_PAF_VIDEO; - avpriv_set_pts_info(vst, 64, 1, 10); + avpriv_set_pts_info(vst, 64, frame_ms, 1000); ast = avformat_new_stream(s, 0); if (!ast) diff --git a/chromium/third_party/ffmpeg/libavformat/pva.c b/chromium/third_party/ffmpeg/libavformat/pva.c index ff30746bcb0..aecd049c039 100644 --- a/chromium/third_party/ffmpeg/libavformat/pva.c +++ b/chromium/third_party/ffmpeg/libavformat/pva.c @@ -20,6 +20,7 @@ */ #include "avformat.h" +#include "avio_internal.h" #include "internal.h" #include "mpeg.h" @@ -147,9 +148,9 @@ recover: goto recover; } - ret = avio_read(pb, pes_header_data, pes_header_data_length); - if (ret != pes_header_data_length) - return ret < 0 ? ret : AVERROR_INVALIDDATA; + ret = ffio_read_size(pb, pes_header_data, pes_header_data_length); + if (ret < 0) + return ret; length -= 9 + pes_header_data_length; pes_packet_length -= 3 + pes_header_data_length; diff --git a/chromium/third_party/ffmpeg/libavformat/rawdec.c b/chromium/third_party/ffmpeg/libavformat/rawdec.c index 06406424c88..b7e5a2d966e 100644 --- a/chromium/third_party/ffmpeg/libavformat/rawdec.c +++ b/chromium/third_party/ffmpeg/libavformat/rawdec.c @@ -102,7 +102,7 @@ int ff_raw_subtitle_read_header(AVFormatContext *s) return 0; } -int ff_raw_data_read_header(AVFormatContext *s) +static int raw_data_read_header(AVFormatContext *s) { AVStream *st = avformat_new_stream(s, NULL); if (!st) @@ -148,7 +148,7 @@ const AVClass ff_raw_demuxer_class = { const AVInputFormat ff_data_demuxer = { .name = "data", .long_name = NULL_IF_CONFIG_SMALL("raw data"), - .read_header = ff_raw_data_read_header, + .read_header = raw_data_read_header, .read_packet = ff_raw_read_partial_packet, .raw_codec_id = AV_CODEC_ID_NONE, .flags = AVFMT_NOTIMESTAMPS, diff --git a/chromium/third_party/ffmpeg/libavformat/rawdec.h b/chromium/third_party/ffmpeg/libavformat/rawdec.h index 18777db290e..f843fe5a2e0 100644 --- a/chromium/third_party/ffmpeg/libavformat/rawdec.h +++ b/chromium/third_party/ffmpeg/libavformat/rawdec.h @@ -49,8 +49,6 @@ int ff_raw_video_read_header(AVFormatContext *s); int ff_raw_subtitle_read_header(AVFormatContext *s); -int ff_raw_data_read_header(AVFormatContext *s); - #define FF_DEF_RAWVIDEO_DEMUXER2(shortname, longname, probe, ext, id, flag)\ const AVInputFormat ff_ ## shortname ## _demuxer = {\ .name = #shortname,\ diff --git a/chromium/third_party/ffmpeg/libavformat/rawenc.c b/chromium/third_party/ffmpeg/libavformat/rawenc.c index 088b62f3692..ad29e710995 100644 --- a/chromium/third_party/ffmpeg/libavformat/rawenc.c +++ b/chromium/third_party/ffmpeg/libavformat/rawenc.c @@ -453,6 +453,26 @@ const AVOutputFormat ff_mpeg2video_muxer = { }; #endif +#if CONFIG_OBU_MUXER +static int obu_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt) +{ + AVStream *st = s->streams[0]; + return ff_stream_add_bitstream_filter(st, "av1_metadata", "td=insert"); +} + +const AVOutputFormat ff_obu_muxer = { + .name = "obu", + .long_name = NULL_IF_CONFIG_SMALL("AV1 low overhead OBU"), + .extensions = "obu", + .audio_codec = AV_CODEC_ID_NONE, + .video_codec = AV_CODEC_ID_AV1, + .init = force_one_stream, + .write_packet = ff_raw_write_packet, + .check_bitstream = obu_check_bitstream, + .flags = AVFMT_NOTIMESTAMPS, +}; +#endif + #if CONFIG_RAWVIDEO_MUXER const AVOutputFormat ff_rawvideo_muxer = { .name = "rawvideo", diff --git a/chromium/third_party/ffmpeg/libavformat/rdt.c b/chromium/third_party/ffmpeg/libavformat/rdt.c index da55503ea6e..a015acb6902 100644 --- a/chromium/third_party/ffmpeg/libavformat/rdt.c +++ b/chromium/third_party/ffmpeg/libavformat/rdt.c @@ -131,7 +131,8 @@ ff_rdt_calc_response_and_checksum(char response[41], char chksum[9], static int rdt_load_mdpr (PayloadContext *rdt, AVStream *st, int rule_nr) { - AVIOContext pb; + FFIOContext pb0; + AVIOContext *const pb = &pb0.pub; unsigned int size; uint32_t tag; @@ -151,32 +152,32 @@ rdt_load_mdpr (PayloadContext *rdt, AVStream *st, int rule_nr) */ if (!rdt->mlti_data) return -1; - ffio_init_context(&pb, rdt->mlti_data, rdt->mlti_data_size, 0, + ffio_init_context(&pb0, rdt->mlti_data, rdt->mlti_data_size, 0, NULL, NULL, NULL, NULL); - tag = avio_rl32(&pb); + tag = avio_rl32(pb); if (tag == MKTAG('M', 'L', 'T', 'I')) { int num, chunk_nr; /* read index of MDPR chunk numbers */ - num = avio_rb16(&pb); + num = avio_rb16(pb); if (rule_nr < 0 || rule_nr >= num) return -1; - avio_skip(&pb, rule_nr * 2); - chunk_nr = avio_rb16(&pb); - avio_skip(&pb, (num - 1 - rule_nr) * 2); + avio_skip(pb, rule_nr * 2); + chunk_nr = avio_rb16(pb); + avio_skip(pb, (num - 1 - rule_nr) * 2); /* read MDPR chunks */ - num = avio_rb16(&pb); + num = avio_rb16(pb); if (chunk_nr >= num) return -1; while (chunk_nr--) - avio_skip(&pb, avio_rb32(&pb)); - size = avio_rb32(&pb); + avio_skip(pb, avio_rb32(pb)); + size = avio_rb32(pb); } else { size = rdt->mlti_data_size; - avio_seek(&pb, 0, SEEK_SET); + avio_seek(pb, 0, SEEK_SET); } - if (ff_rm_read_mdpr_codecdata(rdt->rmctx, &pb, st, rdt->rmst[st->index], size, NULL) < 0) + if (ff_rm_read_mdpr_codecdata(rdt->rmctx, pb, st, rdt->rmst[st->index], size, NULL) < 0) return -1; return 0; @@ -296,16 +297,16 @@ rdt_parse_packet (AVFormatContext *ctx, PayloadContext *rdt, AVStream *st, const uint8_t *buf, int len, uint16_t rtp_seq, int flags) { int seq = 1, res; - AVIOContext pb; if (rdt->audio_pkt_cnt == 0) { + FFIOContext pb; int pos, rmflags; ffio_init_context(&pb, (uint8_t *)buf, len, 0, NULL, NULL, NULL, NULL); rmflags = (flags & RTP_FLAG_KEY) ? 2 : 0; - res = ff_rm_parse_packet (rdt->rmctx, &pb, st, rdt->rmst[st->index], len, pkt, - &seq, rmflags, *timestamp); - pos = avio_tell(&pb); + res = ff_rm_parse_packet(rdt->rmctx, &pb.pub, st, rdt->rmst[st->index], + len, pkt, &seq, rmflags, *timestamp); + pos = avio_tell(&pb.pub); if (res < 0) return res; if (res > 0) { diff --git a/chromium/third_party/ffmpeg/libavformat/riff.c b/chromium/third_party/ffmpeg/libavformat/riff.c index 423926e3bd2..27a97065109 100644 --- a/chromium/third_party/ffmpeg/libavformat/riff.c +++ b/chromium/third_party/ffmpeg/libavformat/riff.c @@ -560,6 +560,7 @@ const AVCodecTag ff_codec_wav_tags[] = { { AV_CODEC_ID_DVAUDIO, 0x0215 }, { AV_CODEC_ID_DVAUDIO, 0x0216 }, { AV_CODEC_ID_ATRAC3, 0x0270 }, + { AV_CODEC_ID_MSNSIREN, 0x028E }, { AV_CODEC_ID_ADPCM_G722, 0x028F }, { AV_CODEC_ID_IMC, 0x0401 }, { AV_CODEC_ID_IAC, 0x0402 }, diff --git a/chromium/third_party/ffmpeg/libavformat/riffdec.c b/chromium/third_party/ffmpeg/libavformat/riffdec.c index 444b9fc00de..bd32e598373 100644 --- a/chromium/third_party/ffmpeg/libavformat/riffdec.c +++ b/chromium/third_party/ffmpeg/libavformat/riffdec.c @@ -32,10 +32,10 @@ int ff_get_guid(AVIOContext *s, ff_asf_guid *g) { int ret; av_assert0(sizeof(*g) == 16); //compiler will optimize this out - ret = avio_read(s, *g, sizeof(*g)); - if (ret < (int)sizeof(*g)) { + ret = ffio_read_size(s, *g, sizeof(*g)); + if (ret < 0) { memset(*g, 0, sizeof(*g)); - return ret < 0 ? ret : AVERROR_INVALIDDATA; + return ret; } return 0; } diff --git a/chromium/third_party/ffmpeg/libavformat/rtpdec.c b/chromium/third_party/ffmpeg/libavformat/rtpdec.c index 6b0da9e6369..20fe2b82d7a 100644 --- a/chromium/third_party/ffmpeg/libavformat/rtpdec.c +++ b/chromium/third_party/ffmpeg/libavformat/rtpdec.c @@ -135,7 +135,16 @@ static const RTPDynamicProtocolHandler *const rtp_dynamic_protocol_handler_list[ NULL, }; -const RTPDynamicProtocolHandler *ff_rtp_handler_iterate(void **opaque) +/** + * Iterate over all registered rtp dynamic protocol handlers. + * + * @param opaque a pointer where libavformat will store the iteration state. + * Must point to NULL to start the iteration. + * + * @return the next registered rtp dynamic protocol handler + * or NULL when the iteration is finished + */ +static const RTPDynamicProtocolHandler *rtp_handler_iterate(void **opaque) { uintptr_t i = (uintptr_t)*opaque; const RTPDynamicProtocolHandler *r = rtp_dynamic_protocol_handler_list[i]; @@ -151,7 +160,7 @@ const RTPDynamicProtocolHandler *ff_rtp_handler_find_by_name(const char *name, { void *i = 0; const RTPDynamicProtocolHandler *handler; - while (handler = ff_rtp_handler_iterate(&i)) { + while (handler = rtp_handler_iterate(&i)) { if (handler->enc_name && !av_strcasecmp(name, handler->enc_name) && codec_type == handler->codec_type) @@ -165,7 +174,7 @@ const RTPDynamicProtocolHandler *ff_rtp_handler_find_by_id(int id, { void *i = 0; const RTPDynamicProtocolHandler *handler; - while (handler = ff_rtp_handler_iterate(&i)) { + while (handler = rtp_handler_iterate(&i)) { if (handler->static_payload_id && handler->static_payload_id == id && codec_type == handler->codec_type) return handler; diff --git a/chromium/third_party/ffmpeg/libavformat/rtpdec.h b/chromium/third_party/ffmpeg/libavformat/rtpdec.h index d54a05869fb..5a02e72dc2c 100644 --- a/chromium/third_party/ffmpeg/libavformat/rtpdec.h +++ b/chromium/third_party/ffmpeg/libavformat/rtpdec.h @@ -191,16 +191,6 @@ struct RTPDemuxContext { }; /** - * Iterate over all registered rtp dynamic protocol handlers. - * - * @param opaque a pointer where libavformat will store the iteration state. Must - * point to NULL to start the iteration. - * - * @return the next registered rtp dynamic protocol handler or NULL when the iteration is - * finished - */ -const RTPDynamicProtocolHandler *ff_rtp_handler_iterate(void **opaque); -/** * Find a registered rtp dynamic protocol handler with the specified name. * * @param name name of the requested rtp dynamic protocol handler diff --git a/chromium/third_party/ffmpeg/libavformat/rtpdec_asf.c b/chromium/third_party/ffmpeg/libavformat/rtpdec_asf.c index 3802a57407b..7812117228c 100644 --- a/chromium/third_party/ffmpeg/libavformat/rtpdec_asf.c +++ b/chromium/third_party/ffmpeg/libavformat/rtpdec_asf.c @@ -87,20 +87,20 @@ static int packetizer_read(void *opaque, uint8_t *buf, int buf_size) return AVERROR(EAGAIN); } -static void init_packetizer(AVIOContext *pb, uint8_t *buf, int len) +static void init_packetizer(FFIOContext *pb, uint8_t *buf, int len) { ffio_init_context(pb, buf, len, 0, NULL, packetizer_read, NULL, NULL); /* this "fills" the buffer with its current content */ - pb->pos = len; - pb->buf_end = buf + len; + pb->pub.pos = len; + pb->pub.buf_end = buf + len; } int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p) { int ret = 0; if (av_strstart(p, "pgmpu:data:application/vnd.ms.wms-hdr.asfv1;base64,", &p)) { - AVIOContext pb = { 0 }; + FFIOContext pb; RTSPState *rt = s->priv_data; AVDictionary *opts = NULL; int len = strlen(p) * 6 / 8; @@ -127,7 +127,7 @@ int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p) av_free(buf); return AVERROR(ENOMEM); } - rt->asf_ctx->pb = &pb; + rt->asf_ctx->pb = &pb.pub; av_dict_set(&opts, "no_resync_search", "1", 0); if ((ret = ff_copy_whiteblacklists(rt->asf_ctx, s)) < 0) { @@ -138,12 +138,12 @@ int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p) ret = avformat_open_input(&rt->asf_ctx, "", iformat, &opts); av_dict_free(&opts); if (ret < 0) { - av_free(pb.buffer); + av_free(pb.pub.buffer); return ret; } av_dict_copy(&s->metadata, rt->asf_ctx->metadata, 0); - rt->asf_pb_pos = avio_tell(&pb); - av_free(pb.buffer); + rt->asf_pb_pos = avio_tell(&pb.pub); + av_free(pb.pub.buffer); rt->asf_ctx->pb = NULL; } return ret; @@ -178,7 +178,8 @@ static int asfrtp_parse_sdp_line(AVFormatContext *s, int stream_index, } struct PayloadContext { - AVIOContext *pktbuf, pb; + FFIOContext pb; + AVIOContext *pktbuf; uint8_t *buf; }; @@ -193,7 +194,8 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, const uint8_t *buf, int len, uint16_t seq, int flags) { - AVIOContext *pb = &asf->pb; + FFIOContext *const pb0 = &asf->pb; + AVIOContext *const pb = &pb0->pub; int res, mflags, len_off; RTSPState *rt = s->priv_data; @@ -208,7 +210,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, av_freep(&asf->buf); - ffio_init_context(pb, (uint8_t *)buf, len, 0, NULL, NULL, NULL, NULL); + ffio_init_context(pb0, (uint8_t *)buf, len, 0, NULL, NULL, NULL, NULL); while (avio_tell(pb) + 4 < len) { int start_off = avio_tell(pb); @@ -267,7 +269,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, } } - init_packetizer(pb, asf->buf, out_len); + init_packetizer(pb0, asf->buf, out_len); pb->pos += rt->asf_pb_pos; pb->eof_reached = 0; rt->asf_ctx->pb = pb; diff --git a/chromium/third_party/ffmpeg/libavformat/rtpdec_qt.c b/chromium/third_party/ffmpeg/libavformat/rtpdec_qt.c index 492a1b67157..6723cd1bb0f 100644 --- a/chromium/third_party/ffmpeg/libavformat/rtpdec_qt.c +++ b/chromium/third_party/ffmpeg/libavformat/rtpdec_qt.c @@ -54,7 +54,8 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, uint32_t *timestamp, const uint8_t *buf, int len, uint16_t seq, int flags) { - AVIOContext pb; + FFIOContext pb0; + AVIOContext *const pb = &pb0.pub; GetBitContext gb; int packing_scheme, has_payload_desc, has_packet_info, alen, has_marker_bit = flags & RTP_FLAG_MARKER, @@ -82,7 +83,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, * http://developer.apple.com/quicktime/icefloe/dispatch026.html */ init_get_bits(&gb, buf, len << 3); - ffio_init_context(&pb, (uint8_t*)buf, len, 0, NULL, NULL, NULL, NULL); + ffio_init_context(&pb0, (uint8_t*)buf, len, 0, NULL, NULL, NULL, NULL); if (len < 4) return AVERROR_INVALIDDATA; @@ -114,22 +115,22 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, skip_bits(&gb, 12); // reserved data_len = get_bits(&gb, 16); - avio_seek(&pb, pos + 4, SEEK_SET); - tag = avio_rl32(&pb); + avio_seek(pb, pos + 4, SEEK_SET); + tag = avio_rl32(pb); if ((st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && tag != MKTAG('v','i','d','e')) || (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && tag != MKTAG('s','o','u','n'))) return AVERROR_INVALIDDATA; - avpriv_set_pts_info(st, 32, 1, avio_rb32(&pb)); + avpriv_set_pts_info(st, 32, 1, avio_rb32(pb)); if (pos + data_len > len) return AVERROR_INVALIDDATA; /* TLVs */ - while (avio_tell(&pb) + 4 < pos + data_len) { - int tlv_len = avio_rb16(&pb); - tag = avio_rl16(&pb); - if (avio_tell(&pb) + tlv_len > pos + data_len) + while (avio_tell(pb) + 4 < pos + data_len) { + int tlv_len = avio_rb16(pb); + tag = avio_rl16(pb); + if (avio_tell(pb) + tlv_len > pos + data_len) return AVERROR_INVALIDDATA; #define MKTAG16(a,b) MKTAG(a,b,0,0) @@ -151,7 +152,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, /* ff_mov_read_stsd_entries updates stream s->nb_streams-1, * so set it temporarily to indicate which stream to update. */ s->nb_streams = st->index + 1; - ff_mov_read_stsd_entries(mc, &pb, 1); + ff_mov_read_stsd_entries(mc, pb, 1); qt->bytes_per_frame = msc->bytes_per_frame; av_free(msc); av_free(mc); @@ -160,22 +161,22 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, break; } default: - avio_skip(&pb, tlv_len); + avio_skip(pb, tlv_len); break; } } /* 32-bit alignment */ - avio_skip(&pb, ((avio_tell(&pb) + 3) & ~3) - avio_tell(&pb)); + avio_skip(pb, ((avio_tell(pb) + 3) & ~3) - avio_tell(pb)); } else - avio_seek(&pb, 4, SEEK_SET); + avio_seek(pb, 4, SEEK_SET); if (has_packet_info) { avpriv_request_sample(s, "RTP-X-QT with packet-specific info"); return AVERROR_PATCHWELCOME; } - alen = len - avio_tell(&pb); + alen = len - avio_tell(pb); if (alen <= 0) return AVERROR_INVALIDDATA; @@ -197,7 +198,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, qt->pkt->size = 0; qt->timestamp = *timestamp; } - memcpy(qt->pkt->data + qt->pkt->size, buf + avio_tell(&pb), alen); + memcpy(qt->pkt->data + qt->pkt->size, buf + avio_tell(pb), alen); qt->pkt->size += alen; if (has_marker_bit) { int ret = av_packet_from_data(pkt, qt->pkt->data, qt->pkt->size); @@ -220,7 +221,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, qt->remaining = (alen / qt->bytes_per_frame) - 1; if ((ret = av_new_packet(pkt, qt->bytes_per_frame)) < 0) return ret; - memcpy(pkt->data, buf + avio_tell(&pb), qt->bytes_per_frame); + memcpy(pkt->data, buf + avio_tell(pb), qt->bytes_per_frame); pkt->flags = keyframe ? AV_PKT_FLAG_KEY : 0; pkt->stream_index = st->index; if (qt->remaining > 0) { @@ -232,7 +233,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, } qt->pkt->size = qt->remaining * qt->bytes_per_frame; memcpy(qt->pkt->data, - buf + avio_tell(&pb) + qt->bytes_per_frame, + buf + avio_tell(pb) + qt->bytes_per_frame, qt->remaining * qt->bytes_per_frame); qt->pkt->flags = pkt->flags; return 1; diff --git a/chromium/third_party/ffmpeg/libavformat/rtsp.c b/chromium/third_party/ffmpeg/libavformat/rtsp.c index 9869e1b72e3..3772a7f2a9c 100644 --- a/chromium/third_party/ffmpeg/libavformat/rtsp.c +++ b/chromium/third_party/ffmpeg/libavformat/rtsp.c @@ -2496,7 +2496,7 @@ static int rtp_read_header(AVFormatContext *s) int payload_type; AVCodecParameters *par = NULL; struct sockaddr_storage addr; - AVIOContext pb; + FFIOContext pb; socklen_t addrlen = sizeof(addr); RTSPState *rt = s->priv_data; const char *p; @@ -2594,7 +2594,7 @@ static int rtp_read_header(AVFormatContext *s) avcodec_parameters_free(&par); ffio_init_context(&pb, sdp.str, sdp.len, 0, NULL, NULL, NULL, NULL); - s->pb = &pb; + s->pb = &pb.pub; /* if sdp_read_header() fails then following ff_network_close() cancels out */ /* ff_network_init() at the start of this function. Otherwise it cancels out */ diff --git a/chromium/third_party/ffmpeg/libavformat/sapdec.c b/chromium/third_party/ffmpeg/libavformat/sapdec.c index a852b0782bb..fd0e662433f 100644 --- a/chromium/third_party/ffmpeg/libavformat/sapdec.c +++ b/chromium/third_party/ffmpeg/libavformat/sapdec.c @@ -35,7 +35,7 @@ struct SAPState { URLContext *ann_fd; AVFormatContext *sdp_ctx; - AVIOContext sdp_pb; + FFIOContext sdp_pb; uint16_t hash; char *sdp; int eof; @@ -160,7 +160,7 @@ static int sap_read_header(AVFormatContext *s) goto fail; } sap->sdp_ctx->max_delay = s->max_delay; - sap->sdp_ctx->pb = &sap->sdp_pb; + sap->sdp_ctx->pb = &sap->sdp_pb.pub; sap->sdp_ctx->interrupt_callback = s->interrupt_callback; if ((ret = ff_copy_whiteblacklists(sap->sdp_ctx, s)) < 0) diff --git a/chromium/third_party/ffmpeg/libavformat/sbgdec.c b/chromium/third_party/ffmpeg/libavformat/sbgdec.c index bd72db5f08b..21a918db44e 100644 --- a/chromium/third_party/ffmpeg/libavformat/sbgdec.c +++ b/chromium/third_party/ffmpeg/libavformat/sbgdec.c @@ -1292,6 +1292,10 @@ static int generate_intervals(void *log, struct sbg_script *s, int sample_rate, ev1 = &s->events[i]; ev2 = &s->events[(i + 1) % s->nb_events]; ev1->ts_int = ev1->ts; + + if (!ev1->fade.slide && ev1 >= ev2 && ev2->ts > INT64_MAX - period) + return AVERROR_INVALIDDATA; + ev1->ts_trans = ev1->fade.slide ? ev1->ts : ev2->ts + (ev1 < ev2 ? 0 : period); } diff --git a/chromium/third_party/ffmpeg/libavformat/segment.c b/chromium/third_party/ffmpeg/libavformat/segment.c index ed671353d05..7c171b6fa4e 100644 --- a/chromium/third_party/ffmpeg/libavformat/segment.c +++ b/chromium/third_party/ffmpeg/libavformat/segment.c @@ -952,7 +952,9 @@ calc_times: seg->initial_offset || seg->reset_timestamps || seg->avf->oformat->interleave_packet); fail: - if (pkt->stream_index == seg->reference_stream_index) { + /* Use st->index here as the packet returned from ff_write_chained() + * is blank if interleaving has been used. */ + if (st->index == seg->reference_stream_index) { seg->frame_count++; seg->segment_frame_count++; } diff --git a/chromium/third_party/ffmpeg/libavformat/subtitles.c b/chromium/third_party/ffmpeg/libavformat/subtitles.c index f80a439bccd..c6701c6a60c 100644 --- a/chromium/third_party/ffmpeg/libavformat/subtitles.c +++ b/chromium/third_party/ffmpeg/libavformat/subtitles.c @@ -51,9 +51,8 @@ void ff_text_init_avio(void *s, FFTextReader *r, AVIOContext *pb) void ff_text_init_buf(FFTextReader *r, void *buf, size_t size) { - memset(&r->buf_pb, 0, sizeof(r->buf_pb)); ffio_init_context(&r->buf_pb, buf, size, 0, NULL, NULL, NULL, NULL); - ff_text_init_avio(NULL, r, &r->buf_pb); + ff_text_init_avio(NULL, r, &r->buf_pb.pub); } int64_t ff_text_pos(FFTextReader *r) diff --git a/chromium/third_party/ffmpeg/libavformat/subtitles.h b/chromium/third_party/ffmpeg/libavformat/subtitles.h index 37ca7b19b1e..4460efacf33 100644 --- a/chromium/third_party/ffmpeg/libavformat/subtitles.h +++ b/chromium/third_party/ffmpeg/libavformat/subtitles.h @@ -25,6 +25,7 @@ #include <stddef.h> #include "avformat.h" #include "libavutil/bprint.h" +#include "avio_internal.h" enum sub_sort { SUB_SORT_TS_POS = 0, ///< sort by timestamps, then position @@ -42,7 +43,7 @@ typedef struct { AVIOContext *pb; unsigned char buf[8]; int buf_pos, buf_len; - AVIOContext buf_pb; + FFIOContext buf_pb; } FFTextReader; /** diff --git a/chromium/third_party/ffmpeg/libavformat/thp.c b/chromium/third_party/ffmpeg/libavformat/thp.c index 7aad24221b1..7103cf4f8af 100644 --- a/chromium/third_party/ffmpeg/libavformat/thp.c +++ b/chromium/third_party/ffmpeg/libavformat/thp.c @@ -22,6 +22,7 @@ #include "libavutil/intreadwrite.h" #include "libavutil/intfloat.h" #include "avformat.h" +#include "avio_internal.h" #include "internal.h" typedef struct ThpDemuxContext { @@ -65,6 +66,7 @@ static int thp_read_header(AVFormatContext *s) AVStream *st; AVIOContext *pb = s->pb; int64_t fsize= avio_size(pb); + uint32_t maxsize; int i; /* Read the file header. */ @@ -79,9 +81,10 @@ static int thp_read_header(AVFormatContext *s) return AVERROR_INVALIDDATA; thp->framecnt = avio_rb32(pb); thp->first_framesz = avio_rb32(pb); - pb->maxsize = avio_rb32(pb); - if(fsize>0 && (!pb->maxsize || fsize < pb->maxsize)) - pb->maxsize= fsize; + maxsize = avio_rb32(pb); + if (fsize > 0 && (!maxsize || fsize < maxsize)) + maxsize = fsize; + ffiocontext(pb)->maxsize = fsize; thp->compoff = avio_rb32(pb); avio_rb32(pb); /* offsetDataOffset. */ diff --git a/chromium/third_party/ffmpeg/libavformat/ttmlenc.c b/chromium/third_party/ffmpeg/libavformat/ttmlenc.c index 8546d35196a..896fc819585 100644 --- a/chromium/third_party/ffmpeg/libavformat/ttmlenc.c +++ b/chromium/third_party/ffmpeg/libavformat/ttmlenc.c @@ -30,6 +30,7 @@ #include "libavutil/avstring.h" #include "avformat.h" #include "internal.h" +#include "ttmlenc.h" #include "libavcodec/ttmlenc.h" #include "libavutil/internal.h" @@ -138,13 +139,7 @@ static int ttml_write_header(AVFormatContext *ctx) 0); const char *printed_lang = (lang && lang->value) ? lang->value : ""; - // Not perfect, but decide whether the packet is a document or not - // by the existence of the lavc ttmlenc extradata. - ttml_ctx->input_type = (st->codecpar->extradata && - st->codecpar->extradata_size >= TTMLENC_EXTRADATA_SIGNATURE_SIZE && - !memcmp(st->codecpar->extradata, - TTMLENC_EXTRADATA_SIGNATURE, - TTMLENC_EXTRADATA_SIGNATURE_SIZE)) ? + ttml_ctx->input_type = ff_is_ttml_stream_paragraph_based(st->codecpar) ? PACKET_TYPE_PARAGRAPH : PACKET_TYPE_DOCUMENT; diff --git a/chromium/third_party/ffmpeg/libavformat/ttmlenc.h b/chromium/third_party/ffmpeg/libavformat/ttmlenc.h new file mode 100644 index 00000000000..5a6954f3c1e --- /dev/null +++ b/chromium/third_party/ffmpeg/libavformat/ttmlenc.h @@ -0,0 +1,39 @@ +/* + * Generic TTML helpers + * Copyright (c) 2021 24i + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFORMAT_TTMLENC_H +#define AVFORMAT_TTMLENC_H + +#include "libavcodec/codec_par.h" +#include "libavcodec/ttmlenc.h" + +static inline unsigned int ff_is_ttml_stream_paragraph_based(const AVCodecParameters *codecpar) +{ + // Not perfect, but decide whether the packet is a document or not + // by the existence of the lavc ttmlenc extradata. + return (codecpar->extradata && + codecpar->extradata_size >= TTMLENC_EXTRADATA_SIGNATURE_SIZE && + !memcmp(codecpar->extradata, + TTMLENC_EXTRADATA_SIGNATURE, + TTMLENC_EXTRADATA_SIGNATURE_SIZE)); +} + +#endif /* AVFORMAT_TTMLENC_H */ diff --git a/chromium/third_party/ffmpeg/libavformat/utils.c b/chromium/third_party/ffmpeg/libavformat/utils.c index 1f3629c1083..3df5aeaea67 100644 --- a/chromium/third_party/ffmpeg/libavformat/utils.c +++ b/chromium/third_party/ffmpeg/libavformat/utils.c @@ -220,31 +220,6 @@ static const AVCodec *find_probe_decoder(AVFormatContext *s, const AVStream *st, /* an arbitrarily chosen "sane" max packet size -- 50M */ #define SANE_CHUNK_SIZE (50000000) -int ffio_limit(AVIOContext *s, int size) -{ - if (s->maxsize>= 0) { - int64_t pos = avio_tell(s); - int64_t remaining= s->maxsize - pos; - if (remaining < size) { - int64_t newsize = avio_size(s); - if (!s->maxsize || s->maxsize<newsize) - s->maxsize = newsize - !newsize; - if (pos > s->maxsize && s->maxsize >= 0) - s->maxsize = AVERROR(EIO); - if (s->maxsize >= 0) - remaining = s->maxsize - pos; - } - - if (s->maxsize >= 0 && remaining < size && size > 1) { - av_log(NULL, remaining ? AV_LOG_ERROR : AV_LOG_DEBUG, - "Truncating packet of size %d to %"PRId64"\n", - size, remaining + !remaining); - size = remaining + !remaining; - } - } - return size; -} - /* Read the data in sane-sized chunks and append to pkt. * Return the number of bytes read or an error. */ static int append_packet_chunked(AVIOContext *s, AVPacket *pkt, int size) @@ -262,7 +237,7 @@ static int append_packet_chunked(AVIOContext *s, AVPacket *pkt, int size) if (read_size > SANE_CHUNK_SIZE/10) { read_size = ffio_limit(s, read_size); // If filesize/maxsize is unknown, limit to SANE_CHUNK_SIZE - if (s->maxsize < 0) + if (ffiocontext(s)->maxsize < 0) read_size = FFMIN(read_size, SANE_CHUNK_SIZE); } @@ -905,18 +880,18 @@ static int determinable_frame_size(AVCodecContext *avctx) /** * Return the frame duration in seconds. Return 0 if not available. */ -void ff_compute_frame_duration(AVFormatContext *s, int *pnum, int *pden, AVStream *st, - AVCodecParserContext *pc, AVPacket *pkt) +static void compute_frame_duration(AVFormatContext *s, int *pnum, int *pden, + AVStream *st, AVCodecParserContext *pc, + AVPacket *pkt) { - AVRational codec_framerate = s->iformat ? st->internal->avctx->framerate : - av_mul_q(av_inv_q(st->internal->avctx->time_base), (AVRational){1, st->internal->avctx->ticks_per_frame}); + AVRational codec_framerate = st->internal->avctx->framerate; int frame_size, sample_rate; *pnum = 0; *pden = 0; switch (st->codecpar->codec_type) { case AVMEDIA_TYPE_VIDEO: - if (st->r_frame_rate.num && !pc && s->iformat) { + if (st->r_frame_rate.num && !pc) { *pnum = st->r_frame_rate.den; *pden = st->r_frame_rate.num; } else if (st->time_base.num * 1000LL > st->time_base.den) { @@ -930,7 +905,6 @@ void ff_compute_frame_duration(AVFormatContext *s, int *pnum, int *pden, AVStrea INT_MAX); if (pc && pc->repeat_pict) { - av_assert0(s->iformat); // this may be wrong for interlaced encoding but its not used for that case av_reduce(pnum, pden, (*pnum) * (1LL + pc->repeat_pict), (*pden), @@ -1257,7 +1231,7 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st, duration = av_mul_q((AVRational) {pkt->duration, 1}, st->time_base); if (pkt->duration <= 0) { - ff_compute_frame_duration(s, &num, &den, st, pc, pkt); + compute_frame_duration(s, &num, &den, st, pc, pkt); if (den && num) { duration = (AVRational) {num, den}; pkt->duration = av_rescale_rnd(1, @@ -1774,8 +1748,6 @@ return_packet: /* XXX: suppress the packet queue */ static void flush_packet_queue(AVFormatContext *s) { - if (!s->internal) - return; avpriv_packet_list_free(&s->internal->parse_queue, &s->internal->parse_queue_end); avpriv_packet_list_free(&s->internal->packet_buffer, &s->internal->packet_buffer_end); avpriv_packet_list_free(&s->internal->raw_packet_buffer, &s->internal->raw_packet_buffer_end); @@ -2004,6 +1976,7 @@ void ff_configure_buffers_for_index(AVFormatContext *s, int64_t time_tolerance) int64_t skip = 0; //We could use URLProtocol flags here but as many user applications do not use URLProtocols this would be unreliable const char *proto = avio_find_protocol_name(s->url); + FFIOContext *ctx; av_assert0(time_tolerance >= 0); @@ -2044,6 +2017,7 @@ void ff_configure_buffers_for_index(AVFormatContext *s, int64_t time_tolerance) } pos_delta *= 2; + ctx = ffiocontext(s->pb); /* XXX This could be adjusted depending on protocol*/ if (s->pb->buffer_size < pos_delta && pos_delta < (1<<24)) { av_log(s, AV_LOG_VERBOSE, "Reconfiguring buffers to size %"PRId64"\n", pos_delta); @@ -2054,11 +2028,11 @@ void ff_configure_buffers_for_index(AVFormatContext *s, int64_t time_tolerance) return; } - s->pb->short_seek_threshold = FFMAX(s->pb->short_seek_threshold, pos_delta/2); + ctx->short_seek_threshold = FFMAX(ctx->short_seek_threshold, pos_delta/2); } if (skip < (1<<23)) { - s->pb->short_seek_threshold = FFMAX(s->pb->short_seek_threshold, skip); + ctx->short_seek_threshold = FFMAX(ctx->short_seek_threshold, skip); } } @@ -2361,10 +2335,12 @@ static int seek_frame_generic(AVFormatContext *s, int stream_index, ie = &st->internal->index_entries[st->internal->nb_index_entries - 1]; if ((ret = avio_seek(s->pb, ie->pos, SEEK_SET)) < 0) return ret; + s->io_repositioned = 1; avpriv_update_cur_dts(s, st, ie->timestamp); } else { if ((ret = avio_seek(s->pb, s->internal->data_offset, SEEK_SET)) < 0) return ret; + s->io_repositioned = 1; } av_packet_unref(pkt); for (;;) { @@ -2399,6 +2375,7 @@ static int seek_frame_generic(AVFormatContext *s, int stream_index, ie = &st->internal->index_entries[index]; if ((ret = avio_seek(s->pb, ie->pos, SEEK_SET)) < 0) return ret; + s->io_repositioned = 1; avpriv_update_cur_dts(s, st, ie->timestamp); return 0; @@ -2790,7 +2767,7 @@ static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset) (st->start_time != AV_NOPTS_VALUE || st->internal->first_dts != AV_NOPTS_VALUE)) { if (pkt->duration == 0) { - ff_compute_frame_duration(ic, &num, &den, st, st->internal->parser, pkt); + compute_frame_duration(ic, &num, &den, st, st->internal->parser, pkt); if (den && num) { pkt->duration = av_rescale_rnd(1, num * (int64_t) st->time_base.den, @@ -3190,24 +3167,25 @@ static int chapter_start_cmp(const void *p1, const void *p2) int delta = av_compare_ts(ch1->start, ch1->time_base, ch2->start, ch2->time_base); if (delta) return delta; - return (ch1 > ch2) - (ch1 < ch2); + return FFDIFFSIGN(ch1->id, ch2->id); } static int compute_chapters_end(AVFormatContext *s) { unsigned int i; int64_t max_time = 0; - AVChapter **timetable = av_malloc(s->nb_chapters * sizeof(*timetable)); + AVChapter **timetable; - if (!timetable) - return AVERROR(ENOMEM); + if (!s->nb_chapters) + return 0; if (s->duration > 0 && s->start_time < INT64_MAX - s->duration) max_time = s->duration + ((s->start_time == AV_NOPTS_VALUE) ? 0 : s->start_time); - for (i = 0; i < s->nb_chapters; i++) - timetable[i] = s->chapters[i]; + timetable = av_memdup(s->chapters, s->nb_chapters * sizeof(*timetable)); + if (!timetable) + return AVERROR(ENOMEM); qsort(timetable, s->nb_chapters, sizeof(*timetable), chapter_start_cmp); for (i = 0; i < s->nb_chapters; i++) @@ -3292,12 +3270,12 @@ int ff_get_extradata(AVFormatContext *s, AVCodecParameters *par, AVIOContext *pb int ret = ff_alloc_extradata(par, size); if (ret < 0) return ret; - ret = avio_read(pb, par->extradata, size); - if (ret != size) { + ret = ffio_read_size(pb, par->extradata, size); + if (ret < 0) { av_freep(&par->extradata); par->extradata_size = 0; av_log(s, AV_LOG_ERROR, "Failed to read extradata of size %d\n", size); - return ret < 0 ? ret : AVERROR_INVALIDDATA; + return ret; } return ret; @@ -3585,9 +3563,11 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) max_stream_analyze_duration = 7*AV_TIME_BASE; } - if (ic->pb) + if (ic->pb) { + FFIOContext *const ctx = ffiocontext(ic->pb); av_log(ic, AV_LOG_DEBUG, "Before avformat_find_stream_info() pos: %"PRId64" bytes read:%"PRId64" seeks:%d nb_streams:%d\n", - avio_tell(ic->pb), ic->pb->bytes_read, ic->pb->seek_count, ic->nb_streams); + avio_tell(ic->pb), ctx->bytes_read, ctx->seek_count, ic->nb_streams); + } for (i = 0; i < ic->nb_streams; i++) { const AVCodec *codec; @@ -3652,14 +3632,6 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) av_dict_free(&thread_opt); } - for (i = 0; i < ic->nb_streams; i++) { -#if FF_API_R_FRAME_RATE - ic->streams[i]->internal->info->last_dts = AV_NOPTS_VALUE; -#endif - ic->streams[i]->internal->info->fps_first_dts = AV_NOPTS_VALUE; - ic->streams[i]->internal->info->fps_last_dts = AV_NOPTS_VALUE; - } - read_size = 0; for (;;) { const AVPacket *pkt; @@ -4098,9 +4070,11 @@ find_stream_info_err: av_freep(&ic->streams[i]->internal->info); av_bsf_free(&ic->streams[i]->internal->extract_extradata.bsf); } - if (ic->pb) + if (ic->pb) { + FFIOContext *const ctx = ffiocontext(ic->pb); av_log(ic, AV_LOG_DEBUG, "After avformat_find_stream_info() pos: %"PRId64" bytes read:%"PRId64" seeks:%d frames:%d\n", - avio_tell(ic->pb), ic->pb->bytes_read, ic->pb->seek_count, count); + avio_tell(ic->pb), ctx->bytes_read, ctx->seek_count, count); + } return ret; unref_then_goto_end: @@ -4366,8 +4340,6 @@ void avformat_close_input(AVFormatContext **ps) (s->flags & AVFMT_FLAG_CUSTOM_IO)) pb = NULL; - flush_packet_queue(s); - if (s->iformat) if (s->iformat->read_close) s->iformat->read_close(s); @@ -4404,11 +4376,6 @@ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c) if (!st->internal) goto fail; - st->internal->info = av_mallocz(sizeof(*st->internal->info)); - if (!st->internal->info) - goto fail; - st->internal->info->last_dts = AV_NOPTS_VALUE; - st->codecpar = avcodec_parameters_alloc(); if (!st->codecpar) goto fail; @@ -4418,6 +4385,16 @@ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c) goto fail; if (s->iformat) { + st->internal->info = av_mallocz(sizeof(*st->internal->info)); + if (!st->internal->info) + goto fail; + +#if FF_API_R_FRAME_RATE + st->internal->info->last_dts = AV_NOPTS_VALUE; +#endif + st->internal->info->fps_first_dts = AV_NOPTS_VALUE; + st->internal->info->fps_last_dts = AV_NOPTS_VALUE; + /* default pts setting is MPEG-like */ avpriv_set_pts_info(st, 33, 1, 90000); /* we set the current DTS to 0 so that formats without any timestamps @@ -4444,12 +4421,6 @@ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c) st->sample_aspect_ratio = (AVRational) { 0, 1 }; -#if FF_API_R_FRAME_RATE - st->internal->info->last_dts = AV_NOPTS_VALUE; -#endif - st->internal->info->fps_first_dts = AV_NOPTS_VALUE; - st->internal->info->fps_last_dts = AV_NOPTS_VALUE; - st->internal->inject_global_side_data = s->internal->inject_global_side_data; st->internal->need_context_update = 1; @@ -5547,12 +5518,8 @@ int avformat_transfer_internal_stream_timing_info(const AVOutputFormat *ofmt, AVStream *ost, const AVStream *ist, enum AVTimebaseSource copy_tb) { - //TODO: use [io]st->internal->avctx - const AVCodecContext *dec_ctx; - AVCodecContext *enc_ctx; - - dec_ctx = ist->internal->avctx; - enc_ctx = ost->internal->avctx; + const AVCodecContext *const dec_ctx = ist->internal->avctx; + AVCodecContext *const enc_ctx = ost->internal->avctx; enc_ctx->time_base = ist->time_base; /* diff --git a/chromium/third_party/ffmpeg/libavformat/version.h b/chromium/third_party/ffmpeg/libavformat/version.h index 03eb20ad820..13df244d97c 100644 --- a/chromium/third_party/ffmpeg/libavformat/version.h +++ b/chromium/third_party/ffmpeg/libavformat/version.h @@ -32,8 +32,8 @@ // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium) // Also please add any ticket numbers that you believe might be affected here #define LIBAVFORMAT_VERSION_MAJOR 59 -#define LIBAVFORMAT_VERSION_MINOR 4 -#define LIBAVFORMAT_VERSION_MICRO 101 +#define LIBAVFORMAT_VERSION_MINOR 5 +#define LIBAVFORMAT_VERSION_MICRO 100 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ LIBAVFORMAT_VERSION_MINOR, \ diff --git a/chromium/third_party/ffmpeg/libavformat/vividas.c b/chromium/third_party/ffmpeg/libavformat/vividas.c index 8d1c1dab295..d7a6e746507 100644 --- a/chromium/third_party/ffmpeg/libavformat/vividas.c +++ b/chromium/third_party/ffmpeg/libavformat/vividas.c @@ -283,9 +283,10 @@ static int track_header(VividasDemuxContext *viv, AVFormatContext *s, uint8_t * int64_t off; int val_1; int num_video; - AVIOContext pb0, *pb = &pb0; + FFIOContext pb0; + AVIOContext *const pb = &pb0.pub; - ffio_init_context(pb, buf, size, 0, NULL, NULL, NULL, NULL); + ffio_init_context(&pb0, buf, size, 0, NULL, NULL, NULL, NULL); ffio_read_varlen(pb); // track_header_len avio_r8(pb); // '1' @@ -436,12 +437,13 @@ static int track_index(VividasDemuxContext *viv, AVFormatContext *s, uint8_t *bu int64_t off; int64_t poff; int maxnp=0; - AVIOContext pb0, *pb = &pb0; + FFIOContext pb0; + AVIOContext *const pb = &pb0.pub; int i; int64_t filesize = avio_size(s->pb); uint64_t n_sb_blocks_tmp; - ffio_init_context(pb, buf, size, 0, NULL, NULL, NULL, NULL); + ffio_init_context(&pb0, buf, size, 0, NULL, NULL, NULL, NULL); ffio_read_varlen(pb); // track_index_len avio_r8(pb); // 'c' diff --git a/chromium/third_party/ffmpeg/libavformat/vorbiscomment.c b/chromium/third_party/ffmpeg/libavformat/vorbiscomment.c index a929634cc04..13ee065a446 100644 --- a/chromium/third_party/ffmpeg/libavformat/vorbiscomment.c +++ b/chromium/third_party/ffmpeg/libavformat/vorbiscomment.c @@ -66,9 +66,10 @@ int ff_vorbiscomment_write(AVIOContext *pb, const AVDictionary *m, const char *vendor_string, AVChapter **chapters, unsigned int nb_chapters) { + size_t vendor_string_length = strlen(vendor_string); int cm_count = 0; - avio_wl32(pb, strlen(vendor_string)); - avio_write(pb, vendor_string, strlen(vendor_string)); + avio_wl32(pb, vendor_string_length); + avio_write(pb, vendor_string, vendor_string_length); if (chapters && nb_chapters) { for (int i = 0; i < nb_chapters; i++) { cm_count += av_dict_count(chapters[i]->metadata) + 1; diff --git a/chromium/third_party/ffmpeg/libavformat/wavdec.c b/chromium/third_party/ffmpeg/libavformat/wavdec.c index c2f773caef5..b8c38a14fe9 100644 --- a/chromium/third_party/ffmpeg/libavformat/wavdec.c +++ b/chromium/third_party/ffmpeg/libavformat/wavdec.c @@ -243,8 +243,8 @@ static inline int wav_parse_bext_string(AVFormatContext *s, const char *key, int ret; av_assert0(length < sizeof(temp)); - if ((ret = avio_read(s->pb, temp, length)) != length) - return ret < 0 ? ret : AVERROR_INVALIDDATA; + if ((ret = ffio_read_size(s->pb, temp, length)) < 0) + return ret; temp[length] = 0; @@ -313,9 +313,9 @@ static int wav_parse_bext_tag(AVFormatContext *s, int64_t size) if (!(coding_history = av_malloc(size + 1))) return AVERROR(ENOMEM); - if ((ret = avio_read(s->pb, coding_history, size)) != size) { + if ((ret = ffio_read_size(s->pb, coding_history, size)) < 0) { av_free(coding_history); - return ret < 0 ? ret : AVERROR_INVALIDDATA; + return ret; } coding_history[size] = 0; @@ -722,7 +722,7 @@ smv_retry: if (wav->smv_last_stream) { uint64_t old_pos = avio_tell(s->pb); uint64_t new_pos = wav->smv_data_ofs + - wav->smv_block * wav->smv_block_size; + wav->smv_block * (int64_t)wav->smv_block_size; if (avio_seek(s->pb, new_pos, SEEK_SET) < 0) { ret = AVERROR_EOF; goto smv_out; diff --git a/chromium/third_party/ffmpeg/libavformat/wtvdec.c b/chromium/third_party/ffmpeg/libavformat/wtvdec.c index a5496813228..191da2718b7 100644 --- a/chromium/third_party/ffmpeg/libavformat/wtvdec.c +++ b/chromium/third_party/ffmpeg/libavformat/wtvdec.c @@ -652,6 +652,8 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid, avio_skip(pb, size - 32); ff_get_guid(pb, &actual_subtype); ff_get_guid(pb, &actual_formattype); + if (avio_feof(pb)) + return NULL; avio_seek(pb, -size, SEEK_CUR); st = parse_media_type(s, st, sid, mediatype, actual_subtype, actual_formattype, size - 32); diff --git a/chromium/third_party/ffmpeg/libavformat/yuv4mpegdec.c b/chromium/third_party/ffmpeg/libavformat/yuv4mpegdec.c index c327aa9d3f4..69dd8a3165a 100644 --- a/chromium/third_party/ffmpeg/libavformat/yuv4mpegdec.c +++ b/chromium/third_party/ffmpeg/libavformat/yuv4mpegdec.c @@ -44,6 +44,7 @@ static int yuv4_read_header(AVFormatContext *s) enum AVFieldOrder field_order = AV_FIELD_UNKNOWN; enum AVColorRange color_range = AVCOL_RANGE_UNSPECIFIED; AVStream *st; + int64_t data_offset; for (i = 0; i < MAX_YUV4_HEADER; i++) { header[i] = avio_r8(pb); @@ -254,9 +255,9 @@ static int yuv4_read_header(AVFormatContext *s) s->packet_size = av_image_get_buffer_size(st->codecpar->format, width, height, 1) + Y4M_FRAME_MAGIC_LEN; if ((int) s->packet_size < 0) return s->packet_size; - s->internal->data_offset = avio_tell(pb); + s->internal->data_offset = data_offset = avio_tell(pb); - st->duration = (avio_size(pb) - avio_tell(pb)) / s->packet_size; + st->duration = (avio_size(pb) - data_offset) / s->packet_size; return 0; } diff --git a/chromium/third_party/ffmpeg/libavformat/yuv4mpegenc.c b/chromium/third_party/ffmpeg/libavformat/yuv4mpegenc.c index efa05133d53..fca0ee31207 100644 --- a/chromium/third_party/ffmpeg/libavformat/yuv4mpegenc.c +++ b/chromium/third_party/ffmpeg/libavformat/yuv4mpegenc.c @@ -181,9 +181,8 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt) AVStream *st = s->streams[pkt->stream_index]; AVIOContext *pb = s->pb; const AVFrame *frame = (const AVFrame *)pkt->data; - int width, height, h_chroma_shift, v_chroma_shift; - int i; - const uint8_t *ptr, *ptr1, *ptr2; + int width, height; + const AVPixFmtDescriptor *desc; /* construct frame header */ @@ -191,79 +190,21 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt) width = st->codecpar->width; height = st->codecpar->height; + desc = av_pix_fmt_desc_get(st->codecpar->format); - ptr = frame->data[0]; + /* The following code presumes all planes to be non-interleaved. */ + for (int k = 0; k < desc->nb_components; k++) { + int plane_height = height, plane_width = width * desc->comp[k].step; + const uint8_t *ptr = frame->data[k]; - switch (st->codecpar->format) { - case AV_PIX_FMT_GRAY8: - case AV_PIX_FMT_YUV411P: - case AV_PIX_FMT_YUV420P: - case AV_PIX_FMT_YUV422P: - case AV_PIX_FMT_YUV444P: - case AV_PIX_FMT_YUVA444P: - // TODO: remove YUVJ pixel formats when they are completely removed from the codebase. - case AV_PIX_FMT_YUVJ420P: - case AV_PIX_FMT_YUVJ422P: - case AV_PIX_FMT_YUVJ444P: - break; - case AV_PIX_FMT_GRAY9: - case AV_PIX_FMT_GRAY10: - case AV_PIX_FMT_GRAY12: - case AV_PIX_FMT_GRAY16: - case AV_PIX_FMT_YUV420P9: - case AV_PIX_FMT_YUV422P9: - case AV_PIX_FMT_YUV444P9: - case AV_PIX_FMT_YUV420P10: - case AV_PIX_FMT_YUV422P10: - case AV_PIX_FMT_YUV444P10: - case AV_PIX_FMT_YUV420P12: - case AV_PIX_FMT_YUV422P12: - case AV_PIX_FMT_YUV444P12: - case AV_PIX_FMT_YUV420P14: - case AV_PIX_FMT_YUV422P14: - case AV_PIX_FMT_YUV444P14: - case AV_PIX_FMT_YUV420P16: - case AV_PIX_FMT_YUV422P16: - case AV_PIX_FMT_YUV444P16: - width *= 2; - break; - default: - av_log(s, AV_LOG_ERROR, "The pixel format '%s' is not supported.\n", - av_get_pix_fmt_name(st->codecpar->format)); - return AVERROR(EINVAL); - } - - for (i = 0; i < height; i++) { - avio_write(pb, ptr, width); - ptr += frame->linesize[0]; - } - - if (st->codecpar->format != AV_PIX_FMT_GRAY8 && st->codecpar->format != AV_PIX_FMT_GRAY9 && - st->codecpar->format != AV_PIX_FMT_GRAY10 && st->codecpar->format != AV_PIX_FMT_GRAY12 && - st->codecpar->format != AV_PIX_FMT_GRAY16) { - // Adjust for smaller Cb and Cr planes - av_pix_fmt_get_chroma_sub_sample(st->codecpar->format, &h_chroma_shift, - &v_chroma_shift); - // Shift right, rounding up - width = AV_CEIL_RSHIFT(width, h_chroma_shift); - height = AV_CEIL_RSHIFT(height, v_chroma_shift); - - ptr1 = frame->data[1]; - ptr2 = frame->data[2]; - for (i = 0; i < height; i++) { /* Cb */ - avio_write(pb, ptr1, width); - ptr1 += frame->linesize[1]; + if (desc->nb_components >= 3 && (k == 1 || k == 2)) { /* chroma? */ + plane_width = AV_CEIL_RSHIFT(plane_width, desc->log2_chroma_w); + plane_height = AV_CEIL_RSHIFT(plane_height, desc->log2_chroma_h); } - for (i = 0; i < height; i++) { /* Cr */ - avio_write(pb, ptr2, width); - ptr2 += frame->linesize[2]; - } - if (st->codecpar->format == AV_PIX_FMT_YUVA444P) { - ptr = frame->data[3]; - for (i = 0; i < height; i++) { /* A */ - avio_write(pb, ptr, width); - ptr += frame->linesize[3]; - } + + for (int i = 0; i < plane_height; i++) { + avio_write(pb, ptr, plane_width); + ptr += frame->linesize[k]; } } diff --git a/chromium/third_party/ffmpeg/libavutil/Makefile b/chromium/third_party/ffmpeg/libavutil/Makefile index 18dc5f22d9b..410ac636f72 100644 --- a/chromium/third_party/ffmpeg/libavutil/Makefile +++ b/chromium/third_party/ffmpeg/libavutil/Makefile @@ -262,6 +262,6 @@ TESTPROGS-$(HAVE_LZO1X_999_COMPRESS) += lzo TOOLS = crypto_bench ffhash ffeval ffescape tools/crypto_bench$(EXESUF): ELIBS += $(if $(VERSUS),$(subst +, -l,+$(VERSUS)),) -tools/crypto_bench$(EXESUF): CFLAGS += -DUSE_EXT_LIBS=0$(if $(VERSUS),$(subst +,+USE_,+$(VERSUS)),) +tools/crypto_bench.o: CFLAGS += -DUSE_EXT_LIBS=0$(if $(VERSUS),$(subst +,+USE_,+$(VERSUS)),) $(SUBDIR)tests/lzo$(EXESUF): ELIBS = -llzo2 diff --git a/chromium/third_party/ffmpeg/libavcodec/autorename_libavcodec_utils.c b/chromium/third_party/ffmpeg/libavutil/autorename_libavutil_utils.c index e6429512e9d..e6429512e9d 100644 --- a/chromium/third_party/ffmpeg/libavcodec/autorename_libavcodec_utils.c +++ b/chromium/third_party/ffmpeg/libavutil/autorename_libavutil_utils.c diff --git a/chromium/third_party/ffmpeg/libavutil/film_grain_params.h b/chromium/third_party/ffmpeg/libavutil/film_grain_params.h index 7350dfc5b84..f3bd0a4a6a3 100644 --- a/chromium/third_party/ffmpeg/libavutil/film_grain_params.h +++ b/chromium/third_party/ffmpeg/libavutil/film_grain_params.h @@ -221,6 +221,9 @@ typedef struct AVFilmGrainParams { /** * Seed to use for the synthesis process, if the codec allows for it. + * + * @note For H.264, this refers to `pic_offset` as defined in + * SMPTE RDD 5-2006. */ uint64_t seed; diff --git a/chromium/third_party/ffmpeg/libavutil/hwcontext_d3d11va.c b/chromium/third_party/ffmpeg/libavutil/hwcontext_d3d11va.c index 27274ee3fa1..272a19da47e 100644 --- a/chromium/third_party/ffmpeg/libavutil/hwcontext_d3d11va.c +++ b/chromium/third_party/ffmpeg/libavutil/hwcontext_d3d11va.c @@ -72,6 +72,7 @@ static av_cold void load_functions(void) } typedef struct D3D11VAFramesContext { + int nb_surfaces; int nb_surfaces_used; DXGI_FORMAT format; @@ -112,6 +113,8 @@ static void d3d11va_frames_uninit(AVHWFramesContext *ctx) if (s->staging_texture) ID3D11Texture2D_Release(s->staging_texture); s->staging_texture = NULL; + + av_freep(&frames_hwctx->texture_infos); } static int d3d11va_frames_get_constraints(AVHWDeviceContext *ctx, @@ -152,15 +155,21 @@ static void free_texture(void *opaque, uint8_t *data) av_free(data); } -static AVBufferRef *wrap_texture_buf(ID3D11Texture2D *tex, int index) +static AVBufferRef *wrap_texture_buf(AVHWFramesContext *ctx, ID3D11Texture2D *tex, int index) { AVBufferRef *buf; - AVD3D11FrameDescriptor *desc = av_mallocz(sizeof(*desc)); + AVD3D11FrameDescriptor *desc = av_mallocz(sizeof(*desc)); + D3D11VAFramesContext *s = ctx->internal->priv; + AVD3D11VAFramesContext *frames_hwctx = ctx->hwctx; if (!desc) { ID3D11Texture2D_Release(tex); return NULL; } + frames_hwctx->texture_infos[s->nb_surfaces_used].texture = tex; + frames_hwctx->texture_infos[s->nb_surfaces_used].index = index; + s->nb_surfaces_used++; + desc->texture = tex; desc->index = index; @@ -199,7 +208,7 @@ static AVBufferRef *d3d11va_alloc_single(AVHWFramesContext *ctx) return NULL; } - return wrap_texture_buf(tex, 0); + return wrap_texture_buf(ctx, tex, 0); } static AVBufferRef *d3d11va_pool_alloc(void *opaque, size_t size) @@ -220,7 +229,7 @@ static AVBufferRef *d3d11va_pool_alloc(void *opaque, size_t size) } ID3D11Texture2D_AddRef(hwctx->texture); - return wrap_texture_buf(hwctx->texture, s->nb_surfaces_used++); + return wrap_texture_buf(ctx, hwctx->texture, s->nb_surfaces_used); } static int d3d11va_frames_init(AVHWFramesContext *ctx) @@ -267,7 +276,7 @@ static int d3d11va_frames_init(AVHWFramesContext *ctx) av_log(ctx, AV_LOG_ERROR, "User-provided texture has mismatching parameters\n"); return AVERROR(EINVAL); } - } else if (texDesc.ArraySize > 0) { + } else if (!(texDesc.BindFlags & D3D11_BIND_RENDER_TARGET) && texDesc.ArraySize > 0) { hr = ID3D11Device_CreateTexture2D(device_hwctx->device, &texDesc, NULL, &hwctx->texture); if (FAILED(hr)) { av_log(ctx, AV_LOG_ERROR, "Could not create the texture (%lx)\n", (long)hr); @@ -275,6 +284,11 @@ static int d3d11va_frames_init(AVHWFramesContext *ctx) } } + hwctx->texture_infos = av_mallocz_array(ctx->initial_pool_size, sizeof(*hwctx->texture_infos)); + if (!hwctx->texture_infos) + return AVERROR(ENOMEM); + s->nb_surfaces = ctx->initial_pool_size; + ctx->internal->pool_internal = av_buffer_pool_init2(sizeof(AVD3D11FrameDescriptor), ctx, d3d11va_pool_alloc, NULL); if (!ctx->internal->pool_internal) diff --git a/chromium/third_party/ffmpeg/libavutil/hwcontext_d3d11va.h b/chromium/third_party/ffmpeg/libavutil/hwcontext_d3d11va.h index 9f91e9b1b67..77d2d72f1b9 100644 --- a/chromium/third_party/ffmpeg/libavutil/hwcontext_d3d11va.h +++ b/chromium/third_party/ffmpeg/libavutil/hwcontext_d3d11va.h @@ -164,6 +164,15 @@ typedef struct AVD3D11VAFramesContext { * This field is ignored/invalid if a user-allocated texture is provided. */ UINT MiscFlags; + + /** + * In case if texture structure member above is not NULL contains the same texture + * pointer for all elements and different indexes into the array texture. + * In case if texture structure member above is NULL, all elements contains + * pointers to separate non-array textures and 0 indexes. + * This field is ignored/invalid if a user-allocated texture is provided. + */ + AVD3D11FrameDescriptor *texture_infos; } AVD3D11VAFramesContext; #endif /* AVUTIL_HWCONTEXT_D3D11VA_H */ diff --git a/chromium/third_party/ffmpeg/libavutil/hwcontext_qsv.c b/chromium/third_party/ffmpeg/libavutil/hwcontext_qsv.c index 08a6e0ee1c6..d431e71eab3 100644 --- a/chromium/third_party/ffmpeg/libavutil/hwcontext_qsv.c +++ b/chromium/third_party/ffmpeg/libavutil/hwcontext_qsv.c @@ -27,9 +27,13 @@ #include <pthread.h> #endif +#define COBJMACROS #if CONFIG_VAAPI #include "hwcontext_vaapi.h" #endif +#if CONFIG_D3D11VA +#include "hwcontext_d3d11va.h" +#endif #if CONFIG_DXVA2 #include "hwcontext_dxva2.h" #endif @@ -48,6 +52,8 @@ (MFX_VERSION_MAJOR > (MAJOR) || \ MFX_VERSION_MAJOR == (MAJOR) && MFX_VERSION_MINOR >= (MINOR)) +#define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl)) + typedef struct QSVDevicePriv { AVBufferRef *child_device_ctx; } QSVDevicePriv; @@ -74,6 +80,7 @@ typedef struct QSVFramesContext { AVBufferRef *child_frames_ref; mfxFrameSurface1 *surfaces_internal; + mfxHDLPair *handle_pairs_internal; int nb_surfaces_used; // used in the frame allocator for non-opaque surfaces @@ -86,20 +93,6 @@ typedef struct QSVFramesContext { } QSVFramesContext; static const struct { - mfxHandleType handle_type; - enum AVHWDeviceType device_type; - enum AVPixelFormat pix_fmt; -} supported_handle_types[] = { -#if CONFIG_VAAPI - { MFX_HANDLE_VA_DISPLAY, AV_HWDEVICE_TYPE_VAAPI, AV_PIX_FMT_VAAPI }, -#endif -#if CONFIG_DXVA2 - { MFX_HANDLE_D3D9_DEVICE_MANAGER, AV_HWDEVICE_TYPE_DXVA2, AV_PIX_FMT_DXVA2_VLD }, -#endif - { 0 }, -}; - -static const struct { enum AVPixelFormat pix_fmt; uint32_t fourcc; } supported_pixel_formats[] = { @@ -127,28 +120,32 @@ static uint32_t qsv_fourcc_from_pix_fmt(enum AVPixelFormat pix_fmt) return 0; } +#if CONFIG_D3D11VA +static uint32_t qsv_get_d3d11va_bind_flags(int mem_type) +{ + uint32_t bind_flags = 0; + + if ((mem_type & MFX_MEMTYPE_VIDEO_MEMORY_ENCODER_TARGET) && (mem_type & MFX_MEMTYPE_INTERNAL_FRAME)) + bind_flags = D3D11_BIND_DECODER | D3D11_BIND_VIDEO_ENCODER; + else + bind_flags = D3D11_BIND_DECODER; + + if ((MFX_MEMTYPE_FROM_VPPOUT & mem_type) || (MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET & mem_type)) + bind_flags = D3D11_BIND_RENDER_TARGET; + + return bind_flags; +} +#endif + static int qsv_device_init(AVHWDeviceContext *ctx) { AVQSVDeviceContext *hwctx = ctx->hwctx; QSVDeviceContext *s = ctx->internal->priv; - + int hw_handle_supported = 0; + mfxHandleType handle_type; + enum AVHWDeviceType device_type; + enum AVPixelFormat pix_fmt; mfxStatus err; - int i; - - for (i = 0; supported_handle_types[i].handle_type; i++) { - err = MFXVideoCORE_GetHandle(hwctx->session, supported_handle_types[i].handle_type, - &s->handle); - if (err == MFX_ERR_NONE) { - s->handle_type = supported_handle_types[i].handle_type; - s->child_device_type = supported_handle_types[i].device_type; - s->child_pix_fmt = supported_handle_types[i].pix_fmt; - break; - } - } - if (!s->handle) { - av_log(ctx, AV_LOG_VERBOSE, "No supported hw handle could be retrieved " - "from the session\n"); - } err = MFXQueryIMPL(hwctx->session, &s->impl); if (err == MFX_ERR_NONE) @@ -158,6 +155,41 @@ static int qsv_device_init(AVHWDeviceContext *ctx) return AVERROR_UNKNOWN; } + if (MFX_IMPL_VIA_VAAPI == MFX_IMPL_VIA_MASK(s->impl)) { +#if CONFIG_VAAPI + handle_type = MFX_HANDLE_VA_DISPLAY; + device_type = AV_HWDEVICE_TYPE_VAAPI; + pix_fmt = AV_PIX_FMT_VAAPI; + hw_handle_supported = 1; +#endif + } else if (MFX_IMPL_VIA_D3D11 == MFX_IMPL_VIA_MASK(s->impl)) { +#if CONFIG_D3D11VA + handle_type = MFX_HANDLE_D3D11_DEVICE; + device_type = AV_HWDEVICE_TYPE_D3D11VA; + pix_fmt = AV_PIX_FMT_D3D11; + hw_handle_supported = 1; +#endif + } else if (MFX_IMPL_VIA_D3D9 == MFX_IMPL_VIA_MASK(s->impl)) { +#if CONFIG_DXVA2 + handle_type = MFX_HANDLE_D3D9_DEVICE_MANAGER; + device_type = AV_HWDEVICE_TYPE_DXVA2; + pix_fmt = AV_PIX_FMT_DXVA2_VLD; + hw_handle_supported = 1; +#endif + } + + if (hw_handle_supported) { + err = MFXVideoCORE_GetHandle(hwctx->session, handle_type, &s->handle); + if (err == MFX_ERR_NONE) { + s->handle_type = handle_type; + s->child_device_type = device_type; + s->child_pix_fmt = pix_fmt; + } + } + if (!s->handle) { + av_log(ctx, AV_LOG_VERBOSE, "No supported hw handle could be retrieved " + "from the session\n"); + } return 0; } @@ -187,6 +219,7 @@ static void qsv_frames_uninit(AVHWFramesContext *ctx) av_freep(&s->mem_ids); av_freep(&s->surface_ptrs); av_freep(&s->surfaces_internal); + av_freep(&s->handle_pairs_internal); av_buffer_unref(&s->child_frames_ref); } @@ -202,6 +235,8 @@ static AVBufferRef *qsv_pool_alloc(void *opaque, size_t size) if (s->nb_surfaces_used < hwctx->nb_surfaces) { s->nb_surfaces_used++; + av_buffer_create((uint8_t*)(s->handle_pairs_internal + s->nb_surfaces_used - 1), + sizeof(*s->handle_pairs_internal), qsv_pool_release_dummy, NULL, 0); return av_buffer_create((uint8_t*)(s->surfaces_internal + s->nb_surfaces_used - 1), sizeof(*hwctx->surfaces), qsv_pool_release_dummy, NULL, 0); } @@ -241,6 +276,13 @@ static int qsv_init_child_ctx(AVHWFramesContext *ctx) child_device_hwctx->display = (VADisplay)device_priv->handle; } #endif +#if CONFIG_D3D11VA + if (child_device_ctx->type == AV_HWDEVICE_TYPE_D3D11VA) { + AVD3D11VADeviceContext *child_device_hwctx = child_device_ctx->hwctx; + ID3D11Device_AddRef((ID3D11Device*)device_priv->handle); + child_device_hwctx->device = (ID3D11Device*)device_priv->handle; + } +#endif #if CONFIG_DXVA2 if (child_device_ctx->type == AV_HWDEVICE_TYPE_DXVA2) { AVDXVA2DeviceContext *child_device_hwctx = child_device_ctx->hwctx; @@ -267,6 +309,16 @@ static int qsv_init_child_ctx(AVHWFramesContext *ctx) child_frames_ctx->width = FFALIGN(ctx->width, 16); child_frames_ctx->height = FFALIGN(ctx->height, 16); +#if CONFIG_D3D11VA + if (child_device_ctx->type == AV_HWDEVICE_TYPE_D3D11VA) { + AVD3D11VAFramesContext *child_frames_hwctx = child_frames_ctx->hwctx; + if (hwctx->frame_type == 0) + hwctx->frame_type = MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET; + if (hwctx->frame_type & MFX_MEMTYPE_SHARED_RESOURCE) + child_frames_hwctx->MiscFlags = D3D11_RESOURCE_MISC_SHARED; + child_frames_hwctx->BindFlags = qsv_get_d3d11va_bind_flags(hwctx->frame_type); + } +#endif #if CONFIG_DXVA2 if (child_device_ctx->type == AV_HWDEVICE_TYPE_DXVA2) { AVDXVA2FramesContext *child_frames_hwctx = child_frames_ctx->hwctx; @@ -286,16 +338,41 @@ static int qsv_init_child_ctx(AVHWFramesContext *ctx) #if CONFIG_VAAPI if (child_device_ctx->type == AV_HWDEVICE_TYPE_VAAPI) { AVVAAPIFramesContext *child_frames_hwctx = child_frames_ctx->hwctx; - for (i = 0; i < ctx->initial_pool_size; i++) - s->surfaces_internal[i].Data.MemId = child_frames_hwctx->surface_ids + i; + for (i = 0; i < ctx->initial_pool_size; i++) { + s->handle_pairs_internal[i].first = child_frames_hwctx->surface_ids + i; + s->handle_pairs_internal[i].second = (mfxMemId)MFX_INFINITE; + s->surfaces_internal[i].Data.MemId = (mfxMemId)&s->handle_pairs_internal[i]; + } hwctx->frame_type = MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET; } #endif +#if CONFIG_D3D11VA + if (child_device_ctx->type == AV_HWDEVICE_TYPE_D3D11VA) { + AVD3D11VAFramesContext *child_frames_hwctx = child_frames_ctx->hwctx; + for (i = 0; i < ctx->initial_pool_size; i++) { + s->handle_pairs_internal[i].first = (mfxMemId)child_frames_hwctx->texture_infos[i].texture; + if(child_frames_hwctx->BindFlags & D3D11_BIND_RENDER_TARGET) { + s->handle_pairs_internal[i].second = (mfxMemId)MFX_INFINITE; + } else { + s->handle_pairs_internal[i].second = (mfxMemId)child_frames_hwctx->texture_infos[i].index; + } + s->surfaces_internal[i].Data.MemId = (mfxMemId)&s->handle_pairs_internal[i]; + } + if (child_frames_hwctx->BindFlags & D3D11_BIND_RENDER_TARGET) { + hwctx->frame_type |= MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET; + } else { + hwctx->frame_type |= MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET; + } + } +#endif #if CONFIG_DXVA2 if (child_device_ctx->type == AV_HWDEVICE_TYPE_DXVA2) { AVDXVA2FramesContext *child_frames_hwctx = child_frames_ctx->hwctx; - for (i = 0; i < ctx->initial_pool_size; i++) - s->surfaces_internal[i].Data.MemId = (mfxMemId)child_frames_hwctx->surfaces[i]; + for (i = 0; i < ctx->initial_pool_size; i++) { + s->handle_pairs_internal[i].first = (mfxMemId)child_frames_hwctx->surfaces[i]; + s->handle_pairs_internal[i].second = (mfxMemId)MFX_INFINITE; + s->surfaces_internal[i].Data.MemId = (mfxMemId)&s->handle_pairs_internal[i]; + } if (child_frames_hwctx->surface_type == DXVA2_VideoProcessorRenderTarget) hwctx->frame_type = MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET; else @@ -360,6 +437,11 @@ static int qsv_init_pool(AVHWFramesContext *ctx, uint32_t fourcc) return AVERROR(EINVAL); } + s->handle_pairs_internal = av_mallocz_array(ctx->initial_pool_size, + sizeof(*s->handle_pairs_internal)); + if (!s->handle_pairs_internal) + return AVERROR(ENOMEM); + s->surfaces_internal = av_mallocz_array(ctx->initial_pool_size, sizeof(*s->surfaces_internal)); if (!s->surfaces_internal) @@ -433,7 +515,13 @@ static mfxStatus frame_unlock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr) static mfxStatus frame_get_hdl(mfxHDL pthis, mfxMemId mid, mfxHDL *hdl) { - *hdl = mid; + mfxHDLPair *pair_dst = (mfxHDLPair*)hdl; + mfxHDLPair *pair_src = (mfxHDLPair*)mid; + + pair_dst->first = pair_src->first; + + if (pair_src->second != (mfxMemId)MFX_INFINITE) + pair_dst->second = pair_src->second; return MFX_ERR_NONE; } @@ -626,13 +714,26 @@ static int qsv_frames_derive_from(AVHWFramesContext *dst_ctx, sizeof(*dst_hwctx->surface_ids)); if (!dst_hwctx->surface_ids) return AVERROR(ENOMEM); - for (i = 0; i < src_hwctx->nb_surfaces; i++) - dst_hwctx->surface_ids[i] = - *(VASurfaceID*)src_hwctx->surfaces[i].Data.MemId; + for (i = 0; i < src_hwctx->nb_surfaces; i++) { + mfxHDLPair *pair = (mfxHDLPair*)src_hwctx->surfaces[i].Data.MemId; + dst_hwctx->surface_ids[i] = *(VASurfaceID*)pair->first; + } dst_hwctx->nb_surfaces = src_hwctx->nb_surfaces; } break; #endif +#if CONFIG_D3D11VA + case AV_HWDEVICE_TYPE_D3D11VA: + { + AVD3D11VAFramesContext *dst_hwctx = dst_ctx->hwctx; + mfxHDLPair *pair = (mfxHDLPair*)src_hwctx->surfaces[i].Data.MemId; + dst_hwctx->texture = (ID3D11Texture2D*)pair->first; + if (src_hwctx->frame_type & MFX_MEMTYPE_SHARED_RESOURCE) + dst_hwctx->MiscFlags = D3D11_RESOURCE_MISC_SHARED; + dst_hwctx->BindFlags = qsv_get_d3d11va_bind_flags(src_hwctx->frame_type); + } + break; +#endif #if CONFIG_DXVA2 case AV_HWDEVICE_TYPE_DXVA2: { @@ -641,9 +742,10 @@ static int qsv_frames_derive_from(AVHWFramesContext *dst_ctx, sizeof(*dst_hwctx->surfaces)); if (!dst_hwctx->surfaces) return AVERROR(ENOMEM); - for (i = 0; i < src_hwctx->nb_surfaces; i++) - dst_hwctx->surfaces[i] = - (IDirect3DSurface9*)src_hwctx->surfaces[i].Data.MemId; + for (i = 0; i < src_hwctx->nb_surfaces; i++) { + mfxHDLPair *pair = (mfxHDLPair*)src_hwctx->surfaces[i].Data.MemId; + dst_hwctx->surfaces[i] = (IDirect3DSurface9*)pair->first; + } dst_hwctx->nb_surfaces = src_hwctx->nb_surfaces; if (src_hwctx->frame_type == MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET) dst_hwctx->surface_type = DXVA2_VideoDecoderRenderTarget; @@ -677,13 +779,27 @@ static int qsv_map_from(AVHWFramesContext *ctx, switch (child_frames_ctx->device_ctx->type) { #if CONFIG_VAAPI case AV_HWDEVICE_TYPE_VAAPI: - child_data = (uint8_t*)(intptr_t)*(VASurfaceID*)surf->Data.MemId; + { + mfxHDLPair *pair = (mfxHDLPair*)surf->Data.MemId; + child_data = pair->first; break; + } +#endif +#if CONFIG_D3D11VA + case AV_HWDEVICE_TYPE_D3D11VA: + { + mfxHDLPair *pair = (mfxHDLPair*)surf->Data.MemId; + child_data = pair->first; + break; + } #endif #if CONFIG_DXVA2 case AV_HWDEVICE_TYPE_DXVA2: - child_data = surf->Data.MemId; + { + mfxHDLPair *pair = (mfxHDLPair*)surf->Data.MemId; + child_data = pair->first; break; + } #endif default: return AVERROR(ENOSYS); @@ -697,7 +813,14 @@ static int qsv_map_from(AVHWFramesContext *ctx, dst->width = src->width; dst->height = src->height; - dst->data[3] = child_data; + + if (child_frames_ctx->device_ctx->type == AV_HWDEVICE_TYPE_D3D11VA) { + mfxHDLPair *pair = (mfxHDLPair*)surf->Data.MemId; + dst->data[0] = pair->first; + dst->data[1] = pair->second; + } else { + dst->data[3] = child_data; + } return 0; } @@ -720,7 +843,14 @@ static int qsv_map_from(AVHWFramesContext *ctx, dummy->format = child_frames_ctx->format; dummy->width = src->width; dummy->height = src->height; - dummy->data[3] = child_data; + + if (child_frames_ctx->device_ctx->type == AV_HWDEVICE_TYPE_D3D11VA) { + mfxHDLPair *pair = (mfxHDLPair*)surf->Data.MemId; + dummy->data[0] = pair->first; + dummy->data[1] = pair->second; + } else { + dummy->data[3] = child_data; + } ret = av_hwframe_map(dst, dummy, flags); @@ -978,35 +1108,81 @@ static int qsv_frames_derive_to(AVHWFramesContext *dst_ctx, AVQSVFramesContext *dst_hwctx = dst_ctx->hwctx; int i; + if (src_ctx->initial_pool_size == 0) { + av_log(dst_ctx, AV_LOG_ERROR, "Only fixed-size pools can be " + "mapped to QSV frames.\n"); + return AVERROR(EINVAL); + } + switch (src_ctx->device_ctx->type) { #if CONFIG_VAAPI case AV_HWDEVICE_TYPE_VAAPI: { AVVAAPIFramesContext *src_hwctx = src_ctx->hwctx; + s->handle_pairs_internal = av_mallocz_array(src_ctx->initial_pool_size, sizeof(*s->handle_pairs_internal)); + if (!s->handle_pairs_internal) + return AVERROR(ENOMEM); s->surfaces_internal = av_mallocz_array(src_hwctx->nb_surfaces, sizeof(*s->surfaces_internal)); if (!s->surfaces_internal) return AVERROR(ENOMEM); for (i = 0; i < src_hwctx->nb_surfaces; i++) { qsv_init_surface(dst_ctx, &s->surfaces_internal[i]); - s->surfaces_internal[i].Data.MemId = src_hwctx->surface_ids + i; + s->handle_pairs_internal[i].first = src_hwctx->surface_ids + i; + s->handle_pairs_internal[i].second = (mfxMemId)MFX_INFINITE; + s->surfaces_internal[i].Data.MemId = (mfxMemId)&s->handle_pairs_internal[i]; } dst_hwctx->nb_surfaces = src_hwctx->nb_surfaces; dst_hwctx->frame_type = MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET; } break; #endif +#if CONFIG_D3D11VA + case AV_HWDEVICE_TYPE_D3D11VA: + { + AVD3D11VAFramesContext *src_hwctx = src_ctx->hwctx; + s->handle_pairs_internal = av_mallocz_array(src_ctx->initial_pool_size, sizeof(*s->handle_pairs_internal)); + if (!s->handle_pairs_internal) + return AVERROR(ENOMEM); + s->surfaces_internal = av_mallocz_array(src_ctx->initial_pool_size, + sizeof(*s->surfaces_internal)); + if (!s->surfaces_internal) + return AVERROR(ENOMEM); + for (i = 0; i < src_ctx->initial_pool_size; i++) { + qsv_init_surface(dst_ctx, &s->surfaces_internal[i]); + s->handle_pairs_internal[i].first = (mfxMemId)src_hwctx->texture_infos[i].texture; + if (src_hwctx->BindFlags & D3D11_BIND_RENDER_TARGET) { + s->handle_pairs_internal[i].second = (mfxMemId)MFX_INFINITE; + } else { + s->handle_pairs_internal[i].second = (mfxMemId)src_hwctx->texture_infos[i].index; + } + s->surfaces_internal[i].Data.MemId = (mfxMemId)&s->handle_pairs_internal[i]; + } + dst_hwctx->nb_surfaces = src_ctx->initial_pool_size; + if (src_hwctx->BindFlags & D3D11_BIND_RENDER_TARGET) { + dst_hwctx->frame_type |= MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET; + } else { + dst_hwctx->frame_type |= MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET; + } + } + break; +#endif #if CONFIG_DXVA2 case AV_HWDEVICE_TYPE_DXVA2: { AVDXVA2FramesContext *src_hwctx = src_ctx->hwctx; + s->handle_pairs_internal = av_mallocz_array(src_ctx->initial_pool_size, sizeof(*s->handle_pairs_internal)); + if (!s->handle_pairs_internal) + return AVERROR(ENOMEM); s->surfaces_internal = av_mallocz_array(src_hwctx->nb_surfaces, sizeof(*s->surfaces_internal)); if (!s->surfaces_internal) return AVERROR(ENOMEM); for (i = 0; i < src_hwctx->nb_surfaces; i++) { qsv_init_surface(dst_ctx, &s->surfaces_internal[i]); - s->surfaces_internal[i].Data.MemId = (mfxMemId)src_hwctx->surfaces[i]; + s->handle_pairs_internal[i].first = (mfxMemId)src_hwctx->surfaces[i]; + s->handle_pairs_internal[i].second = (mfxMemId)MFX_INFINITE; + s->surfaces_internal[i].Data.MemId = (mfxMemId)&s->handle_pairs_internal[i]; } dst_hwctx->nb_surfaces = src_hwctx->nb_surfaces; if (src_hwctx->surface_type == DXVA2_VideoProcessorRenderTarget) @@ -1029,21 +1205,44 @@ static int qsv_map_to(AVHWFramesContext *dst_ctx, AVFrame *dst, const AVFrame *src, int flags) { AVQSVFramesContext *hwctx = dst_ctx->hwctx; - int i, err; + int i, err, index = -1; - for (i = 0; i < hwctx->nb_surfaces; i++) { + for (i = 0; i < hwctx->nb_surfaces && index < 0; i++) { + switch(src->format) { #if CONFIG_VAAPI - if (*(VASurfaceID*)hwctx->surfaces[i].Data.MemId == - (VASurfaceID)(uintptr_t)src->data[3]) - break; + case AV_PIX_FMT_VAAPI: + { + mfxHDLPair *pair = (mfxHDLPair*)hwctx->surfaces[i].Data.MemId; + if (pair->first == src->data[3]) { + index = i; + break; + } + } +#endif +#if CONFIG_D3D11VA + case AV_PIX_FMT_D3D11: + { + mfxHDLPair *pair = (mfxHDLPair*)hwctx->surfaces[i].Data.MemId; + if (pair->first == src->data[0] + && pair->second == src->data[1]) { + index = i; + break; + } + } #endif #if CONFIG_DXVA2 - if ((IDirect3DSurface9*)hwctx->surfaces[i].Data.MemId == - (IDirect3DSurface9*)(uintptr_t)src->data[3]) - break; + case AV_PIX_FMT_DXVA2_VLD: + { + mfxHDLPair *pair = (mfxHDLPair*)hwctx->surfaces[i].Data.MemId; + if (pair->first == src->data[3]) { + index = i; + break; + } + } #endif + } } - if (i >= hwctx->nb_surfaces) { + if (index < 0) { av_log(dst_ctx, AV_LOG_ERROR, "Trying to map from a surface which " "is not in the mapped frames context.\n"); return AVERROR(EINVAL); @@ -1056,7 +1255,7 @@ static int qsv_map_to(AVHWFramesContext *dst_ctx, dst->width = src->width; dst->height = src->height; - dst->data[3] = (uint8_t*)&hwctx->surfaces[i]; + dst->data[3] = (uint8_t*)&hwctx->surfaces[index]; return 0; } @@ -1098,7 +1297,7 @@ static void qsv_device_free(AVHWDeviceContext *ctx) av_freep(&priv); } -static mfxIMPL choose_implementation(const char *device) +static mfxIMPL choose_implementation(const char *device, enum AVHWDeviceType child_device_type) { static const struct { const char *name; @@ -1127,6 +1326,13 @@ static mfxIMPL choose_implementation(const char *device) impl = strtol(device, NULL, 0); } + if (impl != MFX_IMPL_SOFTWARE) { + if (child_device_type == AV_HWDEVICE_TYPE_D3D11VA) + impl |= MFX_IMPL_VIA_D3D11; + else if (child_device_type == AV_HWDEVICE_TYPE_DXVA2) + impl |= MFX_IMPL_VIA_D3D9; + } + return impl; } @@ -1153,6 +1359,15 @@ static int qsv_device_derive_from_child(AVHWDeviceContext *ctx, } break; #endif +#if CONFIG_D3D11VA + case AV_HWDEVICE_TYPE_D3D11VA: + { + AVD3D11VADeviceContext *child_device_hwctx = child_device_ctx->hwctx; + handle_type = MFX_HANDLE_D3D11_DEVICE; + handle = (mfxHDL)child_device_hwctx->device; + } + break; +#endif #if CONFIG_DXVA2 case AV_HWDEVICE_TYPE_DXVA2: { @@ -1216,7 +1431,9 @@ static int qsv_device_derive(AVHWDeviceContext *ctx, AVHWDeviceContext *child_device_ctx, AVDictionary *opts, int flags) { - return qsv_device_derive_from_child(ctx, MFX_IMPL_HARDWARE_ANY, + mfxIMPL impl; + impl = choose_implementation("hw_any", child_device_ctx->type); + return qsv_device_derive_from_child(ctx, impl, child_device_ctx, flags); } @@ -1239,25 +1456,61 @@ static int qsv_device_create(AVHWDeviceContext *ctx, const char *device, ctx->user_opaque = priv; ctx->free = qsv_device_free; - e = av_dict_get(opts, "child_device", NULL, 0); - - child_device_opts = NULL; - if (CONFIG_VAAPI) { + e = av_dict_get(opts, "child_device_type", NULL, 0); + if (e) { + child_device_type = av_hwdevice_find_type_by_name(e ? e->value : NULL); + if (child_device_type == AV_HWDEVICE_TYPE_NONE) { + av_log(ctx, AV_LOG_ERROR, "Unknown child device type " + "\"%s\".\n", e ? e->value : NULL); + return AVERROR(EINVAL); + } + } else if (CONFIG_VAAPI) { child_device_type = AV_HWDEVICE_TYPE_VAAPI; - // libmfx does not actually implement VAAPI properly, rather it - // depends on the specific behaviour of a matching iHD driver when - // used on recent Intel hardware. Set options to the VAAPI device - // creation so that we should pick a usable setup by default if - // possible, even when multiple devices and drivers are available. - av_dict_set(&child_device_opts, "kernel_driver", "i915", 0); - av_dict_set(&child_device_opts, "driver", "iHD", 0); - } else if (CONFIG_DXVA2) + } else if (CONFIG_DXVA2) { + av_log(NULL, AV_LOG_WARNING, + "WARNING: defaulting child_device_type to AV_HWDEVICE_TYPE_DXVA2 for compatibility " + "with old commandlines. This behaviour will be removed " + "in the future. Please explicitly set device type via \"-init_hw_device\" option.\n"); child_device_type = AV_HWDEVICE_TYPE_DXVA2; - else { + } else if (CONFIG_D3D11VA) { + child_device_type = AV_HWDEVICE_TYPE_D3D11VA; + } else { av_log(ctx, AV_LOG_ERROR, "No supported child device type is enabled\n"); return AVERROR(ENOSYS); } + child_device_opts = NULL; + switch (child_device_type) { +#if CONFIG_VAAPI + case AV_HWDEVICE_TYPE_VAAPI: + { + // libmfx does not actually implement VAAPI properly, rather it + // depends on the specific behaviour of a matching iHD driver when + // used on recent Intel hardware. Set options to the VAAPI device + // creation so that we should pick a usable setup by default if + // possible, even when multiple devices and drivers are available. + av_dict_set(&child_device_opts, "kernel_driver", "i915", 0); + av_dict_set(&child_device_opts, "driver", "iHD", 0); + } + break; +#endif +#if CONFIG_D3D11VA + case AV_HWDEVICE_TYPE_D3D11VA: + break; +#endif +#if CONFIG_DXVA2 + case AV_HWDEVICE_TYPE_DXVA2: + break; +#endif + default: + { + av_log(ctx, AV_LOG_ERROR, "No supported child device type is enabled\n"); + return AVERROR(ENOSYS); + } + break; + } + + e = av_dict_get(opts, "child_device", NULL, 0); ret = av_hwdevice_ctx_create(&priv->child_device_ctx, child_device_type, e ? e->value : NULL, child_device_opts, 0); @@ -1267,7 +1520,7 @@ static int qsv_device_create(AVHWDeviceContext *ctx, const char *device, child_device = (AVHWDeviceContext*)priv->child_device_ctx->data; - impl = choose_implementation(device); + impl = choose_implementation(device, child_device_type); return qsv_device_derive_from_child(ctx, impl, child_device, 0); } diff --git a/chromium/third_party/ffmpeg/libavutil/hwcontext_vulkan.c b/chromium/third_party/ffmpeg/libavutil/hwcontext_vulkan.c index b7da6a7e328..94fdad7f064 100644 --- a/chromium/third_party/ffmpeg/libavutil/hwcontext_vulkan.c +++ b/chromium/third_party/ffmpeg/libavutil/hwcontext_vulkan.c @@ -3424,7 +3424,7 @@ static int vulkan_transfer_data(AVHWFramesContext *hwfc, const AVFrame *vkf, } if (!from) { - /* Map, copy image to buffer, unmap */ + /* Map, copy image TO buffer (which then goes to the VkImage), unmap */ if ((err = map_buffers(dev_ctx, bufs, tmp.data, planes, 0))) goto end; @@ -3449,7 +3449,7 @@ static int vulkan_transfer_data(AVHWFramesContext *hwfc, const AVFrame *vkf, swf->width, swf->height, swf->format, from); if (from) { - /* Map, copy image to buffer, unmap */ + /* Map, copy buffer (which came FROM the VkImage) to the frame, unmap */ if ((err = map_buffers(dev_ctx, bufs, tmp.data, planes, 0))) goto end; @@ -3459,10 +3459,10 @@ static int vulkan_transfer_data(AVHWFramesContext *hwfc, const AVFrame *vkf, get_plane_wh(&p_w, &p_h, swf->format, swf->width, swf->height, i); - av_image_copy_plane(swf->data[i], swf->linesize[i], - (const uint8_t *)tmp.data[i], tmp.linesize[i], - FFMIN(tmp.linesize[i], FFABS(swf->linesize[i])), - p_h); + av_image_copy_plane_uc_from(swf->data[i], swf->linesize[i], + (const uint8_t *)tmp.data[i], tmp.linesize[i], + FFMIN(tmp.linesize[i], FFABS(swf->linesize[i])), + p_h); } if ((err = unmap_buffers(dev_ctx, bufs, planes, 1))) diff --git a/chromium/third_party/ffmpeg/libavutil/imgutils.c b/chromium/third_party/ffmpeg/libavutil/imgutils.c index 6c32a71cc5b..9ab5757cf61 100644 --- a/chromium/third_party/ffmpeg/libavutil/imgutils.c +++ b/chromium/third_party/ffmpeg/libavutil/imgutils.c @@ -356,9 +356,9 @@ static void image_copy_plane(uint8_t *dst, ptrdiff_t dst_linesize, } } -static void image_copy_plane_uc_from(uint8_t *dst, ptrdiff_t dst_linesize, - const uint8_t *src, ptrdiff_t src_linesize, - ptrdiff_t bytewidth, int height) +void av_image_copy_plane_uc_from(uint8_t *dst, ptrdiff_t dst_linesize, + const uint8_t *src, ptrdiff_t src_linesize, + ptrdiff_t bytewidth, int height) { int ret = -1; @@ -440,7 +440,7 @@ void av_image_copy_uc_from(uint8_t *dst_data[4], const ptrdiff_t dst_linesizes[4 enum AVPixelFormat pix_fmt, int width, int height) { image_copy(dst_data, dst_linesizes, src_data, src_linesizes, pix_fmt, - width, height, image_copy_plane_uc_from); + width, height, av_image_copy_plane_uc_from); } int av_image_fill_arrays(uint8_t *dst_data[4], int dst_linesize[4], diff --git a/chromium/third_party/ffmpeg/libavutil/imgutils.h b/chromium/third_party/ffmpeg/libavutil/imgutils.h index 5eccbf0bf78..cb2d74728ef 100644 --- a/chromium/third_party/ffmpeg/libavutil/imgutils.h +++ b/chromium/third_party/ffmpeg/libavutil/imgutils.h @@ -125,6 +125,24 @@ void av_image_copy_plane(uint8_t *dst, int dst_linesize, int bytewidth, int height); /** + * Copy image data located in uncacheable (e.g. GPU mapped) memory. Where + * available, this function will use special functionality for reading from such + * memory, which may result in greatly improved performance compared to plain + * av_image_copy_plane(). + * + * bytewidth must be contained by both absolute values of dst_linesize + * and src_linesize, otherwise the function behavior is undefined. + * + * @note The linesize parameters have the type ptrdiff_t here, while they are + * int for av_image_copy_plane(). + * @note On x86, the linesizes currently need to be aligned to the cacheline + * size (i.e. 64) to get improved performance. + */ +void av_image_copy_plane_uc_from(uint8_t *dst, ptrdiff_t dst_linesize, + const uint8_t *src, ptrdiff_t src_linesize, + ptrdiff_t bytewidth, int height); + +/** * Copy image in src_data to dst_data. * * @param dst_linesizes linesizes for the image in dst_data diff --git a/chromium/third_party/ffmpeg/libavutil/internal.h b/chromium/third_party/ffmpeg/libavutil/internal.h index f0ba72f0522..ceb36c45928 100644 --- a/chromium/third_party/ffmpeg/libavutil/internal.h +++ b/chromium/third_party/ffmpeg/libavutil/internal.h @@ -86,10 +86,6 @@ #define FF_MEMORY_POISON 0x2a -#define MAKE_ACCESSORS(str, name, type, field) \ - type av_##name##_get_##field(const str *s) { return s->field; } \ - void av_##name##_set_##field(str *s, type v) { s->field = v; } - /* Check if the hard coded offset of a struct member still matches reality. * Induce a compilation failure if not. */ @@ -103,6 +99,11 @@ #define FF_PTR_ADD(ptr, off) ((off) ? (ptr) + (off) : (ptr)) +/** + * Access a field in a structure by its offset. + */ +#define FF_FIELD_AT(type, off, obj) (*(type *)((char *)&(obj) + (off))) + #include "libm.h" /** @@ -202,10 +203,18 @@ void avpriv_request_sample(void *avc, #ifdef DEBUG # define ff_dlog(ctx, ...) av_log(ctx, AV_LOG_DEBUG, __VA_ARGS__) +#elif defined(CHROMIUM_NO_LOGGING) +# define ff_dlog(ctx, ...) do { } while(0) // Prevent a [-Wempty-body] error. #else # define ff_dlog(ctx, ...) do { if (0) av_log(ctx, AV_LOG_DEBUG, __VA_ARGS__); } while (0) #endif +#ifdef TRACE +# define ff_tlog(ctx, ...) av_log(ctx, AV_LOG_TRACE, __VA_ARGS__) +#else +# define ff_tlog(ctx, ...) do { } while(0) +#endif + // For debuging we use signed operations so overflows can be detected (by ubsan) // For production we use unsigned so there are no undefined operations #ifdef CHECKED diff --git a/chromium/third_party/ffmpeg/libavutil/log.h b/chromium/third_party/ffmpeg/libavutil/log.h index 40895c7e4e0..8e3e0a64726 100644 --- a/chromium/third_party/ffmpeg/libavutil/log.h +++ b/chromium/third_party/ffmpeg/libavutil/log.h @@ -107,11 +107,6 @@ typedef struct AVClass { int parent_log_context_offset; /** - * Return next AVOptions-enabled child or NULL - */ - void* (*child_next)(void *obj, void *prev); - - /** * Category used for visualization (like color) * This is only set if the category is equal for all objects using this class. * available since version (51 << 16 | 56 << 8 | 100) @@ -131,6 +126,11 @@ typedef struct AVClass { int (*query_ranges)(struct AVOptionRanges **, void *obj, const char *key, int flags); /** + * Return next AVOptions-enabled child or NULL + */ + void* (*child_next)(void *obj, void *prev); + + /** * Iterate over the AVClasses corresponding to potential AVOptions-enabled * children. * diff --git a/chromium/third_party/ffmpeg/libavutil/mem.c b/chromium/third_party/ffmpeg/libavutil/mem.c index 0cb5fd3995a..9cf0cb67f05 100644 --- a/chromium/third_party/ffmpeg/libavutil/mem.c +++ b/chromium/third_party/ffmpeg/libavutil/mem.c @@ -75,6 +75,24 @@ void av_max_alloc(size_t max){ atomic_store_explicit(&max_alloc_size, max, memory_order_relaxed); } +static int size_mult(size_t a, size_t b, size_t *r) +{ + size_t t; + +#if (!defined(__INTEL_COMPILER) && AV_GCC_VERSION_AT_LEAST(5,1)) || AV_HAS_BUILTIN(__builtin_mul_overflow) + if (__builtin_mul_overflow(a, b, &t)) + return AVERROR(EINVAL); +#else + t = a * b; + /* Hack inspired from glibc: don't try the division if nelem and elsize + * are both less than sqrt(SIZE_MAX). */ + if ((a | b) >= ((size_t)1 << (sizeof(size_t) * 4)) && a && t / a != b) + return AVERROR(EINVAL); +#endif + *r = t; + return 0; +} + void *av_malloc(size_t size) { void *ptr = NULL; @@ -155,7 +173,7 @@ void *av_realloc_f(void *ptr, size_t nelem, size_t elsize) size_t size; void *r; - if (av_size_mult(elsize, nelem, &size)) { + if (size_mult(elsize, nelem, &size)) { av_free(ptr); return NULL; } @@ -189,7 +207,7 @@ int av_reallocp(void *ptr, size_t size) void *av_malloc_array(size_t nmemb, size_t size) { size_t result; - if (av_size_mult(nmemb, size, &result) < 0) + if (size_mult(nmemb, size, &result) < 0) return NULL; return av_malloc(result); } @@ -197,7 +215,7 @@ void *av_malloc_array(size_t nmemb, size_t size) void *av_mallocz_array(size_t nmemb, size_t size) { size_t result; - if (av_size_mult(nmemb, size, &result) < 0) + if (size_mult(nmemb, size, &result) < 0) return NULL; return av_mallocz(result); } @@ -205,7 +223,7 @@ void *av_mallocz_array(size_t nmemb, size_t size) void *av_realloc_array(void *ptr, size_t nmemb, size_t size) { size_t result; - if (av_size_mult(nmemb, size, &result) < 0) + if (size_mult(nmemb, size, &result) < 0) return NULL; return av_realloc(ptr, result); } @@ -252,7 +270,7 @@ void *av_mallocz(size_t size) void *av_calloc(size_t nmemb, size_t size) { size_t result; - if (av_size_mult(nmemb, size, &result) < 0) + if (size_mult(nmemb, size, &result) < 0) return NULL; return av_mallocz(result); } @@ -550,18 +568,5 @@ void av_fast_mallocz(void *ptr, unsigned int *size, size_t min_size) int av_size_mult(size_t a, size_t b, size_t *r) { - size_t t; - -#if (!defined(__INTEL_COMPILER) && AV_GCC_VERSION_AT_LEAST(5,1)) || AV_HAS_BUILTIN(__builtin_mul_overflow) - if (__builtin_mul_overflow(a, b, &t)) - return AVERROR(EINVAL); -#else - t = a * b; - /* Hack inspired from glibc: don't try the division if nelem and elsize - * are both less than sqrt(SIZE_MAX). */ - if ((a | b) >= ((size_t)1 << (sizeof(size_t) * 4)) && a && t / a != b) - return AVERROR(EINVAL); -#endif - *r = t; - return 0; + return size_mult(a, b, r); } diff --git a/chromium/third_party/ffmpeg/libavutil/mem.h b/chromium/third_party/ffmpeg/libavutil/mem.h index e9d343eaf03..c7f8867a131 100644 --- a/chromium/third_party/ffmpeg/libavutil/mem.h +++ b/chromium/third_party/ffmpeg/libavutil/mem.h @@ -240,7 +240,7 @@ av_alloc_size(1, 2) void *av_malloc_array(size_t nmemb, size_t size); av_alloc_size(1, 2) void *av_mallocz_array(size_t nmemb, size_t size); /** - * Non-inlined equivalent of av_mallocz_array(). + * Equivalent of av_mallocz_array(). * * Created for symmetry with the calloc() C function. */ diff --git a/chromium/third_party/ffmpeg/libavutil/opt.h b/chromium/third_party/ffmpeg/libavutil/opt.h index 9e1e8ede06d..2820435eec2 100644 --- a/chromium/third_party/ffmpeg/libavutil/opt.h +++ b/chromium/third_party/ffmpeg/libavutil/opt.h @@ -790,9 +790,16 @@ int av_opt_query_ranges(AVOptionRanges **, void *obj, const char *key, int flags /** * Copy options from src object into dest object. * + * The underlying AVClass of both src and dest must coincide. The guarantee + * below does not apply if this is not fulfilled. + * * Options that require memory allocation (e.g. string or binary) are malloc'ed in dest object. * Original memory allocated for such options is freed unless both src and dest options points to the same memory. * + * Even on error it is guaranteed that allocated options from src and dest + * no longer alias each other afterwards; in particular calling av_opt_free() + * on both src and dest is safe afterwards if dest has been memdup'ed from src. + * * @param dest Object to copy from * @param src Object to copy into * @return 0 on success, negative on error diff --git a/chromium/third_party/ffmpeg/libavutil/slicethread.c b/chromium/third_party/ffmpeg/libavutil/slicethread.c index f928a5cf00e..867ce322387 100644 --- a/chromium/third_party/ffmpeg/libavutil/slicethread.c +++ b/chromium/third_party/ffmpeg/libavutil/slicethread.c @@ -240,7 +240,7 @@ int avpriv_slicethread_create(AVSliceThread **pctx, void *priv, int nb_threads) { *pctx = NULL; - return AVERROR(EINVAL); + return AVERROR(ENOSYS); } void avpriv_slicethread_execute(AVSliceThread *ctx, int nb_jobs, int execute_main) diff --git a/chromium/third_party/ffmpeg/libavutil/tx.c b/chromium/third_party/ffmpeg/libavutil/tx.c index 25adb6b37ee..fa81ada2f19 100644 --- a/chromium/third_party/ffmpeg/libavutil/tx.c +++ b/chromium/third_party/ffmpeg/libavutil/tx.c @@ -38,6 +38,7 @@ static av_always_inline int mulinv(int n, int m) if (((n * x) % m) == 1) return x; av_assert0(0); /* Never reached */ + return 0; } /* Guaranteed to work for any n, m where gcd(n, m) == 1 */ diff --git a/chromium/third_party/ffmpeg/libavutil/version.h b/chromium/third_party/ffmpeg/libavutil/version.h index 6b4a2654572..f220e192c8b 100644 --- a/chromium/third_party/ffmpeg/libavutil/version.h +++ b/chromium/third_party/ffmpeg/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 57 -#define LIBAVUTIL_VERSION_MINOR 3 +#define LIBAVUTIL_VERSION_MINOR 5 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ diff --git a/chromium/third_party/ffmpeg/libswscale/options.c b/chromium/third_party/ffmpeg/libswscale/options.c index 7eb27525432..4b71a23e37f 100644 --- a/chromium/third_party/ffmpeg/libswscale/options.c +++ b/chromium/third_party/ffmpeg/libswscale/options.c @@ -81,6 +81,9 @@ static const AVOption swscale_options[] = { { "uniform_color", "blend onto a uniform color", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_ALPHA_BLEND_UNIFORM},INT_MIN, INT_MAX, VE, "alphablend" }, { "checkerboard", "blend onto a checkerboard", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_ALPHA_BLEND_CHECKERBOARD},INT_MIN, INT_MAX, VE, "alphablend" }, + { "threads", "number of threads", OFFSET(nb_threads), AV_OPT_TYPE_INT, {.i64 = 1 }, 0, INT_MAX, VE, "threads" }, + { "auto", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 0 }, .flags = VE, "threads" }, + { NULL } }; diff --git a/chromium/third_party/ffmpeg/libswscale/swscale.c b/chromium/third_party/ffmpeg/libswscale/swscale.c index 61dfcb4dffd..b9c9647fcb6 100644 --- a/chromium/third_party/ffmpeg/libswscale/swscale.c +++ b/chromium/third_party/ffmpeg/libswscale/swscale.c @@ -236,13 +236,16 @@ static void lumRangeFromJpeg16_c(int16_t *_dst, int width) av_log(c, AV_LOG_DEBUG, __VA_ARGS__) static int swscale(SwsContext *c, const uint8_t *src[], - int srcStride[], int srcSliceY, - int srcSliceH, uint8_t *dst[], int dstStride[]) + int srcStride[], int srcSliceY, int srcSliceH, + uint8_t *dst[], int dstStride[], + int dstSliceY, int dstSliceH) { + const int scale_dst = dstSliceY > 0 || dstSliceH < c->dstH; + /* load a few things into local vars to make the code more readable? * and faster */ const int dstW = c->dstW; - const int dstH = c->dstH; + int dstH = c->dstH; const enum AVPixelFormat dstFormat = c->dstFormat; const int flags = c->flags; @@ -331,10 +334,15 @@ static int swscale(SwsContext *c, const uint8_t *src[], } } - /* Note the user might start scaling the picture in the middle so this - * will not get executed. This is not really intended but works - * currently, so people might do it. */ - if (srcSliceY == 0) { + if (scale_dst) { + dstY = dstSliceY; + dstH = dstY + dstSliceH; + lastInLumBuf = -1; + lastInChrBuf = -1; + } else if (srcSliceY == 0) { + /* Note the user might start scaling the picture in the middle so this + * will not get executed. This is not really intended but works + * currently, so people might do it. */ dstY = 0; lastInLumBuf = -1; lastInChrBuf = -1; @@ -352,8 +360,8 @@ static int swscale(SwsContext *c, const uint8_t *src[], srcSliceY, srcSliceH, chrSrcSliceY, chrSrcSliceH, 1); ff_init_slice_from_src(vout_slice, (uint8_t**)dst, dstStride, c->dstW, - dstY, dstH, dstY >> c->chrDstVSubSample, - AV_CEIL_RSHIFT(dstH, c->chrDstVSubSample), 0); + dstY, dstSliceH, dstY >> c->chrDstVSubSample, + AV_CEIL_RSHIFT(dstSliceH, c->chrDstVSubSample), scale_dst); if (srcSliceY == 0) { hout_slice->plane[0].sliceY = lastInLumBuf + 1; hout_slice->plane[1].sliceY = lastInChrBuf + 1; @@ -373,7 +381,7 @@ static int swscale(SwsContext *c, const uint8_t *src[], // First line needed as input const int firstLumSrcY = FFMAX(1 - vLumFilterSize, vLumFilterPos[dstY]); - const int firstLumSrcY2 = FFMAX(1 - vLumFilterSize, vLumFilterPos[FFMIN(dstY | ((1 << c->chrDstVSubSample) - 1), dstH - 1)]); + const int firstLumSrcY2 = FFMAX(1 - vLumFilterSize, vLumFilterPos[FFMIN(dstY | ((1 << c->chrDstVSubSample) - 1), c->dstH - 1)]); // First line needed as input const int firstChrSrcY = FFMAX(1 - vChrFilterSize, vChrFilterPos[chrDstY]); @@ -477,7 +485,7 @@ static int swscale(SwsContext *c, const uint8_t *src[], c->chrDither8 = ff_dither_8x8_128[chrDstY & 7]; c->lumDither8 = ff_dither_8x8_128[dstY & 7]; } - if (dstY >= dstH - 2) { + if (dstY >= c->dstH - 2) { /* hmm looks like we can't use MMX here without overwriting * this array's tail */ ff_sws_init_output_funcs(c, &yuv2plane1, &yuv2planeX, &yuv2nv12cX, @@ -491,21 +499,22 @@ static int swscale(SwsContext *c, const uint8_t *src[], desc[i].process(c, &desc[i], dstY, 1); } if (isPlanar(dstFormat) && isALPHA(dstFormat) && !needAlpha) { + int offset = lastDstY - dstSliceY; int length = dstW; int height = dstY - lastDstY; if (is16BPS(dstFormat) || isNBPS(dstFormat)) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(dstFormat); - fillPlane16(dst[3], dstStride[3], length, height, lastDstY, + fillPlane16(dst[3], dstStride[3], length, height, offset, 1, desc->comp[3].depth, isBE(dstFormat)); } else if (is32BPS(dstFormat)) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(dstFormat); - fillPlane32(dst[3], dstStride[3], length, height, lastDstY, + fillPlane32(dst[3], dstStride[3], length, height, offset, 1, desc->comp[3].depth, isBE(dstFormat), desc->flags & AV_PIX_FMT_FLAG_FLOAT); } else - fillPlane(dst[3], dstStride[3], length, height, lastDstY, 255); + fillPlane(dst[3], dstStride[3], length, height, offset, 255); } #if HAVE_MMXEXT_INLINE @@ -809,33 +818,42 @@ static void update_palette(SwsContext *c, const uint32_t *pal) } } +static int scale_internal(SwsContext *c, + const uint8_t * const srcSlice[], const int srcStride[], + int srcSliceY, int srcSliceH, + uint8_t *const dstSlice[], const int dstStride[], + int dstSliceY, int dstSliceH); + static int scale_gamma(SwsContext *c, const uint8_t * const srcSlice[], const int srcStride[], int srcSliceY, int srcSliceH, - uint8_t * const dst[], const int dstStride[]) + uint8_t * const dstSlice[], const int dstStride[], + int dstSliceY, int dstSliceH) { - int ret = sws_scale(c->cascaded_context[0], - srcSlice, srcStride, srcSliceY, srcSliceH, - c->cascaded_tmp, c->cascaded_tmpStride); + int ret = scale_internal(c->cascaded_context[0], + srcSlice, srcStride, srcSliceY, srcSliceH, + c->cascaded_tmp, c->cascaded_tmpStride, 0, c->srcH); if (ret < 0) return ret; if (c->cascaded_context[2]) - ret = sws_scale(c->cascaded_context[1], (const uint8_t * const *)c->cascaded_tmp, - c->cascaded_tmpStride, srcSliceY, srcSliceH, c->cascaded1_tmp, - c->cascaded1_tmpStride); + ret = scale_internal(c->cascaded_context[1], (const uint8_t * const *)c->cascaded_tmp, + c->cascaded_tmpStride, srcSliceY, srcSliceH, + c->cascaded1_tmp, c->cascaded1_tmpStride, 0, c->dstH); else - ret = sws_scale(c->cascaded_context[1], (const uint8_t * const *)c->cascaded_tmp, - c->cascaded_tmpStride, srcSliceY, srcSliceH, dst, dstStride); + ret = scale_internal(c->cascaded_context[1], (const uint8_t * const *)c->cascaded_tmp, + c->cascaded_tmpStride, srcSliceY, srcSliceH, + dstSlice, dstStride, dstSliceY, dstSliceH); if (ret < 0) return ret; if (c->cascaded_context[2]) { - ret = sws_scale(c->cascaded_context[2], (const uint8_t * const *)c->cascaded1_tmp, - c->cascaded1_tmpStride, c->cascaded_context[1]->dstY - ret, - c->cascaded_context[1]->dstY, dst, dstStride); + ret = scale_internal(c->cascaded_context[2], (const uint8_t * const *)c->cascaded1_tmp, + c->cascaded1_tmpStride, c->cascaded_context[1]->dstY - ret, + c->cascaded_context[1]->dstY, + dstSlice, dstStride, dstSliceY, dstSliceH); } return ret; } @@ -843,56 +861,64 @@ static int scale_gamma(SwsContext *c, static int scale_cascaded(SwsContext *c, const uint8_t * const srcSlice[], const int srcStride[], int srcSliceY, int srcSliceH, - uint8_t * const dst[], const int dstStride[]) + uint8_t * const dstSlice[], const int dstStride[], + int dstSliceY, int dstSliceH) { - int ret = sws_scale(c->cascaded_context[0], - srcSlice, srcStride, srcSliceY, srcSliceH, - c->cascaded_tmp, c->cascaded_tmpStride); + int ret = scale_internal(c->cascaded_context[0], + srcSlice, srcStride, srcSliceY, srcSliceH, + c->cascaded_tmp, c->cascaded_tmpStride, + 0, c->cascaded_context[0]->dstH); if (ret < 0) return ret; - ret = sws_scale(c->cascaded_context[1], - (const uint8_t * const * )c->cascaded_tmp, c->cascaded_tmpStride, - 0, c->cascaded_context[0]->dstH, dst, dstStride); + ret = scale_internal(c->cascaded_context[1], + (const uint8_t * const * )c->cascaded_tmp, c->cascaded_tmpStride, + 0, c->cascaded_context[0]->dstH, + dstSlice, dstStride, dstSliceY, dstSliceH); return ret; } -/** - * swscale wrapper, so we don't need to export the SwsContext. - * Assumes planar YUV to be in YUV order instead of YVU. - */ -int attribute_align_arg sws_scale(struct SwsContext *c, - const uint8_t * const srcSlice[], - const int srcStride[], int srcSliceY, - int srcSliceH, uint8_t *const dst[], - const int dstStride[]) +static int scale_internal(SwsContext *c, + const uint8_t * const srcSlice[], const int srcStride[], + int srcSliceY, int srcSliceH, + uint8_t *const dstSlice[], const int dstStride[], + int dstSliceY, int dstSliceH) { - const int frame_start = !c->sliceDir; + const int scale_dst = dstSliceY > 0 || dstSliceH < c->dstH; + const int frame_start = scale_dst || !c->sliceDir; int i, ret; const uint8_t *src2[4]; uint8_t *dst2[4]; - int macro_height = isBayer(c->srcFormat) ? 2 : (1 << c->chrSrcVSubSample); + int macro_height_src = isBayer(c->srcFormat) ? 2 : (1 << c->chrSrcVSubSample); + int macro_height_dst = isBayer(c->dstFormat) ? 2 : (1 << c->chrDstVSubSample); // copy strides, so they can safely be modified int srcStride2[4]; int dstStride2[4]; int srcSliceY_internal = srcSliceY; - if (!srcStride || !dstStride || !dst || !srcSlice) { + if (!srcStride || !dstStride || !dstSlice || !srcSlice) { av_log(c, AV_LOG_ERROR, "One of the input parameters to sws_scale() is NULL, please check the calling code\n"); return AVERROR(EINVAL); } - if ((srcSliceY & (macro_height-1)) || - ((srcSliceH& (macro_height-1)) && srcSliceY + srcSliceH != c->srcH) || + if ((srcSliceY & (macro_height_src - 1)) || + ((srcSliceH & (macro_height_src - 1)) && srcSliceY + srcSliceH != c->srcH) || srcSliceY + srcSliceH > c->srcH) { av_log(c, AV_LOG_ERROR, "Slice parameters %d, %d are invalid\n", srcSliceY, srcSliceH); return AVERROR(EINVAL); } + if ((dstSliceY & (macro_height_dst - 1)) || + ((dstSliceH & (macro_height_dst - 1)) && dstSliceY + dstSliceH != c->dstH) || + dstSliceY + dstSliceH > c->dstH) { + av_log(c, AV_LOG_ERROR, "Slice parameters %d, %d are invalid\n", dstSliceY, dstSliceH); + return AVERROR(EINVAL); + } + if (!check_image_pointers(srcSlice, c->srcFormat, srcStride)) { av_log(c, AV_LOG_ERROR, "bad src image pointers\n"); return AVERROR(EINVAL); } - if (!check_image_pointers((const uint8_t* const*)dst, c->dstFormat, dstStride)) { + if (!check_image_pointers((const uint8_t* const*)dstSlice, c->dstFormat, dstStride)) { av_log(c, AV_LOG_ERROR, "bad dst image pointers\n"); return AVERROR(EINVAL); } @@ -902,10 +928,12 @@ int attribute_align_arg sws_scale(struct SwsContext *c, return 0; if (c->gamma_flag && c->cascaded_context[0]) - return scale_gamma(c, srcSlice, srcStride, srcSliceY, srcSliceH, dst, dstStride); + return scale_gamma(c, srcSlice, srcStride, srcSliceY, srcSliceH, + dstSlice, dstStride, dstSliceY, dstSliceH); if (c->cascaded_context[0] && srcSliceY == 0 && srcSliceH == c->cascaded_context[0]->srcH) - return scale_cascaded(c, srcSlice, srcStride, srcSliceY, srcSliceH, dst, dstStride); + return scale_cascaded(c, srcSlice, srcStride, srcSliceY, srcSliceH, + dstSlice, dstStride, dstSliceY, dstSliceH); if (!srcSliceY && (c->flags & SWS_BITEXACT) && c->dither == SWS_DITHER_ED && c->dither_error[0]) for (i = 0; i < 4; i++) @@ -915,18 +943,19 @@ int attribute_align_arg sws_scale(struct SwsContext *c, update_palette(c, (const uint32_t *)srcSlice[1]); memcpy(src2, srcSlice, sizeof(src2)); - memcpy(dst2, dst, sizeof(dst2)); + memcpy(dst2, dstSlice, sizeof(dst2)); memcpy(srcStride2, srcStride, sizeof(srcStride2)); memcpy(dstStride2, dstStride, sizeof(dstStride2)); - if (frame_start) { + if (frame_start && !scale_dst) { if (srcSliceY != 0 && srcSliceY + srcSliceH != c->srcH) { av_log(c, AV_LOG_ERROR, "Slices start in the middle!\n"); return AVERROR(EINVAL); } c->sliceDir = (srcSliceY == 0) ? 1 : -1; - } + } else if (scale_dst) + c->sliceDir = 1; if (c->src0Alpha && !c->dst0Alpha && isALPHA(c->dstFormat)) { uint8_t *base; @@ -985,26 +1014,224 @@ int attribute_align_arg sws_scale(struct SwsContext *c, reset_ptr(src2, c->srcFormat); reset_ptr((void*)dst2, c->dstFormat); - if (c->convert_unscaled) - ret = c->convert_unscaled(c, src2, srcStride2, srcSliceY_internal, srcSliceH, + if (c->convert_unscaled) { + int offset = srcSliceY_internal; + int slice_h = srcSliceH; + + // for dst slice scaling, offset the src pointers to match the dst slice + if (scale_dst) { + av_assert0(offset == 0); + for (i = 0; i < 4 && src2[i]; i++) { + if (!src2[i] || (i > 0 && usePal(c->srcFormat))) + break; + src2[i] += (dstSliceY >> ((i == 1 || i == 2) ? c->chrSrcVSubSample : 0)) * srcStride2[i]; + } + offset = 0; + slice_h = dstSliceH; + } + + ret = c->convert_unscaled(c, src2, srcStride2, offset, slice_h, dst2, dstStride2); - else - ret = swscale(c, src2, srcStride2, srcSliceY_internal, srcSliceH, dst2, dstStride2); + } else { + ret = swscale(c, src2, srcStride2, srcSliceY_internal, srcSliceH, + dst2, dstStride2, dstSliceY, dstSliceH); + } if (c->dstXYZ && !(c->srcXYZ && c->srcW==c->dstW && c->srcH==c->dstH)) { - int dstY = c->dstY ? c->dstY : srcSliceY + srcSliceH; - uint16_t *dst16 = (uint16_t*)(dst2[0] + (dstY - ret) * dstStride2[0]); - av_assert0(dstY >= ret); - av_assert0(ret >= 0); - av_assert0(c->dstH >= dstY); + uint16_t *dst16; + + if (scale_dst) { + dst16 = (uint16_t *)dst2[0]; + } else { + int dstY = c->dstY ? c->dstY : srcSliceY + srcSliceH; + + av_assert0(dstY >= ret); + av_assert0(ret >= 0); + av_assert0(c->dstH >= dstY); + dst16 = (uint16_t*)(dst2[0] + (dstY - ret) * dstStride2[0]); + } /* replace on the same data */ rgb48Toxyz12(c, dst16, dst16, dstStride2[0]/2, ret); } /* reset slice direction at end of frame */ - if (srcSliceY_internal + srcSliceH == c->srcH) + if ((srcSliceY_internal + srcSliceH == c->srcH) || scale_dst) c->sliceDir = 0; return ret; } + +void sws_frame_end(struct SwsContext *c) +{ + av_frame_unref(c->frame_src); + av_frame_unref(c->frame_dst); + c->src_ranges.nb_ranges = 0; +} + +int sws_frame_start(struct SwsContext *c, AVFrame *dst, const AVFrame *src) +{ + int ret, allocated = 0; + + ret = av_frame_ref(c->frame_src, src); + if (ret < 0) + return ret; + + if (!dst->buf[0]) { + dst->width = c->dstW; + dst->height = c->dstH; + dst->format = c->dstFormat; + + ret = av_frame_get_buffer(dst, 0); + if (ret < 0) + return ret; + allocated = 1; + } + + ret = av_frame_ref(c->frame_dst, dst); + if (ret < 0) { + if (allocated) + av_frame_unref(dst); + + return ret; + } + + return 0; +} + +int sws_send_slice(struct SwsContext *c, unsigned int slice_start, + unsigned int slice_height) +{ + int ret; + + ret = ff_range_add(&c->src_ranges, slice_start, slice_height); + if (ret < 0) + return ret; + + return 0; +} + +unsigned int sws_receive_slice_alignment(const struct SwsContext *c) +{ + if (c->slice_ctx) + return c->slice_ctx[0]->dst_slice_align; + + return c->dst_slice_align; +} + +int sws_receive_slice(struct SwsContext *c, unsigned int slice_start, + unsigned int slice_height) +{ + unsigned int align = sws_receive_slice_alignment(c); + uint8_t *dst[4]; + + /* wait until complete input has been received */ + if (!(c->src_ranges.nb_ranges == 1 && + c->src_ranges.ranges[0].start == 0 && + c->src_ranges.ranges[0].len == c->srcH)) + return AVERROR(EAGAIN); + + if ((slice_start > 0 || slice_height < c->dstH) && + (slice_start % align || slice_height % align)) { + av_log(c, AV_LOG_ERROR, + "Incorrectly aligned output: %u/%u not multiples of %u\n", + slice_start, slice_height, align); + return AVERROR(EINVAL); + } + + if (c->slicethread) { + int nb_jobs = c->slice_ctx[0]->dither == SWS_DITHER_ED ? 1 : c->nb_slice_ctx; + int ret = 0; + + c->dst_slice_start = slice_start; + c->dst_slice_height = slice_height; + + avpriv_slicethread_execute(c->slicethread, nb_jobs, 0); + + for (int i = 0; i < c->nb_slice_ctx; i++) { + if (c->slice_err[i] < 0) { + ret = c->slice_err[i]; + break; + } + } + + memset(c->slice_err, 0, c->nb_slice_ctx * sizeof(*c->slice_err)); + + return ret; + } + + for (int i = 0; i < FF_ARRAY_ELEMS(dst); i++) { + ptrdiff_t offset = c->frame_dst->linesize[i] * (slice_start >> c->chrDstVSubSample); + dst[i] = FF_PTR_ADD(c->frame_dst->data[i], offset); + } + + return scale_internal(c, (const uint8_t * const *)c->frame_src->data, + c->frame_src->linesize, 0, c->srcH, + dst, c->frame_dst->linesize, slice_start, slice_height); +} + +int sws_scale_frame(struct SwsContext *c, AVFrame *dst, const AVFrame *src) +{ + int ret; + + ret = sws_frame_start(c, dst, src); + if (ret < 0) + return ret; + + ret = sws_send_slice(c, 0, src->height); + if (ret >= 0) + ret = sws_receive_slice(c, 0, dst->height); + + sws_frame_end(c); + + return ret; +} + +/** + * swscale wrapper, so we don't need to export the SwsContext. + * Assumes planar YUV to be in YUV order instead of YVU. + */ +int attribute_align_arg sws_scale(struct SwsContext *c, + const uint8_t * const srcSlice[], + const int srcStride[], int srcSliceY, + int srcSliceH, uint8_t *const dst[], + const int dstStride[]) +{ + if (c->nb_slice_ctx) + c = c->slice_ctx[0]; + + return scale_internal(c, srcSlice, srcStride, srcSliceY, srcSliceH, + dst, dstStride, 0, c->dstH); +} + +void ff_sws_slice_worker(void *priv, int jobnr, int threadnr, + int nb_jobs, int nb_threads) +{ + SwsContext *parent = priv; + SwsContext *c = parent->slice_ctx[threadnr]; + + const int slice_height = FFALIGN(FFMAX((parent->dst_slice_height + nb_jobs - 1) / nb_jobs, 1), + c->dst_slice_align); + const int slice_start = jobnr * slice_height; + const int slice_end = FFMIN((jobnr + 1) * slice_height, parent->dst_slice_height); + int err = 0; + + if (slice_end > slice_start) { + uint8_t *dst[4] = { NULL }; + + for (int i = 0; i < FF_ARRAY_ELEMS(dst) && parent->frame_dst->data[i]; i++) { + const int vshift = (i == 1 || i == 2) ? c->chrDstVSubSample : 0; + const ptrdiff_t offset = parent->frame_dst->linesize[i] * + ((slice_start + parent->dst_slice_start) >> vshift); + + dst[i] = parent->frame_dst->data[i] + offset; + } + + err = scale_internal(c, (const uint8_t * const *)parent->frame_src->data, + parent->frame_src->linesize, 0, c->srcH, + dst, parent->frame_dst->linesize, + parent->dst_slice_start + slice_start, slice_end - slice_start); + } + + parent->slice_err[threadnr] = err; +} diff --git a/chromium/third_party/ffmpeg/libswscale/swscale.h b/chromium/third_party/ffmpeg/libswscale/swscale.h index 50d6d465531..59610d03426 100644 --- a/chromium/third_party/ffmpeg/libswscale/swscale.h +++ b/chromium/third_party/ffmpeg/libswscale/swscale.h @@ -30,6 +30,7 @@ #include <stdint.h> #include "libavutil/avutil.h" +#include "libavutil/frame.h" #include "libavutil/log.h" #include "libavutil/pixfmt.h" #include "version.h" @@ -219,6 +220,97 @@ int sws_scale(struct SwsContext *c, const uint8_t *const srcSlice[], uint8_t *const dst[], const int dstStride[]); /** + * Scale source data from src and write the output to dst. + * + * This is merely a convenience wrapper around + * - sws_frame_start() + * - sws_send_slice(0, src->height) + * - sws_receive_slice(0, dst->height) + * - sws_frame_end() + * + * @param dst The destination frame. See documentation for sws_frame_start() for + * more details. + * @param src The source frame. + * + * @return 0 on success, a negative AVERROR code on failure + */ +int sws_scale_frame(struct SwsContext *c, AVFrame *dst, const AVFrame *src); + +/** + * Initialize the scaling process for a given pair of source/destination frames. + * Must be called before any calls to sws_send_slice() and sws_receive_slice(). + * + * This function will retain references to src and dst, so they must both use + * refcounted buffers (if allocated by the caller, in case of dst). + * + * @param dst The destination frame. + * + * The data buffers may either be already allocated by the caller or + * left clear, in which case they will be allocated by the scaler. + * The latter may have performance advantages - e.g. in certain cases + * some output planes may be references to input planes, rather than + * copies. + * + * Output data will be written into this frame in successful + * sws_receive_slice() calls. + * @param src The source frame. The data buffers must be allocated, but the + * frame data does not have to be ready at this point. Data + * availability is then signalled by sws_send_slice(). + * @return 0 on success, a negative AVERROR code on failure + * + * @see sws_frame_end() + */ +int sws_frame_start(struct SwsContext *c, AVFrame *dst, const AVFrame *src); + +/** + * Finish the scaling process for a pair of source/destination frames previously + * submitted with sws_frame_start(). Must be called after all sws_send_slice() + * and sws_receive_slice() calls are done, before any new sws_frame_start() + * calls. + */ +void sws_frame_end(struct SwsContext *c); + +/** + * Indicate that a horizontal slice of input data is available in the source + * frame previously provided to sws_frame_start(). The slices may be provided in + * any order, but may not overlap. For vertically subsampled pixel formats, the + * slices must be aligned according to subsampling. + * + * @param slice_start first row of the slice + * @param slice_height number of rows in the slice + * + * @return a non-negative number on success, a negative AVERROR code on failure. + */ +int sws_send_slice(struct SwsContext *c, unsigned int slice_start, + unsigned int slice_height); + +/** + * Request a horizontal slice of the output data to be written into the frame + * previously provided to sws_frame_start(). + * + * @param slice_start first row of the slice; must be a multiple of + * sws_receive_slice_alignment() + * @param slice_height number of rows in the slice; must be a multiple of + * sws_receive_slice_alignment(), except for the last slice + * (i.e. when slice_start+slice_height is equal to output + * frame height) + * + * @return a non-negative number if the data was successfully written into the output + * AVERROR(EAGAIN) if more input data needs to be provided before the + * output can be produced + * another negative AVERROR code on other kinds of scaling failure + */ +int sws_receive_slice(struct SwsContext *c, unsigned int slice_start, + unsigned int slice_height); + +/** + * @return alignment required for output slices requested with sws_receive_slice(). + * Slice offsets and sizes passed to sws_receive_slice() must be + * multiples of the value returned from this function. + */ +unsigned int sws_receive_slice_alignment(const struct SwsContext *c); + +/** * @param dstRange flag indicating the while-black range of the output (1=jpeg / 0=mpeg) * @param srcRange flag indicating the while-black range of the input (1=jpeg / 0=mpeg) * @param table the yuv2rgb coefficients describing the output yuv space, normally ff_yuv2rgb_coeffs[x] diff --git a/chromium/third_party/ffmpeg/libswscale/swscale_internal.h b/chromium/third_party/ffmpeg/libswscale/swscale_internal.h index 673407636ab..fbfc08a89fe 100644 --- a/chromium/third_party/ffmpeg/libswscale/swscale_internal.h +++ b/chromium/third_party/ffmpeg/libswscale/swscale_internal.h @@ -27,11 +27,13 @@ #include "libavutil/avassert.h" #include "libavutil/avutil.h" #include "libavutil/common.h" +#include "libavutil/frame.h" #include "libavutil/intreadwrite.h" #include "libavutil/log.h" #include "libavutil/mem_internal.h" #include "libavutil/pixfmt.h" #include "libavutil/pixdesc.h" +#include "libavutil/slicethread.h" #include "libavutil/ppc/util_altivec.h" #define STR(s) AV_TOSTRING(s) // AV_STRINGIFY is too long @@ -80,6 +82,19 @@ typedef enum SwsAlphaBlend { SWS_ALPHA_BLEND_NB, } SwsAlphaBlend; +typedef struct Range { + unsigned int start; + unsigned int len; +} Range; + +typedef struct RangeList { + Range *ranges; + unsigned int nb_ranges; + int ranges_allocated; +} RangeList; + +int ff_range_add(RangeList *r, unsigned int start, unsigned int len); + typedef int (*SwsFunc)(struct SwsContext *context, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]); @@ -286,6 +301,15 @@ typedef struct SwsContext { */ const AVClass *av_class; + AVSliceThread *slicethread; + struct SwsContext **slice_ctx; + int *slice_err; + int nb_slice_ctx; + + // values passed to current sws_receive_slice() call + unsigned int dst_slice_start; + unsigned int dst_slice_height; + /** * Note that src, dst, srcStride, dstStride will be copied in the * sws_scale() wrapper so they can be freely modified here. @@ -311,8 +335,14 @@ typedef struct SwsContext { int chrDstVSubSample; ///< Binary logarithm of vertical subsampling factor between luma/alpha and chroma planes in destination image. int vChrDrop; ///< Binary logarithm of extra vertical subsampling factor in source image chroma planes specified by user. int sliceDir; ///< Direction that slices are fed to the scaler (1 = top-to-bottom, -1 = bottom-to-top). + int nb_threads; ///< Number of threads used for scaling double param[2]; ///< Input parameters for scaling algorithms that need them. + AVFrame *frame_src; + AVFrame *frame_dst; + + RangeList src_ranges; + /* The cascaded_* fields allow spliting a scaler task into multiple * sequential steps, this is for example used to limit the maximum * downscaling factor that needs to be supported in one scaler. @@ -638,6 +668,8 @@ typedef struct SwsContext { // then passed as input to further conversion uint8_t *xyz_scratch; unsigned int xyz_scratch_allocated; + + unsigned int dst_slice_align; } SwsContext; //FIXME check init (where 0) @@ -1061,6 +1093,9 @@ void ff_init_vscale_pfn(SwsContext *c, yuv2planar1_fn yuv2plane1, yuv2planarX_fn yuv2interleavedX_fn yuv2nv12cX, yuv2packed1_fn yuv2packed1, yuv2packed2_fn yuv2packed2, yuv2packedX_fn yuv2packedX, yuv2anyX_fn yuv2anyX, int use_mmx); +void ff_sws_slice_worker(void *priv, int jobnr, int threadnr, + int nb_jobs, int nb_threads); + //number of extra lines to process #define MAX_LINES_AHEAD 4 diff --git a/chromium/third_party/ffmpeg/libswscale/swscale_unscaled.c b/chromium/third_party/ffmpeg/libswscale/swscale_unscaled.c index c83af8bb070..7cb2a62f07f 100644 --- a/chromium/third_party/ffmpeg/libswscale/swscale_unscaled.c +++ b/chromium/third_party/ffmpeg/libswscale/swscale_unscaled.c @@ -2009,6 +2009,7 @@ void ff_get_unscaled_swscale(SwsContext *c) srcFormat == AV_PIX_FMT_YUVA420P) && isAnyRGB(dstFormat) && !(flags & SWS_ACCURATE_RND) && (c->dither == SWS_DITHER_BAYER || c->dither == SWS_DITHER_AUTO) && !(dstH & 1)) { c->convert_unscaled = ff_yuv2rgb_get_func_ptr(c); + c->dst_slice_align = 2; } /* yuv420p1x_to_p01x */ if ((srcFormat == AV_PIX_FMT_YUV420P10 || srcFormat == AV_PIX_FMT_YUVA420P10 || @@ -2028,6 +2029,7 @@ void ff_get_unscaled_swscale(SwsContext *c) (dstFormat == AV_PIX_FMT_YUV420P || dstFormat == AV_PIX_FMT_YUVA420P) && !(flags & SWS_BITEXACT)) { c->convert_unscaled = yvu9ToYv12Wrapper; + c->dst_slice_align = 4; } /* bgr24toYV12 */ diff --git a/chromium/third_party/ffmpeg/libswscale/utils.c b/chromium/third_party/ffmpeg/libswscale/utils.c index 176fc6fd63e..25051ead72f 100644 --- a/chromium/third_party/ffmpeg/libswscale/utils.c +++ b/chromium/third_party/ffmpeg/libswscale/utils.c @@ -49,6 +49,7 @@ #include "libavutil/mathematics.h" #include "libavutil/opt.h" #include "libavutil/pixdesc.h" +#include "libavutil/slicethread.h" #include "libavutil/thread.h" #include "libavutil/aarch64/cpu.h" #include "libavutil/ppc/cpu.h" @@ -871,6 +872,18 @@ int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4], const AVPixFmtDescriptor *desc_src; int need_reinit = 0; + if (c->nb_slice_ctx) { + for (int i = 0; i < c->nb_slice_ctx; i++) { + int ret = sws_setColorspaceDetails(c->slice_ctx[i], inv_table, + srcRange, table, dstRange, + brightness, contrast, saturation); + if (ret < 0) + return ret; + } + + return 0; + } + handle_formats(c); desc_dst = av_pix_fmt_desc_get(c->dstFormat); desc_src = av_pix_fmt_desc_get(c->srcFormat); @@ -1005,6 +1018,12 @@ int sws_getColorspaceDetails(struct SwsContext *c, int **inv_table, if (!c ) return -1; + if (c->nb_slice_ctx) { + return sws_getColorspaceDetails(c->slice_ctx[0], inv_table, srcRange, + table, dstRange, brightness, contrast, + saturation); + } + *inv_table = c->srcColorspaceTable; *table = c->dstColorspaceTable; *srcRange = range_override_needed(c->srcFormat) ? 1 : c->srcRange; @@ -1170,6 +1189,58 @@ static enum AVPixelFormat alphaless_fmt(enum AVPixelFormat fmt) } } +static int context_init_threaded(SwsContext *c, + SwsFilter *src_filter, SwsFilter *dst_filter) +{ + int ret; + + ret = avpriv_slicethread_create(&c->slicethread, (void*)c, + ff_sws_slice_worker, NULL, c->nb_threads); + if (ret == AVERROR(ENOSYS)) { + c->nb_threads = 1; + return 0; + } else if (ret < 0) + return ret; + + c->nb_threads = ret; + + c->slice_ctx = av_mallocz_array(c->nb_threads, sizeof(*c->slice_ctx)); + c->slice_err = av_mallocz_array(c->nb_threads, sizeof(*c->slice_err)); + if (!c->slice_ctx || !c->slice_err) + return AVERROR(ENOMEM); + + for (int i = 0; i < c->nb_threads; i++) { + c->slice_ctx[i] = sws_alloc_context(); + if (!c->slice_ctx[i]) + return AVERROR(ENOMEM); + + ret = av_opt_copy((void*)c->slice_ctx[i], (void*)c); + if (ret < 0) + return ret; + + c->slice_ctx[i]->nb_threads = 1; + + ret = sws_init_context(c->slice_ctx[i], src_filter, dst_filter); + if (ret < 0) + return ret; + + c->nb_slice_ctx++; + + if (c->slice_ctx[i]->dither == SWS_DITHER_ED) { + av_log(c, AV_LOG_VERBOSE, + "Error-diffusion dither is in use, scaling will be single-threaded."); + break; + } + } + + c->frame_src = av_frame_alloc(); + c->frame_dst = av_frame_alloc(); + if (!c->frame_src || !c->frame_dst) + return AVERROR(ENOMEM); + + return 0; +} + av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter) { @@ -1192,6 +1263,13 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter, static const float float_mult = 1.0f / 255.0f; static AVOnce rgb2rgb_once = AV_ONCE_INIT; + if (c->nb_threads != 1) { + ret = context_init_threaded(c, srcFilter, dstFilter); + if (ret < 0 || c->nb_threads > 1) + return ret; + // threading disabled in this build, init as single-threaded + } + cpu_flags = av_get_cpu_flags(); flags = c->flags; emms_c(); @@ -1300,6 +1378,8 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter, av_pix_fmt_get_chroma_sub_sample(srcFormat, &c->chrSrcHSubSample, &c->chrSrcVSubSample); av_pix_fmt_get_chroma_sub_sample(dstFormat, &c->chrDstHSubSample, &c->chrDstVSubSample); + c->dst_slice_align = 1 << c->chrDstVSubSample; + if (isAnyRGB(dstFormat) && !(flags&SWS_FULL_CHR_H_INT)) { if (dstW&1) { av_log(c, AV_LOG_DEBUG, "Forcing full internal H chroma due to odd output size\n"); @@ -1424,6 +1504,11 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter, if (!FF_ALLOCZ_TYPED_ARRAY(c->formatConvBuffer, FFALIGN(srcW * 2 + 78, 16) * 2)) goto nomem; + c->frame_src = av_frame_alloc(); + c->frame_dst = av_frame_alloc(); + if (!c->frame_src || !c->frame_dst) + goto nomem; + c->srcBpc = desc_src->comp[0].depth; if (c->srcBpc < 8) c->srcBpc = 8; @@ -2247,9 +2332,21 @@ void sws_freeContext(SwsContext *c) if (!c) return; + for (i = 0; i < c->nb_slice_ctx; i++) + sws_freeContext(c->slice_ctx[i]); + av_freep(&c->slice_ctx); + av_freep(&c->slice_err); + + avpriv_slicethread_free(&c->slicethread); + for (i = 0; i < 4; i++) av_freep(&c->dither_error[i]); + av_frame_free(&c->frame_src); + av_frame_free(&c->frame_dst); + + av_freep(&c->src_ranges.ranges); + av_freep(&c->vLumFilter); av_freep(&c->vChrFilter); av_freep(&c->hLumFilter); @@ -2364,3 +2461,63 @@ struct SwsContext *sws_getCachedContext(struct SwsContext *context, int srcW, } return context; } + +int ff_range_add(RangeList *rl, unsigned int start, unsigned int len) +{ + Range *tmp; + unsigned int idx; + + /* find the first existing range after the new one */ + for (idx = 0; idx < rl->nb_ranges; idx++) + if (rl->ranges[idx].start > start) + break; + + /* check for overlap */ + if (idx > 0) { + Range *prev = &rl->ranges[idx - 1]; + if (prev->start + prev->len > start) + return AVERROR(EINVAL); + } + if (idx < rl->nb_ranges) { + Range *next = &rl->ranges[idx]; + if (start + len > next->start) + return AVERROR(EINVAL); + } + + tmp = av_fast_realloc(rl->ranges, &rl->ranges_allocated, + (rl->nb_ranges + 1) * sizeof(*rl->ranges)); + if (!tmp) + return AVERROR(ENOMEM); + rl->ranges = tmp; + + memmove(rl->ranges + idx + 1, rl->ranges + idx, + sizeof(*rl->ranges) * (rl->nb_ranges - idx)); + rl->ranges[idx].start = start; + rl->ranges[idx].len = len; + rl->nb_ranges++; + + /* merge ranges */ + if (idx > 0) { + Range *prev = &rl->ranges[idx - 1]; + Range *cur = &rl->ranges[idx]; + if (prev->start + prev->len == cur->start) { + prev->len += cur->len; + memmove(rl->ranges + idx - 1, rl->ranges + idx, + sizeof(*rl->ranges) * (rl->nb_ranges - idx)); + rl->nb_ranges--; + idx--; + } + } + if (idx < rl->nb_ranges - 1) { + Range *cur = &rl->ranges[idx]; + Range *next = &rl->ranges[idx + 1]; + if (cur->start + cur->len == next->start) { + cur->len += next->len; + memmove(rl->ranges + idx, rl->ranges + idx + 1, + sizeof(*rl->ranges) * (rl->nb_ranges - idx - 1)); + rl->nb_ranges--; + } + } + + return 0; +} diff --git a/chromium/third_party/ffmpeg/libswscale/version.h b/chromium/third_party/ffmpeg/libswscale/version.h index f86a8049c16..0d3b7cf3631 100644 --- a/chromium/third_party/ffmpeg/libswscale/version.h +++ b/chromium/third_party/ffmpeg/libswscale/version.h @@ -27,7 +27,7 @@ #include "libavutil/version.h" #define LIBSWSCALE_VERSION_MAJOR 6 -#define LIBSWSCALE_VERSION_MINOR 0 +#define LIBSWSCALE_VERSION_MINOR 1 #define LIBSWSCALE_VERSION_MICRO 100 #define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \ diff --git a/chromium/third_party/ffmpeg/tools/Makefile b/chromium/third_party/ffmpeg/tools/Makefile index 82baa8eadb4..f4d1327b9f4 100644 --- a/chromium/third_party/ffmpeg/tools/Makefile +++ b/chromium/third_party/ffmpeg/tools/Makefile @@ -1,4 +1,4 @@ -TOOLS = enum_options qt-faststart trasher uncoded_frame +TOOLS = enum_options qt-faststart scale_slice_test trasher uncoded_frame TOOLS-$(CONFIG_LIBMYSOFA) += sofa2wavs TOOLS-$(CONFIG_ZLIB) += cws2fws @@ -17,6 +17,9 @@ tools/target_dem_fuzzer.o: tools/target_dem_fuzzer.c tools/target_io_dem_fuzzer.o: tools/target_dem_fuzzer.c $(COMPILE_C) -DIO_FLAT=0 +tools/venc_data_dump$(EXESUF): tools/decode_simple.o +tools/scale_slice_test$(EXESUF): tools/decode_simple.o + OUTDIRS += tools clean:: diff --git a/chromium/third_party/ffmpeg/tools/decode_simple.c b/chromium/third_party/ffmpeg/tools/decode_simple.c new file mode 100644 index 00000000000..b679fd7ce6f --- /dev/null +++ b/chromium/third_party/ffmpeg/tools/decode_simple.c @@ -0,0 +1,157 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* shared code for simple demux/decode tools */ + +#include <stdlib.h> +#include <string.h> + +#include "decode_simple.h" + +#include "libavformat/avformat.h" + +#include "libavcodec/avcodec.h" +#include "libavcodec/packet.h" + +#include "libavutil/dict.h" +#include "libavutil/error.h" +#include "libavutil/frame.h" + +static int decode_read(DecodeContext *dc, int flush) +{ + const int ret_done = flush ? AVERROR_EOF : AVERROR(EAGAIN); + int ret = 0; + + while (ret >= 0 && + (dc->max_frames == 0 || dc->decoder->frame_number < dc->max_frames)) { + ret = avcodec_receive_frame(dc->decoder, dc->frame); + if (ret < 0) { + if (ret == AVERROR_EOF) { + int err = dc->process_frame(dc, NULL); + if (err < 0) + return err; + } + + return (ret == ret_done) ? 0 : ret; + } + + ret = dc->process_frame(dc, dc->frame); + av_frame_unref(dc->frame); + if (ret < 0) + return ret; + + if (dc->max_frames && dc->decoder->frame_number == dc->max_frames) + return 1; + } + + return (dc->max_frames == 0 || dc->decoder->frame_number < dc->max_frames) ? 0 : 1; +} + +int ds_run(DecodeContext *dc) +{ + int ret; + + ret = avcodec_open2(dc->decoder, NULL, &dc->decoder_opts); + if (ret < 0) + return ret; + + while (ret >= 0) { + ret = av_read_frame(dc->demuxer, dc->pkt); + if (ret < 0) + goto flush; + if (dc->pkt->stream_index != dc->stream->index) { + av_packet_unref(dc->pkt); + continue; + } + + ret = avcodec_send_packet(dc->decoder, dc->pkt); + if (ret < 0) { + fprintf(stderr, "Error decoding: %d\n", ret); + return ret; + } + av_packet_unref(dc->pkt); + + ret = decode_read(dc, 0); + if (ret < 0) { + fprintf(stderr, "Error decoding: %d\n", ret); + return ret; + } else if (ret > 0) + return 0; + } + +flush: + avcodec_send_packet(dc->decoder, NULL); + ret = decode_read(dc, 1); + if (ret < 0) { + fprintf(stderr, "Error flushing: %d\n", ret); + return ret; + } + + return 0; +} + +void ds_free(DecodeContext *dc) +{ + av_dict_free(&dc->decoder_opts); + + av_frame_free(&dc->frame); + av_packet_free(&dc->pkt); + + avcodec_free_context(&dc->decoder); + avformat_close_input(&dc->demuxer); +} + +int ds_open(DecodeContext *dc, const char *url, int stream_idx) +{ + const AVCodec *codec; + int ret; + + memset(dc, 0, sizeof(*dc)); + + dc->pkt = av_packet_alloc(); + dc->frame = av_frame_alloc(); + if (!dc->pkt || !dc->frame) { + ret = AVERROR(ENOMEM); + goto fail; + } + + ret = avformat_open_input(&dc->demuxer, url, NULL, NULL); + if (ret < 0) { + fprintf(stderr, "Error opening input file: %d\n", ret); + return ret; + } + + if (stream_idx < 0 || stream_idx >= dc->demuxer->nb_streams) + return AVERROR(EINVAL); + + dc->stream = dc->demuxer->streams[stream_idx]; + + codec = avcodec_find_decoder(dc->stream->codecpar->codec_id); + if (!codec) + return AVERROR_DECODER_NOT_FOUND; + + dc->decoder = avcodec_alloc_context3(codec); + if (!dc->decoder) + return AVERROR(ENOMEM); + + return 0; + +fail: + ds_free(dc); + return ret; +} diff --git a/chromium/third_party/ffmpeg/tools/decode_simple.h b/chromium/third_party/ffmpeg/tools/decode_simple.h new file mode 100644 index 00000000000..d480489a6c5 --- /dev/null +++ b/chromium/third_party/ffmpeg/tools/decode_simple.h @@ -0,0 +1,53 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* shared code for simple demux/decode tools */ + +#ifndef DECODE_SIMPLE_H +#define DECODE_SIMPLE_H + +#include "libavformat/avformat.h" + +#include "libavcodec/avcodec.h" +#include "libavcodec/packet.h" + +#include "libavutil/dict.h" +#include "libavutil/frame.h" + + +typedef struct DecodeContext { + AVFormatContext *demuxer; + AVStream *stream; + AVCodecContext *decoder; + + AVPacket *pkt; + AVFrame *frame; + + int (*process_frame)(struct DecodeContext *dc, AVFrame *frame); + void *opaque; + + AVDictionary *decoder_opts; + int max_frames; +} DecodeContext; + +int ds_open(DecodeContext *dc, const char *url, int stream_idx); +void ds_free(DecodeContext *dc); + +int ds_run(DecodeContext *dc); + +#endif /* DECODE_SIMPLE_H */ diff --git a/chromium/third_party/ffmpeg/tools/dvd2concat b/chromium/third_party/ffmpeg/tools/dvd2concat index 8effee86b9f..ef04a87d05e 100755 --- a/chromium/third_party/ffmpeg/tools/dvd2concat +++ b/chromium/third_party/ffmpeg/tools/dvd2concat @@ -37,7 +37,8 @@ normally contains a directory named B<VIDEO_TS>. It must not be encrypted with CSS. I<file.concat> is the output file. It can be used as an input to ffmpeg. -It will require the B<-safe 0> option. +It will require the B<-safe 0> and +B<-protocol_whitelist file,subfile,concat> options. =cut @@ -116,10 +117,12 @@ for my $cell (@{$track->{cell}}) { my $file = @files == 1 ? $files[0] : "concat:" . join("|", @files); my $start = $off << 11; my $end = ($off + $size) << 11; - $file = "subfile,,start,${start},end,${end},,:$file"; my $dur = int(1000 * $cell->{length}); - $concat .= sprintf "\nfile '%s'\nduration %02d:%02d:%02d.%03d\n", $file, + $concat .= "\nfile 'subfile:$file'\n"; + $concat .= "option start $start\n"; + $concat .= "option end $end\n"; + $concat .= sprintf "duration %02d:%02d:%02d.%03d\n", int($dur / 3600000), int($dur / 60000) % 60, int($dur / 1000) % 60, $dur % 1000; } diff --git a/chromium/third_party/ffmpeg/tools/scale_slice_test.c b/chromium/third_party/ffmpeg/tools/scale_slice_test.c new file mode 100644 index 00000000000..d869eaae740 --- /dev/null +++ b/chromium/third_party/ffmpeg/tools/scale_slice_test.c @@ -0,0 +1,190 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include <stdio.h> +#include <stdint.h> +#include <stdlib.h> + +#include "decode_simple.h" + +#include "libavutil/common.h" +#include "libavutil/pixdesc.h" +#include "libavutil/error.h" +#include "libavutil/lfg.h" +#include "libavutil/random_seed.h" +#include "libavutil/video_enc_params.h" + +#include "libavformat/avformat.h" + +#include "libavcodec/avcodec.h" + +#include "libswscale/swscale.h" + +typedef struct PrivData { + unsigned int random_seed; + AVLFG lfg; + + struct SwsContext *scaler; + + int v_shift_dst, h_shift_dst; + int v_shift_src, h_shift_src; + + AVFrame *frame_ref; + AVFrame *frame_dst; +} PrivData; + +static int process_frame(DecodeContext *dc, AVFrame *frame) +{ + PrivData *pd = dc->opaque; + int slice_start = 0; + int ret; + + if (!frame) + return 0; + + if (!pd->scaler) { + pd->scaler = sws_getContext(frame->width, frame->height, frame->format, + pd->frame_ref->width, pd->frame_ref->height, + pd->frame_ref->format, 0, NULL, NULL, NULL); + if (!pd->scaler) + return AVERROR(ENOMEM); + + av_pix_fmt_get_chroma_sub_sample(frame->format, &pd->h_shift_src, &pd->v_shift_src); + } + + /* scale the whole input frame as reference */ + ret = sws_scale(pd->scaler, (const uint8_t **)frame->data, frame->linesize, 0, frame->height, + pd->frame_ref->data, pd->frame_ref->linesize); + if (ret < 0) + return ret; + + /* scale slices with randomly generated heights */ + while (slice_start < frame->height) { + int slice_height; + const uint8_t *src[4]; + + slice_height = av_lfg_get(&pd->lfg) % (frame->height - slice_start); + slice_height = FFALIGN(FFMAX(1, slice_height), 1 << pd->v_shift_src); + + for (int j = 0; j < FF_ARRAY_ELEMS(src) && frame->data[j]; j++) { + int shift = (j == 1 || j == 2) ? pd->v_shift_src : 0; + src[j] = frame->data[j] + frame->linesize[j] * (slice_start >> shift); + } + + ret = sws_scale(pd->scaler, src, frame->linesize, slice_start, slice_height, + pd->frame_dst->data, pd->frame_dst->linesize); + if (ret < 0) + return ret; + + slice_start += slice_height; + } + + /* compare the two results */ + for (int i = 0; i < 4 && pd->frame_ref->data[i]; i++) { + int shift = (i == 1 || i == 2) ? pd->v_shift_dst : 0; + + if (memcmp(pd->frame_ref->data[i], pd->frame_dst->data[i], + pd->frame_ref->linesize[i] * (pd->frame_ref->height >> shift))) { + fprintf(stderr, "mismatch frame %d seed %u\n", + dc->decoder->frame_number - 1, pd->random_seed); + return AVERROR(EINVAL); + } + } + + return 0; +} + +int main(int argc, char **argv) +{ + PrivData pd; + DecodeContext dc; + + int width, height; + enum AVPixelFormat pix_fmt; + const char *filename; + int ret = 0; + + if (argc <= 4) { + fprintf(stderr, + "Usage: %s <input file> <dst width> <dst height> <dst pixfmt> [<random seed>] \n", + argv[0]); + return 0; + } + + memset(&pd, 0, sizeof(pd)); + + filename = argv[1]; + width = strtol(argv[2], NULL, 0); + height = strtol(argv[3], NULL, 0); + pix_fmt = av_get_pix_fmt(argv[4]); + + /* init RNG for generating slice sizes */ + if (argc >= 6) + pd.random_seed = strtoul(argv[5], NULL, 0); + else + pd.random_seed = av_get_random_seed(); + + av_lfg_init(&pd.lfg, pd.random_seed); + + av_pix_fmt_get_chroma_sub_sample(pix_fmt, &pd.h_shift_dst, &pd.v_shift_dst); + + /* allocate the frames for scaler output */ + for (int i = 0; i < 2; i++) { + AVFrame *frame = av_frame_alloc(); + if (!frame) { + fprintf(stderr, "Error allocating frames\n"); + return AVERROR(ENOMEM); + } + + frame->width = width; + frame->height = height; + frame->format = pix_fmt; + + ret = av_frame_get_buffer(frame, 0); + if (ret < 0) { + fprintf(stderr, "Error allocating frame data\n"); + return ret; + } + + /* make sure the padding is zeroed */ + for (int j = 0; j < 4 && frame->data[j]; j++) { + int shift = (j == 1 || j == 2) ? pd.v_shift_dst : 0; + memset(frame->data[j], 0, + frame->linesize[j] * (height >> shift)); + } + if (i) pd.frame_ref = frame; + else pd.frame_dst = frame; + } + + ret = ds_open(&dc, filename, 0); + if (ret < 0) { + fprintf(stderr, "Error opening the file\n"); + return ret; + } + + dc.process_frame = process_frame; + dc.opaque = &pd; + + ret = ds_run(&dc); + + av_frame_free(&pd.frame_dst); + av_frame_free(&pd.frame_ref); + sws_freeContext(pd.scaler); + ds_free(&dc); + return ret; +} diff --git a/chromium/third_party/ffmpeg/tools/target_dec_fuzzer.c b/chromium/third_party/ffmpeg/tools/target_dec_fuzzer.c index 0195d8910e5..c0e59983c4a 100644 --- a/chromium/third_party/ffmpeg/tools/target_dec_fuzzer.c +++ b/chromium/third_party/ffmpeg/tools/target_dec_fuzzer.c @@ -441,6 +441,10 @@ maximums_reached: got_frame = 0; av_frame_unref(frame); decode_handler(ctx, frame, &got_frame, avpkt); + + nb_samples += frame->nb_samples; + if (nb_samples > maxsamples) + break; } while (got_frame == 1 && it++ < maxiteration); fprintf(stderr, "pixels decoded: %"PRId64", samples decoded: %"PRId64", iterations: %d\n", ec_pixels, nb_samples, it); diff --git a/chromium/third_party/ffmpeg/tools/venc_data_dump.c b/chromium/third_party/ffmpeg/tools/venc_data_dump.c index 3a6ce94268f..3a3543f80f5 100644 --- a/chromium/third_party/ffmpeg/tools/venc_data_dump.c +++ b/chromium/third_party/ffmpeg/tools/venc_data_dump.c @@ -20,6 +20,8 @@ #include <stdint.h> #include <stdlib.h> +#include "decode_simple.h" + #include "libavutil/common.h" #include "libavutil/dict.h" #include "libavutil/error.h" @@ -29,85 +31,44 @@ #include "libavcodec/avcodec.h" -static int decode_read(AVCodecContext *decoder, AVFrame *frame, int flush, int max_frames) +static int process_frame(DecodeContext *dc, AVFrame *frame) { - const int ret_done = flush ? AVERROR_EOF : AVERROR(EAGAIN); - int ret = 0; - - while (ret >= 0 && - (max_frames == 0 || decoder->frame_number < max_frames)) { - AVFrameSideData *sd; + AVFrameSideData *sd; - ret = avcodec_receive_frame(decoder, frame); - if (ret < 0) - return (ret == ret_done) ? 0 : ret; + if (!frame) + return 0; - fprintf(stdout, "frame %d\n", decoder->frame_number - 1); + fprintf(stdout, "frame %d\n", dc->decoder->frame_number - 1); - sd = av_frame_get_side_data(frame, AV_FRAME_DATA_VIDEO_ENC_PARAMS); - if (sd) { - AVVideoEncParams *par = (AVVideoEncParams*)sd->data; + sd = av_frame_get_side_data(frame, AV_FRAME_DATA_VIDEO_ENC_PARAMS); + if (sd) { + AVVideoEncParams *par = (AVVideoEncParams*)sd->data; - fprintf(stdout, "AVVideoEncParams %d\n", par->type); - fprintf(stdout, "qp %d\n", par->qp); - for (int i = 0; i < FF_ARRAY_ELEMS(par->delta_qp); i++) - for (int j = 0; j < FF_ARRAY_ELEMS(par->delta_qp[i]); j++) { - if (par->delta_qp[i][j]) - fprintf(stdout, "delta_qp[%d][%d] %"PRId32"\n", i, j, par->delta_qp[i][j]); - } + fprintf(stdout, "AVVideoEncParams %d\n", par->type); + fprintf(stdout, "qp %d\n", par->qp); + for (int i = 0; i < FF_ARRAY_ELEMS(par->delta_qp); i++) + for (int j = 0; j < FF_ARRAY_ELEMS(par->delta_qp[i]); j++) { + if (par->delta_qp[i][j]) + fprintf(stdout, "delta_qp[%d][%d] %"PRId32"\n", i, j, par->delta_qp[i][j]); + } - if (par->nb_blocks) { - fprintf(stdout, "nb_blocks %d\n", par->nb_blocks); - for (int i = 0; i < par->nb_blocks; i++) { - AVVideoBlockParams *b = av_video_enc_params_block(par, i); + if (par->nb_blocks) { + fprintf(stdout, "nb_blocks %d\n", par->nb_blocks); + for (int i = 0; i < par->nb_blocks; i++) { + AVVideoBlockParams *b = av_video_enc_params_block(par, i); - fprintf(stdout, "block %d %d:%d %dx%d %"PRId32"\n", - i, b->src_x, b->src_y, b->w, b->h, b->delta_qp); - } + fprintf(stdout, "block %d %d:%d %dx%d %"PRId32"\n", + i, b->src_x, b->src_y, b->w, b->h, b->delta_qp); } } - - av_frame_unref(frame); - - if (max_frames && decoder->frame_number == max_frames) - return 1; } - return (max_frames == 0 || decoder->frame_number < max_frames) ? 0 : 1; -} - -static int decoder_init(AVFormatContext *demuxer, int stream_idx, - AVCodecContext **dec, AVDictionary **opts) -{ - const AVCodec *codec; - int ret; - - if (stream_idx < 0 || stream_idx >= demuxer->nb_streams) - return AVERROR(EINVAL); - - codec = avcodec_find_decoder(demuxer->streams[stream_idx]->codecpar->codec_id); - if (!codec) - return AVERROR_DECODER_NOT_FOUND; - - *dec = avcodec_alloc_context3(codec); - if (!*dec) - return AVERROR(ENOMEM); - - ret = avcodec_open2(*dec, NULL, opts); - if (ret < 0) - return ret; - return 0; } int main(int argc, char **argv) { - AVFormatContext *demuxer = NULL; - AVCodecContext *decoder = NULL; - AVDictionary *opts = NULL; - - AVPacket *pkt = NULL; - AVFrame *frame = NULL; + DecodeContext dc; unsigned int stream_idx, max_frames; const char *filename, *thread_type = NULL, *nb_threads = NULL; @@ -126,70 +87,23 @@ int main(int argc, char **argv) thread_type = argv[5]; } - ret = av_dict_set(&opts, "threads", nb_threads, 0); - ret |= av_dict_set(&opts, "thread_type", thread_type, 0); - ret |= av_dict_set(&opts, "export_side_data", "venc_params", 0); - - ret = avformat_open_input(&demuxer, filename, NULL, NULL); - if (ret < 0) { - fprintf(stderr, "Error opening input file: %d\n", ret); - return ret; - } - - ret = decoder_init(demuxer, stream_idx, &decoder, &opts); - if (ret < 0) { - fprintf(stderr, "Error initializing decoder\n"); - goto finish; - } - - pkt = av_packet_alloc(); - frame = av_frame_alloc(); - if (!pkt || !frame) { - ret = AVERROR(ENOMEM); + ret = ds_open(&dc, filename, stream_idx); + if (ret < 0) goto finish; - } - while (ret >= 0) { - ret = av_read_frame(demuxer, pkt); - if (ret < 0) - goto flush; - if (pkt->stream_index != stream_idx) { - av_packet_unref(pkt); - continue; - } + dc.process_frame = process_frame; + dc.max_frames = max_frames; - ret = avcodec_send_packet(decoder, pkt); - if (ret < 0) { - fprintf(stderr, "Error decoding: %d\n", ret); - goto finish; - } - av_packet_unref(pkt); - - ret = decode_read(decoder, frame, 0, max_frames); - if (ret < 0) { - fprintf(stderr, "Error decoding: %d\n", ret); - goto finish; - } else if (ret > 0) { - ret = 0; - goto finish; - } - } + ret = av_dict_set(&dc.decoder_opts, "threads", nb_threads, 0); + ret |= av_dict_set(&dc.decoder_opts, "thread_type", thread_type, 0); + ret |= av_dict_set(&dc.decoder_opts, "export_side_data", "venc_params", 0); -flush: - avcodec_send_packet(decoder, NULL); - ret = decode_read(decoder, frame, 1, max_frames); - if (ret < 0) { - fprintf(stderr, "Error flushing: %d\n", ret); + if (ret < 0) goto finish; - } - ret = 0; -finish: - av_dict_free(&opts); - av_packet_free(&pkt); - av_frame_free(&frame); - avcodec_free_context(&decoder); - avformat_close_input(&demuxer); + ret = ds_run(&dc); +finish: + ds_free(&dc); return ret; } |