Home | History | Annotate | Download | only in libopus
      1 cc_library_shared {
      2     name: "libopus",
      3     vendor_available: true,
      4     host_supported: true,
      5 
      6     export_include_dirs: ["include"],
      7 
      8     local_include_dirs: [
      9         "src",
     10         "silk",
     11         "celt",
     12         "silk/fixed",
     13     ],
     14 
     15     sanitize: {
     16         integer_overflow: true,
     17         misc_undefined: ["bounds"],
     18         blacklist: "libopus_blacklist.txt",
     19     },
     20 
     21     srcs: [
     22         // CELT_SOURCES
     23         "celt/bands.c",
     24         "celt/celt.c",
     25         "celt/celt_encoder.c",
     26         "celt/celt_decoder.c",
     27         "celt/cwrs.c",
     28         "celt/entcode.c",
     29         "celt/entdec.c",
     30         "celt/entenc.c",
     31         "celt/kiss_fft.c",
     32         "celt/laplace.c",
     33         "celt/mathops.c",
     34         "celt/mdct.c",
     35         "celt/modes.c",
     36         "celt/pitch.c",
     37         "celt/celt_lpc.c",
     38         "celt/quant_bands.c",
     39         "celt/rate.c",
     40         "celt/vq.c",
     41 
     42         // SILK_SOURCES
     43         "silk/CNG.c",
     44         "silk/code_signs.c",
     45         "silk/init_decoder.c",
     46         "silk/decode_core.c",
     47         "silk/decode_frame.c",
     48         "silk/decode_parameters.c",
     49         "silk/decode_indices.c",
     50         "silk/decode_pulses.c",
     51         "silk/decoder_set_fs.c",
     52         "silk/dec_API.c",
     53         "silk/enc_API.c",
     54         "silk/encode_indices.c",
     55         "silk/encode_pulses.c",
     56         "silk/gain_quant.c",
     57         "silk/interpolate.c",
     58         "silk/LP_variable_cutoff.c",
     59         "silk/NLSF_decode.c",
     60         "silk/NSQ.c",
     61         "silk/NSQ_del_dec.c",
     62         "silk/PLC.c",
     63         "silk/shell_coder.c",
     64         "silk/tables_gain.c",
     65         "silk/tables_LTP.c",
     66         "silk/tables_NLSF_CB_NB_MB.c",
     67         "silk/tables_NLSF_CB_WB.c",
     68         "silk/tables_other.c",
     69         "silk/tables_pitch_lag.c",
     70         "silk/tables_pulses_per_block.c",
     71         "silk/VAD.c",
     72         "silk/control_audio_bandwidth.c",
     73         "silk/quant_LTP_gains.c",
     74         "silk/VQ_WMat_EC.c",
     75         "silk/HP_variable_cutoff.c",
     76         "silk/NLSF_encode.c",
     77         "silk/NLSF_VQ.c",
     78         "silk/NLSF_unpack.c",
     79         "silk/NLSF_del_dec_quant.c",
     80         "silk/process_NLSFs.c",
     81         "silk/stereo_LR_to_MS.c",
     82         "silk/stereo_MS_to_LR.c",
     83         "silk/check_control_input.c",
     84         "silk/control_SNR.c",
     85         "silk/init_encoder.c",
     86         "silk/control_codec.c",
     87         "silk/A2NLSF.c",
     88         "silk/ana_filt_bank_1.c",
     89         "silk/biquad_alt.c",
     90         "silk/bwexpander_32.c",
     91         "silk/bwexpander.c",
     92         "silk/debug.c",
     93         "silk/decode_pitch.c",
     94         "silk/inner_prod_aligned.c",
     95         "silk/lin2log.c",
     96         "silk/log2lin.c",
     97         "silk/LPC_analysis_filter.c",
     98         "silk/LPC_fit.c",
     99         "silk/LPC_inv_pred_gain.c",
    100         "silk/table_LSF_cos.c",
    101         "silk/NLSF2A.c",
    102         "silk/NLSF_stabilize.c",
    103         "silk/NLSF_VQ_weights_laroia.c",
    104         "silk/pitch_est_tables.c",
    105         "silk/resampler.c",
    106         "silk/resampler_down2_3.c",
    107         "silk/resampler_down2.c",
    108         "silk/resampler_private_AR2.c",
    109         "silk/resampler_private_down_FIR.c",
    110         "silk/resampler_private_IIR_FIR.c",
    111         "silk/resampler_private_up2_HQ.c",
    112         "silk/resampler_rom.c",
    113         "silk/sigm_Q15.c",
    114         "silk/sort.c",
    115         "silk/sum_sqr_shift.c",
    116         "silk/stereo_decode_pred.c",
    117         "silk/stereo_encode_pred.c",
    118         "silk/stereo_find_predictor.c",
    119         "silk/stereo_quant_pred.c",
    120 
    121         // SILK_SOURCES_FIXED
    122         "silk/fixed/LTP_analysis_filter_FIX.c",
    123         "silk/fixed/LTP_scale_ctrl_FIX.c",
    124         "silk/fixed/corrMatrix_FIX.c",
    125         "silk/fixed/encode_frame_FIX.c",
    126         "silk/fixed/find_LPC_FIX.c",
    127         "silk/fixed/find_LTP_FIX.c",
    128         "silk/fixed/find_pitch_lags_FIX.c",
    129         "silk/fixed/find_pred_coefs_FIX.c",
    130         "silk/fixed/noise_shape_analysis_FIX.c",
    131         "silk/fixed/process_gains_FIX.c",
    132         "silk/fixed/regularize_correlations_FIX.c",
    133         "silk/fixed/residual_energy16_FIX.c",
    134         "silk/fixed/residual_energy_FIX.c",
    135         "silk/fixed/warped_autocorrelation_FIX.c",
    136         "silk/fixed/apply_sine_window_FIX.c",
    137         "silk/fixed/autocorr_FIX.c",
    138         "silk/fixed/burg_modified_FIX.c",
    139         "silk/fixed/k2a_FIX.c",
    140         "silk/fixed/k2a_Q16_FIX.c",
    141         "silk/fixed/pitch_analysis_core_FIX.c",
    142         "silk/fixed/vector_ops_FIX.c",
    143         "silk/fixed/schur64_FIX.c",
    144         "silk/fixed/schur_FIX.c",
    145 
    146         // OPUS_SOURCES
    147         "src/mapping_matrix.c",
    148         "src/opus.c",
    149         "src/opus_decoder.c",
    150         "src/opus_encoder.c",
    151         "src/opus_multistream.c",
    152         "src/opus_multistream_encoder.c",
    153         "src/opus_multistream_decoder.c",
    154         "src/opus_projection_encoder.c",
    155         "src/opus_projection_decoder.c",
    156         "src/repacketizer.c",
    157 
    158         // OPUS_SOURCES_FLOAT
    159         "src/analysis.c",
    160         "src/mlp.c",
    161         "src/mlp_data.c",
    162     ],
    163 
    164     cflags: [
    165         "-DNULL=0",
    166         "-DSOCKLEN_T=socklen_t",
    167         "-DLOCALE_NOT_USED",
    168         "-D_LARGEFILE_SOURCE=1",
    169         "-D_FILE_OFFSET_BITS=64",
    170         "-Drestrict=",
    171         "-D__EMX__",
    172         "-DOPUS_BUILD",
    173         "-DFIXED_POINT",
    174         "-DUSE_ALLOCA",
    175         "-DHAVE_LRINT",
    176         "-DHAVE_LRINTF",
    177         "-DENABLE_HARDENING",
    178         "-O2",
    179         "-fno-math-errno",
    180         "-Wall",
    181         "-Werror",
    182     ],
    183     cppflags: [
    184         "-DBSD=1",
    185         "-ffast-math",
    186         "-O2",
    187         "-funroll-loops",
    188     ],
    189 
    190     arch: {
    191         arm: {
    192             srcs: [
    193                 // CELT_SOURCES_ARM
    194                 "celt/arm/armcpu.c",
    195                 "celt/arm/arm_celt_map.c",
    196 
    197                 // DSP, MEDIA and NEON instructions are in the same assembler
    198                 // file - thus we need to include it even if NEON is not
    199                 // supported on target platform.
    200                 // CELT_SOURCES_ARM_ASM
    201                 "celt/arm/celt_pitch_xcorr_arm_gnu.s",
    202 
    203                 // CELT_AM_SOURCES_ARM_ASM
    204                 "celt/arm/armopts_gnu.s",
    205             ],
    206 
    207             cflags: [
    208                 "-DOPUS_ARM_ASM",
    209                 "-DOPUS_ARM_INLINE_ASM",
    210                 "-DOPUS_ARM_MAY_HAVE_EDSP",
    211                 "-DOPUS_ARM_INLINE_EDSP",
    212                 "-DOPUS_ARM_MAY_HAVE_MEDIA",
    213                 "-DOPUS_ARM_INLINE_MEDIA",
    214                 "-DOPUS_ARM_MAY_HAVE_NEON",
    215                 "-DOPUS_HAVE_RTCD",
    216             ],
    217 
    218             // Note: OPUS enhanced DSP/NEON implementation is not yet
    219             // compatible with arm64.  Only add the appropriate defines for
    220             // 32-bit arm architecture.
    221             neon: {
    222                 srcs: [
    223                     // CELT_SOURCES_ARM_NEON_INTR
    224                     "celt/arm/celt_neon_intr.c",
    225                     "celt/arm/pitch_neon_intr.c",
    226 
    227                     // SILK_SOURCES_ARM_NEON_INTR,
    228                     "silk/arm/arm_silk_map.c",
    229                     "silk/arm/biquad_alt_neon_intr.c",
    230                     "silk/arm/LPC_inv_pred_gain_neon_intr.c",
    231                     "silk/arm/NSQ_del_dec_neon_intr.c",
    232                     "silk/arm/NSQ_neon.c",
    233 
    234                     // SILK_SOURCES_FIXED_ARM_NEON_INTR,
    235                     "silk/fixed/arm/warped_autocorrelation_FIX_neon_intr.c",
    236                 ],
    237 
    238                 cflags: [
    239                     "-DOPUS_ARM_MAY_HAVE_NEON",
    240                     "-DOPUS_ARM_MAY_HAVE_NEON_INTR",
    241                     "-DOPUS_ARM_PRESUME_NEON",
    242                     "-DOPUS_ARM_INLINE_NEON",
    243                 ],
    244             },
    245 
    246         },
    247 
    248         x86: {
    249             ssse3: {
    250                 srcs: [
    251                     // CELT_SOURCES_SSE
    252                     "celt/x86/x86cpu.c",
    253                     "celt/x86/x86_celt_map.c",
    254                     "celt/x86/pitch_sse.c",
    255 
    256                     // CELT_SOURCES_SSE2
    257                     "celt/x86/pitch_sse2.c",
    258                     "celt/x86/vq_sse2.c",
    259                 ],
    260 
    261                 cflags: [
    262                     "-DOPUS_X86_MAY_HAVE_SSE",
    263                     "-DOPUS_X86_PRESUME_SSE",
    264                     "-DOPUS_X86_MAY_HAVE_SSE2",
    265                     "-DOPUS_X86_PRESUME_SSE2",
    266                 ],
    267             },
    268 
    269             sse4_1: {
    270                 srcs: [
    271                     // CELT_SOURCES_SSE4_1
    272                     "celt/x86/celt_lpc_sse4_1.c",
    273                     "celt/x86/pitch_sse4_1.c",
    274 
    275                     // SILK_SOURCES_SSE4_1
    276                     "silk/x86/NSQ_sse4_1.c",
    277                     "silk/x86/NSQ_del_dec_sse4_1.c",
    278                     "silk/x86/x86_silk_map.c",
    279                     "silk/x86/VAD_sse4_1.c",
    280                     "silk/x86/VQ_WMat_EC_sse4_1.c",
    281 
    282                     // SILK_SOURCES_FIXED_SSE4_1
    283                     "silk/fixed/x86/vector_ops_FIX_sse4_1.c",
    284                     "silk/fixed/x86/burg_modified_FIX_sse4_1.c",
    285                 ],
    286 
    287                 cflags: [
    288                     "-DOPUS_X86_MAY_HAVE_SSE4_1",
    289                     "-DOPUS_X86_PRESUME_SSE4_1",
    290                 ],
    291             },
    292         },
    293 
    294         x86_64: {
    295             ssse3: {
    296                 srcs: [
    297                     // CELT_SOURCES_SSE
    298                     "celt/x86/x86cpu.c",
    299                     "celt/x86/x86_celt_map.c",
    300                     "celt/x86/pitch_sse.c",
    301 
    302                     // CELT_SOURCES_SSE2
    303                     "celt/x86/pitch_sse2.c",
    304                     "celt/x86/vq_sse2.c",
    305                 ],
    306 
    307                 cflags: [
    308                     "-DOPUS_X86_MAY_HAVE_SSE",
    309                     "-DOPUS_X86_PRESUME_SSE",
    310                     "-DOPUS_X86_MAY_HAVE_SSE2",
    311                     "-DOPUS_X86_PRESUME_SSE2",
    312                 ],
    313             },
    314 
    315             sse4_1: {
    316                 srcs: [
    317                     // CELT_SOURCES_SSE4_1
    318                     "celt/x86/celt_lpc_sse4_1.c",
    319                     "celt/x86/pitch_sse4_1.c",
    320 
    321                     // SILK_SOURCES_SSE4_1
    322                     "silk/x86/NSQ_sse4_1.c",
    323                     "silk/x86/NSQ_del_dec_sse4_1.c",
    324                     "silk/x86/x86_silk_map.c",
    325                     "silk/x86/VAD_sse4_1.c",
    326                     "silk/x86/VQ_WMat_EC_sse4_1.c",
    327 
    328                     // SILK_SOURCES_FIXED_SSE4_1
    329                     "silk/fixed/x86/vector_ops_FIX_sse4_1.c",
    330                     "silk/fixed/x86/burg_modified_FIX_sse4_1.c",
    331                 ],
    332 
    333                 cflags: [
    334                     "-DOPUS_X86_MAY_HAVE_SSE4_1",
    335                     "-DOPUS_X86_PRESUME_SSE4_1",
    336                 ],
    337             },
    338         },
    339     },
    340 }
    341