57 const unsigned lt = src[-1-1*stride];
63 (
t2 + 2*
t3 +
t4 + 2) >> 2);
74 const unsigned lt = src[-1-1*stride];
77 AV_WN32A(src+0*stride, ((lt + 2*l0 + l1 + 2) >> 2)*0x01010101);
78 AV_WN32A(src+1*stride, ((l0 + 2*l1 + l2 + 2) >> 2)*0x01010101);
79 AV_WN32A(src+2*stride, ((l1 + 2*l2 + l3 + 2) >> 2)*0x01010101);
80 AV_WN32A(src+3*stride, ((l2 + 2*l3 + l3 + 2) >> 2)*0x01010101);
89 src[0+0*stride]=(l1 +
t1)>>1;
91 src[0+1*stride]=(l2 +
t2)>>1;
104 src[3+3*stride]=(l3 +
t3)>>1;
115 src[0+0*stride]=(
t0 +
t2 + 2*
t1 + 2 + l0 + l2 + 2*l1 + 2)>>3;
117 src[0+1*stride]=(
t1 +
t3 + 2*
t2 + 2 + l1 + l3 + 2*l2 + 2)>>3;
120 src[0+2*stride]=(
t2 +
t4 + 2*
t3 + 2 + l2 + l4 + 2*l3 + 2)>>3;
124 src[0+3*stride]=(
t3 +
t5 + 2*
t4 + 2 + l3 + l5 + 2*l4 + 2)>>3;
127 src[1+3*stride]=(
t4 +
t6 + 2*
t5 + 2 + l4 + l6 + 2*l5 + 2)>>3;
129 src[2+3*stride]=(
t5 +
t7 + 2*
t6 + 2 + l5 + l7 + 2*l6 + 2)>>3;
130 src[3+3*stride]=(
t6 +
t7 + 1 + l6 + l7 + 1)>>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 + 3*l3 + 2)>>3;
150 src[0+3*stride]=(
t3 +
t5 + 2*
t4 + 2 + l3*4 + 2)>>3;
153 src[1+3*stride]=(
t4 +
t6 + 2*
t5 + 2 + l3*4 + 2)>>3;
155 src[2+3*stride]=(
t5 +
t7 + 2*
t6 + 2 + l3*4 + 2)>>3;
156 src[3+3*stride]=(
t6 +
t7 + 1 + 2*l3 + 1)>>2;
161 const int l0,
const int l1,
const int l2,
162 const int l3,
const int l4)
167 src[0+0*stride]=(2*
t0 + 2*
t1 + l1 + 2*l2 + l3 + 4)>>3;
169 src[0+2*stride]=(
t1 +
t2 + 1)>>1;
171 src[1+2*stride]=(
t2 +
t3 + 1)>>1;
173 src[2+2*stride]=(
t3 +
t4+ 1)>>1;
174 src[3+2*stride]=(
t4 +
t5+ 1)>>1;
175 src[0+1*stride]=(
t0 + 2*
t1 +
t2 + l2 + 2*l3 + l4 + 4)>>3;
177 src[0+3*stride]=(
t1 + 2*
t2 +
t3 + 2)>>2;
179 src[1+3*stride]=(
t2 + 2*
t3 +
t4 + 2)>>2;
181 src[2+3*stride]=(
t3 + 2*
t4 +
t5 + 2)>>2;
182 src[3+3*stride]=(
t4 + 2*
t5 +
t6 + 2)>>2;
209 src[0+0*stride]=(
t0 +
t1 + 1)>>1;
211 src[0+2*stride]=(
t1 +
t2 + 1)>>1;
213 src[1+2*stride]=(
t2 +
t3 + 1)>>1;
215 src[2+2*stride]=(
t3 +
t4 + 1)>>1;
216 src[0+1*stride]=(
t0 + 2*
t1 +
t2 + 2)>>2;
218 src[0+3*stride]=(
t1 + 2*
t2 +
t3 + 2)>>2;
220 src[1+3*stride]=(
t2 + 2*
t3 +
t4 + 2)>>2;
222 src[2+3*stride]=(
t3 + 2*
t4 +
t5 + 2)>>2;
223 src[3+2*stride]=(
t4 + 2*
t5 +
t6 + 2)>>2;
224 src[3+3*stride]=(
t5 + 2*
t6 +
t7 + 2)>>2;
235 src[0+0*stride]=(
t1 + 2*
t2 +
t3 + 2*l0 + 2*l1 + 4)>>3;
236 src[1+0*stride]=(
t2 + 2*
t3 +
t4 + l0 + 2*l1 + l2 + 4)>>3;
238 src[0+1*stride]=(
t3 + 2*
t4 +
t5 + 2*l1 + 2*l2 + 4)>>3;
240 src[1+1*stride]=(
t4 + 2*
t5 +
t6 + l1 + 2*l2 + l3 + 4)>>3;
242 src[0+2*stride]=(
t5 + 2*
t6 +
t7 + 2*l2 + 2*l3 + 4)>>3;
244 src[1+2*stride]=(
t6 + 3*
t7 + l2 + 3*l3 + 4)>>3;
246 src[1+3*stride]=(l3 + 2*l4 + l5 + 2)>>2;
248 src[2+2*stride]=(
t6 +
t7 + l3 + l4 + 2)>>2;
249 src[2+3*stride]=(l4 + l5 + 1)>>1;
250 src[3+3*stride]=(l4 + 2*l5 + l6 + 2)>>2;
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 + 2*l3 + 2)>>2;
286 for (y = 0; y < 4; y++) {
287 const uint8_t *cm_in = cm + src[-1];
288 src[0] = cm_in[top[0]];
289 src[1] = cm_in[top[1]];
290 src[2] = cm_in[top[2]];
291 src[3] = cm_in[top[3]];
298 pred16x16_plane_compat_8_c(src, stride, 1, 0);
303 pred16x16_plane_compat_8_c(src, stride, 0, 1);
312 for (y = 0; y < 16; 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]];
318 src[4] = cm_in[top[4]];
319 src[5] = cm_in[top[5]];
320 src[6] = cm_in[top[6]];
321 src[7] = cm_in[top[7]];
322 src[8] = cm_in[top[8]];
323 src[9] = cm_in[top[9]];
324 src[10] = cm_in[top[10]];
325 src[11] = cm_in[top[11]];
326 src[12] = cm_in[top[12]];
327 src[13] = cm_in[top[13]];
328 src[14] = cm_in[top[14]];
329 src[15] = cm_in[top[15]];
341 dc0+= src[-1+i*stride];
342 dc0= 0x01010101*((dc0 + 4)>>3);
345 ((uint32_t*)(src+i*stride))[0]=
346 ((uint32_t*)(src+i*stride))[1]= dc0;
358 dc0= 0x01010101*((dc0 + 4)>>3);
361 ((uint32_t*)(src+i*stride))[0]=
362 ((uint32_t*)(src+i*stride))[1]= dc0;
372 dc0+= src[-1+i*stride] + src[i-stride];
373 dc0+= src[4+i-stride];
374 dc0+= src[-1+(i+4)*stride];
376 dc0= 0x01010101*((dc0 + 8)>>4);
379 ((uint32_t*)(src+i*stride))[0]= dc0;
380 ((uint32_t*)(src+i*stride))[1]= dc0;
383 ((uint32_t*)(src+i*stride))[0]= dc0;
384 ((uint32_t*)(src+i*stride))[1]= dc0;
394 for (y = 0; y < 8; y++) {
395 const uint8_t *cm_in = cm + src[-1];
396 src[0] = cm_in[top[0]];
397 src[1] = cm_in[top[1]];
398 src[2] = cm_in[top[2]];
399 src[3] = cm_in[top[3]];
400 src[4] = cm_in[top[4]];
401 src[5] = cm_in[top[5]];
402 src[6] = cm_in[top[6]];
403 src[7] = cm_in[top[7]];
413 int chroma_format_idc)
417 #define FUNC(a, depth) a ## _ ## depth
418 #define FUNCC(a, depth) a ## _ ## depth ## _c
419 #define FUNCD(a) a ## _c
421 #define H264_PRED(depth) \
422 if(codec_id != AV_CODEC_ID_RV40){\
423 if(codec_id == AV_CODEC_ID_VP8) {\
424 h->pred4x4[VERT_PRED ]= FUNCD(pred4x4_vertical_vp8);\
425 h->pred4x4[HOR_PRED ]= FUNCD(pred4x4_horizontal_vp8);\
427 h->pred4x4[VERT_PRED ]= FUNCC(pred4x4_vertical , depth);\
428 h->pred4x4[HOR_PRED ]= FUNCC(pred4x4_horizontal , depth);\
430 h->pred4x4[DC_PRED ]= FUNCC(pred4x4_dc , depth);\
431 if(codec_id == AV_CODEC_ID_SVQ3)\
432 h->pred4x4[DIAG_DOWN_LEFT_PRED ]= FUNCD(pred4x4_down_left_svq3);\
434 h->pred4x4[DIAG_DOWN_LEFT_PRED ]= FUNCC(pred4x4_down_left , depth);\
435 h->pred4x4[DIAG_DOWN_RIGHT_PRED]= FUNCC(pred4x4_down_right , depth);\
436 h->pred4x4[VERT_RIGHT_PRED ]= FUNCC(pred4x4_vertical_right , depth);\
437 h->pred4x4[HOR_DOWN_PRED ]= FUNCC(pred4x4_horizontal_down , depth);\
438 if (codec_id == AV_CODEC_ID_VP8) {\
439 h->pred4x4[VERT_LEFT_PRED ]= FUNCD(pred4x4_vertical_left_vp8);\
441 h->pred4x4[VERT_LEFT_PRED ]= FUNCC(pred4x4_vertical_left , depth);\
442 h->pred4x4[HOR_UP_PRED ]= FUNCC(pred4x4_horizontal_up , depth);\
443 if(codec_id != AV_CODEC_ID_VP8) {\
444 h->pred4x4[LEFT_DC_PRED ]= FUNCC(pred4x4_left_dc , depth);\
445 h->pred4x4[TOP_DC_PRED ]= FUNCC(pred4x4_top_dc , depth);\
446 h->pred4x4[DC_128_PRED ]= FUNCC(pred4x4_128_dc , depth);\
448 h->pred4x4[TM_VP8_PRED ]= FUNCD(pred4x4_tm_vp8);\
449 h->pred4x4[DC_127_PRED ]= FUNCC(pred4x4_127_dc , depth);\
450 h->pred4x4[DC_129_PRED ]= FUNCC(pred4x4_129_dc , depth);\
451 h->pred4x4[VERT_VP8_PRED ]= FUNCC(pred4x4_vertical , depth);\
452 h->pred4x4[HOR_VP8_PRED ]= FUNCC(pred4x4_horizontal , depth);\
455 h->pred4x4[VERT_PRED ]= FUNCC(pred4x4_vertical , depth);\
456 h->pred4x4[HOR_PRED ]= FUNCC(pred4x4_horizontal , depth);\
457 h->pred4x4[DC_PRED ]= FUNCC(pred4x4_dc , depth);\
458 h->pred4x4[DIAG_DOWN_LEFT_PRED ]= FUNCD(pred4x4_down_left_rv40);\
459 h->pred4x4[DIAG_DOWN_RIGHT_PRED]= FUNCC(pred4x4_down_right , depth);\
460 h->pred4x4[VERT_RIGHT_PRED ]= FUNCC(pred4x4_vertical_right , depth);\
461 h->pred4x4[HOR_DOWN_PRED ]= FUNCC(pred4x4_horizontal_down , depth);\
462 h->pred4x4[VERT_LEFT_PRED ]= FUNCD(pred4x4_vertical_left_rv40);\
463 h->pred4x4[HOR_UP_PRED ]= FUNCD(pred4x4_horizontal_up_rv40);\
464 h->pred4x4[LEFT_DC_PRED ]= FUNCC(pred4x4_left_dc , depth);\
465 h->pred4x4[TOP_DC_PRED ]= FUNCC(pred4x4_top_dc , depth);\
466 h->pred4x4[DC_128_PRED ]= FUNCC(pred4x4_128_dc , depth);\
467 h->pred4x4[DIAG_DOWN_LEFT_PRED_RV40_NODOWN]= FUNCD(pred4x4_down_left_rv40_nodown);\
468 h->pred4x4[HOR_UP_PRED_RV40_NODOWN]= FUNCD(pred4x4_horizontal_up_rv40_nodown);\
469 h->pred4x4[VERT_LEFT_PRED_RV40_NODOWN]= FUNCD(pred4x4_vertical_left_rv40_nodown);\
472 h->pred8x8l[VERT_PRED ]= FUNCC(pred8x8l_vertical , depth);\
473 h->pred8x8l[HOR_PRED ]= FUNCC(pred8x8l_horizontal , depth);\
474 h->pred8x8l[DC_PRED ]= FUNCC(pred8x8l_dc , depth);\
475 h->pred8x8l[DIAG_DOWN_LEFT_PRED ]= FUNCC(pred8x8l_down_left , depth);\
476 h->pred8x8l[DIAG_DOWN_RIGHT_PRED]= FUNCC(pred8x8l_down_right , depth);\
477 h->pred8x8l[VERT_RIGHT_PRED ]= FUNCC(pred8x8l_vertical_right , depth);\
478 h->pred8x8l[HOR_DOWN_PRED ]= FUNCC(pred8x8l_horizontal_down , depth);\
479 h->pred8x8l[VERT_LEFT_PRED ]= FUNCC(pred8x8l_vertical_left , depth);\
480 h->pred8x8l[HOR_UP_PRED ]= FUNCC(pred8x8l_horizontal_up , depth);\
481 h->pred8x8l[LEFT_DC_PRED ]= FUNCC(pred8x8l_left_dc , depth);\
482 h->pred8x8l[TOP_DC_PRED ]= FUNCC(pred8x8l_top_dc , depth);\
483 h->pred8x8l[DC_128_PRED ]= FUNCC(pred8x8l_128_dc , depth);\
485 if (chroma_format_idc <= 1) {\
486 h->pred8x8[VERT_PRED8x8 ]= FUNCC(pred8x8_vertical , depth);\
487 h->pred8x8[HOR_PRED8x8 ]= FUNCC(pred8x8_horizontal , depth);\
489 h->pred8x8[VERT_PRED8x8 ]= FUNCC(pred8x16_vertical , depth);\
490 h->pred8x8[HOR_PRED8x8 ]= FUNCC(pred8x16_horizontal , depth);\
492 if (codec_id != AV_CODEC_ID_VP8) {\
493 if (chroma_format_idc <= 1) {\
494 h->pred8x8[PLANE_PRED8x8]= FUNCC(pred8x8_plane , depth);\
496 h->pred8x8[PLANE_PRED8x8]= FUNCC(pred8x16_plane , depth);\
499 h->pred8x8[PLANE_PRED8x8]= FUNCD(pred8x8_tm_vp8);\
500 if(codec_id != AV_CODEC_ID_RV40 && codec_id != AV_CODEC_ID_VP8){\
501 if (chroma_format_idc <= 1) {\
502 h->pred8x8[DC_PRED8x8 ]= FUNCC(pred8x8_dc , depth);\
503 h->pred8x8[LEFT_DC_PRED8x8]= FUNCC(pred8x8_left_dc , depth);\
504 h->pred8x8[TOP_DC_PRED8x8 ]= FUNCC(pred8x8_top_dc , depth);\
505 h->pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l0t, depth);\
506 h->pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0lt, depth);\
507 h->pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l00, depth);\
508 h->pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0l0, depth);\
510 h->pred8x8[DC_PRED8x8 ]= FUNCC(pred8x16_dc , depth);\
511 h->pred8x8[LEFT_DC_PRED8x8]= FUNCC(pred8x16_left_dc , depth);\
512 h->pred8x8[TOP_DC_PRED8x8 ]= FUNCC(pred8x16_top_dc , depth);\
513 h->pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_l0t, depth);\
514 h->pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_0lt, depth);\
515 h->pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_l00, depth);\
516 h->pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_0l0, depth);\
519 h->pred8x8[DC_PRED8x8 ]= FUNCD(pred8x8_dc_rv40);\
520 h->pred8x8[LEFT_DC_PRED8x8]= FUNCD(pred8x8_left_dc_rv40);\
521 h->pred8x8[TOP_DC_PRED8x8 ]= FUNCD(pred8x8_top_dc_rv40);\
522 if (codec_id == AV_CODEC_ID_VP8) {\
523 h->pred8x8[DC_127_PRED8x8]= FUNCC(pred8x8_127_dc , depth);\
524 h->pred8x8[DC_129_PRED8x8]= FUNCC(pred8x8_129_dc , depth);\
527 if (chroma_format_idc <= 1) {\
528 h->pred8x8[DC_128_PRED8x8 ]= FUNCC(pred8x8_128_dc , depth);\
530 h->pred8x8[DC_128_PRED8x8 ]= FUNCC(pred8x16_128_dc , depth);\
533 h->pred16x16[DC_PRED8x8 ]= FUNCC(pred16x16_dc , depth);\
534 h->pred16x16[VERT_PRED8x8 ]= FUNCC(pred16x16_vertical , depth);\
535 h->pred16x16[HOR_PRED8x8 ]= FUNCC(pred16x16_horizontal , depth);\
537 case AV_CODEC_ID_SVQ3:\
538 h->pred16x16[PLANE_PRED8x8 ]= FUNCD(pred16x16_plane_svq3);\
540 case AV_CODEC_ID_RV40:\
541 h->pred16x16[PLANE_PRED8x8 ]= FUNCD(pred16x16_plane_rv40);\
543 case AV_CODEC_ID_VP8:\
544 h->pred16x16[PLANE_PRED8x8 ]= FUNCD(pred16x16_tm_vp8);\
545 h->pred16x16[DC_127_PRED8x8]= FUNCC(pred16x16_127_dc , depth);\
546 h->pred16x16[DC_129_PRED8x8]= FUNCC(pred16x16_129_dc , depth);\
549 h->pred16x16[PLANE_PRED8x8 ]= FUNCC(pred16x16_plane , depth);\
552 h->pred16x16[LEFT_DC_PRED8x8]= FUNCC(pred16x16_left_dc , depth);\
553 h->pred16x16[TOP_DC_PRED8x8 ]= FUNCC(pred16x16_top_dc , depth);\
554 h->pred16x16[DC_128_PRED8x8 ]= FUNCC(pred16x16_128_dc , depth);\
557 h->pred4x4_add [VERT_PRED ]= FUNCC(pred4x4_vertical_add , depth);\
558 h->pred4x4_add [ HOR_PRED ]= FUNCC(pred4x4_horizontal_add , depth);\
559 h->pred8x8l_add [VERT_PRED ]= FUNCC(pred8x8l_vertical_add , depth);\
560 h->pred8x8l_add [ HOR_PRED ]= FUNCC(pred8x8l_horizontal_add , depth);\
561 if (chroma_format_idc <= 1) {\
562 h->pred8x8_add [VERT_PRED8x8]= FUNCC(pred8x8_vertical_add , depth);\
563 h->pred8x8_add [ HOR_PRED8x8]= FUNCC(pred8x8_horizontal_add , depth);\
565 h->pred8x8_add [VERT_PRED8x8]= FUNCC(pred8x16_vertical_add , depth);\
566 h->pred8x8_add [ HOR_PRED8x8]= FUNCC(pred8x16_horizontal_add , depth);\
568 h->pred16x16_add[VERT_PRED8x8]= FUNCC(pred16x16_vertical_add , depth);\
569 h->pred16x16_add[ HOR_PRED8x8]= FUNCC(pred16x16_horizontal_add , depth);\