| # Copyright 2020 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/config/arm.gni") |
| |
| # If fixed point implementation shall be used (otherwise float). |
| use_opus_fixed_point = current_cpu == "arm64" |
| |
| use_opus_x86_optimization = current_cpu == "x64" |
| |
| config("opus_config") { |
| include_dirs = [ "include" ] |
| |
| if (use_opus_fixed_point) { |
| defines = [ "OPUS_FIXED_POINT" ] |
| } |
| } |
| |
| config("opus_private_config") { |
| defines = [ |
| "OPUS_BUILD", |
| "OPUS_EXPORT=", |
| "ENABLE_HARDENING", |
| |
| # Prefer alloca() over variable length arrays which are often inefficient; |
| # the opus code will automatically handle this correctly per-platform. |
| "USE_ALLOCA", |
| "HAVE_ALLOCA_H", |
| ] |
| |
| include_dirs = [ |
| ".", |
| "celt", |
| "silk", |
| ] |
| |
| cflags = [] |
| |
| defines += [ |
| "HAVE_LRINT", |
| "HAVE_LRINTF", |
| ] |
| |
| if (is_debug) { |
| # Turn off a warning in opus_decoder.c when compiling without optimization. |
| defines += [ "OPUS_WILL_BE_SLOW" ] |
| } |
| |
| if (use_opus_x86_optimization) { |
| defines += [ |
| # Run Time CPU Detections (RTCD) is always enabled for x86. |
| "OPUS_HAVE_RTCD", |
| "CPU_INFO_BY_ASM", |
| |
| # Chrome always targets SSE2+. |
| "OPUS_X86_MAY_HAVE_SSE", |
| "OPUS_X86_MAY_HAVE_SSE2", |
| "OPUS_X86_PRESUME_SSE", |
| "OPUS_X86_PRESUME_SSE2", |
| |
| # Some systems may have SSE4.1+ support. |
| "OPUS_X86_MAY_HAVE_SSE4_1", |
| |
| # At present libopus has no AVX functions so no sources are add for this, |
| # if you see linker errors on AVX code the this flag is why. |
| "OPUS_X86_MAY_HAVE_AVX", |
| ] |
| } |
| |
| if (use_opus_fixed_point) { |
| defines += [ "FIXED_POINT" ] |
| include_dirs += [ "silk/fixed" ] |
| } else { |
| include_dirs += [ "silk/float" ] |
| } |
| } |
| |
| config("opus_test_config") { |
| include_dirs = [ |
| "celt", |
| "silk", |
| ] |
| |
| cflags = [ "-Wno-absolute-value" ] |
| } |
| |
| if (use_opus_x86_optimization) { |
| source_set("opus_sse41") { |
| sources = [ |
| "celt/x86/pitch_sse4_1.c", |
| "silk/x86/NSQ_del_dec_sse4_1.c", |
| "silk/x86/NSQ_sse4_1.c", |
| "silk/x86/VAD_sse4_1.c", |
| "silk/x86/VQ_WMat_EC_sse4_1.c", |
| ] |
| |
| configs += [ |
| ":opus_private_config", |
| ":opus_config", |
| ] |
| |
| cflags = [ "-msse4.1" ] |
| |
| configs += [ "//build/config:Wno-conversion" ] |
| } |
| # TODO(dalecurtis): If libopus ever adds AVX support, add an opus_avx block. |
| } |
| |
| # Note: Do not add any defines or include_dirs to this target, those should all |
| # go in the opus_private_config so they can be shared with intrinsic targets. |
| static_library("opus") { |
| sources = [ |
| "celt/_kiss_fft_guts.h", |
| "celt/arch.h", |
| "celt/bands.c", |
| "celt/bands.h", |
| "celt/celt.c", |
| "celt/celt.h", |
| "celt/celt_decoder.c", |
| "celt/celt_encoder.c", |
| "celt/celt_lpc.c", |
| "celt/celt_lpc.h", |
| "celt/cpu_support.h", |
| "celt/cwrs.c", |
| "celt/cwrs.h", |
| "celt/ecintrin.h", |
| "celt/entcode.c", |
| "celt/entcode.h", |
| "celt/entdec.c", |
| "celt/entdec.h", |
| "celt/entenc.c", |
| "celt/entenc.h", |
| "celt/fixed_debug.h", |
| "celt/fixed_generic.h", |
| "celt/float_cast.h", |
| "celt/kiss_fft.c", |
| "celt/kiss_fft.h", |
| "celt/laplace.c", |
| "celt/laplace.h", |
| "celt/mathops.c", |
| "celt/mathops.h", |
| "celt/mdct.c", |
| "celt/mdct.h", |
| "celt/mfrngcod.h", |
| "celt/modes.c", |
| "celt/modes.h", |
| "celt/os_support.h", |
| "celt/pitch.c", |
| "celt/pitch.h", |
| "celt/quant_bands.c", |
| "celt/quant_bands.h", |
| "celt/rate.c", |
| "celt/rate.h", |
| "celt/stack_alloc.h", |
| "celt/static_modes_fixed.h", |
| "celt/static_modes_float.h", |
| "celt/vq.c", |
| "celt/vq.h", |
| "include/opus.h", |
| "include/opus_custom.h", |
| "include/opus_defines.h", |
| "include/opus_multistream.h", |
| "include/opus_projection.h", |
| "include/opus_types.h", |
| "silk/A2NLSF.c", |
| "silk/API.h", |
| "silk/CNG.c", |
| "silk/HP_variable_cutoff.c", |
| "silk/Inlines.h", |
| "silk/LPC_analysis_filter.c", |
| "silk/LPC_fit.c", |
| "silk/LPC_inv_pred_gain.c", |
| "silk/LP_variable_cutoff.c", |
| "silk/MacroCount.h", |
| "silk/MacroDebug.h", |
| "silk/NLSF2A.c", |
| "silk/NLSF_VQ.c", |
| "silk/NLSF_VQ_weights_laroia.c", |
| "silk/NLSF_decode.c", |
| "silk/NLSF_del_dec_quant.c", |
| "silk/NLSF_encode.c", |
| "silk/NLSF_stabilize.c", |
| "silk/NLSF_unpack.c", |
| "silk/NSQ.c", |
| "silk/NSQ.h", |
| "silk/NSQ_del_dec.c", |
| "silk/PLC.c", |
| "silk/PLC.h", |
| "silk/SigProc_FIX.h", |
| "silk/VAD.c", |
| "silk/VQ_WMat_EC.c", |
| "silk/ana_filt_bank_1.c", |
| "silk/biquad_alt.c", |
| "silk/bwexpander.c", |
| "silk/bwexpander_32.c", |
| "silk/check_control_input.c", |
| "silk/code_signs.c", |
| "silk/control.h", |
| "silk/control_SNR.c", |
| "silk/control_audio_bandwidth.c", |
| "silk/control_codec.c", |
| "silk/debug.c", |
| "silk/debug.h", |
| "silk/dec_API.c", |
| "silk/decode_core.c", |
| "silk/decode_frame.c", |
| "silk/decode_indices.c", |
| "silk/decode_parameters.c", |
| "silk/decode_pitch.c", |
| "silk/decode_pulses.c", |
| "silk/decoder_set_fs.c", |
| "silk/define.h", |
| "silk/enc_API.c", |
| "silk/encode_indices.c", |
| "silk/encode_pulses.c", |
| "silk/errors.h", |
| "silk/gain_quant.c", |
| "silk/init_decoder.c", |
| "silk/init_encoder.c", |
| "silk/inner_prod_aligned.c", |
| "silk/interpolate.c", |
| "silk/lin2log.c", |
| "silk/log2lin.c", |
| "silk/macros.h", |
| "silk/main.h", |
| "silk/pitch_est_defines.h", |
| "silk/pitch_est_tables.c", |
| "silk/process_NLSFs.c", |
| "silk/quant_LTP_gains.c", |
| "silk/resampler.c", |
| "silk/resampler_down2.c", |
| "silk/resampler_down2_3.c", |
| "silk/resampler_private.h", |
| "silk/resampler_private_AR2.c", |
| "silk/resampler_private_IIR_FIR.c", |
| "silk/resampler_private_down_FIR.c", |
| "silk/resampler_private_up2_HQ.c", |
| "silk/resampler_rom.c", |
| "silk/resampler_rom.h", |
| "silk/resampler_structs.h", |
| "silk/shell_coder.c", |
| "silk/sigm_Q15.c", |
| "silk/sort.c", |
| "silk/stereo_LR_to_MS.c", |
| "silk/stereo_MS_to_LR.c", |
| "silk/stereo_decode_pred.c", |
| "silk/stereo_encode_pred.c", |
| "silk/stereo_find_predictor.c", |
| "silk/stereo_quant_pred.c", |
| "silk/structs.h", |
| "silk/sum_sqr_shift.c", |
| "silk/table_LSF_cos.c", |
| "silk/tables.h", |
| "silk/tables_LTP.c", |
| "silk/tables_NLSF_CB_NB_MB.c", |
| "silk/tables_NLSF_CB_WB.c", |
| "silk/tables_gain.c", |
| "silk/tables_other.c", |
| "silk/tables_pitch_lag.c", |
| "silk/tables_pulses_per_block.c", |
| "silk/tuning_parameters.h", |
| "silk/typedef.h", |
| "src/analysis.c", |
| "src/analysis.h", |
| "src/mapping_matrix.c", |
| "src/mapping_matrix.h", |
| "src/mlp.c", |
| "src/mlp.h", |
| "src/mlp_data.c", |
| "src/opus.c", |
| "src/opus_decoder.c", |
| "src/opus_encoder.c", |
| "src/opus_multistream.c", |
| "src/opus_multistream_decoder.c", |
| "src/opus_multistream_encoder.c", |
| "src/opus_private.h", |
| "src/opus_projection_encoder.c", |
| "src/opus_projection_decoder.c", |
| "src/repacketizer.c", |
| "src/tansig_table.h", |
| ] |
| |
| configs += [ |
| ":opus_private_config", |
| ] |
| public_configs = [ ":opus_config" ] |
| |
| deps = [] |
| |
| if (use_opus_x86_optimization) { |
| sources += [ |
| "celt/x86/celt_lpc_sse.h", |
| "celt/x86/celt_lpc_sse4_1.c", |
| "celt/x86/pitch_sse.c", |
| "celt/x86/pitch_sse.h", |
| "celt/x86/pitch_sse2.c", |
| "celt/x86/vq_sse.h", |
| "celt/x86/vq_sse2.c", |
| "celt/x86/x86_celt_map.c", |
| "celt/x86/x86cpu.c", |
| "celt/x86/x86cpu.h", |
| "silk/x86/SigProc_FIX_sse.h", |
| "silk/x86/main_sse.h", |
| "silk/x86/x86_silk_map.c", |
| ] |
| deps += [ ":opus_sse41" ] |
| } |
| |
| if (use_opus_fixed_point) { |
| sources += [ |
| "silk/fixed/LTP_analysis_filter_FIX.c", |
| "silk/fixed/LTP_scale_ctrl_FIX.c", |
| "silk/fixed/apply_sine_window_FIX.c", |
| "silk/fixed/autocorr_FIX.c", |
| "silk/fixed/burg_modified_FIX.c", |
| "silk/fixed/corrMatrix_FIX.c", |
| "silk/fixed/encode_frame_FIX.c", |
| "silk/fixed/find_LPC_FIX.c", |
| "silk/fixed/find_LTP_FIX.c", |
| "silk/fixed/find_pitch_lags_FIX.c", |
| "silk/fixed/find_pred_coefs_FIX.c", |
| "silk/fixed/k2a_FIX.c", |
| "silk/fixed/k2a_Q16_FIX.c", |
| "silk/fixed/main_FIX.h", |
| "silk/fixed/noise_shape_analysis_FIX.c", |
| "silk/fixed/pitch_analysis_core_FIX.c", |
| "silk/fixed/process_gains_FIX.c", |
| "silk/fixed/regularize_correlations_FIX.c", |
| "silk/fixed/residual_energy16_FIX.c", |
| "silk/fixed/residual_energy_FIX.c", |
| "silk/fixed/schur64_FIX.c", |
| "silk/fixed/schur_FIX.c", |
| "silk/fixed/structs_FIX.h", |
| "silk/fixed/vector_ops_FIX.c", |
| "silk/fixed/warped_autocorrelation_FIX.c", |
| ] |
| } else { |
| sources += [ |
| "silk/float/LPC_analysis_filter_FLP.c", |
| "silk/float/LPC_inv_pred_gain_FLP.c", |
| "silk/float/LTP_analysis_filter_FLP.c", |
| "silk/float/LTP_scale_ctrl_FLP.c", |
| "silk/float/SigProc_FLP.h", |
| "silk/float/apply_sine_window_FLP.c", |
| "silk/float/autocorrelation_FLP.c", |
| "silk/float/burg_modified_FLP.c", |
| "silk/float/bwexpander_FLP.c", |
| "silk/float/corrMatrix_FLP.c", |
| "silk/float/encode_frame_FLP.c", |
| "silk/float/energy_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", |
| "silk/float/inner_product_FLP.c", |
| "silk/float/k2a_FLP.c", |
| "silk/float/main_FLP.h", |
| "silk/float/noise_shape_analysis_FLP.c", |
| "silk/float/pitch_analysis_core_FLP.c", |
| "silk/float/process_gains_FLP.c", |
| "silk/float/regularize_correlations_FLP.c", |
| "silk/float/residual_energy_FLP.c", |
| "silk/float/scale_copy_vector_FLP.c", |
| "silk/float/scale_vector_FLP.c", |
| "silk/float/schur_FLP.c", |
| "silk/float/sort_FLP.c", |
| "silk/float/structs_FLP.h", |
| "silk/float/warped_autocorrelation_FLP.c", |
| "silk/float/wrappers_FLP.c", |
| ] |
| } |
| |
| configs += [ "//build/config:Wno-conversion" ] |
| } |
| |