39 pixel *ptr, *last_line;
45 memset(ptr - w, ptr[0], w);
52 last_line = buf + (height - 1) * wrap;
54 for(i = 0; i < h; i++)
55 memcpy(buf - (i + 1) *
wrap, buf, (
width + w + w) *
sizeof(
pixel));
57 for (i = 0; i < h; i++)
58 memcpy(last_line + (i + 1) *
wrap, last_line, (
width + w + w) *
sizeof(
pixel));
79 pixels += line_size /
sizeof(
pixel);
87 memset(block, 0,
sizeof(int16_t)*64);
90 static void FUNCC(clear_blocks)(int16_t *blocks)
92 memset(blocks, 0,
sizeof(int16_t)*6*64);
100 #define PIXOP2(OPNAME, OP) \
101 static inline void FUNC(OPNAME ## _no_rnd_pixels8_l2)(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, \
102 int src_stride1, int src_stride2, int h){\
106 a= AV_RN4P(&src1[i*src_stride1 ]);\
107 b= AV_RN4P(&src2[i*src_stride2 ]);\
108 OP(*((pixel4*)&dst[i*dst_stride ]), no_rnd_avg_pixel4(a, b));\
109 a= AV_RN4P(&src1[i*src_stride1+4*sizeof(pixel)]);\
110 b= AV_RN4P(&src2[i*src_stride2+4*sizeof(pixel)]);\
111 OP(*((pixel4*)&dst[i*dst_stride+4*sizeof(pixel)]), no_rnd_avg_pixel4(a, b));\
115 static inline void FUNC(OPNAME ## _no_rnd_pixels16_l2)(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, \
116 int src_stride1, int src_stride2, int h){\
117 FUNC(OPNAME ## _no_rnd_pixels8_l2)(dst , src1 , src2 , dst_stride, src_stride1, src_stride2, h);\
118 FUNC(OPNAME ## _no_rnd_pixels8_l2)(dst+8*sizeof(pixel), src1+8*sizeof(pixel), src2+8*sizeof(pixel), dst_stride, src_stride1, src_stride2, h);\
121 static inline void FUNC(OPNAME ## _pixels8_l4)(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, const uint8_t *src3, const uint8_t *src4,\
122 int dst_stride, int src_stride1, int src_stride2,int src_stride3,int src_stride4, int h){\
126 uint32_t a, b, c, d, l0, l1, h0, h1;\
127 a= AV_RN32(&src1[i*src_stride1]);\
128 b= AV_RN32(&src2[i*src_stride2]);\
129 c= AV_RN32(&src3[i*src_stride3]);\
130 d= AV_RN32(&src4[i*src_stride4]);\
131 l0= (a&0x03030303UL)\
134 h0= ((a&0xFCFCFCFCUL)>>2)\
135 + ((b&0xFCFCFCFCUL)>>2);\
136 l1= (c&0x03030303UL)\
138 h1= ((c&0xFCFCFCFCUL)>>2)\
139 + ((d&0xFCFCFCFCUL)>>2);\
140 OP(*((uint32_t*)&dst[i*dst_stride]), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\
141 a= AV_RN32(&src1[i*src_stride1+4]);\
142 b= AV_RN32(&src2[i*src_stride2+4]);\
143 c= AV_RN32(&src3[i*src_stride3+4]);\
144 d= AV_RN32(&src4[i*src_stride4+4]);\
145 l0= (a&0x03030303UL)\
148 h0= ((a&0xFCFCFCFCUL)>>2)\
149 + ((b&0xFCFCFCFCUL)>>2);\
150 l1= (c&0x03030303UL)\
152 h1= ((c&0xFCFCFCFCUL)>>2)\
153 + ((d&0xFCFCFCFCUL)>>2);\
154 OP(*((uint32_t*)&dst[i*dst_stride+4]), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\
158 static inline void FUNC(OPNAME ## _no_rnd_pixels8_l4)(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, const uint8_t *src3, const uint8_t *src4,\
159 int dst_stride, int src_stride1, int src_stride2,int src_stride3,int src_stride4, int h){\
163 uint32_t a, b, c, d, l0, l1, h0, h1;\
164 a= AV_RN32(&src1[i*src_stride1]);\
165 b= AV_RN32(&src2[i*src_stride2]);\
166 c= AV_RN32(&src3[i*src_stride3]);\
167 d= AV_RN32(&src4[i*src_stride4]);\
168 l0= (a&0x03030303UL)\
171 h0= ((a&0xFCFCFCFCUL)>>2)\
172 + ((b&0xFCFCFCFCUL)>>2);\
173 l1= (c&0x03030303UL)\
175 h1= ((c&0xFCFCFCFCUL)>>2)\
176 + ((d&0xFCFCFCFCUL)>>2);\
177 OP(*((uint32_t*)&dst[i*dst_stride]), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\
178 a= AV_RN32(&src1[i*src_stride1+4]);\
179 b= AV_RN32(&src2[i*src_stride2+4]);\
180 c= AV_RN32(&src3[i*src_stride3+4]);\
181 d= AV_RN32(&src4[i*src_stride4+4]);\
182 l0= (a&0x03030303UL)\
185 h0= ((a&0xFCFCFCFCUL)>>2)\
186 + ((b&0xFCFCFCFCUL)>>2);\
187 l1= (c&0x03030303UL)\
189 h1= ((c&0xFCFCFCFCUL)>>2)\
190 + ((d&0xFCFCFCFCUL)>>2);\
191 OP(*((uint32_t*)&dst[i*dst_stride+4]), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\
194 static inline void FUNC(OPNAME ## _pixels16_l4)(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, const uint8_t *src3, const uint8_t *src4,\
195 int dst_stride, int src_stride1, int src_stride2,int src_stride3,int src_stride4, int h){\
196 FUNC(OPNAME ## _pixels8_l4)(dst , src1 , src2 , src3 , src4 , dst_stride, src_stride1, src_stride2, src_stride3, src_stride4, h);\
197 FUNC(OPNAME ## _pixels8_l4)(dst+8*sizeof(pixel), src1+8*sizeof(pixel), src2+8*sizeof(pixel), src3+8*sizeof(pixel), src4+8*sizeof(pixel), dst_stride, src_stride1, src_stride2, src_stride3, src_stride4, h);\
199 static inline void FUNC(OPNAME ## _no_rnd_pixels16_l4)(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, const uint8_t *src3, const uint8_t *src4,\
200 int dst_stride, int src_stride1, int src_stride2,int src_stride3,int src_stride4, int h){\
201 FUNC(OPNAME ## _no_rnd_pixels8_l4)(dst , src1 , src2 , src3 , src4 , dst_stride, src_stride1, src_stride2, src_stride3, src_stride4, h);\
202 FUNC(OPNAME ## _no_rnd_pixels8_l4)(dst+8*sizeof(pixel), src1+8*sizeof(pixel), src2+8*sizeof(pixel), src3+8*sizeof(pixel), src4+8*sizeof(pixel), dst_stride, src_stride1, src_stride2, src_stride3, src_stride4, h);\
205 static inline void FUNCC(OPNAME ## _pixels8_xy2)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h)\
211 const uint32_t a= AV_RN32(pixels );\
212 const uint32_t b= AV_RN32(pixels+1);\
213 uint32_t l0= (a&0x03030303UL)\
216 uint32_t h0= ((a&0xFCFCFCFCUL)>>2)\
217 + ((b&0xFCFCFCFCUL)>>2);\
221 for(i=0; i<h; i+=2){\
222 uint32_t a= AV_RN32(pixels );\
223 uint32_t b= AV_RN32(pixels+1);\
224 l1= (a&0x03030303UL)\
226 h1= ((a&0xFCFCFCFCUL)>>2)\
227 + ((b&0xFCFCFCFCUL)>>2);\
228 OP(*((uint32_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\
231 a= AV_RN32(pixels );\
232 b= AV_RN32(pixels+1);\
233 l0= (a&0x03030303UL)\
236 h0= ((a&0xFCFCFCFCUL)>>2)\
237 + ((b&0xFCFCFCFCUL)>>2);\
238 OP(*((uint32_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\
242 pixels+=4-line_size*(h+1);\
243 block +=4-line_size*h;\
247 CALL_2X_PIXELS(FUNCC(OPNAME ## _pixels16_xy2), FUNCC(OPNAME ## _pixels8_xy2), 8*sizeof(pixel))\
249 #define op_avg(a, b) a = rnd_avg_pixel4(a, b)
250 #define op_put(a, b) a = b
252 #define put_no_rnd_pixels8_8_c put_pixels8_8_c
#define PIXOP2(OPNAME, OP)
static void FUNCC() get_pixels(int16_t *restrict block, const uint8_t *_pixels, int line_size)