• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1package {
2    default_applicable_licenses: ["external_libhevc_license"],
3}
4
5// Added automatically by a large-scale-change
6// See: http://go/android-license-faq
7license {
8    name: "external_libhevc_license",
9    visibility: [":__subpackages__"],
10    license_kinds: [
11        "SPDX-license-identifier-Apache-2.0",
12    ],
13    license_text: [
14        "NOTICE",
15    ],
16}
17
18cc_library_headers {
19    name: "libhevcdec_headers",
20    export_include_dirs: [
21        "common",
22        "decoder",
23    ],
24    min_sdk_version: "29",
25}
26
27cc_library_headers {
28    name: "libhevcenc_headers",
29    export_include_dirs: [
30        "common",
31        "encoder",
32    ],
33    min_sdk_version: "29",
34}
35
36cc_library_static {
37    name: "libhevcdec",
38    vendor_available: true,
39    host_supported: true,
40
41    cflags: [
42        "-D_LIB",
43        "-DMULTICORE",
44        "-fPIC",
45
46        "-O3",
47        "-DANDROID",
48        "-Wall",
49        "-Werror",
50        // common/x86/ihevc_sao_ssse3_intr.c: implicit conversion from
51        // 'int' to 'char' changes value from 128 to -128
52        "-Wno-error=constant-conversion",
53        // #KEEP_THREAD_ACTIVE is experimental
54        "-UKEEP_THREADS_ACTIVE",
55    ],
56
57    export_include_dirs: [
58        "common",
59        "decoder",
60    ],
61
62    srcs: [
63        "common/ihevc_quant_tables.c",
64        "common/ihevc_inter_pred_filters.c",
65        "common/ihevc_weighted_pred.c",
66        "common/ihevc_padding.c",
67        "common/ihevc_deblk_edge_filter.c",
68        "common/ihevc_deblk_tables.c",
69        "common/ihevc_cabac_tables.c",
70        "common/ihevc_common_tables.c",
71        "common/ihevc_intra_pred_filters.c",
72        "common/ihevc_chroma_intra_pred_filters.c",
73        "common/ihevc_mem_fns.c",
74        "common/ihevc_sao.c",
75        "common/ihevc_trans_tables.c",
76        "common/ihevc_recon.c",
77        "common/ihevc_itrans.c",
78        "common/ihevc_itrans_recon.c",
79        "common/ihevc_iquant_recon.c",
80        "common/ihevc_iquant_itrans_recon.c",
81        "common/ihevc_itrans_recon_32x32.c",
82        "common/ihevc_itrans_recon_16x16.c",
83        "common/ihevc_itrans_recon_8x8.c",
84        "common/ihevc_chroma_itrans_recon.c",
85        "common/ihevc_chroma_iquant_recon.c",
86        "common/ihevc_chroma_iquant_itrans_recon.c",
87        "common/ihevc_chroma_recon.c",
88        "common/ihevc_chroma_itrans_recon_16x16.c",
89        "common/ihevc_chroma_itrans_recon_8x8.c",
90        "common/ihevc_buf_mgr.c",
91        "common/ihevc_disp_mgr.c",
92        "common/ihevc_dpb_mgr.c",
93        "common/ithread.c",
94        "decoder/ihevcd_version.c",
95        "decoder/ihevcd_api.c",
96        "decoder/ihevcd_decode.c",
97        "decoder/ihevcd_nal.c",
98        "decoder/ihevcd_bitstream.c",
99        "decoder/ihevcd_parse_headers.c",
100        "decoder/ihevcd_parse_slice_header.c",
101        "decoder/ihevcd_parse_slice.c",
102        "decoder/ihevcd_parse_residual.c",
103        "decoder/ihevcd_cabac.c",
104        "decoder/ihevcd_intra_pred_mode_prediction.c",
105        "decoder/ihevcd_process_slice.c",
106        "decoder/ihevcd_utils.c",
107        "decoder/ihevcd_job_queue.c",
108        "decoder/ihevcd_ref_list.c",
109        "decoder/ihevcd_get_mv.c",
110        "decoder/ihevcd_mv_pred.c",
111        "decoder/ihevcd_mv_merge.c",
112        "decoder/ihevcd_iquant_itrans_recon_ctb.c",
113        "decoder/ihevcd_itrans_recon_dc.c",
114        "decoder/ihevcd_common_tables.c",
115        "decoder/ihevcd_boundary_strength.c",
116        "decoder/ihevcd_deblk.c",
117        "decoder/ihevcd_inter_pred.c",
118        "decoder/ihevcd_sao.c",
119        "decoder/ihevcd_ilf_padding.c",
120        "decoder/ihevcd_fmt_conv.c",
121    ],
122
123    arch: {
124        arm64: {
125            cflags: [
126                "-DARMV8",
127                "-DDISABLE_NEONINTR",
128                "-DARM",
129                "-DARMGCC",
130
131                "-DDEFAULT_ARCH=D_ARCH_ARMV8_GENERIC",
132            ],
133            local_include_dirs: [
134                "decoder/arm",
135                "common/arm",
136                "decoder/arm64",
137                "common/arm64",
138            ],
139
140            srcs: [
141                "decoder/arm/ihevcd_function_selector.c",
142                "decoder/arm/ihevcd_function_selector_noneon.c",
143                "decoder/arm64/ihevcd_function_selector_av8.c",
144                "common/arm/ihevc_intra_pred_filters_neon_intr.c",
145                "common/arm/ihevc_weighted_pred_neon_intr.c",
146                "common/arm64/ihevc_mem_fns.s",
147                "common/arm64/ihevc_itrans_recon_32x32.s",
148                "common/arm64/ihevc_weighted_pred_bi_default.s",
149                "common/arm64/ihevc_weighted_pred_bi.s",
150                "common/arm64/ihevc_weighted_pred_uni.s",
151                "common/arm64/ihevc_deblk_luma_horz.s",
152                "common/arm64/ihevc_deblk_luma_vert.s",
153                "common/arm64/ihevc_deblk_chroma_vert.s",
154                "common/arm64/ihevc_deblk_chroma_horz.s",
155                "common/arm64/ihevc_sao_band_offset_luma.s",
156                "common/arm64/ihevc_sao_band_offset_chroma.s",
157                "common/arm64/ihevc_sao_edge_offset_class0.s",
158                "common/arm64/ihevc_sao_edge_offset_class0_chroma.s",
159                "common/arm64/ihevc_sao_edge_offset_class1.s",
160                "common/arm64/ihevc_sao_edge_offset_class1_chroma.s",
161                "common/arm64/ihevc_sao_edge_offset_class2.s",
162                "common/arm64/ihevc_sao_edge_offset_class2_chroma.s",
163                "common/arm64/ihevc_sao_edge_offset_class3.s",
164                "common/arm64/ihevc_sao_edge_offset_class3_chroma.s",
165                "common/arm64/ihevc_inter_pred_luma_horz_w16out.s",
166                "common/arm64/ihevc_inter_pred_filters_luma_horz.s",
167                "common/arm64/ihevc_inter_pred_filters_luma_vert.s",
168                "common/arm64/ihevc_inter_pred_chroma_horz.s",
169                "common/arm64/ihevc_inter_pred_chroma_horz_w16out.s",
170                "common/arm64/ihevc_inter_pred_chroma_vert.s",
171                "common/arm64/ihevc_inter_pred_chroma_vert_w16out.s",
172                "common/arm64/ihevc_inter_pred_chroma_vert_w16inp.s",
173                "common/arm64/ihevc_inter_pred_chroma_vert_w16inp_w16out.s",
174                "common/arm64/ihevc_inter_pred_filters_luma_vert_w16inp.s",
175                "common/arm64/ihevc_inter_pred_filters_luma_vert_w16out.s",
176                "common/arm64/ihevc_inter_pred_luma_vert_w16inp_w16out.s",
177                "common/arm64/ihevc_inter_pred_luma_copy_w16out.s",
178                "common/arm64/ihevc_inter_pred_luma_copy.s",
179                "common/arm64/ihevc_inter_pred_chroma_copy.s",
180                "common/arm64/ihevc_inter_pred_chroma_copy_w16out.s",
181                "common/arm64/ihevc_itrans_recon_4x4_ttype1.s",
182                "common/arm64/ihevc_itrans_recon_4x4.s",
183                "common/arm64/ihevc_itrans_recon_8x8.s",
184                "common/arm64/ihevc_itrans_recon_16x16.s",
185                "common/arm64/ihevc_intra_pred_chroma_planar.s",
186                "common/arm64/ihevc_intra_pred_chroma_dc.s",
187                "common/arm64/ihevc_intra_pred_chroma_horz.s",
188                "common/arm64/ihevc_intra_pred_chroma_ver.s",
189                "common/arm64/ihevc_intra_pred_chroma_mode2.s",
190                "common/arm64/ihevc_intra_pred_chroma_mode_18_34.s",
191                "common/arm64/ihevc_intra_pred_filters_chroma_mode_11_to_17.s",
192                "common/arm64/ihevc_intra_pred_filters_chroma_mode_19_to_25.s",
193                "common/arm64/ihevc_intra_pred_chroma_mode_3_to_9.s",
194                "common/arm64/ihevc_intra_pred_chroma_mode_27_to_33.s",
195                "common/arm64/ihevc_intra_pred_luma_planar.s",
196                "common/arm64/ihevc_intra_pred_luma_horz.s",
197                "common/arm64/ihevc_intra_pred_luma_mode2.s",
198                "common/arm64/ihevc_intra_pred_luma_mode_27_to_33.s",
199                "common/arm64/ihevc_intra_pred_luma_mode_18_34.s",
200                "common/arm64/ihevc_intra_pred_luma_vert.s",
201                "common/arm64/ihevc_intra_pred_luma_dc.s",
202                "common/arm64/ihevc_intra_pred_filters_luma_mode_11_to_17.s",
203                "common/arm64/ihevc_intra_pred_filters_luma_mode_19_to_25.s",
204                "common/arm64/ihevc_intra_pred_luma_mode_3_to_9.s",
205                "common/arm64/ihevc_padding.s",
206                "decoder/arm64/ihevcd_itrans_recon_dc_luma.s",
207                "decoder/arm64/ihevcd_itrans_recon_dc_chroma.s",
208                "decoder/arm64/ihevcd_fmt_conv_420sp_to_420p.s",
209                "decoder/arm64/ihevcd_fmt_conv_420sp_to_420sp.s",
210                "decoder/arm64/ihevcd_fmt_conv_420sp_to_rgba8888.s",
211            ],
212        },
213
214        arm: {
215            local_include_dirs: [
216                "decoder/arm",
217                "common/arm",
218            ],
219
220            srcs: [
221                "decoder/arm/ihevcd_function_selector.c",
222                "decoder/arm/ihevcd_function_selector_noneon.c",
223            ],
224
225            cflags: [
226                "-DDISABLE_NEONINTR",
227                "-DARM",
228                "-DARMGCC",
229                "-fno-tree-vectorize",
230
231                // These will be overriden by armv7_a_neon
232                "-DDISABLE_NEON",
233                "-DDEFAULT_ARCH=D_ARCH_ARM_NONEON",
234            ],
235
236            instruction_set: "arm",
237
238            neon: {
239                srcs: [
240                    "decoder/arm/ihevcd_function_selector_a9q.c",
241                    "common/arm/ihevc_intra_ref_substitution_a9q.c",
242                    "common/arm/ihevc_intra_pred_filters_neon_intr.c",
243                    "common/arm/ihevc_weighted_pred_neon_intr.c",
244                    "common/arm/ihevc_mem_fns.s",
245                    "common/arm/ihevc_itrans_recon_32x32.s",
246                    "common/arm/ihevc_weighted_pred_bi_default.s",
247                    "common/arm/ihevc_weighted_pred_bi.s",
248                    "common/arm/ihevc_weighted_pred_uni.s",
249                    "common/arm/ihevc_deblk_luma_horz.s",
250                    "common/arm/ihevc_deblk_luma_vert.s",
251                    "common/arm/ihevc_deblk_chroma_vert.s",
252                    "common/arm/ihevc_deblk_chroma_horz.s",
253                    "common/arm/ihevc_sao_band_offset_luma.s",
254                    "common/arm/ihevc_sao_band_offset_chroma.s",
255                    "common/arm/ihevc_sao_edge_offset_class0.s",
256                    "common/arm/ihevc_sao_edge_offset_class0_chroma.s",
257                    "common/arm/ihevc_sao_edge_offset_class1.s",
258                    "common/arm/ihevc_sao_edge_offset_class1_chroma.s",
259                    "common/arm/ihevc_sao_edge_offset_class2.s",
260                    "common/arm/ihevc_sao_edge_offset_class2_chroma.s",
261                    "common/arm/ihevc_sao_edge_offset_class3.s",
262                    "common/arm/ihevc_sao_edge_offset_class3_chroma.s",
263                    "common/arm/ihevc_inter_pred_luma_horz_w16out.s",
264                    "common/arm/ihevc_inter_pred_filters_luma_horz.s",
265                    "common/arm/ihevc_inter_pred_filters_luma_vert.s",
266                    "common/arm/ihevc_inter_pred_chroma_horz.s",
267                    "common/arm/ihevc_inter_pred_chroma_horz_w16out.s",
268                    "common/arm/ihevc_inter_pred_chroma_vert.s",
269                    "common/arm/ihevc_inter_pred_chroma_vert_w16out.s",
270                    "common/arm/ihevc_inter_pred_chroma_vert_w16inp.s",
271                    "common/arm/ihevc_inter_pred_chroma_vert_w16inp_w16out.s",
272                    "common/arm/ihevc_inter_pred_filters_luma_vert_w16inp.s",
273                    "common/arm/ihevc_inter_pred_luma_vert_w16inp_w16out.s",
274                    "common/arm/ihevc_inter_pred_luma_copy_w16out.s",
275                    "common/arm/ihevc_inter_pred_luma_copy.s",
276                    "common/arm/ihevc_inter_pred_chroma_copy.s",
277                    "common/arm/ihevc_inter_pred_chroma_copy_w16out.s",
278                    "common/arm/ihevc_itrans_recon_4x4_ttype1.s",
279                    "common/arm/ihevc_itrans_recon_4x4.s",
280                    "common/arm/ihevc_itrans_recon_8x8.s",
281                    "common/arm/ihevc_itrans_recon_16x16.s",
282                    "common/arm/ihevc_intra_pred_chroma_planar.s",
283                    "common/arm/ihevc_intra_pred_chroma_dc.s",
284                    "common/arm/ihevc_intra_pred_chroma_horz.s",
285                    "common/arm/ihevc_intra_pred_chroma_ver.s",
286                    "common/arm/ihevc_intra_pred_chroma_mode2.s",
287                    "common/arm/ihevc_intra_pred_chroma_mode_18_34.s",
288                    "common/arm/ihevc_intra_pred_filters_chroma_mode_11_to_17.s",
289                    "common/arm/ihevc_intra_pred_filters_chroma_mode_19_to_25.s",
290                    "common/arm/ihevc_intra_pred_chroma_mode_3_to_9.s",
291                    "common/arm/ihevc_intra_pred_chroma_mode_27_to_33.s",
292                    "common/arm/ihevc_intra_pred_luma_planar.s",
293                    "common/arm/ihevc_intra_pred_luma_horz.s",
294                    "common/arm/ihevc_intra_pred_luma_mode2.s",
295                    "common/arm/ihevc_intra_pred_luma_mode_27_to_33.s",
296                    "common/arm/ihevc_intra_pred_luma_mode_18_34.s",
297                    "common/arm/ihevc_intra_pred_luma_vert.s",
298                    "common/arm/ihevc_intra_pred_luma_dc.s",
299                    "common/arm/ihevc_intra_pred_filters_luma_mode_11_to_17.s",
300                    "common/arm/ihevc_intra_pred_filters_luma_mode_19_to_25.s",
301                    "common/arm/ihevc_intra_pred_luma_mode_3_to_9.s",
302                    "common/arm/ihevc_padding.s",
303                    "decoder/arm/ihevcd_itrans_recon_dc_luma.s",
304                    "decoder/arm/ihevcd_itrans_recon_dc_chroma.s",
305                    "decoder/arm/ihevcd_fmt_conv_420sp_to_420p.s",
306                    "decoder/arm/ihevcd_fmt_conv_420sp_to_420sp.s",
307                    "decoder/arm/ihevcd_fmt_conv_420sp_to_rgba8888.s",
308                ],
309                cflags: [
310                    "-UDISABLE_NEON",
311                    "-UDEFAULT_ARCH",
312                    "-DDEFAULT_ARCH=D_ARCH_ARM_A9Q",
313                ],
314            },
315        },
316
317        x86_64: {
318            cflags: [
319                "-DX86",
320                "-DDISABLE_AVX2",
321                "-msse4.2",
322                "-mno-avx",
323                "-DDEFAULT_ARCH=D_ARCH_X86_SSE42",
324            ],
325
326            local_include_dirs: [
327                "decoder/x86",
328                "common/x86",
329            ],
330
331            srcs: [
332                "decoder/x86/ihevcd_function_selector.c",
333                "decoder/x86/ihevcd_function_selector_generic.c",
334                "decoder/x86/ihevcd_function_selector_ssse3.c",
335                "decoder/x86/ihevcd_function_selector_sse42.c",
336                "common/x86/ihevc_inter_pred_filters_ssse3_intr.c",
337                "common/x86/ihevc_weighted_pred_ssse3_intr.c",
338                "common/x86/ihevc_intra_pred_filters_ssse3_intr.c",
339                "common/x86/ihevc_chroma_intra_pred_filters_ssse3_intr.c",
340                "common/x86/ihevc_itrans_recon_ssse3_intr.c",
341                "common/x86/ihevc_itrans_recon_16x16_ssse3_intr.c",
342                "common/x86/ihevc_itrans_recon_32x32_ssse3_intr.c",
343                "common/x86/ihevc_sao_ssse3_intr.c",
344                "common/x86/ihevc_deblk_ssse3_intr.c",
345                "common/x86/ihevc_padding_ssse3_intr.c",
346                "common/x86/ihevc_mem_fns_ssse3_intr.c",
347                "decoder/x86/ihevcd_fmt_conv_ssse3_intr.c",
348                "decoder/x86/ihevcd_it_rec_dc_ssse3_intr.c",
349                "common/x86/ihevc_inter_pred_filters_sse42_intr.c",
350                "common/x86/ihevc_weighted_pred_sse42_intr.c",
351                "common/x86/ihevc_intra_pred_filters_sse42_intr.c",
352                "common/x86/ihevc_chroma_intra_pred_filters_sse42_intr.c",
353                "common/x86/ihevc_itrans_recon_sse42_intr.c",
354                "common/x86/ihevc_16x16_itrans_recon_sse42_intr.c",
355                "common/x86/ihevc_32x32_itrans_recon_sse42_intr.c",
356                "decoder/x86/ihevcd_it_rec_dc_sse42_intr.c",
357                "common/x86/ihevc_tables_x86_intr.c",
358            ],
359        },
360
361        x86: {
362            cflags: [
363                "-DX86",
364                "-DDISABLE_AVX2",
365                "-msse4.2",
366                "-mno-avx",
367                "-DDEFAULT_ARCH=D_ARCH_X86_SSE42",
368            ],
369
370            local_include_dirs: [
371                "decoder/x86",
372                "common/x86",
373            ],
374
375            srcs: [
376                "decoder/x86/ihevcd_function_selector.c",
377                "decoder/x86/ihevcd_function_selector_generic.c",
378                "decoder/x86/ihevcd_function_selector_ssse3.c",
379                "decoder/x86/ihevcd_function_selector_sse42.c",
380                "common/x86/ihevc_inter_pred_filters_ssse3_intr.c",
381                "common/x86/ihevc_weighted_pred_ssse3_intr.c",
382                "common/x86/ihevc_intra_pred_filters_ssse3_intr.c",
383                "common/x86/ihevc_chroma_intra_pred_filters_ssse3_intr.c",
384                "common/x86/ihevc_itrans_recon_ssse3_intr.c",
385                "common/x86/ihevc_itrans_recon_16x16_ssse3_intr.c",
386                "common/x86/ihevc_itrans_recon_32x32_ssse3_intr.c",
387                "common/x86/ihevc_sao_ssse3_intr.c",
388                "common/x86/ihevc_deblk_ssse3_intr.c",
389                "common/x86/ihevc_padding_ssse3_intr.c",
390                "common/x86/ihevc_mem_fns_ssse3_intr.c",
391                "decoder/x86/ihevcd_fmt_conv_ssse3_intr.c",
392                "decoder/x86/ihevcd_it_rec_dc_ssse3_intr.c",
393                "common/x86/ihevc_inter_pred_filters_sse42_intr.c",
394                "common/x86/ihevc_weighted_pred_sse42_intr.c",
395                "common/x86/ihevc_intra_pred_filters_sse42_intr.c",
396                "common/x86/ihevc_chroma_intra_pred_filters_sse42_intr.c",
397                "common/x86/ihevc_itrans_recon_sse42_intr.c",
398                "common/x86/ihevc_16x16_itrans_recon_sse42_intr.c",
399                "common/x86/ihevc_32x32_itrans_recon_sse42_intr.c",
400                "decoder/x86/ihevcd_it_rec_dc_sse42_intr.c",
401                "common/x86/ihevc_tables_x86_intr.c",
402            ],
403        },
404    },
405
406    sanitize: {
407        integer_overflow: true,
408        misc_undefined: ["bounds"],
409        // Enable CFI if this becomes a shared library.
410        cfi: true,
411	config: {
412            cfi_assembly_support: true,
413        },
414        blocklist: "libhevc_blocklist.txt",
415    },
416
417    apex_available: [
418        "//apex_available:platform",
419        "com.android.media.swcodec",
420    ],
421    min_sdk_version: "29",
422}
423
424cc_test {
425    name: "hevcdec",
426    host_supported: true,
427    cflags: [
428        "-DPROFILE_ENABLE",
429        "-DARM",
430        "-fPIC",
431        "-DMD5_DISABLE",
432        "-Wall",
433        "-Werror",
434    ],
435    gtest: false,
436    srcs: ["test/decoder/main.c"],
437    static_libs: ["libhevcdec"],
438    target: {
439        darwin: {
440            enabled: false,
441        },
442    },
443}
444
445cc_library_static {
446    name: "libhevcenc",
447    vendor_available: true,
448    host_supported: true,
449    cflags: [
450        "-DENABLE_MAIN_REXT_PROFILE",
451        "-fPIC",
452        "-O3",
453        "-Wall",
454        "-Wno-unused-variable",
455        "-Wno-unused-parameter",
456        "-Wno-switch",
457    ],
458
459    export_include_dirs: [
460        "common",
461        "encoder",
462    ],
463
464    srcs: [
465        "common/ihevc_cabac_tables.c",
466        "common/ihevc_chroma_intra_pred_filters.c",
467        "common/ihevc_chroma_itrans_recon.c",
468        "common/ihevc_chroma_itrans_recon_16x16.c",
469        "common/ihevc_chroma_itrans_recon_8x8.c",
470        "common/ihevc_common_tables.c",
471        "common/ihevc_deblk_edge_filter.c",
472        "common/ihevc_deblk_tables.c",
473        "common/ihevc_hbd_deblk_edge_filter.c",
474        "common/ihevc_inter_pred_filters.c",
475        "common/ihevc_intra_pred_filters.c",
476        "common/ihevc_iquant_recon.c",
477        "common/ihevc_itrans_recon.c",
478        "common/ihevc_itrans_recon_16x16.c",
479        "common/ihevc_itrans_recon_32x32.c",
480        "common/ihevc_itrans_recon_8x8.c",
481        "common/ihevc_mem_fns.c",
482        "common/ihevc_padding.c",
483        "common/ihevc_quant_iquant_ssd.c",
484        "common/ihevc_quant_tables.c",
485        "common/ihevc_resi_trans.c",
486        "common/ihevc_sao.c",
487        "common/ihevc_trans_tables.c",
488        "common/ihevc_weighted_pred.c",
489        "encoder/bit_allocation.c",
490        "encoder/cbr_buffer_control.c",
491        "encoder/common_rom.c",
492        "encoder/convert_float_to_fix.c",
493        "encoder/est_sad.c",
494        "encoder/fixed_point_error_bits.c",
495        "encoder/frame_info_collector.c",
496        "encoder/hme_coarse.c",
497        "encoder/hme_common_utils.c",
498        "encoder/hme_err_compute.c",
499        "encoder/hme_fullpel.c",
500        "encoder/hme_function_selector.c",
501        "encoder/hme_globals.c",
502        "encoder/hme_interface.c",
503        "encoder/hme_refine.c",
504        "encoder/hme_search_algo.c",
505        "encoder/hme_subpel.c",
506        "encoder/hme_utils.c",
507        "encoder/ihevce_bitstream.c",
508        "encoder/ihevce_bs_compute_ctb.c",
509        "encoder/ihevce_buffer_que.c",
510        "encoder/ihevce_cabac.c",
511        "encoder/ihevce_cabac_cu_pu.c",
512        "encoder/ihevce_cabac_rdo.c",
513        "encoder/ihevce_cabac_tu.c",
514        "encoder/ihevce_chroma_had_satd.c",
515        "encoder/ihevce_cmn_utils_instr_set_router.c",
516        "encoder/ihevce_coarse_me_pass.c",
517        "encoder/ihevce_common_utils.c",
518        "encoder/ihevce_deblk.c",
519        "encoder/ihevce_decomp_pre_intra_pass.c",
520        "encoder/ihevce_dep_mngr.c",
521        "encoder/ihevce_enc_cu_recursion.c",
522        "encoder/ihevce_enc_loop_inter_mode_sifter.c",
523        "encoder/ihevce_enc_loop_pass.c",
524        "encoder/ihevce_enc_loop_utils.c",
525        "encoder/ihevce_enc_sbh_funcs.c",
526        "encoder/ihevce_enc_subpel_gen.c",
527        "encoder/ihevce_encode_header.c",
528        "encoder/ihevce_encode_header_sei_vui.c",
529        "encoder/ihevce_entropy_cod.c",
530        "encoder/ihevce_entropy_interface.c",
531        "encoder/ihevce_error_check.c",
532        "encoder/ihevce_frame_process.c",
533        "encoder/ihevce_frame_process_utils.c",
534        "encoder/ihevce_function_selector.c",
535        "encoder/ihevce_global_tables.c",
536        "encoder/ihevce_had_satd.c",
537        "encoder/ihevce_hle_interface.c",
538        "encoder/ihevce_hle_q_func.c",
539        "encoder/ihevce_inter_pred.c",
540        "encoder/ihevce_ipe_instr_set_router.c",
541        "encoder/ihevce_ipe_pass.c",
542        "encoder/ihevce_lap_interface.c",
543        "encoder/ihevce_me_instr_set_router.c",
544        "encoder/ihevce_me_pass.c",
545        "encoder/ihevce_memory_init.c",
546        "encoder/ihevce_multi_thrd_funcs.c",
547        "encoder/ihevce_mv_pred.c",
548        "encoder/ihevce_mv_pred_merge.c",
549        "encoder/ihevce_nbr_avail.c",
550        "encoder/ihevce_plugin.c",
551        "encoder/ihevce_profile.c",
552        "encoder/ihevce_rc_interface.c",
553        "encoder/ihevce_recur_bracketing.c",
554        "encoder/ihevce_sao.c",
555        "encoder/ihevce_stasino_helpers.c",
556        "encoder/ihevce_sub_pic_rc.c",
557        "encoder/ihevce_sys_api.c",
558        "encoder/ihevce_tile_interface.c",
559        "encoder/ihevce_trace.c",
560        "encoder/ihevce_tu_tree_selector.c",
561        "encoder/init_qp.c",
562        "encoder/mb_model_based.c",
563        "encoder/osal.c",
564        "encoder/osal_cond_var.c",
565        "encoder/osal_error.c",
566        "encoder/osal_mutex.c",
567        "encoder/osal_semaphore.c",
568        "encoder/osal_thread.c",
569        "encoder/picture_type.c",
570        "encoder/rate_control_api.c",
571        "encoder/rc_rd_model.c",
572        "encoder/rc_rd_model_fix.c",
573        "encoder/rc_sad_acc.c",
574        "encoder/sqrt_interp.c",
575        "encoder/var_q_operator.c",
576        "encoder/vbr_storage_vbv.c",
577        "encoder/vbr_str_prms.c",
578    ],
579
580    arch: {
581        arm64: {
582
583            local_include_dirs: [
584                "encoder/arm",
585                "common/arm",
586                "common/arm64",
587            ],
588
589            srcs: [
590                "encoder/arm/ihevce_coarse_layer_sad_neon.c",
591                "encoder/arm/ihevce_common_utils_neon.c",
592                "encoder/arm/ihevce_copy_neon.c",
593                "encoder/arm/ihevce_had_compute_neon.c",
594                "encoder/arm/ihevce_hme_utils_neon.c",
595                "encoder/arm/ihevce_itrans_recon_neon.c",
596                "encoder/arm/ihevce_me_neon.c",
597                "encoder/arm/ihevce_sad_compute_neon.c",
598                "encoder/arm/ihevce_scale_by_2_neon.c",
599                "encoder/arm/ihevce_scan_coeffs_neon.c",
600                "encoder/arm/ihevce_ssd_and_sad_calculator_neon.c",
601                "encoder/arm/ihevce_ssd_calculator_neon.c",
602                "encoder/arm/ihevce_subpel_neon.c",
603                "common/arm/ihevc_resi_trans_neon.c",
604                "common/arm/ihevc_resi_trans_neon_32x32.c",
605                "common/arm/ihevc_quant_iquant_ssd_neon_intr.c",
606                "common/arm/ihevc_intra_pred_filters_neon_intr.c",
607                "common/arm/ihevc_weighted_pred_neon_intr.c",
608                "common/arm/ihevc_intra_ref_substitution_a9q.c",
609                "common/arm64/ihevc_deblk_chroma_horz.s",
610                "common/arm64/ihevc_deblk_chroma_vert.s",
611                "common/arm64/ihevc_deblk_luma_horz.s",
612                "common/arm64/ihevc_deblk_luma_vert.s",
613                "common/arm64/ihevc_inter_pred_chroma_copy.s",
614                "common/arm64/ihevc_inter_pred_chroma_copy_w16out.s",
615                "common/arm64/ihevc_inter_pred_chroma_horz.s",
616                "common/arm64/ihevc_inter_pred_chroma_horz_w16out.s",
617                "common/arm64/ihevc_inter_pred_chroma_vert.s",
618                "common/arm64/ihevc_inter_pred_chroma_vert_w16inp.s",
619                "common/arm64/ihevc_inter_pred_chroma_vert_w16inp_w16out.s",
620                "common/arm64/ihevc_inter_pred_chroma_vert_w16out.s",
621                "common/arm64/ihevc_inter_pred_filters_luma_horz.s",
622                "common/arm64/ihevc_inter_pred_filters_luma_vert.s",
623                "common/arm64/ihevc_inter_pred_filters_luma_vert_w16inp.s",
624                "common/arm64/ihevc_inter_pred_filters_luma_vert_w16out.s",
625                "common/arm64/ihevc_inter_pred_luma_copy.s",
626                "common/arm64/ihevc_inter_pred_luma_copy_w16out.s",
627                "common/arm64/ihevc_inter_pred_luma_horz_w16out.s",
628                "common/arm64/ihevc_inter_pred_luma_vert_w16inp_w16out.s",
629                "common/arm64/ihevc_intra_pred_chroma_dc.s",
630                "common/arm64/ihevc_intra_pred_chroma_horz.s",
631                "common/arm64/ihevc_intra_pred_chroma_mode2.s",
632                "common/arm64/ihevc_intra_pred_chroma_mode_18_34.s",
633                "common/arm64/ihevc_intra_pred_chroma_mode_27_to_33.s",
634                "common/arm64/ihevc_intra_pred_chroma_mode_3_to_9.s",
635                "common/arm64/ihevc_intra_pred_chroma_planar.s",
636                "common/arm64/ihevc_intra_pred_chroma_ver.s",
637                "common/arm64/ihevc_intra_pred_filters_chroma_mode_11_to_17.s",
638                "common/arm64/ihevc_intra_pred_filters_chroma_mode_19_to_25.s",
639                "common/arm64/ihevc_intra_pred_filters_luma_mode_11_to_17.s",
640                "common/arm64/ihevc_intra_pred_filters_luma_mode_19_to_25.s",
641                "common/arm64/ihevc_intra_pred_luma_dc.s",
642                "common/arm64/ihevc_intra_pred_luma_horz.s",
643                "common/arm64/ihevc_intra_pred_luma_mode2.s",
644                "common/arm64/ihevc_intra_pred_luma_mode_18_34.s",
645                "common/arm64/ihevc_intra_pred_luma_mode_27_to_33.s",
646                "common/arm64/ihevc_intra_pred_luma_mode_3_to_9.s",
647                "common/arm64/ihevc_intra_pred_luma_planar.s",
648                "common/arm64/ihevc_intra_pred_luma_vert.s",
649                "common/arm64/ihevc_itrans_recon_16x16.s",
650                "common/arm64/ihevc_itrans_recon_32x32.s",
651                "common/arm64/ihevc_itrans_recon_4x4.s",
652                "common/arm64/ihevc_itrans_recon_4x4_ttype1.s",
653                "common/arm64/ihevc_itrans_recon_8x8.s",
654                "common/arm64/ihevc_mem_fns.s",
655                "common/arm64/ihevc_padding.s",
656                "common/arm64/ihevc_sao_band_offset_chroma.s",
657                "common/arm64/ihevc_sao_band_offset_luma.s",
658                "common/arm64/ihevc_sao_edge_offset_class0.s",
659                "common/arm64/ihevc_sao_edge_offset_class0_chroma.s",
660                "common/arm64/ihevc_sao_edge_offset_class1.s",
661                "common/arm64/ihevc_sao_edge_offset_class1_chroma.s",
662                "common/arm64/ihevc_sao_edge_offset_class2.s",
663                "common/arm64/ihevc_sao_edge_offset_class2_chroma.s",
664                "common/arm64/ihevc_sao_edge_offset_class3.s",
665                "common/arm64/ihevc_sao_edge_offset_class3_chroma.s",
666                "common/arm64/ihevc_weighted_pred_bi.s",
667                "common/arm64/ihevc_weighted_pred_bi_default.s",
668                "common/arm64/ihevc_weighted_pred_uni.s",
669            ],
670
671            cflags: [
672                "-DENABLE_NEON",
673                "-DARMV8",
674                "-DARM",
675            ],
676        },
677
678        arm: {
679            local_include_dirs: [
680                "encoder/arm",
681                "common/arm",
682            ],
683
684            instruction_set: "arm",
685
686            neon: {
687                srcs: [
688                    "encoder/arm/ihevce_coarse_layer_sad_neon.c",
689                    "encoder/arm/ihevce_common_utils_neon.c",
690                    "encoder/arm/ihevce_copy_neon.c",
691                    "encoder/arm/ihevce_had_compute_neon.c",
692                    "encoder/arm/ihevce_hme_utils_neon.c",
693                    "encoder/arm/ihevce_itrans_recon_neon.c",
694                    "encoder/arm/ihevce_me_neon.c",
695                    "encoder/arm/ihevce_sad_compute_neon.c",
696                    "encoder/arm/ihevce_scale_by_2_neon.c",
697                    "encoder/arm/ihevce_scan_coeffs_neon.c",
698                    "encoder/arm/ihevce_ssd_and_sad_calculator_neon.c",
699                    "encoder/arm/ihevce_ssd_calculator_neon.c",
700                    "encoder/arm/ihevce_subpel_neon.c",
701                    "common/arm/ihevc_resi_trans_neon.c",
702                    "common/arm/ihevc_resi_trans_neon_32x32.c",
703                    "common/arm/ihevc_quant_iquant_ssd_neon_intr.c",
704                    "common/arm/ihevc_intra_pred_filters_neon_intr.c",
705                    "common/arm/ihevc_weighted_pred_neon_intr.c",
706                    "common/arm/ihevc_intra_ref_substitution_a9q.c",
707                    "common/arm/ihevc_deblk_chroma_horz.s",
708                    "common/arm/ihevc_deblk_chroma_vert.s",
709                    "common/arm/ihevc_deblk_luma_horz.s",
710                    "common/arm/ihevc_deblk_luma_vert.s",
711                    "common/arm/ihevc_inter_pred_chroma_copy.s",
712                    "common/arm/ihevc_inter_pred_chroma_copy_w16out.s",
713                    "common/arm/ihevc_inter_pred_chroma_horz.s",
714                    "common/arm/ihevc_inter_pred_chroma_horz_w16out.s",
715                    "common/arm/ihevc_inter_pred_chroma_vert.s",
716                    "common/arm/ihevc_inter_pred_chroma_vert_w16inp.s",
717                    "common/arm/ihevc_inter_pred_chroma_vert_w16inp_w16out.s",
718                    "common/arm/ihevc_inter_pred_chroma_vert_w16out.s",
719                    "common/arm/ihevc_inter_pred_filters_luma_horz.s",
720                    "common/arm/ihevc_inter_pred_filters_luma_vert.s",
721                    "common/arm/ihevc_inter_pred_filters_luma_vert_w16inp.s",
722                    "common/arm/ihevc_inter_pred_luma_copy.s",
723                    "common/arm/ihevc_inter_pred_luma_copy_w16out.s",
724                    "common/arm/ihevc_inter_pred_luma_horz_w16out.s",
725                    "common/arm/ihevc_inter_pred_luma_vert_w16inp_w16out.s",
726                    "common/arm/ihevc_intra_pred_chroma_dc.s",
727                    "common/arm/ihevc_intra_pred_chroma_horz.s",
728                    "common/arm/ihevc_intra_pred_chroma_mode2.s",
729                    "common/arm/ihevc_intra_pred_chroma_mode_18_34.s",
730                    "common/arm/ihevc_intra_pred_chroma_mode_27_to_33.s",
731                    "common/arm/ihevc_intra_pred_chroma_mode_3_to_9.s",
732                    "common/arm/ihevc_intra_pred_chroma_planar.s",
733                    "common/arm/ihevc_intra_pred_chroma_ver.s",
734                    "common/arm/ihevc_intra_pred_filters_chroma_mode_11_to_17.s",
735                    "common/arm/ihevc_intra_pred_filters_chroma_mode_19_to_25.s",
736                    "common/arm/ihevc_intra_pred_filters_luma_mode_11_to_17.s",
737                    "common/arm/ihevc_intra_pred_filters_luma_mode_19_to_25.s",
738                    "common/arm/ihevc_intra_pred_luma_dc.s",
739                    "common/arm/ihevc_intra_pred_luma_horz.s",
740                    "common/arm/ihevc_intra_pred_luma_mode2.s",
741                    "common/arm/ihevc_intra_pred_luma_mode_18_34.s",
742                    "common/arm/ihevc_intra_pred_luma_mode_27_to_33.s",
743                    "common/arm/ihevc_intra_pred_luma_mode_3_to_9.s",
744                    "common/arm/ihevc_intra_pred_luma_planar.s",
745                    "common/arm/ihevc_intra_pred_luma_vert.s",
746                    "common/arm/ihevc_itrans_recon_16x16.s",
747                    "common/arm/ihevc_itrans_recon_32x32.s",
748                    "common/arm/ihevc_itrans_recon_4x4.s",
749                    "common/arm/ihevc_itrans_recon_4x4_ttype1.s",
750                    "common/arm/ihevc_itrans_recon_8x8.s",
751                    "common/arm/ihevc_resi_trans.s",
752                    "common/arm/ihevc_resi_trans_32x32_a9q.s",
753                    "common/arm/ihevc_mem_fns.s",
754                    "common/arm/ihevc_padding.s",
755                    "common/arm/ihevc_sao_band_offset_chroma.s",
756                    "common/arm/ihevc_sao_band_offset_luma.s",
757                    "common/arm/ihevc_sao_edge_offset_class0.s",
758                    "common/arm/ihevc_sao_edge_offset_class0_chroma.s",
759                    "common/arm/ihevc_sao_edge_offset_class1.s",
760                    "common/arm/ihevc_sao_edge_offset_class1_chroma.s",
761                    "common/arm/ihevc_sao_edge_offset_class2.s",
762                    "common/arm/ihevc_sao_edge_offset_class2_chroma.s",
763                    "common/arm/ihevc_sao_edge_offset_class3.s",
764                    "common/arm/ihevc_sao_edge_offset_class3_chroma.s",
765                    "common/arm/ihevc_weighted_pred_bi_default.s",
766                    "common/arm/ihevc_weighted_pred_bi.s",
767                    "common/arm/ihevc_weighted_pred_uni.s",
768                ],
769
770                cflags: [
771                    "-DENABLE_NEON",
772                    "-DARM",
773                ],
774            },
775        },
776
777        x86_64: {
778            local_include_dirs: [
779                "common/x86",
780            ],
781        },
782
783        x86: {
784            local_include_dirs: [
785                "common/x86",
786            ],
787        },
788
789    },
790    sanitize: {
791        integer_overflow: true,
792        misc_undefined: ["bounds"],
793        // Enable CFI if this becomes a shared library.
794        cfi: true,
795	config: {
796            cfi_assembly_support: true,
797        },
798        blocklist: "libhevc_blocklist.txt",
799    },
800
801    apex_available: [
802        "//apex_available:platform",
803        "com.android.media.swcodec",
804    ],
805    min_sdk_version: "29",
806}
807
808cc_test {
809    name: "hevcenc",
810    host_supported: true,
811    cflags: [
812        "-DARM",
813        "-fPIC",
814        "-Wall",
815        "-Werror",
816    ],
817    gtest: false,
818    srcs: ["test/encoder/main.c"],
819    static_libs: ["libhevcenc"],
820    sanitize: {
821        integer_overflow: true,
822        misc_undefined: ["bounds"],
823    },
824}
825