Skip to content

Commit a085c49

Browse files
Build x265 with all bitdepths and HDR10+ support
1 parent 7d90ee6 commit a085c49

File tree

1 file changed

+35
-16
lines changed

1 file changed

+35
-16
lines changed

cross_compile_ffmpeg.sh

+35-16
Original file line numberDiff line numberDiff line change
@@ -1636,10 +1636,7 @@ build_dav1d() {
16361636

16371637
build_libx265() {
16381638
# the only one that uses mercurial, so there's some extra initial junk in this method... XXX needs some cleanup :|
1639-
local checkout_dir=x265
1640-
if [[ $high_bitdepth == "y" ]]; then
1641-
checkout_dir=x265_high_bitdepth_10
1642-
fi
1639+
local checkout_dir=x265_all_bitdepth
16431640

16441641
if [[ $prefer_stable = "n" ]]; then
16451642
local old_hg_version
@@ -1660,12 +1657,11 @@ build_libx265() {
16601657
cd $checkout_dir
16611658
old_hg_version=none-yet
16621659
fi
1663-
cd source
16641660

16651661
local new_hg_version=`hg --debug id -i`
16661662
if [[ "$old_hg_version" != "$new_hg_version" ]]; then
16671663
echo "got upstream hg changes, forcing rebuild...x265"
1668-
rm -f already*
1664+
rm -f 8bit/already* 10bit/already* 12bit/already*
16691665
else
16701666
echo "still at hg $new_hg_version x265"
16711667
fi
@@ -1689,30 +1685,53 @@ build_libx265() {
16891685
cd $checkout_dir
16901686
old_hg_version=none-yet
16911687
fi
1692-
cd source
16931688

16941689
local new_hg_version=`hg --debug id -i`
16951690
if [[ "$old_hg_version" != "$new_hg_version" ]]; then
16961691
echo "got upstream hg changes, forcing rebuild...x265"
1697-
rm -f already*
1692+
rm -f 8bit/already* 10bit/already* 12bit/already*
16981693
else
16991694
echo "still at hg $new_hg_version x265"
17001695
fi
1701-
fi # dont with prefer_stable = [y|n]
1696+
fi # done with prefer_stable = [y|n]
1697+
17021698

1703-
local cmake_params="-DENABLE_SHARED=0 -DENABLE_CLI=1" # build x265.exe
1699+
local cmake_params="-DENABLE_SHARED=0" # build x265.exe
17041700
if [ "$bits_target" = "32" ]; then
17051701
cmake_params+=" -DWINXP_SUPPORT=1" # enable windows xp/vista compatibility in x86 build
17061702
cmake_params="$cmake_params -DENABLE_ASSEMBLY=OFF" # apparently required or build fails
17071703
fi
1708-
if [[ $high_bitdepth == "y" ]]; then
1709-
cmake_params+=" -DHIGH_BIT_DEPTH=1" # Enable 10 bits (main10) per pixels profiles. XXX have an option for 12 here too??? gah...
1710-
fi
17111704

1712-
do_cmake "$cmake_params"
1705+
mkdir -p 8bit 10bit 12bit
1706+
1707+
# Build 12bit (main12)
1708+
cd 12bit
1709+
local cmake_12bit_params="$cmake_params -DENABLE_CLI=0 -DHIGH_BIT_DEPTH=1 -DMAIN12=1 -DEXPORT_C_API=0"
1710+
do_cmake_from_build_dir ../source "$cmake_12bit_params"
17131711
do_make
1714-
echo force reinstall in case bit depth changed at all :|
1715-
rm already_ran_make_install*
1712+
cp libx265.a ../8bit/libx265_main12.a
1713+
1714+
# Build 10bit (main10)
1715+
cd ../10bit
1716+
local cmake_10bit_params="$cmake_params -DENABLE_CLI=0 -DHIGH_BIT_DEPTH=1 -DENABLE_HDR10_PLUS=1 -DEXPORT_C_API=0"
1717+
do_cmake_from_build_dir ../source "$cmake_10bit_params"
1718+
do_make
1719+
cp libx265.a ../8bit/libx265_main10.a
1720+
1721+
# Build 8 bit (main) with linked 10 and 12 bit then install
1722+
cd ../8bit
1723+
cmake_params="$cmake_params -DENABLE_CLI=1 -DEXTRA_LINK_FLAGS=-L -DLINKED_10BIT=1 -DLINKED_12BIT=1 -DEXTRA_LIB='$(pwd)/libx265_main10.a;$(pwd)/libx265_main12.a'"
1724+
do_cmake_from_build_dir ../source "$cmake_params"
1725+
do_make
1726+
mv libx265.a libx265_main.a
1727+
${cross_prefix}ar -M <<EOF
1728+
CREATE libx265.a
1729+
ADDLIB libx265_main.a
1730+
ADDLIB libx265_main10.a
1731+
ADDLIB libx265_main12.a
1732+
SAVE
1733+
END
1734+
EOF
17161735
do_make_install
17171736
cd ../..
17181737
}

0 commit comments

Comments
 (0)