56 const unsigned lt = src[-1-1*
stride];
62 (
t2 + 2*
t3 +
t4 + 2) >> 2);
73 const unsigned lt = src[-1-1*
stride];
76 AV_WN32A(src+0*stride, ((lt + 2*l0 + l1 + 2) >> 2)*0x01010101);
77 AV_WN32A(src+1*stride, ((l0 + 2*l1 + l2 + 2) >> 2)*0x01010101);
78 AV_WN32A(src+2*stride, ((l1 + 2*l2 + l3 + 2) >> 2)*0x01010101);
79 AV_WN32A(src+3*stride, ((l2 + 2*l3 + l3 + 2) >> 2)*0x01010101);
114 src[0+0*
stride]=(
t0 +
t2 + 2*
t1 + 2 + l0 + l2 + 2*l1 + 2)>>3;
116 src[0+1*
stride]=(
t1 +
t3 + 2*
t2 + 2 + l1 + l3 + 2*l2 + 2)>>3;
119 src[0+2*
stride]=(
t2 +
t4 + 2*
t3 + 2 + l2 + l4 + 2*l3 + 2)>>3;
123 src[0+3*
stride]=(
t3 +
t5 + 2*
t4 + 2 + l3 + l5 + 2*l4 + 2)>>3;
126 src[1+3*
stride]=(
t4 +
t6 + 2*
t5 + 2 + l4 + l6 + 2*l5 + 2)>>3;
128 src[2+3*
stride]=(
t5 +
t7 + 2*
t6 + 2 + l5 + l7 + 2*l6 + 2)>>3;
129 src[3+3*
stride]=(
t6 +
t7 + 1 + l6 + l7 + 1)>>2;
140 src[0+0*
stride]=(
t0 +
t2 + 2*
t1 + 2 + l0 + l2 + 2*l1 + 2)>>3;
142 src[0+1*
stride]=(
t1 +
t3 + 2*
t2 + 2 + l1 + l3 + 2*l2 + 2)>>3;
145 src[0+2*
stride]=(
t2 +
t4 + 2*
t3 + 2 + l2 + 3*l3 + 2)>>3;
160 const int l0,
const int l1,
const int l2,
161 const int l3,
const int l4)
166 src[0+0*
stride]=(2*
t0 + 2*
t1 + l1 + 2*l2 + l3 + 4)>>3;
174 src[0+1*
stride]=(
t0 + 2*
t1 +
t2 + l2 + 2*l3 + l4 + 4)>>3;
235 src[1+0*
stride]=(
t2 + 2*
t3 +
t4 + l0 + 2*l1 + l2 + 4)>>3;
239 src[1+1*
stride]=(
t4 + 2*
t5 +
t6 + l1 + 2*l2 + l3 + 4)>>3;
243 src[1+2*
stride]=(
t6 + 3*
t7 + l2 + 3*l3 + 4)>>3;
245 src[1+3*
stride]=(l3 + 2*l4 + l5 + 2)>>2;
248 src[2+3*
stride]=(l4 + l5 + 1)>>1;
249 src[3+3*
stride]=(l4 + 2*l5 + l6 + 2)>>2;
261 src[1+0*
stride]=(
t2 + 2*
t3 +
t4 + l0 + 2*l1 + l2 + 4)>>3;
265 src[1+1*
stride]=(
t4 + 2*
t5 +
t6 + l1 + 2*l2 + l3 + 4)>>3;
269 src[1+2*
stride]=(
t6 + 3*
t7 + l2 + 3*l3 + 4)>>3;
285 for (y = 0; y < 4; y++) {
286 const uint8_t *cm_in = cm + src[-1];
287 src[0] = cm_in[top[0]];
288 src[1] = cm_in[top[1]];
289 src[2] = cm_in[top[2]];
290 src[3] = cm_in[top[3]];
297 pred16x16_plane_compat_8_c(src, stride, 1, 0);
302 pred16x16_plane_compat_8_c(src, stride, 0, 1);
311 for (y = 0; y < 16; y++) {
312 const uint8_t *cm_in = cm + src[-1];
313 src[0] = cm_in[top[0]];
314 src[1] = cm_in[top[1]];
315 src[2] = cm_in[top[2]];
316 src[3] = cm_in[top[3]];
317 src[4] = cm_in[top[4]];
318 src[5] = cm_in[top[5]];
319 src[6] = cm_in[top[6]];
320 src[7] = cm_in[top[7]];
321 src[8] = cm_in[top[8]];
322 src[9] = cm_in[top[9]];
323 src[10] = cm_in[top[10]];
324 src[11] = cm_in[top[11]];
325 src[12] = cm_in[top[12]];
326 src[13] = cm_in[top[13]];
327 src[14] = cm_in[top[14]];
328 src[15] = cm_in[top[15]];
340 dc0+= src[-1+i*stride];
341 dc0= 0x01010101*((dc0 + 4)>>3);
344 ((uint32_t*)(src+i*stride))[0]=
345 ((uint32_t*)(src+i*
stride))[1]= dc0;
357 dc0= 0x01010101*((dc0 + 4)>>3);
360 ((uint32_t*)(src+i*stride))[0]=
361 ((uint32_t*)(src+i*
stride))[1]= dc0;
373 dc0+= src[-1+(i+4)*stride];
375 dc0= 0x01010101*((dc0 + 8)>>4);
378 ((uint32_t*)(src+i*stride))[0]= dc0;
379 ((uint32_t*)(src+i*stride))[1]= dc0;
382 ((uint32_t*)(src+i*stride))[0]= dc0;
383 ((uint32_t*)(src+i*stride))[1]= dc0;
393 for (y = 0; y < 8; y++) {
394 const uint8_t *cm_in = cm + src[-1];
395 src[0] = cm_in[top[0]];
396 src[1] = cm_in[top[1]];
397 src[2] = cm_in[top[2]];
398 src[3] = cm_in[top[3]];
399 src[4] = cm_in[top[4]];
400 src[5] = cm_in[top[5]];
401 src[6] = cm_in[top[6]];
402 src[7] = cm_in[top[7]];
411 int chroma_format_idc)
415 #define FUNC(a, depth) a ## _ ## depth 416 #define FUNCC(a, depth) a ## _ ## depth ## _c 417 #define FUNCD(a) a ## _c 419 #define H264_PRED(depth) \ 420 if(codec_id != AV_CODEC_ID_RV40){\ 421 if(codec_id == AV_CODEC_ID_VP8) {\ 422 h->pred4x4[VERT_PRED ]= FUNCD(pred4x4_vertical_vp8);\ 423 h->pred4x4[HOR_PRED ]= FUNCD(pred4x4_horizontal_vp8);\ 425 h->pred4x4[VERT_PRED ]= FUNCC(pred4x4_vertical , depth);\ 426 h->pred4x4[HOR_PRED ]= FUNCC(pred4x4_horizontal , depth);\ 428 h->pred4x4[DC_PRED ]= FUNCC(pred4x4_dc , depth);\ 429 if(codec_id == AV_CODEC_ID_SVQ3)\ 430 h->pred4x4[DIAG_DOWN_LEFT_PRED ]= FUNCD(pred4x4_down_left_svq3);\ 432 h->pred4x4[DIAG_DOWN_LEFT_PRED ]= FUNCC(pred4x4_down_left , depth);\ 433 h->pred4x4[DIAG_DOWN_RIGHT_PRED]= FUNCC(pred4x4_down_right , depth);\ 434 h->pred4x4[VERT_RIGHT_PRED ]= FUNCC(pred4x4_vertical_right , depth);\ 435 h->pred4x4[HOR_DOWN_PRED ]= FUNCC(pred4x4_horizontal_down , depth);\ 436 if (codec_id == AV_CODEC_ID_VP8) {\ 437 h->pred4x4[VERT_LEFT_PRED ]= FUNCD(pred4x4_vertical_left_vp8);\ 439 h->pred4x4[VERT_LEFT_PRED ]= FUNCC(pred4x4_vertical_left , depth);\ 440 h->pred4x4[HOR_UP_PRED ]= FUNCC(pred4x4_horizontal_up , depth);\ 441 if(codec_id != AV_CODEC_ID_VP8) {\ 442 h->pred4x4[LEFT_DC_PRED ]= FUNCC(pred4x4_left_dc , depth);\ 443 h->pred4x4[TOP_DC_PRED ]= FUNCC(pred4x4_top_dc , depth);\ 444 h->pred4x4[DC_128_PRED ]= FUNCC(pred4x4_128_dc , depth);\ 446 h->pred4x4[TM_VP8_PRED ]= FUNCD(pred4x4_tm_vp8);\ 447 h->pred4x4[DC_127_PRED ]= FUNCC(pred4x4_127_dc , depth);\ 448 h->pred4x4[DC_129_PRED ]= FUNCC(pred4x4_129_dc , depth);\ 449 h->pred4x4[VERT_VP8_PRED ]= FUNCC(pred4x4_vertical , depth);\ 450 h->pred4x4[HOR_VP8_PRED ]= FUNCC(pred4x4_horizontal , depth);\ 453 h->pred4x4[VERT_PRED ]= FUNCC(pred4x4_vertical , depth);\ 454 h->pred4x4[HOR_PRED ]= FUNCC(pred4x4_horizontal , depth);\ 455 h->pred4x4[DC_PRED ]= FUNCC(pred4x4_dc , depth);\ 456 h->pred4x4[DIAG_DOWN_LEFT_PRED ]= FUNCD(pred4x4_down_left_rv40);\ 457 h->pred4x4[DIAG_DOWN_RIGHT_PRED]= FUNCC(pred4x4_down_right , depth);\ 458 h->pred4x4[VERT_RIGHT_PRED ]= FUNCC(pred4x4_vertical_right , depth);\ 459 h->pred4x4[HOR_DOWN_PRED ]= FUNCC(pred4x4_horizontal_down , depth);\ 460 h->pred4x4[VERT_LEFT_PRED ]= FUNCD(pred4x4_vertical_left_rv40);\ 461 h->pred4x4[HOR_UP_PRED ]= FUNCD(pred4x4_horizontal_up_rv40);\ 462 h->pred4x4[LEFT_DC_PRED ]= FUNCC(pred4x4_left_dc , depth);\ 463 h->pred4x4[TOP_DC_PRED ]= FUNCC(pred4x4_top_dc , depth);\ 464 h->pred4x4[DC_128_PRED ]= FUNCC(pred4x4_128_dc , depth);\ 465 h->pred4x4[DIAG_DOWN_LEFT_PRED_RV40_NODOWN]= FUNCD(pred4x4_down_left_rv40_nodown);\ 466 h->pred4x4[HOR_UP_PRED_RV40_NODOWN]= FUNCD(pred4x4_horizontal_up_rv40_nodown);\ 467 h->pred4x4[VERT_LEFT_PRED_RV40_NODOWN]= FUNCD(pred4x4_vertical_left_rv40_nodown);\ 470 h->pred8x8l[VERT_PRED ]= FUNCC(pred8x8l_vertical , depth);\ 471 h->pred8x8l[HOR_PRED ]= FUNCC(pred8x8l_horizontal , depth);\ 472 h->pred8x8l[DC_PRED ]= FUNCC(pred8x8l_dc , depth);\ 473 h->pred8x8l[DIAG_DOWN_LEFT_PRED ]= FUNCC(pred8x8l_down_left , depth);\ 474 h->pred8x8l[DIAG_DOWN_RIGHT_PRED]= FUNCC(pred8x8l_down_right , depth);\ 475 h->pred8x8l[VERT_RIGHT_PRED ]= FUNCC(pred8x8l_vertical_right , depth);\ 476 h->pred8x8l[HOR_DOWN_PRED ]= FUNCC(pred8x8l_horizontal_down , depth);\ 477 h->pred8x8l[VERT_LEFT_PRED ]= FUNCC(pred8x8l_vertical_left , depth);\ 478 h->pred8x8l[HOR_UP_PRED ]= FUNCC(pred8x8l_horizontal_up , depth);\ 479 h->pred8x8l[LEFT_DC_PRED ]= FUNCC(pred8x8l_left_dc , depth);\ 480 h->pred8x8l[TOP_DC_PRED ]= FUNCC(pred8x8l_top_dc , depth);\ 481 h->pred8x8l[DC_128_PRED ]= FUNCC(pred8x8l_128_dc , depth);\ 483 if (chroma_format_idc == 1) {\ 484 h->pred8x8[VERT_PRED8x8 ]= FUNCC(pred8x8_vertical , depth);\ 485 h->pred8x8[HOR_PRED8x8 ]= FUNCC(pred8x8_horizontal , depth);\ 487 h->pred8x8[VERT_PRED8x8 ]= FUNCC(pred8x16_vertical , depth);\ 488 h->pred8x8[HOR_PRED8x8 ]= FUNCC(pred8x16_horizontal , depth);\ 490 if (codec_id != AV_CODEC_ID_VP8) {\ 491 if (chroma_format_idc == 1) {\ 492 h->pred8x8[PLANE_PRED8x8]= FUNCC(pred8x8_plane , depth);\ 494 h->pred8x8[PLANE_PRED8x8]= FUNCC(pred8x16_plane , depth);\ 497 h->pred8x8[PLANE_PRED8x8]= FUNCD(pred8x8_tm_vp8);\ 498 if(codec_id != AV_CODEC_ID_RV40 && codec_id != AV_CODEC_ID_VP8){\ 499 if (chroma_format_idc == 1) {\ 500 h->pred8x8[DC_PRED8x8 ]= FUNCC(pred8x8_dc , depth);\ 501 h->pred8x8[LEFT_DC_PRED8x8]= FUNCC(pred8x8_left_dc , depth);\ 502 h->pred8x8[TOP_DC_PRED8x8 ]= FUNCC(pred8x8_top_dc , depth);\ 503 h->pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l0t, depth);\ 504 h->pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0lt, depth);\ 505 h->pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l00, depth);\ 506 h->pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0l0, depth);\ 508 h->pred8x8[DC_PRED8x8 ]= FUNCC(pred8x16_dc , depth);\ 509 h->pred8x8[LEFT_DC_PRED8x8]= FUNCC(pred8x16_left_dc , depth);\ 510 h->pred8x8[TOP_DC_PRED8x8 ]= FUNCC(pred8x16_top_dc , depth);\ 511 h->pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_l0t, depth);\ 512 h->pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_0lt, depth);\ 513 h->pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_l00, depth);\ 514 h->pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_0l0, depth);\ 517 h->pred8x8[DC_PRED8x8 ]= FUNCD(pred8x8_dc_rv40);\ 518 h->pred8x8[LEFT_DC_PRED8x8]= FUNCD(pred8x8_left_dc_rv40);\ 519 h->pred8x8[TOP_DC_PRED8x8 ]= FUNCD(pred8x8_top_dc_rv40);\ 520 if (codec_id == AV_CODEC_ID_VP8) {\ 521 h->pred8x8[DC_127_PRED8x8]= FUNCC(pred8x8_127_dc , depth);\ 522 h->pred8x8[DC_129_PRED8x8]= FUNCC(pred8x8_129_dc , depth);\ 525 if (chroma_format_idc == 1) {\ 526 h->pred8x8[DC_128_PRED8x8 ]= FUNCC(pred8x8_128_dc , depth);\ 528 h->pred8x8[DC_128_PRED8x8 ]= FUNCC(pred8x16_128_dc , depth);\ 531 h->pred16x16[DC_PRED8x8 ]= FUNCC(pred16x16_dc , depth);\ 532 h->pred16x16[VERT_PRED8x8 ]= FUNCC(pred16x16_vertical , depth);\ 533 h->pred16x16[HOR_PRED8x8 ]= FUNCC(pred16x16_horizontal , depth);\ 535 case AV_CODEC_ID_SVQ3:\ 536 h->pred16x16[PLANE_PRED8x8 ]= FUNCD(pred16x16_plane_svq3);\ 538 case AV_CODEC_ID_RV40:\ 539 h->pred16x16[PLANE_PRED8x8 ]= FUNCD(pred16x16_plane_rv40);\ 541 case AV_CODEC_ID_VP8:\ 542 h->pred16x16[PLANE_PRED8x8 ]= FUNCD(pred16x16_tm_vp8);\ 543 h->pred16x16[DC_127_PRED8x8]= FUNCC(pred16x16_127_dc , depth);\ 544 h->pred16x16[DC_129_PRED8x8]= FUNCC(pred16x16_129_dc , depth);\ 547 h->pred16x16[PLANE_PRED8x8 ]= FUNCC(pred16x16_plane , depth);\ 550 h->pred16x16[LEFT_DC_PRED8x8]= FUNCC(pred16x16_left_dc , depth);\ 551 h->pred16x16[TOP_DC_PRED8x8 ]= FUNCC(pred16x16_top_dc , depth);\ 552 h->pred16x16[DC_128_PRED8x8 ]= FUNCC(pred16x16_128_dc , depth);\ 555 h->pred4x4_add [VERT_PRED ]= FUNCC(pred4x4_vertical_add , depth);\ 556 h->pred4x4_add [ HOR_PRED ]= FUNCC(pred4x4_horizontal_add , depth);\ 557 h->pred8x8l_add [VERT_PRED ]= FUNCC(pred8x8l_vertical_add , depth);\ 558 h->pred8x8l_add [ HOR_PRED ]= FUNCC(pred8x8l_horizontal_add , depth);\ 559 if (chroma_format_idc == 1) {\ 560 h->pred8x8_add [VERT_PRED8x8]= FUNCC(pred8x8_vertical_add , depth);\ 561 h->pred8x8_add [ HOR_PRED8x8]= FUNCC(pred8x8_horizontal_add , depth);\ 563 h->pred8x8_add [VERT_PRED8x8]= FUNCC(pred8x16_vertical_add , depth);\ 564 h->pred8x8_add [ HOR_PRED8x8]= FUNCC(pred8x16_horizontal_add , depth);\ 566 h->pred16x16_add[VERT_PRED8x8]= FUNCC(pred16x16_vertical_add , depth);\ 567 h->pred16x16_add[ HOR_PRED8x8]= FUNCC(pred16x16_horizontal_add , depth);\ 569 if(!chroma_format_idc)
570 chroma_format_idc = 1;
static void pred4x4_vertical_left_rv40_nodown_c(uint8_t *src, const uint8_t *topright, 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 pred4x4_tm_vp8_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)
#define PACK_4U8(a, b, c, d)
static void pred8x8_tm_vp8_c(uint8_t *src, ptrdiff_t stride)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
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 pred16x16_plane_rv40_c(uint8_t *src, ptrdiff_t stride)
Context for storing H.264 prediction functions.
static void pred4x4_down_left_rv40_nodown_c(uint8_t *src, const uint8_t *topright, ptrdiff_t stride)
static void pred8x8_dc_rv40_c(uint8_t *src, ptrdiff_t stride)
static void pred16x16_plane_svq3_c(uint8_t *src, ptrdiff_t stride)
static void pred8x8_top_dc_rv40_c(uint8_t *src, ptrdiff_t stride)
simple assert() macros that are a bit more flexible than ISO C assert().
H.264 / AVC / MPEG4 part10 prediction functions.
static void pred4x4_down_left_rv40_c(uint8_t *src, const uint8_t *topright, ptrdiff_t stride)
static void pred4x4_horizontal_vp8_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)
static void pred4x4_vertical_vp8_c(uint8_t *src, const uint8_t *topright, ptrdiff_t stride)
synthesis window for stochastic i
static void pred16x16_tm_vp8_c(uint8_t *src, ptrdiff_t stride)
H.264 / AVC / MPEG4 prediction functions.
static void pred4x4_down_left_svq3_c(uint8_t *src, const uint8_t *topright, ptrdiff_t stride)
void ff_h264_pred_init(H264PredContext *h, int codec_id, const int bit_depth, int chroma_format_idc)
Set the intra prediction function pointers.
av_cold void ff_h264_pred_init_arm(H264PredContext *h, int codec_id, int bit_depth, const int chroma_format_idc)
static void pred8x8_left_dc_rv40_c(uint8_t *src, ptrdiff_t stride)
static void pred4x4_vertical_left_vp8_c(uint8_t *src, const uint8_t *topright, ptrdiff_t stride)
#define LOAD_DOWN_LEFT_EDGE
static void pred4x4_horizontal_up_rv40_c(uint8_t *src, const uint8_t *topright, ptrdiff_t stride)
#define LOAD_TOP_RIGHT_EDGE