FFmpeg
Loading...
Searching...
No Matches
pred_template.c
Go to the documentation of this file.
1/*
2 * HEVC video decoder
3 *
4 * Copyright (C) 2012 - 2013 Guillaume Martres
5 *
6 * This file is part of FFmpeg.
7 *
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#include "libavutil/pixdesc.h"
24
26#include "pred.h"
27
28static void FUNC(ref_filter_3tap)(uint8_t *filtered_left,
29 uint8_t *filtered_top,
30 const uint8_t *left,
31 const uint8_t *top,
32 int size)
33{
34 pixel *filtered_left_p = (pixel *)filtered_left;
35 pixel *filtered_top_p = (pixel *)filtered_top;
36 const pixel *left_p = (const pixel *)left;
37 const pixel *top_p = (const pixel *)top;
38 int i;
39 int n = 2 * size;
40
41 filtered_left_p[n - 1] = left_p[n - 1];
42 filtered_top_p[n - 1] = top_p[n - 1];
43 for (i = n - 2; i >= 0; i--)
44 filtered_left_p[i] = (left_p[i + 1] + 2 * left_p[i] + left_p[i - 1] + 2) >> 2;
45 filtered_top_p[-1] =
46 filtered_left_p[-1] = (left_p[0] + 2 * left_p[-1] + top_p[0] + 2) >> 2;
47 for (i = n - 2; i >= 0; i--)
48 filtered_top_p[i] = (top_p[i + 1] + 2 * top_p[i] + top_p[i - 1] + 2) >> 2;
49}
50
51static void FUNC(ref_filter_strong)(uint8_t *filtered_top,
52 uint8_t *left,
53 const uint8_t *top)
54{
55 pixel *filtered_top_p = (pixel *)filtered_top;
56 pixel *left_p = (pixel *)left;
57 const pixel *top_p = (const pixel *)top;
58 int i;
59
60 filtered_top_p[-1] = top_p[-1];
61 filtered_top_p[63] = top_p[63];
62 for (i = 0; i < 63; i++)
63 filtered_top_p[i] = ((64 - (i + 1)) * top_p[-1] +
64 (i + 1) * top_p[63] + 32) >> 6;
65 for (i = 0; i < 63; i++)
66 left_p[i] = ((64 - (i + 1)) * left_p[-1] +
67 (i + 1) * left_p[63] + 32) >> 6;
68}
69
70#define POS(x, y) src[(x) + stride * (y)]
71
73 const HEVCPPS *pps,
74 int x0, int y0,
75 int log2_size, int c_idx)
76{
77#define PU(x) \
78 ((x) >> sps->log2_min_pu_size)
79#define MVF(x, y) \
80 (s->cur_frame->tab_mvf[(x) + (y) * min_pu_width])
81#define MVF_PU(x, y) \
82 MVF(PU(x0 + ((x) * (1 << hshift))), PU(y0 + ((y) * (1 << vshift))))
83#define IS_INTRA(x, y) \
84 (MVF_PU(x, y).pred_flag == PF_INTRA)
85#define MIN_TB_ADDR_ZS(x, y) \
86 pps->min_tb_addr_zs[(y) * (sps->tb_mask+2) + (x)]
87#define EXTEND(ptr, val, len) \
88do { \
89 pixel4 pix = PIXEL_SPLAT_X4(val); \
90 for (i = 0; i < (len); i += 4) \
91 AV_WN4P(ptr + i, pix); \
92} while (0)
93
94#define EXTEND_RIGHT_CIP(ptr, start, length) \
95 for (i = start; i < (start) + (length); i += 4) \
96 if (!IS_INTRA(i, -1)) \
97 AV_WN4P(&ptr[i], a); \
98 else \
99 a = PIXEL_SPLAT_X4(ptr[i+3])
100#define EXTEND_LEFT_CIP(ptr, start, length) \
101 for (i = start; i > (start) - (length); i--) \
102 if (!IS_INTRA(i - 1, -1)) \
103 ptr[i - 1] = ptr[i]
104#define EXTEND_UP_CIP(ptr, start, length) \
105 for (i = (start); i > (start) - (length); i -= 4) \
106 if (!IS_INTRA(-1, i - 3)) \
107 AV_WN4P(&ptr[i - 3], a); \
108 else \
109 a = PIXEL_SPLAT_X4(ptr[i - 3])
110#define EXTEND_DOWN_CIP(ptr, start, length) \
111 for (i = start; i < (start) + (length); i += 4) \
112 if (!IS_INTRA(-1, i)) \
113 AV_WN4P(&ptr[i], a); \
114 else \
115 a = PIXEL_SPLAT_X4(ptr[i + 3])
116
117 const HEVCSPS *const sps = pps->sps;
118 const HEVCContext *const s = lc->parent;
119 int i;
120 int hshift = sps->hshift[c_idx];
121 int vshift = sps->vshift[c_idx];
122 int size = (1 << log2_size);
123 int size_in_luma_h = size << hshift;
124 int size_in_tbs_h = size_in_luma_h >> sps->log2_min_tb_size;
125 int size_in_luma_v = size << vshift;
126 int size_in_tbs_v = size_in_luma_v >> sps->log2_min_tb_size;
127 int x = x0 >> hshift;
128 int y = y0 >> vshift;
129 int x_tb = (x0 >> sps->log2_min_tb_size) & sps->tb_mask;
130 int y_tb = (y0 >> sps->log2_min_tb_size) & sps->tb_mask;
131 int spin = c_idx && !size_in_tbs_v && ((2 * y0) & (1 << sps->log2_min_tb_size));
132
133 int cur_tb_addr = MIN_TB_ADDR_ZS(x_tb, y_tb);
134
135 ptrdiff_t stride = s->cur_frame->f->linesize[c_idx] / sizeof(pixel);
136 pixel *src = (pixel*)s->cur_frame->f->data[c_idx] + x + y * stride;
137
138 int min_pu_width = sps->min_pu_width;
139
140 enum IntraPredMode mode = c_idx ? lc->tu.intra_pred_mode_c :
141 lc->tu.intra_pred_mode;
142 pixel4 a;
143 // Extra 16 bytes of padding allow NEON 3-tap filter to do
144 // 32-byte loads without reading past the allocation.
145 pixel left_array[2 * MAX_TB_SIZE + 1 + 16];
146 pixel filtered_left_array[2 * MAX_TB_SIZE + 1];
147 pixel top_array[2 * MAX_TB_SIZE + 1 + 16];
148 pixel filtered_top_array[2 * MAX_TB_SIZE + 1];
149
150 pixel *left = left_array + 1;
151 pixel *top = top_array + 1;
152 pixel *filtered_left = filtered_left_array + 1;
153 pixel *filtered_top = filtered_top_array + 1;
154 int cand_bottom_left = lc->na.cand_bottom_left && cur_tb_addr > MIN_TB_ADDR_ZS( x_tb - 1, (y_tb + size_in_tbs_v + spin) & sps->tb_mask);
155 int cand_left = lc->na.cand_left;
156 int cand_up_left = lc->na.cand_up_left;
157 int cand_up = lc->na.cand_up;
158 int cand_up_right = lc->na.cand_up_right && !spin && cur_tb_addr > MIN_TB_ADDR_ZS((x_tb + size_in_tbs_h) & sps->tb_mask, y_tb - 1);
159
160 int bottom_left_size = (FFMIN(y0 + 2 * size_in_luma_v, sps->height) -
161 (y0 + size_in_luma_v)) >> vshift;
162 int top_right_size = (FFMIN(x0 + 2 * size_in_luma_h, sps->width) -
163 (x0 + size_in_luma_h)) >> hshift;
164
165 if (pps->constrained_intra_pred_flag == 1) {
166 int size_in_luma_pu_v = PU(size_in_luma_v);
167 int size_in_luma_pu_h = PU(size_in_luma_h);
168 int on_pu_edge_x = !av_zero_extend(x0, sps->log2_min_pu_size);
169 int on_pu_edge_y = !av_zero_extend(y0, sps->log2_min_pu_size);
170 if (!size_in_luma_pu_h)
171 size_in_luma_pu_h++;
172 if (cand_bottom_left == 1 && on_pu_edge_x) {
173 int x_left_pu = PU(x0 - 1);
174 int y_bottom_pu = PU(y0 + size_in_luma_v);
175 int max = FFMIN(size_in_luma_pu_v, sps->min_pu_height - y_bottom_pu);
176 cand_bottom_left = 0;
177 for (i = 0; i < max; i += 2)
178 cand_bottom_left |= (MVF(x_left_pu, y_bottom_pu + i).pred_flag == PF_INTRA);
179 }
180 if (cand_left == 1 && on_pu_edge_x) {
181 int x_left_pu = PU(x0 - 1);
182 int y_left_pu = PU(y0);
183 int max = FFMIN(size_in_luma_pu_v, sps->min_pu_height - y_left_pu);
184 cand_left = 0;
185 for (i = 0; i < max; i += 2)
186 cand_left |= (MVF(x_left_pu, y_left_pu + i).pred_flag == PF_INTRA);
187 }
188 if (cand_up_left == 1) {
189 int x_left_pu = PU(x0 - 1);
190 int y_top_pu = PU(y0 - 1);
191 cand_up_left = MVF(x_left_pu, y_top_pu).pred_flag == PF_INTRA;
192 }
193 if (cand_up == 1 && on_pu_edge_y) {
194 int x_top_pu = PU(x0);
195 int y_top_pu = PU(y0 - 1);
196 int max = FFMIN(size_in_luma_pu_h, sps->min_pu_width - x_top_pu);
197 cand_up = 0;
198 for (i = 0; i < max; i += 2)
199 cand_up |= (MVF(x_top_pu + i, y_top_pu).pred_flag == PF_INTRA);
200 }
201 if (cand_up_right == 1 && on_pu_edge_y) {
202 int y_top_pu = PU(y0 - 1);
203 int x_right_pu = PU(x0 + size_in_luma_h);
204 int max = FFMIN(size_in_luma_pu_h, sps->min_pu_width - x_right_pu);
205 cand_up_right = 0;
206 for (i = 0; i < max; i += 2)
207 cand_up_right |= (MVF(x_right_pu + i, y_top_pu).pred_flag == PF_INTRA);
208 }
209 memset(left, 128, 2 * MAX_TB_SIZE*sizeof(pixel));
210 memset(top , 128, 2 * MAX_TB_SIZE*sizeof(pixel));
211 top[-1] = 128;
212 }
213 if (cand_up_left) {
214 left[-1] = POS(-1, -1);
215 top[-1] = left[-1];
216 }
217 if (cand_up)
218 memcpy(top, src - stride, size * sizeof(pixel));
219 if (cand_up_right) {
220 memcpy(top + size, src - stride + size, size * sizeof(pixel));
221 EXTEND(top + size + top_right_size, POS(size + top_right_size - 1, -1),
222 size - top_right_size);
223 }
224 if (cand_left)
225 for (i = 0; i < size; i++)
226 left[i] = POS(-1, i);
227 if (cand_bottom_left) {
228 for (i = size; i < size + bottom_left_size; i++)
229 left[i] = POS(-1, i);
230 EXTEND(left + size + bottom_left_size, POS(-1, size + bottom_left_size - 1),
231 size - bottom_left_size);
232 }
233
234 if (pps->constrained_intra_pred_flag == 1) {
235 if (cand_bottom_left || cand_left || cand_up_left || cand_up || cand_up_right) {
236 int size_max_x = x0 + ((2 * size) << hshift) < sps->width ?
237 2 * size : (sps->width - x0) >> hshift;
238 int size_max_y = y0 + ((2 * size) << vshift) < sps->height ?
239 2 * size : (sps->height - y0) >> vshift;
240 int j = size + (cand_bottom_left? bottom_left_size: 0) -1;
241 if (!cand_up_right) {
242 size_max_x = x0 + ((size) << hshift) < sps->width ?
243 size : (sps->width - x0) >> hshift;
244 }
245 if (!cand_bottom_left) {
246 size_max_y = y0 + (( size) << vshift) < sps->height ?
247 size : (sps->height - y0) >> vshift;
248 }
249 if (cand_bottom_left || cand_left || cand_up_left) {
250 while (j > -1 && !IS_INTRA(-1, j))
251 j--;
252 if (!IS_INTRA(-1, j)) {
253 j = 0;
254 while (j < size_max_x && !IS_INTRA(j, -1))
255 j++;
256 EXTEND_LEFT_CIP(top, j, j + 1);
257 left[-1] = top[-1];
258 }
259 } else {
260 j = 0;
261 while (j < size_max_x && !IS_INTRA(j, -1))
262 j++;
263 if (j > 0) {
264 EXTEND_LEFT_CIP(top, j, j);
265 top[-1] = top[0];
266 }
267 left[-1] = top[-1];
268 }
269 left[-1] = top[-1];
270 if (cand_bottom_left || cand_left) {
271 a = PIXEL_SPLAT_X4(left[-1]);
272 EXTEND_DOWN_CIP(left, 0, size_max_y);
273 }
274 if (!cand_left)
275 EXTEND(left, left[-1], size);
276 if (!cand_bottom_left)
277 EXTEND(left + size, left[size - 1], size);
278 if (x0 != 0 && y0 != 0) {
279 a = PIXEL_SPLAT_X4(left[size_max_y - 1]);
280 EXTEND_UP_CIP(left, size_max_y - 1, size_max_y);
281 if (!IS_INTRA(-1, - 1))
282 left[-1] = left[0];
283 } else if (x0 == 0) {
284 EXTEND(left, 0, size_max_y);
285 } else {
286 a = PIXEL_SPLAT_X4(left[size_max_y - 1]);
287 EXTEND_UP_CIP(left, size_max_y - 1, size_max_y);
288 }
289 top[-1] = left[-1];
290 if (y0 != 0) {
291 a = PIXEL_SPLAT_X4(left[-1]);
292 EXTEND_RIGHT_CIP(top, 0, size_max_x);
293 }
294 // Samples past the picture edge repeat the substituted last
295 // sample, not the one read before the substitution.
296 if (cand_bottom_left && bottom_left_size < size)
297 EXTEND(left + size + bottom_left_size, left[size + bottom_left_size - 1],
298 size - bottom_left_size);
299 if (cand_up_right && top_right_size < size)
300 EXTEND(top + size + top_right_size, top[size + top_right_size - 1],
301 size - top_right_size);
302 }
303 }
304 // Infer the unavailable samples
305 if (!cand_bottom_left) {
306 if (cand_left) {
307 EXTEND(left + size, left[size - 1], size);
308 } else if (cand_up_left) {
309 EXTEND(left, left[-1], 2 * size);
310 cand_left = 1;
311 } else if (cand_up) {
312 left[-1] = top[0];
313 EXTEND(left, left[-1], 2 * size);
314 cand_up_left = 1;
315 cand_left = 1;
316 } else if (cand_up_right) {
317 EXTEND(top, top[size], size);
318 left[-1] = top[size];
319 EXTEND(left, left[-1], 2 * size);
320 cand_up = 1;
321 cand_up_left = 1;
322 cand_left = 1;
323 } else { // No samples available
324 left[-1] = (1 << (BIT_DEPTH - 1));
325 EXTEND(top, left[-1], 2 * size);
326 EXTEND(left, left[-1], 2 * size);
327 }
328 }
329
330 if (!cand_left)
332 if (!cand_up_left) {
333 left[-1] = left[0];
334 }
335 if (!cand_up)
336 EXTEND(top, left[-1], size);
337 if (!cand_up_right)
338 EXTEND(top + size, top[size - 1], size);
339
340 top[-1] = left[-1];
341
342 // Filtering process
343 if (!sps->intra_smoothing_disabled && (c_idx == 0 || sps->chroma_format_idc == 3)) {
344 if (mode != INTRA_DC && size != 4){
345 int intra_hor_ver_dist_thresh[] = { 7, 1, 0 };
346 int min_dist_vert_hor = FFMIN(FFABS((int)(mode - 26U)),
347 FFABS((int)(mode - 10U)));
348 if (min_dist_vert_hor > intra_hor_ver_dist_thresh[log2_size - 3]) {
349 int threshold = 1 << (BIT_DEPTH - 5);
350 if (sps->strong_intra_smoothing_enabled && c_idx == 0 &&
351 log2_size == 5 &&
352 FFABS(top[-1] + top[63] - 2 * top[31]) < threshold &&
353 FFABS(left[-1] + left[63] - 2 * left[31]) < threshold) {
354 s->hpc.ref_filter_strong((uint8_t *)filtered_top,
355 (uint8_t *)left,
356 (const uint8_t *)top);
357 top = filtered_top;
358 } else {
359 s->hpc.ref_filter_3tap[log2_size - 3](
360 (uint8_t *)filtered_left, (uint8_t *)filtered_top,
361 (const uint8_t *)left, (const uint8_t *)top, size);
362 left = filtered_left;
363 top = filtered_top;
364 }
365 }
366 }
367 }
368
369 switch (mode) {
370 case INTRA_PLANAR:
371 s->hpc.pred_planar[log2_size - 2]((uint8_t *)src, (uint8_t *)top,
372 (uint8_t *)left, stride);
373 break;
374 case INTRA_DC:
375 s->hpc.pred_dc((uint8_t *)src, (uint8_t *)top,
376 (uint8_t *)left, stride, log2_size, c_idx);
377 break;
378 default:
379 s->hpc.pred_angular[log2_size - 2]((uint8_t *)src, (uint8_t *)top,
380 (uint8_t *)left, stride, c_idx,
381 mode);
382 break;
383 }
384}
385
386#define INTRA_PRED(size) \
387static void FUNC(intra_pred_ ## size)(HEVCLocalContext *lc, const HEVCPPS *pps, \
388 int x0, int y0, int c_idx) \
389{ \
390 FUNC(intra_pred)(lc, pps, x0, y0, size, c_idx); \
391}
392
393INTRA_PRED(2)
394INTRA_PRED(3)
395INTRA_PRED(4)
396INTRA_PRED(5)
397
398#undef INTRA_PRED
399
400static av_always_inline void FUNC(pred_planar)(uint8_t *_src, const uint8_t *_top,
401 const uint8_t *_left, ptrdiff_t stride,
402 int trafo_size)
403{
404 int x, y;
405 pixel *src = (pixel *)_src;
406 const pixel *top = (const pixel *)_top;
407 const pixel *left = (const pixel *)_left;
408 int size = 1 << trafo_size;
409 for (y = 0; y < size; y++)
410 for (x = 0; x < size; x++)
411 POS(x, y) = ((size - 1 - x) * left[y] + (x + 1) * top[size] +
412 (size - 1 - y) * top[x] + (y + 1) * left[size] + size) >> (trafo_size + 1);
413}
414
415#define PRED_PLANAR(size)\
416static void FUNC(pred_planar_ ## size)(uint8_t *src, const uint8_t *top, \
417 const uint8_t *left, ptrdiff_t stride) \
418{ \
419 FUNC(pred_planar)(src, top, left, stride, size + 2); \
420}
421
426
427#undef PRED_PLANAR
428
429static void FUNC(pred_dc)(uint8_t *_src, const uint8_t *_top,
430 const uint8_t *_left,
431 ptrdiff_t stride, int log2_size, int c_idx)
432{
433 int i, j, x, y;
434 int size = (1 << log2_size);
435 pixel *src = (pixel *)_src;
436 const pixel *top = (const pixel *)_top;
437 const pixel *left = (const pixel *)_left;
438 int dc = size;
439 pixel4 a;
440 for (i = 0; i < size; i++)
441 dc += left[i] + top[i];
442
443 dc >>= log2_size + 1;
444
445 a = PIXEL_SPLAT_X4(dc);
446
447 for (i = 0; i < size; i++)
448 for (j = 0; j < size; j+=4)
449 AV_WN4P(&POS(j, i), a);
450
451 if (c_idx == 0 && size < 32) {
452 POS(0, 0) = (left[0] + 2 * dc + top[0] + 2) >> 2;
453 for (x = 1; x < size; x++)
454 POS(x, 0) = (top[x] + 3 * dc + 2) >> 2;
455 for (y = 1; y < size; y++)
456 POS(0, y) = (left[y] + 3 * dc + 2) >> 2;
457 }
458}
459
461 const uint8_t *_top,
462 const uint8_t *_left,
463 ptrdiff_t stride, int c_idx,
464 int mode, int size)
465{
466 int x, y;
467 pixel *src = (pixel *)_src;
468 const pixel *top = (const pixel *)_top;
469 const pixel *left = (const pixel *)_left;
470
471 static const int intra_pred_angle[] = {
472 32, 26, 21, 17, 13, 9, 5, 2, 0, -2, -5, -9, -13, -17, -21, -26, -32,
473 -26, -21, -17, -13, -9, -5, -2, 0, 2, 5, 9, 13, 17, 21, 26, 32
474 };
475 static const int inv_angle[] = {
476 -4096, -1638, -910, -630, -482, -390, -315, -256, -315, -390, -482,
477 -630, -910, -1638, -4096
478 };
479
480 int angle = intra_pred_angle[mode - 2];
481 pixel ref_array[3 * MAX_TB_SIZE + 4];
482 pixel *ref_tmp = ref_array + size;
483 const pixel *ref;
484 int last = (size * angle) >> 5;
485
486 if (mode >= 18) {
487 ref = top - 1;
488 if (angle < 0 && last < -1) {
489 for (x = 0; x <= size; x += 4)
490 AV_WN4P(&ref_tmp[x], AV_RN4P(&top[x - 1]));
491 for (x = last; x <= -1; x++)
492 ref_tmp[x] = left[-1 + ((x * inv_angle[mode - 11] + 128) >> 8)];
493 ref = ref_tmp;
494 }
495
496 for (y = 0; y < size; y++) {
497 int idx = ((y + 1) * angle) >> 5;
498 int fact = ((y + 1) * angle) & 31;
499 if (fact) {
500 for (x = 0; x < size; x += 4) {
501 POS(x , y) = ((32 - fact) * ref[x + idx + 1] +
502 fact * ref[x + idx + 2] + 16) >> 5;
503 POS(x + 1, y) = ((32 - fact) * ref[x + 1 + idx + 1] +
504 fact * ref[x + 1 + idx + 2] + 16) >> 5;
505 POS(x + 2, y) = ((32 - fact) * ref[x + 2 + idx + 1] +
506 fact * ref[x + 2 + idx + 2] + 16) >> 5;
507 POS(x + 3, y) = ((32 - fact) * ref[x + 3 + idx + 1] +
508 fact * ref[x + 3 + idx + 2] + 16) >> 5;
509 }
510 } else {
511 for (x = 0; x < size; x += 4)
512 AV_WN4P(&POS(x, y), AV_RN4P(&ref[x + idx + 1]));
513 }
514 }
515 if (mode == 26 && c_idx == 0 && size < 32) {
516 for (y = 0; y < size; y++)
517 POS(0, y) = av_clip_pixel(top[0] + ((left[y] - left[-1]) >> 1));
518 }
519 } else {
520 ref = left - 1;
521 if (angle < 0 && last < -1) {
522 for (x = 0; x <= size; x += 4)
523 AV_WN4P(&ref_tmp[x], AV_RN4P(&left[x - 1]));
524 for (x = last; x <= -1; x++)
525 ref_tmp[x] = top[-1 + ((x * inv_angle[mode - 11] + 128) >> 8)];
526 ref = ref_tmp;
527 }
528
529 for (x = 0; x < size; x++) {
530 int idx = ((x + 1) * angle) >> 5;
531 int fact = ((x + 1) * angle) & 31;
532 if (fact) {
533 for (y = 0; y < size; y++) {
534 POS(x, y) = ((32 - fact) * ref[y + idx + 1] +
535 fact * ref[y + idx + 2] + 16) >> 5;
536 }
537 } else {
538 for (y = 0; y < size; y++)
539 POS(x, y) = ref[y + idx + 1];
540 }
541 }
542 if (mode == 10 && c_idx == 0 && size < 32) {
543 for (x = 0; x < size; x += 4) {
544 POS(x, 0) = av_clip_pixel(left[0] + ((top[x ] - top[-1]) >> 1));
545 POS(x + 1, 0) = av_clip_pixel(left[0] + ((top[x + 1] - top[-1]) >> 1));
546 POS(x + 2, 0) = av_clip_pixel(left[0] + ((top[x + 2] - top[-1]) >> 1));
547 POS(x + 3, 0) = av_clip_pixel(left[0] + ((top[x + 3] - top[-1]) >> 1));
548 }
549 }
550 }
551}
552
553void FUNC(ff_hevc_pred_angular_0)(uint8_t *src, const uint8_t *top,
554 const uint8_t *left,
555 ptrdiff_t stride, int c_idx, int mode)
556{
557 FUNC(pred_angular)(src, top, left, stride, c_idx, mode, 1 << 2);
558}
559
560void FUNC(ff_hevc_pred_angular_1)(uint8_t *src, const uint8_t *top,
561 const uint8_t *left,
562 ptrdiff_t stride, int c_idx, int mode)
563{
564 FUNC(pred_angular)(src, top, left, stride, c_idx, mode, 1 << 3);
565}
566
567void FUNC(ff_hevc_pred_angular_2)(uint8_t *src, const uint8_t *top,
568 const uint8_t *left,
569 ptrdiff_t stride, int c_idx, int mode)
570{
571 FUNC(pred_angular)(src, top, left, stride, c_idx, mode, 1 << 4);
572}
573
574void FUNC(ff_hevc_pred_angular_3)(uint8_t *src, const uint8_t *top,
575 const uint8_t *left,
576 ptrdiff_t stride, int c_idx, int mode)
577{
578 FUNC(pred_angular)(src, top, left, stride, c_idx, mode, 1 << 5);
579}
580
581#undef EXTEND_LEFT_CIP
582#undef EXTEND_RIGHT_CIP
583#undef EXTEND_UP_CIP
584#undef EXTEND_DOWN_CIP
585#undef IS_INTRA
586#undef MVF_PU
587#undef MVF
588#undef PU
589#undef EXTEND
590#undef MIN_TB_ADDR_ZS
591#undef POS
uint8_t ptrdiff_t const uint8_t * _src
Definition dsp.h:66
#define BIT_DEPTH
Definition dsp_init.c:121
static double fact(double i)
Definition af_aiir.c:936
#define av_clip_pixel(a)
#define FUNC(a)
#define pixel4
#define PIXEL_SPLAT_X4(x)
#define AV_RN4P
#define AV_WN4P
#define pixel
static int BS_FUNC left(const BSCTX *bc)
Return the number of the bits left in a buffer.
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
static int FUNC sps(CodedBitstreamContext *ctx, RWContext *rw, H264RawSPS *current)
#define s(width, name)
Definition cbs_vp9.c:198
#define av_zero_extend
Definition common.h:151
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
Definition common.h:74
#define max(a, b)
uint64_t pps
Definition dovi_rpuenc.c:36
int a
@ PF_INTRA
Definition hevcdec.h:118
IntraPredMode
Definition hevcdec.h:124
@ INTRA_DC
Definition hevcdec.h:126
@ INTRA_PLANAR
Definition hevcdec.h:125
#define MAX_TB_SIZE
Definition hevcdec.h:47
#define av_always_inline
Definition attributes.h:72
#define FFMIN(a, b)
Definition macros.h:49
void FUNC ff_hevc_pred_angular_3(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int c_idx, int mode)
#define EXTEND_UP_CIP(ptr, start, length)
static av_always_inline void FUNC pred_angular(uint8_t *_src, const uint8_t *_top, const uint8_t *_left, ptrdiff_t stride, int c_idx, int mode, int size)
static av_always_inline void FUNC intra_pred(HEVCLocalContext *lc, const HEVCPPS *pps, int x0, int y0, int log2_size, int c_idx)
#define EXTEND(ptr, val, len)
#define EXTEND_DOWN_CIP(ptr, start, length)
#define PU(x)
#define EXTEND_RIGHT_CIP(ptr, start, length)
void FUNC ff_hevc_pred_angular_1(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int c_idx, int mode)
static void FUNC pred_dc(uint8_t *_src, const uint8_t *_top, const uint8_t *_left, ptrdiff_t stride, int log2_size, int c_idx)
static av_always_inline void FUNC pred_planar(uint8_t *_src, const uint8_t *_top, const uint8_t *_left, ptrdiff_t stride, int trafo_size)
static void FUNC ref_filter_strong(uint8_t *filtered_top, uint8_t *left, const uint8_t *top)
#define POS(x, y)
#define INTRA_PRED(size)
static void FUNC ref_filter_3tap(uint8_t *filtered_left, uint8_t *filtered_top, const uint8_t *left, const uint8_t *top, int size)
#define MVF(x, y)
#define MIN_TB_ADDR_ZS(x, y)
#define EXTEND_LEFT_CIP(ptr, start, length)
#define PRED_PLANAR(size)
void FUNC ff_hevc_pred_angular_2(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int c_idx, int mode)
#define IS_INTRA(x, y)
void FUNC ff_hevc_pred_angular_0(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int c_idx, int mode)
Definition ps.h:371
Definition ps.h:252
Definition swscale.c:82
#define stride
#define src
Definition vp8dsp.c:248
static int ref[MAX_W *MAX_W]
int size