1 : /*
2 : * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3 : *
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 : */
10 :
11 :
12 : #include "vpx_config.h"
13 : #include "vpx_ports/x86.h"
14 : #include "vp8/common/g_common.h"
15 : #include "vp8/common/subpixel.h"
16 : #include "vp8/common/loopfilter.h"
17 : #include "vp8/common/recon.h"
18 : #include "vp8/common/idct.h"
19 : #include "vp8/common/pragmas.h"
20 : #include "vp8/common/onyxc_int.h"
21 :
22 0 : void vp8_arch_x86_common_init(VP8_COMMON *ctx)
23 : {
24 : #if CONFIG_RUNTIME_CPU_DETECT
25 0 : VP8_COMMON_RTCD *rtcd = &ctx->rtcd;
26 0 : int flags = x86_simd_caps();
27 :
28 : /* Note:
29 : *
30 : * This platform can be built without runtime CPU detection as well. If
31 : * you modify any of the function mappings present in this file, be sure
32 : * to also update them in static mapings (<arch>/filename_<arch>.h)
33 : */
34 :
35 : /* Override default functions with fastest ones for this CPU. */
36 : #if HAVE_MMX
37 :
38 0 : if (flags & HAS_MMX)
39 : {
40 0 : rtcd->idct.idct1 = vp8_short_idct4x4llm_1_mmx;
41 0 : rtcd->idct.idct16 = vp8_short_idct4x4llm_mmx;
42 0 : rtcd->idct.idct1_scalar_add = vp8_dc_only_idct_add_mmx;
43 0 : rtcd->idct.iwalsh16 = vp8_short_inv_walsh4x4_mmx;
44 0 : rtcd->idct.iwalsh1 = vp8_short_inv_walsh4x4_1_mmx;
45 :
46 :
47 :
48 0 : rtcd->recon.recon = vp8_recon_b_mmx;
49 0 : rtcd->recon.copy8x8 = vp8_copy_mem8x8_mmx;
50 0 : rtcd->recon.copy8x4 = vp8_copy_mem8x4_mmx;
51 0 : rtcd->recon.copy16x16 = vp8_copy_mem16x16_mmx;
52 :
53 0 : rtcd->subpix.sixtap16x16 = vp8_sixtap_predict16x16_mmx;
54 0 : rtcd->subpix.sixtap8x8 = vp8_sixtap_predict8x8_mmx;
55 0 : rtcd->subpix.sixtap8x4 = vp8_sixtap_predict8x4_mmx;
56 0 : rtcd->subpix.sixtap4x4 = vp8_sixtap_predict4x4_mmx;
57 0 : rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_mmx;
58 0 : rtcd->subpix.bilinear8x8 = vp8_bilinear_predict8x8_mmx;
59 0 : rtcd->subpix.bilinear8x4 = vp8_bilinear_predict8x4_mmx;
60 0 : rtcd->subpix.bilinear4x4 = vp8_bilinear_predict4x4_mmx;
61 :
62 0 : rtcd->loopfilter.normal_mb_v = vp8_loop_filter_mbv_mmx;
63 0 : rtcd->loopfilter.normal_b_v = vp8_loop_filter_bv_mmx;
64 0 : rtcd->loopfilter.normal_mb_h = vp8_loop_filter_mbh_mmx;
65 0 : rtcd->loopfilter.normal_b_h = vp8_loop_filter_bh_mmx;
66 0 : rtcd->loopfilter.simple_mb_v = vp8_loop_filter_simple_vertical_edge_mmx;
67 0 : rtcd->loopfilter.simple_b_v = vp8_loop_filter_bvs_mmx;
68 0 : rtcd->loopfilter.simple_mb_h = vp8_loop_filter_simple_horizontal_edge_mmx;
69 0 : rtcd->loopfilter.simple_b_h = vp8_loop_filter_bhs_mmx;
70 :
71 : #if CONFIG_POSTPROC
72 0 : rtcd->postproc.down = vp8_mbpost_proc_down_mmx;
73 : /*rtcd->postproc.across = vp8_mbpost_proc_across_ip_c;*/
74 0 : rtcd->postproc.downacross = vp8_post_proc_down_and_across_mmx;
75 0 : rtcd->postproc.addnoise = vp8_plane_add_noise_mmx;
76 : #endif
77 : }
78 :
79 : #endif
80 : #if HAVE_SSE2
81 :
82 0 : if (flags & HAS_SSE2)
83 : {
84 0 : rtcd->recon.recon2 = vp8_recon2b_sse2;
85 0 : rtcd->recon.recon4 = vp8_recon4b_sse2;
86 0 : rtcd->recon.copy16x16 = vp8_copy_mem16x16_sse2;
87 0 : rtcd->recon.build_intra_predictors_mbuv =
88 : vp8_build_intra_predictors_mbuv_sse2;
89 0 : rtcd->recon.build_intra_predictors_mbuv_s =
90 : vp8_build_intra_predictors_mbuv_s_sse2;
91 :
92 0 : rtcd->idct.iwalsh16 = vp8_short_inv_walsh4x4_sse2;
93 :
94 0 : rtcd->subpix.sixtap16x16 = vp8_sixtap_predict16x16_sse2;
95 0 : rtcd->subpix.sixtap8x8 = vp8_sixtap_predict8x8_sse2;
96 0 : rtcd->subpix.sixtap8x4 = vp8_sixtap_predict8x4_sse2;
97 0 : rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_sse2;
98 0 : rtcd->subpix.bilinear8x8 = vp8_bilinear_predict8x8_sse2;
99 :
100 0 : rtcd->loopfilter.normal_mb_v = vp8_loop_filter_mbv_sse2;
101 0 : rtcd->loopfilter.normal_b_v = vp8_loop_filter_bv_sse2;
102 0 : rtcd->loopfilter.normal_mb_h = vp8_loop_filter_mbh_sse2;
103 0 : rtcd->loopfilter.normal_b_h = vp8_loop_filter_bh_sse2;
104 0 : rtcd->loopfilter.simple_mb_v = vp8_loop_filter_simple_vertical_edge_sse2;
105 0 : rtcd->loopfilter.simple_b_v = vp8_loop_filter_bvs_sse2;
106 0 : rtcd->loopfilter.simple_mb_h = vp8_loop_filter_simple_horizontal_edge_sse2;
107 0 : rtcd->loopfilter.simple_b_h = vp8_loop_filter_bhs_sse2;
108 :
109 : #if CONFIG_POSTPROC
110 0 : rtcd->postproc.down = vp8_mbpost_proc_down_xmm;
111 0 : rtcd->postproc.across = vp8_mbpost_proc_across_ip_xmm;
112 0 : rtcd->postproc.downacross = vp8_post_proc_down_and_across_xmm;
113 0 : rtcd->postproc.addnoise = vp8_plane_add_noise_wmt;
114 : #endif
115 : }
116 :
117 : #endif
118 :
119 : #if HAVE_SSSE3
120 :
121 0 : if (flags & HAS_SSSE3)
122 : {
123 0 : rtcd->subpix.sixtap16x16 = vp8_sixtap_predict16x16_ssse3;
124 0 : rtcd->subpix.sixtap8x8 = vp8_sixtap_predict8x8_ssse3;
125 0 : rtcd->subpix.sixtap8x4 = vp8_sixtap_predict8x4_ssse3;
126 0 : rtcd->subpix.sixtap4x4 = vp8_sixtap_predict4x4_ssse3;
127 0 : rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_ssse3;
128 0 : rtcd->subpix.bilinear8x8 = vp8_bilinear_predict8x8_ssse3;
129 :
130 0 : rtcd->recon.build_intra_predictors_mbuv =
131 : vp8_build_intra_predictors_mbuv_ssse3;
132 0 : rtcd->recon.build_intra_predictors_mbuv_s =
133 : vp8_build_intra_predictors_mbuv_s_ssse3;
134 : }
135 : #endif
136 :
137 : #endif
138 0 : }
|