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"
1479f15823c34ae1e423108295e416213200bb280fAndreas Huber#include "vp8/common/g_common.h"
1579f15823c34ae1e423108295e416213200bb280fAndreas Huber#include "vp8/common/pragmas.h"
1679f15823c34ae1e423108295e416213200bb280fAndreas Huber#include "vp8/common/subpixel.h"
1779f15823c34ae1e423108295e416213200bb280fAndreas Huber#include "vp8/common/loopfilter.h"
1879f15823c34ae1e423108295e416213200bb280fAndreas Huber#include "vp8/common/recon.h"
1979f15823c34ae1e423108295e416213200bb280fAndreas Huber#include "vp8/common/idct.h"
2079f15823c34ae1e423108295e416213200bb280fAndreas Huber#include "vp8/common/onyxc_int.h"
21538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber
22538f6170b788de7408b06efc6613dc98579aa6a6Andreas Hubervoid vp8_arch_arm_common_init(VP8_COMMON *ctx)
23538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber{
24538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber#if CONFIG_RUNTIME_CPU_DETECT
25538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber    VP8_COMMON_RTCD *rtcd = &ctx->rtcd;
26538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber    int flags = arm_cpu_caps();
27538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber    int has_edsp = flags & HAS_EDSP;
28538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber    int has_media = flags & HAS_MEDIA;
29538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber    int has_neon = flags & HAS_NEON;
30538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber    rtcd->flags = flags;
31538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber
32538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber    /* Override default functions with fastest ones for this CPU. */
33538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber#if HAVE_ARMV6
34538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber    if (has_media)
35538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber    {
36538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->subpix.sixtap16x16   = vp8_sixtap_predict16x16_armv6;
37538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->subpix.sixtap8x8     = vp8_sixtap_predict8x8_armv6;
38538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->subpix.sixtap8x4     = vp8_sixtap_predict8x4_armv6;
39538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->subpix.sixtap4x4     = vp8_sixtap_predict_armv6;
40538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_armv6;
41538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->subpix.bilinear8x8   = vp8_bilinear_predict8x8_armv6;
42538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->subpix.bilinear8x4   = vp8_bilinear_predict8x4_armv6;
43538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->subpix.bilinear4x4   = vp8_bilinear_predict4x4_armv6;
44538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber
45538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->idct.idct1        = vp8_short_idct4x4llm_1_v6;
46538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->idct.idct16       = vp8_short_idct4x4llm_v6_dual;
47538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->idct.iwalsh1      = vp8_short_inv_walsh4x4_1_v6;
48538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->idct.iwalsh16     = vp8_short_inv_walsh4x4_v6;
49538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber
50538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->loopfilter.normal_mb_v = vp8_loop_filter_mbv_armv6;
51538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->loopfilter.normal_b_v  = vp8_loop_filter_bv_armv6;
52538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->loopfilter.normal_mb_h = vp8_loop_filter_mbh_armv6;
53538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->loopfilter.normal_b_h  = vp8_loop_filter_bh_armv6;
54538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->loopfilter.simple_mb_v = vp8_loop_filter_mbvs_armv6;
55538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->loopfilter.simple_b_v  = vp8_loop_filter_bvs_armv6;
56538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->loopfilter.simple_mb_h = vp8_loop_filter_mbhs_armv6;
57538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->loopfilter.simple_b_h  = vp8_loop_filter_bhs_armv6;
58538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber
59538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->recon.copy16x16   = vp8_copy_mem16x16_v6;
60538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->recon.copy8x8     = vp8_copy_mem8x8_v6;
61538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->recon.copy8x4     = vp8_copy_mem8x4_v6;
62538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->recon.recon       = vp8_recon_b_armv6;
63538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->recon.recon2      = vp8_recon2b_armv6;
64538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->recon.recon4      = vp8_recon4b_armv6;
65538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber    }
66538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber#endif
67538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber
68538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber#if HAVE_ARMV7
69538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber    if (has_neon)
70538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber    {
71538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->subpix.sixtap16x16   = vp8_sixtap_predict16x16_neon;
72538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->subpix.sixtap8x8     = vp8_sixtap_predict8x8_neon;
73538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->subpix.sixtap8x4     = vp8_sixtap_predict8x4_neon;
74538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->subpix.sixtap4x4     = vp8_sixtap_predict_neon;
75538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_neon;
76538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->subpix.bilinear8x8   = vp8_bilinear_predict8x8_neon;
77538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->subpix.bilinear8x4   = vp8_bilinear_predict8x4_neon;
78538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->subpix.bilinear4x4   = vp8_bilinear_predict4x4_neon;
79538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber
80538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->idct.idct1        = vp8_short_idct4x4llm_1_neon;
81538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->idct.idct16       = vp8_short_idct4x4llm_neon;
82538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->idct.iwalsh1      = vp8_short_inv_walsh4x4_1_neon;
83538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->idct.iwalsh16     = vp8_short_inv_walsh4x4_neon;
84538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber
85538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->loopfilter.normal_mb_v = vp8_loop_filter_mbv_neon;
86538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->loopfilter.normal_b_v  = vp8_loop_filter_bv_neon;
87538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->loopfilter.normal_mb_h = vp8_loop_filter_mbh_neon;
88538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->loopfilter.normal_b_h  = vp8_loop_filter_bh_neon;
89538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->loopfilter.simple_mb_v = vp8_loop_filter_mbvs_neon;
90538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->loopfilter.simple_b_v  = vp8_loop_filter_bvs_neon;
91538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->loopfilter.simple_mb_h = vp8_loop_filter_mbhs_neon;
92538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->loopfilter.simple_b_h  = vp8_loop_filter_bhs_neon;
93538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber
94538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->recon.copy16x16   = vp8_copy_mem16x16_neon;
95538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->recon.copy8x8     = vp8_copy_mem8x8_neon;
96538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->recon.copy8x4     = vp8_copy_mem8x4_neon;
97538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->recon.recon       = vp8_recon_b_neon;
98538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->recon.recon2      = vp8_recon2b_neon;
99538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->recon.recon4      = vp8_recon4b_neon;
100538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber        rtcd->recon.recon_mb    = vp8_recon_mb_neon;
10179f15823c34ae1e423108295e416213200bb280fAndreas Huber        rtcd->recon.build_intra_predictors_mby =
10279f15823c34ae1e423108295e416213200bb280fAndreas Huber            vp8_build_intra_predictors_mby_neon;
10379f15823c34ae1e423108295e416213200bb280fAndreas Huber        rtcd->recon.build_intra_predictors_mby_s =
10479f15823c34ae1e423108295e416213200bb280fAndreas Huber            vp8_build_intra_predictors_mby_s_neon;
105538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber    }
106538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber#endif
107538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber
108538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber#endif
109538f6170b788de7408b06efc6613dc98579aa6a6Andreas Huber}
110