1package { 2 default_applicable_licenses: ["external_libopus_license"], 3} 4 5// Added automatically by a large-scale-change that took the approach of 6// 'apply every license found to every target'. While this makes sure we respect 7// every license restriction, it may not be entirely correct. 8// 9// e.g. GPL in an MIT project might only apply to the contrib/ directory. 10// 11// Please consider splitting the single license below into multiple licenses, 12// taking care not to lose any license_kind information, and overriding the 13// default license using the 'licenses: [...]' property on targets as needed. 14// 15// For unused files, consider creating a 'filegroup' with "//visibility:private" 16// to attach the license to, and including a comment whether the files may be 17// used in the current project. 18// 19// large-scale-change included anything that looked like it might be a license 20// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc. 21// 22// Please consider removing redundant or irrelevant files from 'license_text:'. 23// http://go/android-license-faq 24license { 25 name: "external_libopus_license", 26 visibility: [":__subpackages__"], 27 license_kinds: [ 28 "SPDX-license-identifier-Apache-2.0", 29 "SPDX-license-identifier-BSD", 30 ], 31 license_text: [ 32 "COPYING", 33 "NOTICE", 34 ], 35} 36 37cc_library { 38 name: "libopus", 39 vendor_available: true, 40 host_supported: true, 41 42 export_include_dirs: ["include"], 43 44 local_include_dirs: [ 45 "src", 46 "silk", 47 "celt", 48 "silk/fixed", 49 ], 50 51 sanitize: { 52 integer_overflow: true, 53 misc_undefined: ["bounds"], 54 blocklist: "libopus_blocklist.txt", 55 }, 56 57 srcs: [ 58 // CELT_SOURCES 59 "celt/bands.c", 60 "celt/celt.c", 61 "celt/celt_encoder.c", 62 "celt/celt_decoder.c", 63 "celt/cwrs.c", 64 "celt/entcode.c", 65 "celt/entdec.c", 66 "celt/entenc.c", 67 "celt/kiss_fft.c", 68 "celt/laplace.c", 69 "celt/mathops.c", 70 "celt/mdct.c", 71 "celt/modes.c", 72 "celt/pitch.c", 73 "celt/celt_lpc.c", 74 "celt/quant_bands.c", 75 "celt/rate.c", 76 "celt/vq.c", 77 78 // SILK_SOURCES 79 "silk/CNG.c", 80 "silk/code_signs.c", 81 "silk/init_decoder.c", 82 "silk/decode_core.c", 83 "silk/decode_frame.c", 84 "silk/decode_parameters.c", 85 "silk/decode_indices.c", 86 "silk/decode_pulses.c", 87 "silk/decoder_set_fs.c", 88 "silk/dec_API.c", 89 "silk/enc_API.c", 90 "silk/encode_indices.c", 91 "silk/encode_pulses.c", 92 "silk/gain_quant.c", 93 "silk/interpolate.c", 94 "silk/LP_variable_cutoff.c", 95 "silk/NLSF_decode.c", 96 "silk/NSQ.c", 97 "silk/NSQ_del_dec.c", 98 "silk/PLC.c", 99 "silk/shell_coder.c", 100 "silk/tables_gain.c", 101 "silk/tables_LTP.c", 102 "silk/tables_NLSF_CB_NB_MB.c", 103 "silk/tables_NLSF_CB_WB.c", 104 "silk/tables_other.c", 105 "silk/tables_pitch_lag.c", 106 "silk/tables_pulses_per_block.c", 107 "silk/VAD.c", 108 "silk/control_audio_bandwidth.c", 109 "silk/quant_LTP_gains.c", 110 "silk/VQ_WMat_EC.c", 111 "silk/HP_variable_cutoff.c", 112 "silk/NLSF_encode.c", 113 "silk/NLSF_VQ.c", 114 "silk/NLSF_unpack.c", 115 "silk/NLSF_del_dec_quant.c", 116 "silk/process_NLSFs.c", 117 "silk/stereo_LR_to_MS.c", 118 "silk/stereo_MS_to_LR.c", 119 "silk/check_control_input.c", 120 "silk/control_SNR.c", 121 "silk/init_encoder.c", 122 "silk/control_codec.c", 123 "silk/A2NLSF.c", 124 "silk/ana_filt_bank_1.c", 125 "silk/biquad_alt.c", 126 "silk/bwexpander_32.c", 127 "silk/bwexpander.c", 128 "silk/debug.c", 129 "silk/decode_pitch.c", 130 "silk/inner_prod_aligned.c", 131 "silk/lin2log.c", 132 "silk/log2lin.c", 133 "silk/LPC_analysis_filter.c", 134 "silk/LPC_fit.c", 135 "silk/LPC_inv_pred_gain.c", 136 "silk/table_LSF_cos.c", 137 "silk/NLSF2A.c", 138 "silk/NLSF_stabilize.c", 139 "silk/NLSF_VQ_weights_laroia.c", 140 "silk/pitch_est_tables.c", 141 "silk/resampler.c", 142 "silk/resampler_down2_3.c", 143 "silk/resampler_down2.c", 144 "silk/resampler_private_AR2.c", 145 "silk/resampler_private_down_FIR.c", 146 "silk/resampler_private_IIR_FIR.c", 147 "silk/resampler_private_up2_HQ.c", 148 "silk/resampler_rom.c", 149 "silk/sigm_Q15.c", 150 "silk/sort.c", 151 "silk/sum_sqr_shift.c", 152 "silk/stereo_decode_pred.c", 153 "silk/stereo_encode_pred.c", 154 "silk/stereo_find_predictor.c", 155 "silk/stereo_quant_pred.c", 156 157 // SILK_SOURCES_FIXED 158 "silk/fixed/LTP_analysis_filter_FIX.c", 159 "silk/fixed/LTP_scale_ctrl_FIX.c", 160 "silk/fixed/corrMatrix_FIX.c", 161 "silk/fixed/encode_frame_FIX.c", 162 "silk/fixed/find_LPC_FIX.c", 163 "silk/fixed/find_LTP_FIX.c", 164 "silk/fixed/find_pitch_lags_FIX.c", 165 "silk/fixed/find_pred_coefs_FIX.c", 166 "silk/fixed/noise_shape_analysis_FIX.c", 167 "silk/fixed/process_gains_FIX.c", 168 "silk/fixed/regularize_correlations_FIX.c", 169 "silk/fixed/residual_energy16_FIX.c", 170 "silk/fixed/residual_energy_FIX.c", 171 "silk/fixed/warped_autocorrelation_FIX.c", 172 "silk/fixed/apply_sine_window_FIX.c", 173 "silk/fixed/autocorr_FIX.c", 174 "silk/fixed/burg_modified_FIX.c", 175 "silk/fixed/k2a_FIX.c", 176 "silk/fixed/k2a_Q16_FIX.c", 177 "silk/fixed/pitch_analysis_core_FIX.c", 178 "silk/fixed/vector_ops_FIX.c", 179 "silk/fixed/schur64_FIX.c", 180 "silk/fixed/schur_FIX.c", 181 182 // OPUS_SOURCES 183 "src/mapping_matrix.c", 184 "src/opus.c", 185 "src/opus_decoder.c", 186 "src/opus_encoder.c", 187 "src/opus_multistream.c", 188 "src/opus_multistream_encoder.c", 189 "src/opus_multistream_decoder.c", 190 "src/opus_projection_encoder.c", 191 "src/opus_projection_decoder.c", 192 "src/repacketizer.c", 193 "src/extensions.c", 194 // OPUS_SOURCES_FLOAT 195 "src/analysis.c", 196 "src/mlp.c", 197 "src/mlp_data.c", 198 ], 199 200 cflags: [ 201 "-DNULL=0", 202 "-DSOCKLEN_T=socklen_t", 203 "-DLOCALE_NOT_USED", 204 "-D_LARGEFILE_SOURCE=1", 205 "-D_FILE_OFFSET_BITS=64", 206 "-Drestrict=", 207 "-D__EMX__", 208 "-DOPUS_BUILD", 209 "-DFIXED_POINT", 210 "-DUSE_ALLOCA", 211 "-DSIMD_EXTRA_ALLOC_BYTES=16", 212 "-DHAVE_LRINT", 213 "-DHAVE_LRINTF", 214 "-DENABLE_HARDENING", 215 "-O2", 216 "-fno-math-errno", 217 "-Wall", 218 "-Werror", 219 ], 220 cppflags: [ 221 "-DBSD=1", 222 "-ffast-math", 223 "-O2", 224 "-funroll-loops", 225 ], 226 227 arch: { 228 arm: { 229 srcs: [ 230 // CELT_SOURCES_ARM 231 "celt/arm/armcpu.c", 232 "celt/arm/arm_celt_map.c", 233 234 // CELT_SOURCES_ARM_ASM 235 "celt/arm/celt_pitch_xcorr_arm_gnu.s", 236 237 // CELT_AM_SOURCES_ARM_ASM 238 "celt/arm/armopts_gnu.s", 239 240 // CELT_SOURCES_ARM_NEON_INTR 241 "celt/arm/celt_neon_intr.c", 242 "celt/arm/pitch_neon_intr.c", 243 244 // SILK_SOURCES_ARM_NEON_INTR, 245 "silk/arm/arm_silk_map.c", 246 "silk/arm/biquad_alt_neon_intr.c", 247 "silk/arm/LPC_inv_pred_gain_neon_intr.c", 248 "silk/arm/NSQ_del_dec_neon_intr.c", 249 "silk/arm/NSQ_neon.c", 250 251 // SILK_SOURCES_FIXED_ARM_NEON_INTR, 252 "silk/fixed/arm/warped_autocorrelation_FIX_neon_intr.c", 253 ], 254 255 cflags: [ 256 "-DOPUS_ARM_ASM", 257 "-DOPUS_ARM_INLINE_ASM", 258 "-DOPUS_ARM_MAY_HAVE_EDSP", 259 "-DOPUS_ARM_INLINE_EDSP", 260 "-DOPUS_ARM_MAY_HAVE_MEDIA", 261 "-DOPUS_ARM_INLINE_MEDIA", 262 "-DOPUS_ARM_MAY_HAVE_NEON", 263 "-DOPUS_ARM_MAY_HAVE_NEON_INTR", 264 "-DOPUS_ARM_PRESUME_NEON", 265 "-DOPUS_ARM_INLINE_NEON", 266 "-DOPUS_HAVE_RTCD", 267 ], 268 }, 269 270 arm64: { 271 // TODO: opus 1.5 has support for arm64 (AARCH64) too. 272 }, 273 274 x86: { 275 ssse3: { 276 srcs: [ 277 // CELT_SOURCES_SSE 278 "celt/x86/x86cpu.c", 279 "celt/x86/x86_celt_map.c", 280 "celt/x86/pitch_sse.c", 281 282 // CELT_SOURCES_SSE2 283 "celt/x86/pitch_sse2.c", 284 "celt/x86/vq_sse2.c", 285 ], 286 287 cflags: [ 288 "-DOPUS_X86_MAY_HAVE_SSE", 289 "-DOPUS_X86_PRESUME_SSE", 290 "-DOPUS_X86_MAY_HAVE_SSE2", 291 "-DOPUS_X86_PRESUME_SSE2", 292 ], 293 }, 294 295 sse4_1: { 296 srcs: [ 297 // CELT_SOURCES_SSE4_1 298 "celt/x86/celt_lpc_sse4_1.c", 299 "celt/x86/pitch_sse4_1.c", 300 301 // SILK_SOURCES_SSE4_1 302 "silk/x86/NSQ_sse4_1.c", 303 "silk/x86/NSQ_del_dec_sse4_1.c", 304 "silk/x86/x86_silk_map.c", 305 "silk/x86/VAD_sse4_1.c", 306 "silk/x86/VQ_WMat_EC_sse4_1.c", 307 308 // SILK_SOURCES_FIXED_SSE4_1 309 "silk/fixed/x86/vector_ops_FIX_sse4_1.c", 310 "silk/fixed/x86/burg_modified_FIX_sse4_1.c", 311 ], 312 313 cflags: [ 314 "-DOPUS_X86_MAY_HAVE_SSE4_1", 315 "-DOPUS_X86_PRESUME_SSE4_1", 316 ], 317 }, 318 }, 319 320 x86_64: { 321 ssse3: { 322 srcs: [ 323 // CELT_SOURCES_SSE 324 "celt/x86/x86cpu.c", 325 "celt/x86/x86_celt_map.c", 326 "celt/x86/pitch_sse.c", 327 328 // CELT_SOURCES_SSE2 329 "celt/x86/pitch_sse2.c", 330 "celt/x86/vq_sse2.c", 331 ], 332 333 cflags: [ 334 "-DOPUS_X86_MAY_HAVE_SSE", 335 "-DOPUS_X86_PRESUME_SSE", 336 "-DOPUS_X86_MAY_HAVE_SSE2", 337 "-DOPUS_X86_PRESUME_SSE2", 338 ], 339 }, 340 341 sse4_1: { 342 srcs: [ 343 // CELT_SOURCES_SSE4_1 344 "celt/x86/celt_lpc_sse4_1.c", 345 "celt/x86/pitch_sse4_1.c", 346 347 // SILK_SOURCES_SSE4_1 348 "silk/x86/NSQ_sse4_1.c", 349 "silk/x86/NSQ_del_dec_sse4_1.c", 350 "silk/x86/x86_silk_map.c", 351 "silk/x86/VAD_sse4_1.c", 352 "silk/x86/VQ_WMat_EC_sse4_1.c", 353 354 // SILK_SOURCES_FIXED_SSE4_1 355 "silk/fixed/x86/vector_ops_FIX_sse4_1.c", 356 "silk/fixed/x86/burg_modified_FIX_sse4_1.c", 357 ], 358 359 cflags: [ 360 "-DOPUS_X86_MAY_HAVE_SSE4_1", 361 "-DOPUS_X86_PRESUME_SSE4_1", 362 ], 363 }, 364 }, 365 }, 366 367 target: { 368 darwin: { 369 enabled: false, 370 }, 371 }, 372 apex_available: [ 373 "//apex_available:platform", // used by libstagefright_soft_opusdec 374 "com.android.media.swcodec", 375 "com.android.btservices", 376 ], 377 min_sdk_version: "29", 378} 379