blob: 370d0374b0efb61b4e53db51680f25b8766738b4 [file] [log] [blame]
Yaowu Xuc27fc142016-08-22 16:08:15 -07001/*
Yaowu Xu9c01aa12016-09-01 14:32:49 -07002 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
Yaowu Xuc27fc142016-08-22 16:08:15 -07003 *
Yaowu Xu9c01aa12016-09-01 14:32:49 -07004 * This source code is subject to the terms of the BSD 2 Clause License and
5 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6 * was not distributed with this source code in the LICENSE file, you can
7 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8 * Media Patent License 1.0 was not distributed with this source code in the
9 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
Yaowu Xuc27fc142016-08-22 16:08:15 -070010 */
11
Urvang Joshi7a406002017-01-31 14:52:18 -080012#include <assert.h>
Urvang Joshi6be4a542016-11-03 15:24:05 -070013#include <math.h>
14
Yaowu Xuf883b422016-08-30 14:01:10 -070015#include "./aom_config.h"
16#include "./aom_dsp_rtcd.h"
Yaowu Xuc27fc142016-08-22 16:08:15 -070017
Yaowu Xuf883b422016-08-30 14:01:10 -070018#include "aom_dsp/aom_dsp_common.h"
19#include "aom_mem/aom_mem.h"
Urvang Joshiee7ee7f2017-03-09 13:19:03 -080020#include "aom_ports/bitops.h"
Yaowu Xuc27fc142016-08-22 16:08:15 -070021
22#define DST(x, y) dst[(x) + (y)*stride]
23#define AVG3(a, b, c) (((a) + 2 * (b) + (c) + 2) >> 2)
24#define AVG2(a, b) (((a) + (b) + 1) >> 1)
25
Yaowu Xuc27fc142016-08-22 16:08:15 -070026static INLINE void d207e_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
27 const uint8_t *above, const uint8_t *left) {
28 int r, c;
29 (void)above;
30
31 for (r = 0; r < bs; ++r) {
32 for (c = 0; c < bs; ++c) {
33 dst[c] = c & 1 ? AVG3(left[(c >> 1) + r], left[(c >> 1) + r + 1],
34 left[(c >> 1) + r + 2])
35 : AVG2(left[(c >> 1) + r], left[(c >> 1) + r + 1]);
36 }
37 dst += stride;
38 }
39}
40
Yaowu Xuc27fc142016-08-22 16:08:15 -070041static INLINE void d63e_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
42 const uint8_t *above, const uint8_t *left) {
43 int r, c;
44 (void)left;
45 for (r = 0; r < bs; ++r) {
46 for (c = 0; c < bs; ++c) {
47 dst[c] = r & 1 ? AVG3(above[(r >> 1) + c], above[(r >> 1) + c + 1],
48 above[(r >> 1) + c + 2])
49 : AVG2(above[(r >> 1) + c], above[(r >> 1) + c + 1]);
50 }
51 dst += stride;
52 }
53}
54
Yaowu Xuc27fc142016-08-22 16:08:15 -070055static INLINE void d45e_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
56 const uint8_t *above, const uint8_t *left) {
57 int r, c;
58 (void)left;
59 for (r = 0; r < bs; ++r) {
60 for (c = 0; c < bs; ++c) {
61 dst[c] = AVG3(above[r + c], above[r + c + 1],
62 above[r + c + 1 + (r + c + 2 < bs * 2)]);
63 }
64 dst += stride;
65 }
66}
67
68static INLINE void d117_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
69 const uint8_t *above, const uint8_t *left) {
70 int r, c;
71
72 // first row
73 for (c = 0; c < bs; c++) dst[c] = AVG2(above[c - 1], above[c]);
74 dst += stride;
75
76 // second row
77 dst[0] = AVG3(left[0], above[-1], above[0]);
78 for (c = 1; c < bs; c++) dst[c] = AVG3(above[c - 2], above[c - 1], above[c]);
79 dst += stride;
80
81 // the rest of first col
82 dst[0] = AVG3(above[-1], left[0], left[1]);
83 for (r = 3; r < bs; ++r)
84 dst[(r - 2) * stride] = AVG3(left[r - 3], left[r - 2], left[r - 1]);
85
86 // the rest of the block
87 for (r = 2; r < bs; ++r) {
88 for (c = 1; c < bs; c++) dst[c] = dst[-2 * stride + c - 1];
89 dst += stride;
90 }
91}
92
93static INLINE void d135_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
94 const uint8_t *above, const uint8_t *left) {
95 int i;
Debargha Mukherjee84c56af2016-11-19 10:59:37 -080096#if CONFIG_TX64X64
97#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ > 7
98 // silence a spurious -Warray-bounds warning, possibly related to:
99 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56273
100 uint8_t border[133];
101#else
102 uint8_t border[64 + 64 - 1]; // outer border from bottom-left to top-right
103#endif
104#else
Yaowu Xuc27fc142016-08-22 16:08:15 -0700105#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ > 7
106 // silence a spurious -Warray-bounds warning, possibly related to:
107 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56273
108 uint8_t border[69];
109#else
110 uint8_t border[32 + 32 - 1]; // outer border from bottom-left to top-right
111#endif
Debargha Mukherjee84c56af2016-11-19 10:59:37 -0800112#endif // CONFIG_TX64X64
Yaowu Xuc27fc142016-08-22 16:08:15 -0700113
114 // dst(bs, bs - 2)[0], i.e., border starting at bottom-left
115 for (i = 0; i < bs - 2; ++i) {
116 border[i] = AVG3(left[bs - 3 - i], left[bs - 2 - i], left[bs - 1 - i]);
117 }
118 border[bs - 2] = AVG3(above[-1], left[0], left[1]);
119 border[bs - 1] = AVG3(left[0], above[-1], above[0]);
120 border[bs - 0] = AVG3(above[-1], above[0], above[1]);
121 // dst[0][2, size), i.e., remaining top border ascending
122 for (i = 0; i < bs - 2; ++i) {
123 border[bs + 1 + i] = AVG3(above[i], above[i + 1], above[i + 2]);
124 }
125
126 for (i = 0; i < bs; ++i) {
127 memcpy(dst + i * stride, border + bs - 1 - i, bs);
128 }
129}
130
131static INLINE void d153_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
132 const uint8_t *above, const uint8_t *left) {
133 int r, c;
134 dst[0] = AVG2(above[-1], left[0]);
135 for (r = 1; r < bs; r++) dst[r * stride] = AVG2(left[r - 1], left[r]);
136 dst++;
137
138 dst[0] = AVG3(left[0], above[-1], above[0]);
139 dst[stride] = AVG3(above[-1], left[0], left[1]);
140 for (r = 2; r < bs; r++)
141 dst[r * stride] = AVG3(left[r - 2], left[r - 1], left[r]);
142 dst++;
143
144 for (c = 0; c < bs - 2; c++)
145 dst[c] = AVG3(above[c - 1], above[c], above[c + 1]);
146 dst += stride;
147
148 for (r = 1; r < bs; ++r) {
149 for (c = 0; c < bs - 2; c++) dst[c] = dst[-stride + c - 2];
150 dst += stride;
151 }
152}
153
154static INLINE void v_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
155 const uint8_t *above, const uint8_t *left) {
156 int r;
157 (void)left;
158
159 for (r = 0; r < bs; r++) {
160 memcpy(dst, above, bs);
161 dst += stride;
162 }
163}
164
165static INLINE void h_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
166 const uint8_t *above, const uint8_t *left) {
167 int r;
168 (void)above;
169
170 for (r = 0; r < bs; r++) {
171 memset(dst, left[r], bs);
172 dst += stride;
173 }
174}
175
Urvang Joshi340593e2016-09-01 12:03:20 -0700176#if CONFIG_ALT_INTRA
177static INLINE int abs_diff(int a, int b) { return (a > b) ? a - b : b - a; }
178
179static INLINE uint16_t paeth_predictor_single(uint16_t left, uint16_t top,
180 uint16_t top_left) {
181 const int base = top + left - top_left;
182 const int p_left = abs_diff(base, left);
183 const int p_top = abs_diff(base, top);
184 const int p_top_left = abs_diff(base, top_left);
185
186 // Return nearest to base of left, top and top_left.
187 return (p_left <= p_top && p_left <= p_top_left)
188 ? left
189 : (p_top <= p_top_left) ? top : top_left;
190}
191
192static INLINE void paeth_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
193 const uint8_t *above, const uint8_t *left) {
194 int r, c;
195 const uint8_t ytop_left = above[-1];
196
197 for (r = 0; r < bs; r++) {
198 for (c = 0; c < bs; c++)
199 dst[c] = (uint8_t)paeth_predictor_single(left[r], above[c], ytop_left);
200 dst += stride;
201 }
202}
203
Urvang Joshi3e42acd2017-02-23 13:02:08 -0800204// Weights are quadratic from '1' to '1 / block_size', scaled by
205// 2^sm_weight_log2_scale.
206static const int sm_weight_log2_scale = 8;
Urvang Joshi7a406002017-01-31 14:52:18 -0800207
Urvang Joshi6be4a542016-11-03 15:24:05 -0700208#if CONFIG_TX64X64
Urvang Joshiee7ee7f2017-03-09 13:19:03 -0800209// max(block_size_wide[BLOCK_LARGEST], block_size_high[BLOCK_LARGEST])
210#define MAX_BLOCK_DIM 64
Urvang Joshi6be4a542016-11-03 15:24:05 -0700211#else
Urvang Joshiee7ee7f2017-03-09 13:19:03 -0800212#define MAX_BLOCK_DIM 32
Urvang Joshi6be4a542016-11-03 15:24:05 -0700213#endif // CONFIG_TX64X64
Urvang Joshiee7ee7f2017-03-09 13:19:03 -0800214
Urvang Joshif695d652017-05-10 11:21:45 -0700215static const uint8_t sm_weight_arrays[2 * MAX_BLOCK_DIM] = {
216 // Unused, because we always offset by bs, which is at least 2.
217 0, 0,
Urvang Joshi6be4a542016-11-03 15:24:05 -0700218 // bs = 2
Urvang Joshif695d652017-05-10 11:21:45 -0700219 255, 128,
Urvang Joshi6be4a542016-11-03 15:24:05 -0700220 // bs = 4
Urvang Joshif695d652017-05-10 11:21:45 -0700221 255, 149, 85, 64,
Urvang Joshi6be4a542016-11-03 15:24:05 -0700222 // bs = 8
Urvang Joshif695d652017-05-10 11:21:45 -0700223 255, 197, 146, 105, 73, 50, 37, 32,
Urvang Joshi6be4a542016-11-03 15:24:05 -0700224 // bs = 16
Urvang Joshif695d652017-05-10 11:21:45 -0700225 255, 225, 196, 170, 145, 123, 102, 84, 68, 54, 43, 33, 26, 20, 17, 16,
Urvang Joshi6be4a542016-11-03 15:24:05 -0700226 // bs = 32
Urvang Joshif695d652017-05-10 11:21:45 -0700227 255, 240, 225, 210, 196, 182, 169, 157, 145, 133, 122, 111, 101, 92, 83, 74,
228 66, 59, 52, 45, 39, 34, 29, 25, 21, 17, 14, 12, 10, 9, 8, 8,
Urvang Joshi6be4a542016-11-03 15:24:05 -0700229#if CONFIG_TX64X64
230 // bs = 64
Urvang Joshif695d652017-05-10 11:21:45 -0700231 255, 248, 240, 233, 225, 218, 210, 203, 196, 189, 182, 176, 169, 163, 156,
232 150, 144, 138, 133, 127, 121, 116, 111, 106, 101, 96, 91, 86, 82, 77, 73, 69,
233 65, 61, 57, 54, 50, 47, 44, 41, 38, 35, 32, 29, 27, 25, 22, 20, 18, 16, 15,
234 13, 12, 10, 9, 8, 7, 6, 6, 5, 5, 4, 4, 4,
Urvang Joshi6be4a542016-11-03 15:24:05 -0700235#endif // CONFIG_TX64X64
236};
237
Urvang Joshi4d5bbbd2017-03-02 17:10:44 -0800238// Some basic checks on weights for smooth predictor.
239#define sm_weights_sanity_checks(weights, weights_scale, pred_scale) \
240 assert(weights[0] < weights_scale); \
241 assert(weights_scale - weights[bs - 1] < weights_scale); \
242 assert(pred_scale < 31) // ensures no overflow when calculating predictor.
243
Urvang Joshi7a406002017-01-31 14:52:18 -0800244#define divide_round(value, bits) (((value) + (1 << ((bits)-1))) >> (bits))
245
Urvang Joshi6be4a542016-11-03 15:24:05 -0700246static INLINE void smooth_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
247 const uint8_t *above, const uint8_t *left) {
248 const uint8_t below_pred = left[bs - 1]; // estimated by bottom-left pixel
249 const uint8_t right_pred = above[bs - 1]; // estimated by top-right pixel
Urvang Joshif695d652017-05-10 11:21:45 -0700250 const uint8_t *const sm_weights = sm_weight_arrays + bs;
Urvang Joshi81760812017-02-15 16:47:59 -0800251 // scale = 2 * 2^sm_weight_log2_scale
252 const int log2_scale = 1 + sm_weight_log2_scale;
Urvang Joshi4d5bbbd2017-03-02 17:10:44 -0800253 const uint16_t scale = (1 << sm_weight_log2_scale);
254 sm_weights_sanity_checks(sm_weights, scale, log2_scale + sizeof(*dst));
Urvang Joshi6be4a542016-11-03 15:24:05 -0700255 int r;
256 for (r = 0; r < bs; ++r) {
257 int c;
258 for (c = 0; c < bs; ++c) {
Urvang Joshi7a406002017-01-31 14:52:18 -0800259 const uint8_t pixels[] = { above[c], below_pred, left[r], right_pred };
Urvang Joshi4d5bbbd2017-03-02 17:10:44 -0800260 const uint8_t weights[] = { sm_weights[r], scale - sm_weights[r],
261 sm_weights[c], scale - sm_weights[c] };
Urvang Joshi7a406002017-01-31 14:52:18 -0800262 uint32_t this_pred = 0;
Urvang Joshi6be4a542016-11-03 15:24:05 -0700263 int i;
Urvang Joshi81760812017-02-15 16:47:59 -0800264 assert(scale >= sm_weights[r] && scale >= sm_weights[c]);
Urvang Joshi6be4a542016-11-03 15:24:05 -0700265 for (i = 0; i < 4; ++i) {
266 this_pred += weights[i] * pixels[i];
267 }
Urvang Joshi7a406002017-01-31 14:52:18 -0800268 dst[c] = clip_pixel(divide_round(this_pred, log2_scale));
Urvang Joshi6be4a542016-11-03 15:24:05 -0700269 }
270 dst += stride;
271 }
272}
273
Urvang Joshie6ca8e82017-03-15 14:57:41 -0700274#if CONFIG_SMOOTH_HV
275static INLINE void smooth_v_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
276 const uint8_t *above,
277 const uint8_t *left) {
278 const uint8_t below_pred = left[bs - 1]; // estimated by bottom-left pixel
Urvang Joshif695d652017-05-10 11:21:45 -0700279 const uint8_t *const sm_weights = sm_weight_arrays + bs;
Urvang Joshie6ca8e82017-03-15 14:57:41 -0700280 // scale = 2^sm_weight_log2_scale
281 const int log2_scale = sm_weight_log2_scale;
282 const uint16_t scale = (1 << sm_weight_log2_scale);
283 sm_weights_sanity_checks(sm_weights, scale, log2_scale + sizeof(*dst));
284
285 int r;
286 for (r = 0; r < bs; r++) {
287 int c;
288 for (c = 0; c < bs; ++c) {
289 const uint8_t pixels[] = { above[c], below_pred };
290 const uint8_t weights[] = { sm_weights[r], scale - sm_weights[r] };
291 uint32_t this_pred = 0;
292 assert(scale >= sm_weights[r]);
293 int i;
294 for (i = 0; i < 2; ++i) {
295 this_pred += weights[i] * pixels[i];
296 }
297 dst[c] = clip_pixel(divide_round(this_pred, log2_scale));
298 }
299 dst += stride;
300 }
301}
302
303static INLINE void smooth_h_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
304 const uint8_t *above,
305 const uint8_t *left) {
306 const uint8_t right_pred = above[bs - 1]; // estimated by top-right pixel
Urvang Joshif695d652017-05-10 11:21:45 -0700307 const uint8_t *const sm_weights = sm_weight_arrays + bs;
Urvang Joshie6ca8e82017-03-15 14:57:41 -0700308 // scale = 2^sm_weight_log2_scale
309 const int log2_scale = sm_weight_log2_scale;
310 const uint16_t scale = (1 << sm_weight_log2_scale);
311 sm_weights_sanity_checks(sm_weights, scale, log2_scale + sizeof(*dst));
312
313 int r;
314 for (r = 0; r < bs; r++) {
315 int c;
316 for (c = 0; c < bs; ++c) {
317 const uint8_t pixels[] = { left[r], right_pred };
318 const uint8_t weights[] = { sm_weights[c], scale - sm_weights[c] };
319 uint32_t this_pred = 0;
320 assert(scale >= sm_weights[c]);
321 int i;
322 for (i = 0; i < 2; ++i) {
323 this_pred += weights[i] * pixels[i];
324 }
325 dst[c] = clip_pixel(divide_round(this_pred, log2_scale));
326 }
327 dst += stride;
328 }
329}
330#endif // CONFIG_SMOOTH_HV
331
Urvang Joshi340593e2016-09-01 12:03:20 -0700332#else
333
Yaowu Xuc27fc142016-08-22 16:08:15 -0700334static INLINE void tm_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
335 const uint8_t *above, const uint8_t *left) {
336 int r, c;
337 int ytop_left = above[-1];
338
339 for (r = 0; r < bs; r++) {
340 for (c = 0; c < bs; c++)
341 dst[c] = clip_pixel(left[r] + above[c] - ytop_left);
342 dst += stride;
343 }
344}
Urvang Joshi340593e2016-09-01 12:03:20 -0700345#endif // CONFIG_ALT_INTRA
Yaowu Xuc27fc142016-08-22 16:08:15 -0700346
347static INLINE void dc_128_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
348 const uint8_t *above, const uint8_t *left) {
349 int r;
350 (void)above;
351 (void)left;
352
353 for (r = 0; r < bs; r++) {
354 memset(dst, 128, bs);
355 dst += stride;
356 }
357}
358
359static INLINE void dc_left_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
360 const uint8_t *above,
361 const uint8_t *left) {
362 int i, r, expected_dc, sum = 0;
363 (void)above;
364
365 for (i = 0; i < bs; i++) sum += left[i];
366 expected_dc = (sum + (bs >> 1)) / bs;
367
368 for (r = 0; r < bs; r++) {
369 memset(dst, expected_dc, bs);
370 dst += stride;
371 }
372}
373
374static INLINE void dc_top_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
375 const uint8_t *above, const uint8_t *left) {
376 int i, r, expected_dc, sum = 0;
377 (void)left;
378
379 for (i = 0; i < bs; i++) sum += above[i];
380 expected_dc = (sum + (bs >> 1)) / bs;
381
382 for (r = 0; r < bs; r++) {
383 memset(dst, expected_dc, bs);
384 dst += stride;
385 }
386}
387
388static INLINE void dc_predictor(uint8_t *dst, ptrdiff_t stride, int bs,
389 const uint8_t *above, const uint8_t *left) {
390 int i, r, expected_dc, sum = 0;
391 const int count = 2 * bs;
392
393 for (i = 0; i < bs; i++) {
394 sum += above[i];
395 sum += left[i];
396 }
397
398 expected_dc = (sum + (count >> 1)) / count;
399
400 for (r = 0; r < bs; r++) {
401 memset(dst, expected_dc, bs);
402 dst += stride;
403 }
404}
405
Jingning Han03b35142016-10-19 13:04:26 -0700406void aom_d45e_predictor_2x2_c(uint8_t *dst, ptrdiff_t stride,
407 const uint8_t *above, const uint8_t *left) {
408 const int A = above[0];
409 const int B = above[1];
410 const int C = above[2];
411 const int D = above[3];
Jingning Han03b35142016-10-19 13:04:26 -0700412 (void)stride;
413 (void)left;
Jingning Han8a7786d2016-12-15 20:37:47 -0800414
Jingning Han03b35142016-10-19 13:04:26 -0700415 DST(0, 0) = AVG3(A, B, C);
416 DST(1, 0) = DST(0, 1) = AVG3(B, C, D);
Jingning Han8a7786d2016-12-15 20:37:47 -0800417 DST(1, 1) = AVG3(C, D, D);
Jingning Han03b35142016-10-19 13:04:26 -0700418}
419
420void aom_d117_predictor_2x2_c(uint8_t *dst, ptrdiff_t stride,
421 const uint8_t *above, const uint8_t *left) {
422 const int I = left[0];
423 const int X = above[-1];
424 const int A = above[0];
425 const int B = above[1];
426 DST(0, 0) = AVG2(X, A);
427 DST(1, 0) = AVG2(A, B);
428 DST(0, 1) = AVG3(I, X, A);
429 DST(1, 1) = AVG3(X, A, B);
430}
431
432void aom_d135_predictor_2x2_c(uint8_t *dst, ptrdiff_t stride,
433 const uint8_t *above, const uint8_t *left) {
434 const int I = left[0];
435 const int J = left[1];
436 const int X = above[-1];
437 const int A = above[0];
438 const int B = above[1];
439 (void)stride;
440 DST(0, 1) = AVG3(X, I, J);
441 DST(1, 1) = DST(0, 0) = AVG3(A, X, I);
442 DST(1, 0) = AVG3(B, A, X);
443}
444
445void aom_d153_predictor_2x2_c(uint8_t *dst, ptrdiff_t stride,
446 const uint8_t *above, const uint8_t *left) {
447 const int I = left[0];
448 const int J = left[1];
449 const int X = above[-1];
450 const int A = above[0];
451
452 DST(0, 0) = AVG2(I, X);
453 DST(0, 1) = AVG2(J, I);
454 DST(1, 0) = AVG3(I, X, A);
455 DST(1, 1) = AVG3(J, I, X);
456}
457
Yaowu Xuf883b422016-08-30 14:01:10 -0700458void aom_d45e_predictor_4x4_c(uint8_t *dst, ptrdiff_t stride,
Yaowu Xuc27fc142016-08-22 16:08:15 -0700459 const uint8_t *above, const uint8_t *left) {
460 const int A = above[0];
461 const int B = above[1];
462 const int C = above[2];
463 const int D = above[3];
464 const int E = above[4];
465 const int F = above[5];
466 const int G = above[6];
467 const int H = above[7];
468 (void)stride;
469 (void)left;
470 DST(0, 0) = AVG3(A, B, C);
471 DST(1, 0) = DST(0, 1) = AVG3(B, C, D);
472 DST(2, 0) = DST(1, 1) = DST(0, 2) = AVG3(C, D, E);
473 DST(3, 0) = DST(2, 1) = DST(1, 2) = DST(0, 3) = AVG3(D, E, F);
474 DST(3, 1) = DST(2, 2) = DST(1, 3) = AVG3(E, F, G);
475 DST(3, 2) = DST(2, 3) = AVG3(F, G, H);
476 DST(3, 3) = AVG3(G, H, H);
477}
478
Yaowu Xuf883b422016-08-30 14:01:10 -0700479void aom_d117_predictor_4x4_c(uint8_t *dst, ptrdiff_t stride,
Yaowu Xuc27fc142016-08-22 16:08:15 -0700480 const uint8_t *above, const uint8_t *left) {
481 const int I = left[0];
482 const int J = left[1];
483 const int K = left[2];
484 const int X = above[-1];
485 const int A = above[0];
486 const int B = above[1];
487 const int C = above[2];
488 const int D = above[3];
489 DST(0, 0) = DST(1, 2) = AVG2(X, A);
490 DST(1, 0) = DST(2, 2) = AVG2(A, B);
491 DST(2, 0) = DST(3, 2) = AVG2(B, C);
492 DST(3, 0) = AVG2(C, D);
493
494 DST(0, 3) = AVG3(K, J, I);
495 DST(0, 2) = AVG3(J, I, X);
496 DST(0, 1) = DST(1, 3) = AVG3(I, X, A);
497 DST(1, 1) = DST(2, 3) = AVG3(X, A, B);
498 DST(2, 1) = DST(3, 3) = AVG3(A, B, C);
499 DST(3, 1) = AVG3(B, C, D);
500}
501
Yaowu Xuf883b422016-08-30 14:01:10 -0700502void aom_d135_predictor_4x4_c(uint8_t *dst, ptrdiff_t stride,
Yaowu Xuc27fc142016-08-22 16:08:15 -0700503 const uint8_t *above, const uint8_t *left) {
504 const int I = left[0];
505 const int J = left[1];
506 const int K = left[2];
507 const int L = left[3];
508 const int X = above[-1];
509 const int A = above[0];
510 const int B = above[1];
511 const int C = above[2];
512 const int D = above[3];
513 (void)stride;
514 DST(0, 3) = AVG3(J, K, L);
515 DST(1, 3) = DST(0, 2) = AVG3(I, J, K);
516 DST(2, 3) = DST(1, 2) = DST(0, 1) = AVG3(X, I, J);
517 DST(3, 3) = DST(2, 2) = DST(1, 1) = DST(0, 0) = AVG3(A, X, I);
518 DST(3, 2) = DST(2, 1) = DST(1, 0) = AVG3(B, A, X);
519 DST(3, 1) = DST(2, 0) = AVG3(C, B, A);
520 DST(3, 0) = AVG3(D, C, B);
521}
522
Yaowu Xuf883b422016-08-30 14:01:10 -0700523void aom_d153_predictor_4x4_c(uint8_t *dst, ptrdiff_t stride,
Yaowu Xuc27fc142016-08-22 16:08:15 -0700524 const uint8_t *above, const uint8_t *left) {
525 const int I = left[0];
526 const int J = left[1];
527 const int K = left[2];
528 const int L = left[3];
529 const int X = above[-1];
530 const int A = above[0];
531 const int B = above[1];
532 const int C = above[2];
533
534 DST(0, 0) = DST(2, 1) = AVG2(I, X);
535 DST(0, 1) = DST(2, 2) = AVG2(J, I);
536 DST(0, 2) = DST(2, 3) = AVG2(K, J);
537 DST(0, 3) = AVG2(L, K);
538
539 DST(3, 0) = AVG3(A, B, C);
540 DST(2, 0) = AVG3(X, A, B);
541 DST(1, 0) = DST(3, 1) = AVG3(I, X, A);
542 DST(1, 1) = DST(3, 2) = AVG3(J, I, X);
543 DST(1, 2) = DST(3, 3) = AVG3(K, J, I);
544 DST(1, 3) = AVG3(L, K, J);
545}
546
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200547#if CONFIG_HIGHBITDEPTH
Yaowu Xuc27fc142016-08-22 16:08:15 -0700548static INLINE void highbd_d207e_predictor(uint16_t *dst, ptrdiff_t stride,
549 int bs, const uint16_t *above,
550 const uint16_t *left, int bd) {
551 int r, c;
552 (void)above;
553 (void)bd;
554
555 for (r = 0; r < bs; ++r) {
556 for (c = 0; c < bs; ++c) {
557 dst[c] = c & 1 ? AVG3(left[(c >> 1) + r], left[(c >> 1) + r + 1],
558 left[(c >> 1) + r + 2])
559 : AVG2(left[(c >> 1) + r], left[(c >> 1) + r + 1]);
560 }
561 dst += stride;
562 }
563}
564
Urvang Joshic3bcf3b2017-04-21 13:09:43 -0700565static INLINE void highbd_d63e_predictor(uint16_t *dst, ptrdiff_t stride,
566 int bs, const uint16_t *above,
567 const uint16_t *left, int bd) {
Yaowu Xuc27fc142016-08-22 16:08:15 -0700568 int r, c;
569 (void)left;
570 (void)bd;
571 for (r = 0; r < bs; ++r) {
572 for (c = 0; c < bs; ++c) {
573 dst[c] = r & 1 ? AVG3(above[(r >> 1) + c], above[(r >> 1) + c + 1],
574 above[(r >> 1) + c + 2])
575 : AVG2(above[(r >> 1) + c], above[(r >> 1) + c + 1]);
576 }
577 dst += stride;
578 }
579}
580
Yaowu Xuc27fc142016-08-22 16:08:15 -0700581static INLINE void highbd_d45e_predictor(uint16_t *dst, ptrdiff_t stride,
582 int bs, const uint16_t *above,
583 const uint16_t *left, int bd) {
584 int r, c;
585 (void)left;
586 (void)bd;
587 for (r = 0; r < bs; ++r) {
588 for (c = 0; c < bs; ++c) {
589 dst[c] = AVG3(above[r + c], above[r + c + 1],
590 above[r + c + 1 + (r + c + 2 < bs * 2)]);
591 }
592 dst += stride;
593 }
594}
595
596static INLINE void highbd_d117_predictor(uint16_t *dst, ptrdiff_t stride,
597 int bs, const uint16_t *above,
598 const uint16_t *left, int bd) {
599 int r, c;
600 (void)bd;
601
602 // first row
603 for (c = 0; c < bs; c++) dst[c] = AVG2(above[c - 1], above[c]);
604 dst += stride;
605
606 // second row
607 dst[0] = AVG3(left[0], above[-1], above[0]);
608 for (c = 1; c < bs; c++) dst[c] = AVG3(above[c - 2], above[c - 1], above[c]);
609 dst += stride;
610
611 // the rest of first col
612 dst[0] = AVG3(above[-1], left[0], left[1]);
613 for (r = 3; r < bs; ++r)
614 dst[(r - 2) * stride] = AVG3(left[r - 3], left[r - 2], left[r - 1]);
615
616 // the rest of the block
617 for (r = 2; r < bs; ++r) {
618 for (c = 1; c < bs; c++) dst[c] = dst[-2 * stride + c - 1];
619 dst += stride;
620 }
621}
622
623static INLINE void highbd_d135_predictor(uint16_t *dst, ptrdiff_t stride,
624 int bs, const uint16_t *above,
625 const uint16_t *left, int bd) {
626 int r, c;
627 (void)bd;
628 dst[0] = AVG3(left[0], above[-1], above[0]);
629 for (c = 1; c < bs; c++) dst[c] = AVG3(above[c - 2], above[c - 1], above[c]);
630
631 dst[stride] = AVG3(above[-1], left[0], left[1]);
632 for (r = 2; r < bs; ++r)
633 dst[r * stride] = AVG3(left[r - 2], left[r - 1], left[r]);
634
635 dst += stride;
636 for (r = 1; r < bs; ++r) {
637 for (c = 1; c < bs; c++) dst[c] = dst[-stride + c - 1];
638 dst += stride;
639 }
640}
641
642static INLINE void highbd_d153_predictor(uint16_t *dst, ptrdiff_t stride,
643 int bs, const uint16_t *above,
644 const uint16_t *left, int bd) {
645 int r, c;
646 (void)bd;
647 dst[0] = AVG2(above[-1], left[0]);
648 for (r = 1; r < bs; r++) dst[r * stride] = AVG2(left[r - 1], left[r]);
649 dst++;
650
651 dst[0] = AVG3(left[0], above[-1], above[0]);
652 dst[stride] = AVG3(above[-1], left[0], left[1]);
653 for (r = 2; r < bs; r++)
654 dst[r * stride] = AVG3(left[r - 2], left[r - 1], left[r]);
655 dst++;
656
657 for (c = 0; c < bs - 2; c++)
658 dst[c] = AVG3(above[c - 1], above[c], above[c + 1]);
659 dst += stride;
660
661 for (r = 1; r < bs; ++r) {
662 for (c = 0; c < bs - 2; c++) dst[c] = dst[-stride + c - 2];
663 dst += stride;
664 }
665}
666
667static INLINE void highbd_v_predictor(uint16_t *dst, ptrdiff_t stride, int bs,
668 const uint16_t *above,
669 const uint16_t *left, int bd) {
670 int r;
671 (void)left;
672 (void)bd;
673 for (r = 0; r < bs; r++) {
674 memcpy(dst, above, bs * sizeof(uint16_t));
675 dst += stride;
676 }
677}
678
679static INLINE void highbd_h_predictor(uint16_t *dst, ptrdiff_t stride, int bs,
680 const uint16_t *above,
681 const uint16_t *left, int bd) {
682 int r;
683 (void)above;
684 (void)bd;
685 for (r = 0; r < bs; r++) {
Yaowu Xuf883b422016-08-30 14:01:10 -0700686 aom_memset16(dst, left[r], bs);
Yaowu Xuc27fc142016-08-22 16:08:15 -0700687 dst += stride;
688 }
689}
690
Jingning Han324b4c62016-12-19 09:33:04 -0800691void aom_highbd_d207_predictor_2x2_c(uint16_t *dst, ptrdiff_t stride,
692 const uint16_t *above,
693 const uint16_t *left, int bd) {
694 const int I = left[0];
695 const int J = left[1];
696 const int K = left[2];
697 const int L = left[3];
698 (void)above;
699 (void)bd;
700 DST(0, 0) = AVG2(I, J);
701 DST(0, 1) = AVG2(J, K);
702 DST(1, 0) = AVG3(I, J, K);
703 DST(1, 1) = AVG3(J, K, L);
704}
705
706void aom_highbd_d63_predictor_2x2_c(uint16_t *dst, ptrdiff_t stride,
707 const uint16_t *above, const uint16_t *left,
708 int bd) {
709 const int A = above[0];
710 const int B = above[1];
711 const int C = above[2];
712 const int D = above[3];
713 (void)left;
714 (void)bd;
715 DST(0, 0) = AVG2(A, B);
716 DST(1, 0) = AVG2(B, C);
717 DST(0, 1) = AVG3(A, B, C);
718 DST(1, 1) = AVG3(B, C, D);
719}
720
721void aom_highbd_d45e_predictor_2x2_c(uint16_t *dst, ptrdiff_t stride,
722 const uint16_t *above,
723 const uint16_t *left, int bd) {
724 const int A = above[0];
725 const int B = above[1];
726 const int C = above[2];
727 const int D = above[3];
728 (void)stride;
729 (void)left;
730 (void)bd;
731 DST(0, 0) = AVG3(A, B, C);
732 DST(1, 0) = DST(0, 1) = AVG3(B, C, D);
733 DST(1, 1) = AVG3(C, D, D);
734}
735
736void aom_highbd_d117_predictor_2x2_c(uint16_t *dst, ptrdiff_t stride,
737 const uint16_t *above,
738 const uint16_t *left, int bd) {
739 const int I = left[0];
740 const int X = above[-1];
741 const int A = above[0];
742 const int B = above[1];
743 (void)bd;
744 DST(0, 0) = AVG2(X, A);
745 DST(1, 0) = AVG2(A, B);
746 DST(0, 1) = AVG3(I, X, A);
747 DST(1, 1) = AVG3(X, A, B);
748}
749
750void aom_highbd_d135_predictor_2x2_c(uint16_t *dst, ptrdiff_t stride,
751 const uint16_t *above,
752 const uint16_t *left, int bd) {
753 const int I = left[0];
754 const int J = left[1];
755 const int X = above[-1];
756 const int A = above[0];
757 const int B = above[1];
758 (void)bd;
759 DST(0, 1) = AVG3(X, I, J);
760 DST(1, 1) = DST(0, 0) = AVG3(A, X, I);
761 DST(1, 0) = AVG3(B, A, X);
762}
763
764void aom_highbd_d153_predictor_2x2_c(uint16_t *dst, ptrdiff_t stride,
765 const uint16_t *above,
766 const uint16_t *left, int bd) {
767 const int I = left[0];
768 const int J = left[1];
769 const int X = above[-1];
770 const int A = above[0];
771 (void)bd;
772 DST(0, 0) = AVG2(I, X);
773 DST(0, 1) = AVG2(J, I);
774 DST(1, 0) = AVG3(I, X, A);
775 DST(1, 1) = AVG3(J, I, X);
776}
777
Urvang Joshi340593e2016-09-01 12:03:20 -0700778#if CONFIG_ALT_INTRA
779static INLINE void highbd_paeth_predictor(uint16_t *dst, ptrdiff_t stride,
780 int bs, const uint16_t *above,
781 const uint16_t *left, int bd) {
782 int r, c;
783 const uint16_t ytop_left = above[-1];
784 (void)bd;
785
786 for (r = 0; r < bs; r++) {
787 for (c = 0; c < bs; c++)
788 dst[c] = paeth_predictor_single(left[r], above[c], ytop_left);
789 dst += stride;
790 }
791}
792
Urvang Joshi6be4a542016-11-03 15:24:05 -0700793static INLINE void highbd_smooth_predictor(uint16_t *dst, ptrdiff_t stride,
794 int bs, const uint16_t *above,
795 const uint16_t *left, int bd) {
796 const uint16_t below_pred = left[bs - 1]; // estimated by bottom-left pixel
797 const uint16_t right_pred = above[bs - 1]; // estimated by top-right pixel
Urvang Joshif695d652017-05-10 11:21:45 -0700798 const uint8_t *const sm_weights = sm_weight_arrays + bs;
Urvang Joshi81760812017-02-15 16:47:59 -0800799 // scale = 2 * 2^sm_weight_log2_scale
800 const int log2_scale = 1 + sm_weight_log2_scale;
Urvang Joshi4d5bbbd2017-03-02 17:10:44 -0800801 const uint16_t scale = (1 << sm_weight_log2_scale);
802 sm_weights_sanity_checks(sm_weights, scale, log2_scale + sizeof(*dst));
Urvang Joshi6be4a542016-11-03 15:24:05 -0700803 int r;
804 for (r = 0; r < bs; ++r) {
805 int c;
806 for (c = 0; c < bs; ++c) {
Urvang Joshi7a406002017-01-31 14:52:18 -0800807 const uint16_t pixels[] = { above[c], below_pred, left[r], right_pred };
Urvang Joshi4d5bbbd2017-03-02 17:10:44 -0800808 const uint8_t weights[] = { sm_weights[r], scale - sm_weights[r],
809 sm_weights[c], scale - sm_weights[c] };
Urvang Joshi7a406002017-01-31 14:52:18 -0800810 uint32_t this_pred = 0;
Urvang Joshi6be4a542016-11-03 15:24:05 -0700811 int i;
Urvang Joshi81760812017-02-15 16:47:59 -0800812 assert(scale >= sm_weights[r] && scale >= sm_weights[c]);
Urvang Joshi6be4a542016-11-03 15:24:05 -0700813 for (i = 0; i < 4; ++i) {
814 this_pred += weights[i] * pixels[i];
815 }
Urvang Joshi7a406002017-01-31 14:52:18 -0800816 dst[c] = clip_pixel_highbd(divide_round(this_pred, log2_scale), bd);
Urvang Joshi6be4a542016-11-03 15:24:05 -0700817 }
818 dst += stride;
819 }
820}
821
Sebastien Alaiwane13a11f2017-05-09 10:54:54 +0200822#if CONFIG_SMOOTH_HV
Urvang Joshie6ca8e82017-03-15 14:57:41 -0700823static INLINE void highbd_smooth_v_predictor(uint16_t *dst, ptrdiff_t stride,
824 int bs, const uint16_t *above,
825 const uint16_t *left, int bd) {
826 const uint16_t below_pred = left[bs - 1]; // estimated by bottom-left pixel
Urvang Joshif695d652017-05-10 11:21:45 -0700827 const uint8_t *const sm_weights = sm_weight_arrays + bs;
Urvang Joshie6ca8e82017-03-15 14:57:41 -0700828 // scale = 2^sm_weight_log2_scale
829 const int log2_scale = sm_weight_log2_scale;
830 const uint16_t scale = (1 << sm_weight_log2_scale);
831 sm_weights_sanity_checks(sm_weights, scale, log2_scale + sizeof(*dst));
832
833 int r;
834 for (r = 0; r < bs; r++) {
835 int c;
836 for (c = 0; c < bs; ++c) {
837 const uint16_t pixels[] = { above[c], below_pred };
838 const uint8_t weights[] = { sm_weights[r], scale - sm_weights[r] };
839 uint32_t this_pred = 0;
840 assert(scale >= sm_weights[r]);
841 int i;
842 for (i = 0; i < 2; ++i) {
843 this_pred += weights[i] * pixels[i];
844 }
845 dst[c] = clip_pixel_highbd(divide_round(this_pred, log2_scale), bd);
846 }
847 dst += stride;
848 }
849}
850
851static INLINE void highbd_smooth_h_predictor(uint16_t *dst, ptrdiff_t stride,
852 int bs, const uint16_t *above,
853 const uint16_t *left, int bd) {
854 const uint16_t right_pred = above[bs - 1]; // estimated by top-right pixel
Urvang Joshif695d652017-05-10 11:21:45 -0700855 const uint8_t *const sm_weights = sm_weight_arrays + bs;
Urvang Joshie6ca8e82017-03-15 14:57:41 -0700856 // scale = 2^sm_weight_log2_scale
857 const int log2_scale = sm_weight_log2_scale;
858 const uint16_t scale = (1 << sm_weight_log2_scale);
859 sm_weights_sanity_checks(sm_weights, scale, log2_scale + sizeof(*dst));
860
861 int r;
862 for (r = 0; r < bs; r++) {
863 int c;
864 for (c = 0; c < bs; ++c) {
865 const uint16_t pixels[] = { left[r], right_pred };
866 const uint8_t weights[] = { sm_weights[c], scale - sm_weights[c] };
867 uint32_t this_pred = 0;
868 assert(scale >= sm_weights[c]);
869 int i;
870 for (i = 0; i < 2; ++i) {
871 this_pred += weights[i] * pixels[i];
872 }
873 dst[c] = clip_pixel_highbd(divide_round(this_pred, log2_scale), bd);
874 }
875 dst += stride;
876 }
877}
Sebastien Alaiwane13a11f2017-05-09 10:54:54 +0200878#endif
Urvang Joshie6ca8e82017-03-15 14:57:41 -0700879
Urvang Joshi340593e2016-09-01 12:03:20 -0700880#else
Yaowu Xuc27fc142016-08-22 16:08:15 -0700881static INLINE void highbd_tm_predictor(uint16_t *dst, ptrdiff_t stride, int bs,
882 const uint16_t *above,
883 const uint16_t *left, int bd) {
884 int r, c;
885 int ytop_left = above[-1];
886 (void)bd;
887
888 for (r = 0; r < bs; r++) {
889 for (c = 0; c < bs; c++)
890 dst[c] = clip_pixel_highbd(left[r] + above[c] - ytop_left, bd);
891 dst += stride;
892 }
893}
Urvang Joshi340593e2016-09-01 12:03:20 -0700894#endif // CONFIG_ALT_INTRA
Yaowu Xuc27fc142016-08-22 16:08:15 -0700895
896static INLINE void highbd_dc_128_predictor(uint16_t *dst, ptrdiff_t stride,
897 int bs, const uint16_t *above,
898 const uint16_t *left, int bd) {
899 int r;
900 (void)above;
901 (void)left;
902
903 for (r = 0; r < bs; r++) {
Yaowu Xuf883b422016-08-30 14:01:10 -0700904 aom_memset16(dst, 128 << (bd - 8), bs);
Yaowu Xuc27fc142016-08-22 16:08:15 -0700905 dst += stride;
906 }
907}
908
909static INLINE void highbd_dc_left_predictor(uint16_t *dst, ptrdiff_t stride,
910 int bs, const uint16_t *above,
911 const uint16_t *left, int bd) {
912 int i, r, expected_dc, sum = 0;
913 (void)above;
914 (void)bd;
915
916 for (i = 0; i < bs; i++) sum += left[i];
917 expected_dc = (sum + (bs >> 1)) / bs;
918
919 for (r = 0; r < bs; r++) {
Yaowu Xuf883b422016-08-30 14:01:10 -0700920 aom_memset16(dst, expected_dc, bs);
Yaowu Xuc27fc142016-08-22 16:08:15 -0700921 dst += stride;
922 }
923}
924
925static INLINE void highbd_dc_top_predictor(uint16_t *dst, ptrdiff_t stride,
926 int bs, const uint16_t *above,
927 const uint16_t *left, int bd) {
928 int i, r, expected_dc, sum = 0;
929 (void)left;
930 (void)bd;
931
932 for (i = 0; i < bs; i++) sum += above[i];
933 expected_dc = (sum + (bs >> 1)) / bs;
934
935 for (r = 0; r < bs; r++) {
Yaowu Xuf883b422016-08-30 14:01:10 -0700936 aom_memset16(dst, expected_dc, bs);
Yaowu Xuc27fc142016-08-22 16:08:15 -0700937 dst += stride;
938 }
939}
940
941static INLINE void highbd_dc_predictor(uint16_t *dst, ptrdiff_t stride, int bs,
942 const uint16_t *above,
943 const uint16_t *left, int bd) {
944 int i, r, expected_dc, sum = 0;
945 const int count = 2 * bs;
946 (void)bd;
947
948 for (i = 0; i < bs; i++) {
949 sum += above[i];
950 sum += left[i];
951 }
952
953 expected_dc = (sum + (count >> 1)) / count;
954
955 for (r = 0; r < bs; r++) {
Yaowu Xuf883b422016-08-30 14:01:10 -0700956 aom_memset16(dst, expected_dc, bs);
Yaowu Xuc27fc142016-08-22 16:08:15 -0700957 dst += stride;
958 }
959}
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200960#endif // CONFIG_HIGHBITDEPTH
Yaowu Xuc27fc142016-08-22 16:08:15 -0700961
962// This serves as a wrapper function, so that all the prediction functions
963// can be unified and accessed as a pointer array. Note that the boundary
964// above and left are not necessarily used all the time.
965#define intra_pred_sized(type, size) \
Yaowu Xuf883b422016-08-30 14:01:10 -0700966 void aom_##type##_predictor_##size##x##size##_c( \
Yaowu Xuc27fc142016-08-22 16:08:15 -0700967 uint8_t *dst, ptrdiff_t stride, const uint8_t *above, \
968 const uint8_t *left) { \
969 type##_predictor(dst, stride, size, above, left); \
970 }
971
Sebastien Alaiwan71e87842017-04-12 16:03:28 +0200972#if CONFIG_HIGHBITDEPTH
Yaowu Xuc27fc142016-08-22 16:08:15 -0700973#define intra_pred_highbd_sized(type, size) \
Yaowu Xuf883b422016-08-30 14:01:10 -0700974 void aom_highbd_##type##_predictor_##size##x##size##_c( \
Yaowu Xuc27fc142016-08-22 16:08:15 -0700975 uint16_t *dst, ptrdiff_t stride, const uint16_t *above, \
976 const uint16_t *left, int bd) { \
977 highbd_##type##_predictor(dst, stride, size, above, left, bd); \
978 }
979
980/* clang-format off */
Debargha Mukherjee84c56af2016-11-19 10:59:37 -0800981#if CONFIG_TX64X64
982#define intra_pred_allsizes(type) \
983 intra_pred_sized(type, 2) \
984 intra_pred_sized(type, 4) \
985 intra_pred_sized(type, 8) \
986 intra_pred_sized(type, 16) \
987 intra_pred_sized(type, 32) \
988 intra_pred_sized(type, 64) \
Urvang Joshi16247652017-05-24 17:28:19 -0700989 intra_pred_highbd_sized(type, 2) \
Debargha Mukherjee84c56af2016-11-19 10:59:37 -0800990 intra_pred_highbd_sized(type, 4) \
991 intra_pred_highbd_sized(type, 8) \
992 intra_pred_highbd_sized(type, 16) \
993 intra_pred_highbd_sized(type, 32) \
994 intra_pred_highbd_sized(type, 64)
995
996#define intra_pred_above_4x4(type) \
997 intra_pred_sized(type, 8) \
998 intra_pred_sized(type, 16) \
999 intra_pred_sized(type, 32) \
1000 intra_pred_sized(type, 64) \
1001 intra_pred_highbd_sized(type, 4) \
1002 intra_pred_highbd_sized(type, 8) \
1003 intra_pred_highbd_sized(type, 16) \
1004 intra_pred_highbd_sized(type, 32) \
1005 intra_pred_highbd_sized(type, 64)
1006#else // CONFIG_TX64X64
Yaowu Xuc27fc142016-08-22 16:08:15 -07001007#define intra_pred_allsizes(type) \
Jingning Hane3954d82016-10-12 21:03:18 -07001008 intra_pred_sized(type, 2) \
Yaowu Xuc27fc142016-08-22 16:08:15 -07001009 intra_pred_sized(type, 4) \
1010 intra_pred_sized(type, 8) \
1011 intra_pred_sized(type, 16) \
1012 intra_pred_sized(type, 32) \
Jingning Han324b4c62016-12-19 09:33:04 -08001013 intra_pred_highbd_sized(type, 2) \
Yaowu Xuc27fc142016-08-22 16:08:15 -07001014 intra_pred_highbd_sized(type, 4) \
1015 intra_pred_highbd_sized(type, 8) \
1016 intra_pred_highbd_sized(type, 16) \
1017 intra_pred_highbd_sized(type, 32)
1018
Jingning Hane3954d82016-10-12 21:03:18 -07001019#define intra_pred_above_4x4(type) \
Yaowu Xuc27fc142016-08-22 16:08:15 -07001020 intra_pred_sized(type, 8) \
1021 intra_pred_sized(type, 16) \
1022 intra_pred_sized(type, 32) \
1023 intra_pred_highbd_sized(type, 4) \
1024 intra_pred_highbd_sized(type, 8) \
1025 intra_pred_highbd_sized(type, 16) \
1026 intra_pred_highbd_sized(type, 32)
Debargha Mukherjee84c56af2016-11-19 10:59:37 -08001027#endif // CONFIG_TX64X64
Yaowu Xuc27fc142016-08-22 16:08:15 -07001028
1029#else
Debargha Mukherjee84c56af2016-11-19 10:59:37 -08001030
1031#if CONFIG_TX64X64
1032#define intra_pred_allsizes(type) \
1033 intra_pred_sized(type, 2) \
1034 intra_pred_sized(type, 4) \
1035 intra_pred_sized(type, 8) \
1036 intra_pred_sized(type, 16) \
1037 intra_pred_sized(type, 32) \
1038 intra_pred_sized(type, 64)
1039
1040#define intra_pred_above_4x4(type) \
1041 intra_pred_sized(type, 8) \
1042 intra_pred_sized(type, 16) \
1043 intra_pred_sized(type, 32) \
1044 intra_pred_sized(type, 64)
1045#else // CONFIG_TX64X64
Yaowu Xuc27fc142016-08-22 16:08:15 -07001046#define intra_pred_allsizes(type) \
Jingning Hane3954d82016-10-12 21:03:18 -07001047 intra_pred_sized(type, 2) \
Yaowu Xuc27fc142016-08-22 16:08:15 -07001048 intra_pred_sized(type, 4) \
1049 intra_pred_sized(type, 8) \
1050 intra_pred_sized(type, 16) \
1051 intra_pred_sized(type, 32)
1052
Jingning Hane3954d82016-10-12 21:03:18 -07001053#define intra_pred_above_4x4(type) \
Yaowu Xuc27fc142016-08-22 16:08:15 -07001054 intra_pred_sized(type, 8) \
1055 intra_pred_sized(type, 16) \
1056 intra_pred_sized(type, 32)
Debargha Mukherjee84c56af2016-11-19 10:59:37 -08001057#endif // CONFIG_TX64X64
Sebastien Alaiwan71e87842017-04-12 16:03:28 +02001058#endif // CONFIG_HIGHBITDEPTH
Yaowu Xuc27fc142016-08-22 16:08:15 -07001059
Yaowu Xuc27fc142016-08-22 16:08:15 -07001060intra_pred_allsizes(d207e)
1061intra_pred_allsizes(d63e)
Jingning Hane3954d82016-10-12 21:03:18 -07001062intra_pred_above_4x4(d45e)
1063intra_pred_above_4x4(d117)
1064intra_pred_above_4x4(d135)
1065intra_pred_above_4x4(d153)
Yaowu Xuc27fc142016-08-22 16:08:15 -07001066intra_pred_allsizes(v)
1067intra_pred_allsizes(h)
Urvang Joshi340593e2016-09-01 12:03:20 -07001068#if CONFIG_ALT_INTRA
Urvang Joshi6be4a542016-11-03 15:24:05 -07001069intra_pred_allsizes(smooth)
Urvang Joshie6ca8e82017-03-15 14:57:41 -07001070#if CONFIG_SMOOTH_HV
1071intra_pred_allsizes(smooth_v)
1072intra_pred_allsizes(smooth_h)
1073#endif // CONFIG_SMOOTH_HV
1074intra_pred_allsizes(paeth)
Urvang Joshi340593e2016-09-01 12:03:20 -07001075#else
Yaowu Xuc27fc142016-08-22 16:08:15 -07001076intra_pred_allsizes(tm)
Urvang Joshi340593e2016-09-01 12:03:20 -07001077#endif // CONFIG_ALT_INTRA
Yaowu Xuc27fc142016-08-22 16:08:15 -07001078intra_pred_allsizes(dc_128)
1079intra_pred_allsizes(dc_left)
1080intra_pred_allsizes(dc_top)
1081intra_pred_allsizes(dc)
1082/* clang-format on */
1083#undef intra_pred_allsizes