28#define H264_CHROMA_MC(OPNAME, OP)\
29MC2_STATIC void FUNCC(ff_ ## OPNAME ## h264_chroma_mc2)(uint8_t *_dst, const uint8_t *_src, ptrdiff_t stride, int h, int x, int y)\
31 pixel *dst = (pixel*)_dst;\
32 const pixel *src = (const pixel*)_src;\
33 const int A=(8-x)*(8-y);\
34 const int B=( x)*(8-y);\
35 const int C=(8-x)*( y);\
36 const int D=( x)*( y);\
38 stride >>= sizeof(pixel)-1;\
40 av_assert2(x<8 && y<8 && x>=0 && y>=0);\
44 OP(dst[0], (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1]));\
45 OP(dst[1], (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2]));\
51 const ptrdiff_t step = C ? stride : 1;\
53 OP(dst[0], (A*src[0] + E*src[step+0]));\
54 OP(dst[1], (A*src[1] + E*src[step+1]));\
59 for ( i = 0; i < h; i++){\
60 OP(dst[0], A * src[0]);\
61 OP(dst[1], A * src[1]);\
68static void FUNCC(OPNAME ## h264_chroma_mc4)(uint8_t *_dst, const uint8_t *_src, ptrdiff_t stride, int h, int x, int y)\
70 pixel *dst = (pixel*)_dst;\
71 const pixel *src = (const pixel*)_src;\
72 const int A=(8-x)*(8-y);\
73 const int B=( x)*(8-y);\
74 const int C=(8-x)*( y);\
75 const int D=( x)*( y);\
77 stride >>= sizeof(pixel)-1;\
79 av_assert2(x<8 && y<8 && x>=0 && y>=0);\
83 OP(dst[0], (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1]));\
84 OP(dst[1], (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2]));\
85 OP(dst[2], (A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3]));\
86 OP(dst[3], (A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4]));\
92 const ptrdiff_t step = C ? stride : 1;\
94 OP(dst[0], (A*src[0] + E*src[step+0]));\
95 OP(dst[1], (A*src[1] + E*src[step+1]));\
96 OP(dst[2], (A*src[2] + E*src[step+2]));\
97 OP(dst[3], (A*src[3] + E*src[step+3]));\
102 for ( i = 0; i < h; i++){\
103 OP(dst[0], A * src[0]);\
104 OP(dst[1], A * src[1]);\
105 OP(dst[2], A * src[2]);\
106 OP(dst[3], A * src[3]);\
113static void FUNCC(OPNAME ## h264_chroma_mc8)(uint8_t *_dst, const uint8_t *_src, ptrdiff_t stride, int h, int x, int y)\
115 pixel *dst = (pixel*)_dst;\
116 const pixel *src = (const pixel*)_src;\
117 const int A=(8-x)*(8-y);\
118 const int B=( x)*(8-y);\
119 const int C=(8-x)*( y);\
120 const int D=( x)*( y);\
122 stride >>= sizeof(pixel)-1;\
124 av_assert2(x<8 && y<8 && x>=0 && y>=0);\
128 OP(dst[0], (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1]));\
129 OP(dst[1], (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2]));\
130 OP(dst[2], (A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3]));\
131 OP(dst[3], (A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4]));\
132 OP(dst[4], (A*src[4] + B*src[5] + C*src[stride+4] + D*src[stride+5]));\
133 OP(dst[5], (A*src[5] + B*src[6] + C*src[stride+5] + D*src[stride+6]));\
134 OP(dst[6], (A*src[6] + B*src[7] + C*src[stride+6] + D*src[stride+7]));\
135 OP(dst[7], (A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8]));\
141 const ptrdiff_t step = C ? stride : 1;\
143 OP(dst[0], (A*src[0] + E*src[step+0]));\
144 OP(dst[1], (A*src[1] + E*src[step+1]));\
145 OP(dst[2], (A*src[2] + E*src[step+2]));\
146 OP(dst[3], (A*src[3] + E*src[step+3]));\
147 OP(dst[4], (A*src[4] + E*src[step+4]));\
148 OP(dst[5], (A*src[5] + E*src[step+5]));\
149 OP(dst[6], (A*src[6] + E*src[step+6]));\
150 OP(dst[7], (A*src[7] + E*src[step+7]));\
155 for ( i = 0; i < h; i++){\
156 OP(dst[0], A * src[0]);\
157 OP(dst[1], A * src[1]);\
158 OP(dst[2], A * src[2]);\
159 OP(dst[3], A * src[3]);\
160 OP(dst[4], A * src[4]);\
161 OP(dst[5], A * src[5]);\
162 OP(dst[6], A * src[6]);\
163 OP(dst[7], A * src[7]);\
170#define op_avg(a, b) a = (((a)+(((b) + 32)>>6)+1)>>1)
171#define op_put(a, b) a = (((b) + 32)>>6)
simple assert() macros that are a bit more flexible than ISO C assert().
#define H264_CHROMA_MC(OPNAME, OP)