FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libswscale/x86/swscale.c
Date: 2024-11-20 23:03:26
Exec Total Coverage
Lines: 192 253 75.9%
Functions: 6 6 100.0%
Branches: 680 1182 57.5%

Line Branch Exec Source
1 /*
2 * Copyright (C) 2001-2011 Michael Niedermayer <michaelni@gmx.at>
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 #include <inttypes.h>
22 #include "config.h"
23 #include "libswscale/swscale.h"
24 #include "libswscale/swscale_internal.h"
25 #include "libavutil/attributes.h"
26 #include "libavutil/avassert.h"
27 #include "libavutil/intreadwrite.h"
28 #include "libavutil/x86/cpu.h"
29 #include "libavutil/cpu.h"
30 #include "libavutil/mem_internal.h"
31 #include "libavutil/pixdesc.h"
32
33 const DECLARE_ALIGNED(8, uint64_t, ff_dither4)[2] = {
34 0x0103010301030103LL,
35 0x0200020002000200LL,};
36
37 const DECLARE_ALIGNED(8, uint64_t, ff_dither8)[2] = {
38 0x0602060206020602LL,
39 0x0004000400040004LL,};
40
41 #if HAVE_INLINE_ASM
42
43 DECLARE_ASM_CONST(8, uint64_t, bF8)= 0xF8F8F8F8F8F8F8F8LL;
44 DECLARE_ASM_CONST(8, uint64_t, bFC)= 0xFCFCFCFCFCFCFCFCLL;
45
46 DECLARE_ASM_ALIGNED(8, const uint64_t, ff_M24A) = 0x00FF0000FF0000FFLL;
47 DECLARE_ASM_ALIGNED(8, const uint64_t, ff_M24B) = 0xFF0000FF0000FF00LL;
48 DECLARE_ASM_ALIGNED(8, const uint64_t, ff_M24C) = 0x0000FF0000FF0000LL;
49
50 DECLARE_ASM_ALIGNED(8, const uint64_t, ff_bgr2YOffset) = 0x1010101010101010ULL;
51 DECLARE_ASM_ALIGNED(8, const uint64_t, ff_bgr2UVOffset) = 0x8080808080808080ULL;
52 DECLARE_ASM_ALIGNED(8, const uint64_t, ff_w1111) = 0x0001000100010001ULL;
53
54
55 // MMXEXT versions
56 #if HAVE_MMXEXT_INLINE
57 #undef RENAME
58 #undef COMPILE_TEMPLATE_MMXEXT
59 #define COMPILE_TEMPLATE_MMXEXT 1
60 #define RENAME(a) a ## _mmxext
61 #include "swscale_template.c"
62 #endif
63
64 22621691 void ff_updateMMXDitherTables(SwsInternal *c, int dstY)
65 {
66 22621691 const int dstH= c->dstH;
67 22621691 const int flags= c->flags;
68
69 22621691 SwsPlane *lumPlane = &c->slice[c->numSlice-2].plane[0];
70 22621691 SwsPlane *chrUPlane = &c->slice[c->numSlice-2].plane[1];
71 22621691 SwsPlane *alpPlane = &c->slice[c->numSlice-2].plane[3];
72
73 22621691 int hasAlpha = c->needAlpha;
74 22621691 int32_t *vLumFilterPos= c->vLumFilterPos;
75 22621691 int32_t *vChrFilterPos= c->vChrFilterPos;
76 22621691 int16_t *vLumFilter= c->vLumFilter;
77 22621691 int16_t *vChrFilter= c->vChrFilter;
78 22621691 int32_t *lumMmxFilter= c->lumMmxFilter;
79 22621691 int32_t *chrMmxFilter= c->chrMmxFilter;
80 22621691 int32_t av_unused *alpMmxFilter= c->alpMmxFilter;
81 22621691 const int vLumFilterSize= c->vLumFilterSize;
82 22621691 const int vChrFilterSize= c->vChrFilterSize;
83 22621691 const int chrDstY= dstY>>c->chrDstVSubSample;
84 22621691 const int firstLumSrcY= vLumFilterPos[dstY]; //First line needed as input
85 22621691 const int firstChrSrcY= vChrFilterPos[chrDstY]; //First line needed as input
86
87 22621691 c->blueDither= ff_dither8[dstY&1];
88
4/4
✓ Branch 0 taken 22422063 times.
✓ Branch 1 taken 199628 times.
✓ Branch 2 taken 51048 times.
✓ Branch 3 taken 22371015 times.
22621691 if (c->dstFormat == AV_PIX_FMT_RGB555 || c->dstFormat == AV_PIX_FMT_BGR555)
89 250676 c->greenDither= ff_dither8[dstY&1];
90 else
91 22371015 c->greenDither= ff_dither4[dstY&1];
92 22621691 c->redDither= ff_dither8[(dstY+1)&1];
93
2/2
✓ Branch 0 taken 22471993 times.
✓ Branch 1 taken 149698 times.
22621691 if (dstY < dstH - 2) {
94 22471993 const int16_t **lumSrcPtr = (const int16_t **)(void*) lumPlane->line + firstLumSrcY - lumPlane->sliceY;
95 22471993 const int16_t **chrUSrcPtr = (const int16_t **)(void*) chrUPlane->line + firstChrSrcY - chrUPlane->sliceY;
96
2/2
✓ Branch 0 taken 97859 times.
✓ Branch 1 taken 22374134 times.
22471993 const int16_t **alpSrcPtr = (CONFIG_SWSCALE_ALPHA && hasAlpha) ? (const int16_t **)(void*) alpPlane->line + firstLumSrcY - alpPlane->sliceY : NULL;
97
98 int i;
99
2/4
✓ Branch 0 taken 22471993 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 22471993 times.
22471993 if (firstLumSrcY < 0 || firstLumSrcY + vLumFilterSize > c->srcH) {
100 const int16_t **tmpY = (const int16_t **) lumPlane->tmp;
101
102 int neg = -firstLumSrcY, i, end = FFMIN(c->srcH - firstLumSrcY, vLumFilterSize);
103 for (i = 0; i < neg; i++)
104 tmpY[i] = lumSrcPtr[neg];
105 for ( ; i < end; i++)
106 tmpY[i] = lumSrcPtr[i];
107 for ( ; i < vLumFilterSize; i++)
108 tmpY[i] = tmpY[i-1];
109 lumSrcPtr = tmpY;
110
111 if (alpSrcPtr) {
112 const int16_t **tmpA = (const int16_t **) alpPlane->tmp;
113 for (i = 0; i < neg; i++)
114 tmpA[i] = alpSrcPtr[neg];
115 for ( ; i < end; i++)
116 tmpA[i] = alpSrcPtr[i];
117 for ( ; i < vLumFilterSize; i++)
118 tmpA[i] = tmpA[i - 1];
119 alpSrcPtr = tmpA;
120 }
121 }
122
2/4
✓ Branch 0 taken 22471993 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 22471993 times.
22471993 if (firstChrSrcY < 0 || firstChrSrcY + vChrFilterSize > c->chrSrcH) {
123 const int16_t **tmpU = (const int16_t **) chrUPlane->tmp;
124 int neg = -firstChrSrcY, i, end = FFMIN(c->chrSrcH - firstChrSrcY, vChrFilterSize);
125 for (i = 0; i < neg; i++) {
126 tmpU[i] = chrUSrcPtr[neg];
127 }
128 for ( ; i < end; i++) {
129 tmpU[i] = chrUSrcPtr[i];
130 }
131 for ( ; i < vChrFilterSize; i++) {
132 tmpU[i] = tmpU[i - 1];
133 }
134 chrUSrcPtr = tmpU;
135 }
136
137
2/2
✓ Branch 0 taken 21981236 times.
✓ Branch 1 taken 490757 times.
22471993 if (flags & SWS_ACCURATE_RND) {
138 21981236 int s= APCK_SIZE / 8;
139
2/2
✓ Branch 0 taken 23713660 times.
✓ Branch 1 taken 21981236 times.
45694896 for (i=0; i<vLumFilterSize; i+=2) {
140 23713660 *(const void**)&lumMmxFilter[s*i ]= lumSrcPtr[i ];
141 23713660 *(const void**)&lumMmxFilter[s*i+APCK_PTR2/4 ]= lumSrcPtr[i+(vLumFilterSize>1)];
142 23713660 lumMmxFilter[s*i+APCK_COEF/4 ]=
143 47427320 lumMmxFilter[s*i+APCK_COEF/4+1]= vLumFilter[dstY*vLumFilterSize + i ]
144
2/2
✓ Branch 0 taken 4968412 times.
✓ Branch 1 taken 18745248 times.
23713660 + (vLumFilterSize>1 ? vLumFilter[dstY*vLumFilterSize + i + 1] * (1 << 16) : 0);
145
2/2
✓ Branch 0 taken 118544 times.
✓ Branch 1 taken 23595116 times.
23713660 if (CONFIG_SWSCALE_ALPHA && hasAlpha) {
146 118544 *(const void**)&alpMmxFilter[s*i ]= alpSrcPtr[i ];
147 118544 *(const void**)&alpMmxFilter[s*i+APCK_PTR2/4 ]= alpSrcPtr[i+(vLumFilterSize>1)];
148 118544 alpMmxFilter[s*i+APCK_COEF/4 ]=
149 118544 alpMmxFilter[s*i+APCK_COEF/4+1]= lumMmxFilter[s*i+APCK_COEF/4 ];
150 }
151 }
152
2/2
✓ Branch 0 taken 38692770 times.
✓ Branch 1 taken 21981236 times.
60674006 for (i=0; i<vChrFilterSize; i+=2) {
153 38692770 *(const void**)&chrMmxFilter[s*i ]= chrUSrcPtr[i ];
154 38692770 *(const void**)&chrMmxFilter[s*i+APCK_PTR2/4 ]= chrUSrcPtr[i+(vChrFilterSize>1)];
155 38692770 chrMmxFilter[s*i+APCK_COEF/4 ]=
156 77385540 chrMmxFilter[s*i+APCK_COEF/4+1]= vChrFilter[chrDstY*vChrFilterSize + i ]
157
2/2
✓ Branch 0 taken 28141622 times.
✓ Branch 1 taken 10551148 times.
38692770 + (vChrFilterSize>1 ? vChrFilter[chrDstY*vChrFilterSize + i + 1] * (1 << 16) : 0);
158 }
159 } else {
160
2/2
✓ Branch 0 taken 1377378 times.
✓ Branch 1 taken 490757 times.
1868135 for (i=0; i<vLumFilterSize; i++) {
161 1377378 *(const void**)&lumMmxFilter[4*i+0]= lumSrcPtr[i];
162 1377378 lumMmxFilter[4*i+2]=
163 1377378 lumMmxFilter[4*i+3]=
164 1377378 ((uint16_t)vLumFilter[dstY*vLumFilterSize + i])*0x10001U;
165
2/2
✓ Branch 0 taken 26510 times.
✓ Branch 1 taken 1350868 times.
1377378 if (CONFIG_SWSCALE_ALPHA && hasAlpha) {
166 26510 *(const void**)&alpMmxFilter[4*i+0]= alpSrcPtr[i];
167 26510 alpMmxFilter[4*i+2]=
168 26510 alpMmxFilter[4*i+3]= lumMmxFilter[4*i+2];
169 }
170 }
171
2/2
✓ Branch 0 taken 1928330 times.
✓ Branch 1 taken 490757 times.
2419087 for (i=0; i<vChrFilterSize; i++) {
172 1928330 *(const void**)&chrMmxFilter[4*i+0]= chrUSrcPtr[i];
173 1928330 chrMmxFilter[4*i+2]=
174 1928330 chrMmxFilter[4*i+3]=
175 1928330 ((uint16_t)vChrFilter[chrDstY*vChrFilterSize + i])*0x10001U;
176 }
177 }
178 }
179 22621691 }
180 #endif /* HAVE_INLINE_ASM */
181
182 #define YUV2YUVX_FUNC_MMX(opt, step) \
183 void ff_yuv2yuvX_ ##opt(const int16_t *filter, int filterSize, int srcOffset, \
184 uint8_t *dest, int dstW, \
185 const uint8_t *dither, int offset); \
186 static void yuv2yuvX_ ##opt(const int16_t *filter, int filterSize, \
187 const int16_t **src, uint8_t *dest, int dstW, \
188 const uint8_t *dither, int offset) \
189 { \
190 if(dstW > 0) \
191 ff_yuv2yuvX_ ##opt(filter, filterSize - 1, 0, dest - offset, dstW + offset, dither, offset); \
192 return; \
193 }
194
195 #define YUV2YUVX_FUNC(opt, step) \
196 void ff_yuv2yuvX_ ##opt(const int16_t *filter, int filterSize, int srcOffset, \
197 uint8_t *dest, int dstW, \
198 const uint8_t *dither, int offset); \
199 static void yuv2yuvX_ ##opt(const int16_t *filter, int filterSize, \
200 const int16_t **src, uint8_t *dest, int dstW, \
201 const uint8_t *dither, int offset) \
202 { \
203 int remainder = (dstW % step); \
204 int pixelsProcessed = dstW - remainder; \
205 if(((uintptr_t)dest) & 15){ \
206 yuv2yuvX_mmxext(filter, filterSize, src, dest, dstW, dither, offset); \
207 return; \
208 } \
209 if(pixelsProcessed > 0) \
210 ff_yuv2yuvX_ ##opt(filter, filterSize - 1, 0, dest - offset, pixelsProcessed + offset, dither, offset); \
211 if(remainder > 0){ \
212 ff_yuv2yuvX_mmxext(filter, filterSize - 1, pixelsProcessed, dest - offset, pixelsProcessed + remainder + offset, dither, offset); \
213 } \
214 return; \
215 }
216
217 #if HAVE_MMXEXT_EXTERNAL
218
1/2
✓ Branch 0 taken 76 times.
✗ Branch 1 not taken.
76 YUV2YUVX_FUNC_MMX(mmxext, 16)
219 #endif
220 #if HAVE_SSE3_EXTERNAL
221
5/6
✗ Branch 0 not taken.
✓ Branch 1 taken 76 times.
✓ Branch 3 taken 64 times.
✓ Branch 4 taken 12 times.
✓ Branch 6 taken 44 times.
✓ Branch 7 taken 32 times.
76 YUV2YUVX_FUNC(sse3, 32)
222 #endif
223 #if HAVE_AVX2_EXTERNAL
224
5/6
✗ Branch 0 not taken.
✓ Branch 1 taken 76 times.
✓ Branch 3 taken 64 times.
✓ Branch 4 taken 12 times.
✓ Branch 6 taken 60 times.
✓ Branch 7 taken 16 times.
76 YUV2YUVX_FUNC(avx2, 64)
225 #endif
226
227 #define SCALE_FUNC(filter_n, from_bpc, to_bpc, opt) \
228 void ff_hscale ## from_bpc ## to ## to_bpc ## _ ## filter_n ## _ ## opt( \
229 SwsInternal *c, int16_t *data, \
230 int dstW, const uint8_t *src, \
231 const int16_t *filter, \
232 const int32_t *filterPos, int filterSize)
233
234 #define SCALE_FUNCS(filter_n, opt) \
235 SCALE_FUNC(filter_n, 8, 15, opt); \
236 SCALE_FUNC(filter_n, 9, 15, opt); \
237 SCALE_FUNC(filter_n, 10, 15, opt); \
238 SCALE_FUNC(filter_n, 12, 15, opt); \
239 SCALE_FUNC(filter_n, 14, 15, opt); \
240 SCALE_FUNC(filter_n, 16, 15, opt); \
241 SCALE_FUNC(filter_n, 8, 19, opt); \
242 SCALE_FUNC(filter_n, 9, 19, opt); \
243 SCALE_FUNC(filter_n, 10, 19, opt); \
244 SCALE_FUNC(filter_n, 12, 19, opt); \
245 SCALE_FUNC(filter_n, 14, 19, opt); \
246 SCALE_FUNC(filter_n, 16, 19, opt)
247
248 #define SCALE_FUNCS_MMX(opt) \
249 SCALE_FUNCS(4, opt); \
250 SCALE_FUNCS(8, opt); \
251 SCALE_FUNCS(X, opt)
252
253 #define SCALE_FUNCS_SSE(opt) \
254 SCALE_FUNCS(4, opt); \
255 SCALE_FUNCS(8, opt); \
256 SCALE_FUNCS(X4, opt); \
257 SCALE_FUNCS(X8, opt)
258
259 SCALE_FUNCS_SSE(sse2);
260 SCALE_FUNCS_SSE(ssse3);
261 SCALE_FUNCS_SSE(sse4);
262
263 SCALE_FUNC(4, 8, 15, avx2);
264 SCALE_FUNC(X4, 8, 15, avx2);
265
266 #define VSCALEX_FUNC(size, opt) \
267 void ff_yuv2planeX_ ## size ## _ ## opt(const int16_t *filter, int filterSize, \
268 const int16_t **src, uint8_t *dest, int dstW, \
269 const uint8_t *dither, int offset)
270 #define VSCALEX_FUNCS(opt) \
271 VSCALEX_FUNC(8, opt); \
272 VSCALEX_FUNC(9, opt); \
273 VSCALEX_FUNC(10, opt)
274
275 VSCALEX_FUNC(8, mmxext);
276 VSCALEX_FUNCS(sse2);
277 VSCALEX_FUNCS(sse4);
278 VSCALEX_FUNC(16, sse4);
279 VSCALEX_FUNCS(avx);
280
281 #define VSCALE_FUNC(size, opt) \
282 void ff_yuv2plane1_ ## size ## _ ## opt(const int16_t *src, uint8_t *dst, int dstW, \
283 const uint8_t *dither, int offset)
284 #define VSCALE_FUNCS(opt1, opt2) \
285 VSCALE_FUNC(8, opt1); \
286 VSCALE_FUNC(9, opt2); \
287 VSCALE_FUNC(10, opt2); \
288 VSCALE_FUNC(16, opt1)
289
290 VSCALE_FUNCS(sse2, sse2);
291 VSCALE_FUNC(16, sse4);
292 VSCALE_FUNCS(avx, avx);
293
294 #define INPUT_Y_FUNC(fmt, opt) \
295 void ff_ ## fmt ## ToY_ ## opt(uint8_t *dst, const uint8_t *src, \
296 const uint8_t *unused1, const uint8_t *unused2, \
297 int w, uint32_t *unused, void *opq)
298 #define INPUT_UV_FUNC(fmt, opt) \
299 void ff_ ## fmt ## ToUV_ ## opt(uint8_t *dstU, uint8_t *dstV, \
300 const uint8_t *unused0, \
301 const uint8_t *src1, \
302 const uint8_t *src2, \
303 int w, uint32_t *unused, void *opq)
304 #define INPUT_FUNC(fmt, opt) \
305 INPUT_Y_FUNC(fmt, opt); \
306 INPUT_UV_FUNC(fmt, opt)
307 #define INPUT_FUNCS(opt) \
308 INPUT_FUNC(uyvy, opt); \
309 INPUT_FUNC(yuyv, opt); \
310 INPUT_UV_FUNC(nv12, opt); \
311 INPUT_UV_FUNC(nv21, opt); \
312 INPUT_FUNC(rgba, opt); \
313 INPUT_FUNC(bgra, opt); \
314 INPUT_FUNC(argb, opt); \
315 INPUT_FUNC(abgr, opt); \
316 INPUT_FUNC(rgb24, opt); \
317 INPUT_FUNC(bgr24, opt)
318
319 INPUT_FUNCS(sse2);
320 INPUT_FUNCS(ssse3);
321 INPUT_FUNCS(avx);
322 INPUT_FUNC(rgba, avx2);
323 INPUT_FUNC(bgra, avx2);
324 INPUT_FUNC(argb, avx2);
325 INPUT_FUNC(abgr, avx2);
326 INPUT_FUNC(rgb24, avx2);
327 INPUT_FUNC(bgr24, avx2);
328
329 #if ARCH_X86_64
330 #define YUV2NV_DECL(fmt, opt) \
331 void ff_yuv2 ## fmt ## cX_ ## opt(enum AVPixelFormat format, const uint8_t *dither, \
332 const int16_t *filter, int filterSize, \
333 const int16_t **u, const int16_t **v, \
334 uint8_t *dst, int dstWidth)
335
336 YUV2NV_DECL(nv12, avx2);
337 YUV2NV_DECL(nv21, avx2);
338
339 #define YUV2GBRP_FN_DECL(fmt, opt) \
340 void ff_yuv2##fmt##_full_X_ ##opt(SwsInternal *c, const int16_t *lumFilter, \
341 const int16_t **lumSrcx, int lumFilterSize, \
342 const int16_t *chrFilter, const int16_t **chrUSrcx, \
343 const int16_t **chrVSrcx, int chrFilterSize, \
344 const int16_t **alpSrcx, uint8_t **dest, \
345 int dstW, int y)
346
347 #define YUV2GBRP_DECL(opt) \
348 YUV2GBRP_FN_DECL(gbrp, opt); \
349 YUV2GBRP_FN_DECL(gbrap, opt); \
350 YUV2GBRP_FN_DECL(gbrp9le, opt); \
351 YUV2GBRP_FN_DECL(gbrp10le, opt); \
352 YUV2GBRP_FN_DECL(gbrap10le, opt); \
353 YUV2GBRP_FN_DECL(gbrp12le, opt); \
354 YUV2GBRP_FN_DECL(gbrap12le, opt); \
355 YUV2GBRP_FN_DECL(gbrp14le, opt); \
356 YUV2GBRP_FN_DECL(gbrp16le, opt); \
357 YUV2GBRP_FN_DECL(gbrap16le, opt); \
358 YUV2GBRP_FN_DECL(gbrpf32le, opt); \
359 YUV2GBRP_FN_DECL(gbrapf32le, opt); \
360 YUV2GBRP_FN_DECL(gbrp9be, opt); \
361 YUV2GBRP_FN_DECL(gbrp10be, opt); \
362 YUV2GBRP_FN_DECL(gbrap10be, opt); \
363 YUV2GBRP_FN_DECL(gbrp12be, opt); \
364 YUV2GBRP_FN_DECL(gbrap12be, opt); \
365 YUV2GBRP_FN_DECL(gbrp14be, opt); \
366 YUV2GBRP_FN_DECL(gbrp16be, opt); \
367 YUV2GBRP_FN_DECL(gbrap16be, opt); \
368 YUV2GBRP_FN_DECL(gbrpf32be, opt); \
369 YUV2GBRP_FN_DECL(gbrapf32be, opt)
370
371 YUV2GBRP_DECL(sse2);
372 YUV2GBRP_DECL(sse4);
373 YUV2GBRP_DECL(avx2);
374
375 #define INPUT_PLANAR_RGB_Y_FN_DECL(fmt, opt) \
376 void ff_planar_##fmt##_to_y_##opt(uint8_t *dst, \
377 const uint8_t *src[4], int w, int32_t *rgb2yuv, \
378 void *opq)
379
380 #define INPUT_PLANAR_RGB_UV_FN_DECL(fmt, opt) \
381 void ff_planar_##fmt##_to_uv_##opt(uint8_t *dstU, uint8_t *dstV, \
382 const uint8_t *src[4], int w, int32_t *rgb2yuv, \
383 void *opq)
384
385 #define INPUT_PLANAR_RGB_A_FN_DECL(fmt, opt) \
386 void ff_planar_##fmt##_to_a_##opt(uint8_t *dst, \
387 const uint8_t *src[4], int w, int32_t *rgb2yuv, \
388 void *opq)
389
390
391 #define INPUT_PLANAR_RGBXX_A_DECL(fmt, opt) \
392 INPUT_PLANAR_RGB_A_FN_DECL(fmt##le, opt); \
393 INPUT_PLANAR_RGB_A_FN_DECL(fmt##be, opt)
394
395 #define INPUT_PLANAR_RGBXX_Y_DECL(fmt, opt) \
396 INPUT_PLANAR_RGB_Y_FN_DECL(fmt##le, opt); \
397 INPUT_PLANAR_RGB_Y_FN_DECL(fmt##be, opt)
398
399 #define INPUT_PLANAR_RGBXX_UV_DECL(fmt, opt) \
400 INPUT_PLANAR_RGB_UV_FN_DECL(fmt##le, opt); \
401 INPUT_PLANAR_RGB_UV_FN_DECL(fmt##be, opt)
402
403 #define INPUT_PLANAR_RGBXX_YUVA_DECL(fmt, opt) \
404 INPUT_PLANAR_RGBXX_Y_DECL(fmt, opt); \
405 INPUT_PLANAR_RGBXX_UV_DECL(fmt, opt); \
406 INPUT_PLANAR_RGBXX_A_DECL(fmt, opt)
407
408 #define INPUT_PLANAR_RGBXX_YUV_DECL(fmt, opt) \
409 INPUT_PLANAR_RGBXX_Y_DECL(fmt, opt); \
410 INPUT_PLANAR_RGBXX_UV_DECL(fmt, opt)
411
412 #define INPUT_PLANAR_RGBXX_UVA_DECL(fmt, opt) \
413 INPUT_PLANAR_RGBXX_UV_DECL(fmt, opt); \
414 INPUT_PLANAR_RGBXX_A_DECL(fmt, opt)
415
416 #define INPUT_PLANAR_RGB_A_ALL_DECL(opt) \
417 INPUT_PLANAR_RGB_A_FN_DECL(rgb, opt); \
418 INPUT_PLANAR_RGBXX_A_DECL(rgb10, opt); \
419 INPUT_PLANAR_RGBXX_A_DECL(rgb12, opt); \
420 INPUT_PLANAR_RGBXX_A_DECL(rgb16, opt); \
421 INPUT_PLANAR_RGBXX_A_DECL(rgbf32, opt)
422
423 #define INPUT_PLANAR_RGB_Y_ALL_DECL(opt) \
424 INPUT_PLANAR_RGB_Y_FN_DECL(rgb, opt); \
425 INPUT_PLANAR_RGBXX_Y_DECL(rgb9, opt); \
426 INPUT_PLANAR_RGBXX_Y_DECL(rgb10, opt); \
427 INPUT_PLANAR_RGBXX_Y_DECL(rgb12, opt); \
428 INPUT_PLANAR_RGBXX_Y_DECL(rgb14, opt); \
429 INPUT_PLANAR_RGBXX_Y_DECL(rgb16, opt); \
430 INPUT_PLANAR_RGBXX_Y_DECL(rgbf32, opt)
431
432 #define INPUT_PLANAR_RGB_UV_ALL_DECL(opt) \
433 INPUT_PLANAR_RGB_UV_FN_DECL(rgb, opt); \
434 INPUT_PLANAR_RGBXX_UV_DECL(rgb9, opt); \
435 INPUT_PLANAR_RGBXX_UV_DECL(rgb10, opt); \
436 INPUT_PLANAR_RGBXX_UV_DECL(rgb12, opt); \
437 INPUT_PLANAR_RGBXX_UV_DECL(rgb14, opt); \
438 INPUT_PLANAR_RGBXX_UV_DECL(rgb16, opt); \
439 INPUT_PLANAR_RGBXX_UV_DECL(rgbf32, opt)
440
441 INPUT_PLANAR_RGBXX_Y_DECL(rgbf32, sse2);
442 INPUT_PLANAR_RGB_UV_ALL_DECL(sse2);
443 INPUT_PLANAR_RGB_A_ALL_DECL(sse2);
444
445 INPUT_PLANAR_RGB_Y_ALL_DECL(sse4);
446 INPUT_PLANAR_RGB_UV_ALL_DECL(sse4);
447 INPUT_PLANAR_RGBXX_A_DECL(rgbf32, sse4);
448
449 INPUT_PLANAR_RGB_Y_ALL_DECL(avx2);
450 INPUT_PLANAR_RGB_UV_ALL_DECL(avx2);
451 INPUT_PLANAR_RGB_A_ALL_DECL(avx2);
452 #endif
453
454 #define RANGE_CONVERT_FUNCS(opt) do { \
455 if (c->dstBpc <= 14) { \
456 if (c->srcRange) { \
457 c->lumConvertRange = ff_lumRangeFromJpeg_ ##opt; \
458 c->chrConvertRange = ff_chrRangeFromJpeg_ ##opt; \
459 } else { \
460 c->lumConvertRange = ff_lumRangeToJpeg_ ##opt; \
461 c->chrConvertRange = ff_chrRangeToJpeg_ ##opt; \
462 } \
463 } \
464 } while (0)
465
466 #define RANGE_CONVERT_FUNCS_DECL(opt) \
467 void ff_lumRangeFromJpeg_ ##opt(int16_t *dst, int width); \
468 void ff_chrRangeFromJpeg_ ##opt(int16_t *dstU, int16_t *dstV, int width); \
469 void ff_lumRangeToJpeg_ ##opt(int16_t *dst, int width); \
470 void ff_chrRangeToJpeg_ ##opt(int16_t *dstU, int16_t *dstV, int width); \
471
472 RANGE_CONVERT_FUNCS_DECL(sse2);
473 RANGE_CONVERT_FUNCS_DECL(avx2);
474
475 3620 av_cold void ff_sws_init_range_convert_x86(SwsInternal *c)
476 {
477 3620 int cpu_flags = av_get_cpu_flags();
478
3/4
✓ Branch 0 taken 24 times.
✓ Branch 1 taken 3596 times.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
3620 if (EXTERNAL_AVX2_FAST(cpu_flags)) {
479
4/4
✓ Branch 0 taken 20 times.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 10 times.
24 RANGE_CONVERT_FUNCS(avx2);
480
2/2
✓ Branch 0 taken 192 times.
✓ Branch 1 taken 3404 times.
3596 } else if (EXTERNAL_SSE2(cpu_flags)) {
481
4/4
✓ Branch 0 taken 160 times.
✓ Branch 1 taken 32 times.
✓ Branch 2 taken 80 times.
✓ Branch 3 taken 80 times.
192 RANGE_CONVERT_FUNCS(sse2);
482 }
483 3620 }
484
485 30303 av_cold void ff_sws_init_swscale_x86(SwsInternal *c)
486 {
487 30303 int cpu_flags = av_get_cpu_flags();
488
489 #if HAVE_MMXEXT_INLINE
490
2/2
✓ Branch 0 taken 10677 times.
✓ Branch 1 taken 19626 times.
30303 if (INLINE_MMXEXT(cpu_flags))
491 10677 sws_init_swscale_mmxext(c);
492 #endif
493
3/4
✓ Branch 0 taken 2485 times.
✓ Branch 1 taken 27818 times.
✓ Branch 2 taken 2485 times.
✗ Branch 3 not taken.
30303 if(c->use_mmx_vfilter && !(c->flags & SWS_ACCURATE_RND)) {
494 #if HAVE_MMXEXT_EXTERNAL
495
1/2
✓ Branch 0 taken 2485 times.
✗ Branch 1 not taken.
2485 if (EXTERNAL_MMXEXT(cpu_flags))
496 2485 c->yuv2planeX = yuv2yuvX_mmxext;
497 #endif
498 #if HAVE_SSE3_EXTERNAL
499
2/2
✓ Branch 0 taken 1819 times.
✓ Branch 1 taken 666 times.
2485 if (EXTERNAL_SSE3(cpu_flags))
500 1819 c->yuv2planeX = yuv2yuvX_sse3;
501 #endif
502 #if HAVE_AVX2_EXTERNAL
503
3/4
✓ Branch 0 taken 265 times.
✓ Branch 1 taken 2220 times.
✓ Branch 2 taken 265 times.
✗ Branch 3 not taken.
2485 if (EXTERNAL_AVX2_FAST(cpu_flags))
504 265 c->yuv2planeX = yuv2yuvX_avx2;
505 #endif
506 }
507 #if ARCH_X86_32 && !HAVE_ALIGNED_STACK
508 // The better yuv2planeX_8 functions need aligned stack on x86-32,
509 // so we use MMXEXT in this case if they are not available.
510 if (EXTERNAL_MMXEXT(cpu_flags)) {
511 if (c->dstBpc == 8 && !c->use_mmx_vfilter)
512 c->yuv2planeX = ff_yuv2planeX_8_mmxext;
513 }
514 #endif /* ARCH_X86_32 && !HAVE_ALIGNED_STACK */
515
516 #define ASSIGN_SCALE_FUNC2(hscalefn, filtersize, opt1, opt2) do { \
517 if (c->srcBpc == 8) { \
518 hscalefn = c->dstBpc <= 14 ? ff_hscale8to15_ ## filtersize ## _ ## opt2 : \
519 ff_hscale8to19_ ## filtersize ## _ ## opt1; \
520 } else if (c->srcBpc == 9) { \
521 hscalefn = c->dstBpc <= 14 ? ff_hscale9to15_ ## filtersize ## _ ## opt2 : \
522 ff_hscale9to19_ ## filtersize ## _ ## opt1; \
523 } else if (c->srcBpc == 10) { \
524 hscalefn = c->dstBpc <= 14 ? ff_hscale10to15_ ## filtersize ## _ ## opt2 : \
525 ff_hscale10to19_ ## filtersize ## _ ## opt1; \
526 } else if (c->srcBpc == 12) { \
527 hscalefn = c->dstBpc <= 14 ? ff_hscale12to15_ ## filtersize ## _ ## opt2 : \
528 ff_hscale12to19_ ## filtersize ## _ ## opt1; \
529 } else if (c->srcBpc == 14 || ((c->srcFormat==AV_PIX_FMT_PAL8||isAnyRGB(c->srcFormat)) && av_pix_fmt_desc_get(c->srcFormat)->comp[0].depth<16)) { \
530 hscalefn = c->dstBpc <= 14 ? ff_hscale14to15_ ## filtersize ## _ ## opt2 : \
531 ff_hscale14to19_ ## filtersize ## _ ## opt1; \
532 } else { /* c->srcBpc == 16 */ \
533 av_assert0(c->srcBpc == 16);\
534 hscalefn = c->dstBpc <= 14 ? ff_hscale16to15_ ## filtersize ## _ ## opt2 : \
535 ff_hscale16to19_ ## filtersize ## _ ## opt1; \
536 } \
537 } while (0)
538 #define ASSIGN_VSCALEX_FUNC(vscalefn, opt, do_16_case, condition_8bit) \
539 switch(c->dstBpc){ \
540 case 16: do_16_case; break; \
541 case 10: if (!isBE(c->dstFormat) && !isSemiPlanarYUV(c->dstFormat)) vscalefn = ff_yuv2planeX_10_ ## opt; break; \
542 case 9: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2planeX_9_ ## opt; break; \
543 case 8: if ((condition_8bit) && !c->use_mmx_vfilter) vscalefn = ff_yuv2planeX_8_ ## opt; break; \
544 }
545 #define ASSIGN_VSCALE_FUNC(vscalefn, opt) \
546 switch(c->dstBpc){ \
547 case 16: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2plane1_16_ ## opt; break; \
548 case 10: if (!isBE(c->dstFormat) && !isSemiPlanarYUV(c->dstFormat)) vscalefn = ff_yuv2plane1_10_ ## opt; break; \
549 case 9: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2plane1_9_ ## opt; break; \
550 case 8: vscalefn = ff_yuv2plane1_8_ ## opt; break; \
551 default: av_assert0(c->dstBpc>8); \
552 }
553 #define case_rgb(x, X, opt) \
554 case AV_PIX_FMT_ ## X: \
555 c->lumToYV12 = ff_ ## x ## ToY_ ## opt; \
556 if (!c->chrSrcHSubSample) \
557 c->chrToYV12 = ff_ ## x ## ToUV_ ## opt; \
558 break
559 #define ASSIGN_SSE_SCALE_FUNC(hscalefn, filtersize, opt1, opt2) \
560 switch (filtersize) { \
561 case 4: ASSIGN_SCALE_FUNC2(hscalefn, 4, opt1, opt2); break; \
562 case 8: ASSIGN_SCALE_FUNC2(hscalefn, 8, opt1, opt2); break; \
563 default: if (filtersize & 4) ASSIGN_SCALE_FUNC2(hscalefn, X4, opt1, opt2); \
564 else ASSIGN_SCALE_FUNC2(hscalefn, X8, opt1, opt2); \
565 break; \
566 }
567
2/2
✓ Branch 0 taken 8747 times.
✓ Branch 1 taken 21556 times.
30303 if (EXTERNAL_SSE2(cpu_flags)) {
568
53/125
✓ Branch 0 taken 339 times.
✓ Branch 1 taken 109 times.
✓ Branch 2 taken 8299 times.
✓ Branch 3 taken 109 times.
✓ Branch 4 taken 230 times.
✓ Branch 5 taken 54 times.
✓ Branch 6 taken 55 times.
✓ Branch 7 taken 1 times.
✓ Branch 8 taken 229 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 1 times.
✓ Branch 11 taken 1 times.
✓ Branch 12 taken 228 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 1 times.
✓ Branch 15 taken 1 times.
✓ Branch 16 taken 227 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 1 times.
✓ Branch 19 taken 226 times.
✓ Branch 20 taken 1 times.
✓ Branch 21 taken 226 times.
✗ Branch 22 not taken.
✓ Branch 24 taken 225 times.
✓ Branch 25 taken 1 times.
✓ Branch 27 taken 189 times.
✓ Branch 28 taken 36 times.
✓ Branch 29 taken 171 times.
✓ Branch 30 taken 19 times.
✗ Branch 31 not taken.
✓ Branch 32 taken 37 times.
✓ Branch 35 taken 23 times.
✓ Branch 36 taken 14 times.
✓ Branch 37 taken 108 times.
✓ Branch 38 taken 1 times.
✓ Branch 39 taken 54 times.
✓ Branch 40 taken 54 times.
✗ Branch 41 not taken.
✓ Branch 42 taken 1 times.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✓ Branch 46 taken 1 times.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✓ Branch 49 taken 1 times.
✗ Branch 50 not taken.
✗ Branch 51 not taken.
✓ Branch 52 taken 1 times.
✗ Branch 53 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 66 not taken.
✗ Branch 69 not taken.
✗ Branch 70 not taken.
✓ Branch 71 taken 108 times.
✓ Branch 72 taken 8191 times.
✓ Branch 73 taken 108 times.
✗ Branch 74 not taken.
✓ Branch 75 taken 54 times.
✓ Branch 76 taken 54 times.
✗ Branch 77 not taken.
✗ Branch 78 not taken.
✗ Branch 79 not taken.
✗ Branch 80 not taken.
✗ Branch 81 not taken.
✗ Branch 82 not taken.
✗ Branch 83 not taken.
✗ Branch 84 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✗ Branch 87 not taken.
✗ Branch 88 not taken.
✗ Branch 89 not taken.
✗ Branch 90 not taken.
✗ Branch 91 not taken.
✗ Branch 92 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
✗ Branch 97 not taken.
✗ Branch 98 not taken.
✗ Branch 99 not taken.
✗ Branch 100 not taken.
✗ Branch 101 not taken.
✗ Branch 102 not taken.
✗ Branch 105 not taken.
✗ Branch 106 not taken.
✓ Branch 107 taken 8190 times.
✓ Branch 108 taken 1 times.
✓ Branch 109 taken 7992 times.
✓ Branch 110 taken 198 times.
✗ Branch 111 not taken.
✓ Branch 112 taken 1 times.
✗ Branch 113 not taken.
✗ Branch 114 not taken.
✗ Branch 115 not taken.
✓ Branch 116 taken 1 times.
✗ Branch 117 not taken.
✗ Branch 118 not taken.
✗ Branch 119 not taken.
✓ Branch 120 taken 1 times.
✗ Branch 121 not taken.
✗ Branch 122 not taken.
✓ Branch 123 taken 1 times.
✗ Branch 124 not taken.
✓ Branch 125 taken 1 times.
✗ Branch 126 not taken.
✓ Branch 128 taken 1 times.
✗ Branch 129 not taken.
✓ Branch 131 taken 1 times.
✗ Branch 132 not taken.
✓ Branch 133 taken 1 times.
✗ Branch 134 not taken.
✗ Branch 135 not taken.
✗ Branch 136 not taken.
✗ Branch 139 not taken.
✗ Branch 140 not taken.
8855 ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, sse2, sse2);
569
53/125
✓ Branch 0 taken 339 times.
✓ Branch 1 taken 109 times.
✓ Branch 2 taken 8299 times.
✓ Branch 3 taken 109 times.
✓ Branch 4 taken 230 times.
✓ Branch 5 taken 54 times.
✓ Branch 6 taken 55 times.
✓ Branch 7 taken 1 times.
✓ Branch 8 taken 229 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 1 times.
✓ Branch 11 taken 1 times.
✓ Branch 12 taken 228 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 1 times.
✓ Branch 15 taken 1 times.
✓ Branch 16 taken 227 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 1 times.
✓ Branch 19 taken 226 times.
✓ Branch 20 taken 1 times.
✓ Branch 21 taken 226 times.
✗ Branch 22 not taken.
✓ Branch 24 taken 225 times.
✓ Branch 25 taken 1 times.
✓ Branch 27 taken 189 times.
✓ Branch 28 taken 36 times.
✓ Branch 29 taken 171 times.
✓ Branch 30 taken 19 times.
✗ Branch 31 not taken.
✓ Branch 32 taken 37 times.
✓ Branch 35 taken 23 times.
✓ Branch 36 taken 14 times.
✓ Branch 37 taken 108 times.
✓ Branch 38 taken 1 times.
✓ Branch 39 taken 54 times.
✓ Branch 40 taken 54 times.
✗ Branch 41 not taken.
✓ Branch 42 taken 1 times.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✓ Branch 46 taken 1 times.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✓ Branch 49 taken 1 times.
✗ Branch 50 not taken.
✗ Branch 51 not taken.
✓ Branch 52 taken 1 times.
✗ Branch 53 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 66 not taken.
✗ Branch 69 not taken.
✗ Branch 70 not taken.
✓ Branch 71 taken 108 times.
✓ Branch 72 taken 8191 times.
✓ Branch 73 taken 108 times.
✗ Branch 74 not taken.
✓ Branch 75 taken 54 times.
✓ Branch 76 taken 54 times.
✗ Branch 77 not taken.
✗ Branch 78 not taken.
✗ Branch 79 not taken.
✗ Branch 80 not taken.
✗ Branch 81 not taken.
✗ Branch 82 not taken.
✗ Branch 83 not taken.
✗ Branch 84 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✗ Branch 87 not taken.
✗ Branch 88 not taken.
✗ Branch 89 not taken.
✗ Branch 90 not taken.
✗ Branch 91 not taken.
✗ Branch 92 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
✗ Branch 97 not taken.
✗ Branch 98 not taken.
✗ Branch 99 not taken.
✗ Branch 100 not taken.
✗ Branch 101 not taken.
✗ Branch 102 not taken.
✗ Branch 105 not taken.
✗ Branch 106 not taken.
✓ Branch 107 taken 8190 times.
✓ Branch 108 taken 1 times.
✓ Branch 109 taken 7992 times.
✓ Branch 110 taken 198 times.
✗ Branch 111 not taken.
✓ Branch 112 taken 1 times.
✗ Branch 113 not taken.
✗ Branch 114 not taken.
✗ Branch 115 not taken.
✓ Branch 116 taken 1 times.
✗ Branch 117 not taken.
✗ Branch 118 not taken.
✗ Branch 119 not taken.
✓ Branch 120 taken 1 times.
✗ Branch 121 not taken.
✗ Branch 122 not taken.
✓ Branch 123 taken 1 times.
✗ Branch 124 not taken.
✓ Branch 125 taken 1 times.
✗ Branch 126 not taken.
✓ Branch 128 taken 1 times.
✗ Branch 129 not taken.
✓ Branch 131 taken 1 times.
✗ Branch 132 not taken.
✓ Branch 133 taken 1 times.
✗ Branch 134 not taken.
✗ Branch 135 not taken.
✗ Branch 136 not taken.
✗ Branch 139 not taken.
✗ Branch 140 not taken.
8855 ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, sse2, sse2);
570
10/13
✓ Branch 0 taken 44 times.
✓ Branch 1 taken 39 times.
✓ Branch 2 taken 38 times.
✓ Branch 3 taken 7871 times.
✓ Branch 4 taken 755 times.
✓ Branch 6 taken 39 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 39 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 38 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 6508 times.
✓ Branch 15 taken 1363 times.
8747 ASSIGN_VSCALEX_FUNC(c->yuv2planeX, sse2, ,
571 HAVE_ALIGNED_STACK || ARCH_X86_64);
572
2/2
✓ Branch 0 taken 8558 times.
✓ Branch 1 taken 189 times.
8747 if (!(c->flags & SWS_ACCURATE_RND))
573
10/15
✓ Branch 0 taken 44 times.
✓ Branch 1 taken 39 times.
✓ Branch 2 taken 38 times.
✓ Branch 3 taken 7682 times.
✓ Branch 4 taken 755 times.
✓ Branch 6 taken 44 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 39 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 39 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 38 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✓ Branch 18 taken 755 times.
8558 ASSIGN_VSCALE_FUNC(c->yuv2plane1, sse2);
574
575
7/12
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 37 times.
✓ Branch 6 taken 28 times.
✓ Branch 7 taken 30 times.
✓ Branch 8 taken 29 times.
✓ Branch 9 taken 29 times.
✓ Branch 10 taken 29 times.
✓ Branch 11 taken 8565 times.
8747 switch (c->srcFormat) {
576 case AV_PIX_FMT_YA8:
577 c->lumToYV12 = ff_yuyvToY_sse2;
578 if (c->needAlpha)
579 c->alpToYV12 = ff_uyvyToY_sse2;
580 break;
581 case AV_PIX_FMT_YUYV422:
582 c->lumToYV12 = ff_yuyvToY_sse2;
583 c->chrToYV12 = ff_yuyvToUV_sse2;
584 break;
585 case AV_PIX_FMT_UYVY422:
586 c->lumToYV12 = ff_uyvyToY_sse2;
587 c->chrToYV12 = ff_uyvyToUV_sse2;
588 break;
589 case AV_PIX_FMT_NV12:
590 c->chrToYV12 = ff_nv12ToUV_sse2;
591 break;
592 case AV_PIX_FMT_NV21:
593 c->chrToYV12 = ff_nv21ToUV_sse2;
594 break;
595
2/2
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 27 times.
37 case_rgb(rgb24, RGB24, sse2);
596
2/2
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 18 times.
28 case_rgb(bgr24, BGR24, sse2);
597
2/2
✓ Branch 0 taken 11 times.
✓ Branch 1 taken 19 times.
30 case_rgb(bgra, BGRA, sse2);
598
2/2
✓ Branch 0 taken 11 times.
✓ Branch 1 taken 18 times.
29 case_rgb(rgba, RGBA, sse2);
599
2/2
✓ Branch 0 taken 11 times.
✓ Branch 1 taken 18 times.
29 case_rgb(abgr, ABGR, sse2);
600
2/2
✓ Branch 0 taken 11 times.
✓ Branch 1 taken 18 times.
29 case_rgb(argb, ARGB, sse2);
601 8565 default:
602 8565 break;
603 }
604 }
605
2/2
✓ Branch 0 taken 6817 times.
✓ Branch 1 taken 23486 times.
30303 if (EXTERNAL_SSSE3(cpu_flags)) {
606
53/125
✓ Branch 0 taken 277 times.
✓ Branch 1 taken 85 times.
✓ Branch 2 taken 6455 times.
✓ Branch 3 taken 85 times.
✓ Branch 4 taken 192 times.
✓ Branch 5 taken 42 times.
✓ Branch 6 taken 43 times.
✓ Branch 7 taken 1 times.
✓ Branch 8 taken 191 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 1 times.
✓ Branch 11 taken 1 times.
✓ Branch 12 taken 190 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 1 times.
✓ Branch 15 taken 1 times.
✓ Branch 16 taken 189 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 1 times.
✓ Branch 19 taken 188 times.
✓ Branch 20 taken 1 times.
✓ Branch 21 taken 188 times.
✗ Branch 22 not taken.
✓ Branch 24 taken 187 times.
✓ Branch 25 taken 1 times.
✓ Branch 27 taken 151 times.
✓ Branch 28 taken 36 times.
✓ Branch 29 taken 133 times.
✓ Branch 30 taken 19 times.
✗ Branch 31 not taken.
✓ Branch 32 taken 37 times.
✓ Branch 35 taken 23 times.
✓ Branch 36 taken 14 times.
✓ Branch 37 taken 84 times.
✓ Branch 38 taken 1 times.
✓ Branch 39 taken 42 times.
✓ Branch 40 taken 42 times.
✗ Branch 41 not taken.
✓ Branch 42 taken 1 times.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✓ Branch 46 taken 1 times.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✓ Branch 49 taken 1 times.
✗ Branch 50 not taken.
✗ Branch 51 not taken.
✓ Branch 52 taken 1 times.
✗ Branch 53 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 66 not taken.
✗ Branch 69 not taken.
✗ Branch 70 not taken.
✓ Branch 71 taken 84 times.
✓ Branch 72 taken 6371 times.
✓ Branch 73 taken 84 times.
✗ Branch 74 not taken.
✓ Branch 75 taken 42 times.
✓ Branch 76 taken 42 times.
✗ Branch 77 not taken.
✗ Branch 78 not taken.
✗ Branch 79 not taken.
✗ Branch 80 not taken.
✗ Branch 81 not taken.
✗ Branch 82 not taken.
✗ Branch 83 not taken.
✗ Branch 84 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✗ Branch 87 not taken.
✗ Branch 88 not taken.
✗ Branch 89 not taken.
✗ Branch 90 not taken.
✗ Branch 91 not taken.
✗ Branch 92 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
✗ Branch 97 not taken.
✗ Branch 98 not taken.
✗ Branch 99 not taken.
✗ Branch 100 not taken.
✗ Branch 101 not taken.
✗ Branch 102 not taken.
✗ Branch 105 not taken.
✗ Branch 106 not taken.
✓ Branch 107 taken 6370 times.
✓ Branch 108 taken 1 times.
✓ Branch 109 taken 6216 times.
✓ Branch 110 taken 154 times.
✗ Branch 111 not taken.
✓ Branch 112 taken 1 times.
✗ Branch 113 not taken.
✗ Branch 114 not taken.
✗ Branch 115 not taken.
✓ Branch 116 taken 1 times.
✗ Branch 117 not taken.
✗ Branch 118 not taken.
✗ Branch 119 not taken.
✓ Branch 120 taken 1 times.
✗ Branch 121 not taken.
✗ Branch 122 not taken.
✓ Branch 123 taken 1 times.
✗ Branch 124 not taken.
✓ Branch 125 taken 1 times.
✗ Branch 126 not taken.
✓ Branch 128 taken 1 times.
✗ Branch 129 not taken.
✓ Branch 131 taken 1 times.
✗ Branch 132 not taken.
✓ Branch 133 taken 1 times.
✗ Branch 134 not taken.
✗ Branch 135 not taken.
✗ Branch 136 not taken.
✗ Branch 139 not taken.
✗ Branch 140 not taken.
6901 ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, ssse3, ssse3);
607
53/125
✓ Branch 0 taken 277 times.
✓ Branch 1 taken 85 times.
✓ Branch 2 taken 6455 times.
✓ Branch 3 taken 85 times.
✓ Branch 4 taken 192 times.
✓ Branch 5 taken 42 times.
✓ Branch 6 taken 43 times.
✓ Branch 7 taken 1 times.
✓ Branch 8 taken 191 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 1 times.
✓ Branch 11 taken 1 times.
✓ Branch 12 taken 190 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 1 times.
✓ Branch 15 taken 1 times.
✓ Branch 16 taken 189 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 1 times.
✓ Branch 19 taken 188 times.
✓ Branch 20 taken 1 times.
✓ Branch 21 taken 188 times.
✗ Branch 22 not taken.
✓ Branch 24 taken 187 times.
✓ Branch 25 taken 1 times.
✓ Branch 27 taken 151 times.
✓ Branch 28 taken 36 times.
✓ Branch 29 taken 133 times.
✓ Branch 30 taken 19 times.
✗ Branch 31 not taken.
✓ Branch 32 taken 37 times.
✓ Branch 35 taken 23 times.
✓ Branch 36 taken 14 times.
✓ Branch 37 taken 84 times.
✓ Branch 38 taken 1 times.
✓ Branch 39 taken 42 times.
✓ Branch 40 taken 42 times.
✗ Branch 41 not taken.
✓ Branch 42 taken 1 times.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✓ Branch 46 taken 1 times.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✓ Branch 49 taken 1 times.
✗ Branch 50 not taken.
✗ Branch 51 not taken.
✓ Branch 52 taken 1 times.
✗ Branch 53 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 66 not taken.
✗ Branch 69 not taken.
✗ Branch 70 not taken.
✓ Branch 71 taken 84 times.
✓ Branch 72 taken 6371 times.
✓ Branch 73 taken 84 times.
✗ Branch 74 not taken.
✓ Branch 75 taken 42 times.
✓ Branch 76 taken 42 times.
✗ Branch 77 not taken.
✗ Branch 78 not taken.
✗ Branch 79 not taken.
✗ Branch 80 not taken.
✗ Branch 81 not taken.
✗ Branch 82 not taken.
✗ Branch 83 not taken.
✗ Branch 84 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✗ Branch 87 not taken.
✗ Branch 88 not taken.
✗ Branch 89 not taken.
✗ Branch 90 not taken.
✗ Branch 91 not taken.
✗ Branch 92 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
✗ Branch 97 not taken.
✗ Branch 98 not taken.
✗ Branch 99 not taken.
✗ Branch 100 not taken.
✗ Branch 101 not taken.
✗ Branch 102 not taken.
✗ Branch 105 not taken.
✗ Branch 106 not taken.
✓ Branch 107 taken 6370 times.
✓ Branch 108 taken 1 times.
✓ Branch 109 taken 6216 times.
✓ Branch 110 taken 154 times.
✗ Branch 111 not taken.
✓ Branch 112 taken 1 times.
✗ Branch 113 not taken.
✗ Branch 114 not taken.
✗ Branch 115 not taken.
✓ Branch 116 taken 1 times.
✗ Branch 117 not taken.
✗ Branch 118 not taken.
✗ Branch 119 not taken.
✓ Branch 120 taken 1 times.
✗ Branch 121 not taken.
✗ Branch 122 not taken.
✓ Branch 123 taken 1 times.
✗ Branch 124 not taken.
✓ Branch 125 taken 1 times.
✗ Branch 126 not taken.
✓ Branch 128 taken 1 times.
✗ Branch 129 not taken.
✓ Branch 131 taken 1 times.
✗ Branch 132 not taken.
✓ Branch 133 taken 1 times.
✗ Branch 134 not taken.
✗ Branch 135 not taken.
✗ Branch 136 not taken.
✗ Branch 139 not taken.
✗ Branch 140 not taken.
6901 ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, ssse3, ssse3);
608
3/3
✓ Branch 0 taken 29 times.
✓ Branch 1 taken 22 times.
✓ Branch 2 taken 6766 times.
6817 switch (c->srcFormat) {
609
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 21 times.
29 case_rgb(rgb24, RGB24, ssse3);
610
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 14 times.
22 case_rgb(bgr24, BGR24, ssse3);
611 6766 default:
612 6766 break;
613 }
614 }
615
2/2
✓ Branch 0 taken 5852 times.
✓ Branch 1 taken 24451 times.
30303 if (EXTERNAL_SSE4(cpu_flags)) {
616 /* Xto15 don't need special sse4 functions */
617
53/125
✓ Branch 0 taken 246 times.
✓ Branch 1 taken 73 times.
✓ Branch 2 taken 5533 times.
✓ Branch 3 taken 73 times.
✓ Branch 4 taken 173 times.
✓ Branch 5 taken 36 times.
✓ Branch 6 taken 37 times.
✓ Branch 7 taken 1 times.
✓ Branch 8 taken 172 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 1 times.
✓ Branch 11 taken 1 times.
✓ Branch 12 taken 171 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 1 times.
✓ Branch 15 taken 1 times.
✓ Branch 16 taken 170 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 1 times.
✓ Branch 19 taken 169 times.
✓ Branch 20 taken 1 times.
✓ Branch 21 taken 169 times.
✗ Branch 22 not taken.
✓ Branch 24 taken 168 times.
✓ Branch 25 taken 1 times.
✓ Branch 27 taken 132 times.
✓ Branch 28 taken 36 times.
✓ Branch 29 taken 114 times.
✓ Branch 30 taken 19 times.
✗ Branch 31 not taken.
✓ Branch 32 taken 37 times.
✓ Branch 35 taken 23 times.
✓ Branch 36 taken 14 times.
✓ Branch 37 taken 72 times.
✓ Branch 38 taken 1 times.
✓ Branch 39 taken 36 times.
✓ Branch 40 taken 36 times.
✗ Branch 41 not taken.
✓ Branch 42 taken 1 times.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✓ Branch 46 taken 1 times.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✓ Branch 49 taken 1 times.
✗ Branch 50 not taken.
✗ Branch 51 not taken.
✓ Branch 52 taken 1 times.
✗ Branch 53 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 66 not taken.
✗ Branch 69 not taken.
✗ Branch 70 not taken.
✓ Branch 71 taken 72 times.
✓ Branch 72 taken 5461 times.
✓ Branch 73 taken 72 times.
✗ Branch 74 not taken.
✓ Branch 75 taken 36 times.
✓ Branch 76 taken 36 times.
✗ Branch 77 not taken.
✗ Branch 78 not taken.
✗ Branch 79 not taken.
✗ Branch 80 not taken.
✗ Branch 81 not taken.
✗ Branch 82 not taken.
✗ Branch 83 not taken.
✗ Branch 84 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✗ Branch 87 not taken.
✗ Branch 88 not taken.
✗ Branch 89 not taken.
✗ Branch 90 not taken.
✗ Branch 91 not taken.
✗ Branch 92 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
✗ Branch 97 not taken.
✗ Branch 98 not taken.
✗ Branch 99 not taken.
✗ Branch 100 not taken.
✗ Branch 101 not taken.
✗ Branch 102 not taken.
✗ Branch 105 not taken.
✗ Branch 106 not taken.
✓ Branch 107 taken 5460 times.
✓ Branch 108 taken 1 times.
✓ Branch 109 taken 5328 times.
✓ Branch 110 taken 132 times.
✗ Branch 111 not taken.
✓ Branch 112 taken 1 times.
✗ Branch 113 not taken.
✗ Branch 114 not taken.
✗ Branch 115 not taken.
✓ Branch 116 taken 1 times.
✗ Branch 117 not taken.
✗ Branch 118 not taken.
✗ Branch 119 not taken.
✓ Branch 120 taken 1 times.
✗ Branch 121 not taken.
✗ Branch 122 not taken.
✓ Branch 123 taken 1 times.
✗ Branch 124 not taken.
✓ Branch 125 taken 1 times.
✗ Branch 126 not taken.
✓ Branch 128 taken 1 times.
✗ Branch 129 not taken.
✓ Branch 131 taken 1 times.
✗ Branch 132 not taken.
✓ Branch 133 taken 1 times.
✗ Branch 134 not taken.
✗ Branch 135 not taken.
✗ Branch 136 not taken.
✗ Branch 139 not taken.
✗ Branch 140 not taken.
5924 ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, sse4, ssse3);
618
53/125
✓ Branch 0 taken 246 times.
✓ Branch 1 taken 73 times.
✓ Branch 2 taken 5533 times.
✓ Branch 3 taken 73 times.
✓ Branch 4 taken 173 times.
✓ Branch 5 taken 36 times.
✓ Branch 6 taken 37 times.
✓ Branch 7 taken 1 times.
✓ Branch 8 taken 172 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 1 times.
✓ Branch 11 taken 1 times.
✓ Branch 12 taken 171 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 1 times.
✓ Branch 15 taken 1 times.
✓ Branch 16 taken 170 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 1 times.
✓ Branch 19 taken 169 times.
✓ Branch 20 taken 1 times.
✓ Branch 21 taken 169 times.
✗ Branch 22 not taken.
✓ Branch 24 taken 168 times.
✓ Branch 25 taken 1 times.
✓ Branch 27 taken 132 times.
✓ Branch 28 taken 36 times.
✓ Branch 29 taken 114 times.
✓ Branch 30 taken 19 times.
✗ Branch 31 not taken.
✓ Branch 32 taken 37 times.
✓ Branch 35 taken 23 times.
✓ Branch 36 taken 14 times.
✓ Branch 37 taken 72 times.
✓ Branch 38 taken 1 times.
✓ Branch 39 taken 36 times.
✓ Branch 40 taken 36 times.
✗ Branch 41 not taken.
✓ Branch 42 taken 1 times.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✓ Branch 46 taken 1 times.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✓ Branch 49 taken 1 times.
✗ Branch 50 not taken.
✗ Branch 51 not taken.
✓ Branch 52 taken 1 times.
✗ Branch 53 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 66 not taken.
✗ Branch 69 not taken.
✗ Branch 70 not taken.
✓ Branch 71 taken 72 times.
✓ Branch 72 taken 5461 times.
✓ Branch 73 taken 72 times.
✗ Branch 74 not taken.
✓ Branch 75 taken 36 times.
✓ Branch 76 taken 36 times.
✗ Branch 77 not taken.
✗ Branch 78 not taken.
✗ Branch 79 not taken.
✗ Branch 80 not taken.
✗ Branch 81 not taken.
✗ Branch 82 not taken.
✗ Branch 83 not taken.
✗ Branch 84 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✗ Branch 87 not taken.
✗ Branch 88 not taken.
✗ Branch 89 not taken.
✗ Branch 90 not taken.
✗ Branch 91 not taken.
✗ Branch 92 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
✗ Branch 97 not taken.
✗ Branch 98 not taken.
✗ Branch 99 not taken.
✗ Branch 100 not taken.
✗ Branch 101 not taken.
✗ Branch 102 not taken.
✗ Branch 105 not taken.
✗ Branch 106 not taken.
✓ Branch 107 taken 5460 times.
✓ Branch 108 taken 1 times.
✓ Branch 109 taken 5328 times.
✓ Branch 110 taken 132 times.
✗ Branch 111 not taken.
✓ Branch 112 taken 1 times.
✗ Branch 113 not taken.
✗ Branch 114 not taken.
✗ Branch 115 not taken.
✓ Branch 116 taken 1 times.
✗ Branch 117 not taken.
✗ Branch 118 not taken.
✗ Branch 119 not taken.
✓ Branch 120 taken 1 times.
✗ Branch 121 not taken.
✗ Branch 122 not taken.
✓ Branch 123 taken 1 times.
✗ Branch 124 not taken.
✓ Branch 125 taken 1 times.
✗ Branch 126 not taken.
✓ Branch 128 taken 1 times.
✗ Branch 129 not taken.
✓ Branch 131 taken 1 times.
✗ Branch 132 not taken.
✓ Branch 133 taken 1 times.
✗ Branch 134 not taken.
✗ Branch 135 not taken.
✗ Branch 136 not taken.
✗ Branch 139 not taken.
✗ Branch 140 not taken.
5924 ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, sse4, ssse3);
619
11/15
✓ Branch 0 taken 32 times.
✓ Branch 1 taken 27 times.
✓ Branch 2 taken 26 times.
✓ Branch 3 taken 5252 times.
✓ Branch 4 taken 515 times.
✓ Branch 6 taken 32 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 27 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 27 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 26 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 4339 times.
✓ Branch 18 taken 913 times.
5852 ASSIGN_VSCALEX_FUNC(c->yuv2planeX, sse4,
620 if (!isBE(c->dstFormat)) c->yuv2planeX = ff_yuv2planeX_16_sse4,
621 HAVE_ALIGNED_STACK || ARCH_X86_64);
622
4/6
✓ Branch 0 taken 32 times.
✓ Branch 1 taken 5820 times.
✓ Branch 3 taken 32 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 32 times.
✗ Branch 6 not taken.
5852 if (c->dstBpc == 16 && !isBE(c->dstFormat) && !(c->flags & SWS_ACCURATE_RND))
623 32 c->yuv2plane1 = ff_yuv2plane1_16_sse4;
624 }
625
626
2/2
✓ Branch 0 taken 2957 times.
✓ Branch 1 taken 27346 times.
30303 if (EXTERNAL_AVX(cpu_flags)) {
627
10/13
✓ Branch 0 taken 20 times.
✓ Branch 1 taken 15 times.
✓ Branch 2 taken 14 times.
✓ Branch 3 taken 2633 times.
✓ Branch 4 taken 275 times.
✓ Branch 6 taken 15 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 15 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 14 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 2170 times.
✓ Branch 15 taken 463 times.
2957 ASSIGN_VSCALEX_FUNC(c->yuv2planeX, avx, ,
628 HAVE_ALIGNED_STACK || ARCH_X86_64);
629
2/2
✓ Branch 0 taken 2894 times.
✓ Branch 1 taken 63 times.
2957 if (!(c->flags & SWS_ACCURATE_RND))
630
10/15
✓ Branch 0 taken 20 times.
✓ Branch 1 taken 15 times.
✓ Branch 2 taken 14 times.
✓ Branch 3 taken 2570 times.
✓ Branch 4 taken 275 times.
✓ Branch 6 taken 20 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 15 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 15 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 14 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✓ Branch 18 taken 275 times.
2894 ASSIGN_VSCALE_FUNC(c->yuv2plane1, avx);
631
632
7/11
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 13 times.
✓ Branch 5 taken 10 times.
✓ Branch 6 taken 12 times.
✓ Branch 7 taken 11 times.
✓ Branch 8 taken 11 times.
✓ Branch 9 taken 11 times.
✓ Branch 10 taken 2889 times.
2957 switch (c->srcFormat) {
633 case AV_PIX_FMT_YUYV422:
634 c->chrToYV12 = ff_yuyvToUV_avx;
635 break;
636 case AV_PIX_FMT_UYVY422:
637 c->chrToYV12 = ff_uyvyToUV_avx;
638 break;
639 case AV_PIX_FMT_NV12:
640 c->chrToYV12 = ff_nv12ToUV_avx;
641 break;
642 case AV_PIX_FMT_NV21:
643 c->chrToYV12 = ff_nv21ToUV_avx;
644 break;
645
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 9 times.
13 case_rgb(rgb24, RGB24, avx);
646
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 6 times.
10 case_rgb(bgr24, BGR24, avx);
647
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 7 times.
12 case_rgb(bgra, BGRA, avx);
648
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 6 times.
11 case_rgb(rgba, RGBA, avx);
649
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 6 times.
11 case_rgb(abgr, ABGR, avx);
650
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 6 times.
11 case_rgb(argb, ARGB, avx);
651 2889 default:
652 2889 break;
653 }
654 }
655
656 #if ARCH_X86_64
657 #define ASSIGN_AVX2_SCALE_FUNC(hscalefn, filtersize) \
658 switch (filtersize) { \
659 case 4: hscalefn = ff_hscale8to15_4_avx2; break; \
660 default: hscalefn = ff_hscale8to15_X4_avx2; break; \
661 break; \
662 }
663
664
4/6
✓ Branch 0 taken 1027 times.
✓ Branch 1 taken 29276 times.
✓ Branch 2 taken 1027 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1027 times.
✗ Branch 5 not taken.
30303 if (EXTERNAL_AVX2_FAST(cpu_flags) && !(cpu_flags & AV_CPU_FLAG_SLOW_GATHER)) {
665
4/4
✓ Branch 0 taken 947 times.
✓ Branch 1 taken 80 times.
✓ Branch 2 taken 906 times.
✓ Branch 3 taken 41 times.
1027 if ((c->srcBpc == 8) && (c->dstBpc <= 14)) {
666
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 900 times.
906 ASSIGN_AVX2_SCALE_FUNC(c->hcScale, c->hChrFilterSize);
667
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 900 times.
906 ASSIGN_AVX2_SCALE_FUNC(c->hyScale, c->hLumFilterSize);
668 }
669 }
670
671
3/4
✓ Branch 0 taken 1027 times.
✓ Branch 1 taken 29276 times.
✓ Branch 2 taken 1027 times.
✗ Branch 3 not taken.
30303 if (EXTERNAL_AVX2_FAST(cpu_flags)) {
672 if (ARCH_X86_64)
673
7/7
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 5 taken 5 times.
✓ Branch 6 taken 997 times.
1027 switch (c->srcFormat) {
674
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 3 times.
5 case_rgb(rgb24, RGB24, avx2);
675
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2 times.
4 case_rgb(bgr24, BGR24, avx2);
676
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 3 times.
6 case_rgb(bgra, BGRA, avx2);
677
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 2 times.
5 case_rgb(rgba, RGBA, avx2);
678
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 2 times.
5 case_rgb(abgr, ABGR, avx2);
679
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 2 times.
5 case_rgb(argb, ARGB, avx2);
680 }
681
2/2
✓ Branch 0 taken 1006 times.
✓ Branch 1 taken 21 times.
1027 if (!(c->flags & SWS_ACCURATE_RND)) // FIXME
682
2/3
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1005 times.
1006 switch (c->dstFormat) {
683 1 case AV_PIX_FMT_NV12:
684 case AV_PIX_FMT_NV24:
685 1 c->yuv2nv12cX = ff_yuv2nv12cX_avx2;
686 1 break;
687 case AV_PIX_FMT_NV21:
688 case AV_PIX_FMT_NV42:
689 c->yuv2nv12cX = ff_yuv2nv21cX_avx2;
690 break;
691 1005 default:
692 1005 break;
693 }
694 }
695
696
697 #define INPUT_PLANER_RGB_A_FUNC_CASE_NOBREAK(fmt, name, opt) \
698 case fmt: \
699 c->readAlpPlanar = ff_planar_##name##_to_a_##opt;
700
701 #define INPUT_PLANER_RGBA_YUV_FUNC_CASE(rgb_fmt, rgba_fmt, name, opt) \
702 case rgba_fmt: \
703 case rgb_fmt: \
704 c->readLumPlanar = ff_planar_##name##_to_y_##opt; \
705 c->readChrPlanar = ff_planar_##name##_to_uv_##opt; \
706 break;
707
708 #define INPUT_PLANER_RGB_YUV_FUNC_CASE(fmt, name, opt) \
709 case fmt: \
710 c->readLumPlanar = ff_planar_##name##_to_y_##opt; \
711 c->readChrPlanar = ff_planar_##name##_to_uv_##opt; \
712 break;
713
714 #define INPUT_PLANER_RGB_UV_FUNC_CASE(fmt, name, opt) \
715 case fmt: \
716 c->readChrPlanar = ff_planar_##name##_to_uv_##opt; \
717 break;
718
719 #define INPUT_PLANER_RGBAXX_YUVA_FUNC_CASE(rgb_fmt, rgba_fmt, name, opt) \
720 INPUT_PLANER_RGB_A_FUNC_CASE_NOBREAK(rgba_fmt##LE, name##le, opt) \
721 INPUT_PLANER_RGB_YUV_FUNC_CASE(rgb_fmt##LE, name##le, opt) \
722 INPUT_PLANER_RGB_A_FUNC_CASE_NOBREAK(rgba_fmt##BE, name##be, opt) \
723 INPUT_PLANER_RGB_YUV_FUNC_CASE(rgb_fmt##BE, name##be, opt)
724
725 #define INPUT_PLANER_RGBAXX_UVA_FUNC_CASE(rgb_fmt, rgba_fmt, name, opt) \
726 INPUT_PLANER_RGB_A_FUNC_CASE_NOBREAK(rgba_fmt##LE, name##le, opt) \
727 INPUT_PLANER_RGB_UV_FUNC_CASE(rgb_fmt##LE, name##le, opt) \
728 INPUT_PLANER_RGB_A_FUNC_CASE_NOBREAK(rgba_fmt##BE, name##be, opt) \
729 INPUT_PLANER_RGB_UV_FUNC_CASE(rgb_fmt##BE, name##be, opt)
730
731 #define INPUT_PLANER_RGBAXX_YUV_FUNC_CASE(rgb_fmt, rgba_fmt, name, opt) \
732 INPUT_PLANER_RGBA_YUV_FUNC_CASE(rgb_fmt##LE, rgba_fmt##LE, name##le, opt) \
733 INPUT_PLANER_RGBA_YUV_FUNC_CASE(rgb_fmt##BE, rgba_fmt##BE, name##be, opt)
734
735 #define INPUT_PLANER_RGBXX_YUV_FUNC_CASE(rgb_fmt, name, opt) \
736 INPUT_PLANER_RGB_YUV_FUNC_CASE(rgb_fmt##LE, name##le, opt) \
737 INPUT_PLANER_RGB_YUV_FUNC_CASE(rgb_fmt##BE, name##be, opt)
738
739 #define INPUT_PLANER_RGBXX_UV_FUNC_CASE(rgb_fmt, name, opt) \
740 INPUT_PLANER_RGB_UV_FUNC_CASE(rgb_fmt##LE, name##le, opt) \
741 INPUT_PLANER_RGB_UV_FUNC_CASE(rgb_fmt##BE, name##be, opt)
742
743 #define INPUT_PLANER_RGB_YUVA_ALL_CASES(opt) \
744 INPUT_PLANER_RGB_A_FUNC_CASE_NOBREAK(AV_PIX_FMT_GBRAP, rgb, opt) \
745 INPUT_PLANER_RGB_YUV_FUNC_CASE( AV_PIX_FMT_GBRP, rgb, opt) \
746 INPUT_PLANER_RGBXX_YUV_FUNC_CASE( AV_PIX_FMT_GBRP9, rgb9, opt) \
747 INPUT_PLANER_RGBAXX_YUVA_FUNC_CASE(AV_PIX_FMT_GBRP10, AV_PIX_FMT_GBRAP10, rgb10, opt) \
748 INPUT_PLANER_RGBAXX_YUVA_FUNC_CASE(AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRAP12, rgb12, opt) \
749 INPUT_PLANER_RGBXX_YUV_FUNC_CASE( AV_PIX_FMT_GBRP14, rgb14, opt) \
750 INPUT_PLANER_RGBAXX_YUVA_FUNC_CASE(AV_PIX_FMT_GBRP16, AV_PIX_FMT_GBRAP16, rgb16, opt) \
751 INPUT_PLANER_RGBAXX_YUVA_FUNC_CASE(AV_PIX_FMT_GBRPF32, AV_PIX_FMT_GBRAPF32, rgbf32, opt)
752
753
754
2/2
✓ Branch 0 taken 8747 times.
✓ Branch 1 taken 21556 times.
30303 if (EXTERNAL_SSE2(cpu_flags)) {
755
23/23
✓ Branch 0 taken 163 times.
✓ Branch 1 taken 109 times.
✓ Branch 2 taken 109 times.
✓ Branch 3 taken 108 times.
✓ Branch 4 taken 163 times.
✓ Branch 5 taken 109 times.
✓ Branch 6 taken 162 times.
✓ Branch 7 taken 108 times.
✓ Branch 8 taken 163 times.
✓ Branch 9 taken 109 times.
✓ Branch 10 taken 162 times.
✓ Branch 11 taken 108 times.
✓ Branch 12 taken 109 times.
✓ Branch 13 taken 108 times.
✓ Branch 14 taken 163 times.
✓ Branch 15 taken 109 times.
✓ Branch 16 taken 162 times.
✓ Branch 17 taken 108 times.
✓ Branch 18 taken 162 times.
✓ Branch 19 taken 138 times.
✓ Branch 20 taken 162 times.
✓ Branch 21 taken 108 times.
✓ Branch 22 taken 5845 times.
8747 switch (c->srcFormat) {
756 163 INPUT_PLANER_RGB_A_FUNC_CASE_NOBREAK(AV_PIX_FMT_GBRAP, rgb, sse2);
757 272 INPUT_PLANER_RGB_UV_FUNC_CASE( AV_PIX_FMT_GBRP, rgb, sse2);
758 217 INPUT_PLANER_RGBXX_UV_FUNC_CASE( AV_PIX_FMT_GBRP9, rgb9, sse2);
759 542 INPUT_PLANER_RGBAXX_UVA_FUNC_CASE( AV_PIX_FMT_GBRP10, AV_PIX_FMT_GBRAP10, rgb10, sse2);
760 542 INPUT_PLANER_RGBAXX_UVA_FUNC_CASE( AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRAP12, rgb12, sse2);
761 217 INPUT_PLANER_RGBXX_UV_FUNC_CASE( AV_PIX_FMT_GBRP14, rgb14, sse2);
762 542 INPUT_PLANER_RGBAXX_UVA_FUNC_CASE( AV_PIX_FMT_GBRP16, AV_PIX_FMT_GBRAP16, rgb16, sse2);
763 570 INPUT_PLANER_RGBAXX_YUVA_FUNC_CASE(AV_PIX_FMT_GBRPF32, AV_PIX_FMT_GBRAPF32, rgbf32, sse2);
764 5845 default:
765 5845 break;
766 }
767 }
768
769
2/2
✓ Branch 0 taken 5852 times.
✓ Branch 1 taken 24451 times.
30303 if (EXTERNAL_SSE4(cpu_flags)) {
770
16/16
✓ Branch 0 taken 182 times.
✓ Branch 1 taken 73 times.
✓ Branch 2 taken 72 times.
✓ Branch 3 taken 182 times.
✓ Branch 4 taken 180 times.
✓ Branch 5 taken 182 times.
✓ Branch 6 taken 180 times.
✓ Branch 7 taken 73 times.
✓ Branch 8 taken 72 times.
✓ Branch 9 taken 182 times.
✓ Branch 10 taken 180 times.
✓ Branch 11 taken 108 times.
✓ Branch 12 taken 102 times.
✓ Branch 13 taken 108 times.
✓ Branch 14 taken 72 times.
✓ Branch 15 taken 3904 times.
5852 switch (c->srcFormat) {
771 182 case AV_PIX_FMT_GBRAP:
772 182 INPUT_PLANER_RGB_YUV_FUNC_CASE( AV_PIX_FMT_GBRP, rgb, sse4);
773 145 INPUT_PLANER_RGBXX_YUV_FUNC_CASE( AV_PIX_FMT_GBRP9, rgb9, sse4);
774 362 INPUT_PLANER_RGBAXX_YUV_FUNC_CASE( AV_PIX_FMT_GBRP10, AV_PIX_FMT_GBRAP10, rgb10, sse4);
775 362 INPUT_PLANER_RGBAXX_YUV_FUNC_CASE( AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRAP12, rgb12, sse4);
776 145 INPUT_PLANER_RGBXX_YUV_FUNC_CASE( AV_PIX_FMT_GBRP14, rgb14, sse4);
777 362 INPUT_PLANER_RGBAXX_YUV_FUNC_CASE( AV_PIX_FMT_GBRP16, AV_PIX_FMT_GBRAP16, rgb16, sse4);
778 390 INPUT_PLANER_RGBAXX_YUVA_FUNC_CASE(AV_PIX_FMT_GBRPF32, AV_PIX_FMT_GBRAPF32, rgbf32, sse4);
779 3904 default:
780 3904 break;
781 }
782 }
783
784
3/4
✓ Branch 0 taken 1027 times.
✓ Branch 1 taken 29276 times.
✓ Branch 2 taken 1027 times.
✗ Branch 3 not taken.
30303 if (EXTERNAL_AVX2_FAST(cpu_flags)) {
785
23/23
✓ Branch 0 taken 19 times.
✓ Branch 1 taken 13 times.
✓ Branch 2 taken 13 times.
✓ Branch 3 taken 12 times.
✓ Branch 4 taken 19 times.
✓ Branch 5 taken 13 times.
✓ Branch 6 taken 18 times.
✓ Branch 7 taken 12 times.
✓ Branch 8 taken 19 times.
✓ Branch 9 taken 13 times.
✓ Branch 10 taken 18 times.
✓ Branch 11 taken 12 times.
✓ Branch 12 taken 13 times.
✓ Branch 13 taken 12 times.
✓ Branch 14 taken 19 times.
✓ Branch 15 taken 13 times.
✓ Branch 16 taken 18 times.
✓ Branch 17 taken 12 times.
✓ Branch 18 taken 18 times.
✓ Branch 19 taken 42 times.
✓ Branch 20 taken 18 times.
✓ Branch 21 taken 12 times.
✓ Branch 22 taken 669 times.
1027 switch (c->srcFormat) {
786 358 INPUT_PLANER_RGB_YUVA_ALL_CASES(avx2)
787 669 default:
788 669 break;
789 }
790 }
791
792
2/2
✓ Branch 0 taken 11665 times.
✓ Branch 1 taken 18638 times.
30303 if(c->flags & SWS_FULL_CHR_H_INT) {
793
794 /* yuv2gbrp uses the SwsInternal for yuv coefficients
795 if struct offsets change the asm needs to be updated too */
796 av_assert0(offsetof(SwsInternal, yuv2rgb_y_offset) == 40292);
797
798 #define YUV2ANYX_FUNC_CASE(fmt, name, opt) \
799 case fmt: \
800 c->yuv2anyX = ff_yuv2##name##_full_X_##opt; \
801 break;
802
803 #define YUV2ANYX_GBRAP_CASES(opt) \
804 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRP, gbrp, opt) \
805 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRAP, gbrap, opt) \
806 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRP9LE, gbrp9le, opt) \
807 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRP10LE, gbrp10le, opt) \
808 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRAP10LE, gbrap10le, opt) \
809 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRP12LE, gbrp12le, opt) \
810 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRAP12LE, gbrap12le, opt) \
811 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRP14LE, gbrp14le, opt) \
812 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRP16LE, gbrp16le, opt) \
813 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRAP16LE, gbrap16le, opt) \
814 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRPF32LE, gbrpf32le, opt) \
815 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRAPF32LE, gbrapf32le, opt) \
816 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRP9BE, gbrp9be, opt) \
817 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRP10BE, gbrp10be, opt) \
818 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRAP10BE, gbrap10be, opt) \
819 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRP12BE, gbrp12be, opt) \
820 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRAP12BE, gbrap12be, opt) \
821 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRP14BE, gbrp14be, opt) \
822 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRP16BE, gbrp16be, opt) \
823 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRAP16BE, gbrap16be, opt) \
824 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRPF32BE, gbrpf32be, opt) \
825 YUV2ANYX_FUNC_CASE(AV_PIX_FMT_GBRAPF32BE, gbrapf32be, opt)
826
827
2/2
✓ Branch 0 taken 4806 times.
✓ Branch 1 taken 6859 times.
11665 if (EXTERNAL_SSE2(cpu_flags)) {
828
23/23
✓ Branch 0 taken 217 times.
✓ Branch 1 taken 217 times.
✓ Branch 2 taken 217 times.
✓ Branch 3 taken 217 times.
✓ Branch 4 taken 217 times.
✓ Branch 5 taken 217 times.
✓ Branch 6 taken 217 times.
✓ Branch 7 taken 217 times.
✓ Branch 8 taken 217 times.
✓ Branch 9 taken 217 times.
✓ Branch 10 taken 246 times.
✓ Branch 11 taken 216 times.
✓ Branch 12 taken 216 times.
✓ Branch 13 taken 216 times.
✓ Branch 14 taken 216 times.
✓ Branch 15 taken 216 times.
✓ Branch 16 taken 216 times.
✓ Branch 17 taken 216 times.
✓ Branch 18 taken 216 times.
✓ Branch 19 taken 216 times.
✓ Branch 20 taken 216 times.
✓ Branch 21 taken 216 times.
✓ Branch 22 taken 14 times.
4806 switch (c->dstFormat) {
829 4792 YUV2ANYX_GBRAP_CASES(sse2)
830 14 default:
831 14 break;
832 }
833 }
834
835
2/2
✓ Branch 0 taken 3222 times.
✓ Branch 1 taken 8443 times.
11665 if (EXTERNAL_SSE4(cpu_flags)) {
836
23/23
✓ Branch 0 taken 145 times.
✓ Branch 1 taken 145 times.
✓ Branch 2 taken 145 times.
✓ Branch 3 taken 145 times.
✓ Branch 4 taken 145 times.
✓ Branch 5 taken 145 times.
✓ Branch 6 taken 145 times.
✓ Branch 7 taken 145 times.
✓ Branch 8 taken 145 times.
✓ Branch 9 taken 145 times.
✓ Branch 10 taken 174 times.
✓ Branch 11 taken 144 times.
✓ Branch 12 taken 144 times.
✓ Branch 13 taken 144 times.
✓ Branch 14 taken 144 times.
✓ Branch 15 taken 144 times.
✓ Branch 16 taken 144 times.
✓ Branch 17 taken 144 times.
✓ Branch 18 taken 144 times.
✓ Branch 19 taken 144 times.
✓ Branch 20 taken 144 times.
✓ Branch 21 taken 144 times.
✓ Branch 22 taken 14 times.
3222 switch (c->dstFormat) {
837 3208 YUV2ANYX_GBRAP_CASES(sse4)
838 14 default:
839 14 break;
840 }
841 }
842
843
3/4
✓ Branch 0 taken 582 times.
✓ Branch 1 taken 11083 times.
✓ Branch 2 taken 582 times.
✗ Branch 3 not taken.
11665 if (EXTERNAL_AVX2_FAST(cpu_flags)) {
844
23/23
✓ Branch 0 taken 25 times.
✓ Branch 1 taken 25 times.
✓ Branch 2 taken 25 times.
✓ Branch 3 taken 25 times.
✓ Branch 4 taken 25 times.
✓ Branch 5 taken 25 times.
✓ Branch 6 taken 25 times.
✓ Branch 7 taken 25 times.
✓ Branch 8 taken 25 times.
✓ Branch 9 taken 25 times.
✓ Branch 10 taken 54 times.
✓ Branch 11 taken 24 times.
✓ Branch 12 taken 24 times.
✓ Branch 13 taken 24 times.
✓ Branch 14 taken 24 times.
✓ Branch 15 taken 24 times.
✓ Branch 16 taken 24 times.
✓ Branch 17 taken 24 times.
✓ Branch 18 taken 24 times.
✓ Branch 19 taken 24 times.
✓ Branch 20 taken 24 times.
✓ Branch 21 taken 24 times.
✓ Branch 22 taken 14 times.
582 switch (c->dstFormat) {
845 568 YUV2ANYX_GBRAP_CASES(avx2)
846 14 default:
847 14 break;
848 }
849 }
850 }
851
852 #endif
853 30303 }
854