Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(846)

Side by Side Diff: source/libvpx/vp9/common/vp9_loopfilter_filters.c

Issue 11974002: libvpx: Pull from upstream (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « source/libvpx/vp9/common/vp9_loopfilter.c ('k') | source/libvpx/vp9/common/vp9_mbpitch.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include <stdlib.h> 11 #include <stdlib.h>
12 #include "vpx_config.h" 12 #include "vpx_config.h"
13 #include "vp9/common/vp9_loopfilter.h" 13 #include "vp9/common/vp9_loopfilter.h"
14 #include "vp9/common/vp9_onyxc_int.h" 14 #include "vp9/common/vp9_onyxc_int.h"
15 15
16 typedef unsigned char uc; 16 static __inline int8_t signed_char_clamp(int t) {
17
18 static __inline signed char signed_char_clamp(int t) {
19 t = (t < -128 ? -128 : t); 17 t = (t < -128 ? -128 : t);
20 t = (t > 127 ? 127 : t); 18 t = (t > 127 ? 127 : t);
21 return (signed char) t; 19 return (int8_t) t;
22 } 20 }
23 21
24 22
25 /* should we apply any filter at all ( 11111111 yes, 00000000 no) */ 23 /* should we apply any filter at all ( 11111111 yes, 00000000 no) */
26 static __inline signed char filter_mask(uc limit, uc blimit, 24 static __inline int8_t filter_mask(uint8_t limit, uint8_t blimit,
27 uc p3, uc p2, uc p1, uc p0, 25 uint8_t p3, uint8_t p2,
28 uc q0, uc q1, uc q2, uc q3) { 26 uint8_t p1, uint8_t p0,
29 signed char mask = 0; 27 uint8_t q0, uint8_t q1,
28 uint8_t q2, uint8_t q3) {
29 int8_t mask = 0;
30 mask |= (abs(p3 - p2) > limit) * -1; 30 mask |= (abs(p3 - p2) > limit) * -1;
31 mask |= (abs(p2 - p1) > limit) * -1; 31 mask |= (abs(p2 - p1) > limit) * -1;
32 mask |= (abs(p1 - p0) > limit) * -1; 32 mask |= (abs(p1 - p0) > limit) * -1;
33 mask |= (abs(q1 - q0) > limit) * -1; 33 mask |= (abs(q1 - q0) > limit) * -1;
34 mask |= (abs(q2 - q1) > limit) * -1; 34 mask |= (abs(q2 - q1) > limit) * -1;
35 mask |= (abs(q3 - q2) > limit) * -1; 35 mask |= (abs(q3 - q2) > limit) * -1;
36 mask |= (abs(p0 - q0) * 2 + abs(p1 - q1) / 2 > blimit) * -1; 36 mask |= (abs(p0 - q0) * 2 + abs(p1 - q1) / 2 > blimit) * -1;
37 mask = ~mask; 37 mask = ~mask;
38 return mask; 38 return mask;
39 } 39 }
40 40
41 /* is there high variance internal edge ( 11111111 yes, 00000000 no) */ 41 /* is there high variance internal edge ( 11111111 yes, 00000000 no) */
42 static __inline signed char hevmask(uc thresh, uc p1, uc p0, uc q0, uc q1) { 42 static __inline int8_t hevmask(uint8_t thresh, uint8_t p1, uint8_t p0,
43 signed char hev = 0; 43 uint8_t q0, uint8_t q1) {
44 int8_t hev = 0;
44 hev |= (abs(p1 - p0) > thresh) * -1; 45 hev |= (abs(p1 - p0) > thresh) * -1;
45 hev |= (abs(q1 - q0) > thresh) * -1; 46 hev |= (abs(q1 - q0) > thresh) * -1;
46 return hev; 47 return hev;
47 } 48 }
48 49
49 static __inline void filter(signed char mask, uc hev, uc *op1, 50 static __inline void filter(int8_t mask, uint8_t hev, uint8_t *op1,
50 uc *op0, uc *oq0, uc *oq1) 51 uint8_t *op0, uint8_t *oq0, uint8_t *oq1) {
52 int8_t ps0, qs0;
53 int8_t ps1, qs1;
54 int8_t filter, Filter1, Filter2;
55 int8_t u;
51 56
52 { 57 ps1 = (int8_t) *op1 ^ 0x80;
53 signed char ps0, qs0; 58 ps0 = (int8_t) *op0 ^ 0x80;
54 signed char ps1, qs1; 59 qs0 = (int8_t) *oq0 ^ 0x80;
55 signed char filter, Filter1, Filter2; 60 qs1 = (int8_t) *oq1 ^ 0x80;
56 signed char u;
57
58 ps1 = (signed char) * op1 ^ 0x80;
59 ps0 = (signed char) * op0 ^ 0x80;
60 qs0 = (signed char) * oq0 ^ 0x80;
61 qs1 = (signed char) * oq1 ^ 0x80;
62 61
63 /* add outer taps if we have high edge variance */ 62 /* add outer taps if we have high edge variance */
64 filter = signed_char_clamp(ps1 - qs1); 63 filter = signed_char_clamp(ps1 - qs1);
65 filter &= hev; 64 filter &= hev;
66 65
67 /* inner taps */ 66 /* inner taps */
68 filter = signed_char_clamp(filter + 3 * (qs0 - ps0)); 67 filter = signed_char_clamp(filter + 3 * (qs0 - ps0));
69 filter &= mask; 68 filter &= mask;
70 69
71 /* save bottom 3 bits so that we round one side +4 and the other +3 70 /* save bottom 3 bits so that we round one side +4 and the other +3
(...skipping 12 matching lines...) Expand all
84 83
85 /* outer tap adjustments */ 84 /* outer tap adjustments */
86 filter += 1; 85 filter += 1;
87 filter >>= 1; 86 filter >>= 1;
88 filter &= ~hev; 87 filter &= ~hev;
89 88
90 u = signed_char_clamp(qs1 - filter); 89 u = signed_char_clamp(qs1 - filter);
91 *oq1 = u ^ 0x80; 90 *oq1 = u ^ 0x80;
92 u = signed_char_clamp(ps1 + filter); 91 u = signed_char_clamp(ps1 + filter);
93 *op1 = u ^ 0x80; 92 *op1 = u ^ 0x80;
94
95 } 93 }
96 94
97 void vp9_loop_filter_horizontal_edge_c 95 void vp9_loop_filter_horizontal_edge_c(uint8_t *s,
98 ( 96 int p, /* pitch */
99 unsigned char *s, 97 const unsigned char *blimit,
100 int p, /* pitch */ 98 const unsigned char *limit,
101 const unsigned char *blimit, 99 const unsigned char *thresh,
102 const unsigned char *limit, 100 int count) {
103 const unsigned char *thresh, 101 int hev = 0; /* high edge variance */
104 int count 102 int8_t mask = 0;
105 ) {
106 int hev = 0; /* high edge variance */
107 signed char mask = 0;
108 int i = 0; 103 int i = 0;
109 104
110 /* loop filter designed to work using chars so that we can make maximum use 105 /* loop filter designed to work using chars so that we can make maximum use
111 * of 8 bit simd instructions. 106 * of 8 bit simd instructions.
112 */ 107 */
113 do { 108 do {
114 mask = filter_mask(limit[0], blimit[0], 109 mask = filter_mask(limit[0], blimit[0],
115 s[-4 * p], s[-3 * p], s[-2 * p], s[-1 * p], 110 s[-4 * p], s[-3 * p], s[-2 * p], s[-1 * p],
116 s[0 * p], s[1 * p], s[2 * p], s[3 * p]); 111 s[0 * p], s[1 * p], s[2 * p], s[3 * p]);
117 112
118 hev = hevmask(thresh[0], s[-2 * p], s[-1 * p], s[0 * p], s[1 * p]); 113 hev = hevmask(thresh[0], s[-2 * p], s[-1 * p], s[0 * p], s[1 * p]);
119 114
120 filter(mask, hev, s - 2 * p, s - 1 * p, s, s + 1 * p); 115 filter(mask, hev, s - 2 * p, s - 1 * p, s, s + 1 * p);
121 116
122 ++s; 117 ++s;
123 } while (++i < count * 8); 118 } while (++i < count * 8);
124 } 119 }
125 120
126 void vp9_loop_filter_vertical_edge_c(unsigned char *s, 121 void vp9_loop_filter_vertical_edge_c(uint8_t *s,
127 int p, 122 int p,
128 const unsigned char *blimit, 123 const unsigned char *blimit,
129 const unsigned char *limit, 124 const unsigned char *limit,
130 const unsigned char *thresh, 125 const unsigned char *thresh,
131 int count) { 126 int count) {
132 int hev = 0; /* high edge variance */ 127 int hev = 0; /* high edge variance */
133 signed char mask = 0; 128 int8_t mask = 0;
134 int i = 0; 129 int i = 0;
135 130
136 /* loop filter designed to work using chars so that we can make maximum use 131 /* loop filter designed to work using chars so that we can make maximum use
137 * of 8 bit simd instructions. 132 * of 8 bit simd instructions.
138 */ 133 */
139 do { 134 do {
140 mask = filter_mask(limit[0], blimit[0], 135 mask = filter_mask(limit[0], blimit[0],
141 s[-4], s[-3], s[-2], s[-1], 136 s[-4], s[-3], s[-2], s[-1],
142 s[0], s[1], s[2], s[3]); 137 s[0], s[1], s[2], s[3]);
143 138
144 hev = hevmask(thresh[0], s[-2], s[-1], s[0], s[1]); 139 hev = hevmask(thresh[0], s[-2], s[-1], s[0], s[1]);
145 140
146 filter(mask, hev, s - 2, s - 1, s, s + 1); 141 filter(mask, hev, s - 2, s - 1, s, s + 1);
147 142
148 s += p; 143 s += p;
149 } while (++i < count * 8); 144 } while (++i < count * 8);
150 } 145 }
151 static __inline signed char flatmask(uc thresh, 146 static __inline signed char flatmask(uint8_t thresh,
152 uc p4, uc p3, uc p2, uc p1, uc p0, 147 uint8_t p4, uint8_t p3, uint8_t p2,
153 uc q0, uc q1, uc q2, uc q3, uc q4) { 148 uint8_t p1, uint8_t p0,
154 signed char flat = 0; 149 uint8_t q0, uint8_t q1, uint8_t q2,
155 flat |= (abs(p1 - p0) > 1) * -1; 150 uint8_t q3, uint8_t q4) {
156 flat |= (abs(q1 - q0) > 1) * -1; 151 int8_t flat = 0;
157 flat |= (abs(p0 - p2) > 1) * -1; 152 flat |= (abs(p1 - p0) > thresh) * -1;
158 flat |= (abs(q0 - q2) > 1) * -1; 153 flat |= (abs(q1 - q0) > thresh) * -1;
159 flat |= (abs(p3 - p0) > 1) * -1; 154 flat |= (abs(p0 - p2) > thresh) * -1;
160 flat |= (abs(q3 - q0) > 1) * -1; 155 flat |= (abs(q0 - q2) > thresh) * -1;
161 flat |= (abs(p4 - p0) > 1) * -1; 156 flat |= (abs(p3 - p0) > thresh) * -1;
162 flat |= (abs(q4 - q0) > 1) * -1; 157 flat |= (abs(q3 - q0) > thresh) * -1;
158 flat |= (abs(p4 - p0) > thresh) * -1;
159 flat |= (abs(q4 - q0) > thresh) * -1;
163 flat = ~flat; 160 flat = ~flat;
164 return flat; 161 return flat;
165 } 162 }
166 163
167 static __inline void mbfilter(signed char mask, uc hev, uc flat, 164 static __inline void mbfilter(int8_t mask, uint8_t hev, uint8_t flat,
168 uc *op4, uc *op3, uc *op2, uc *op1, uc *op0, 165 uint8_t *op4, uint8_t *op3, uint8_t *op2,
169 uc *oq0, uc *oq1, uc *oq2, uc *oq3, uc *oq4) { 166 uint8_t *op1, uint8_t *op0,
167 uint8_t *oq0, uint8_t *oq1, uint8_t *oq2,
168 uint8_t *oq3, uint8_t *oq4) {
170 /* use a 7 tap filter [1, 1, 1, 2, 1, 1, 1] for flat line */ 169 /* use a 7 tap filter [1, 1, 1, 2, 1, 1, 1] for flat line */
171 if (flat && mask) { 170 if (flat && mask) {
172 unsigned char p0, q0; 171 uint8_t p0, q0;
173 unsigned char p1, q1; 172 uint8_t p1, q1;
174 unsigned char p2, q2; 173 uint8_t p2, q2;
175 unsigned char p3, q3; 174 uint8_t p3, q3;
176 unsigned char p4, q4; 175 uint8_t p4, q4;
177 176
178 p4 = *op4; 177 p4 = *op4;
179 p3 = *op3; 178 p3 = *op3;
180 p2 = *op2; 179 p2 = *op2;
181 p1 = *op1; 180 p1 = *op1;
182 p0 = *op0; 181 p0 = *op0;
183 q0 = *oq0; 182 q0 = *oq0;
184 q1 = *oq1; 183 q1 = *oq1;
185 q2 = *oq2; 184 q2 = *oq2;
186 q3 = *oq3; 185 q3 = *oq3;
187 q4 = *oq4; 186 q4 = *oq4;
188 187
189 *op2 = (p4 + p4 + p3 + p2 + p2 + p1 + p0 + q0 + 4) >> 3; 188 *op2 = (p4 + p4 + p3 + p2 + p2 + p1 + p0 + q0 + 4) >> 3;
190 *op1 = (p4 + p3 + p2 + p1 + p1 + p0 + q0 + q1 + 4) >> 3; 189 *op1 = (p4 + p3 + p2 + p1 + p1 + p0 + q0 + q1 + 4) >> 3;
191 *op0 = (p3 + p2 + p1 + p0 + p0 + q0 + q1 + q2 + 4) >> 3; 190 *op0 = (p3 + p2 + p1 + p0 + p0 + q0 + q1 + q2 + 4) >> 3;
192 *oq0 = (p2 + p1 + p0 + q0 + q0 + q1 + q2 + q3 + 4) >> 3; 191 *oq0 = (p2 + p1 + p0 + q0 + q0 + q1 + q2 + q3 + 4) >> 3;
193 *oq1 = (p1 + p0 + q0 + q1 + q1 + q2 + q3 + q4 + 4) >> 3; 192 *oq1 = (p1 + p0 + q0 + q1 + q1 + q2 + q3 + q4 + 4) >> 3;
194 *oq2 = (p0 + q0 + q1 + q2 + q2 + q3 + q4 + q4 + 4) >> 3; 193 *oq2 = (p0 + q0 + q1 + q2 + q2 + q3 + q4 + q4 + 4) >> 3;
195 } else { 194 } else {
196 signed char ps0, qs0; 195 int8_t ps0, qs0;
197 signed char ps1, qs1; 196 int8_t ps1, qs1;
198 signed char filter, Filter1, Filter2; 197 int8_t filter, Filter1, Filter2;
199 signed char u; 198 int8_t u;
200 199
201 ps1 = (signed char) * op1 ^ 0x80; 200 ps1 = (int8_t) *op1 ^ 0x80;
202 ps0 = (signed char) * op0 ^ 0x80; 201 ps0 = (int8_t) *op0 ^ 0x80;
203 qs0 = (signed char) * oq0 ^ 0x80; 202 qs0 = (int8_t) *oq0 ^ 0x80;
204 qs1 = (signed char) * oq1 ^ 0x80; 203 qs1 = (int8_t) *oq1 ^ 0x80;
205 204
206 /* add outer taps if we have high edge variance */ 205 /* add outer taps if we have high edge variance */
207 filter = signed_char_clamp(ps1 - qs1); 206 filter = signed_char_clamp(ps1 - qs1);
208 filter &= hev; 207 filter &= hev;
209 208
210 /* inner taps */ 209 /* inner taps */
211 filter = signed_char_clamp(filter + 3 * (qs0 - ps0)); 210 filter = signed_char_clamp(filter + 3 * (qs0 - ps0));
212 filter &= mask; 211 filter &= mask;
213 212
214 Filter1 = signed_char_clamp(filter + 4); 213 Filter1 = signed_char_clamp(filter + 4);
(...skipping 11 matching lines...) Expand all
226 filter += 1; 225 filter += 1;
227 filter >>= 1; 226 filter >>= 1;
228 filter &= ~hev; 227 filter &= ~hev;
229 228
230 u = signed_char_clamp(qs1 - filter); 229 u = signed_char_clamp(qs1 - filter);
231 *oq1 = u ^ 0x80; 230 *oq1 = u ^ 0x80;
232 u = signed_char_clamp(ps1 + filter); 231 u = signed_char_clamp(ps1 + filter);
233 *op1 = u ^ 0x80; 232 *op1 = u ^ 0x80;
234 } 233 }
235 } 234 }
236 void vp9_mbloop_filter_horizontal_edge_c 235
237 ( 236 void vp9_mbloop_filter_horizontal_edge_c(uint8_t *s,
238 unsigned char *s, 237 int p,
239 int p, 238 const unsigned char *blimit,
240 const unsigned char *blimit, 239 const unsigned char *limit,
241 const unsigned char *limit, 240 const unsigned char *thresh,
242 const unsigned char *thresh, 241 int count) {
243 int count 242 int8_t hev = 0; /* high edge variance */
244 ) { 243 int8_t mask = 0;
245 signed char hev = 0; /* high edge variance */ 244 int8_t flat = 0;
246 signed char mask = 0;
247 signed char flat = 0;
248 int i = 0; 245 int i = 0;
249 246
250 /* loop filter designed to work using chars so that we can make maximum use 247 /* loop filter designed to work using chars so that we can make maximum use
251 * of 8 bit simd instructions. 248 * of 8 bit simd instructions.
252 */ 249 */
253 do { 250 do {
254
255 mask = filter_mask(limit[0], blimit[0], 251 mask = filter_mask(limit[0], blimit[0],
256 s[-4 * p], s[-3 * p], s[-2 * p], s[-1 * p], 252 s[-4 * p], s[-3 * p], s[-2 * p], s[-1 * p],
257 s[ 0 * p], s[ 1 * p], s[ 2 * p], s[ 3 * p]); 253 s[ 0 * p], s[ 1 * p], s[ 2 * p], s[ 3 * p]);
258 254
259 hev = hevmask(thresh[0], s[-2 * p], s[-1 * p], s[0 * p], s[1 * p]); 255 hev = hevmask(thresh[0], s[-2 * p], s[-1 * p], s[0 * p], s[1 * p]);
260 256
261 flat = flatmask(thresh[0], 257 flat = flatmask(1,
262 s[-5 * p], s[-4 * p], s[-3 * p], s[-2 * p], s[-1 * p], 258 s[-5 * p], s[-4 * p], s[-3 * p], s[-2 * p], s[-1 * p],
263 s[ 0 * p], s[ 1 * p], s[ 2 * p], s[ 3 * p], s[ 4 * p]); 259 s[ 0 * p], s[ 1 * p], s[ 2 * p], s[ 3 * p], s[ 4 * p]);
264 mbfilter(mask, hev, flat, 260 mbfilter(mask, hev, flat,
265 s - 5 * p, s - 4 * p, s - 3 * p, s - 2 * p, s - 1 * p, 261 s - 5 * p, s - 4 * p, s - 3 * p, s - 2 * p, s - 1 * p,
266 s, s + 1 * p, s + 2 * p, s + 3 * p, s + 4 * p); 262 s, s + 1 * p, s + 2 * p, s + 3 * p, s + 4 * p);
267 263
268 ++s; 264 ++s;
269 } while (++i < count * 8); 265 } while (++i < count * 8);
270 266
271 } 267 }
272 void vp9_mbloop_filter_vertical_edge_c 268
273 ( 269 void vp9_mbloop_filter_vertical_edge_c(uint8_t *s,
274 unsigned char *s, 270 int p,
275 int p, 271 const unsigned char *blimit,
276 const unsigned char *blimit, 272 const unsigned char *limit,
277 const unsigned char *limit, 273 const unsigned char *thresh,
278 const unsigned char *thresh, 274 int count) {
279 int count 275 int8_t hev = 0; /* high edge variance */
280 ) { 276 int8_t mask = 0;
281 signed char hev = 0; /* high edge variance */ 277 int8_t flat = 0;
282 signed char mask = 0;
283 signed char flat = 0;
284 int i = 0; 278 int i = 0;
285 279
286 do { 280 do {
287
288 mask = filter_mask(limit[0], blimit[0], 281 mask = filter_mask(limit[0], blimit[0],
289 s[-4], s[-3], s[-2], s[-1], 282 s[-4], s[-3], s[-2], s[-1],
290 s[0], s[1], s[2], s[3]); 283 s[0], s[1], s[2], s[3]);
291 284
292 hev = hevmask(thresh[0], s[-2], s[-1], s[0], s[1]); 285 hev = hevmask(thresh[0], s[-2], s[-1], s[0], s[1]);
293 flat = flatmask(thresh[0], 286 flat = flatmask(1,
294 s[-5], s[-4], s[-3], s[-2], s[-1], 287 s[-5], s[-4], s[-3], s[-2], s[-1],
295 s[ 0], s[ 1], s[ 2], s[ 3], s[ 4]); 288 s[ 0], s[ 1], s[ 2], s[ 3], s[ 4]);
296 mbfilter(mask, hev, flat, 289 mbfilter(mask, hev, flat,
297 s - 5, s - 4, s - 3, s - 2, s - 1, 290 s - 5, s - 4, s - 3, s - 2, s - 1,
298 s, s + 1, s + 2, s + 3, s + 4); 291 s, s + 1, s + 2, s + 3, s + 4);
299 s += p; 292 s += p;
300 } while (++i < count * 8); 293 } while (++i < count * 8);
301 294
302 } 295 }
303 296
304 /* should we apply any filter at all ( 11111111 yes, 00000000 no) */ 297 /* should we apply any filter at all ( 11111111 yes, 00000000 no) */
305 static __inline signed char simple_filter_mask(uc blimit, 298 static __inline int8_t simple_filter_mask(uint8_t blimit,
306 uc p1, uc p0, 299 uint8_t p1, uint8_t p0,
307 uc q0, uc q1) { 300 uint8_t q0, uint8_t q1) {
308 /* Why does this cause problems for win32? 301 /* Why does this cause problems for win32?
309 * error C2143: syntax error : missing ';' before 'type' 302 * error C2143: syntax error : missing ';' before 'type'
310 * (void) limit; 303 * (void) limit;
311 */ 304 */
312 signed char mask = (abs(p0 - q0) * 2 + abs(p1 - q1) / 2 <= blimit) * -1; 305 int8_t mask = (abs(p0 - q0) * 2 + abs(p1 - q1) / 2 <= blimit) * -1;
313 return mask; 306 return mask;
314 } 307 }
315 308
316 static __inline void simple_filter(signed char mask, 309 static __inline void simple_filter(int8_t mask,
317 uc *op1, uc *op0, 310 uint8_t *op1, uint8_t *op0,
318 uc *oq0, uc *oq1) { 311 uint8_t *oq0, uint8_t *oq1) {
319 signed char filter, Filter1, Filter2; 312 int8_t filter, Filter1, Filter2;
320 signed char p1 = (signed char) * op1 ^ 0x80; 313 int8_t p1 = (int8_t) *op1 ^ 0x80;
321 signed char p0 = (signed char) * op0 ^ 0x80; 314 int8_t p0 = (int8_t) *op0 ^ 0x80;
322 signed char q0 = (signed char) * oq0 ^ 0x80; 315 int8_t q0 = (int8_t) *oq0 ^ 0x80;
323 signed char q1 = (signed char) * oq1 ^ 0x80; 316 int8_t q1 = (int8_t) *oq1 ^ 0x80;
324 signed char u; 317 int8_t u;
325 318
326 filter = signed_char_clamp(p1 - q1); 319 filter = signed_char_clamp(p1 - q1);
327 filter = signed_char_clamp(filter + 3 * (q0 - p0)); 320 filter = signed_char_clamp(filter + 3 * (q0 - p0));
328 filter &= mask; 321 filter &= mask;
329 322
330 /* save bottom 3 bits so that we round one side +4 and the other +3 */ 323 /* save bottom 3 bits so that we round one side +4 and the other +3 */
331 Filter1 = signed_char_clamp(filter + 4); 324 Filter1 = signed_char_clamp(filter + 4);
332 Filter1 >>= 3; 325 Filter1 >>= 3;
333 u = signed_char_clamp(q0 - Filter1); 326 u = signed_char_clamp(q0 - Filter1);
334 *oq0 = u ^ 0x80; 327 *oq0 = u ^ 0x80;
335 328
336 Filter2 = signed_char_clamp(filter + 3); 329 Filter2 = signed_char_clamp(filter + 3);
337 Filter2 >>= 3; 330 Filter2 >>= 3;
338 u = signed_char_clamp(p0 + Filter2); 331 u = signed_char_clamp(p0 + Filter2);
339 *op0 = u ^ 0x80; 332 *op0 = u ^ 0x80;
340 } 333 }
341 334
342 void vp9_loop_filter_simple_horizontal_edge_c 335 void vp9_loop_filter_simple_horizontal_edge_c(uint8_t *s,
343 ( 336 int p,
344 unsigned char *s, 337 const unsigned char *blimit) {
345 int p, 338 int8_t mask = 0;
346 const unsigned char *blimit
347 ) {
348 signed char mask = 0;
349 int i = 0; 339 int i = 0;
350 340
351 do { 341 do {
352 mask = simple_filter_mask(blimit[0], 342 mask = simple_filter_mask(blimit[0],
353 s[-2 * p], s[-1 * p], 343 s[-2 * p], s[-1 * p],
354 s[0 * p], s[1 * p]); 344 s[0 * p], s[1 * p]);
355 simple_filter(mask, 345 simple_filter(mask,
356 s - 2 * p, s - 1 * p, 346 s - 2 * p, s - 1 * p,
357 s, s + 1 * p); 347 s, s + 1 * p);
358 ++s; 348 ++s;
359 } while (++i < 16); 349 } while (++i < 16);
360 } 350 }
361 351
362 void vp9_loop_filter_simple_vertical_edge_c 352 void vp9_loop_filter_simple_vertical_edge_c(uint8_t *s,
363 ( 353 int p,
364 unsigned char *s, 354 const unsigned char *blimit) {
365 int p, 355 int8_t mask = 0;
366 const unsigned char *blimit
367 ) {
368 signed char mask = 0;
369 int i = 0; 356 int i = 0;
370 357
371 do { 358 do {
372 mask = simple_filter_mask(blimit[0], s[-2], s[-1], s[0], s[1]); 359 mask = simple_filter_mask(blimit[0], s[-2], s[-1], s[0], s[1]);
373 simple_filter(mask, s - 2, s - 1, s, s + 1); 360 simple_filter(mask, s - 2, s - 1, s, s + 1);
374 s += p; 361 s += p;
375 } while (++i < 16); 362 } while (++i < 16);
376
377 } 363 }
378 364
379 /* Vertical MB Filtering */ 365 /* Vertical MB Filtering */
380 void vp9_loop_filter_mbv_c(unsigned char *y_ptr, unsigned char *u_ptr, 366 void vp9_loop_filter_mbv_c(uint8_t *y_ptr, uint8_t *u_ptr,
381 unsigned char *v_ptr, int y_stride, int uv_stride, 367 uint8_t *v_ptr, int y_stride, int uv_stride,
382 struct loop_filter_info *lfi) { 368 struct loop_filter_info *lfi) {
383 vp9_mbloop_filter_vertical_edge_c(y_ptr, y_stride, 369 vp9_mbloop_filter_vertical_edge_c(y_ptr, y_stride,
384 lfi->mblim, lfi->lim, lfi->hev_thr, 2); 370 lfi->mblim, lfi->lim, lfi->hev_thr, 2);
385 371
386 if (u_ptr) 372 if (u_ptr)
387 vp9_mbloop_filter_vertical_edge_c(u_ptr, uv_stride, 373 vp9_mbloop_filter_vertical_edge_c(u_ptr, uv_stride,
388 lfi->mblim, lfi->lim, lfi->hev_thr, 1); 374 lfi->mblim, lfi->lim, lfi->hev_thr, 1);
389 375
390 if (v_ptr) 376 if (v_ptr)
391 vp9_mbloop_filter_vertical_edge_c(v_ptr, uv_stride, 377 vp9_mbloop_filter_vertical_edge_c(v_ptr, uv_stride,
392 lfi->mblim, lfi->lim, lfi->hev_thr, 1); 378 lfi->mblim, lfi->lim, lfi->hev_thr, 1);
393 } 379 }
394 380
395 /* Vertical B Filtering */ 381 /* Vertical B Filtering */
396 void vp9_loop_filter_bv_c(unsigned char *y_ptr, unsigned char *u_ptr, 382 void vp9_loop_filter_bv_c(uint8_t*y_ptr, uint8_t *u_ptr,
397 unsigned char *v_ptr, int y_stride, int uv_stride, 383 uint8_t *v_ptr, int y_stride, int uv_stride,
398 struct loop_filter_info *lfi) { 384 struct loop_filter_info *lfi) {
399 vp9_loop_filter_vertical_edge_c(y_ptr + 4, y_stride, 385 vp9_loop_filter_vertical_edge_c(y_ptr + 4, y_stride,
400 lfi->blim, lfi->lim, lfi->hev_thr, 2); 386 lfi->blim, lfi->lim, lfi->hev_thr, 2);
401 vp9_loop_filter_vertical_edge_c(y_ptr + 8, y_stride, 387 vp9_loop_filter_vertical_edge_c(y_ptr + 8, y_stride,
402 lfi->blim, lfi->lim, lfi->hev_thr, 2); 388 lfi->blim, lfi->lim, lfi->hev_thr, 2);
403 vp9_loop_filter_vertical_edge_c(y_ptr + 12, y_stride, 389 vp9_loop_filter_vertical_edge_c(y_ptr + 12, y_stride,
404 lfi->blim, lfi->lim, lfi->hev_thr, 2); 390 lfi->blim, lfi->lim, lfi->hev_thr, 2);
405 391
406 if (u_ptr) 392 if (u_ptr)
407 vp9_loop_filter_vertical_edge_c(u_ptr + 4, uv_stride, 393 vp9_loop_filter_vertical_edge_c(u_ptr + 4, uv_stride,
408 lfi->blim, lfi->lim, lfi->hev_thr, 1); 394 lfi->blim, lfi->lim, lfi->hev_thr, 1);
409 395
410 if (v_ptr) 396 if (v_ptr)
411 vp9_loop_filter_vertical_edge_c(v_ptr + 4, uv_stride, 397 vp9_loop_filter_vertical_edge_c(v_ptr + 4, uv_stride,
412 lfi->blim, lfi->lim, lfi->hev_thr, 1); 398 lfi->blim, lfi->lim, lfi->hev_thr, 1);
413 } 399 }
414 400
415 /* Horizontal MB filtering */ 401 /* Horizontal MB filtering */
416 void vp9_loop_filter_mbh_c(unsigned char *y_ptr, unsigned char *u_ptr, 402 void vp9_loop_filter_mbh_c(uint8_t *y_ptr, uint8_t *u_ptr,
417 unsigned char *v_ptr, int y_stride, int uv_stride, 403 uint8_t *v_ptr, int y_stride, int uv_stride,
418 struct loop_filter_info *lfi) { 404 struct loop_filter_info *lfi) {
419 vp9_mbloop_filter_horizontal_edge_c(y_ptr, y_stride, 405 vp9_mbloop_filter_horizontal_edge_c(y_ptr, y_stride,
420 lfi->mblim, lfi->lim, lfi->hev_thr, 2); 406 lfi->mblim, lfi->lim, lfi->hev_thr, 2);
421 407
422 if (u_ptr) 408 if (u_ptr)
423 vp9_mbloop_filter_horizontal_edge_c(u_ptr, uv_stride, 409 vp9_mbloop_filter_horizontal_edge_c(u_ptr, uv_stride,
424 lfi->mblim, lfi->lim, lfi->hev_thr, 1); 410 lfi->mblim, lfi->lim, lfi->hev_thr, 1);
425 411
426 if (v_ptr) 412 if (v_ptr)
427 vp9_mbloop_filter_horizontal_edge_c(v_ptr, uv_stride, 413 vp9_mbloop_filter_horizontal_edge_c(v_ptr, uv_stride,
428 lfi->mblim, lfi->lim, lfi->hev_thr, 1); 414 lfi->mblim, lfi->lim, lfi->hev_thr, 1);
429 } 415 }
430 416
431 /* Horizontal B Filtering */ 417 /* Horizontal B Filtering */
432 void vp9_loop_filter_bh_c(unsigned char *y_ptr, unsigned char *u_ptr, 418 void vp9_loop_filter_bh_c(uint8_t *y_ptr, uint8_t *u_ptr,
433 unsigned char *v_ptr, int y_stride, int uv_stride, 419 uint8_t *v_ptr, int y_stride, int uv_stride,
434 struct loop_filter_info *lfi) { 420 struct loop_filter_info *lfi) {
435 vp9_loop_filter_horizontal_edge_c(y_ptr + 4 * y_stride, y_stride, 421 vp9_loop_filter_horizontal_edge_c(y_ptr + 4 * y_stride, y_stride,
436 lfi->blim, lfi->lim, lfi->hev_thr, 2); 422 lfi->blim, lfi->lim, lfi->hev_thr, 2);
437 vp9_loop_filter_horizontal_edge_c(y_ptr + 8 * y_stride, y_stride, 423 vp9_loop_filter_horizontal_edge_c(y_ptr + 8 * y_stride, y_stride,
438 lfi->blim, lfi->lim, lfi->hev_thr, 2); 424 lfi->blim, lfi->lim, lfi->hev_thr, 2);
439 vp9_loop_filter_horizontal_edge_c(y_ptr + 12 * y_stride, y_stride, 425 vp9_loop_filter_horizontal_edge_c(y_ptr + 12 * y_stride, y_stride,
440 lfi->blim, lfi->lim, lfi->hev_thr, 2); 426 lfi->blim, lfi->lim, lfi->hev_thr, 2);
441 427
442 if (u_ptr) 428 if (u_ptr)
443 vp9_loop_filter_horizontal_edge_c(u_ptr + 4 * uv_stride, uv_stride, 429 vp9_loop_filter_horizontal_edge_c(u_ptr + 4 * uv_stride, uv_stride,
444 lfi->blim, lfi->lim, lfi->hev_thr, 1); 430 lfi->blim, lfi->lim, lfi->hev_thr, 1);
445 431
446 if (v_ptr) 432 if (v_ptr)
447 vp9_loop_filter_horizontal_edge_c(v_ptr + 4 * uv_stride, uv_stride, 433 vp9_loop_filter_horizontal_edge_c(v_ptr + 4 * uv_stride, uv_stride,
448 lfi->blim, lfi->lim, lfi->hev_thr, 1); 434 lfi->blim, lfi->lim, lfi->hev_thr, 1);
449 } 435 }
450 436
451 void vp9_loop_filter_bh8x8_c(unsigned char *y_ptr, unsigned char *u_ptr, 437 void vp9_loop_filter_bh8x8_c(uint8_t *y_ptr, uint8_t *u_ptr,
452 unsigned char *v_ptr, int y_stride, int uv_stride, 438 uint8_t *v_ptr, int y_stride, int uv_stride,
453 struct loop_filter_info *lfi) { 439 struct loop_filter_info *lfi) {
454 vp9_mbloop_filter_horizontal_edge_c( 440 vp9_mbloop_filter_horizontal_edge_c(
455 y_ptr + 8 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2); 441 y_ptr + 8 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
442
443 if (u_ptr)
444 vp9_loop_filter_horizontal_edge_c(u_ptr + 4 * uv_stride, uv_stride,
445 lfi->blim, lfi->lim, lfi->hev_thr, 1);
446
447 if (v_ptr)
448 vp9_loop_filter_horizontal_edge_c(v_ptr + 4 * uv_stride, uv_stride,
449 lfi->blim, lfi->lim, lfi->hev_thr, 1);
456 } 450 }
457 451
458 void vp9_loop_filter_bhs_c(unsigned char *y_ptr, int y_stride, 452 void vp9_loop_filter_bhs_c(uint8_t *y_ptr, int y_stride,
459 const unsigned char *blimit) { 453 const unsigned char *blimit) {
460 vp9_loop_filter_simple_horizontal_edge_c(y_ptr + 4 * y_stride, 454 vp9_loop_filter_simple_horizontal_edge_c(y_ptr + 4 * y_stride,
461 y_stride, blimit); 455 y_stride, blimit);
462 vp9_loop_filter_simple_horizontal_edge_c(y_ptr + 8 * y_stride, 456 vp9_loop_filter_simple_horizontal_edge_c(y_ptr + 8 * y_stride,
463 y_stride, blimit); 457 y_stride, blimit);
464 vp9_loop_filter_simple_horizontal_edge_c(y_ptr + 12 * y_stride, 458 vp9_loop_filter_simple_horizontal_edge_c(y_ptr + 12 * y_stride,
465 y_stride, blimit); 459 y_stride, blimit);
466 } 460 }
467 461
468 void vp9_loop_filter_bv8x8_c(unsigned char *y_ptr, unsigned char *u_ptr, 462 void vp9_loop_filter_bv8x8_c(uint8_t *y_ptr, uint8_t *u_ptr,
469 unsigned char *v_ptr, int y_stride, int uv_stride, 463 uint8_t *v_ptr, int y_stride, int uv_stride,
470 struct loop_filter_info *lfi) { 464 struct loop_filter_info *lfi) {
471 vp9_mbloop_filter_vertical_edge_c( 465 vp9_mbloop_filter_vertical_edge_c(
472 y_ptr + 8, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2); 466 y_ptr + 8, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
473 } 467
474 468 if (u_ptr)
475 void vp9_loop_filter_bvs_c(unsigned char *y_ptr, int y_stride, 469 vp9_loop_filter_vertical_edge_c(u_ptr + 4, uv_stride,
470 lfi->blim, lfi->lim, lfi->hev_thr, 1);
471
472 if (v_ptr)
473 vp9_loop_filter_vertical_edge_c(v_ptr + 4, uv_stride,
474 lfi->blim, lfi->lim, lfi->hev_thr, 1);
475 }
476
477 void vp9_loop_filter_bvs_c(uint8_t *y_ptr, int y_stride,
476 const unsigned char *blimit) { 478 const unsigned char *blimit) {
477 vp9_loop_filter_simple_vertical_edge_c(y_ptr + 4, y_stride, blimit); 479 vp9_loop_filter_simple_vertical_edge_c(y_ptr + 4, y_stride, blimit);
478 vp9_loop_filter_simple_vertical_edge_c(y_ptr + 8, y_stride, blimit); 480 vp9_loop_filter_simple_vertical_edge_c(y_ptr + 8, y_stride, blimit);
479 vp9_loop_filter_simple_vertical_edge_c(y_ptr + 12, y_stride, blimit); 481 vp9_loop_filter_simple_vertical_edge_c(y_ptr + 12, y_stride, blimit);
480 } 482 }
483
484 static __inline void wide_mbfilter(int8_t mask, uint8_t hev,
485 uint8_t flat, uint8_t flat2,
486 uint8_t *op7, uint8_t *op6, uint8_t *op5,
487 uint8_t *op4, uint8_t *op3, uint8_t *op2,
488 uint8_t *op1, uint8_t *op0, uint8_t *oq0,
489 uint8_t *oq1, uint8_t *oq2, uint8_t *oq3,
490 uint8_t *oq4, uint8_t *oq5, uint8_t *oq6,
491 uint8_t *oq7) {
492 /* use a 15 tap filter [1,1,1,1,1,1,1,2,1,1,1,1,1,1,1] for flat line */
493 if (flat2 && flat && mask) {
494 uint8_t p0, q0;
495 uint8_t p1, q1;
496 uint8_t p2, q2;
497 uint8_t p3, q3;
498 uint8_t p4, q4;
499 uint8_t p5, q5;
500 uint8_t p6, q6;
501 uint8_t p7, q7;
502
503 p7 = *op7;
504 p6 = *op6;
505 p5 = *op5;
506 p4 = *op4;
507 p3 = *op3;
508 p2 = *op2;
509 p1 = *op1;
510 p0 = *op0;
511 q0 = *oq0;
512 q1 = *oq1;
513 q2 = *oq2;
514 q3 = *oq3;
515 q4 = *oq4;
516 q5 = *oq5;
517 q6 = *oq6;
518 q7 = *oq7;
519
520 *op6 = (p7 * 7 + p6 * 2 +
521 p5 + p4 + p3 + p2 + p1 + p0 + q0 + 8) >> 4;
522 *op5 = (p7 * 6 + p6 + p5 * 2 +
523 p4 + p3 + p2 + p1 + p0 + q0 + q1 + 8) >> 4;
524 *op4 = (p7 * 5 + p6 + p5 + p4 * 2 +
525 p3 + p2 + p1 + p0 + q0 + q1 + q2 + 8) >> 4;
526 *op3 = (p7 * 4 + p6 + p5 + p4 + p3 * 2 +
527 p2 + p1 + p0 + q0 + q1 + q2 + q3 + 8) >> 4;
528 *op2 = (p7 * 3 + p6 + p5 + p4 + p3 + p2 * 2 +
529 p1 + p0 + q0 + q1 + q2 + q3 + q4 + 8) >> 4;
530 *op1 = (p7 * 2 + p6 + p5 + p4 + p3 + p2 + p1 * 2 +
531 p0 + q0 + q1 + q2 + q3 + q4 + q5 + 8) >> 4;
532 *op0 = (p7 + p6 + p5 + p4 + p3 + p2 + p1 + p0 * 2 +
533 q0 + q1 + q2 + q3 + q4 + q5 + q6 + 8) >> 4;
534 *oq0 = (p6 + p5 + p4 + p3 + p2 + p1 + p0 + q0 * 2 +
535 q1 + q2 + q3 + q4 + q5 + q6 + q7 + 8) >> 4;
536 *oq1 = (p5 + p4 + p3 + p2 + p1 + p0 + q0 + q1 * 2 +
537 q2 + q3 + q4 + q5 + q6 + q7 * 2 + 8) >> 4;
538 *oq2 = (p4 + p3 + p2 + p1 + p0 + q0 + q1 + q2 * 2 +
539 q3 + q4 + q5 + q6 + q7 * 3 + 8) >> 4;
540 *oq3 = (p3 + p2 + p1 + p0 + q0 + q1 + q2 + q3 * 2 +
541 q4 + q5 + q6 + q7 * 4 + 8) >> 4;
542 *oq4 = (p2 + p1 + p0 + q0 + q1 + q2 + q3 + q4 * 2 +
543 q5 + q6 + q7 * 5 + 8) >> 4;
544 *oq5 = (p1 + p0 + q0 + q1 + q2 + q3 + q4 + q5 * 2 +
545 q6 + q7 * 6 + 8) >> 4;
546 *oq6 = (p0 + q0 + q1 + q2 + q3 + q4 + q5 + q6 * 2 +
547 q7 * 7 + 8) >> 4;
548 } else if (flat && mask) {
549 unsigned char p0, q0;
550 unsigned char p1, q1;
551 unsigned char p2, q2;
552 unsigned char p3, q3;
553 unsigned char p4, q4;
554
555 p4 = *op4;
556 p3 = *op3;
557 p2 = *op2;
558 p1 = *op1;
559 p0 = *op0;
560 q0 = *oq0;
561 q1 = *oq1;
562 q2 = *oq2;
563 q3 = *oq3;
564 q4 = *oq4;
565
566 *op2 = (p4 + p4 + p3 + p2 + p2 + p1 + p0 + q0 + 4) >> 3;
567 *op1 = (p4 + p3 + p2 + p1 + p1 + p0 + q0 + q1 + 4) >> 3;
568 *op0 = (p3 + p2 + p1 + p0 + p0 + q0 + q1 + q2 + 4) >> 3;
569 *oq0 = (p2 + p1 + p0 + q0 + q0 + q1 + q2 + q3 + 4) >> 3;
570 *oq1 = (p1 + p0 + q0 + q1 + q1 + q2 + q3 + q4 + 4) >> 3;
571 *oq2 = (p0 + q0 + q1 + q2 + q2 + q3 + q4 + q4 + 4) >> 3;
572 } else {
573 signed char ps0, qs0;
574 signed char ps1, qs1;
575 signed char filter, Filter1, Filter2;
576 signed char u;
577
578 ps1 = (signed char) * op1 ^ 0x80;
579 ps0 = (signed char) * op0 ^ 0x80;
580 qs0 = (signed char) * oq0 ^ 0x80;
581 qs1 = (signed char) * oq1 ^ 0x80;
582
583 /* add outer taps if we have high edge variance */
584 filter = signed_char_clamp(ps1 - qs1);
585 filter &= hev;
586
587 /* inner taps */
588 filter = signed_char_clamp(filter + 3 * (qs0 - ps0));
589 filter &= mask;
590
591 Filter1 = signed_char_clamp(filter + 4);
592 Filter2 = signed_char_clamp(filter + 3);
593 Filter1 >>= 3;
594 Filter2 >>= 3;
595
596 u = signed_char_clamp(qs0 - Filter1);
597 *oq0 = u ^ 0x80;
598 u = signed_char_clamp(ps0 + Filter2);
599 *op0 = u ^ 0x80;
600 filter = Filter1;
601
602 /* outer tap adjustments */
603 filter += 1;
604 filter >>= 1;
605 filter &= ~hev;
606
607 u = signed_char_clamp(qs1 - filter);
608 *oq1 = u ^ 0x80;
609 u = signed_char_clamp(ps1 + filter);
610 *op1 = u ^ 0x80;
611 }
612 }
613
614 void vp9_mb_lpf_horizontal_edge_w
615 (
616 unsigned char *s,
617 int p,
618 const unsigned char *blimit,
619 const unsigned char *limit,
620 const unsigned char *thresh,
621 int count
622 ) {
623 signed char hev = 0; /* high edge variance */
624 signed char mask = 0;
625 signed char flat = 0;
626 signed char flat2 = 0;
627 int i = 0;
628
629 /* loop filter designed to work using chars so that we can make maximum use
630 * of 8 bit simd instructions.
631 */
632 do {
633 mask = filter_mask(limit[0], blimit[0],
634 s[-4 * p], s[-3 * p], s[-2 * p], s[-1 * p],
635 s[ 0 * p], s[ 1 * p], s[ 2 * p], s[ 3 * p]);
636
637 hev = hevmask(thresh[0], s[-2 * p], s[-1 * p], s[0 * p], s[1 * p]);
638
639 flat = flatmask(1,
640 s[-5 * p], s[-4 * p], s[-3 * p], s[-2 * p], s[-1 * p],
641 s[ 0 * p], s[ 1 * p], s[ 2 * p], s[ 3 * p], s[ 4 * p]);
642
643 flat2 = flatmask(1,
644 s[-8 * p], s[-7 * p], s[-6 * p], s[-5 * p], s[-1 * p],
645 s[ 0 * p], s[ 4 * p], s[ 5 * p], s[ 6 * p], s[ 7 * p]);
646
647 wide_mbfilter(mask, hev, flat, flat2,
648 s - 8 * p, s - 7 * p, s - 6 * p, s - 5 * p,
649 s - 4 * p, s - 3 * p, s - 2 * p, s - 1 * p,
650 s, s + 1 * p, s + 2 * p, s + 3 * p,
651 s + 4 * p, s + 5 * p, s + 6 * p, s + 7 * p);
652
653 ++s;
654 } while (++i < count * 8);
655 }
656 void vp9_mb_lpf_vertical_edge_w
657 (
658 unsigned char *s,
659 int p,
660 const unsigned char *blimit,
661 const unsigned char *limit,
662 const unsigned char *thresh,
663 int count
664 ) {
665 signed char hev = 0; /* high edge variance */
666 signed char mask = 0;
667 signed char flat = 0;
668 signed char flat2 = 0;
669 int i = 0;
670
671 do {
672 mask = filter_mask(limit[0], blimit[0],
673 s[-4], s[-3], s[-2], s[-1],
674 s[0], s[1], s[2], s[3]);
675
676 hev = hevmask(thresh[0], s[-2], s[-1], s[0], s[1]);
677 flat = flatmask(1,
678 s[-5], s[-4], s[-3], s[-2], s[-1],
679 s[ 0], s[ 1], s[ 2], s[ 3], s[ 4]);
680 flat2 = flatmask(1,
681 s[-8], s[-7], s[-6], s[-5], s[-1],
682 s[ 0], s[ 4], s[ 5], s[ 6], s[ 7]);
683
684 wide_mbfilter(mask, hev, flat, flat2,
685 s - 8, s - 7, s - 6, s - 5,
686 s - 4, s - 3, s - 2, s - 1,
687 s, s + 1, s + 2, s + 3,
688 s + 4, s + 5, s + 6, s + 7);
689 s += p;
690 } while (++i < count * 8);
691 }
692
693 void vp9_lpf_mbv_w_c(unsigned char *y_ptr, unsigned char *u_ptr,
694 unsigned char *v_ptr, int y_stride, int uv_stride,
695 struct loop_filter_info *lfi) {
696 vp9_mb_lpf_vertical_edge_w(y_ptr, y_stride,
697 lfi->mblim, lfi->lim, lfi->hev_thr, 2);
698
699 if (u_ptr)
700 vp9_mbloop_filter_vertical_edge_c(u_ptr, uv_stride,
701 lfi->mblim, lfi->lim, lfi->hev_thr, 1);
702
703 if (v_ptr)
704 vp9_mbloop_filter_vertical_edge_c(v_ptr, uv_stride,
705 lfi->mblim, lfi->lim, lfi->hev_thr, 1);
706 }
707 void vp9_lpf_mbh_w_c(unsigned char *y_ptr, unsigned char *u_ptr,
708 unsigned char *v_ptr, int y_stride, int uv_stride,
709 struct loop_filter_info *lfi) {
710 vp9_mb_lpf_horizontal_edge_w(y_ptr, y_stride,
711 lfi->mblim, lfi->lim, lfi->hev_thr, 2);
712
713 if (u_ptr)
714 vp9_mbloop_filter_horizontal_edge_c(u_ptr, uv_stride,
715 lfi->mblim, lfi->lim, lfi->hev_thr, 1);
716
717 if (v_ptr)
718 vp9_mbloop_filter_horizontal_edge_c(v_ptr, uv_stride,
719 lfi->mblim, lfi->lim, lfi->hev_thr, 1);
720 }
721
OLDNEW
« no previous file with comments | « source/libvpx/vp9/common/vp9_loopfilter.c ('k') | source/libvpx/vp9/common/vp9_mbpitch.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698