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 #include "vpx_config.h"
12 #include "vp8_rtcd.h"
13 #include "vpx_mem/vpx_mem.h"
14 #include "vp8/common/blockd.h"
15
16 #define build_intra_predictors_mbuv_prototype(sym) \
17 void sym(unsigned char *dst, int dst_stride, \
18 const unsigned char *above, \
19 const unsigned char *left, int left_stride)
20 typedef build_intra_predictors_mbuv_prototype((*build_intra_predictors_mbuv_fn_t));
21
22 extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_uv_dc_mmx2);
23 extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_uv_dctop_mmx2);
24 extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_uv_dcleft_mmx2);
25 extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_uv_dc128_mmx);
26 extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_uv_ho_mmx2);
27 extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_uv_ho_ssse3);
28 extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_uv_ve_mmx);
29 extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_uv_tm_sse2);
30 extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_uv_tm_ssse3);
31
vp8_build_intra_predictors_mbuv_x86(MACROBLOCKD * x,unsigned char * uabove_row,unsigned char * vabove_row,unsigned char * dst_u,unsigned char * dst_v,int dst_stride,unsigned char * uleft,unsigned char * vleft,int left_stride,build_intra_predictors_mbuv_fn_t tm_func,build_intra_predictors_mbuv_fn_t ho_func)32 static void vp8_build_intra_predictors_mbuv_x86(MACROBLOCKD *x,
33 unsigned char * uabove_row,
34 unsigned char * vabove_row,
35 unsigned char *dst_u,
36 unsigned char *dst_v,
37 int dst_stride,
38 unsigned char * uleft,
39 unsigned char * vleft,
40 int left_stride,
41 build_intra_predictors_mbuv_fn_t tm_func,
42 build_intra_predictors_mbuv_fn_t ho_func)
43 {
44 int mode = x->mode_info_context->mbmi.uv_mode;
45 build_intra_predictors_mbuv_fn_t fn;
46
47 switch (mode) {
48 case V_PRED: fn = vp8_intra_pred_uv_ve_mmx; break;
49 case H_PRED: fn = ho_func; break;
50 case TM_PRED: fn = tm_func; break;
51 case DC_PRED:
52 if (x->up_available) {
53 if (x->left_available) {
54 fn = vp8_intra_pred_uv_dc_mmx2; break;
55 } else {
56 fn = vp8_intra_pred_uv_dctop_mmx2; break;
57 }
58 } else if (x->left_available) {
59 fn = vp8_intra_pred_uv_dcleft_mmx2; break;
60 } else {
61 fn = vp8_intra_pred_uv_dc128_mmx; break;
62 }
63 break;
64 default: return;
65 }
66
67 fn(dst_u, dst_stride, uabove_row, uleft, left_stride);
68 fn(dst_v, dst_stride, vabove_row, vleft, left_stride);
69 }
70
vp8_build_intra_predictors_mbuv_s_sse2(MACROBLOCKD * x,unsigned char * uabove_row,unsigned char * vabove_row,unsigned char * uleft,unsigned char * vleft,int left_stride,unsigned char * upred_ptr,unsigned char * vpred_ptr,int pred_stride)71 void vp8_build_intra_predictors_mbuv_s_sse2(MACROBLOCKD *x,
72 unsigned char * uabove_row,
73 unsigned char * vabove_row,
74 unsigned char * uleft,
75 unsigned char * vleft,
76 int left_stride,
77 unsigned char * upred_ptr,
78 unsigned char * vpred_ptr,
79 int pred_stride)
80 {
81 vp8_build_intra_predictors_mbuv_x86(x,
82 uabove_row, vabove_row,
83 upred_ptr,
84 vpred_ptr, pred_stride,
85 uleft,
86 vleft,
87 left_stride,
88 vp8_intra_pred_uv_tm_sse2,
89 vp8_intra_pred_uv_ho_mmx2);
90 }
91
vp8_build_intra_predictors_mbuv_s_ssse3(MACROBLOCKD * x,unsigned char * uabove_row,unsigned char * vabove_row,unsigned char * uleft,unsigned char * vleft,int left_stride,unsigned char * upred_ptr,unsigned char * vpred_ptr,int pred_stride)92 void vp8_build_intra_predictors_mbuv_s_ssse3(MACROBLOCKD *x,
93 unsigned char * uabove_row,
94 unsigned char * vabove_row,
95 unsigned char * uleft,
96 unsigned char * vleft,
97 int left_stride,
98 unsigned char * upred_ptr,
99 unsigned char * vpred_ptr,
100 int pred_stride)
101 {
102 vp8_build_intra_predictors_mbuv_x86(x,
103 uabove_row, vabove_row,
104 upred_ptr,
105 vpred_ptr, pred_stride,
106 uleft,
107 vleft,
108 left_stride,
109 vp8_intra_pred_uv_tm_ssse3,
110 vp8_intra_pred_uv_ho_ssse3);
111 }
112
113 #define build_intra_predictors_mby_prototype(sym) \
114 void sym(unsigned char *dst, int dst_stride, \
115 const unsigned char *above, \
116 const unsigned char *left, int left_stride)
117 typedef build_intra_predictors_mby_prototype((*build_intra_predictors_mby_fn_t));
118
119 extern build_intra_predictors_mby_prototype(vp8_intra_pred_y_dc_sse2);
120 extern build_intra_predictors_mby_prototype(vp8_intra_pred_y_dctop_sse2);
121 extern build_intra_predictors_mby_prototype(vp8_intra_pred_y_dcleft_sse2);
122 extern build_intra_predictors_mby_prototype(vp8_intra_pred_y_dc128_sse2);
123 extern build_intra_predictors_mby_prototype(vp8_intra_pred_y_ho_sse2);
124 extern build_intra_predictors_mby_prototype(vp8_intra_pred_y_ve_sse2);
125 extern build_intra_predictors_mby_prototype(vp8_intra_pred_y_tm_sse2);
126 extern build_intra_predictors_mby_prototype(vp8_intra_pred_y_tm_ssse3);
127
vp8_build_intra_predictors_mby_x86(MACROBLOCKD * x,unsigned char * yabove_row,unsigned char * dst_y,int dst_stride,unsigned char * yleft,int left_stride,build_intra_predictors_mby_fn_t tm_func)128 static void vp8_build_intra_predictors_mby_x86(MACROBLOCKD *x,
129 unsigned char * yabove_row,
130 unsigned char *dst_y,
131 int dst_stride,
132 unsigned char * yleft,
133 int left_stride,
134 build_intra_predictors_mby_fn_t tm_func)
135 {
136 int mode = x->mode_info_context->mbmi.mode;
137 build_intra_predictors_mbuv_fn_t fn;
138
139 switch (mode) {
140 case V_PRED: fn = vp8_intra_pred_y_ve_sse2; break;
141 case H_PRED: fn = vp8_intra_pred_y_ho_sse2; break;
142 case TM_PRED: fn = tm_func; break;
143 case DC_PRED:
144 if (x->up_available) {
145 if (x->left_available) {
146 fn = vp8_intra_pred_y_dc_sse2; break;
147 } else {
148 fn = vp8_intra_pred_y_dctop_sse2; break;
149 }
150 } else if (x->left_available) {
151 fn = vp8_intra_pred_y_dcleft_sse2; break;
152 } else {
153 fn = vp8_intra_pred_y_dc128_sse2; break;
154 }
155 break;
156 default: return;
157 }
158
159 fn(dst_y, dst_stride, yabove_row, yleft, left_stride);
160 return;
161 }
162
vp8_build_intra_predictors_mby_s_sse2(MACROBLOCKD * x,unsigned char * yabove_row,unsigned char * yleft,int left_stride,unsigned char * ypred_ptr,int y_stride)163 void vp8_build_intra_predictors_mby_s_sse2(MACROBLOCKD *x,
164 unsigned char * yabove_row,
165 unsigned char * yleft,
166 int left_stride,
167 unsigned char * ypred_ptr,
168 int y_stride)
169 {
170 vp8_build_intra_predictors_mby_x86(x, yabove_row, ypred_ptr,
171 y_stride, yleft, left_stride,
172 vp8_intra_pred_y_tm_sse2);
173 }
174
vp8_build_intra_predictors_mby_s_ssse3(MACROBLOCKD * x,unsigned char * yabove_row,unsigned char * yleft,int left_stride,unsigned char * ypred_ptr,int y_stride)175 void vp8_build_intra_predictors_mby_s_ssse3(MACROBLOCKD *x,
176 unsigned char * yabove_row,
177 unsigned char * yleft,
178 int left_stride,
179 unsigned char * ypred_ptr,
180 int y_stride)
181 {
182 vp8_build_intra_predictors_mby_x86(x, yabove_row, ypred_ptr,
183 y_stride, yleft, left_stride,
184 vp8_intra_pred_y_tm_ssse3);
185
186 }
187