CLOSED TREE: TraceMonkey merge head. (a=blockers)
[mozilla-central.git] / media / libvpx / vp8 / common / arm / arm_systemdependent.c
blob83921f8074dd8d69957f12edd2ee70b1399833cb
1 /*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
12 #include "vpx_ports/config.h"
13 #include "vpx_ports/arm.h"
14 #include "g_common.h"
15 #include "pragmas.h"
16 #include "subpixel.h"
17 #include "loopfilter.h"
18 #include "recon.h"
19 #include "idct.h"
20 #include "onyxc_int.h"
22 extern void (*vp8_build_intra_predictors_mby_ptr)(MACROBLOCKD *x);
23 extern void vp8_build_intra_predictors_mby(MACROBLOCKD *x);
24 extern void vp8_build_intra_predictors_mby_neon(MACROBLOCKD *x);
26 extern void (*vp8_build_intra_predictors_mby_s_ptr)(MACROBLOCKD *x);
27 extern void vp8_build_intra_predictors_mby_s(MACROBLOCKD *x);
28 extern void vp8_build_intra_predictors_mby_s_neon(MACROBLOCKD *x);
30 void vp8_arch_arm_common_init(VP8_COMMON *ctx)
32 #if CONFIG_RUNTIME_CPU_DETECT
33 VP8_COMMON_RTCD *rtcd = &ctx->rtcd;
34 int flags = arm_cpu_caps();
35 int has_edsp = flags & HAS_EDSP;
36 int has_media = flags & HAS_MEDIA;
37 int has_neon = flags & HAS_NEON;
38 rtcd->flags = flags;
40 /* Override default functions with fastest ones for this CPU. */
41 #if HAVE_ARMV6
42 if (has_media)
44 rtcd->subpix.sixtap16x16 = vp8_sixtap_predict16x16_armv6;
45 rtcd->subpix.sixtap8x8 = vp8_sixtap_predict8x8_armv6;
46 rtcd->subpix.sixtap8x4 = vp8_sixtap_predict8x4_armv6;
47 rtcd->subpix.sixtap4x4 = vp8_sixtap_predict_armv6;
48 rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_armv6;
49 rtcd->subpix.bilinear8x8 = vp8_bilinear_predict8x8_armv6;
50 rtcd->subpix.bilinear8x4 = vp8_bilinear_predict8x4_armv6;
51 rtcd->subpix.bilinear4x4 = vp8_bilinear_predict4x4_armv6;
53 rtcd->idct.idct1 = vp8_short_idct4x4llm_1_v6;
54 rtcd->idct.idct16 = vp8_short_idct4x4llm_v6_dual;
55 rtcd->idct.iwalsh1 = vp8_short_inv_walsh4x4_1_v6;
56 rtcd->idct.iwalsh16 = vp8_short_inv_walsh4x4_v6;
58 rtcd->loopfilter.normal_mb_v = vp8_loop_filter_mbv_armv6;
59 rtcd->loopfilter.normal_b_v = vp8_loop_filter_bv_armv6;
60 rtcd->loopfilter.normal_mb_h = vp8_loop_filter_mbh_armv6;
61 rtcd->loopfilter.normal_b_h = vp8_loop_filter_bh_armv6;
62 rtcd->loopfilter.simple_mb_v = vp8_loop_filter_mbvs_armv6;
63 rtcd->loopfilter.simple_b_v = vp8_loop_filter_bvs_armv6;
64 rtcd->loopfilter.simple_mb_h = vp8_loop_filter_mbhs_armv6;
65 rtcd->loopfilter.simple_b_h = vp8_loop_filter_bhs_armv6;
67 rtcd->recon.copy16x16 = vp8_copy_mem16x16_v6;
68 rtcd->recon.copy8x8 = vp8_copy_mem8x8_v6;
69 rtcd->recon.copy8x4 = vp8_copy_mem8x4_v6;
70 rtcd->recon.recon = vp8_recon_b_armv6;
71 rtcd->recon.recon2 = vp8_recon2b_armv6;
72 rtcd->recon.recon4 = vp8_recon4b_armv6;
74 #endif
76 #if HAVE_ARMV7
77 if (has_neon)
79 rtcd->subpix.sixtap16x16 = vp8_sixtap_predict16x16_neon;
80 rtcd->subpix.sixtap8x8 = vp8_sixtap_predict8x8_neon;
81 rtcd->subpix.sixtap8x4 = vp8_sixtap_predict8x4_neon;
82 rtcd->subpix.sixtap4x4 = vp8_sixtap_predict_neon;
83 rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_neon;
84 rtcd->subpix.bilinear8x8 = vp8_bilinear_predict8x8_neon;
85 rtcd->subpix.bilinear8x4 = vp8_bilinear_predict8x4_neon;
86 rtcd->subpix.bilinear4x4 = vp8_bilinear_predict4x4_neon;
88 rtcd->idct.idct1 = vp8_short_idct4x4llm_1_neon;
89 rtcd->idct.idct16 = vp8_short_idct4x4llm_neon;
90 rtcd->idct.iwalsh1 = vp8_short_inv_walsh4x4_1_neon;
91 rtcd->idct.iwalsh16 = vp8_short_inv_walsh4x4_neon;
93 rtcd->loopfilter.normal_mb_v = vp8_loop_filter_mbv_neon;
94 rtcd->loopfilter.normal_b_v = vp8_loop_filter_bv_neon;
95 rtcd->loopfilter.normal_mb_h = vp8_loop_filter_mbh_neon;
96 rtcd->loopfilter.normal_b_h = vp8_loop_filter_bh_neon;
97 rtcd->loopfilter.simple_mb_v = vp8_loop_filter_mbvs_neon;
98 rtcd->loopfilter.simple_b_v = vp8_loop_filter_bvs_neon;
99 rtcd->loopfilter.simple_mb_h = vp8_loop_filter_mbhs_neon;
100 rtcd->loopfilter.simple_b_h = vp8_loop_filter_bhs_neon;
102 rtcd->recon.copy16x16 = vp8_copy_mem16x16_neon;
103 rtcd->recon.copy8x8 = vp8_copy_mem8x8_neon;
104 rtcd->recon.copy8x4 = vp8_copy_mem8x4_neon;
105 rtcd->recon.recon = vp8_recon_b_neon;
106 rtcd->recon.recon2 = vp8_recon2b_neon;
107 rtcd->recon.recon4 = vp8_recon4b_neon;
108 rtcd->recon.recon_mb = vp8_recon_mb_neon;
111 #endif
113 #endif
115 #if HAVE_ARMV6
116 #if CONFIG_RUNTIME_CPU_DETECT
117 if (has_media)
118 #endif
120 vp8_build_intra_predictors_mby_ptr = vp8_build_intra_predictors_mby;
121 vp8_build_intra_predictors_mby_s_ptr = vp8_build_intra_predictors_mby_s;
123 #endif
125 #if HAVE_ARMV7
126 #if CONFIG_RUNTIME_CPU_DETECT
127 if (has_neon)
128 #endif
130 vp8_build_intra_predictors_mby_ptr =
131 vp8_build_intra_predictors_mby_neon;
132 vp8_build_intra_predictors_mby_s_ptr =
133 vp8_build_intra_predictors_mby_s_neon;
135 #endif