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