FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/h264qpel_template.c
Date: 2025-10-10 03:51:19
Exec Total Coverage
Lines: 36 36 100.0%
Functions: 352 586 60.1%
Branches: 16 16 100.0%

Line Branch Exec Source
1 /*
2 * H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder
3 * Copyright (c) 2003-2010 Michael Niedermayer <michaelni@gmx.at>
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 #include "libavutil/common.h"
23 #include "libavutil/intreadwrite.h"
24
25 #include "bit_depth_template.c"
26 #include "hpel_template.c"
27 #include "pel_template.c"
28
29 65508 static inline void FUNC(copy_block2)(uint8_t *dst, const uint8_t *restrict src, int dstStride, int srcStride, int h)
30 {
31 int i;
32
2/2
✓ Branch 0 taken 458556 times.
✓ Branch 1 taken 65508 times.
524064 for(i=0; i<h; i++)
33 {
34 458556 AV_WN2P(dst , AV_RN2P(src ));
35 458556 dst+=dstStride;
36 458556 src+=srcStride;
37 }
38 65508 }
39
40 25376984 static inline void FUNC(copy_block4)(uint8_t *dst, const uint8_t *restrict src, int dstStride, int srcStride, int h)
41 {
42 int i;
43
2/2
✓ Branch 0 taken 114196428 times.
✓ Branch 1 taken 12688492 times.
253769840 for(i=0; i<h; i++)
44 {
45 228392856 AV_WN4P(dst , AV_RN4P(src ));
46 228392856 dst+=dstStride;
47 228392856 src+=srcStride;
48 }
49 25376984 }
50
51 13944600 static inline void FUNC(copy_block8)(uint8_t *dst, const uint8_t *restrict src, int dstStride, int srcStride, int h)
52 {
53 int i;
54
2/2
✓ Branch 0 taken 90639900 times.
✓ Branch 1 taken 6972300 times.
195224400 for(i=0; i<h; i++)
55 {
56 181279800 AV_WN4P(dst , AV_RN4P(src ));
57 181279800 AV_WN4P(dst+4*sizeof(pixel), AV_RN4P(src+4*sizeof(pixel)));
58 181279800 dst+=dstStride;
59 181279800 src+=srcStride;
60 }
61 13944600 }
62
63 6735230 static inline void FUNC(copy_block16)(uint8_t *dst, const uint8_t *restrict src, int dstStride, int srcStride, int h)
64 {
65 int i;
66
2/2
✓ Branch 0 taken 70719915 times.
✓ Branch 1 taken 3367615 times.
148175060 for(i=0; i<h; i++)
67 {
68 141439830 AV_WN4P(dst , AV_RN4P(src ));
69 141439830 AV_WN4P(dst+ 4*sizeof(pixel), AV_RN4P(src+ 4*sizeof(pixel)));
70 141439830 AV_WN4P(dst+ 8*sizeof(pixel), AV_RN4P(src+ 8*sizeof(pixel)));
71 141439830 AV_WN4P(dst+12*sizeof(pixel), AV_RN4P(src+12*sizeof(pixel)));
72 141439830 dst+=dstStride;
73 141439830 src+=srcStride;
74 }
75 6735230 }
76
77 #define H264_LOWPASS(OPNAME, OP, OP2) \
78 static void FUNC(OPNAME ## h264_qpel4_h_lowpass)(uint8_t *_dst, const uint8_t *restrict _src, int dstStride, int srcStride)\
79 {\
80 const int h=4;\
81 int i;\
82 pixel *dst = (pixel*)_dst;\
83 const pixel *restrict src = (const pixel*)_src;\
84 dstStride >>= sizeof(pixel)-1;\
85 srcStride >>= sizeof(pixel)-1;\
86 for(i=0; i<h; i++)\
87 {\
88 OP(dst[0], (src[0]+src[1])*20 - (src[-1]+src[2])*5 + (src[-2]+src[3]));\
89 OP(dst[1], (src[1]+src[2])*20 - (src[0 ]+src[3])*5 + (src[-1]+src[4]));\
90 OP(dst[2], (src[2]+src[3])*20 - (src[1 ]+src[4])*5 + (src[0 ]+src[5]));\
91 OP(dst[3], (src[3]+src[4])*20 - (src[2 ]+src[5])*5 + (src[1 ]+src[6]));\
92 dst+=dstStride;\
93 src+=srcStride;\
94 }\
95 }\
96 \
97 static void FUNC(OPNAME ## h264_qpel4_v_lowpass)(uint8_t *_dst, const uint8_t *restrict _src, int dstStride, int srcStride)\
98 {\
99 const int w=4;\
100 int i;\
101 pixel *dst = (pixel*)_dst;\
102 const pixel *restrict src = (const pixel*)_src;\
103 dstStride >>= sizeof(pixel)-1;\
104 srcStride >>= sizeof(pixel)-1;\
105 for(i=0; i<w; i++)\
106 {\
107 const int srcB= src[-2*srcStride];\
108 const int srcA= src[-1*srcStride];\
109 const int src0= src[0 *srcStride];\
110 const int src1= src[1 *srcStride];\
111 const int src2= src[2 *srcStride];\
112 const int src3= src[3 *srcStride];\
113 const int src4= src[4 *srcStride];\
114 const int src5= src[5 *srcStride];\
115 const int src6= src[6 *srcStride];\
116 OP(dst[0*dstStride], (src0+src1)*20 - (srcA+src2)*5 + (srcB+src3));\
117 OP(dst[1*dstStride], (src1+src2)*20 - (src0+src3)*5 + (srcA+src4));\
118 OP(dst[2*dstStride], (src2+src3)*20 - (src1+src4)*5 + (src0+src5));\
119 OP(dst[3*dstStride], (src3+src4)*20 - (src2+src5)*5 + (src1+src6));\
120 dst++;\
121 src++;\
122 }\
123 }\
124 \
125 static void FUNC(OPNAME ## h264_qpel4_hv_lowpass)(uint8_t *_dst, pixeltmp *tmp, const uint8_t *restrict _src, int dstStride, int tmpStride, int srcStride)\
126 {\
127 const int h=4;\
128 const int w=4;\
129 const int pad = (BIT_DEPTH == 10) ? (-10 * ((1<<BIT_DEPTH)-1)) : 0;\
130 int i;\
131 pixel *dst = (pixel*)_dst;\
132 const pixel *restrict src = (const pixel*)_src;\
133 dstStride >>= sizeof(pixel)-1;\
134 srcStride >>= sizeof(pixel)-1;\
135 src -= 2*srcStride;\
136 for(i=0; i<h+5; i++)\
137 {\
138 tmp[0]= (src[0]+src[1])*20 - (src[-1]+src[2])*5 + (src[-2]+src[3]) + pad;\
139 tmp[1]= (src[1]+src[2])*20 - (src[0 ]+src[3])*5 + (src[-1]+src[4]) + pad;\
140 tmp[2]= (src[2]+src[3])*20 - (src[1 ]+src[4])*5 + (src[0 ]+src[5]) + pad;\
141 tmp[3]= (src[3]+src[4])*20 - (src[2 ]+src[5])*5 + (src[1 ]+src[6]) + pad;\
142 tmp+=tmpStride;\
143 src+=srcStride;\
144 }\
145 tmp -= tmpStride*(h+5-2);\
146 for(i=0; i<w; i++)\
147 {\
148 const int tmpB= tmp[-2*tmpStride] - pad;\
149 const int tmpA= tmp[-1*tmpStride] - pad;\
150 const int tmp0= tmp[0 *tmpStride] - pad;\
151 const int tmp1= tmp[1 *tmpStride] - pad;\
152 const int tmp2= tmp[2 *tmpStride] - pad;\
153 const int tmp3= tmp[3 *tmpStride] - pad;\
154 const int tmp4= tmp[4 *tmpStride] - pad;\
155 const int tmp5= tmp[5 *tmpStride] - pad;\
156 const int tmp6= tmp[6 *tmpStride] - pad;\
157 OP2(dst[0*dstStride], (tmp0+tmp1)*20 - (tmpA+tmp2)*5 + (tmpB+tmp3));\
158 OP2(dst[1*dstStride], (tmp1+tmp2)*20 - (tmp0+tmp3)*5 + (tmpA+tmp4));\
159 OP2(dst[2*dstStride], (tmp2+tmp3)*20 - (tmp1+tmp4)*5 + (tmp0+tmp5));\
160 OP2(dst[3*dstStride], (tmp3+tmp4)*20 - (tmp2+tmp5)*5 + (tmp1+tmp6));\
161 dst++;\
162 tmp++;\
163 }\
164 }\
165 \
166 static void FUNC(OPNAME ## h264_qpel8_h_lowpass)(uint8_t *_dst, const uint8_t *restrict _src, int dstStride, int srcStride)\
167 {\
168 const int h=8;\
169 int i;\
170 pixel *dst = (pixel*)_dst;\
171 const pixel *restrict src = (const pixel*)_src;\
172 dstStride >>= sizeof(pixel)-1;\
173 srcStride >>= sizeof(pixel)-1;\
174 for(i=0; i<h; i++)\
175 {\
176 OP(dst[0], (src[0]+src[1])*20 - (src[-1]+src[2])*5 + (src[-2]+src[3 ]));\
177 OP(dst[1], (src[1]+src[2])*20 - (src[0 ]+src[3])*5 + (src[-1]+src[4 ]));\
178 OP(dst[2], (src[2]+src[3])*20 - (src[1 ]+src[4])*5 + (src[0 ]+src[5 ]));\
179 OP(dst[3], (src[3]+src[4])*20 - (src[2 ]+src[5])*5 + (src[1 ]+src[6 ]));\
180 OP(dst[4], (src[4]+src[5])*20 - (src[3 ]+src[6])*5 + (src[2 ]+src[7 ]));\
181 OP(dst[5], (src[5]+src[6])*20 - (src[4 ]+src[7])*5 + (src[3 ]+src[8 ]));\
182 OP(dst[6], (src[6]+src[7])*20 - (src[5 ]+src[8])*5 + (src[4 ]+src[9 ]));\
183 OP(dst[7], (src[7]+src[8])*20 - (src[6 ]+src[9])*5 + (src[5 ]+src[10]));\
184 dst+=dstStride;\
185 src+=srcStride;\
186 }\
187 }\
188 \
189 static void FUNC(OPNAME ## h264_qpel8_v_lowpass)(uint8_t *_dst, const uint8_t *restrict _src, int dstStride, int srcStride)\
190 {\
191 const int w=8;\
192 int i;\
193 pixel *dst = (pixel*)_dst;\
194 const pixel *restrict src = (const pixel*)_src;\
195 dstStride >>= sizeof(pixel)-1;\
196 srcStride >>= sizeof(pixel)-1;\
197 for(i=0; i<w; i++)\
198 {\
199 const int srcB= src[-2*srcStride];\
200 const int srcA= src[-1*srcStride];\
201 const int src0= src[0 *srcStride];\
202 const int src1= src[1 *srcStride];\
203 const int src2= src[2 *srcStride];\
204 const int src3= src[3 *srcStride];\
205 const int src4= src[4 *srcStride];\
206 const int src5= src[5 *srcStride];\
207 const int src6= src[6 *srcStride];\
208 const int src7= src[7 *srcStride];\
209 const int src8= src[8 *srcStride];\
210 const int src9= src[9 *srcStride];\
211 const int src10=src[10*srcStride];\
212 OP(dst[0*dstStride], (src0+src1)*20 - (srcA+src2)*5 + (srcB+src3));\
213 OP(dst[1*dstStride], (src1+src2)*20 - (src0+src3)*5 + (srcA+src4));\
214 OP(dst[2*dstStride], (src2+src3)*20 - (src1+src4)*5 + (src0+src5));\
215 OP(dst[3*dstStride], (src3+src4)*20 - (src2+src5)*5 + (src1+src6));\
216 OP(dst[4*dstStride], (src4+src5)*20 - (src3+src6)*5 + (src2+src7));\
217 OP(dst[5*dstStride], (src5+src6)*20 - (src4+src7)*5 + (src3+src8));\
218 OP(dst[6*dstStride], (src6+src7)*20 - (src5+src8)*5 + (src4+src9));\
219 OP(dst[7*dstStride], (src7+src8)*20 - (src6+src9)*5 + (src5+src10));\
220 dst++;\
221 src++;\
222 }\
223 }\
224 \
225 static void FUNC(OPNAME ## h264_qpel8_hv_lowpass)(uint8_t *_dst, pixeltmp *tmp, const uint8_t *restrict _src, int dstStride, int tmpStride, int srcStride)\
226 {\
227 const int h=8;\
228 const int w=8;\
229 const int pad = (BIT_DEPTH == 10) ? (-10 * ((1<<BIT_DEPTH)-1)) : 0;\
230 int i;\
231 pixel *dst = (pixel*)_dst;\
232 const pixel *restrict src = (const pixel*)_src;\
233 dstStride >>= sizeof(pixel)-1;\
234 srcStride >>= sizeof(pixel)-1;\
235 src -= 2*srcStride;\
236 for(i=0; i<h+5; i++)\
237 {\
238 tmp[0]= (src[0]+src[1])*20 - (src[-1]+src[2])*5 + (src[-2]+src[3 ]) + pad;\
239 tmp[1]= (src[1]+src[2])*20 - (src[0 ]+src[3])*5 + (src[-1]+src[4 ]) + pad;\
240 tmp[2]= (src[2]+src[3])*20 - (src[1 ]+src[4])*5 + (src[0 ]+src[5 ]) + pad;\
241 tmp[3]= (src[3]+src[4])*20 - (src[2 ]+src[5])*5 + (src[1 ]+src[6 ]) + pad;\
242 tmp[4]= (src[4]+src[5])*20 - (src[3 ]+src[6])*5 + (src[2 ]+src[7 ]) + pad;\
243 tmp[5]= (src[5]+src[6])*20 - (src[4 ]+src[7])*5 + (src[3 ]+src[8 ]) + pad;\
244 tmp[6]= (src[6]+src[7])*20 - (src[5 ]+src[8])*5 + (src[4 ]+src[9 ]) + pad;\
245 tmp[7]= (src[7]+src[8])*20 - (src[6 ]+src[9])*5 + (src[5 ]+src[10]) + pad;\
246 tmp+=tmpStride;\
247 src+=srcStride;\
248 }\
249 tmp -= tmpStride*(h+5-2);\
250 for(i=0; i<w; i++)\
251 {\
252 const int tmpB= tmp[-2*tmpStride] - pad;\
253 const int tmpA= tmp[-1*tmpStride] - pad;\
254 const int tmp0= tmp[0 *tmpStride] - pad;\
255 const int tmp1= tmp[1 *tmpStride] - pad;\
256 const int tmp2= tmp[2 *tmpStride] - pad;\
257 const int tmp3= tmp[3 *tmpStride] - pad;\
258 const int tmp4= tmp[4 *tmpStride] - pad;\
259 const int tmp5= tmp[5 *tmpStride] - pad;\
260 const int tmp6= tmp[6 *tmpStride] - pad;\
261 const int tmp7= tmp[7 *tmpStride] - pad;\
262 const int tmp8= tmp[8 *tmpStride] - pad;\
263 const int tmp9= tmp[9 *tmpStride] - pad;\
264 const int tmp10=tmp[10*tmpStride] - pad;\
265 OP2(dst[0*dstStride], (tmp0+tmp1)*20 - (tmpA+tmp2)*5 + (tmpB+tmp3));\
266 OP2(dst[1*dstStride], (tmp1+tmp2)*20 - (tmp0+tmp3)*5 + (tmpA+tmp4));\
267 OP2(dst[2*dstStride], (tmp2+tmp3)*20 - (tmp1+tmp4)*5 + (tmp0+tmp5));\
268 OP2(dst[3*dstStride], (tmp3+tmp4)*20 - (tmp2+tmp5)*5 + (tmp1+tmp6));\
269 OP2(dst[4*dstStride], (tmp4+tmp5)*20 - (tmp3+tmp6)*5 + (tmp2+tmp7));\
270 OP2(dst[5*dstStride], (tmp5+tmp6)*20 - (tmp4+tmp7)*5 + (tmp3+tmp8));\
271 OP2(dst[6*dstStride], (tmp6+tmp7)*20 - (tmp5+tmp8)*5 + (tmp4+tmp9));\
272 OP2(dst[7*dstStride], (tmp7+tmp8)*20 - (tmp6+tmp9)*5 + (tmp5+tmp10));\
273 dst++;\
274 tmp++;\
275 }\
276 }\
277 \
278 static void FUNC(OPNAME ## h264_qpel16_v_lowpass)(uint8_t *dst, const uint8_t *restrict src, int dstStride, int srcStride)\
279 {\
280 FUNC(OPNAME ## h264_qpel8_v_lowpass)(dst , src , dstStride, srcStride);\
281 FUNC(OPNAME ## h264_qpel8_v_lowpass)(dst+8*sizeof(pixel), src+8*sizeof(pixel), dstStride, srcStride);\
282 src += 8*srcStride;\
283 dst += 8*dstStride;\
284 FUNC(OPNAME ## h264_qpel8_v_lowpass)(dst , src , dstStride, srcStride);\
285 FUNC(OPNAME ## h264_qpel8_v_lowpass)(dst+8*sizeof(pixel), src+8*sizeof(pixel), dstStride, srcStride);\
286 }\
287 \
288 static void FUNC(OPNAME ## h264_qpel16_h_lowpass)(uint8_t *dst, const uint8_t *restrict src, int dstStride, int srcStride)\
289 {\
290 FUNC(OPNAME ## h264_qpel8_h_lowpass)(dst , src , dstStride, srcStride);\
291 FUNC(OPNAME ## h264_qpel8_h_lowpass)(dst+8*sizeof(pixel), src+8*sizeof(pixel), dstStride, srcStride);\
292 src += 8*srcStride;\
293 dst += 8*dstStride;\
294 FUNC(OPNAME ## h264_qpel8_h_lowpass)(dst , src , dstStride, srcStride);\
295 FUNC(OPNAME ## h264_qpel8_h_lowpass)(dst+8*sizeof(pixel), src+8*sizeof(pixel), dstStride, srcStride);\
296 }\
297 \
298 static void FUNC(OPNAME ## h264_qpel16_hv_lowpass)(uint8_t *dst, pixeltmp *tmp, const uint8_t *restrict src, int dstStride, int tmpStride, int srcStride){\
299 FUNC(OPNAME ## h264_qpel8_hv_lowpass)(dst , tmp , src , dstStride, tmpStride, srcStride);\
300 FUNC(OPNAME ## h264_qpel8_hv_lowpass)(dst+8*sizeof(pixel), tmp+8, src+8*sizeof(pixel), dstStride, tmpStride, srcStride);\
301 src += 8*srcStride;\
302 dst += 8*dstStride;\
303 FUNC(OPNAME ## h264_qpel8_hv_lowpass)(dst , tmp , src , dstStride, tmpStride, srcStride);\
304 FUNC(OPNAME ## h264_qpel8_hv_lowpass)(dst+8*sizeof(pixel), tmp+8, src+8*sizeof(pixel), dstStride, tmpStride, srcStride);\
305 }\
306
307 #define H264_MC(OPNAME, NAME, SIZE) \
308 static void FUNCC(OPNAME ## NAME ## _qpel ## SIZE ## _mc00)(uint8_t *dst, const uint8_t *restrict src, ptrdiff_t stride)\
309 {\
310 FUNCC(OPNAME ## pixels ## SIZE)(dst, src, stride, SIZE);\
311 }\
312 \
313 static void FUNCC(OPNAME ## NAME ## _qpel ## SIZE ## _mc10)(uint8_t *dst, const uint8_t *restrict src, ptrdiff_t stride)\
314 {\
315 uint8_t half[SIZE*SIZE*sizeof(pixel)];\
316 FUNC(put_ ## NAME ## _qpel ## SIZE ## _h_lowpass)(half, src, SIZE*sizeof(pixel), stride);\
317 FUNC(OPNAME ## pixels ## SIZE ## _l2)(dst, src, half, stride, stride, SIZE*sizeof(pixel), SIZE);\
318 }\
319 \
320 static void FUNCC(OPNAME ## NAME ## _qpel ## SIZE ## _mc20)(uint8_t *dst, const uint8_t *restrict src, ptrdiff_t stride)\
321 {\
322 FUNC(OPNAME ## NAME ## _qpel ## SIZE ## _h_lowpass)(dst, src, stride, stride);\
323 }\
324 \
325 static void FUNCC(OPNAME ## NAME ## _qpel ## SIZE ## _mc30)(uint8_t *dst, const uint8_t *restrict src, ptrdiff_t stride)\
326 {\
327 uint8_t half[SIZE*SIZE*sizeof(pixel)];\
328 FUNC(put_ ## NAME ## _qpel ## SIZE ## _h_lowpass)(half, src, SIZE*sizeof(pixel), stride);\
329 FUNC(OPNAME ## pixels ## SIZE ## _l2)(dst, src+sizeof(pixel), half, stride, stride, SIZE*sizeof(pixel), SIZE);\
330 }\
331 \
332 static void FUNCC(OPNAME ## NAME ## _qpel ## SIZE ## _mc01)(uint8_t *dst, const uint8_t *restrict src, ptrdiff_t stride)\
333 {\
334 uint8_t full[SIZE*(SIZE+5)*sizeof(pixel)];\
335 uint8_t * const full_mid= full + SIZE*2*sizeof(pixel);\
336 uint8_t half[SIZE*SIZE*sizeof(pixel)];\
337 FUNC(copy_block ## SIZE )(full, src - stride*2, SIZE*sizeof(pixel), stride, SIZE + 5);\
338 FUNC(put_ ## NAME ## _qpel ## SIZE ## _v_lowpass)(half, full_mid, SIZE*sizeof(pixel), SIZE*sizeof(pixel));\
339 FUNC(OPNAME ## pixels ## SIZE ## _l2)(dst, full_mid, half, stride, SIZE*sizeof(pixel), SIZE*sizeof(pixel), SIZE);\
340 }\
341 \
342 static void FUNCC(OPNAME ## NAME ## _qpel ## SIZE ## _mc02)(uint8_t *dst, const uint8_t *restrict src, ptrdiff_t stride)\
343 {\
344 uint8_t full[SIZE*(SIZE+5)*sizeof(pixel)];\
345 uint8_t * const full_mid= full + SIZE*2*sizeof(pixel);\
346 FUNC(copy_block ## SIZE )(full, src - stride*2, SIZE*sizeof(pixel), stride, SIZE + 5);\
347 FUNC(OPNAME ## NAME ## _qpel ## SIZE ## _v_lowpass)(dst, full_mid, stride, SIZE*sizeof(pixel));\
348 }\
349 \
350 static void FUNCC(OPNAME ## NAME ## _qpel ## SIZE ## _mc03)(uint8_t *dst, const uint8_t *restrict src, ptrdiff_t stride)\
351 {\
352 uint8_t full[SIZE*(SIZE+5)*sizeof(pixel)];\
353 uint8_t * const full_mid= full + SIZE*2*sizeof(pixel);\
354 uint8_t half[SIZE*SIZE*sizeof(pixel)];\
355 FUNC(copy_block ## SIZE )(full, src - stride*2, SIZE*sizeof(pixel), stride, SIZE + 5);\
356 FUNC(put_ ## NAME ## _qpel ## SIZE ## _v_lowpass)(half, full_mid, SIZE*sizeof(pixel), SIZE*sizeof(pixel));\
357 FUNC(OPNAME ## pixels ## SIZE ## _l2)(dst, full_mid+SIZE*sizeof(pixel), half, stride, SIZE*sizeof(pixel), SIZE*sizeof(pixel), SIZE);\
358 }\
359 \
360 static void FUNCC(OPNAME ## NAME ## _qpel ## SIZE ## _mc11)(uint8_t *dst, const uint8_t *restrict src, ptrdiff_t stride)\
361 {\
362 uint8_t full[SIZE*(SIZE+5)*sizeof(pixel)];\
363 uint8_t * const full_mid= full + SIZE*2*sizeof(pixel);\
364 uint8_t halfH[SIZE*SIZE*sizeof(pixel)];\
365 uint8_t halfV[SIZE*SIZE*sizeof(pixel)];\
366 FUNC(put_ ## NAME ## _qpel ## SIZE ## _h_lowpass)(halfH, src, SIZE*sizeof(pixel), stride);\
367 FUNC(copy_block ## SIZE )(full, src - stride*2, SIZE*sizeof(pixel), stride, SIZE + 5);\
368 FUNC(put_ ## NAME ## _qpel ## SIZE ## _v_lowpass)(halfV, full_mid, SIZE*sizeof(pixel), SIZE*sizeof(pixel));\
369 FUNC(OPNAME ## pixels ## SIZE ## _l2)(dst, halfH, halfV, stride, SIZE*sizeof(pixel), SIZE*sizeof(pixel), SIZE);\
370 }\
371 \
372 static void FUNCC(OPNAME ## NAME ## _qpel ## SIZE ## _mc31)(uint8_t *dst, const uint8_t *restrict src, ptrdiff_t stride)\
373 {\
374 uint8_t full[SIZE*(SIZE+5)*sizeof(pixel)];\
375 uint8_t * const full_mid= full + SIZE*2*sizeof(pixel);\
376 uint8_t halfH[SIZE*SIZE*sizeof(pixel)];\
377 uint8_t halfV[SIZE*SIZE*sizeof(pixel)];\
378 FUNC(put_ ## NAME ## _qpel ## SIZE ## _h_lowpass)(halfH, src, SIZE*sizeof(pixel), stride);\
379 FUNC(copy_block ## SIZE )(full, src - stride*2 + sizeof(pixel), SIZE*sizeof(pixel), stride, SIZE + 5);\
380 FUNC(put_ ## NAME ## _qpel ## SIZE ## _v_lowpass)(halfV, full_mid, SIZE*sizeof(pixel), SIZE*sizeof(pixel));\
381 FUNC(OPNAME ## pixels ## SIZE ## _l2)(dst, halfH, halfV, stride, SIZE*sizeof(pixel), SIZE*sizeof(pixel), SIZE);\
382 }\
383 \
384 static void FUNCC(OPNAME ## NAME ## _qpel ## SIZE ## _mc13)(uint8_t *dst, const uint8_t *restrict src, ptrdiff_t stride)\
385 {\
386 uint8_t full[SIZE*(SIZE+5)*sizeof(pixel)];\
387 uint8_t * const full_mid= full + SIZE*2*sizeof(pixel);\
388 uint8_t halfH[SIZE*SIZE*sizeof(pixel)];\
389 uint8_t halfV[SIZE*SIZE*sizeof(pixel)];\
390 FUNC(put_ ## NAME ## _qpel ## SIZE ## _h_lowpass)(halfH, src + stride, SIZE*sizeof(pixel), stride);\
391 FUNC(copy_block ## SIZE )(full, src - stride*2, SIZE*sizeof(pixel), stride, SIZE + 5);\
392 FUNC(put_ ## NAME ## _qpel ## SIZE ## _v_lowpass)(halfV, full_mid, SIZE*sizeof(pixel), SIZE*sizeof(pixel));\
393 FUNC(OPNAME ## pixels ## SIZE ## _l2)(dst, halfH, halfV, stride, SIZE*sizeof(pixel), SIZE*sizeof(pixel), SIZE);\
394 }\
395 \
396 static void FUNCC(OPNAME ## NAME ## _qpel ## SIZE ## _mc33)(uint8_t *dst, const uint8_t *restrict src, ptrdiff_t stride)\
397 {\
398 uint8_t full[SIZE*(SIZE+5)*sizeof(pixel)];\
399 uint8_t * const full_mid= full + SIZE*2*sizeof(pixel);\
400 uint8_t halfH[SIZE*SIZE*sizeof(pixel)];\
401 uint8_t halfV[SIZE*SIZE*sizeof(pixel)];\
402 FUNC(put_ ## NAME ## _qpel ## SIZE ## _h_lowpass)(halfH, src + stride, SIZE*sizeof(pixel), stride);\
403 FUNC(copy_block ## SIZE )(full, src - stride*2 + sizeof(pixel), SIZE*sizeof(pixel), stride, SIZE + 5);\
404 FUNC(put_ ## NAME ## _qpel ## SIZE ## _v_lowpass)(halfV, full_mid, SIZE*sizeof(pixel), SIZE*sizeof(pixel));\
405 FUNC(OPNAME ## pixels ## SIZE ## _l2)(dst, halfH, halfV, stride, SIZE*sizeof(pixel), SIZE*sizeof(pixel), SIZE);\
406 }\
407 \
408 static void FUNCC(OPNAME ## NAME ## _qpel ## SIZE ## _mc22)(uint8_t *dst, const uint8_t *restrict src, ptrdiff_t stride)\
409 {\
410 pixeltmp tmp[SIZE*(SIZE+5)*sizeof(pixel)];\
411 FUNC(OPNAME ## NAME ## _qpel ## SIZE ## _hv_lowpass)(dst, tmp, src, stride, SIZE*sizeof(pixel), stride);\
412 }\
413 \
414 static void FUNCC(OPNAME ## NAME ## _qpel ## SIZE ## _mc21)(uint8_t *dst, const uint8_t *restrict src, ptrdiff_t stride)\
415 {\
416 pixeltmp tmp[SIZE*(SIZE+5)*sizeof(pixel)];\
417 uint8_t halfH[SIZE*SIZE*sizeof(pixel)];\
418 uint8_t halfHV[SIZE*SIZE*sizeof(pixel)];\
419 FUNC(put_ ## NAME ## _qpel ## SIZE ## _h_lowpass)(halfH, src, SIZE*sizeof(pixel), stride);\
420 FUNC(put_ ## NAME ## _qpel ## SIZE ## _hv_lowpass)(halfHV, tmp, src, SIZE*sizeof(pixel), SIZE*sizeof(pixel), stride);\
421 FUNC(OPNAME ## pixels ## SIZE ## _l2)(dst, halfH, halfHV, stride, SIZE*sizeof(pixel), SIZE*sizeof(pixel), SIZE);\
422 }\
423 \
424 static void FUNCC(OPNAME ## NAME ## _qpel ## SIZE ## _mc23)(uint8_t *dst, const uint8_t *restrict src, ptrdiff_t stride)\
425 {\
426 pixeltmp tmp[SIZE*(SIZE+5)*sizeof(pixel)];\
427 uint8_t halfH[SIZE*SIZE*sizeof(pixel)];\
428 uint8_t halfHV[SIZE*SIZE*sizeof(pixel)];\
429 FUNC(put_ ## NAME ## _qpel ## SIZE ## _h_lowpass)(halfH, src + stride, SIZE*sizeof(pixel), stride);\
430 FUNC(put_ ## NAME ## _qpel ## SIZE ## _hv_lowpass)(halfHV, tmp, src, SIZE*sizeof(pixel), SIZE*sizeof(pixel), stride);\
431 FUNC(OPNAME ## pixels ## SIZE ## _l2)(dst, halfH, halfHV, stride, SIZE*sizeof(pixel), SIZE*sizeof(pixel), SIZE);\
432 }\
433 \
434 static void FUNCC(OPNAME ## NAME ## _qpel ## SIZE ## _mc12)(uint8_t *dst, const uint8_t *restrict src, ptrdiff_t stride)\
435 {\
436 uint8_t full[SIZE*(SIZE+5)*sizeof(pixel)];\
437 uint8_t * const full_mid= full + SIZE*2*sizeof(pixel);\
438 pixeltmp tmp[SIZE*(SIZE+5)*sizeof(pixel)];\
439 uint8_t halfV[SIZE*SIZE*sizeof(pixel)];\
440 uint8_t halfHV[SIZE*SIZE*sizeof(pixel)];\
441 FUNC(copy_block ## SIZE )(full, src - stride*2, SIZE*sizeof(pixel), stride, SIZE + 5);\
442 FUNC(put_ ## NAME ## _qpel ## SIZE ## _v_lowpass)(halfV, full_mid, SIZE*sizeof(pixel), SIZE*sizeof(pixel));\
443 FUNC(put_ ## NAME ## _qpel ## SIZE ## _hv_lowpass)(halfHV, tmp, src, SIZE*sizeof(pixel), SIZE*sizeof(pixel), stride);\
444 FUNC(OPNAME ## pixels ## SIZE ## _l2)(dst, halfV, halfHV, stride, SIZE*sizeof(pixel), SIZE*sizeof(pixel), SIZE);\
445 }\
446 \
447 static void FUNCC(OPNAME ## NAME ## _qpel ## SIZE ## _mc32)(uint8_t *dst, const uint8_t *restrict src, ptrdiff_t stride)\
448 {\
449 uint8_t full[SIZE*(SIZE+5)*sizeof(pixel)];\
450 uint8_t * const full_mid= full + SIZE*2*sizeof(pixel);\
451 pixeltmp tmp[SIZE*(SIZE+5)*sizeof(pixel)];\
452 uint8_t halfV[SIZE*SIZE*sizeof(pixel)];\
453 uint8_t halfHV[SIZE*SIZE*sizeof(pixel)];\
454 FUNC(copy_block ## SIZE )(full, src - stride*2 + sizeof(pixel), SIZE*sizeof(pixel), stride, SIZE + 5);\
455 FUNC(put_ ## NAME ## _qpel ## SIZE ## _v_lowpass)(halfV, full_mid, SIZE*sizeof(pixel), SIZE*sizeof(pixel));\
456 FUNC(put_ ## NAME ## _qpel ## SIZE ## _hv_lowpass)(halfHV, tmp, src, SIZE*sizeof(pixel), SIZE*sizeof(pixel), stride);\
457 FUNC(OPNAME ## pixels ## SIZE ## _l2)(dst, halfV, halfHV, stride, SIZE*sizeof(pixel), SIZE*sizeof(pixel), SIZE);\
458 }\
459
460 #define op_avg(a, b) a = (((a)+CLIP(((b) + 16)>>5)+1)>>1)
461 //#define op_avg2(a, b) a = (((a)*w1+cm[((b) + 16)>>5]*w2 + o + 64)>>7)
462 #define op_put(a, b) a = CLIP(((b) + 16)>>5)
463 #define op2_avg(a, b) a = (((a)+CLIP(((b) + 512)>>10)+1)>>1)
464 #define op2_put(a, b) a = CLIP(((b) + 512)>>10)
465
466 #ifndef SNOW
467
4/4
✓ Branch 0 taken 624172341 times.
✓ Branch 1 taken 84957460 times.
✓ Branch 2 taken 86775048 times.
✓ Branch 3 taken 11796717 times.
1610733792 H264_LOWPASS(put_ , op_put, op2_put)
468
4/4
✓ Branch 0 taken 9289763 times.
✓ Branch 1 taken 1138358 times.
✓ Branch 2 taken 1435028 times.
✓ Branch 3 taken 192131 times.
24095310 H264_LOWPASS(avg_ , op_avg, op2_avg)
469 29207196 H264_MC(put_, h264, 4)
470 27522890 H264_MC(put_, h264, 8)
471 22532766 H264_MC(put_, h264, 16)
472 7888064 H264_MC(avg_, h264, 4)
473 2442308 H264_MC(avg_, h264, 8)
474 4816358 H264_MC(avg_, h264, 16)
475 #endif
476
477 #undef op_avg
478 #undef op_put
479 #undef op2_avg
480 #undef op2_put
481