Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added the libzimg support #1481

Merged
merged 8 commits into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

* Build FFmpeg with zimg to enable zscale filter ([pull #1481](https://github.com/bytedeco/javacpp-presets/pull/1481))
* Enable PulseAudio support for FFmpeg on Linux ([pull #1472](https://github.com/bytedeco/javacpp-presets/pull/1472))
* Virtualize `btCollisionWorld`, `btOverlapFilterCallback`, `btOverlapCallback` from Bullet Physics SDK ([pull #1475](https://github.com/bytedeco/javacpp-presets/pull/1475))
* Upgrade presets for PyTorch 2.2.1 ([pull #1466](https://github.com/bytedeco/javacpp-presets/pull/1466))
Expand Down
165 changes: 151 additions & 14 deletions ffmpeg/cppbuild.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if [[ -z "$PLATFORM" ]]; then
fi

DISABLE="--disable-iconv --disable-opencl --disable-sdl2 --disable-bzlib --disable-lzma --disable-linux-perf --disable-xlib"
ENABLE="--enable-shared --enable-version3 --enable-runtime-cpudetect --enable-zlib --enable-libmp3lame --enable-libspeex --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-openssl --enable-libopenh264 --enable-libvpx --enable-libfreetype --enable-libopus --enable-libxml2 --enable-libsrt --enable-libwebp --enable-libaom --enable-libsvtav1"
ENABLE="--enable-shared --enable-version3 --enable-runtime-cpudetect --enable-zlib --enable-libmp3lame --enable-libspeex --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-openssl --enable-libopenh264 --enable-libvpx --enable-libfreetype --enable-libopus --enable-libxml2 --enable-libsrt --enable-libwebp --enable-libaom --enable-libsvtav1 --enable-libzimg"
ENABLE_VULKAN="--enable-vulkan --enable-hwaccel=h264_vulkan --enable-hwaccel=hevc_vulkan --enable-hwaccel=av1_vulkan"

if [[ "$EXTENSION" == *gpl ]]; then
Expand Down Expand Up @@ -47,6 +47,7 @@ LIBSRT_VERSION=1.5.3
WEBP_VERSION=1.3.2
AOMAV1_VERSION=3.8.0
SVTAV1_VERSION=1.8.0
ZIMG_VERSION=3.0.5
FFMPEG_VERSION=6.1.1
download https://download.videolan.org/contrib/nasm/nasm-$NASM_VERSION.tar.gz nasm-$NASM_VERSION.tar.gz
download http://zlib.net/$ZLIB.tar.gz $ZLIB.tar.gz
Expand All @@ -69,6 +70,7 @@ download https://github.com/FFmpeg/nv-codec-headers/archive/n$NVCODEC_VERSION.ta
download https://github.com/webmproject/libwebp/archive/refs/tags/v$WEBP_VERSION.tar.gz libwebp-$WEBP_VERSION.tar.gz
download https://storage.googleapis.com/aom-releases/libaom-$AOMAV1_VERSION.tar.gz aom-$AOMAV1_VERSION.tar.gz
download https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v$SVTAV1_VERSION/SVT-AV1-v$SVTAV1_VERSION.tar.gz SVT-AV1-$SVTAV1_VERSION.tar.gz
download https://github.com/sekrit-twc/zimg/archive/refs/tags/release-$ZIMG_VERSION.tar.gz zimg-release-$ZIMG_VERSION.tar.gz
download http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2 ffmpeg-$FFMPEG_VERSION.tar.bz2

mkdir -p $PLATFORM$EXTENSION
Expand All @@ -95,6 +97,7 @@ tar --totals -xzf ../$XML2.tar.gz
tar --totals -xzf ../libwebp-$WEBP_VERSION.tar.gz
tar --totals -xzf ../aom-$AOMAV1_VERSION.tar.gz
tar --totals -xzf ../SVT-AV1-$SVTAV1_VERSION.tar.gz
tar --totals -xzf ../zimg-release-$ZIMG_VERSION.tar.gz
tar --totals -xjf ../ffmpeg-$FFMPEG_VERSION.tar.bz2

if [[ "${ACLOCAL_PATH:-}" == C:\\msys64\\* ]]; then
Expand Down Expand Up @@ -132,10 +135,20 @@ case $PLATFORM in
export STRIP="$ANDROID_PREFIX-strip"
echo ""
echo "--------------------"
echo "Building zimg"
echo "--------------------"
echo ""
cd zimg-release-$ZIMG_VERSION
autoreconf -iv
./configure --prefix=$INSTALL_PATH --disable-frontend --disable-shared --with-pic --host=arm-linux
make -j $MAKEJ V=0
make install
echo ""
echo "--------------------"
echo "Building zlib"
echo "--------------------"
echo ""
cd $ZLIB
cd ../$ZLIB
./configure --prefix=$INSTALL_PATH --static --uname=arm-linux
make -j $MAKEJ V=0
make install
Expand Down Expand Up @@ -278,10 +291,20 @@ EOF
export STRIP="$ANDROID_PREFIX-strip"
echo ""
echo "--------------------"
echo "Building zimg"
echo "--------------------"
echo ""
cd zimg-release-$ZIMG_VERSION
autoreconf -iv
./configure --prefix=$INSTALL_PATH --disable-frontend --disable-shared --with-pic --host=aarch64-linux
make -j $MAKEJ V=0
make install
echo ""
echo "--------------------"
echo "Building zlib"
echo "--------------------"
echo ""
cd $ZLIB
cd ../$ZLIB
./configure --prefix=$INSTALL_PATH --static --uname=aarch64-linux
make -j $MAKEJ V=0
make install
Expand Down Expand Up @@ -423,10 +446,20 @@ EOF
export STRIP="$ANDROID_PREFIX-strip"
echo ""
echo "--------------------"
echo "Building zimg"
echo "--------------------"
echo ""
cd zimg-release-$ZIMG_VERSION
autoreconf -iv
./configure --prefix=$INSTALL_PATH --disable-frontend --disable-shared --with-pic --host=i686-linux
make -j $MAKEJ V=0
make install
echo ""
echo "--------------------"
echo "Building zlib"
echo "--------------------"
echo ""
cd $ZLIB
cd ../$ZLIB
./configure --prefix=$INSTALL_PATH --static --uname=i686-linux
make -j $MAKEJ V=0
make install
Expand Down Expand Up @@ -565,10 +598,20 @@ EOF
export STRIP="$ANDROID_PREFIX-strip"
echo ""
echo "--------------------"
echo "Building zimg"
echo "--------------------"
echo ""
cd zimg-release-$ZIMG_VERSION
autoreconf -iv
./configure --prefix=$INSTALL_PATH --disable-frontend --disable-shared --with-pic --host=x86_64-linux
make -j $MAKEJ V=0
make install
echo ""
echo "--------------------"
echo "Building zlib"
echo "--------------------"
echo ""
cd $ZLIB
cd ../$ZLIB
./configure --prefix=$INSTALL_PATH --static --uname=x86_64-linux
make -j $MAKEJ V=0
make install
Expand Down Expand Up @@ -702,10 +745,20 @@ EOF
export AS="nasm"
echo ""
echo "--------------------"
echo "Building zimg"
echo "--------------------"
echo ""
cd zimg-release-$ZIMG_VERSION
autoreconf -iv
./configure --prefix=$INSTALL_PATH --host=i686-linux
make -j $MAKEJ V=0
make install
echo ""
echo "--------------------"
echo "Building zlib"
echo "--------------------"
echo ""
cd $ZLIB
cd ../$ZLIB
CC="gcc -m32 -fPIC" ./configure --prefix=$INSTALL_PATH --static
make -j $MAKEJ V=0
make install
Expand Down Expand Up @@ -841,10 +894,20 @@ EOF
export AS="nasm"
echo ""
echo "--------------------"
echo "Building zimg"
echo "--------------------"
echo ""
cd zimg-release-$ZIMG_VERSION
autoreconf -iv
./configure --prefix=$INSTALL_PATH --host=x86_64-linux
make -j $MAKEJ V=0
make install
echo ""
echo "--------------------"
echo "Building zlib"
echo "--------------------"
echo ""
cd $ZLIB
cd ../$ZLIB
CC="gcc -m64 -fPIC" ./configure --prefix=$INSTALL_PATH --static
make -j $MAKEJ V=0
make install
Expand Down Expand Up @@ -993,12 +1056,22 @@ EOF
echo "Detected non arm arch so cross compiling";
fi

echo ""
echo "--------------------"
echo "Building zimg"
echo "--------------------"
echo ""
cd zimg-release-$ZIMG_VERSION
autoreconf -iv
./configure --prefix=$INSTALL_PATH --disable-frontend --disable-shared --with-pic --host=arm-linux-gnueabihf
make -j $MAKEJ V=0
make install
echo ""
echo "--------------------"
echo "Building zlib"
echo "--------------------"
echo ""
cd $ZLIB
cd ../$ZLIB
CC="arm-linux-gnueabihf-gcc -fPIC" ./configure --prefix=$INSTALL_PATH --static
make -j $MAKEJ V=0
make install
Expand Down Expand Up @@ -1193,10 +1266,20 @@ EOF
HOST_ARCH="$(uname -m)"
echo ""
echo "--------------------"
echo "Building zimg"
echo "--------------------"
echo ""
cd zimg-release-$ZIMG_VERSION
autoreconf -iv
./configure --prefix=$INSTALL_PATH --disable-frontend --disable-shared --with-pic --host=aarch64-linux-gnu
make -j $MAKEJ V=0
make install
echo ""
echo "--------------------"
echo "Building zlib"
echo "--------------------"
echo ""
cd $ZLIB
cd ../$ZLIB
CC="aarch64-linux-gnu-gcc -fPIC" ./configure --prefix=$INSTALL_PATH --static
make -j $MAKEJ V=0
make install
Expand Down Expand Up @@ -1330,10 +1413,24 @@ EOF
MACHINE_TYPE=$( uname -m )
echo ""
echo "--------------------"
echo "Building zimg"
echo "--------------------"
echo ""
cd zimg-release-$ZIMG_VERSION
autoreconf -iv
if [[ "$MACHINE_TYPE" =~ ppc64 ]]; then
CC="gcc -m64 -fPIC" ./configure --prefix=$INSTALL_PATH
else
CC="powerpc64le-linux-gnu-gcc -m64 -fPIC" ./configure --prefix=$INSTALL_PATH --host=powerpc64le-linux-gnu
fi
make -j $MAKEJ V=0
make install
echo ""
echo "--------------------"
echo "Building zlib"
echo "--------------------"
echo ""
cd $ZLIB
cd ../$ZLIB
if [[ "$MACHINE_TYPE" =~ ppc64 ]]; then
CC="gcc -m64 -fPIC" ./configure --prefix=$INSTALL_PATH --static
else
Expand Down Expand Up @@ -1545,10 +1642,20 @@ EOF
export CPPFLAGS="$CFLAGS"
echo ""
echo "--------------------"
echo "Building zimg"
echo "--------------------"
echo ""
cd zimg-release-$ZIMG_VERSION
autoreconf -iv
./configure --prefix=$INSTALL_PATH --host=aarch64-apple-darwin
make -j $MAKEJ V=0
make install
echo ""
echo "--------------------"
echo "Building zlib"
echo "--------------------"
echo ""
cd $ZLIB
cd ../$ZLIB
CC="clang -arch arm64 -fPIC" ./configure --prefix=$INSTALL_PATH --static
make -j $MAKEJ V=0
make install
Expand Down Expand Up @@ -1670,10 +1777,20 @@ EOF
export AS="nasm"
echo ""
echo "--------------------"
echo "Building zimg"
echo "--------------------"
echo ""
cd zimg-release-$ZIMG_VERSION
autoreconf -iv
./configure --prefix=$INSTALL_PATH
make -j $MAKEJ V=0
make install
echo ""
echo "--------------------"
echo "Building zlib"
echo "--------------------"
echo ""
cd $ZLIB
cd ../$ZLIB
CC="clang -fPIC" ./configure --prefix=$INSTALL_PATH --static
make -j $MAKEJ V=0
make install
Expand Down Expand Up @@ -1791,12 +1908,22 @@ EOF
;;

windows-x86)
echo ""
echo "--------------------"
echo "Building zimg"
echo "--------------------"
echo ""
cd zimg-release-$ZIMG_VERSION
autoreconf -iv
./configure --prefix=$INSTALL_PATH
make -j $MAKEJ V=0
make install
echo ""
echo "--------------------"
echo "Building zlib"
echo "--------------------"
echo ""
cd $ZLIB
cd ../$ZLIB
make -j $MAKEJ install -fwin32/Makefile.gcc BINARY_PATH=$INSTALL_PATH/bin/ INCLUDE_PATH=$INSTALL_PATH/include/ LIBRARY_PATH=$INSTALL_PATH/lib/
echo ""
echo "--------------------"
Expand Down Expand Up @@ -1922,12 +2049,22 @@ EOF
;;

windows-x86_64)
echo ""
echo "--------------------"
echo "Building zimg"
echo "--------------------"
echo ""
cd zimg-release-$ZIMG_VERSION
autoreconf -iv
./configure --prefix=$INSTALL_PATH
make -j $MAKEJ V=0
make install
echo ""
echo "--------------------"
echo "Building zlib"
echo "--------------------"
echo ""
cd $ZLIB
cd ../$ZLIB
make -j $MAKEJ install -fwin32/Makefile.gcc BINARY_PATH=$INSTALL_PATH/bin/ INCLUDE_PATH=$INSTALL_PATH/include/ LIBRARY_PATH=$INSTALL_PATH/lib/
echo ""
echo "--------------------"
Expand Down
Loading