139 #define LOAD_TOP_RIGHT_EDGE\
140 const unsigned av_unused t4 = topright[0];\
141 const unsigned av_unused t5 = topright[1];\
142 const unsigned av_unused t6 = topright[2];\
143 const unsigned av_unused t7 = topright[3];\
145 #define LOAD_DOWN_LEFT_EDGE\
146 const unsigned av_unused l4 = src[-1+4*stride];\
147 const unsigned av_unused l5 = src[-1+5*stride];\
148 const unsigned av_unused l6 = src[-1+6*stride];\
149 const unsigned av_unused l7 = src[-1+7*stride];\
151 #define LOAD_LEFT_EDGE\
152 const unsigned av_unused l0 = src[-1+0*stride];\
153 const unsigned av_unused l1 = src[-1+1*stride];\
154 const unsigned av_unused l2 = src[-1+2*stride];\
155 const unsigned av_unused l3 = src[-1+3*stride];\
157 #define LOAD_TOP_EDGE\
158 const unsigned av_unused t0 = src[ 0-1*stride];\
159 const unsigned av_unused t1 = src[ 1-1*stride];\
160 const unsigned av_unused t2 = src[ 2-1*stride];\
161 const unsigned av_unused t3 = src[ 3-1*stride];\
168 const int lt= src[-1-1*
stride];
172 src[0+3*
stride]=(l3 + 2*l2 + l1 + 2)>>2;
174 src[1+3*
stride]=(l2 + 2*l1 + l0 + 2)>>2;
177 src[2+3*
stride]=(l1 + 2*l0 + lt + 2)>>2;
181 src[3+3*
stride]=(l0 + 2*lt +
t0 + 2)>>2;
194 const pixel *topright = (
const pixel*)_topright;
224 const int lt= src[-1-1*
stride];
236 src[1+3*
stride]=(l0 + 2*lt +
t0 + 2)>>2;
242 src[0+2*
stride]=(lt + 2*l0 + l1 + 2)>>2;
243 src[0+3*
stride]=(l0 + 2*l1 + l2 + 2)>>2;
251 const pixel *topright = (
const pixel*)_topright;
281 src[0+0*
stride]=(l0 + l1 + 1)>>1;
282 src[1+0*
stride]=(l0 + 2*l1 + l2 + 2)>>2;
284 src[0+1*
stride]=(l1 + l2 + 1)>>1;
286 src[1+1*
stride]=(l1 + 2*l2 + l3 + 2)>>2;
288 src[0+2*
stride]=(l2 + l3 + 1)>>1;
290 src[1+2*
stride]=(l2 + 2*l3 + l3 + 2)>>2;
305 const int lt= src[-1-1*
stride];
310 src[2+1*
stride]=(lt + l0 + 1)>>1;
312 src[3+1*
stride]=(l0 + 2*lt +
t0 + 2)>>2;
316 src[2+2*
stride]=(l0 + l1 + 1)>>1;
318 src[3+2*
stride]=(lt + 2*l0 + l1 + 2)>>2;
320 src[2+3*
stride]=(l1 + l2+ 1)>>1;
322 src[3+3*
stride]=(l0 + 2*l1 + l2 + 2)>>2;
323 src[0+3*
stride]=(l2 + l3 + 1)>>1;
324 src[1+3*
stride]=(l1 + 2*l2 + l3 + 2)>>2;
361 #define PREDICT_16x16_DC(v)\
362 for(i=0; i<16; i++){\
363 AV_WN4PA(src+ 0, v);\
364 AV_WN4PA(src+ 4, v);\
365 AV_WN4PA(src+ 8, v);\
366 AV_WN4PA(src+12, v);\
419 #define PRED16x16_X(n, v) \
420 static void FUNCC(pred16x16_##n##_dc)(uint8_t *_src, ptrdiff_t stride)\
423 pixel *src = (pixel*)_src;\
424 stride >>= sizeof(pixel)-1;\
425 PREDICT_16x16_DC(PIXEL_SPLAT_X4(v));\
432 static inline
void FUNCC(pred16x16_plane_compat)(
uint8_t *_src,
443 const pixel * src1 = src +8*stride-1;
445 int H = src0[1] - src0[-1];
446 int V = src1[0] - src2[ 0];
447 for(k=2; k<=8; ++k) {
449 H += k*(src0[k] - src0[-k]);
450 V += k*(src1[0] - src2[ 0]);
453 H = ( 5*(H/4) ) / 16;
454 V = ( 5*(V/4) ) / 16;
459 H = ( H + (H>>2) ) >> 4;
460 V = ( V + (V>>2) ) >> 4;
466 a = 16*(src1[0] + src2[16] + 1) - 7*(V+H);
467 for(j=16; j>0; --j) {
470 for(i=-16; i<0; i+=4) {
471 src[16+i] =
CLIP((b ) >> 5);
472 src[17+i] =
CLIP((b+ H) >> 5);
473 src[18+i] =
CLIP((b+2*H) >> 5);
474 src[19+i] =
CLIP((b+3*H) >> 5);
490 int stride = _stride>>(
sizeof(
pixel)-1);
504 int stride = _stride>>(
sizeof(
pixel)-1);
518 stride >>=
sizeof(
pixel)-1;
531 stride >>=
sizeof(
pixel)-1;
539 #define PRED8x8_X(n, v)\
540 static void FUNCC(pred8x8_##n##_dc)(uint8_t *_src, ptrdiff_t stride)\
543 const pixel4 a = PIXEL_SPLAT_X4(v);\
544 pixel *src = (pixel*)_src;\
545 stride >>= sizeof(pixel)-1;\
547 AV_WN4PA(((pixel4*)(src+i*stride))+0, a);\
548 AV_WN4PA(((pixel4*)(src+i*stride))+1, a);\
556 static
void FUNCC(pred8x16_128_dc)(
uint8_t *_src, ptrdiff_t stride)
568 stride >>=
sizeof(
pixel)-1;
573 dc2+= src[-1+(i+4)*stride];
598 pixel4 dc0splat, dc1splat;
600 stride >>=
sizeof(
pixel)-1;
624 pixel4 dc0splat, dc1splat;
626 stride >>=
sizeof(
pixel)-1;
648 stride >>=
sizeof(
pixel)-1;
654 dc2+= src[-1+(i+4)*stride];
674 int dc0, dc1, dc2, dc3, dc4;
675 pixel4 dc0splat, dc1splat,
dc2splat, dc3splat, dc4splat, dc5splat, dc6splat, dc7splat;
677 stride >>=
sizeof(
pixel)-1;
679 dc0=dc1=dc2=dc3=dc4=0;
683 dc2+= src[-1+(i+4)*stride];
684 dc3+= src[-1+(i+8)*stride];
685 dc4+= src[-1+(i+12)*stride];
708 for(i=12; i<16; i++){
773 int stride = _stride>>(
sizeof(
pixel)-1);
775 const pixel * src1 = src +4*stride-1;
777 int H = src0[1] - src0[-1];
778 int V = src1[0] - src2[ 0];
779 for(k=2; k<=4; ++k) {
781 H += k*(src0[k] - src0[-k]);
782 V += k*(src1[0] - src2[ 0]);
784 H = ( 17*H+16 ) >> 5;
785 V = ( 17*V+16 ) >> 5;
787 a = 16*(src1[0] + src2[8]+1) - 3*(V+H);
791 src[0] =
CLIP((b ) >> 5);
792 src[1] =
CLIP((b+ H) >> 5);
793 src[2] =
CLIP((b+2*H) >> 5);
794 src[3] =
CLIP((b+3*H) >> 5);
795 src[4] =
CLIP((b+4*H) >> 5);
796 src[5] =
CLIP((b+5*H) >> 5);
797 src[6] =
CLIP((b+6*H) >> 5);
798 src[7] =
CLIP((b+7*H) >> 5);
809 int stride = _stride>>(
sizeof(
pixel)-1);
811 const pixel * src1 = src +8*stride-1;
813 int H = src0[1] - src0[-1];
814 int V = src1[0] - src2[ 0];
816 for (k = 2; k <= 4; ++k) {
818 H += k*(src0[k] - src0[-k]);
819 V += k*(src1[0] - src2[ 0]);
821 for (; k <= 8; ++k) {
823 V += k*(src1[0] - src2[0]);
829 a = 16*(src1[0] + src2[8] + 1) - 7*V - 3*H;
830 for(j=16; j>0; --j) {
833 src[0] =
CLIP((b ) >> 5);
834 src[1] =
CLIP((b+ H) >> 5);
835 src[2] =
CLIP((b+2*H) >> 5);
836 src[3] =
CLIP((b+3*H) >> 5);
837 src[4] =
CLIP((b+4*H) >> 5);
838 src[5] =
CLIP((b+5*H) >> 5);
839 src[6] =
CLIP((b+6*H) >> 5);
840 src[7] =
CLIP((b+7*H) >> 5);
845 #define SRC(x,y) src[(x)+(y)*stride]
847 const int l##y = (SRC(-1,y-1) + 2*SRC(-1,y) + SRC(-1,y+1) + 2) >> 2;
848 #define PREDICT_8x8_LOAD_LEFT \
849 const int l0 = ((has_topleft ? SRC(-1,-1) : SRC(-1,0)) \
850 + 2*SRC(-1,0) + SRC(-1,1) + 2) >> 2; \
851 PL(1) PL(2) PL(3) PL(4) PL(5) PL(6) \
852 const int l7 av_unused = (SRC(-1,6) + 3*SRC(-1,7) + 2) >> 2
855 const int t##x = (SRC(x-1,-1) + 2*SRC(x,-1) + SRC(x+1,-1) + 2) >> 2;
856 #define PREDICT_8x8_LOAD_TOP \
857 const int t0 = ((has_topleft ? SRC(-1,-1) : SRC(0,-1)) \
858 + 2*SRC(0,-1) + SRC(1,-1) + 2) >> 2; \
859 PT(1) PT(2) PT(3) PT(4) PT(5) PT(6) \
860 const int t7 av_unused = ((has_topright ? SRC(8,-1) : SRC(7,-1)) \
861 + 2*SRC(7,-1) + SRC(6,-1) + 2) >> 2
864 t##x = (SRC(x-1,-1) + 2*SRC(x,-1) + SRC(x+1,-1) + 2) >> 2;
865 #define PREDICT_8x8_LOAD_TOPRIGHT \
866 int t8, t9, t10, t11, t12, t13, t14, t15; \
868 PTR(8) PTR(9) PTR(10) PTR(11) PTR(12) PTR(13) PTR(14) \
869 t15 = (SRC(14,-1) + 3*SRC(15,-1) + 2) >> 2; \
870 } else t8=t9=t10=t11=t12=t13=t14=t15= SRC(7,-1);
872 #define PREDICT_8x8_LOAD_TOPLEFT \
873 const int lt = (SRC(-1,0) + 2*SRC(-1,-1) + SRC(0,-1) + 2) >> 2
875 #define PREDICT_8x8_DC(v) \
877 for( y = 0; y < 8; y++ ) { \
878 AV_WN4PA(((pixel4*)src)+0, v); \
879 AV_WN4PA(((pixel4*)src)+1, v); \
884 int has_topright, ptrdiff_t _stride)
887 int stride = _stride>>(
sizeof(
pixel)-1);
892 int has_topright, ptrdiff_t _stride)
895 int stride = _stride>>(
sizeof(
pixel)-1);
902 int has_topright, ptrdiff_t _stride)
905 int stride = _stride>>(
sizeof(
pixel)-1);
912 int has_topright, ptrdiff_t _stride)
915 int stride = _stride>>(
sizeof(
pixel)-1);
924 int has_topright, ptrdiff_t _stride)
927 int stride = _stride>>(
sizeof(
pixel)-1);
931 #define ROW(y) a = PIXEL_SPLAT_X4(l##y); \
932 AV_WN4PA(src+y*stride, a); \
933 AV_WN4PA(src+y*stride+4, a);
938 int has_topright, ptrdiff_t _stride)
942 int stride = _stride>>(
sizeof(
pixel)-1);
956 for( y = 1; y < 8; y++ ) {
962 int has_topright, ptrdiff_t _stride)
965 int stride = _stride>>(
sizeof(
pixel)-1);
980 SRC(5,7)=
SRC(6,6)=
SRC(7,5)= (
t12 + 2*t13 + t14 + 2) >> 2;
981 SRC(6,7)=
SRC(7,6)= (t13 + 2*t14 + t15 + 2) >> 2;
982 SRC(7,7)= (t14 + 3*t15 + 2) >> 2;
985 int has_topright, ptrdiff_t _stride)
988 int stride = _stride>>(
sizeof(
pixel)-1);
992 SRC(0,7)= (l7 + 2*l6 + l5 + 2) >> 2;
993 SRC(0,6)=
SRC(1,7)= (l6 + 2*l5 + l4 + 2) >> 2;
994 SRC(0,5)=
SRC(1,6)=
SRC(2,7)= (l5 + 2*l4 + l3 + 2) >> 2;
995 SRC(0,4)=
SRC(1,5)=
SRC(2,6)=
SRC(3,7)= (l4 + 2*l3 + l2 + 2) >> 2;
996 SRC(0,3)=
SRC(1,4)=
SRC(2,5)=
SRC(3,6)=
SRC(4,7)= (l3 + 2*l2 + l1 + 2) >> 2;
1009 int has_topright, ptrdiff_t _stride)
1012 int stride = _stride>>(
sizeof(
pixel)-1);
1016 SRC(0,6)= (l5 + 2*l4 + l3 + 2) >> 2;
1017 SRC(0,7)= (l6 + 2*l5 + l4 + 2) >> 2;
1018 SRC(0,4)=
SRC(1,6)= (l3 + 2*l2 + l1 + 2) >> 2;
1019 SRC(0,5)=
SRC(1,7)= (l4 + 2*l3 + l2 + 2) >> 2;
1020 SRC(0,2)=
SRC(1,4)=
SRC(2,6)= (l1 + 2*l0 + lt + 2) >> 2;
1021 SRC(0,3)=
SRC(1,5)=
SRC(2,7)= (l2 + 2*l1 + l0 + 2) >> 2;
1040 int has_topright, ptrdiff_t _stride)
1043 int stride = _stride>>(
sizeof(
pixel)-1);
1047 SRC(0,7)= (l6 + l7 + 1) >> 1;
1048 SRC(1,7)= (l5 + 2*l6 + l7 + 2) >> 2;
1049 SRC(0,6)=
SRC(2,7)= (l5 + l6 + 1) >> 1;
1050 SRC(1,6)=
SRC(3,7)= (l4 + 2*l5 + l6 + 2) >> 2;
1051 SRC(0,5)=
SRC(2,6)=
SRC(4,7)= (l4 + l5 + 1) >> 1;
1052 SRC(1,5)=
SRC(3,6)=
SRC(5,7)= (l3 + 2*l4 + l5 + 2) >> 2;
1053 SRC(0,4)=
SRC(2,5)=
SRC(4,6)=
SRC(6,7)= (l3 + l4 + 1) >> 1;
1054 SRC(1,4)=
SRC(3,5)=
SRC(5,6)=
SRC(7,7)= (l2 + 2*l3 + l4 + 2) >> 2;
1055 SRC(0,3)=
SRC(2,4)=
SRC(4,5)=
SRC(6,6)= (l2 + l3 + 1) >> 1;
1056 SRC(1,3)=
SRC(3,4)=
SRC(5,5)=
SRC(7,6)= (l1 + 2*l2 + l3 + 2) >> 2;
1057 SRC(0,2)=
SRC(2,3)=
SRC(4,4)=
SRC(6,5)= (l1 + l2 + 1) >> 1;
1058 SRC(1,2)=
SRC(3,3)=
SRC(5,4)=
SRC(7,5)= (l0 + 2*l1 + l2 + 2) >> 2;
1059 SRC(0,1)=
SRC(2,2)=
SRC(4,3)=
SRC(6,4)= (l0 + l1 + 1) >> 1;
1060 SRC(1,1)=
SRC(3,2)=
SRC(5,3)=
SRC(7,4)= (lt + 2*l0 + l1 + 2) >> 2;
1061 SRC(0,0)=
SRC(2,1)=
SRC(4,2)=
SRC(6,3)= (lt + l0 + 1) >> 1;
1071 int has_topright, ptrdiff_t _stride)
1074 int stride = _stride>>(
sizeof(
pixel)-1);
1101 int has_topright, ptrdiff_t _stride)
1104 int stride = _stride>>(
sizeof(
pixel)-1);
1106 SRC(0,0)= (l0 + l1 + 1) >> 1;
1107 SRC(1,0)= (l0 + 2*l1 + l2 + 2) >> 2;
1108 SRC(0,1)=
SRC(2,0)= (l1 + l2 + 1) >> 1;
1109 SRC(1,1)=
SRC(3,0)= (l1 + 2*l2 + l3 + 2) >> 2;
1110 SRC(0,2)=
SRC(2,1)=
SRC(4,0)= (l2 + l3 + 1) >> 1;
1111 SRC(1,2)=
SRC(3,1)=
SRC(5,0)= (l2 + 2*l3 + l4 + 2) >> 2;
1112 SRC(0,3)=
SRC(2,2)=
SRC(4,1)=
SRC(6,0)= (l3 + l4 + 1) >> 1;
1113 SRC(1,3)=
SRC(3,2)=
SRC(5,1)=
SRC(7,0)= (l3 + 2*l4 + l5 + 2) >> 2;
1114 SRC(0,4)=
SRC(2,3)=
SRC(4,2)=
SRC(6,1)= (l4 + l5 + 1) >> 1;
1115 SRC(1,4)=
SRC(3,3)=
SRC(5,2)=
SRC(7,1)= (l4 + 2*l5 + l6 + 2) >> 2;
1116 SRC(0,5)=
SRC(2,4)=
SRC(4,3)=
SRC(6,2)= (l5 + l6 + 1) >> 1;
1117 SRC(1,5)=
SRC(3,4)=
SRC(5,3)=
SRC(7,2)= (l5 + 2*l6 + l7 + 2) >> 2;
1118 SRC(0,6)=
SRC(2,5)=
SRC(4,4)=
SRC(6,3)= (l6 + l7 + 1) >> 1;
1119 SRC(1,6)=
SRC(3,5)=
SRC(5,4)=
SRC(7,3)= (l6 + 3*l7 + 2) >> 2;
1125 #undef PREDICT_8x8_LOAD_LEFT
1126 #undef PREDICT_8x8_LOAD_TOP
1127 #undef PREDICT_8x8_LOAD_TOPLEFT
1128 #undef PREDICT_8x8_LOAD_TOPRIGHT
1129 #undef PREDICT_8x8_DC
1141 stride >>=
sizeof(
pixel)-1;
1145 pix[1*
stride]= v += block[0];
1146 pix[2*
stride]= v += block[4];
1147 pix[3*
stride]= v += block[8];
1148 pix[4*
stride]= v + block[12];
1160 stride >>=
sizeof(
pixel)-1;
1163 pix[0]= v += block[0];
1164 pix[1]= v += block[1];
1165 pix[2]= v += block[2];
1166 pix[3]= v + block[3];
1178 stride >>=
sizeof(
pixel)-1;
1182 pix[1*
stride]= v += block[0];
1183 pix[2*
stride]= v += block[8];
1184 pix[3*
stride]= v += block[16];
1185 pix[4*
stride]= v += block[24];
1186 pix[5*
stride]= v += block[32];
1187 pix[6*
stride]= v += block[40];
1188 pix[7*
stride]= v += block[48];
1189 pix[8*
stride]= v + block[56];
1201 stride >>=
sizeof(
pixel)-1;
1204 pix[0]= v += block[0];
1205 pix[1]= v += block[1];
1206 pix[2]= v += block[2];
1207 pix[3]= v += block[3];
1208 pix[4]= v += block[4];
1209 pix[5]= v += block[5];
1210 pix[6]= v += block[6];
1211 pix[7]= v + block[7];
1227 const int *block_offset,
1264 const int *block_offset,