diff --git a/CHANGELOG.md b/CHANGELOG.md index fedbff3dd94..87cf45a3d9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ + * Enable x265 multilib depth support at 8, 10, and 12 bits for FFmpeg ([pull #619](https://github.com/bytedeco/javacpp-presets/pull/619)) * Include all header files from `Python.h` in presets for CPython * Fix mapping of `initCameraMatrix2D`, `calibrateCamera`, and `stereoCalibrate` functions from `opencv_calib3d` * Build OpenCV with pthreads instead of OpenMP or GCD due to thread-safety and usability issues ([issue bytedeco/javacv#396](https://github.com/bytedeco/javacv/issues/396)) diff --git a/ffmpeg/cppbuild.sh b/ffmpeg/cppbuild.sh index c079ad04e66..27069e67b30 100755 --- a/ffmpeg/cppbuild.sh +++ b/ffmpeg/cppbuild.sh @@ -103,14 +103,29 @@ case $PLATFORM in export CXXFLAGS="$ANDROID_FLAGS -D_FILE_OFFSET_BITS=32" export LDFLAGS="-Wl,--no-undefined -Wl,--fix-cortex-a8 -z text" export LIBS="-lgcc -ldl -lz -lm -lc" + echo "" + echo "--------------------" + echo "Building zlib" + echo "--------------------" + echo "" cd $ZLIB ./configure --prefix=$INSTALL_PATH --static --uname=arm-linux make -j $MAKEJ V=0 make install + echo "" + echo "--------------------" + echo "Building LAME" + echo "--------------------" + echo "" cd ../$LAME ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=arm-linux make -j $MAKEJ V=0 make install + echo "" + echo "--------------------" + echo "Building speex" + echo "--------------------" + echo "" cd ../$SPEEX ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=arm-linux cd libspeex @@ -144,9 +159,37 @@ case $PLATFORM in make install cd ../x265-$X265 patch -Np1 < ../../../x265-android.patch || true - $CMAKE -DENABLE_CLI=OFF -DENABLE_SHARED=OFF -DENABLE_LIBNUMA=OFF -DCMAKE_TOOLCHAIN_FILE=android-arm.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=.. source - make -j $MAKEJ x265-static - make install + cd build/linux + # from x265 multilib.sh + mkdir -p 8bit 10bit 12bit + + cd 12bit + $CMAKE ../../../source -DCMAKE_TOOLCHAIN_FILE=../../../android-arm.cmake -DHIGH_BIT_DEPTH=ON -DEXPORT_C_API=OFF -DENABLE_SHARED=OFF -DENABLE_CLI=OFF -DENABLE_ASSEMBLY=OFF -DMAIN12=ON -DENABLE_LIBNUMA=OFF -DCMAKE_BUILD_TYPE=Release + make -j $MAKEJ + + cd ../10bit + $CMAKE ../../../source -DCMAKE_TOOLCHAIN_FILE=../../../android-arm.cmake -DHIGH_BIT_DEPTH=ON -DEXPORT_C_API=OFF -DENABLE_SHARED=OFF -DENABLE_CLI=OFF -DENABLE_ASSEMBLY=OFF -DENABLE_LIBNUMA=OFF -DCMAKE_BUILD_TYPE=Release + make -j $MAKEJ + + cd ../8bit + ln -sf ../10bit/libx265.a libx265_main10.a + ln -sf ../12bit/libx265.a libx265_main12.a + $CMAKE ../../../source -DCMAKE_TOOLCHAIN_FILE=../../../android-arm.cmake -DEXTRA_LIB="x265_main10.a;x265_main12.a" -DEXTRA_LINK_FLAGS=-L. -DLINKED_10BIT=ON -DLINKED_12BIT=ON -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH -DENABLE_SHARED:BOOL=OFF -DENABLE_LIBNUMA=OFF -DCMAKE_BUILD_TYPE=Release -DENABLE_CLI=OFF -DENABLE_ASSEMBLY=OFF + make -j $MAKEJ + + # rename the 8bit library, then combine all three into libx265.a + mv libx265.a libx265_main.a +ar -M </dev/null + make install + # ---- + cd ../../../ cd ../libvpx-$VPX_VERSION sedinplace '/avx512/d' configure ./configure --prefix=$INSTALL_PATH --enable-static --enable-pic --disable-examples --disable-unit-tests @@ -838,12 +1282,27 @@ case $PLATFORM in ;; windows-x86) + echo "" + echo "--------------------" + echo "Building zlib" + echo "--------------------" + echo "" 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 "--------------------" + echo "Building LAME" + echo "--------------------" + echo "" cd ../$LAME ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --build=i686-w64-mingw32 CFLAGS="-m32 -msse2" make -j $MAKEJ V=0 make install + echo "" + echo "--------------------" + echo "Building speex" + echo "--------------------" + echo "" cd ../$SPEEX ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --build=i686-w64-mingw32 CFLAGS="-m32" make -j $MAKEJ V=0 @@ -870,10 +1329,37 @@ case $PLATFORM in ./configure --prefix=$INSTALL_PATH --enable-static --enable-pic --disable-opencl --host=i686-w64-mingw32 make -j $MAKEJ V=0 make install - cd ../x265-$X265 - CC="gcc -m32" CXX="g++ -m32" $CMAKE -G "MSYS Makefiles" -DENABLE_SHARED=OFF -DENABLE_LIBNUMA=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=.. source + cd ../x265-$X265/build/linux + # from x265 multilib.sh + mkdir -p 8bit 10bit 12bit + + cd 12bit + CC="gcc -m32" CXX="g++ -m32" $CMAKE -G "MSYS Makefiles" ../../../source -DHIGH_BIT_DEPTH=ON -DEXPORT_C_API=OFF -DENABLE_SHARED=OFF -DENABLE_CLI=OFF -DENABLE_ASSEMBLY=OFF -DMAIN12=ON -DENABLE_LIBNUMA=OFF -DCMAKE_BUILD_TYPE=Release -DNASM_EXECUTABLE:FILEPATH=$INSTALL_PATH/bin/nasm.exe make -j $MAKEJ - make install + + cd ../10bit + CC="gcc -m32" CXX="g++ -m32" $CMAKE -G "MSYS Makefiles" ../../../source -DHIGH_BIT_DEPTH=ON -DEXPORT_C_API=OFF -DENABLE_SHARED=OFF -DENABLE_CLI=OFF -DENABLE_ASSEMBLY=OFF -DENABLE_LIBNUMA=OFF -DCMAKE_BUILD_TYPE=Release -DNASM_EXECUTABLE:FILEPATH=$INSTALL_PATH/bin/nasm.exe + make -j $MAKEJ + + cd ../8bit + ln -sf ../10bit/libx265.a libx265_main10.a + ln -sf ../12bit/libx265.a libx265_main12.a + CC="gcc -m32" CXX="g++ -m32" $CMAKE -G "MSYS Makefiles" ../../../source -DEXTRA_LIB="x265_main10.a;x265_main12.a" -DEXTRA_LINK_FLAGS=-L. -DLINKED_10BIT=ON -DLINKED_12BIT=ON -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH -DENABLE_SHARED:BOOL=OFF -DENABLE_LIBNUMA=OFF -DCMAKE_BUILD_TYPE=Release -DNASM_EXECUTABLE:FILEPATH=$INSTALL_PATH/bin/nasm.exe -DENABLE_CLI=OFF + make -j $MAKEJ + + # rename the 8bit library, then combine all three into libx265.a + mv libx265.a libx265_main.a +ar -M <= 2.1.0" openjpeg.h opj_version || { require_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } } enabled libopenmpt && require_pkg_config libopenmpt "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create -lstdc++ && append libopenmpt_extralibs "-lstdc++" @@ -83,7 +83,7 @@ diff -ruN ffmpeg-4.1/configure ffmpeg-4.1-patch/configure require_cpp_condition libx264 x264.h "X264_BUILD >= 118" && check_cpp_condition libx262 x264.h "X264_MPEG2" -enabled libx265 && require_pkg_config libx265 x265 x265.h x265_api_get && -+enabled libx265 && require libx265 x265.h x265_encoder_encode -lx265 && ++enabled libx265 && require libx265 x265.h x265_encoder_encode -lx265 $pthreads_extralibs && require_cpp_condition libx265 x265.h "X265_BUILD >= 68" enabled libxavs && require libxavs "stdint.h xavs.h" xavs_encoder_encode "-lxavs $pthreads_extralibs $libm_extralibs" enabled libxavs2 && require_pkg_config libxavs2 "xavs2 >= 1.2.77" "stdint.h xavs2.h" xavs2_api_get @@ -94,7 +94,7 @@ diff -ruN ffmpeg-4.1/configure ffmpeg-4.1-patch/configure - check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto || - check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 || - check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 || -+ check_lib openssl openssl/ssl.h OPENSSL_init_ssl -lssl -lcrypto || ++ check_lib openssl openssl/ssl.h OPENSSL_init_ssl -lssl -lcrypto $pthreads_extralibs || + check_lib openssl openssl/ssl.h OPENSSL_init_ssl -lssl32 -leay32 || + check_lib openssl openssl/ssl.h OPENSSL_init_ssl -lssl -lcrypto -lws2_32 -lgdi32 || die "ERROR: openssl not found"; }