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

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

Issue 1169543007: libvpx: Pull from upstream (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libvpx.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « source/libvpx/vp9/common/vp9_onyxc_int.h ('k') | source/libvpx/vp9/common/vp9_rtcd_defs.pl » ('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
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 #define intra_pred_allsizes(type) \ 72 #define intra_pred_allsizes(type) \
73 intra_pred_sized(type, 4) \ 73 intra_pred_sized(type, 4) \
74 intra_pred_sized(type, 8) \ 74 intra_pred_sized(type, 8) \
75 intra_pred_sized(type, 16) \ 75 intra_pred_sized(type, 16) \
76 intra_pred_sized(type, 32) \ 76 intra_pred_sized(type, 32) \
77 intra_pred_highbd_sized(type, 4) \ 77 intra_pred_highbd_sized(type, 4) \
78 intra_pred_highbd_sized(type, 8) \ 78 intra_pred_highbd_sized(type, 8) \
79 intra_pred_highbd_sized(type, 16) \ 79 intra_pred_highbd_sized(type, 16) \
80 intra_pred_highbd_sized(type, 32) 80 intra_pred_highbd_sized(type, 32)
81 81
82 #define intra_pred_no_4x4(type) \
83 intra_pred_sized(type, 8) \
84 intra_pred_sized(type, 16) \
85 intra_pred_sized(type, 32) \
86 intra_pred_highbd_sized(type, 4) \
87 intra_pred_highbd_sized(type, 8) \
88 intra_pred_highbd_sized(type, 16) \
89 intra_pred_highbd_sized(type, 32)
90
82 #else 91 #else
83 92
84 #define intra_pred_allsizes(type) \ 93 #define intra_pred_allsizes(type) \
85 intra_pred_sized(type, 4) \ 94 intra_pred_sized(type, 4) \
86 intra_pred_sized(type, 8) \ 95 intra_pred_sized(type, 8) \
87 intra_pred_sized(type, 16) \ 96 intra_pred_sized(type, 16) \
88 intra_pred_sized(type, 32) 97 intra_pred_sized(type, 32)
98
99 #define intra_pred_no_4x4(type) \
100 intra_pred_sized(type, 8) \
101 intra_pred_sized(type, 16) \
102 intra_pred_sized(type, 32)
89 #endif // CONFIG_VP9_HIGHBITDEPTH 103 #endif // CONFIG_VP9_HIGHBITDEPTH
90 104
105 #define DST(x, y) dst[(x) + (y) * stride]
106 #define AVG3(a, b, c) (((a) + 2 * (b) + (c) + 2) >> 2)
107 #define AVG2(a, b) (((a) + (b) + 1) >> 1)
108
91 #if CONFIG_VP9_HIGHBITDEPTH 109 #if CONFIG_VP9_HIGHBITDEPTH
92 static INLINE void highbd_d207_predictor(uint16_t *dst, ptrdiff_t stride, 110 static INLINE void highbd_d207_predictor(uint16_t *dst, ptrdiff_t stride,
93 int bs, const uint16_t *above, 111 int bs, const uint16_t *above,
94 const uint16_t *left, int bd) { 112 const uint16_t *left, int bd) {
95 int r, c; 113 int r, c;
96 (void) above; 114 (void) above;
97 (void) bd; 115 (void) bd;
98 116
99 // First column. 117 // First column.
100 for (r = 0; r < bs - 1; ++r) { 118 for (r = 0; r < bs - 1; ++r) {
101 dst[r * stride] = ROUND_POWER_OF_TWO(left[r] + left[r + 1], 1); 119 dst[r * stride] = AVG2(left[r], left[r + 1]);
102 } 120 }
103 dst[(bs - 1) * stride] = left[bs - 1]; 121 dst[(bs - 1) * stride] = left[bs - 1];
104 dst++; 122 dst++;
105 123
106 // Second column. 124 // Second column.
107 for (r = 0; r < bs - 2; ++r) { 125 for (r = 0; r < bs - 2; ++r) {
108 dst[r * stride] = ROUND_POWER_OF_TWO(left[r] + left[r + 1] * 2 + 126 dst[r * stride] = AVG3(left[r], left[r + 1], left[r + 2]);
109 left[r + 2], 2);
110 } 127 }
111 dst[(bs - 2) * stride] = ROUND_POWER_OF_TWO(left[bs - 2] + 128 dst[(bs - 2) * stride] = AVG3(left[bs - 2], left[bs - 1], left[bs - 1]);
112 left[bs - 1] * 3, 2);
113 dst[(bs - 1) * stride] = left[bs - 1]; 129 dst[(bs - 1) * stride] = left[bs - 1];
114 dst++; 130 dst++;
115 131
116 // Rest of last row. 132 // Rest of last row.
117 for (c = 0; c < bs - 2; ++c) 133 for (c = 0; c < bs - 2; ++c)
118 dst[(bs - 1) * stride + c] = left[bs - 1]; 134 dst[(bs - 1) * stride + c] = left[bs - 1];
119 135
120 for (r = bs - 2; r >= 0; --r) { 136 for (r = bs - 2; r >= 0; --r) {
121 for (c = 0; c < bs - 2; ++c) 137 for (c = 0; c < bs - 2; ++c)
122 dst[r * stride + c] = dst[(r + 1) * stride + c - 2]; 138 dst[r * stride + c] = dst[(r + 1) * stride + c - 2];
123 } 139 }
124 } 140 }
125 141
126 static INLINE void highbd_d63_predictor(uint16_t *dst, ptrdiff_t stride, 142 static INLINE void highbd_d63_predictor(uint16_t *dst, ptrdiff_t stride,
127 int bs, const uint16_t *above, 143 int bs, const uint16_t *above,
128 const uint16_t *left, int bd) { 144 const uint16_t *left, int bd) {
129 int r, c; 145 int r, c;
130 (void) left; 146 (void) left;
131 (void) bd; 147 (void) bd;
132 for (r = 0; r < bs; ++r) { 148 for (r = 0; r < bs; ++r) {
133 for (c = 0; c < bs; ++c) { 149 for (c = 0; c < bs; ++c) {
134 dst[c] = r & 1 ? ROUND_POWER_OF_TWO(above[r/2 + c] + 150 dst[c] = r & 1 ? AVG3(above[(r >> 1) + c], above[(r >> 1) + c + 1],
135 above[r/2 + c + 1] * 2 + 151 above[(r >> 1) + c + 2])
136 above[r/2 + c + 2], 2) 152 : AVG2(above[(r >> 1) + c], above[(r >> 1) + c + 1]);
137 : ROUND_POWER_OF_TWO(above[r/2 + c] +
138 above[r/2 + c + 1], 1);
139 } 153 }
140 dst += stride; 154 dst += stride;
141 } 155 }
142 } 156 }
143 157
144 static INLINE void highbd_d45_predictor(uint16_t *dst, ptrdiff_t stride, int bs, 158 static INLINE void highbd_d45_predictor(uint16_t *dst, ptrdiff_t stride, int bs,
145 const uint16_t *above, 159 const uint16_t *above,
146 const uint16_t *left, int bd) { 160 const uint16_t *left, int bd) {
147 int r, c; 161 int r, c;
148 (void) left; 162 (void) left;
149 (void) bd; 163 (void) bd;
150 for (r = 0; r < bs; ++r) { 164 for (r = 0; r < bs; ++r) {
151 for (c = 0; c < bs; ++c) { 165 for (c = 0; c < bs; ++c) {
152 dst[c] = r + c + 2 < bs * 2 ? ROUND_POWER_OF_TWO(above[r + c] + 166 dst[c] = r + c + 2 < bs * 2 ? AVG3(above[r + c], above[r + c + 1],
153 above[r + c + 1] * 2 + 167 above[r + c + 2])
154 above[r + c + 2], 2)
155 : above[bs * 2 - 1]; 168 : above[bs * 2 - 1];
156 } 169 }
157 dst += stride; 170 dst += stride;
158 } 171 }
159 } 172 }
160 173
161 static INLINE void highbd_d117_predictor(uint16_t *dst, ptrdiff_t stride, 174 static INLINE void highbd_d117_predictor(uint16_t *dst, ptrdiff_t stride,
162 int bs, const uint16_t *above, 175 int bs, const uint16_t *above,
163 const uint16_t *left, int bd) { 176 const uint16_t *left, int bd) {
164 int r, c; 177 int r, c;
165 (void) bd; 178 (void) bd;
166 179
167 // first row 180 // first row
168 for (c = 0; c < bs; c++) 181 for (c = 0; c < bs; c++)
169 dst[c] = ROUND_POWER_OF_TWO(above[c - 1] + above[c], 1); 182 dst[c] = AVG2(above[c - 1], above[c]);
170 dst += stride; 183 dst += stride;
171 184
172 // second row 185 // second row
173 dst[0] = ROUND_POWER_OF_TWO(left[0] + above[-1] * 2 + above[0], 2); 186 dst[0] = AVG3(left[0], above[-1], above[0]);
174 for (c = 1; c < bs; c++) 187 for (c = 1; c < bs; c++)
175 dst[c] = ROUND_POWER_OF_TWO(above[c - 2] + above[c - 1] * 2 + above[c], 2); 188 dst[c] = AVG3(above[c - 2], above[c - 1], above[c]);
176 dst += stride; 189 dst += stride;
177 190
178 // the rest of first col 191 // the rest of first col
179 dst[0] = ROUND_POWER_OF_TWO(above[-1] + left[0] * 2 + left[1], 2); 192 dst[0] = AVG3(above[-1], left[0], left[1]);
180 for (r = 3; r < bs; ++r) 193 for (r = 3; r < bs; ++r)
181 dst[(r - 2) * stride] = ROUND_POWER_OF_TWO(left[r - 3] + left[r - 2] * 2 + 194 dst[(r - 2) * stride] = AVG3(left[r - 3], left[r - 2], left[r - 1]);
182 left[r - 1], 2);
183 195
184 // the rest of the block 196 // the rest of the block
185 for (r = 2; r < bs; ++r) { 197 for (r = 2; r < bs; ++r) {
186 for (c = 1; c < bs; c++) 198 for (c = 1; c < bs; c++)
187 dst[c] = dst[-2 * stride + c - 1]; 199 dst[c] = dst[-2 * stride + c - 1];
188 dst += stride; 200 dst += stride;
189 } 201 }
190 } 202 }
191 203
192 static INLINE void highbd_d135_predictor(uint16_t *dst, ptrdiff_t stride, 204 static INLINE void highbd_d135_predictor(uint16_t *dst, ptrdiff_t stride,
193 int bs, const uint16_t *above, 205 int bs, const uint16_t *above,
194 const uint16_t *left, int bd) { 206 const uint16_t *left, int bd) {
195 int r, c; 207 int r, c;
196 (void) bd; 208 (void) bd;
197 dst[0] = ROUND_POWER_OF_TWO(left[0] + above[-1] * 2 + above[0], 2); 209 dst[0] = AVG3(left[0], above[-1], above[0]);
198 for (c = 1; c < bs; c++) 210 for (c = 1; c < bs; c++)
199 dst[c] = ROUND_POWER_OF_TWO(above[c - 2] + above[c - 1] * 2 + above[c], 2); 211 dst[c] = AVG3(above[c - 2], above[c - 1], above[c]);
200 212
201 dst[stride] = ROUND_POWER_OF_TWO(above[-1] + left[0] * 2 + left[1], 2); 213 dst[stride] = AVG3(above[-1], left[0], left[1]);
202 for (r = 2; r < bs; ++r) 214 for (r = 2; r < bs; ++r)
203 dst[r * stride] = ROUND_POWER_OF_TWO(left[r - 2] + left[r - 1] * 2 + 215 dst[r * stride] = AVG3(left[r - 2], left[r - 1], left[r]);
204 left[r], 2);
205 216
206 dst += stride; 217 dst += stride;
207 for (r = 1; r < bs; ++r) { 218 for (r = 1; r < bs; ++r) {
208 for (c = 1; c < bs; c++) 219 for (c = 1; c < bs; c++)
209 dst[c] = dst[-stride + c - 1]; 220 dst[c] = dst[-stride + c - 1];
210 dst += stride; 221 dst += stride;
211 } 222 }
212 } 223 }
213 224
214 static INLINE void highbd_d153_predictor(uint16_t *dst, ptrdiff_t stride, 225 static INLINE void highbd_d153_predictor(uint16_t *dst, ptrdiff_t stride,
215 int bs, const uint16_t *above, 226 int bs, const uint16_t *above,
216 const uint16_t *left, int bd) { 227 const uint16_t *left, int bd) {
217 int r, c; 228 int r, c;
218 (void) bd; 229 (void) bd;
219 dst[0] = ROUND_POWER_OF_TWO(above[-1] + left[0], 1); 230 dst[0] = AVG2(above[-1], left[0]);
220 for (r = 1; r < bs; r++) 231 for (r = 1; r < bs; r++)
221 dst[r * stride] = ROUND_POWER_OF_TWO(left[r - 1] + left[r], 1); 232 dst[r * stride] = AVG2(left[r - 1], left[r]);
222 dst++; 233 dst++;
223 234
224 dst[0] = ROUND_POWER_OF_TWO(left[0] + above[-1] * 2 + above[0], 2); 235 dst[0] = AVG3(left[0], above[-1], above[0]);
225 dst[stride] = ROUND_POWER_OF_TWO(above[-1] + left[0] * 2 + left[1], 2); 236 dst[stride] = AVG3(above[-1], left[0], left[1]);
226 for (r = 2; r < bs; r++) 237 for (r = 2; r < bs; r++)
227 dst[r * stride] = ROUND_POWER_OF_TWO(left[r - 2] + left[r - 1] * 2 + 238 dst[r * stride] = AVG3(left[r - 2], left[r - 1], left[r]);
228 left[r], 2);
229 dst++; 239 dst++;
230 240
231 for (c = 0; c < bs - 2; c++) 241 for (c = 0; c < bs - 2; c++)
232 dst[c] = ROUND_POWER_OF_TWO(above[c - 1] + above[c] * 2 + above[c + 1], 2); 242 dst[c] = AVG3(above[c - 1], above[c], above[c + 1]);
233 dst += stride; 243 dst += stride;
234 244
235 for (r = 1; r < bs; ++r) { 245 for (r = 1; r < bs; ++r) {
236 for (c = 0; c < bs - 2; c++) 246 for (c = 0; c < bs - 2; c++)
237 dst[c] = dst[-stride + c - 2]; 247 dst[c] = dst[-stride + c - 2];
238 dst += stride; 248 dst += stride;
239 } 249 }
240 } 250 }
241 251
242 static INLINE void highbd_v_predictor(uint16_t *dst, ptrdiff_t stride, 252 static INLINE void highbd_v_predictor(uint16_t *dst, ptrdiff_t stride,
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 348
339 expected_dc = (sum + (count >> 1)) / count; 349 expected_dc = (sum + (count >> 1)) / count;
340 350
341 for (r = 0; r < bs; r++) { 351 for (r = 0; r < bs; r++) {
342 vpx_memset16(dst, expected_dc, bs); 352 vpx_memset16(dst, expected_dc, bs);
343 dst += stride; 353 dst += stride;
344 } 354 }
345 } 355 }
346 #endif // CONFIG_VP9_HIGHBITDEPTH 356 #endif // CONFIG_VP9_HIGHBITDEPTH
347 357
358 void vp9_d207_predictor_4x4_c(uint8_t *dst, ptrdiff_t stride,
359 const uint8_t *above, const uint8_t *left) {
360 const int I = left[0];
361 const int J = left[1];
362 const int K = left[2];
363 const int L = left[3];
364 (void)above;
365 DST(0, 0) = AVG2(I, J);
366 DST(2, 0) = DST(0, 1) = AVG2(J, K);
367 DST(2, 1) = DST(0, 2) = AVG2(K, L);
368 DST(1, 0) = AVG3(I, J, K);
369 DST(3, 0) = DST(1, 1) = AVG3(J, K, L);
370 DST(3, 1) = DST(1, 2) = AVG3(K, L, L);
371 DST(3, 2) = DST(2, 2) =
372 DST(0, 3) = DST(1, 3) = DST(2, 3) = DST(3, 3) = L;
373 }
374
348 static INLINE void d207_predictor(uint8_t *dst, ptrdiff_t stride, int bs, 375 static INLINE void d207_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
349 const uint8_t *above, const uint8_t *left) { 376 const uint8_t *above, const uint8_t *left) {
350 int r, c; 377 int r, c;
351 (void) above; 378 (void) above;
352 // first column 379 // first column
353 for (r = 0; r < bs - 1; ++r) 380 for (r = 0; r < bs - 1; ++r)
354 dst[r * stride] = ROUND_POWER_OF_TWO(left[r] + left[r + 1], 1); 381 dst[r * stride] = AVG2(left[r], left[r + 1]);
355 dst[(bs - 1) * stride] = left[bs - 1]; 382 dst[(bs - 1) * stride] = left[bs - 1];
356 dst++; 383 dst++;
357 384
358 // second column 385 // second column
359 for (r = 0; r < bs - 2; ++r) 386 for (r = 0; r < bs - 2; ++r)
360 dst[r * stride] = ROUND_POWER_OF_TWO(left[r] + left[r + 1] * 2 + 387 dst[r * stride] = AVG3(left[r], left[r + 1], left[r + 2]);
361 left[r + 2], 2); 388 dst[(bs - 2) * stride] = AVG3(left[bs - 2], left[bs - 1], left[bs - 1]);
362 dst[(bs - 2) * stride] = ROUND_POWER_OF_TWO(left[bs - 2] +
363 left[bs - 1] * 3, 2);
364 dst[(bs - 1) * stride] = left[bs - 1]; 389 dst[(bs - 1) * stride] = left[bs - 1];
365 dst++; 390 dst++;
366 391
367 // rest of last row 392 // rest of last row
368 for (c = 0; c < bs - 2; ++c) 393 for (c = 0; c < bs - 2; ++c)
369 dst[(bs - 1) * stride + c] = left[bs - 1]; 394 dst[(bs - 1) * stride + c] = left[bs - 1];
370 395
371 for (r = bs - 2; r >= 0; --r) 396 for (r = bs - 2; r >= 0; --r)
372 for (c = 0; c < bs - 2; ++c) 397 for (c = 0; c < bs - 2; ++c)
373 dst[r * stride + c] = dst[(r + 1) * stride + c - 2]; 398 dst[r * stride + c] = dst[(r + 1) * stride + c - 2];
374 } 399 }
375 intra_pred_allsizes(d207) 400 intra_pred_no_4x4(d207)
401
402 void vp9_d63_predictor_4x4_c(uint8_t *dst, ptrdiff_t stride,
403 const uint8_t *above, const uint8_t *left) {
404 const int A = above[0];
405 const int B = above[1];
406 const int C = above[2];
407 const int D = above[3];
408 const int E = above[4];
409 const int F = above[5];
410 const int G = above[6];
411 (void)left;
412 DST(0, 0) = AVG2(A, B);
413 DST(1, 0) = DST(0, 2) = AVG2(B, C);
414 DST(2, 0) = DST(1, 2) = AVG2(C, D);
415 DST(3, 0) = DST(2, 2) = AVG2(D, E);
416 DST(3, 2) = AVG2(E, F); // differs from vp8
417
418 DST(0, 1) = AVG3(A, B, C);
419 DST(1, 1) = DST(0, 3) = AVG3(B, C, D);
420 DST(2, 1) = DST(1, 3) = AVG3(C, D, E);
421 DST(3, 1) = DST(2, 3) = AVG3(D, E, F);
422 DST(3, 3) = AVG3(E, F, G); // differs from vp8
423 }
376 424
377 static INLINE void d63_predictor(uint8_t *dst, ptrdiff_t stride, int bs, 425 static INLINE void d63_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
378 const uint8_t *above, const uint8_t *left) { 426 const uint8_t *above, const uint8_t *left) {
379 int r, c; 427 int r, c;
380 (void) left; 428 int size;
381 for (r = 0; r < bs; ++r) { 429 (void)left;
382 for (c = 0; c < bs; ++c) 430 for (c = 0; c < bs; ++c) {
383 dst[c] = r & 1 ? ROUND_POWER_OF_TWO(above[r/2 + c] + 431 dst[c] = AVG2(above[c], above[c + 1]);
384 above[r/2 + c + 1] * 2 + 432 dst[stride + c] = AVG3(above[c], above[c + 1], above[c + 2]);
385 above[r/2 + c + 2], 2) 433 }
386 : ROUND_POWER_OF_TWO(above[r/2 + c] + 434 for (r = 2, size = bs - 2; r < bs; r += 2, --size) {
387 above[r/2 + c + 1], 1); 435 memcpy(dst + (r + 0) * stride, dst + (r >> 1), size);
436 memset(dst + (r + 0) * stride + size, above[bs - 1], bs - size);
437 memcpy(dst + (r + 1) * stride, dst + stride + (r >> 1), size);
438 memset(dst + (r + 1) * stride + size, above[bs - 1], bs - size);
439 }
440 }
441 intra_pred_no_4x4(d63)
442
443 void vp9_d45_predictor_4x4_c(uint8_t *dst, ptrdiff_t stride,
444 const uint8_t *above, const uint8_t *left) {
445 const int A = above[0];
446 const int B = above[1];
447 const int C = above[2];
448 const int D = above[3];
449 const int E = above[4];
450 const int F = above[5];
451 const int G = above[6];
452 const int H = above[7];
453 (void)stride;
454 (void)left;
455 DST(0, 0) = AVG3(A, B, C);
456 DST(1, 0) = DST(0, 1) = AVG3(B, C, D);
457 DST(2, 0) = DST(1, 1) = DST(0, 2) = AVG3(C, D, E);
458 DST(3, 0) = DST(2, 1) = DST(1, 2) = DST(0, 3) = AVG3(D, E, F);
459 DST(3, 1) = DST(2, 2) = DST(1, 3) = AVG3(E, F, G);
460 DST(3, 2) = DST(2, 3) = AVG3(F, G, H);
461 DST(3, 3) = H; // differs from vp8
462 }
463
464 static INLINE void d45_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
465 const uint8_t *above, const uint8_t *left) {
466 const uint8_t above_right = above[bs - 1];
467 int x, size;
468 uint8_t avg[31]; // TODO(jzern): this could be block size specific
469 (void)left;
470
471 for (x = 0; x < bs - 1; ++x) {
472 avg[x] = AVG3(above[x], above[x + 1], above[x + 2]);
473 }
474 for (x = 0, size = bs - 1; x < bs; ++x, --size) {
475 memcpy(dst, avg + x, size);
476 memset(dst + size, above_right, x + 1);
388 dst += stride; 477 dst += stride;
389 } 478 }
390 } 479 }
391 intra_pred_allsizes(d63) 480 intra_pred_no_4x4(d45)
392 481
393 static INLINE void d45_predictor(uint8_t *dst, ptrdiff_t stride, int bs, 482 void vp9_d117_predictor_4x4_c(uint8_t *dst, ptrdiff_t stride,
394 const uint8_t *above, const uint8_t *left) { 483 const uint8_t *above, const uint8_t *left) {
395 int r, c; 484 const int I = left[0];
396 (void) left; 485 const int J = left[1];
397 for (r = 0; r < bs; ++r) { 486 const int K = left[2];
398 for (c = 0; c < bs; ++c) 487 const int X = above[-1];
399 dst[c] = r + c + 2 < bs * 2 ? ROUND_POWER_OF_TWO(above[r + c] + 488 const int A = above[0];
400 above[r + c + 1] * 2 + 489 const int B = above[1];
401 above[r + c + 2], 2) 490 const int C = above[2];
402 : above[bs * 2 - 1]; 491 const int D = above[3];
403 dst += stride; 492 DST(0, 0) = DST(1, 2) = AVG2(X, A);
404 } 493 DST(1, 0) = DST(2, 2) = AVG2(A, B);
494 DST(2, 0) = DST(3, 2) = AVG2(B, C);
495 DST(3, 0) = AVG2(C, D);
496
497 DST(0, 3) = AVG3(K, J, I);
498 DST(0, 2) = AVG3(J, I, X);
499 DST(0, 1) = DST(1, 3) = AVG3(I, X, A);
500 DST(1, 1) = DST(2, 3) = AVG3(X, A, B);
501 DST(2, 1) = DST(3, 3) = AVG3(A, B, C);
502 DST(3, 1) = AVG3(B, C, D);
405 } 503 }
406 intra_pred_allsizes(d45)
407 504
408 static INLINE void d117_predictor(uint8_t *dst, ptrdiff_t stride, int bs, 505 static INLINE void d117_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
409 const uint8_t *above, const uint8_t *left) { 506 const uint8_t *above, const uint8_t *left) {
410 int r, c; 507 int r, c;
411 508
412 // first row 509 // first row
413 for (c = 0; c < bs; c++) 510 for (c = 0; c < bs; c++)
414 dst[c] = ROUND_POWER_OF_TWO(above[c - 1] + above[c], 1); 511 dst[c] = AVG2(above[c - 1], above[c]);
415 dst += stride; 512 dst += stride;
416 513
417 // second row 514 // second row
418 dst[0] = ROUND_POWER_OF_TWO(left[0] + above[-1] * 2 + above[0], 2); 515 dst[0] = AVG3(left[0], above[-1], above[0]);
419 for (c = 1; c < bs; c++) 516 for (c = 1; c < bs; c++)
420 dst[c] = ROUND_POWER_OF_TWO(above[c - 2] + above[c - 1] * 2 + above[c], 2); 517 dst[c] = AVG3(above[c - 2], above[c - 1], above[c]);
421 dst += stride; 518 dst += stride;
422 519
423 // the rest of first col 520 // the rest of first col
424 dst[0] = ROUND_POWER_OF_TWO(above[-1] + left[0] * 2 + left[1], 2); 521 dst[0] = AVG3(above[-1], left[0], left[1]);
425 for (r = 3; r < bs; ++r) 522 for (r = 3; r < bs; ++r)
426 dst[(r - 2) * stride] = ROUND_POWER_OF_TWO(left[r - 3] + left[r - 2] * 2 + 523 dst[(r - 2) * stride] = AVG3(left[r - 3], left[r - 2], left[r - 1]);
427 left[r - 1], 2);
428 524
429 // the rest of the block 525 // the rest of the block
430 for (r = 2; r < bs; ++r) { 526 for (r = 2; r < bs; ++r) {
431 for (c = 1; c < bs; c++) 527 for (c = 1; c < bs; c++)
432 dst[c] = dst[-2 * stride + c - 1]; 528 dst[c] = dst[-2 * stride + c - 1];
433 dst += stride; 529 dst += stride;
434 } 530 }
435 } 531 }
436 intra_pred_allsizes(d117) 532 intra_pred_no_4x4(d117)
533
534 void vp9_d135_predictor_4x4(uint8_t *dst, ptrdiff_t stride,
535 const uint8_t *above, const uint8_t *left) {
536 const int I = left[0];
537 const int J = left[1];
538 const int K = left[2];
539 const int L = left[3];
540 const int X = above[-1];
541 const int A = above[0];
542 const int B = above[1];
543 const int C = above[2];
544 const int D = above[3];
545 (void)stride;
546 DST(0, 3) = AVG3(J, K, L);
547 DST(1, 3) = DST(0, 2) = AVG3(I, J, K);
548 DST(2, 3) = DST(1, 2) = DST(0, 1) = AVG3(X, I, J);
549 DST(3, 3) = DST(2, 2) = DST(1, 1) = DST(0, 0) = AVG3(A, X, I);
550 DST(3, 2) = DST(2, 1) = DST(1, 0) = AVG3(B, A, X);
551 DST(3, 1) = DST(2, 0) = AVG3(C, B, A);
552 DST(3, 0) = AVG3(D, C, B);
553 }
437 554
438 static INLINE void d135_predictor(uint8_t *dst, ptrdiff_t stride, int bs, 555 static INLINE void d135_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
439 const uint8_t *above, const uint8_t *left) { 556 const uint8_t *above, const uint8_t *left) {
440 int r, c; 557 int r, c;
441 dst[0] = ROUND_POWER_OF_TWO(left[0] + above[-1] * 2 + above[0], 2); 558 dst[0] = AVG3(left[0], above[-1], above[0]);
442 for (c = 1; c < bs; c++) 559 for (c = 1; c < bs; c++)
443 dst[c] = ROUND_POWER_OF_TWO(above[c - 2] + above[c - 1] * 2 + above[c], 2); 560 dst[c] = AVG3(above[c - 2], above[c - 1], above[c]);
444 561
445 dst[stride] = ROUND_POWER_OF_TWO(above[-1] + left[0] * 2 + left[1], 2); 562 dst[stride] = AVG3(above[-1], left[0], left[1]);
446 for (r = 2; r < bs; ++r) 563 for (r = 2; r < bs; ++r)
447 dst[r * stride] = ROUND_POWER_OF_TWO(left[r - 2] + left[r - 1] * 2 + 564 dst[r * stride] = AVG3(left[r - 2], left[r - 1], left[r]);
448 left[r], 2);
449 565
450 dst += stride; 566 dst += stride;
451 for (r = 1; r < bs; ++r) { 567 for (r = 1; r < bs; ++r) {
452 for (c = 1; c < bs; c++) 568 for (c = 1; c < bs; c++)
453 dst[c] = dst[-stride + c - 1]; 569 dst[c] = dst[-stride + c - 1];
454 dst += stride; 570 dst += stride;
455 } 571 }
456 } 572 }
457 intra_pred_allsizes(d135) 573 intra_pred_no_4x4(d135)
574
575 void vp9_d153_predictor_4x4_c(uint8_t *dst, ptrdiff_t stride,
576 const uint8_t *above, const uint8_t *left) {
577 const int I = left[0];
578 const int J = left[1];
579 const int K = left[2];
580 const int L = left[3];
581 const int X = above[-1];
582 const int A = above[0];
583 const int B = above[1];
584 const int C = above[2];
585
586 DST(0, 0) = DST(2, 1) = AVG2(I, X);
587 DST(0, 1) = DST(2, 2) = AVG2(J, I);
588 DST(0, 2) = DST(2, 3) = AVG2(K, J);
589 DST(0, 3) = AVG2(L, K);
590
591 DST(3, 0) = AVG3(A, B, C);
592 DST(2, 0) = AVG3(X, A, B);
593 DST(1, 0) = DST(3, 1) = AVG3(I, X, A);
594 DST(1, 1) = DST(3, 2) = AVG3(J, I, X);
595 DST(1, 2) = DST(3, 3) = AVG3(K, J, I);
596 DST(1, 3) = AVG3(L, K, J);
597 }
458 598
459 static INLINE void d153_predictor(uint8_t *dst, ptrdiff_t stride, int bs, 599 static INLINE void d153_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
460 const uint8_t *above, const uint8_t *left) { 600 const uint8_t *above, const uint8_t *left) {
461 int r, c; 601 int r, c;
462 dst[0] = ROUND_POWER_OF_TWO(above[-1] + left[0], 1); 602 dst[0] = AVG2(above[-1], left[0]);
463 for (r = 1; r < bs; r++) 603 for (r = 1; r < bs; r++)
464 dst[r * stride] = ROUND_POWER_OF_TWO(left[r - 1] + left[r], 1); 604 dst[r * stride] = AVG2(left[r - 1], left[r]);
465 dst++; 605 dst++;
466 606
467 dst[0] = ROUND_POWER_OF_TWO(left[0] + above[-1] * 2 + above[0], 2); 607 dst[0] = AVG3(left[0], above[-1], above[0]);
468 dst[stride] = ROUND_POWER_OF_TWO(above[-1] + left[0] * 2 + left[1], 2); 608 dst[stride] = AVG3(above[-1], left[0], left[1]);
469 for (r = 2; r < bs; r++) 609 for (r = 2; r < bs; r++)
470 dst[r * stride] = ROUND_POWER_OF_TWO(left[r - 2] + left[r - 1] * 2 + 610 dst[r * stride] = AVG3(left[r - 2], left[r - 1], left[r]);
471 left[r], 2);
472 dst++; 611 dst++;
473 612
474 for (c = 0; c < bs - 2; c++) 613 for (c = 0; c < bs - 2; c++)
475 dst[c] = ROUND_POWER_OF_TWO(above[c - 1] + above[c] * 2 + above[c + 1], 2); 614 dst[c] = AVG3(above[c - 1], above[c], above[c + 1]);
476 dst += stride; 615 dst += stride;
477 616
478 for (r = 1; r < bs; ++r) { 617 for (r = 1; r < bs; ++r) {
479 for (c = 0; c < bs - 2; c++) 618 for (c = 0; c < bs - 2; c++)
480 dst[c] = dst[-stride + c - 2]; 619 dst[c] = dst[-stride + c - 2];
481 dst += stride; 620 dst += stride;
482 } 621 }
483 } 622 }
484 intra_pred_allsizes(d153) 623 intra_pred_no_4x4(d153)
485 624
486 static INLINE void v_predictor(uint8_t *dst, ptrdiff_t stride, int bs, 625 static INLINE void v_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
487 const uint8_t *above, const uint8_t *left) { 626 const uint8_t *above, const uint8_t *left) {
488 int r; 627 int r;
489 (void) left; 628 (void) left;
490 629
491 for (r = 0; r < bs; r++) { 630 for (r = 0; r < bs; r++) {
492 memcpy(dst, above, bs); 631 memcpy(dst, above, bs);
493 dst += stride; 632 dst += stride;
494 } 633 }
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 return; 1079 return;
941 } 1080 }
942 #endif 1081 #endif
943 build_intra_predictors(xd, ref, ref_stride, dst, dst_stride, mode, tx_size, 1082 build_intra_predictors(xd, ref, ref_stride, dst, dst_stride, mode, tx_size,
944 have_top, have_left, have_right, x, y, plane); 1083 have_top, have_left, have_right, x, y, plane);
945 } 1084 }
946 1085
947 void vp9_init_intra_predictors(void) { 1086 void vp9_init_intra_predictors(void) {
948 once(vp9_init_intra_predictors_internal); 1087 once(vp9_init_intra_predictors_internal);
949 } 1088 }
OLDNEW
« no previous file with comments | « source/libvpx/vp9/common/vp9_onyxc_int.h ('k') | source/libvpx/vp9/common/vp9_rtcd_defs.pl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698