loopfilter_x86.c 10.6 KB
Newer Older
John Koleszar's avatar
John Koleszar committed
1
/*
2
 *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
John Koleszar's avatar
John Koleszar committed
3
 *
4
 *  Use of this source code is governed by a BSD-style license
5
6
 *  that can be found in the LICENSE file in the root of the source
 *  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.
John Koleszar's avatar
John Koleszar committed
9
10
11
12
 */


#include "vpx_ports/config.h"
John Koleszar's avatar
John Koleszar committed
13
#include "vp8/common/loopfilter.h"
John Koleszar's avatar
John Koleszar committed
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

prototype_loopfilter(vp8_loop_filter_horizontal_edge_c);
prototype_loopfilter(vp8_loop_filter_vertical_edge_c);
prototype_loopfilter(vp8_mbloop_filter_horizontal_edge_c);
prototype_loopfilter(vp8_mbloop_filter_vertical_edge_c);
prototype_loopfilter(vp8_loop_filter_simple_horizontal_edge_c);
prototype_loopfilter(vp8_loop_filter_simple_vertical_edge_c);

prototype_loopfilter(vp8_mbloop_filter_vertical_edge_mmx);
prototype_loopfilter(vp8_mbloop_filter_horizontal_edge_mmx);
prototype_loopfilter(vp8_loop_filter_vertical_edge_mmx);
prototype_loopfilter(vp8_loop_filter_horizontal_edge_mmx);
prototype_loopfilter(vp8_loop_filter_simple_vertical_edge_mmx);
prototype_loopfilter(vp8_loop_filter_simple_horizontal_edge_mmx);

prototype_loopfilter(vp8_loop_filter_vertical_edge_sse2);
prototype_loopfilter(vp8_loop_filter_horizontal_edge_sse2);
prototype_loopfilter(vp8_mbloop_filter_vertical_edge_sse2);
prototype_loopfilter(vp8_mbloop_filter_horizontal_edge_sse2);
prototype_loopfilter(vp8_loop_filter_simple_vertical_edge_sse2);
prototype_loopfilter(vp8_loop_filter_simple_horizontal_edge_sse2);
prototype_loopfilter(vp8_fast_loop_filter_vertical_edges_sse2);

37
38
39
40
41
extern loop_filter_uvfunction vp8_loop_filter_horizontal_edge_uv_sse2;
extern loop_filter_uvfunction vp8_loop_filter_vertical_edge_uv_sse2;
extern loop_filter_uvfunction vp8_mbloop_filter_horizontal_edge_uv_sse2;
extern loop_filter_uvfunction vp8_mbloop_filter_vertical_edge_uv_sse2;

John Koleszar's avatar
John Koleszar committed
42
#if HAVE_MMX
43
/* Horizontal MB filtering */
John Koleszar's avatar
John Koleszar committed
44
void vp8_loop_filter_mbh_mmx(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
Johann's avatar
Johann committed
45
                             int y_stride, int uv_stride, loop_filter_info *lfi)
John Koleszar's avatar
John Koleszar committed
46
{
47
    vp8_mbloop_filter_horizontal_edge_mmx(y_ptr, y_stride, lfi->mbflim, lfi->lim, lfi->thr, 2);
John Koleszar's avatar
John Koleszar committed
48
49

    if (u_ptr)
50
        vp8_mbloop_filter_horizontal_edge_mmx(u_ptr, uv_stride, lfi->mbflim, lfi->lim, lfi->thr, 1);
John Koleszar's avatar
John Koleszar committed
51
52

    if (v_ptr)
53
        vp8_mbloop_filter_horizontal_edge_mmx(v_ptr, uv_stride, lfi->mbflim, lfi->lim, lfi->thr, 1);
John Koleszar's avatar
John Koleszar committed
54
55
56
57
}


void vp8_loop_filter_mbhs_mmx(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
Johann's avatar
Johann committed
58
                              int y_stride, int uv_stride, loop_filter_info *lfi)
John Koleszar's avatar
John Koleszar committed
59
60
61
62
{
    (void) u_ptr;
    (void) v_ptr;
    (void) uv_stride;
63
    vp8_loop_filter_simple_horizontal_edge_mmx(y_ptr, y_stride, lfi->mbflim, lfi->lim, lfi->thr, 2);
John Koleszar's avatar
John Koleszar committed
64
65
66
}


67
/* Vertical MB Filtering */
John Koleszar's avatar
John Koleszar committed
68
void vp8_loop_filter_mbv_mmx(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
Johann's avatar
Johann committed
69
                             int y_stride, int uv_stride, loop_filter_info *lfi)
John Koleszar's avatar
John Koleszar committed
70
{
71
    vp8_mbloop_filter_vertical_edge_mmx(y_ptr, y_stride, lfi->mbflim, lfi->lim, lfi->thr, 2);
John Koleszar's avatar
John Koleszar committed
72
73

    if (u_ptr)
74
        vp8_mbloop_filter_vertical_edge_mmx(u_ptr, uv_stride, lfi->mbflim, lfi->lim, lfi->thr, 1);
John Koleszar's avatar
John Koleszar committed
75
76

    if (v_ptr)
77
        vp8_mbloop_filter_vertical_edge_mmx(v_ptr, uv_stride, lfi->mbflim, lfi->lim, lfi->thr, 1);
John Koleszar's avatar
John Koleszar committed
78
79
80
81
}


void vp8_loop_filter_mbvs_mmx(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
Johann's avatar
Johann committed
82
                              int y_stride, int uv_stride, loop_filter_info *lfi)
John Koleszar's avatar
John Koleszar committed
83
84
85
86
{
    (void) u_ptr;
    (void) v_ptr;
    (void) uv_stride;
87
    vp8_loop_filter_simple_vertical_edge_mmx(y_ptr, y_stride, lfi->mbflim, lfi->lim, lfi->thr, 2);
John Koleszar's avatar
John Koleszar committed
88
89
90
}


91
/* Horizontal B Filtering */
John Koleszar's avatar
John Koleszar committed
92
void vp8_loop_filter_bh_mmx(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
Johann's avatar
Johann committed
93
                            int y_stride, int uv_stride, loop_filter_info *lfi)
John Koleszar's avatar
John Koleszar committed
94
95
96
97
98
99
{
    vp8_loop_filter_horizontal_edge_mmx(y_ptr + 4 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
    vp8_loop_filter_horizontal_edge_mmx(y_ptr + 8 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
    vp8_loop_filter_horizontal_edge_mmx(y_ptr + 12 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);

    if (u_ptr)
100
        vp8_loop_filter_horizontal_edge_mmx(u_ptr + 4 * uv_stride, uv_stride, lfi->flim, lfi->lim, lfi->thr, 1);
John Koleszar's avatar
John Koleszar committed
101
102

    if (v_ptr)
103
        vp8_loop_filter_horizontal_edge_mmx(v_ptr + 4 * uv_stride, uv_stride, lfi->flim, lfi->lim, lfi->thr, 1);
John Koleszar's avatar
John Koleszar committed
104
105
106
107
}


void vp8_loop_filter_bhs_mmx(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
Johann's avatar
Johann committed
108
                             int y_stride, int uv_stride, loop_filter_info *lfi)
John Koleszar's avatar
John Koleszar committed
109
110
111
112
113
114
115
116
117
118
{
    (void) u_ptr;
    (void) v_ptr;
    (void) uv_stride;
    vp8_loop_filter_simple_horizontal_edge_mmx(y_ptr + 4 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
    vp8_loop_filter_simple_horizontal_edge_mmx(y_ptr + 8 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
    vp8_loop_filter_simple_horizontal_edge_mmx(y_ptr + 12 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
}


119
/* Vertical B Filtering */
John Koleszar's avatar
John Koleszar committed
120
void vp8_loop_filter_bv_mmx(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
Johann's avatar
Johann committed
121
                            int y_stride, int uv_stride, loop_filter_info *lfi)
John Koleszar's avatar
John Koleszar committed
122
123
124
125
126
127
{
    vp8_loop_filter_vertical_edge_mmx(y_ptr + 4, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
    vp8_loop_filter_vertical_edge_mmx(y_ptr + 8, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
    vp8_loop_filter_vertical_edge_mmx(y_ptr + 12, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);

    if (u_ptr)
128
        vp8_loop_filter_vertical_edge_mmx(u_ptr + 4, uv_stride, lfi->flim, lfi->lim, lfi->thr, 1);
John Koleszar's avatar
John Koleszar committed
129
130

    if (v_ptr)
131
        vp8_loop_filter_vertical_edge_mmx(v_ptr + 4, uv_stride, lfi->flim, lfi->lim, lfi->thr, 1);
John Koleszar's avatar
John Koleszar committed
132
133
134
135
}


void vp8_loop_filter_bvs_mmx(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
Johann's avatar
Johann committed
136
                             int y_stride, int uv_stride, loop_filter_info *lfi)
John Koleszar's avatar
John Koleszar committed
137
138
139
140
141
142
143
144
145
146
147
{
    (void) u_ptr;
    (void) v_ptr;
    (void) uv_stride;
    vp8_loop_filter_simple_vertical_edge_mmx(y_ptr + 4, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
    vp8_loop_filter_simple_vertical_edge_mmx(y_ptr + 8, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
    vp8_loop_filter_simple_vertical_edge_mmx(y_ptr + 12, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
}
#endif


148
/* Horizontal MB filtering */
John Koleszar's avatar
John Koleszar committed
149
150
#if HAVE_SSE2
void vp8_loop_filter_mbh_sse2(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
Johann's avatar
Johann committed
151
                              int y_stride, int uv_stride, loop_filter_info *lfi)
John Koleszar's avatar
John Koleszar committed
152
{
153
    vp8_mbloop_filter_horizontal_edge_sse2(y_ptr, y_stride, lfi->mbflim, lfi->lim, lfi->thr, 2);
John Koleszar's avatar
John Koleszar committed
154
155

    if (u_ptr)
156
        vp8_mbloop_filter_horizontal_edge_uv_sse2(u_ptr, uv_stride, lfi->mbflim, lfi->lim, lfi->thr, v_ptr);
John Koleszar's avatar
John Koleszar committed
157
158
159
160
}


void vp8_loop_filter_mbhs_sse2(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
Johann's avatar
Johann committed
161
                               int y_stride, int uv_stride, loop_filter_info *lfi)
John Koleszar's avatar
John Koleszar committed
162
163
164
165
{
    (void) u_ptr;
    (void) v_ptr;
    (void) uv_stride;
166
    vp8_loop_filter_simple_horizontal_edge_sse2(y_ptr, y_stride, lfi->mbflim, lfi->lim, lfi->thr, 2);
John Koleszar's avatar
John Koleszar committed
167
168
169
}


170
/* Vertical MB Filtering */
John Koleszar's avatar
John Koleszar committed
171
void vp8_loop_filter_mbv_sse2(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
Johann's avatar
Johann committed
172
                              int y_stride, int uv_stride, loop_filter_info *lfi)
John Koleszar's avatar
John Koleszar committed
173
{
174
    vp8_mbloop_filter_vertical_edge_sse2(y_ptr, y_stride, lfi->mbflim, lfi->lim, lfi->thr, 2);
John Koleszar's avatar
John Koleszar committed
175
176

    if (u_ptr)
177
        vp8_mbloop_filter_vertical_edge_uv_sse2(u_ptr, uv_stride, lfi->mbflim, lfi->lim, lfi->thr, v_ptr);
John Koleszar's avatar
John Koleszar committed
178
179
180
181
}


void vp8_loop_filter_mbvs_sse2(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
Johann's avatar
Johann committed
182
                               int y_stride, int uv_stride, loop_filter_info *lfi)
John Koleszar's avatar
John Koleszar committed
183
184
185
186
{
    (void) u_ptr;
    (void) v_ptr;
    (void) uv_stride;
187
    vp8_loop_filter_simple_vertical_edge_sse2(y_ptr, y_stride, lfi->mbflim, lfi->lim, lfi->thr, 2);
John Koleszar's avatar
John Koleszar committed
188
189
190
}


191
/* Horizontal B Filtering */
John Koleszar's avatar
John Koleszar committed
192
void vp8_loop_filter_bh_sse2(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
Johann's avatar
Johann committed
193
                             int y_stride, int uv_stride, loop_filter_info *lfi)
John Koleszar's avatar
John Koleszar committed
194
195
196
197
198
199
{
    vp8_loop_filter_horizontal_edge_sse2(y_ptr + 4 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
    vp8_loop_filter_horizontal_edge_sse2(y_ptr + 8 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
    vp8_loop_filter_horizontal_edge_sse2(y_ptr + 12 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);

    if (u_ptr)
200
        vp8_loop_filter_horizontal_edge_uv_sse2(u_ptr + 4 * uv_stride, uv_stride, lfi->flim, lfi->lim, lfi->thr, v_ptr + 4 * uv_stride);
John Koleszar's avatar
John Koleszar committed
201
202
203
204
}


void vp8_loop_filter_bhs_sse2(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
Johann's avatar
Johann committed
205
                              int y_stride, int uv_stride, loop_filter_info *lfi)
John Koleszar's avatar
John Koleszar committed
206
207
208
209
210
211
212
213
214
215
{
    (void) u_ptr;
    (void) v_ptr;
    (void) uv_stride;
    vp8_loop_filter_simple_horizontal_edge_sse2(y_ptr + 4 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
    vp8_loop_filter_simple_horizontal_edge_sse2(y_ptr + 8 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
    vp8_loop_filter_simple_horizontal_edge_sse2(y_ptr + 12 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
}


216
/* Vertical B Filtering */
John Koleszar's avatar
John Koleszar committed
217
void vp8_loop_filter_bv_sse2(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
Johann's avatar
Johann committed
218
                             int y_stride, int uv_stride, loop_filter_info *lfi)
John Koleszar's avatar
John Koleszar committed
219
220
221
222
223
224
{
    vp8_loop_filter_vertical_edge_sse2(y_ptr + 4, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
    vp8_loop_filter_vertical_edge_sse2(y_ptr + 8, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
    vp8_loop_filter_vertical_edge_sse2(y_ptr + 12, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);

    if (u_ptr)
225
        vp8_loop_filter_vertical_edge_uv_sse2(u_ptr + 4, uv_stride, lfi->flim, lfi->lim, lfi->thr, v_ptr + 4);
John Koleszar's avatar
John Koleszar committed
226
227
228
229
}


void vp8_loop_filter_bvs_sse2(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
Johann's avatar
Johann committed
230
                              int y_stride, int uv_stride, loop_filter_info *lfi)
John Koleszar's avatar
John Koleszar committed
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
{
    (void) u_ptr;
    (void) v_ptr;
    (void) uv_stride;
    vp8_loop_filter_simple_vertical_edge_sse2(y_ptr + 4, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
    vp8_loop_filter_simple_vertical_edge_sse2(y_ptr + 8, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
    vp8_loop_filter_simple_vertical_edge_sse2(y_ptr + 12, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
}

#endif

#if 0
void vp8_fast_loop_filter_vertical_edges_sse(unsigned char *y_ptr,
        int y_stride,
        loop_filter_info *lfi)
{

    vp8_loop_filter_simple_vertical_edge_sse2(y_ptr + 4, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
    vp8_loop_filter_simple_vertical_edge_sse2(y_ptr + 8, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
    vp8_loop_filter_simple_vertical_edge_sse2(y_ptr + 12, y_stride, lfi->flim, lfi->lim, lfi->thr, 2);
}
#endif