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.
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
;
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
)
48 vp8_mbloop_filter_horizontal_edge_mmx(y_ptr
, y_stride
, lfi
->mbflim
, lfi
->lim
, lfi
->mbthr
, 2);
51 vp8_mbloop_filter_horizontal_edge_mmx(u_ptr
, uv_stride
, lfi
->uvmbflim
, lfi
->uvlim
, lfi
->uvmbthr
, 1);
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
)
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
)
74 vp8_mbloop_filter_vertical_edge_mmx(y_ptr
, y_stride
, lfi
->mbflim
, lfi
->lim
, lfi
->mbthr
, 2);
77 vp8_mbloop_filter_vertical_edge_mmx(u_ptr
, uv_stride
, lfi
->uvmbflim
, lfi
->uvlim
, lfi
->uvmbthr
, 1);
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
)
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
)
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);
105 vp8_loop_filter_horizontal_edge_mmx(u_ptr
+ 4 * uv_stride
, uv_stride
, lfi
->uvflim
, lfi
->uvlim
, lfi
->uvthr
, 1);
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
)
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
)
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);
135 vp8_loop_filter_vertical_edge_mmx(u_ptr
+ 4, uv_stride
, lfi
->uvflim
, lfi
->uvlim
, lfi
->uvthr
, 1);
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
)
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);
156 /* Horizontal MB filtering */
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
)
162 vp8_mbloop_filter_horizontal_edge_sse2(y_ptr
, y_stride
, lfi
->mbflim
, lfi
->lim
, lfi
->mbthr
, 2);
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
)
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
)
185 vp8_mbloop_filter_vertical_edge_sse2(y_ptr
, y_stride
, lfi
->mbflim
, lfi
->lim
, lfi
->mbthr
, 2);
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
)
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
)
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);
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
)
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
)
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);
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
)
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);
259 void vp8_fast_loop_filter_vertical_edges_sse(unsigned char *y_ptr
,
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);