2016-10-17 06:50:25 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
2020-03-30 06:28:32 +00:00
|
|
|
Import("env")
|
|
|
|
Import("env_modules")
|
2016-10-12 18:37:38 +00:00
|
|
|
|
2020-03-18 11:41:18 +00:00
|
|
|
# Only kept to build the thirdparty library used by the webm module.
|
|
|
|
# AudioStreamOpus was dropped in 3.0 due to incompatibility with the new audio
|
|
|
|
# engine. If you want to port it, fetch it from the Git history.
|
2017-09-14 20:45:02 +00:00
|
|
|
|
2016-10-13 16:54:00 +00:00
|
|
|
env_opus = env_modules.Clone()
|
|
|
|
|
2016-10-12 18:37:38 +00:00
|
|
|
# Thirdparty source files
|
2020-03-30 06:28:32 +00:00
|
|
|
if env["builtin_opus"]:
|
2016-10-30 17:44:57 +00:00
|
|
|
thirdparty_dir = "#thirdparty/opus/"
|
2016-10-12 18:37:38 +00:00
|
|
|
|
2016-10-30 17:44:57 +00:00
|
|
|
thirdparty_sources = [
|
2019-02-28 13:23:53 +00:00
|
|
|
# Sync with opus_sources.mk
|
|
|
|
"opus.c",
|
|
|
|
"opus_decoder.c",
|
|
|
|
"opus_encoder.c",
|
|
|
|
"opus_multistream.c",
|
|
|
|
"opus_multistream_encoder.c",
|
|
|
|
"opus_multistream_decoder.c",
|
|
|
|
"repacketizer.c",
|
|
|
|
"analysis.c",
|
|
|
|
"mlp.c",
|
|
|
|
"mlp_data.c",
|
|
|
|
# Sync with libopusfile Makefile.am
|
|
|
|
"info.c",
|
|
|
|
"internal.c",
|
|
|
|
"opusfile.c",
|
|
|
|
"stream.c",
|
|
|
|
# Sync with celt_sources.mk
|
|
|
|
"celt/bands.c",
|
|
|
|
"celt/celt.c",
|
|
|
|
"celt/celt_encoder.c",
|
|
|
|
"celt/celt_decoder.c",
|
|
|
|
"celt/cwrs.c",
|
|
|
|
"celt/entcode.c",
|
|
|
|
"celt/entdec.c",
|
|
|
|
"celt/entenc.c",
|
|
|
|
"celt/kiss_fft.c",
|
|
|
|
"celt/laplace.c",
|
|
|
|
"celt/mathops.c",
|
|
|
|
"celt/mdct.c",
|
|
|
|
"celt/modes.c",
|
|
|
|
"celt/pitch.c",
|
|
|
|
"celt/celt_lpc.c",
|
|
|
|
"celt/quant_bands.c",
|
|
|
|
"celt/rate.c",
|
|
|
|
"celt/vq.c",
|
2020-03-30 06:28:32 +00:00
|
|
|
# "celt/arm/arm_celt_map.c",
|
|
|
|
# "celt/arm/armcpu.c",
|
|
|
|
# "celt/arm/celt_ne10_fft.c",
|
|
|
|
# "celt/arm/celt_ne10_mdct.c",
|
|
|
|
# "celt/arm/celt_neon_intr.c",
|
2019-02-28 13:23:53 +00:00
|
|
|
# Sync with silk_sources.mk
|
|
|
|
"silk/CNG.c",
|
|
|
|
"silk/code_signs.c",
|
2016-10-30 17:44:57 +00:00
|
|
|
"silk/init_decoder.c",
|
|
|
|
"silk/decode_core.c",
|
2019-02-28 13:23:53 +00:00
|
|
|
"silk/decode_frame.c",
|
2016-10-30 17:44:57 +00:00
|
|
|
"silk/decode_parameters.c",
|
|
|
|
"silk/decode_indices.c",
|
2019-02-28 13:23:53 +00:00
|
|
|
"silk/decode_pulses.c",
|
|
|
|
"silk/decoder_set_fs.c",
|
|
|
|
"silk/dec_API.c",
|
|
|
|
"silk/enc_API.c",
|
|
|
|
"silk/encode_indices.c",
|
2016-10-30 17:44:57 +00:00
|
|
|
"silk/encode_pulses.c",
|
2019-02-28 13:23:53 +00:00
|
|
|
"silk/gain_quant.c",
|
|
|
|
"silk/interpolate.c",
|
|
|
|
"silk/LP_variable_cutoff.c",
|
|
|
|
"silk/NLSF_decode.c",
|
|
|
|
"silk/NSQ.c",
|
2016-10-30 17:44:57 +00:00
|
|
|
"silk/NSQ_del_dec.c",
|
2019-02-28 13:23:53 +00:00
|
|
|
"silk/PLC.c",
|
2016-10-30 17:44:57 +00:00
|
|
|
"silk/shell_coder.c",
|
2019-02-28 13:23:53 +00:00
|
|
|
"silk/tables_gain.c",
|
|
|
|
"silk/tables_LTP.c",
|
|
|
|
"silk/tables_NLSF_CB_NB_MB.c",
|
|
|
|
"silk/tables_NLSF_CB_WB.c",
|
|
|
|
"silk/tables_other.c",
|
|
|
|
"silk/tables_pitch_lag.c",
|
|
|
|
"silk/tables_pulses_per_block.c",
|
|
|
|
"silk/VAD.c",
|
|
|
|
"silk/control_audio_bandwidth.c",
|
|
|
|
"silk/quant_LTP_gains.c",
|
|
|
|
"silk/VQ_WMat_EC.c",
|
|
|
|
"silk/HP_variable_cutoff.c",
|
2016-10-30 17:44:57 +00:00
|
|
|
"silk/NLSF_encode.c",
|
2019-02-28 13:23:53 +00:00
|
|
|
"silk/NLSF_VQ.c",
|
|
|
|
"silk/NLSF_unpack.c",
|
|
|
|
"silk/NLSF_del_dec_quant.c",
|
|
|
|
"silk/process_NLSFs.c",
|
2016-10-30 17:44:57 +00:00
|
|
|
"silk/stereo_LR_to_MS.c",
|
2019-02-28 13:23:53 +00:00
|
|
|
"silk/stereo_MS_to_LR.c",
|
|
|
|
"silk/check_control_input.c",
|
|
|
|
"silk/control_SNR.c",
|
|
|
|
"silk/init_encoder.c",
|
|
|
|
"silk/control_codec.c",
|
|
|
|
"silk/A2NLSF.c",
|
|
|
|
"silk/ana_filt_bank_1.c",
|
|
|
|
"silk/biquad_alt.c",
|
|
|
|
"silk/bwexpander_32.c",
|
|
|
|
"silk/bwexpander.c",
|
|
|
|
"silk/debug.c",
|
|
|
|
"silk/decode_pitch.c",
|
|
|
|
"silk/inner_prod_aligned.c",
|
|
|
|
"silk/lin2log.c",
|
|
|
|
"silk/log2lin.c",
|
2016-10-30 17:44:57 +00:00
|
|
|
"silk/LPC_analysis_filter.c",
|
2019-02-28 13:23:53 +00:00
|
|
|
"silk/LPC_inv_pred_gain.c",
|
|
|
|
"silk/table_LSF_cos.c",
|
|
|
|
"silk/NLSF2A.c",
|
|
|
|
"silk/NLSF_stabilize.c",
|
|
|
|
"silk/NLSF_VQ_weights_laroia.c",
|
|
|
|
"silk/pitch_est_tables.c",
|
|
|
|
"silk/resampler.c",
|
|
|
|
"silk/resampler_down2_3.c",
|
|
|
|
"silk/resampler_down2.c",
|
|
|
|
"silk/resampler_private_AR2.c",
|
|
|
|
"silk/resampler_private_down_FIR.c",
|
|
|
|
"silk/resampler_private_IIR_FIR.c",
|
|
|
|
"silk/resampler_private_up2_HQ.c",
|
2016-10-30 17:44:57 +00:00
|
|
|
"silk/resampler_rom.c",
|
2019-02-28 13:23:53 +00:00
|
|
|
"silk/sigm_Q15.c",
|
|
|
|
"silk/sort.c",
|
|
|
|
"silk/sum_sqr_shift.c",
|
|
|
|
"silk/stereo_decode_pred.c",
|
|
|
|
"silk/stereo_encode_pred.c",
|
|
|
|
"silk/stereo_find_predictor.c",
|
|
|
|
"silk/stereo_quant_pred.c",
|
2016-10-30 17:44:57 +00:00
|
|
|
]
|
2016-10-12 18:37:38 +00:00
|
|
|
|
2016-10-30 17:44:57 +00:00
|
|
|
opus_sources_silk = []
|
2016-10-12 18:37:38 +00:00
|
|
|
|
2019-03-02 09:30:10 +00:00
|
|
|
if env["platform"] in ["android", "iphone", "javascript"]:
|
2019-07-03 07:16:20 +00:00
|
|
|
env_opus.Append(CPPDEFINES=["FIXED_POINT"])
|
2016-10-30 17:44:57 +00:00
|
|
|
opus_sources_silk = [
|
2019-02-28 13:23:53 +00:00
|
|
|
"silk/fixed/LTP_analysis_filter_FIX.c",
|
|
|
|
"silk/fixed/LTP_scale_ctrl_FIX.c",
|
|
|
|
"silk/fixed/corrMatrix_FIX.c",
|
2016-10-30 17:44:57 +00:00
|
|
|
"silk/fixed/encode_frame_FIX.c",
|
2019-02-28 13:23:53 +00:00
|
|
|
"silk/fixed/find_LPC_FIX.c",
|
2016-10-30 17:44:57 +00:00
|
|
|
"silk/fixed/find_LTP_FIX.c",
|
|
|
|
"silk/fixed/find_pitch_lags_FIX.c",
|
2019-02-28 13:23:53 +00:00
|
|
|
"silk/fixed/find_pred_coefs_FIX.c",
|
|
|
|
"silk/fixed/noise_shape_analysis_FIX.c",
|
2019-11-18 08:56:18 +00:00
|
|
|
"silk/fixed/prefilter_FIX.c",
|
2016-10-30 17:44:57 +00:00
|
|
|
"silk/fixed/process_gains_FIX.c",
|
2019-02-28 13:23:53 +00:00
|
|
|
"silk/fixed/regularize_correlations_FIX.c",
|
|
|
|
"silk/fixed/residual_energy16_FIX.c",
|
|
|
|
"silk/fixed/residual_energy_FIX.c",
|
2019-11-18 08:56:18 +00:00
|
|
|
"silk/fixed/solve_LS_FIX.c",
|
2019-02-28 13:23:53 +00:00
|
|
|
"silk/fixed/warped_autocorrelation_FIX.c",
|
|
|
|
"silk/fixed/apply_sine_window_FIX.c",
|
|
|
|
"silk/fixed/autocorr_FIX.c",
|
2016-10-30 17:44:57 +00:00
|
|
|
"silk/fixed/burg_modified_FIX.c",
|
2019-02-28 13:23:53 +00:00
|
|
|
"silk/fixed/k2a_FIX.c",
|
|
|
|
"silk/fixed/k2a_Q16_FIX.c",
|
|
|
|
"silk/fixed/pitch_analysis_core_FIX.c",
|
|
|
|
"silk/fixed/vector_ops_FIX.c",
|
|
|
|
"silk/fixed/schur64_FIX.c",
|
|
|
|
"silk/fixed/schur_FIX.c",
|
2016-10-30 17:44:57 +00:00
|
|
|
]
|
|
|
|
else:
|
|
|
|
opus_sources_silk = [
|
2019-02-28 13:23:53 +00:00
|
|
|
"silk/float/apply_sine_window_FLP.c",
|
2016-10-30 17:44:57 +00:00
|
|
|
"silk/float/corrMatrix_FLP.c",
|
2019-02-28 13:23:53 +00:00
|
|
|
"silk/float/encode_frame_FLP.c",
|
|
|
|
"silk/float/find_LPC_FLP.c",
|
|
|
|
"silk/float/find_LTP_FLP.c",
|
|
|
|
"silk/float/find_pitch_lags_FLP.c",
|
|
|
|
"silk/float/find_pred_coefs_FLP.c",
|
2016-10-30 17:44:57 +00:00
|
|
|
"silk/float/LPC_analysis_filter_FLP.c",
|
2019-02-28 13:23:53 +00:00
|
|
|
"silk/float/LTP_analysis_filter_FLP.c",
|
|
|
|
"silk/float/LTP_scale_ctrl_FLP.c",
|
|
|
|
"silk/float/noise_shape_analysis_FLP.c",
|
2019-11-18 08:56:18 +00:00
|
|
|
"silk/float/prefilter_FLP.c",
|
2019-02-28 13:23:53 +00:00
|
|
|
"silk/float/process_gains_FLP.c",
|
|
|
|
"silk/float/regularize_correlations_FLP.c",
|
|
|
|
"silk/float/residual_energy_FLP.c",
|
2019-11-18 08:56:18 +00:00
|
|
|
"silk/float/solve_LS_FLP.c",
|
2019-02-28 13:23:53 +00:00
|
|
|
"silk/float/warped_autocorrelation_FLP.c",
|
|
|
|
"silk/float/wrappers_FLP.c",
|
2016-10-30 17:44:57 +00:00
|
|
|
"silk/float/autocorrelation_FLP.c",
|
|
|
|
"silk/float/burg_modified_FLP.c",
|
2019-02-28 13:23:53 +00:00
|
|
|
"silk/float/bwexpander_FLP.c",
|
2016-10-30 17:44:57 +00:00
|
|
|
"silk/float/energy_FLP.c",
|
|
|
|
"silk/float/inner_product_FLP.c",
|
2019-02-28 13:23:53 +00:00
|
|
|
"silk/float/k2a_FLP.c",
|
2019-11-18 08:56:18 +00:00
|
|
|
"silk/float/levinsondurbin_FLP.c",
|
2019-02-28 13:23:53 +00:00
|
|
|
"silk/float/LPC_inv_pred_gain_FLP.c",
|
|
|
|
"silk/float/pitch_analysis_core_FLP.c",
|
2016-10-30 17:44:57 +00:00
|
|
|
"silk/float/scale_copy_vector_FLP.c",
|
2019-02-28 13:23:53 +00:00
|
|
|
"silk/float/scale_vector_FLP.c",
|
|
|
|
"silk/float/schur_FLP.c",
|
|
|
|
"silk/float/sort_FLP.c",
|
2016-10-30 17:44:57 +00:00
|
|
|
]
|
2016-10-12 18:37:38 +00:00
|
|
|
|
2016-10-30 17:44:57 +00:00
|
|
|
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources + opus_sources_silk]
|
2016-10-12 18:37:38 +00:00
|
|
|
|
2018-09-28 11:29:52 +00:00
|
|
|
# also requires libogg
|
2020-03-30 06:28:32 +00:00
|
|
|
if env["builtin_libogg"]:
|
2019-04-30 11:12:02 +00:00
|
|
|
env_opus.Prepend(CPPPATH=["#thirdparty/libogg"])
|
2018-09-28 11:29:52 +00:00
|
|
|
|
2019-07-03 07:16:20 +00:00
|
|
|
env_opus.Append(CPPDEFINES=["HAVE_CONFIG_H"])
|
2016-10-12 18:37:38 +00:00
|
|
|
|
2016-10-30 17:44:57 +00:00
|
|
|
thirdparty_include_paths = [
|
|
|
|
"",
|
|
|
|
"celt",
|
2016-11-03 20:10:34 +00:00
|
|
|
"opus",
|
2016-10-30 17:44:57 +00:00
|
|
|
"silk",
|
|
|
|
"silk/fixed",
|
|
|
|
"silk/float",
|
|
|
|
]
|
2019-04-30 11:12:02 +00:00
|
|
|
env_opus.Prepend(CPPPATH=[thirdparty_dir + "/" + dir for dir in thirdparty_include_paths])
|
2016-10-12 18:37:38 +00:00
|
|
|
|
2019-04-04 10:01:49 +00:00
|
|
|
if env["platform"] == "android":
|
2020-03-30 06:28:32 +00:00
|
|
|
if "android_arch" in env and env["android_arch"] == "armv7":
|
2019-07-03 07:16:20 +00:00
|
|
|
env_opus.Append(CPPDEFINES=["OPUS_ARM_OPT"])
|
2020-03-30 06:28:32 +00:00
|
|
|
elif "android_arch" in env and env["android_arch"] == "arm64v8":
|
2019-07-03 07:16:20 +00:00
|
|
|
env_opus.Append(CPPDEFINES=["OPUS_ARM64_OPT"])
|
2019-04-04 10:01:49 +00:00
|
|
|
elif env["platform"] == "iphone":
|
2020-03-30 06:28:32 +00:00
|
|
|
if "arch" in env and env["arch"] == "arm":
|
2019-07-03 07:16:20 +00:00
|
|
|
env_opus.Append(CPPDEFINES=["OPUS_ARM_OPT"])
|
2020-03-30 06:28:32 +00:00
|
|
|
elif "arch" in env and env["arch"] == "arm64":
|
2019-07-03 07:16:20 +00:00
|
|
|
env_opus.Append(CPPDEFINES=["OPUS_ARM64_OPT"])
|
2020-06-29 11:24:56 +00:00
|
|
|
elif env["platform"] == "osx":
|
|
|
|
if "arch" in env and env["arch"] == "arm64":
|
|
|
|
env_opus.Append(CPPDEFINES=["OPUS_ARM64_OPT"])
|
2019-03-02 09:30:10 +00:00
|
|
|
|
2018-09-28 11:29:52 +00:00
|
|
|
env_thirdparty = env_opus.Clone()
|
|
|
|
env_thirdparty.disable_warnings()
|
|
|
|
env_thirdparty.add_source_files(env.modules_sources, thirdparty_sources)
|
2016-10-12 18:37:38 +00:00
|
|
|
|
2020-03-18 11:41:18 +00:00
|
|
|
# Module files
|
|
|
|
env_opus.add_source_files(env.modules_sources, "register_types.cpp")
|