Merge "vp8_rd_pick_best_mbsegmentation code restructure"
[libvpx.git] / vp8 / common / x86 / loopfilter_x86.c
blob93107e179668ae577ca565e8d4bd6603dfb0a4d5
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 "loopfilter.h"
15 prototype_loopfilter(vp8_loop_filter_horizontal_edge_c);
16 prototype_loopfilter(vp8_loop_filter_vertical_edge_c);
17 prototype_loopfilter(vp8_mbloop_filter_horizontal_edge_c);
18 prototype_loopfilter(vp8_mbloop_filter_vertical_edge_c);
19 prototype_loopfilter(vp8_loop_filter_simple_horizontal_edge_c);
20 prototype_loopfilter(vp8_loop_filter_simple_vertical_edge_c);
22 prototype_loopfilter(vp8_mbloop_filter_vertical_edge_mmx);
23 prototype_loopfilter(vp8_mbloop_filter_horizontal_edge_mmx);
24 prototype_loopfilter(vp8_loop_filter_vertical_edge_mmx);
25 prototype_loopfilter(vp8_loop_filter_horizontal_edge_mmx);
26 prototype_loopfilter(vp8_loop_filter_simple_vertical_edge_mmx);
27 prototype_loopfilter(vp8_loop_filter_simple_horizontal_edge_mmx);
29 prototype_loopfilter(vp8_loop_filter_vertical_edge_sse2);
30 prototype_loopfilter(vp8_loop_filter_horizontal_edge_sse2);
31 prototype_loopfilter(vp8_mbloop_filter_vertical_edge_sse2);
32 prototype_loopfilter(vp8_mbloop_filter_horizontal_edge_sse2);
33 prototype_loopfilter(vp8_loop_filter_simple_vertical_edge_sse2);
34 prototype_loopfilter(vp8_loop_filter_simple_horizontal_edge_sse2);
35 prototype_loopfilter(vp8_fast_loop_filter_vertical_edges_sse2);
37 extern loop_filter_uvfunction vp8_loop_filter_horizontal_edge_uv_sse2;
38 extern loop_filter_uvfunction vp8_loop_filter_vertical_edge_uv_sse2;
39 extern loop_filter_uvfunction vp8_mbloop_filter_horizontal_edge_uv_sse2;
40 extern loop_filter_uvfunction vp8_mbloop_filter_vertical_edge_uv_sse2;
42 #if HAVE_MMX
43 /* Horizontal MB filtering */
44 void vp8_loop_filter_mbh_mmx(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
45 int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf)
47 (void) simpler_lpf;
48 vp8_mbloop_filter_horizontal_edge_mmx(y_ptr, y_stride, lfi->mbflim, lfi->lim, lfi->mbthr, 2);
50 if (u_ptr)
51 vp8_mbloop_filter_horizontal_edge_mmx(u_ptr, uv_stride, lfi->uvmbflim, lfi->uvlim, lfi->uvmbthr, 1);
53 if (v_ptr)
54 vp8_mbloop_filter_horizontal_edge_mmx(v_ptr, uv_stride, lfi->uvmbflim, lfi->uvlim, lfi->uvmbthr, 1);
58 void vp8_loop_filter_mbhs_mmx(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
59 int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf)
61 (void) u_ptr;
62 (void) v_ptr;
63 (void) uv_stride;
64 (void) simpler_lpf;
65 vp8_loop_filter_simple_horizontal_edge_mmx(y_ptr, y_stride, lfi->mbflim, lfi->lim, lfi->mbthr, 2);
69 /* Vertical MB Filtering */
70 void vp8_loop_filter_mbv_mmx(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
71 int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf)
73 (void) simpler_lpf;
74 vp8_mbloop_filter_vertical_edge_mmx(y_ptr, y_stride, lfi->mbflim, lfi->lim, lfi->mbthr, 2);
76 if (u_ptr)
77 vp8_mbloop_filter_vertical_edge_mmx(u_ptr, uv_stride, lfi->uvmbflim, lfi->uvlim, lfi->uvmbthr, 1);
79 if (v_ptr)
80 vp8_mbloop_filter_vertical_edge_mmx(v_ptr, uv_stride, lfi->uvmbflim, lfi->uvlim, lfi->uvmbthr, 1);
84 void vp8_loop_filter_mbvs_mmx(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
85 int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf)
87 (void) u_ptr;
88 (void) v_ptr;
89 (void) uv_stride;
90 (void) simpler_lpf;
91 vp8_loop_filter_simple_vertical_edge_mmx(y_ptr, y_stride, lfi->mbflim, lfi->lim, lfi->mbthr, 2);
95 /* Horizontal B Filtering */
96 void vp8_loop_filter_bh_mmx(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
97 int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf)
99 (void) simpler_lpf;
100 vp8_loop_filter_horizontal_edge_mmx(y_ptr + 4 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
101 vp8_loop_filter_horizontal_edge_mmx(y_ptr + 8 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
102 vp8_loop_filter_horizontal_edge_mmx(y_ptr + 12 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
104 if (u_ptr)
105 vp8_loop_filter_horizontal_edge_mmx(u_ptr + 4 * uv_stride, uv_stride, lfi->uvflim, lfi->uvlim, lfi->uvthr, 1);
107 if (v_ptr)
108 vp8_loop_filter_horizontal_edge_mmx(v_ptr + 4 * uv_stride, uv_stride, lfi->uvflim, lfi->uvlim, lfi->uvthr, 1);
112 void vp8_loop_filter_bhs_mmx(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
113 int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf)
115 (void) u_ptr;
116 (void) v_ptr;
117 (void) uv_stride;
118 (void) simpler_lpf;
119 vp8_loop_filter_simple_horizontal_edge_mmx(y_ptr + 4 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
120 vp8_loop_filter_simple_horizontal_edge_mmx(y_ptr + 8 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
121 vp8_loop_filter_simple_horizontal_edge_mmx(y_ptr + 12 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
125 /* Vertical B Filtering */
126 void vp8_loop_filter_bv_mmx(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
127 int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf)
129 (void) simpler_lpf;
130 vp8_loop_filter_vertical_edge_mmx(y_ptr + 4, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
131 vp8_loop_filter_vertical_edge_mmx(y_ptr + 8, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
132 vp8_loop_filter_vertical_edge_mmx(y_ptr + 12, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
134 if (u_ptr)
135 vp8_loop_filter_vertical_edge_mmx(u_ptr + 4, uv_stride, lfi->uvflim, lfi->uvlim, lfi->uvthr, 1);
137 if (v_ptr)
138 vp8_loop_filter_vertical_edge_mmx(v_ptr + 4, uv_stride, lfi->uvflim, lfi->uvlim, lfi->uvthr, 1);
142 void vp8_loop_filter_bvs_mmx(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
143 int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf)
145 (void) u_ptr;
146 (void) v_ptr;
147 (void) uv_stride;
148 (void) simpler_lpf;
149 vp8_loop_filter_simple_vertical_edge_mmx(y_ptr + 4, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
150 vp8_loop_filter_simple_vertical_edge_mmx(y_ptr + 8, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
151 vp8_loop_filter_simple_vertical_edge_mmx(y_ptr + 12, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
153 #endif
156 /* Horizontal MB filtering */
157 #if HAVE_SSE2
158 void vp8_loop_filter_mbh_sse2(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
159 int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf)
161 (void) simpler_lpf;
162 vp8_mbloop_filter_horizontal_edge_sse2(y_ptr, y_stride, lfi->mbflim, lfi->lim, lfi->mbthr, 2);
164 if (u_ptr)
165 vp8_mbloop_filter_horizontal_edge_uv_sse2(u_ptr, uv_stride, lfi->uvmbflim, lfi->uvlim, lfi->uvmbthr, v_ptr);
169 void vp8_loop_filter_mbhs_sse2(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
170 int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf)
172 (void) u_ptr;
173 (void) v_ptr;
174 (void) uv_stride;
175 (void) simpler_lpf;
176 vp8_loop_filter_simple_horizontal_edge_sse2(y_ptr, y_stride, lfi->mbflim, lfi->lim, lfi->mbthr, 2);
180 /* Vertical MB Filtering */
181 void vp8_loop_filter_mbv_sse2(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
182 int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf)
184 (void) simpler_lpf;
185 vp8_mbloop_filter_vertical_edge_sse2(y_ptr, y_stride, lfi->mbflim, lfi->lim, lfi->mbthr, 2);
187 if (u_ptr)
188 vp8_mbloop_filter_vertical_edge_uv_sse2(u_ptr, uv_stride, lfi->uvmbflim, lfi->uvlim, lfi->uvmbthr, v_ptr);
192 void vp8_loop_filter_mbvs_sse2(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
193 int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf)
195 (void) u_ptr;
196 (void) v_ptr;
197 (void) uv_stride;
198 (void) simpler_lpf;
199 vp8_loop_filter_simple_vertical_edge_sse2(y_ptr, y_stride, lfi->mbflim, lfi->lim, lfi->mbthr, 2);
203 /* Horizontal B Filtering */
204 void vp8_loop_filter_bh_sse2(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
205 int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf)
207 (void) simpler_lpf;
208 vp8_loop_filter_horizontal_edge_sse2(y_ptr + 4 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
209 vp8_loop_filter_horizontal_edge_sse2(y_ptr + 8 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
210 vp8_loop_filter_horizontal_edge_sse2(y_ptr + 12 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
212 if (u_ptr)
213 vp8_loop_filter_horizontal_edge_uv_sse2(u_ptr + 4 * uv_stride, uv_stride, lfi->uvflim, lfi->uvlim, lfi->uvthr, v_ptr + 4 * uv_stride);
217 void vp8_loop_filter_bhs_sse2(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
218 int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf)
220 (void) u_ptr;
221 (void) v_ptr;
222 (void) uv_stride;
223 (void) simpler_lpf;
224 vp8_loop_filter_simple_horizontal_edge_sse2(y_ptr + 4 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
225 vp8_loop_filter_simple_horizontal_edge_sse2(y_ptr + 8 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
226 vp8_loop_filter_simple_horizontal_edge_sse2(y_ptr + 12 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
230 /* Vertical B Filtering */
231 void vp8_loop_filter_bv_sse2(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
232 int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf)
234 (void) simpler_lpf;
235 vp8_loop_filter_vertical_edge_sse2(y_ptr + 4, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
236 vp8_loop_filter_vertical_edge_sse2(y_ptr + 8, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
237 vp8_loop_filter_vertical_edge_sse2(y_ptr + 12, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
239 if (u_ptr)
240 vp8_loop_filter_vertical_edge_uv_sse2(u_ptr + 4, uv_stride, lfi->uvflim, lfi->uvlim, lfi->uvthr, v_ptr + 4);
244 void vp8_loop_filter_bvs_sse2(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
245 int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf)
247 (void) u_ptr;
248 (void) v_ptr;
249 (void) uv_stride;
250 (void) simpler_lpf;
251 vp8_loop_filter_simple_vertical_edge_sse2(y_ptr + 4, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
252 vp8_loop_filter_simple_vertical_edge_sse2(y_ptr + 8, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
253 vp8_loop_filter_simple_vertical_edge_sse2(y_ptr + 12, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
256 #endif
258 #if 0
259 void vp8_fast_loop_filter_vertical_edges_sse(unsigned char *y_ptr,
260 int y_stride,
261 loop_filter_info *lfi)
264 vp8_loop_filter_simple_vertical_edge_sse2(y_ptr + 4, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
265 vp8_loop_filter_simple_vertical_edge_sse2(y_ptr + 8, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
266 vp8_loop_filter_simple_vertical_edge_sse2(y_ptr + 12, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
268 #endif