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 5 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
175 changes: 156 additions & 19 deletions ffmpeg/cppbuild.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ if [[ -z "$PLATFORM" ]]; then
exit
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"
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-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
ZIMGLIB=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-$ZIMGLIB.tar.gz zimg-$ZIMGLIB.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-$ZIMGLIB.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-$ZIMGLIB
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 @@ -265,7 +278,7 @@ EOF
cd ..
cd ../ffmpeg-$FFMPEG_VERSION
sedinplace 's/unsigned long int/unsigned int/g' libavdevice/v4l2.c
LDEXEFLAGS='-Wl,-rpath,\$$ORIGIN/' ./configure --prefix=.. $DISABLE $ENABLE --enable-jni --enable-mediacodec --enable-pthreads --enable-cross-compile --cross-prefix="$ANDROID_PREFIX-" --ar="$AR" --ranlib="$RANLIB" --cc="$CC" --strip="$STRIP" --sysroot="$ANDROID_ROOT" --target-os=android --arch=arm --extra-cflags="-I../include/ -I../include/libxml2 -I../include/mfx -I../include/svt-av1 $ANDROID_FLAGS" --extra-ldflags="-L../lib/ $ANDROID_FLAGS" --extra-libs="$ANDROID_LIBS -lz -latomic" --disable-symver || cat ffbuild/config.log
LDEXEFLAGS='-Wl,-rpath,\$$ORIGIN/' ./configure --prefix=.. $DISABLE $ENABLE --enable-jni --enable-mediacodec --enable-pthreads --enable-cross-compile --cross-prefix="$ANDROID_PREFIX-" --ar="$AR" --ranlib="$RANLIB" --cc="$CC" --strip="$STRIP" --sysroot="$ANDROID_ROOT" --target-os=android --arch=arm --extra-cflags="-I../include/ -I../include/libxml2 -I../include/mfx -I../include/svt-av1 $ANDROID_FLAGS" --extra-ldflags="-L../lib/ $ANDROID_FLAGS" --extra-libs="$ANDROID_LIBS -lz -latomic -lstdc++" --disable-symver || cat ffbuild/config.log
saudet marked this conversation as resolved.
Show resolved Hide resolved
make -j $MAKEJ
make install
;;
Expand All @@ -278,10 +291,20 @@ EOF
export STRIP="$ANDROID_PREFIX-strip"
echo ""
echo "--------------------"
echo "Building zimg"
echo "--------------------"
echo ""
cd zimg-release-$ZIMGLIB
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 @@ -410,7 +433,7 @@ EOF
cd ..
cd ../ffmpeg-$FFMPEG_VERSION
sedinplace 's/unsigned long int/unsigned int/g' libavdevice/v4l2.c
LDEXEFLAGS='-Wl,-rpath,\$$ORIGIN/' ./configure --prefix=.. $DISABLE $ENABLE --enable-jni --enable-mediacodec --enable-pthreads --enable-cross-compile --cross-prefix="$ANDROID_PREFIX-" --ar="$AR" --ranlib="$RANLIB" --cc="$CC" --strip="$STRIP" --sysroot="$ANDROID_ROOT" --target-os=android --arch=aarch64 --extra-cflags="-I../include/ -I../include/libxml2 -I../include/mfx -I../include/svt-av1 $ANDROID_FLAGS" --extra-ldflags="-L../lib/ $ANDROID_FLAGS" --extra-libs="$ANDROID_LIBS -lz -latomic" --disable-symver || cat ffbuild/config.log
LDEXEFLAGS='-Wl,-rpath,\$$ORIGIN/' ./configure --prefix=.. $DISABLE $ENABLE --enable-jni --enable-mediacodec --enable-pthreads --enable-cross-compile --cross-prefix="$ANDROID_PREFIX-" --ar="$AR" --ranlib="$RANLIB" --cc="$CC" --strip="$STRIP" --sysroot="$ANDROID_ROOT" --target-os=android --arch=aarch64 --extra-cflags="-I../include/ -I../include/libxml2 -I../include/mfx -I../include/svt-av1 $ANDROID_FLAGS" --extra-ldflags="-L../lib/ $ANDROID_FLAGS" --extra-libs="$ANDROID_LIBS -lz -latomic -lstdc++" --disable-symver || cat ffbuild/config.log
make -j $MAKEJ
make install
;;
Expand All @@ -423,10 +446,20 @@ EOF
export STRIP="$ANDROID_PREFIX-strip"
echo ""
echo "--------------------"
echo "Building zimg"
echo "--------------------"
echo ""
cd zimg-release-$ZIMGLIB
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 @@ -552,7 +585,7 @@ EOF
cd ..
cd ../ffmpeg-$FFMPEG_VERSION
sedinplace 's/unsigned long int/unsigned int/g' libavdevice/v4l2.c
LDEXEFLAGS='-Wl,-rpath,\$$ORIGIN/' ./configure --prefix=.. $DISABLE $ENABLE --enable-jni --enable-mediacodec --enable-pthreads --enable-cross-compile --cross-prefix="$ANDROID_PREFIX-" --ar="$AR" --ranlib="$RANLIB" --cc="$CC" --strip="$STRIP" --sysroot="$ANDROID_ROOT" --target-os=android --arch=atom --extra-cflags="-I../include/ -I../include/libxml2 -I../include/mfx -I../include/svt-av1 $ANDROID_FLAGS" --extra-ldflags="-L../lib/ $ANDROID_FLAGS" --extra-libs="$ANDROID_LIBS -lz -latomic" --disable-symver || cat ffbuild/config.log
LDEXEFLAGS='-Wl,-rpath,\$$ORIGIN/' ./configure --prefix=.. $DISABLE $ENABLE --enable-jni --enable-mediacodec --enable-pthreads --enable-cross-compile --cross-prefix="$ANDROID_PREFIX-" --ar="$AR" --ranlib="$RANLIB" --cc="$CC" --strip="$STRIP" --sysroot="$ANDROID_ROOT" --target-os=android --arch=atom --extra-cflags="-I../include/ -I../include/libxml2 -I../include/mfx -I../include/svt-av1 $ANDROID_FLAGS" --extra-ldflags="-L../lib/ $ANDROID_FLAGS" --extra-libs="$ANDROID_LIBS -lz -latomic -lstdc++" --disable-symver || cat ffbuild/config.log
make -j $MAKEJ
make install
;;
Expand All @@ -565,10 +598,20 @@ EOF
export STRIP="$ANDROID_PREFIX-strip"
echo ""
echo "--------------------"
echo "Building zimg"
echo "--------------------"
echo ""
cd zimg-release-$ZIMGLIB
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 @@ -693,7 +736,7 @@ EOF
cd ..
cd ../ffmpeg-$FFMPEG_VERSION
sedinplace 's/unsigned long int/unsigned int/g' libavdevice/v4l2.c
LDEXEFLAGS='-Wl,-rpath,\$$ORIGIN/' ./configure --prefix=.. $DISABLE $ENABLE --enable-jni --enable-mediacodec --enable-pthreads --enable-cross-compile --cross-prefix="$ANDROID_PREFIX-" --ar="$AR" --ranlib="$RANLIB" --cc="$CC" --strip="$STRIP" --sysroot="$ANDROID_ROOT" --target-os=android --arch=atom --extra-cflags="-I../include/ -I../include/libxml2 -I../include/mfx -I../include/svt-av1 $ANDROID_FLAGS" --extra-ldflags="-L../lib/ $ANDROID_FLAGS" --extra-libs="$ANDROID_LIBS -lz -latomic" --disable-symver || cat ffbuild/config.log
LDEXEFLAGS='-Wl,-rpath,\$$ORIGIN/' ./configure --prefix=.. $DISABLE $ENABLE --enable-jni --enable-mediacodec --enable-pthreads --enable-cross-compile --cross-prefix="$ANDROID_PREFIX-" --ar="$AR" --ranlib="$RANLIB" --cc="$CC" --strip="$STRIP" --sysroot="$ANDROID_ROOT" --target-os=android --arch=atom --extra-cflags="-I../include/ -I../include/libxml2 -I../include/mfx -I../include/svt-av1 $ANDROID_FLAGS" --extra-ldflags="-L../lib/ $ANDROID_FLAGS" --extra-libs="$ANDROID_LIBS -lz -latomic -lstdc++" --disable-symver || cat ffbuild/config.log
make -j $MAKEJ
make install
;;
Expand All @@ -702,10 +745,20 @@ EOF
export AS="nasm"
echo ""
echo "--------------------"
echo "Building zimg"
echo "--------------------"
echo ""
cd zimg-release-$ZIMGLIB
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-$ZIMGLIB
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-$ZIMGLIB
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-$ZIMGLIB
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-$ZIMGLIB
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-$ZIMGLIB
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-$ZIMGLIB
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-$ZIMGLIB
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-$ZIMGLIB
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