arm_systemdependent.c revision 538f6170b788de7408b06efc6613dc98579aa6a6
1538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber/*
2538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber *
4538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber *  Use of this source code is governed by a BSD-style license
5538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber *  that can be found in the LICENSE file in the root of the source
6538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber *  tree. An additional intellectual property rights grant can be found
7538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber *  in the file PATENTS.  All contributing project authors may
8538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber *  be found in the AUTHORS file in the root of the source tree.
9538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber */
10538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber
11538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber
12538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber#include "vpx_ports/config.h"
13538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber#include "vpx_ports/arm.h"
14538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber#include "g_common.h"
15538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber#include "pragmas.h"
16538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber#include "subpixel.h"
17538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber#include "loopfilter.h"
18538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber#include "recon.h"
19538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber#include "idct.h"
20538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber#include "onyxc_int.h"
21538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber
22538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huberextern void (*vp8_build_intra_predictors_mby_ptr)(MACROBLOCKD *x);
23538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huberextern void vp8_build_intra_predictors_mby(MACROBLOCKD *x);
24538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huberextern void vp8_build_intra_predictors_mby_neon(MACROBLOCKD *x);
25538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber
26538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huberextern void (*vp8_build_intra_predictors_mby_s_ptr)(MACROBLOCKD *x);
27538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huberextern void vp8_build_intra_predictors_mby_s(MACROBLOCKD *x);
28538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huberextern void vp8_build_intra_predictors_mby_s_neon(MACROBLOCKD *x);
29538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber
30538f6170b788de7408b06efc6613dc98579aa6a6Andreas Hubervoid vp8_arch_arm_common_init(VP8_COMMON *ctx)
31538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber{
32538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber#if CONFIG_RUNTIME_CPU_DETECT
33538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber    VP8_COMMON_RTCD *rtcd = &ctx->rtcd;
34538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber    int flags = arm_cpu_caps();
35538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber    int has_edsp = flags & HAS_EDSP;
36538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber    int has_media = flags & HAS_MEDIA;
37538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber    int has_neon = flags & HAS_NEON;
38538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber    rtcd->flags = flags;
39538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber
40538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber    /* Override default functions with fastest ones for this CPU. */
41538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber#if HAVE_ARMV6
42538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber    if (has_media)
43538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber    {
44538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->subpix.sixtap16x16   = vp8_sixtap_predict16x16_armv6;
45538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->subpix.sixtap8x8     = vp8_sixtap_predict8x8_armv6;
46538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->subpix.sixtap8x4     = vp8_sixtap_predict8x4_armv6;
47538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->subpix.sixtap4x4     = vp8_sixtap_predict_armv6;
48538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_armv6;
49538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->subpix.bilinear8x8   = vp8_bilinear_predict8x8_armv6;
50538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->subpix.bilinear8x4   = vp8_bilinear_predict8x4_armv6;
51538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->subpix.bilinear4x4   = vp8_bilinear_predict4x4_armv6;
52538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber
53538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->idct.idct1        = vp8_short_idct4x4llm_1_v6;
54538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->idct.idct16       = vp8_short_idct4x4llm_v6_dual;
55538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->idct.iwalsh1      = vp8_short_inv_walsh4x4_1_v6;
56538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->idct.iwalsh16     = vp8_short_inv_walsh4x4_v6;
57538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber
58538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->loopfilter.normal_mb_v = vp8_loop_filter_mbv_armv6;
59538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->loopfilter.normal_b_v  = vp8_loop_filter_bv_armv6;
60538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->loopfilter.normal_mb_h = vp8_loop_filter_mbh_armv6;
61538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->loopfilter.normal_b_h  = vp8_loop_filter_bh_armv6;
62538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->loopfilter.simple_mb_v = vp8_loop_filter_mbvs_armv6;
63538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->loopfilter.simple_b_v  = vp8_loop_filter_bvs_armv6;
64538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->loopfilter.simple_mb_h = vp8_loop_filter_mbhs_armv6;
65538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->loopfilter.simple_b_h  = vp8_loop_filter_bhs_armv6;
66538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber
67538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->recon.copy16x16   = vp8_copy_mem16x16_v6;
68538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->recon.copy8x8     = vp8_copy_mem8x8_v6;
69538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->recon.copy8x4     = vp8_copy_mem8x4_v6;
70538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->recon.recon       = vp8_recon_b_armv6;
71538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->recon.recon2      = vp8_recon2b_armv6;
72538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->recon.recon4      = vp8_recon4b_armv6;
73538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber    }
74538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber#endif
75538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber
76538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber#if HAVE_ARMV7
77538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber    if (has_neon)
78538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber    {
79538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->subpix.sixtap16x16   = vp8_sixtap_predict16x16_neon;
80538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->subpix.sixtap8x8     = vp8_sixtap_predict8x8_neon;
81538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->subpix.sixtap8x4     = vp8_sixtap_predict8x4_neon;
82538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->subpix.sixtap4x4     = vp8_sixtap_predict_neon;
83538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_neon;
84538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->subpix.bilinear8x8   = vp8_bilinear_predict8x8_neon;
85538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->subpix.bilinear8x4   = vp8_bilinear_predict8x4_neon;
86538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->subpix.bilinear4x4   = vp8_bilinear_predict4x4_neon;
87538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber
88538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->idct.idct1        = vp8_short_idct4x4llm_1_neon;
89538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->idct.idct16       = vp8_short_idct4x4llm_neon;
90538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->idct.iwalsh1      = vp8_short_inv_walsh4x4_1_neon;
91538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->idct.iwalsh16     = vp8_short_inv_walsh4x4_neon;
92538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber
93538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->loopfilter.normal_mb_v = vp8_loop_filter_mbv_neon;
94538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->loopfilter.normal_b_v  = vp8_loop_filter_bv_neon;
95538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->loopfilter.normal_mb_h = vp8_loop_filter_mbh_neon;
96538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->loopfilter.normal_b_h  = vp8_loop_filter_bh_neon;
97538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->loopfilter.simple_mb_v = vp8_loop_filter_mbvs_neon;
98538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->loopfilter.simple_b_v  = vp8_loop_filter_bvs_neon;
99538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->loopfilter.simple_mb_h = vp8_loop_filter_mbhs_neon;
100538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->loopfilter.simple_b_h  = vp8_loop_filter_bhs_neon;
101538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber
102538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->recon.copy16x16   = vp8_copy_mem16x16_neon;
103538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->recon.copy8x8     = vp8_copy_mem8x8_neon;
104538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->recon.copy8x4     = vp8_copy_mem8x4_neon;
105538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->recon.recon       = vp8_recon_b_neon;
106538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->recon.recon2      = vp8_recon2b_neon;
107538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->recon.recon4      = vp8_recon4b_neon;
108538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->recon.recon_mb    = vp8_recon_mb_neon;
109538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber
110538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber    }
111538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber#endif
112538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber
113538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber#endif
114538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber
115538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber#if HAVE_ARMV6
116538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber#if CONFIG_RUNTIME_CPU_DETECT
117538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber    if (has_media)
118538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber#endif
119538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber    {
120538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        vp8_build_intra_predictors_mby_ptr = vp8_build_intra_predictors_mby;
121538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        vp8_build_intra_predictors_mby_s_ptr = vp8_build_intra_predictors_mby_s;
122538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber    }
123538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber#endif
124538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber
125538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber#if HAVE_ARMV7
126538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber#if CONFIG_RUNTIME_CPU_DETECT
127538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber    if (has_neon)
128538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber#endif
129538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber    {
130538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        vp8_build_intra_predictors_mby_ptr =
131538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber         vp8_build_intra_predictors_mby_neon;
132538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        vp8_build_intra_predictors_mby_s_ptr =
133538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber         vp8_build_intra_predictors_mby_s_neon;
134538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber    }
135538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber#endif
136538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber}
137