2021-10-22 06:51:04 +02:00
|
|
|
if(NOT WIN32 AND USE_CELT)
|
|
|
|
FetchDependency(CELT_0061
|
|
|
|
DIR celt-0061
|
2021-10-22 15:48:56 +02:00
|
|
|
FETCH_PRIORITY file git
|
|
|
|
|
|
|
|
FILE_DOWNLOAD https://downloads.xiph.org/releases/celt/celt-0.6.1.tar.gz
|
|
|
|
FILE_SUBDIR celt-0.6.1
|
|
|
|
|
2021-10-22 06:51:04 +02:00
|
|
|
GIT_REPOSITORY https://gitlab.xiph.org/xiph/celt
|
|
|
|
GIT_TAG 8ccf148573277b983692e15d5f0753081f806bea
|
|
|
|
)
|
|
|
|
FetchDependency(CELT_0110
|
|
|
|
DIR celt-0110
|
2021-10-22 15:48:56 +02:00
|
|
|
FETCH_PRIORITY file git
|
|
|
|
|
|
|
|
FILE_DOWNLOAD https://downloads.xiph.org/releases/celt/celt-0.11.0.tar.gz
|
|
|
|
FILE_SUBDIR celt-0.11.0
|
|
|
|
|
2021-10-22 06:51:04 +02:00
|
|
|
GIT_REPOSITORY https://gitlab.xiph.org/xiph/celt
|
|
|
|
GIT_TAG 0b405d1170122c859faab435405666506d52fa2e
|
|
|
|
)
|
2021-10-22 18:56:27 +02:00
|
|
|
if(CELT_0061_PATH AND CELT_0110_PATH)
|
2021-10-22 06:51:04 +02:00
|
|
|
set(CELT_0061_LINK_PATH ${CELT_0061_BIN}/libcelt/.libs/libcelt.a)
|
|
|
|
set(CELT_0110_LINK_PATH ${CELT_0110_BIN}/libcelt/.libs/libcelt0.a)
|
|
|
|
|
2021-10-22 09:09:33 +02:00
|
|
|
configure_file(
|
|
|
|
${VGM_SOURCE_DIR}/ext_libs/celt-0110/ecintrin.h
|
|
|
|
${CELT_0110_PATH}/libcelt/ecintrin.h
|
|
|
|
COPYONLY)
|
|
|
|
|
|
|
|
set(CELT_CFLAGS
|
2021-10-22 06:51:04 +02:00
|
|
|
alg_quant
|
|
|
|
alg_unquant
|
|
|
|
celt_decode
|
|
|
|
celt_decoder_create
|
|
|
|
celt_decoder_create_custom
|
|
|
|
celt_decoder_destroy
|
|
|
|
celt_mode_create
|
|
|
|
celt_mode_destroy
|
|
|
|
celt_mode_info
|
|
|
|
celt_encoder_destroy
|
|
|
|
celt_encoder_create
|
|
|
|
celt_encode
|
|
|
|
celt_encode_float
|
|
|
|
celt_encoder_ctl
|
|
|
|
celt_decode_float
|
|
|
|
celt_decoder_ctl
|
|
|
|
compute_allocation
|
|
|
|
compute_band_energies
|
|
|
|
denormalise_bands
|
|
|
|
ec_dec_init
|
|
|
|
ec_decode
|
|
|
|
ec_decode_bin
|
|
|
|
ec_dec_update
|
|
|
|
ec_dec_uint
|
|
|
|
ec_dec_bits
|
|
|
|
ec_enc_init
|
|
|
|
ec_encode
|
|
|
|
ec_encode_bin
|
|
|
|
ec_enc_uint
|
|
|
|
ec_enc_bits
|
|
|
|
ec_enc_done
|
|
|
|
normalise_bands
|
|
|
|
renormalise_vector
|
|
|
|
quant_coarse_energy
|
|
|
|
quant_fine_energy
|
|
|
|
quant_energy_finalise
|
|
|
|
unquant_coarse_energy
|
|
|
|
unquant_energy_finalise
|
|
|
|
unquant_fine_energy
|
2021-10-22 07:19:11 +02:00
|
|
|
eMeans
|
|
|
|
encode_pulses
|
|
|
|
decode_pulses
|
|
|
|
ec_laplace_encode
|
|
|
|
ec_laplace_decode
|
|
|
|
celt_decoder_get_size
|
|
|
|
celt_decoder_init
|
|
|
|
ec_dec_bit_logp
|
|
|
|
ec_dec_icdf
|
|
|
|
ec_enc_bit_logp
|
|
|
|
ec_enc_icdf
|
|
|
|
ec_enc_shrink
|
|
|
|
_celt_lpc
|
|
|
|
_celt_autocorr
|
|
|
|
amp2Log2
|
|
|
|
stereo_itheta
|
|
|
|
anti_collapse
|
|
|
|
spreading_decision
|
|
|
|
haar1
|
|
|
|
quant_all_bands
|
|
|
|
log2_frac
|
|
|
|
icwrs
|
|
|
|
get_required_bits
|
2021-10-22 09:09:33 +02:00
|
|
|
ec_ilog
|
|
|
|
mdct_forward
|
|
|
|
mdct_backward
|
|
|
|
mdct_init
|
|
|
|
mdct_clear
|
2021-10-22 06:51:04 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
foreach(ver 0061 0110)
|
2021-10-22 09:09:33 +02:00
|
|
|
foreach(source ${CELT_CFLAGS})
|
2021-10-22 06:51:04 +02:00
|
|
|
string(REGEX REPLACE "^([^_]+)" "\\1_${ver}" target ${source})
|
2021-10-22 07:19:11 +02:00
|
|
|
if(source STREQUAL ${target})
|
|
|
|
set(target "${source}_${ver}")
|
|
|
|
endif()
|
2021-10-22 09:09:33 +02:00
|
|
|
list(APPEND CELT_${ver}_CFLAGS "-D${source}=${target}")
|
2021-10-22 06:51:04 +02:00
|
|
|
endforeach()
|
2021-10-22 09:09:33 +02:00
|
|
|
list(APPEND CELT_${ver}_CFLAGS "-fPIC")
|
|
|
|
|
|
|
|
set(CELT_${ver}_CONF
|
|
|
|
--enable-static
|
|
|
|
--disable-shared
|
2021-10-22 15:48:56 +02:00
|
|
|
--disable-oggtest
|
2021-10-22 09:09:33 +02:00
|
|
|
CC="${CMAKE_C_COMPILER}"
|
|
|
|
AR="${CMAKE_AR}"
|
|
|
|
CFLAGS="${CELT_${ver}_CFLAGS}"
|
|
|
|
)
|
2021-10-22 18:56:27 +02:00
|
|
|
if(ver STREQUAL "0110")
|
|
|
|
list(APPEND CELT_${ver}_CONF --enable-custom-modes)
|
2021-10-22 06:51:04 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT EXISTS ${CELT_${ver}_PATH}/configure)
|
|
|
|
add_custom_target(CELT_${ver}_AUTOGEN
|
|
|
|
COMMAND ./autogen.sh
|
|
|
|
BYPRODUCTS ${CELT_${ver}_PATH}/configure
|
|
|
|
WORKING_DIRECTORY ${CELT_${ver}_PATH}
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
file(MAKE_DIRECTORY ${CELT_${ver}_BIN})
|
|
|
|
add_custom_target(CELT_${ver}_CONFIGURE
|
2021-10-22 09:09:33 +02:00
|
|
|
COMMAND "${CELT_${ver}_PATH}/configure" ${CELT_${ver}_CONF}
|
2021-10-22 09:29:06 +02:00
|
|
|
DEPENDS ${CELT_${ver}_PATH}/configure
|
2021-10-22 06:51:04 +02:00
|
|
|
BYPRODUCTS ${CELT_${ver}_BIN}/Makefile
|
|
|
|
WORKING_DIRECTORY ${CELT_${ver}_BIN}
|
|
|
|
)
|
|
|
|
add_custom_target(CELT_${ver}_MAKE
|
2021-10-22 18:56:27 +02:00
|
|
|
COMMAND make SUBDIRS=libcelt DIST_SUBDIRS=libcelt
|
2021-10-22 06:51:04 +02:00
|
|
|
DEPENDS ${CELT_${ver}_BIN}/Makefile
|
|
|
|
BYPRODUCTS ${CELT_${ver}_LINK_PATH} ${CELT_${ver}_BIN}
|
|
|
|
WORKING_DIRECTORY ${CELT_${ver}_BIN}
|
|
|
|
)
|
|
|
|
|
|
|
|
add_library(celt${ver} STATIC IMPORTED)
|
|
|
|
if(NOT EXISTS ${CELT_${ver}_LINK_PATH})
|
|
|
|
add_dependencies(celt${ver} CELT_${ver}_MAKE)
|
|
|
|
endif()
|
|
|
|
set_target_properties(celt${ver} PROPERTIES
|
|
|
|
IMPORTED_LOCATION ${CELT_${ver}_LINK_PATH}
|
|
|
|
)
|
|
|
|
endforeach()
|
|
|
|
else()
|
|
|
|
set(USE_CELT OFF)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
if(USE_CELT)
|
|
|
|
if(CELT_0061_SOURCE STREQUAL "${CELT_0110_SOURCE}")
|
|
|
|
set(CELT_SOURCE ${CELT_0061_SOURCE})
|
|
|
|
else()
|
|
|
|
set(CELT_SOURCE "v0.6.1: ${CELT_0061_SOURCE}, v0.11.0: ${CELT_0110_SOURCE}")
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
unset(CELT_SOURCE)
|
|
|
|
endif()
|