Go to the documentation of this file.
60 const uint32_t
a = 0x7F7F7F7F
U;
72 const uint32_t
a = 0x81818181
U;
86 uint32_t v =
PACK_4U8((lt + 2*t0 + t1 + 2) >> 2,
87 (t0 + 2*t1 + t2 + 2) >> 2,
88 (t1 + 2*t2 + t3 + 2) >> 2,
89 (t2 + 2*t3 + t4 + 2) >> 2);
141 src[0+0*
stride]=(t0 + t2 + 2*t1 + 2 + l0 + l2 + 2*l1 + 2)>>3;
143 src[0+1*
stride]=(t1 + t3 + 2*t2 + 2 + l1 + l3 + 2*l2 + 2)>>3;
146 src[0+2*
stride]=(t2 + t4 + 2*t3 + 2 + l2 + l4 + 2*l3 + 2)>>3;
150 src[0+3*
stride]=(t3 + t5 + 2*t4 + 2 + l3 + l5 + 2*l4 + 2)>>3;
153 src[1+3*
stride]=(t4 + t6 + 2*t5 + 2 + l4 + l6 + 2*l5 + 2)>>3;
155 src[2+3*
stride]=(t5 + t7 + 2*t6 + 2 + l5 + l7 + 2*l6 + 2)>>3;
156 src[3+3*
stride]=(t6 + t7 + 1 + l6 + l7 + 1)>>2;
160 const uint8_t *topright,
167 src[0+0*
stride]=(t0 + t2 + 2*t1 + 2 + l0 + l2 + 2*l1 + 2)>>3;
169 src[0+1*
stride]=(t1 + t3 + 2*t2 + 2 + l1 + l3 + 2*l2 + 2)>>3;
172 src[0+2*
stride]=(t2 + t4 + 2*t3 + 2 + l2 + 3*l3 + 2)>>3;
176 src[0+3*
stride]=(t3 + t5 + 2*t4 + 2 + l3*4 + 2)>>3;
179 src[1+3*
stride]=(t4 + t6 + 2*t5 + 2 + l3*4 + 2)>>3;
181 src[2+3*
stride]=(t5 + t7 + 2*t6 + 2 + l3*4 + 2)>>3;
182 src[3+3*
stride]=(t6 + t7 + 1 + 2*l3 + 1)>>2;
187 const int l0,
const int l1,
const int l2,
188 const int l3,
const int l4)
193 src[0+0*
stride]=(2*t0 + 2*t1 + l1 + 2*l2 + l3 + 4)>>3;
201 src[0+1*
stride]=(t0 + 2*t1 + t2 + l2 + 2*l3 + l4 + 4)>>3;
221 const uint8_t *topright,
261 src[0+0*
stride]=(t1 + 2*t2 + t3 + 2*l0 + 2*l1 + 4)>>3;
262 src[1+0*
stride]=(t2 + 2*t3 + t4 + l0 + 2*l1 + l2 + 4)>>3;
264 src[0+1*
stride]=(t3 + 2*t4 + t5 + 2*l1 + 2*l2 + 4)>>3;
266 src[1+1*
stride]=(t4 + 2*t5 + t6 + l1 + 2*l2 + l3 + 4)>>3;
268 src[0+2*
stride]=(t5 + 2*t6 + t7 + 2*l2 + 2*l3 + 4)>>3;
270 src[1+2*
stride]=(t6 + 3*t7 + l2 + 3*l3 + 4)>>3;
274 src[2+2*
stride]=(t6 + t7 + l3 + l4 + 2)>>2;
280 const uint8_t *topright,
287 src[0+0*
stride]=(t1 + 2*t2 + t3 + 2*l0 + 2*l1 + 4)>>3;
288 src[1+0*
stride]=(t2 + 2*t3 + t4 + l0 + 2*l1 + l2 + 4)>>3;
290 src[0+1*
stride]=(t3 + 2*t4 + t5 + 2*l1 + 2*l2 + 4)>>3;
292 src[1+1*
stride]=(t4 + 2*t5 + t6 + l1 + 2*l2 + l3 + 4)>>3;
294 src[0+2*
stride]=(t5 + 2*t6 + t7 + 2*l2 + 2*l3 + 4)>>3;
296 src[1+2*
stride]=(t6 + 3*t7 + l2 + 3*l3 + 4)>>3;
312 for (y = 0; y < 4; y++) {
313 const uint8_t *cm_in =
cm +
src[-1];
314 src[0] = cm_in[top[0]];
315 src[1] = cm_in[top[1]];
316 src[2] = cm_in[top[2]];
317 src[3] = cm_in[top[3]];
324 pred16x16_plane_compat_8_c(
src,
stride, 1, 0);
329 pred16x16_plane_compat_8_c(
src,
stride, 0, 1);
338 for (y = 0; y < 16; y++) {
339 const uint8_t *cm_in =
cm +
src[-1];
340 src[0] = cm_in[top[0]];
341 src[1] = cm_in[top[1]];
342 src[2] = cm_in[top[2]];
343 src[3] = cm_in[top[3]];
344 src[4] = cm_in[top[4]];
345 src[5] = cm_in[top[5]];
346 src[6] = cm_in[top[6]];
347 src[7] = cm_in[top[7]];
348 src[8] = cm_in[top[8]];
349 src[9] = cm_in[top[9]];
350 src[10] = cm_in[top[10]];
351 src[11] = cm_in[top[11]];
352 src[12] = cm_in[top[12]];
353 src[13] = cm_in[top[13]];
354 src[14] = cm_in[top[14]];
355 src[15] = cm_in[top[15]];
368 dc0= 0x01010101*((dc0 + 4)>>3);
384 dc0= 0x01010101*((dc0 + 4)>>3);
402 dc0= 0x01010101*((dc0 + 8)>>4);
420 for (y = 0; y < 8; y++) {
421 const uint8_t *cm_in =
cm +
src[-1];
422 src[0] = cm_in[top[0]];
423 src[1] = cm_in[top[1]];
424 src[2] = cm_in[top[2]];
425 src[3] = cm_in[top[3]];
426 src[4] = cm_in[top[4]];
427 src[5] = cm_in[top[5]];
428 src[6] = cm_in[top[6]];
429 src[7] = cm_in[top[7]];
439 int chroma_format_idc)
443 #define FUNC(a, depth) a ## _ ## depth
444 #define FUNCC(a, depth) a ## _ ## depth ## _c
445 #define FUNCD(a) a ## _c
447 #define H264_PRED(depth) \
448 h->pred4x4[VERT_PRED ] = FUNCC(pred4x4_vertical, depth);\
449 h->pred4x4[HOR_PRED ] = FUNCC(pred4x4_horizontal, depth);\
450 h->pred4x4[DC_PRED ] = FUNCC(pred4x4_dc, depth);\
451 h->pred4x4[DIAG_DOWN_LEFT_PRED ] = FUNCC(pred4x4_down_left, depth);\
452 h->pred4x4[DIAG_DOWN_RIGHT_PRED] = FUNCC(pred4x4_down_right, depth);\
453 h->pred4x4[VERT_RIGHT_PRED ] = FUNCC(pred4x4_vertical_right, depth);\
454 h->pred4x4[HOR_DOWN_PRED ] = FUNCC(pred4x4_horizontal_down, depth);\
455 h->pred4x4[VERT_LEFT_PRED ] = FUNCC(pred4x4_vertical_left, depth);\
456 h->pred4x4[HOR_UP_PRED ] = FUNCC(pred4x4_horizontal_up, depth);\
457 h->pred4x4[LEFT_DC_PRED ] = FUNCC(pred4x4_left_dc, depth);\
458 h->pred4x4[TOP_DC_PRED ] = FUNCC(pred4x4_top_dc, depth);\
459 if (depth > 8 || codec_id != AV_CODEC_ID_VP8)\
460 h->pred4x4[DC_128_PRED ] = FUNCC(pred4x4_128_dc, depth);\
462 h->pred8x8l[VERT_PRED ]= FUNCC(pred8x8l_vertical , depth);\
463 h->pred8x8l[HOR_PRED ]= FUNCC(pred8x8l_horizontal , depth);\
464 h->pred8x8l[DC_PRED ]= FUNCC(pred8x8l_dc , depth);\
465 h->pred8x8l[DIAG_DOWN_LEFT_PRED ]= FUNCC(pred8x8l_down_left , depth);\
466 h->pred8x8l[DIAG_DOWN_RIGHT_PRED]= FUNCC(pred8x8l_down_right , depth);\
467 h->pred8x8l[VERT_RIGHT_PRED ]= FUNCC(pred8x8l_vertical_right , depth);\
468 h->pred8x8l[HOR_DOWN_PRED ]= FUNCC(pred8x8l_horizontal_down , depth);\
469 h->pred8x8l[VERT_LEFT_PRED ]= FUNCC(pred8x8l_vertical_left , depth);\
470 h->pred8x8l[HOR_UP_PRED ]= FUNCC(pred8x8l_horizontal_up , depth);\
471 h->pred8x8l[LEFT_DC_PRED ]= FUNCC(pred8x8l_left_dc , depth);\
472 h->pred8x8l[TOP_DC_PRED ]= FUNCC(pred8x8l_top_dc , depth);\
473 h->pred8x8l[DC_128_PRED ]= FUNCC(pred8x8l_128_dc , depth);\
475 if (chroma_format_idc <= 1) {\
476 h->pred8x8[VERT_PRED8x8 ]= FUNCC(pred8x8_vertical , depth);\
477 h->pred8x8[HOR_PRED8x8 ]= FUNCC(pred8x8_horizontal , depth);\
478 h->pred8x8[PLANE_PRED8x8] = FUNCC(pred8x8_plane, depth);\
480 h->pred8x8[VERT_PRED8x8 ]= FUNCC(pred8x16_vertical , depth);\
481 h->pred8x8[HOR_PRED8x8 ]= FUNCC(pred8x16_horizontal , depth);\
482 h->pred8x8[PLANE_PRED8x8] = FUNCC(pred8x16_plane, depth);\
484 if (depth > 8 || (codec_id != AV_CODEC_ID_RV40 && \
485 codec_id != AV_CODEC_ID_VP7 && \
486 codec_id != AV_CODEC_ID_VP8)) { \
487 if (chroma_format_idc <= 1) {\
488 h->pred8x8[DC_PRED8x8 ]= FUNCC(pred8x8_dc , depth);\
489 h->pred8x8[LEFT_DC_PRED8x8]= FUNCC(pred8x8_left_dc , depth);\
490 h->pred8x8[TOP_DC_PRED8x8 ]= FUNCC(pred8x8_top_dc , depth);\
491 h->pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l0t, depth);\
492 h->pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0lt, depth);\
493 h->pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l00, depth);\
494 h->pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0l0, depth);\
496 h->pred8x8[DC_PRED8x8 ]= FUNCC(pred8x16_dc , depth);\
497 h->pred8x8[LEFT_DC_PRED8x8]= FUNCC(pred8x16_left_dc , depth);\
498 h->pred8x8[TOP_DC_PRED8x8 ]= FUNCC(pred8x16_top_dc , depth);\
499 h->pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_l0t, depth);\
500 h->pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_0lt, depth);\
501 h->pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_l00, depth);\
502 h->pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_0l0, depth);\
505 h->pred8x8[DC_PRED8x8 ]= FUNCD(pred8x8_dc_rv40);\
506 h->pred8x8[LEFT_DC_PRED8x8]= FUNCD(pred8x8_left_dc_rv40);\
507 h->pred8x8[TOP_DC_PRED8x8 ]= FUNCD(pred8x8_top_dc_rv40);\
509 if (chroma_format_idc <= 1) {\
510 h->pred8x8[DC_128_PRED8x8 ]= FUNCC(pred8x8_128_dc , depth);\
512 h->pred8x8[DC_128_PRED8x8 ]= FUNCC(pred8x16_128_dc , depth);\
515 h->pred16x16[DC_PRED8x8 ]= FUNCC(pred16x16_dc , depth);\
516 h->pred16x16[VERT_PRED8x8 ]= FUNCC(pred16x16_vertical , depth);\
517 h->pred16x16[HOR_PRED8x8 ]= FUNCC(pred16x16_horizontal , depth);\
518 h->pred16x16[PLANE_PRED8x8 ]= FUNCC(pred16x16_plane , depth);\
519 h->pred16x16[LEFT_DC_PRED8x8]= FUNCC(pred16x16_left_dc , depth);\
520 h->pred16x16[TOP_DC_PRED8x8 ]= FUNCC(pred16x16_top_dc , depth);\
521 h->pred16x16[DC_128_PRED8x8 ]= FUNCC(pred16x16_128_dc , depth);\
524 h->pred4x4_add [VERT_PRED ]= FUNCC(pred4x4_vertical_add , depth);\
525 h->pred4x4_add [ HOR_PRED ]= FUNCC(pred4x4_horizontal_add , depth);\
526 h->pred8x8l_add [VERT_PRED ]= FUNCC(pred8x8l_vertical_add , depth);\
527 h->pred8x8l_add [ HOR_PRED ]= FUNCC(pred8x8l_horizontal_add , depth);\
528 h->pred8x8l_filter_add [VERT_PRED ]= FUNCC(pred8x8l_vertical_filter_add , depth);\
529 h->pred8x8l_filter_add [ HOR_PRED ]= FUNCC(pred8x8l_horizontal_filter_add , depth);\
530 if (chroma_format_idc <= 1) {\
531 h->pred8x8_add[VERT_PRED8x8] = FUNCC(pred8x8_vertical_add, depth);\
532 h->pred8x8_add[ HOR_PRED8x8] = FUNCC(pred8x8_horizontal_add, depth);\
534 h->pred8x8_add [VERT_PRED8x8]= FUNCC(pred8x16_vertical_add , depth);\
535 h->pred8x8_add [ HOR_PRED8x8]= FUNCC(pred8x16_horizontal_add , depth);\
537 h->pred16x16_add[VERT_PRED8x8]= FUNCC(pred16x16_vertical_add , depth);\
538 h->pred16x16_add[ HOR_PRED8x8]= FUNCC(pred16x16_horizontal_add , depth);\
#define PACK_4U8(a, b, c, d)
av_cold void ff_h264_pred_init_aarch64(H264PredContext *h, int codec_id, int bit_depth, const int chroma_format_idc)
#define HOR_VP8_PRED
unaveraged version of HOR_PRED, see
static void pred16x16_tm_vp8_c(uint8_t *src, ptrdiff_t stride)
static void bit_depth(AudioStatsContext *s, const uint64_t *const mask, uint8_t *depth)
#define VERT_VP8_PRED
for VP8, VERT_PRED is the average of
static void pred4x4_vertical_left_vp8_c(uint8_t *src, const uint8_t *topright, ptrdiff_t stride)
static void pred4x4_down_left_rv40_c(uint8_t *src, const uint8_t *topright, ptrdiff_t stride)
#define VERT_LEFT_PRED_RV40_NODOWN
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static void FUNCC() pred4x4_horizontal(uint8_t *_src, const uint8_t *topright, ptrdiff_t _stride)
#define LOAD_TOP_RIGHT_EDGE
static void pred4x4_tm_vp8_c(uint8_t *src, const uint8_t *topright, ptrdiff_t stride)
static void pred8x8_left_dc_rv40_c(uint8_t *src, ptrdiff_t stride)
void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth, const int chroma_format_idc)
static void pred8x8_dc_rv40_c(uint8_t *src, ptrdiff_t stride)
#define LOAD_DOWN_LEFT_EDGE
static void pred4x4_horizontal_vp8_c(uint8_t *src, const uint8_t *topright, ptrdiff_t stride)
static void pred16x16_plane_rv40_c(uint8_t *src, ptrdiff_t stride)
static void pred16x16_plane_svq3_c(uint8_t *src, ptrdiff_t stride)
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
av_cold void ff_h264_pred_init_arm(H264PredContext *h, int codec_id, int bit_depth, const int chroma_format_idc)
#define DIAG_DOWN_LEFT_PRED_RV40_NODOWN
static void pred4x4_horizontal_up_rv40_c(uint8_t *src, const uint8_t *topright, ptrdiff_t stride)
void ff_h264_pred_init_loongarch(H264PredContext *h, int codec_id, const int bit_depth, const int chroma_format_idc)
#define i(width, name, range_min, range_max)
#define HOR_UP_PRED_RV40_NODOWN
static void pred4x4_vertical_vp8_c(uint8_t *src, const uint8_t *topright, ptrdiff_t stride)
static void pred8x8_top_dc_rv40_c(uint8_t *src, ptrdiff_t stride)
static void pred4x4_vertical_left_rv40_nodown_c(uint8_t *src, const uint8_t *topright, ptrdiff_t stride)
static void pred4x4_horizontal_up_rv40_nodown_c(uint8_t *src, const uint8_t *topright, ptrdiff_t stride)
av_cold void ff_h264_pred_init(H264PredContext *h, int codec_id, const int bit_depth, int chroma_format_idc)
Set the intra prediction function pointers.
static void FUNCC() pred4x4_vertical(uint8_t *_src, const uint8_t *topright, ptrdiff_t _stride)
static void pred4x4_129_dc_c(uint8_t *src, const uint8_t *topright, ptrdiff_t _stride)
static void pred4x4_down_left_svq3_c(uint8_t *src, const uint8_t *topright, ptrdiff_t stride)
Context for storing H.264 prediction functions.
static void pred8x8_tm_vp8_c(uint8_t *src, ptrdiff_t stride)
static void pred4x4_down_left_rv40_nodown_c(uint8_t *src, const uint8_t *topright, ptrdiff_t stride)
static void pred4x4_vertical_left_rv40_c(uint8_t *src, const uint8_t *topright, ptrdiff_t stride)
void ff_h264_pred_init_mips(H264PredContext *h, int codec_id, const int bit_depth, const int chroma_format_idc)
static void pred4x4_vertical_left_rv40(uint8_t *src, const uint8_t *topright, ptrdiff_t stride, const int l0, const int l1, const int l2, const int l3, const int l4)
static void pred4x4_127_dc_c(uint8_t *src, const uint8_t *topright, ptrdiff_t _stride)