FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libswscale/x86/rgb2rgb.c
Date: 2026-11-01 11:15:23
Exec Total Coverage
Lines: 504 581 86.7%
Functions: 30 38 78.9%
Branches: 136 158 86.1%

Line Branch Exec Source
1 /*
2 * software RGB to RGB converter
3 * pluralize by software PAL8 to RGB converter
4 * software YUV to YUV converter
5 * software YUV to RGB converter
6 * Written by Nick Kurshev.
7 * palette & YUV & runtime CPU stuff by Michael (michaelni@gmx.at)
8 *
9 * This file is part of FFmpeg.
10 *
11 * FFmpeg is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2.1 of the License, or (at your option) any later version.
15 *
16 * FFmpeg is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with FFmpeg; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 */
25
26 #include <stdint.h>
27
28 #include "config.h"
29 #include "libavutil/attributes.h"
30 #include "libavutil/x86/cpu.h"
31 #include "libavutil/cpu.h"
32 #include "libavutil/bswap.h"
33 #include "libavutil/mem_internal.h"
34
35 #include "libswscale/rgb2rgb.h"
36 #include "libswscale/swscale.h"
37 #include "libswscale/swscale_internal.h"
38
39 #if HAVE_INLINE_ASM
40 #include "libavutil/x86/asm.h"
41
42 DECLARE_ASM_CONST(8, uint64_t, mmx_ff) = 0x00000000000000FFULL;
43 DECLARE_ASM_CONST(8, uint64_t, mmx_null) = 0x0000000000000000ULL;
44 DECLARE_ASM_CONST(8, uint64_t, mask32a) = 0xFF000000FF000000ULL;
45 DECLARE_ASM_CONST(8, uint64_t, mask3216br) = 0x00F800F800F800F8ULL;
46 DECLARE_ASM_CONST(8, uint64_t, mask3216g) = 0x0000FC000000FC00ULL;
47 DECLARE_ASM_CONST(8, uint64_t, mask3215g) = 0x0000F8000000F800ULL;
48 DECLARE_ASM_CONST(8, uint64_t, mul3216) = 0x2000000420000004ULL;
49 DECLARE_ASM_CONST(8, uint64_t, mul3215) = 0x2000000820000008ULL;
50 DECLARE_ASM_CONST(8, uint64_t, mask24b) = 0x00FF0000FF0000FFULL;
51 DECLARE_ASM_CONST(8, uint64_t, mask24g) = 0xFF0000FF0000FF00ULL;
52 DECLARE_ASM_CONST(8, uint64_t, mask24r) = 0x0000FF0000FF0000ULL;
53 DECLARE_ASM_CONST(8, uint64_t, mask24l) = 0x0000000000FFFFFFULL;
54 DECLARE_ASM_CONST(8, uint64_t, mask24h) = 0x0000FFFFFF000000ULL;
55 DECLARE_ASM_CONST(8, uint64_t, mask15b) = 0x001F001F001F001FULL; /* 00000000 00011111 xxB */
56 DECLARE_ASM_CONST(8, uint64_t, mask15rg) = 0x7FE07FE07FE07FE0ULL; /* 01111111 11100000 RGx */
57 DECLARE_ASM_CONST(8, uint64_t, mask15s) = 0xFFE0FFE0FFE0FFE0ULL;
58 DECLARE_ASM_CONST(8, uint64_t, mask15g) = 0x03E003E003E003E0ULL;
59 DECLARE_ASM_CONST(8, uint64_t, mask15r) = 0x7C007C007C007C00ULL;
60 #define mask16b mask15b
61 DECLARE_ASM_CONST(8, uint64_t, mask16g) = 0x07E007E007E007E0ULL;
62 DECLARE_ASM_CONST(8, uint64_t, mask16r) = 0xF800F800F800F800ULL;
63 #define red_16mask mask3215g
64 DECLARE_ASM_CONST(8, uint64_t, green_16mask) = 0x000007e0000007e0ULL;
65 DECLARE_ASM_CONST(8, uint64_t, blue_16mask) = 0x0000001f0000001fULL;
66 DECLARE_ASM_CONST(8, uint64_t, red_15mask) = 0x00007c0000007c00ULL;
67 DECLARE_ASM_CONST(8, uint64_t, green_15mask) = 0x000003e0000003e0ULL;
68 #define blue_15mask blue_16mask
69 DECLARE_ASM_CONST(8, uint64_t, mul15_mid) = 0x4200420042004200ULL;
70 DECLARE_ASM_CONST(8, uint64_t, mul15_hi) = 0x0210021002100210ULL;
71 DECLARE_ASM_CONST(8, uint64_t, mul16_mid) = 0x2080208020802080ULL;
72
73 #define BY ((int)( 0.098*(1<<RGB2YUV_SHIFT)+0.5))
74 #define BV ((int)(-0.071*(1<<RGB2YUV_SHIFT)+0.5))
75 #define BU ((int)( 0.439*(1<<RGB2YUV_SHIFT)+0.5))
76 #define GY ((int)( 0.504*(1<<RGB2YUV_SHIFT)+0.5))
77 #define GV ((int)(-0.368*(1<<RGB2YUV_SHIFT)+0.5))
78 #define GU ((int)(-0.291*(1<<RGB2YUV_SHIFT)+0.5))
79 #define RY ((int)( 0.257*(1<<RGB2YUV_SHIFT)+0.5))
80 #define RV ((int)( 0.439*(1<<RGB2YUV_SHIFT)+0.5))
81 #define RU ((int)(-0.148*(1<<RGB2YUV_SHIFT)+0.5))
82
83 // MMXEXT versions
84 #define PREFETCH "prefetchnta"
85 #define PAVGB "pavgb"
86 #define MOVNTQ "movntq"
87 #define SFENCE "sfence"
88
89 #define EMMS "emms"
90
91 18216 static inline void rgb24tobgr32_mmxext(const uint8_t *src, uint8_t *dst, int src_size)
92 {
93 18216 uint8_t *dest = dst;
94 18216 const uint8_t *s = src;
95 const uint8_t *end;
96 const uint8_t *mm_end;
97 18216 end = s + src_size;
98 18216 __asm__ volatile(PREFETCH" %0"::"m"(*s):"memory");
99 18216 mm_end = end - 23;
100 18216 __asm__ volatile("movq %0, %%mm7"::"m"(mask32a):"memory");
101
2/2
✓ Branch 0 taken 65227 times.
✓ Branch 1 taken 18216 times.
83443 while (s < mm_end) {
102 65227 __asm__ volatile(
103 PREFETCH" 32(%1) \n\t"
104 "movd (%1), %%mm0 \n\t"
105 "punpckldq 3(%1), %%mm0 \n\t"
106 "movd 6(%1), %%mm1 \n\t"
107 "punpckldq 9(%1), %%mm1 \n\t"
108 "movd 12(%1), %%mm2 \n\t"
109 "punpckldq 15(%1), %%mm2 \n\t"
110 "movd 18(%1), %%mm3 \n\t"
111 "punpckldq 21(%1), %%mm3 \n\t"
112 "por %%mm7, %%mm0 \n\t"
113 "por %%mm7, %%mm1 \n\t"
114 "por %%mm7, %%mm2 \n\t"
115 "por %%mm7, %%mm3 \n\t"
116 MOVNTQ" %%mm0, (%0) \n\t"
117 MOVNTQ" %%mm1, 8(%0) \n\t"
118 MOVNTQ" %%mm2, 16(%0) \n\t"
119 MOVNTQ" %%mm3, 24(%0)"
120 :: "r"(dest), "r"(s)
121 :"memory");
122 65227 dest += 32;
123 65227 s += 24;
124 }
125 18216 __asm__ volatile(SFENCE:::"memory");
126 18216 __asm__ volatile(EMMS:::"memory");
127
2/2
✓ Branch 0 taken 64748 times.
✓ Branch 1 taken 18216 times.
82964 while (s < end) {
128 64748 *dest++ = *s++;
129 64748 *dest++ = *s++;
130 64748 *dest++ = *s++;
131 64748 *dest++ = 255;
132 }
133 18216 }
134
135 #define STORE_BGR24_MMX \
136 "psrlq $8, %%mm2 \n\t" \
137 "psrlq $8, %%mm3 \n\t" \
138 "psrlq $8, %%mm6 \n\t" \
139 "psrlq $8, %%mm7 \n\t" \
140 "pand "MANGLE(mask24l)", %%mm0\n\t" \
141 "pand "MANGLE(mask24l)", %%mm1\n\t" \
142 "pand "MANGLE(mask24l)", %%mm4\n\t" \
143 "pand "MANGLE(mask24l)", %%mm5\n\t" \
144 "pand "MANGLE(mask24h)", %%mm2\n\t" \
145 "pand "MANGLE(mask24h)", %%mm3\n\t" \
146 "pand "MANGLE(mask24h)", %%mm6\n\t" \
147 "pand "MANGLE(mask24h)", %%mm7\n\t" \
148 "por %%mm2, %%mm0 \n\t" \
149 "por %%mm3, %%mm1 \n\t" \
150 "por %%mm6, %%mm4 \n\t" \
151 "por %%mm7, %%mm5 \n\t" \
152 \
153 "movq %%mm1, %%mm2 \n\t" \
154 "movq %%mm4, %%mm3 \n\t" \
155 "psllq $48, %%mm2 \n\t" \
156 "psllq $32, %%mm3 \n\t" \
157 "por %%mm2, %%mm0 \n\t" \
158 "psrlq $16, %%mm1 \n\t" \
159 "psrlq $32, %%mm4 \n\t" \
160 "psllq $16, %%mm5 \n\t" \
161 "por %%mm3, %%mm1 \n\t" \
162 "por %%mm5, %%mm4 \n\t" \
163 \
164 MOVNTQ" %%mm0, (%0) \n\t" \
165 MOVNTQ" %%mm1, 8(%0) \n\t" \
166 MOVNTQ" %%mm4, 16(%0)"
167
168
169 18217 static inline void rgb32tobgr24_mmxext(const uint8_t *src, uint8_t *dst, int src_size)
170 {
171 18217 uint8_t *dest = dst;
172 18217 const uint8_t *s = src;
173 const uint8_t *end;
174 const uint8_t *mm_end;
175 18217 end = s + src_size;
176 18217 __asm__ volatile(PREFETCH" %0"::"m"(*s):"memory");
177 18217 mm_end = end - 31;
178
2/2
✓ Branch 0 taken 65229 times.
✓ Branch 1 taken 18217 times.
83446 while (s < mm_end) {
179 65229 __asm__ volatile(
180 PREFETCH" 32(%1) \n\t"
181 "movq (%1), %%mm0 \n\t"
182 "movq 8(%1), %%mm1 \n\t"
183 "movq 16(%1), %%mm4 \n\t"
184 "movq 24(%1), %%mm5 \n\t"
185 "movq %%mm0, %%mm2 \n\t"
186 "movq %%mm1, %%mm3 \n\t"
187 "movq %%mm4, %%mm6 \n\t"
188 "movq %%mm5, %%mm7 \n\t"
189 STORE_BGR24_MMX
190 :: "r"(dest), "r"(s)
191 NAMED_CONSTRAINTS_ADD(mask24l,mask24h)
192 :"memory");
193 65229 dest += 24;
194 65229 s += 32;
195 }
196 18217 __asm__ volatile(SFENCE:::"memory");
197 18217 __asm__ volatile(EMMS:::"memory");
198
2/2
✓ Branch 0 taken 64747 times.
✓ Branch 1 taken 18217 times.
82964 while (s < end) {
199 64747 *dest++ = *s++;
200 64747 *dest++ = *s++;
201 64747 *dest++ = *s++;
202 64747 s++;
203 }
204 18217 }
205
206 /*
207 original by Strepto/Astral
208 ported to gcc & bugfixed: A'rpi
209 MMXEXT, 3DNOW optimization by Nick Kurshev
210 32-bit C version, and and&add trick by Michael Niedermayer
211 */
212 18207 static inline void rgb15to16_mmxext(const uint8_t *src, uint8_t *dst, int src_size)
213 {
214 18207 register const uint8_t* s=src;
215 18207 register uint8_t* d=dst;
216 register const uint8_t *end;
217 const uint8_t *mm_end;
218 18207 end = s + src_size;
219 18207 __asm__ volatile(PREFETCH" %0"::"m"(*s));
220 18207 __asm__ volatile("movq %0, %%mm4"::"m"(mask15s));
221 18207 mm_end = end - 15;
222
2/2
✓ Branch 0 taken 64736 times.
✓ Branch 1 taken 18207 times.
82943 while (s<mm_end) {
223 64736 __asm__ volatile(
224 PREFETCH" 32(%1) \n\t"
225 "movq (%1), %%mm0 \n\t"
226 "movq 8(%1), %%mm2 \n\t"
227 "movq %%mm0, %%mm1 \n\t"
228 "movq %%mm2, %%mm3 \n\t"
229 "pand %%mm4, %%mm0 \n\t"
230 "pand %%mm4, %%mm2 \n\t"
231 "paddw %%mm1, %%mm0 \n\t"
232 "paddw %%mm3, %%mm2 \n\t"
233 MOVNTQ" %%mm0, (%0) \n\t"
234 MOVNTQ" %%mm2, 8(%0)"
235 :: "r"(d), "r"(s)
236 );
237 64736 d+=16;
238 64736 s+=16;
239 }
240 18207 __asm__ volatile(SFENCE:::"memory");
241 18207 __asm__ volatile(EMMS:::"memory");
242 18207 mm_end = end - 3;
243
2/2
✓ Branch 0 taken 27744 times.
✓ Branch 1 taken 18207 times.
45951 while (s < mm_end) {
244 27744 register unsigned x= *((const uint32_t *)s);
245 27744 *((uint32_t *)d) = (x&0x7FFF7FFF) + (x&0x7FE07FE0);
246 27744 d+=4;
247 27744 s+=4;
248 }
249
2/2
✓ Branch 0 taken 9248 times.
✓ Branch 1 taken 8959 times.
18207 if (s < end) {
250 9248 register unsigned short x= *((const uint16_t *)s);
251 9248 *((uint16_t *)d) = (x&0x7FFF) + (x&0x7FE0);
252 }
253 18207 }
254
255 18207 static inline void rgb16to15_mmxext(const uint8_t *src, uint8_t *dst, int src_size)
256 {
257 18207 register const uint8_t* s=src;
258 18207 register uint8_t* d=dst;
259 register const uint8_t *end;
260 const uint8_t *mm_end;
261 18207 end = s + src_size;
262 18207 __asm__ volatile(PREFETCH" %0"::"m"(*s));
263 18207 __asm__ volatile("movq %0, %%mm7"::"m"(mask15rg));
264 18207 __asm__ volatile("movq %0, %%mm6"::"m"(mask15b));
265 18207 mm_end = end - 15;
266
2/2
✓ Branch 0 taken 64736 times.
✓ Branch 1 taken 18207 times.
82943 while (s<mm_end) {
267 64736 __asm__ volatile(
268 PREFETCH" 32(%1) \n\t"
269 "movq (%1), %%mm0 \n\t"
270 "movq 8(%1), %%mm2 \n\t"
271 "movq %%mm0, %%mm1 \n\t"
272 "movq %%mm2, %%mm3 \n\t"
273 "psrlq $1, %%mm0 \n\t"
274 "psrlq $1, %%mm2 \n\t"
275 "pand %%mm7, %%mm0 \n\t"
276 "pand %%mm7, %%mm2 \n\t"
277 "pand %%mm6, %%mm1 \n\t"
278 "pand %%mm6, %%mm3 \n\t"
279 "por %%mm1, %%mm0 \n\t"
280 "por %%mm3, %%mm2 \n\t"
281 MOVNTQ" %%mm0, (%0) \n\t"
282 MOVNTQ" %%mm2, 8(%0)"
283 :: "r"(d), "r"(s)
284 );
285 64736 d+=16;
286 64736 s+=16;
287 }
288 18207 __asm__ volatile(SFENCE:::"memory");
289 18207 __asm__ volatile(EMMS:::"memory");
290 18207 mm_end = end - 3;
291
2/2
✓ Branch 0 taken 27744 times.
✓ Branch 1 taken 18207 times.
45951 while (s < mm_end) {
292 27744 register uint32_t x= *((const uint32_t*)s);
293 27744 *((uint32_t *)d) = ((x>>1)&0x7FE07FE0) | (x&0x001F001F);
294 27744 s+=4;
295 27744 d+=4;
296 }
297
2/2
✓ Branch 0 taken 9248 times.
✓ Branch 1 taken 8959 times.
18207 if (s < end) {
298 9248 register uint16_t x= *((const uint16_t*)s);
299 9248 *((uint16_t *)d) = ((x>>1)&0x7FE0) | (x&0x001F);
300 }
301 18207 }
302
303 18207 static inline void rgb32to16_mmxext(const uint8_t *src, uint8_t *dst, int src_size)
304 {
305 18207 const uint8_t *s = src;
306 const uint8_t *end;
307 const uint8_t *mm_end;
308 18207 uint16_t *d = (uint16_t *)dst;
309 18207 end = s + src_size;
310 18207 mm_end = end - 15;
311 18207 __asm__ volatile(
312 "movq %3, %%mm5 \n\t"
313 "movq %4, %%mm6 \n\t"
314 "movq %5, %%mm7 \n\t"
315 "jmp 2f \n\t"
316 ".p2align 4 \n\t"
317 "1: \n\t"
318 PREFETCH" 32(%1) \n\t"
319 "movd (%1), %%mm0 \n\t"
320 "movd 4(%1), %%mm3 \n\t"
321 "punpckldq 8(%1), %%mm0 \n\t"
322 "punpckldq 12(%1), %%mm3 \n\t"
323 "movq %%mm0, %%mm1 \n\t"
324 "movq %%mm3, %%mm4 \n\t"
325 "pand %%mm6, %%mm0 \n\t"
326 "pand %%mm6, %%mm3 \n\t"
327 "pmaddwd %%mm7, %%mm0 \n\t"
328 "pmaddwd %%mm7, %%mm3 \n\t"
329 "pand %%mm5, %%mm1 \n\t"
330 "pand %%mm5, %%mm4 \n\t"
331 "por %%mm1, %%mm0 \n\t"
332 "por %%mm4, %%mm3 \n\t"
333 "psrld $5, %%mm0 \n\t"
334 "pslld $11, %%mm3 \n\t"
335 "por %%mm3, %%mm0 \n\t"
336 MOVNTQ" %%mm0, (%0) \n\t"
337 "add $16, %1 \n\t"
338 "add $8, %0 \n\t"
339 "2: \n\t"
340 "cmp %2, %1 \n\t"
341 " jb 1b \n\t"
342 : "+r" (d), "+r"(s)
343 : "r" (mm_end), "m" (mask3216g), "m" (mask3216br), "m" (mul3216)
344 );
345 18207 __asm__ volatile(SFENCE:::"memory");
346 18207 __asm__ volatile(EMMS:::"memory");
347
2/2
✓ Branch 0 taken 27744 times.
✓ Branch 1 taken 18207 times.
45951 while (s < end) {
348 27744 register int rgb = *(const uint32_t*)s; s += 4;
349 27744 *d++ = ((rgb&0xFF)>>3) + ((rgb&0xFC00)>>5) + ((rgb&0xF80000)>>8);
350 }
351 18207 }
352
353 18207 static inline void rgb32tobgr16_mmxext(const uint8_t *src, uint8_t *dst, int src_size)
354 {
355 18207 const uint8_t *s = src;
356 const uint8_t *end;
357 const uint8_t *mm_end;
358 18207 uint16_t *d = (uint16_t *)dst;
359 18207 end = s + src_size;
360 18207 __asm__ volatile(PREFETCH" %0"::"m"(*src):"memory");
361 18207 __asm__ volatile(
362 "movq %0, %%mm7 \n\t"
363 "movq %1, %%mm6 \n\t"
364 ::"m"(red_16mask),"m"(green_16mask));
365 18207 mm_end = end - 15;
366
2/2
✓ Branch 0 taken 138720 times.
✓ Branch 1 taken 18207 times.
156927 while (s < mm_end) {
367 138720 __asm__ volatile(
368 PREFETCH" 32(%1) \n\t"
369 "movd (%1), %%mm0 \n\t"
370 "movd 4(%1), %%mm3 \n\t"
371 "punpckldq 8(%1), %%mm0 \n\t"
372 "punpckldq 12(%1), %%mm3 \n\t"
373 "movq %%mm0, %%mm1 \n\t"
374 "movq %%mm0, %%mm2 \n\t"
375 "movq %%mm3, %%mm4 \n\t"
376 "movq %%mm3, %%mm5 \n\t"
377 "psllq $8, %%mm0 \n\t"
378 "psllq $8, %%mm3 \n\t"
379 "pand %%mm7, %%mm0 \n\t"
380 "pand %%mm7, %%mm3 \n\t"
381 "psrlq $5, %%mm1 \n\t"
382 "psrlq $5, %%mm4 \n\t"
383 "pand %%mm6, %%mm1 \n\t"
384 "pand %%mm6, %%mm4 \n\t"
385 "psrlq $19, %%mm2 \n\t"
386 "psrlq $19, %%mm5 \n\t"
387 "pand %2, %%mm2 \n\t"
388 "pand %2, %%mm5 \n\t"
389 "por %%mm1, %%mm0 \n\t"
390 "por %%mm4, %%mm3 \n\t"
391 "por %%mm2, %%mm0 \n\t"
392 "por %%mm5, %%mm3 \n\t"
393 "psllq $16, %%mm3 \n\t"
394 "por %%mm3, %%mm0 \n\t"
395 MOVNTQ" %%mm0, (%0) \n\t"
396 :: "r"(d),"r"(s),"m"(blue_16mask):"memory");
397 138720 d += 4;
398 138720 s += 16;
399 }
400 18207 __asm__ volatile(SFENCE:::"memory");
401 18207 __asm__ volatile(EMMS:::"memory");
402
2/2
✓ Branch 0 taken 27744 times.
✓ Branch 1 taken 18207 times.
45951 while (s < end) {
403 27744 register int rgb = *(const uint32_t*)s; s += 4;
404 27744 *d++ = ((rgb&0xF8)<<8) + ((rgb&0xFC00)>>5) + ((rgb&0xF80000)>>19);
405 }
406 18207 }
407
408 18207 static inline void rgb32to15_mmxext(const uint8_t *src, uint8_t *dst, int src_size)
409 {
410 18207 const uint8_t *s = src;
411 const uint8_t *end;
412 const uint8_t *mm_end;
413 18207 uint16_t *d = (uint16_t *)dst;
414 18207 end = s + src_size;
415 18207 mm_end = end - 15;
416 18207 __asm__ volatile(
417 "movq %3, %%mm5 \n\t"
418 "movq %4, %%mm6 \n\t"
419 "movq %5, %%mm7 \n\t"
420 "jmp 2f \n\t"
421 ".p2align 4 \n\t"
422 "1: \n\t"
423 PREFETCH" 32(%1) \n\t"
424 "movd (%1), %%mm0 \n\t"
425 "movd 4(%1), %%mm3 \n\t"
426 "punpckldq 8(%1), %%mm0 \n\t"
427 "punpckldq 12(%1), %%mm3 \n\t"
428 "movq %%mm0, %%mm1 \n\t"
429 "movq %%mm3, %%mm4 \n\t"
430 "pand %%mm6, %%mm0 \n\t"
431 "pand %%mm6, %%mm3 \n\t"
432 "pmaddwd %%mm7, %%mm0 \n\t"
433 "pmaddwd %%mm7, %%mm3 \n\t"
434 "pand %%mm5, %%mm1 \n\t"
435 "pand %%mm5, %%mm4 \n\t"
436 "por %%mm1, %%mm0 \n\t"
437 "por %%mm4, %%mm3 \n\t"
438 "psrld $6, %%mm0 \n\t"
439 "pslld $10, %%mm3 \n\t"
440 "por %%mm3, %%mm0 \n\t"
441 MOVNTQ" %%mm0, (%0) \n\t"
442 "add $16, %1 \n\t"
443 "add $8, %0 \n\t"
444 "2: \n\t"
445 "cmp %2, %1 \n\t"
446 " jb 1b \n\t"
447 : "+r" (d), "+r"(s)
448 : "r" (mm_end), "m" (mask3215g), "m" (mask3216br), "m" (mul3215)
449 );
450 18207 __asm__ volatile(SFENCE:::"memory");
451 18207 __asm__ volatile(EMMS:::"memory");
452
2/2
✓ Branch 0 taken 27744 times.
✓ Branch 1 taken 18207 times.
45951 while (s < end) {
453 27744 register int rgb = *(const uint32_t*)s; s += 4;
454 27744 *d++ = ((rgb&0xFF)>>3) + ((rgb&0xF800)>>6) + ((rgb&0xF80000)>>9);
455 }
456 18207 }
457
458 18207 static inline void rgb32tobgr15_mmxext(const uint8_t *src, uint8_t *dst, int src_size)
459 {
460 18207 const uint8_t *s = src;
461 const uint8_t *end;
462 const uint8_t *mm_end;
463 18207 uint16_t *d = (uint16_t *)dst;
464 18207 end = s + src_size;
465 18207 __asm__ volatile(PREFETCH" %0"::"m"(*src):"memory");
466 18207 __asm__ volatile(
467 "movq %0, %%mm7 \n\t"
468 "movq %1, %%mm6 \n\t"
469 ::"m"(red_15mask),"m"(green_15mask));
470 18207 mm_end = end - 15;
471
2/2
✓ Branch 0 taken 138720 times.
✓ Branch 1 taken 18207 times.
156927 while (s < mm_end) {
472 138720 __asm__ volatile(
473 PREFETCH" 32(%1) \n\t"
474 "movd (%1), %%mm0 \n\t"
475 "movd 4(%1), %%mm3 \n\t"
476 "punpckldq 8(%1), %%mm0 \n\t"
477 "punpckldq 12(%1), %%mm3 \n\t"
478 "movq %%mm0, %%mm1 \n\t"
479 "movq %%mm0, %%mm2 \n\t"
480 "movq %%mm3, %%mm4 \n\t"
481 "movq %%mm3, %%mm5 \n\t"
482 "psllq $7, %%mm0 \n\t"
483 "psllq $7, %%mm3 \n\t"
484 "pand %%mm7, %%mm0 \n\t"
485 "pand %%mm7, %%mm3 \n\t"
486 "psrlq $6, %%mm1 \n\t"
487 "psrlq $6, %%mm4 \n\t"
488 "pand %%mm6, %%mm1 \n\t"
489 "pand %%mm6, %%mm4 \n\t"
490 "psrlq $19, %%mm2 \n\t"
491 "psrlq $19, %%mm5 \n\t"
492 "pand %2, %%mm2 \n\t"
493 "pand %2, %%mm5 \n\t"
494 "por %%mm1, %%mm0 \n\t"
495 "por %%mm4, %%mm3 \n\t"
496 "por %%mm2, %%mm0 \n\t"
497 "por %%mm5, %%mm3 \n\t"
498 "psllq $16, %%mm3 \n\t"
499 "por %%mm3, %%mm0 \n\t"
500 MOVNTQ" %%mm0, (%0) \n\t"
501 ::"r"(d),"r"(s),"m"(blue_15mask):"memory");
502 138720 d += 4;
503 138720 s += 16;
504 }
505 18207 __asm__ volatile(SFENCE:::"memory");
506 18207 __asm__ volatile(EMMS:::"memory");
507
2/2
✓ Branch 0 taken 27744 times.
✓ Branch 1 taken 18207 times.
45951 while (s < end) {
508 27744 register int rgb = *(const uint32_t*)s; s += 4;
509 27744 *d++ = ((rgb&0xF8)<<7) + ((rgb&0xF800)>>6) + ((rgb&0xF80000)>>19);
510 }
511 18207 }
512
513 18207 static inline void rgb24tobgr16_mmxext(const uint8_t *src, uint8_t *dst, int src_size)
514 {
515 18207 const uint8_t *s = src;
516 const uint8_t *end;
517 const uint8_t *mm_end;
518 18207 uint16_t *d = (uint16_t *)dst;
519 18207 end = s + src_size;
520 18207 __asm__ volatile(PREFETCH" %0"::"m"(*src):"memory");
521 18207 __asm__ volatile(
522 "movq %0, %%mm7 \n\t"
523 "movq %1, %%mm6 \n\t"
524 ::"m"(red_16mask),"m"(green_16mask));
525 18207 mm_end = end - 11;
526
2/2
✓ Branch 0 taken 138720 times.
✓ Branch 1 taken 18207 times.
156927 while (s < mm_end) {
527 138720 __asm__ volatile(
528 PREFETCH" 32(%1) \n\t"
529 "movd (%1), %%mm0 \n\t"
530 "movd 3(%1), %%mm3 \n\t"
531 "punpckldq 6(%1), %%mm0 \n\t"
532 "punpckldq 9(%1), %%mm3 \n\t"
533 "movq %%mm0, %%mm1 \n\t"
534 "movq %%mm0, %%mm2 \n\t"
535 "movq %%mm3, %%mm4 \n\t"
536 "movq %%mm3, %%mm5 \n\t"
537 "psrlq $3, %%mm0 \n\t"
538 "psrlq $3, %%mm3 \n\t"
539 "pand %2, %%mm0 \n\t"
540 "pand %2, %%mm3 \n\t"
541 "psrlq $5, %%mm1 \n\t"
542 "psrlq $5, %%mm4 \n\t"
543 "pand %%mm6, %%mm1 \n\t"
544 "pand %%mm6, %%mm4 \n\t"
545 "psrlq $8, %%mm2 \n\t"
546 "psrlq $8, %%mm5 \n\t"
547 "pand %%mm7, %%mm2 \n\t"
548 "pand %%mm7, %%mm5 \n\t"
549 "por %%mm1, %%mm0 \n\t"
550 "por %%mm4, %%mm3 \n\t"
551 "por %%mm2, %%mm0 \n\t"
552 "por %%mm5, %%mm3 \n\t"
553 "psllq $16, %%mm3 \n\t"
554 "por %%mm3, %%mm0 \n\t"
555 MOVNTQ" %%mm0, (%0) \n\t"
556 ::"r"(d),"r"(s),"m"(blue_16mask):"memory");
557 138720 d += 4;
558 138720 s += 12;
559 }
560 18207 __asm__ volatile(SFENCE:::"memory");
561 18207 __asm__ volatile(EMMS:::"memory");
562
2/2
✓ Branch 0 taken 27744 times.
✓ Branch 1 taken 18207 times.
45951 while (s < end) {
563 27744 const int b = *s++;
564 27744 const int g = *s++;
565 27744 const int r = *s++;
566 27744 *d++ = (b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8);
567 }
568 18207 }
569
570 18207 static inline void rgb24to16_mmxext(const uint8_t *src, uint8_t *dst, int src_size)
571 {
572 18207 const uint8_t *s = src;
573 const uint8_t *end;
574 const uint8_t *mm_end;
575 18207 uint16_t *d = (uint16_t *)dst;
576 18207 end = s + src_size;
577 18207 __asm__ volatile(PREFETCH" %0"::"m"(*src):"memory");
578 18207 __asm__ volatile(
579 "movq %0, %%mm7 \n\t"
580 "movq %1, %%mm6 \n\t"
581 ::"m"(red_16mask),"m"(green_16mask));
582 18207 mm_end = end - 15;
583
2/2
✓ Branch 0 taken 130050 times.
✓ Branch 1 taken 18207 times.
148257 while (s < mm_end) {
584 130050 __asm__ volatile(
585 PREFETCH" 32(%1) \n\t"
586 "movd (%1), %%mm0 \n\t"
587 "movd 3(%1), %%mm3 \n\t"
588 "punpckldq 6(%1), %%mm0 \n\t"
589 "punpckldq 9(%1), %%mm3 \n\t"
590 "movq %%mm0, %%mm1 \n\t"
591 "movq %%mm0, %%mm2 \n\t"
592 "movq %%mm3, %%mm4 \n\t"
593 "movq %%mm3, %%mm5 \n\t"
594 "psllq $8, %%mm0 \n\t"
595 "psllq $8, %%mm3 \n\t"
596 "pand %%mm7, %%mm0 \n\t"
597 "pand %%mm7, %%mm3 \n\t"
598 "psrlq $5, %%mm1 \n\t"
599 "psrlq $5, %%mm4 \n\t"
600 "pand %%mm6, %%mm1 \n\t"
601 "pand %%mm6, %%mm4 \n\t"
602 "psrlq $19, %%mm2 \n\t"
603 "psrlq $19, %%mm5 \n\t"
604 "pand %2, %%mm2 \n\t"
605 "pand %2, %%mm5 \n\t"
606 "por %%mm1, %%mm0 \n\t"
607 "por %%mm4, %%mm3 \n\t"
608 "por %%mm2, %%mm0 \n\t"
609 "por %%mm5, %%mm3 \n\t"
610 "psllq $16, %%mm3 \n\t"
611 "por %%mm3, %%mm0 \n\t"
612 MOVNTQ" %%mm0, (%0) \n\t"
613 ::"r"(d),"r"(s),"m"(blue_16mask):"memory");
614 130050 d += 4;
615 130050 s += 12;
616 }
617 18207 __asm__ volatile(SFENCE:::"memory");
618 18207 __asm__ volatile(EMMS:::"memory");
619
2/2
✓ Branch 0 taken 62424 times.
✓ Branch 1 taken 18207 times.
80631 while (s < end) {
620 62424 const int r = *s++;
621 62424 const int g = *s++;
622 62424 const int b = *s++;
623 62424 *d++ = (b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8);
624 }
625 18207 }
626
627 18207 static inline void rgb24tobgr15_mmxext(const uint8_t *src, uint8_t *dst, int src_size)
628 {
629 18207 const uint8_t *s = src;
630 const uint8_t *end;
631 const uint8_t *mm_end;
632 18207 uint16_t *d = (uint16_t *)dst;
633 18207 end = s + src_size;
634 18207 __asm__ volatile(PREFETCH" %0"::"m"(*src):"memory");
635 18207 __asm__ volatile(
636 "movq %0, %%mm7 \n\t"
637 "movq %1, %%mm6 \n\t"
638 ::"m"(red_15mask),"m"(green_15mask));
639 18207 mm_end = end - 11;
640
2/2
✓ Branch 0 taken 138720 times.
✓ Branch 1 taken 18207 times.
156927 while (s < mm_end) {
641 138720 __asm__ volatile(
642 PREFETCH" 32(%1) \n\t"
643 "movd (%1), %%mm0 \n\t"
644 "movd 3(%1), %%mm3 \n\t"
645 "punpckldq 6(%1), %%mm0 \n\t"
646 "punpckldq 9(%1), %%mm3 \n\t"
647 "movq %%mm0, %%mm1 \n\t"
648 "movq %%mm0, %%mm2 \n\t"
649 "movq %%mm3, %%mm4 \n\t"
650 "movq %%mm3, %%mm5 \n\t"
651 "psrlq $3, %%mm0 \n\t"
652 "psrlq $3, %%mm3 \n\t"
653 "pand %2, %%mm0 \n\t"
654 "pand %2, %%mm3 \n\t"
655 "psrlq $6, %%mm1 \n\t"
656 "psrlq $6, %%mm4 \n\t"
657 "pand %%mm6, %%mm1 \n\t"
658 "pand %%mm6, %%mm4 \n\t"
659 "psrlq $9, %%mm2 \n\t"
660 "psrlq $9, %%mm5 \n\t"
661 "pand %%mm7, %%mm2 \n\t"
662 "pand %%mm7, %%mm5 \n\t"
663 "por %%mm1, %%mm0 \n\t"
664 "por %%mm4, %%mm3 \n\t"
665 "por %%mm2, %%mm0 \n\t"
666 "por %%mm5, %%mm3 \n\t"
667 "psllq $16, %%mm3 \n\t"
668 "por %%mm3, %%mm0 \n\t"
669 MOVNTQ" %%mm0, (%0) \n\t"
670 ::"r"(d),"r"(s),"m"(blue_15mask):"memory");
671 138720 d += 4;
672 138720 s += 12;
673 }
674 18207 __asm__ volatile(SFENCE:::"memory");
675 18207 __asm__ volatile(EMMS:::"memory");
676
2/2
✓ Branch 0 taken 27744 times.
✓ Branch 1 taken 18207 times.
45951 while (s < end) {
677 27744 const int b = *s++;
678 27744 const int g = *s++;
679 27744 const int r = *s++;
680 27744 *d++ = (b>>3) | ((g&0xF8)<<2) | ((r&0xF8)<<7);
681 }
682 18207 }
683
684 18207 static inline void rgb24to15_mmxext(const uint8_t *src, uint8_t *dst, int src_size)
685 {
686 18207 const uint8_t *s = src;
687 const uint8_t *end;
688 const uint8_t *mm_end;
689 18207 uint16_t *d = (uint16_t *)dst;
690 18207 end = s + src_size;
691 18207 __asm__ volatile(PREFETCH" %0"::"m"(*src):"memory");
692 18207 __asm__ volatile(
693 "movq %0, %%mm7 \n\t"
694 "movq %1, %%mm6 \n\t"
695 ::"m"(red_15mask),"m"(green_15mask));
696 18207 mm_end = end - 15;
697
2/2
✓ Branch 0 taken 130050 times.
✓ Branch 1 taken 18207 times.
148257 while (s < mm_end) {
698 130050 __asm__ volatile(
699 PREFETCH" 32(%1) \n\t"
700 "movd (%1), %%mm0 \n\t"
701 "movd 3(%1), %%mm3 \n\t"
702 "punpckldq 6(%1), %%mm0 \n\t"
703 "punpckldq 9(%1), %%mm3 \n\t"
704 "movq %%mm0, %%mm1 \n\t"
705 "movq %%mm0, %%mm2 \n\t"
706 "movq %%mm3, %%mm4 \n\t"
707 "movq %%mm3, %%mm5 \n\t"
708 "psllq $7, %%mm0 \n\t"
709 "psllq $7, %%mm3 \n\t"
710 "pand %%mm7, %%mm0 \n\t"
711 "pand %%mm7, %%mm3 \n\t"
712 "psrlq $6, %%mm1 \n\t"
713 "psrlq $6, %%mm4 \n\t"
714 "pand %%mm6, %%mm1 \n\t"
715 "pand %%mm6, %%mm4 \n\t"
716 "psrlq $19, %%mm2 \n\t"
717 "psrlq $19, %%mm5 \n\t"
718 "pand %2, %%mm2 \n\t"
719 "pand %2, %%mm5 \n\t"
720 "por %%mm1, %%mm0 \n\t"
721 "por %%mm4, %%mm3 \n\t"
722 "por %%mm2, %%mm0 \n\t"
723 "por %%mm5, %%mm3 \n\t"
724 "psllq $16, %%mm3 \n\t"
725 "por %%mm3, %%mm0 \n\t"
726 MOVNTQ" %%mm0, (%0) \n\t"
727 ::"r"(d),"r"(s),"m"(blue_15mask):"memory");
728 130050 d += 4;
729 130050 s += 12;
730 }
731 18207 __asm__ volatile(SFENCE:::"memory");
732 18207 __asm__ volatile(EMMS:::"memory");
733
2/2
✓ Branch 0 taken 62424 times.
✓ Branch 1 taken 18207 times.
80631 while (s < end) {
734 62424 const int r = *s++;
735 62424 const int g = *s++;
736 62424 const int b = *s++;
737 62424 *d++ = (b>>3) | ((g&0xF8)<<2) | ((r&0xF8)<<7);
738 }
739 18207 }
740
741 18207 static inline void rgb15tobgr24_mmxext(const uint8_t *src, uint8_t *dst, int src_size)
742 {
743 const uint16_t *end;
744 const uint16_t *mm_end;
745 18207 uint8_t *d = dst;
746 18207 const uint16_t *s = (const uint16_t*)src;
747 18207 end = s + src_size/2;
748 18207 __asm__ volatile(PREFETCH" %0"::"m"(*s):"memory");
749 18207 mm_end = end - 7;
750
2/2
✓ Branch 0 taken 64736 times.
✓ Branch 1 taken 18207 times.
82943 while (s < mm_end) {
751 64736 __asm__ volatile(
752 PREFETCH" 32(%1) \n\t"
753 "movq (%1), %%mm0 \n\t"
754 "movq (%1), %%mm1 \n\t"
755 "movq (%1), %%mm2 \n\t"
756 "pand %2, %%mm0 \n\t"
757 "pand %3, %%mm1 \n\t"
758 "pand %4, %%mm2 \n\t"
759 "psllq $5, %%mm0 \n\t"
760 "pmulhw "MANGLE(mul15_mid)", %%mm0 \n\t"
761 "pmulhw "MANGLE(mul15_mid)", %%mm1 \n\t"
762 "pmulhw "MANGLE(mul15_hi)", %%mm2 \n\t"
763 "movq %%mm0, %%mm3 \n\t"
764 "movq %%mm1, %%mm4 \n\t"
765 "movq %%mm2, %%mm5 \n\t"
766 "punpcklwd %5, %%mm0 \n\t"
767 "punpcklwd %5, %%mm1 \n\t"
768 "punpcklwd %5, %%mm2 \n\t"
769 "punpckhwd %5, %%mm3 \n\t"
770 "punpckhwd %5, %%mm4 \n\t"
771 "punpckhwd %5, %%mm5 \n\t"
772 "psllq $8, %%mm1 \n\t"
773 "psllq $16, %%mm2 \n\t"
774 "por %%mm1, %%mm0 \n\t"
775 "por %%mm2, %%mm0 \n\t"
776 "psllq $8, %%mm4 \n\t"
777 "psllq $16, %%mm5 \n\t"
778 "por %%mm4, %%mm3 \n\t"
779 "por %%mm5, %%mm3 \n\t"
780
781 "movq %%mm0, %%mm6 \n\t"
782 "movq %%mm3, %%mm7 \n\t"
783
784 "movq 8(%1), %%mm0 \n\t"
785 "movq 8(%1), %%mm1 \n\t"
786 "movq 8(%1), %%mm2 \n\t"
787 "pand %2, %%mm0 \n\t"
788 "pand %3, %%mm1 \n\t"
789 "pand %4, %%mm2 \n\t"
790 "psllq $5, %%mm0 \n\t"
791 "pmulhw "MANGLE(mul15_mid)", %%mm0 \n\t"
792 "pmulhw "MANGLE(mul15_mid)", %%mm1 \n\t"
793 "pmulhw "MANGLE(mul15_hi)", %%mm2 \n\t"
794 "movq %%mm0, %%mm3 \n\t"
795 "movq %%mm1, %%mm4 \n\t"
796 "movq %%mm2, %%mm5 \n\t"
797 "punpcklwd %5, %%mm0 \n\t"
798 "punpcklwd %5, %%mm1 \n\t"
799 "punpcklwd %5, %%mm2 \n\t"
800 "punpckhwd %5, %%mm3 \n\t"
801 "punpckhwd %5, %%mm4 \n\t"
802 "punpckhwd %5, %%mm5 \n\t"
803 "psllq $8, %%mm1 \n\t"
804 "psllq $16, %%mm2 \n\t"
805 "por %%mm1, %%mm0 \n\t"
806 "por %%mm2, %%mm0 \n\t"
807 "psllq $8, %%mm4 \n\t"
808 "psllq $16, %%mm5 \n\t"
809 "por %%mm4, %%mm3 \n\t"
810 "por %%mm5, %%mm3 \n\t"
811
812 :"=m"(*d)
813 :"r"(s),"m"(mask15b),"m"(mask15g),"m"(mask15r), "m"(mmx_null)
814 NAMED_CONSTRAINTS_ADD(mul15_mid,mul15_hi)
815 :"memory");
816 /* borrowed 32 to 24 */
817 64736 __asm__ volatile(
818 "movq %%mm0, %%mm4 \n\t"
819 "movq %%mm3, %%mm5 \n\t"
820 "movq %%mm6, %%mm0 \n\t"
821 "movq %%mm7, %%mm1 \n\t"
822
823 "movq %%mm4, %%mm6 \n\t"
824 "movq %%mm5, %%mm7 \n\t"
825 "movq %%mm0, %%mm2 \n\t"
826 "movq %%mm1, %%mm3 \n\t"
827
828 STORE_BGR24_MMX
829
830 :: "r"(d), "m"(*s)
831 NAMED_CONSTRAINTS_ADD(mask24l,mask24h)
832 :"memory");
833 64736 d += 24;
834 64736 s += 8;
835 }
836 18207 __asm__ volatile(SFENCE:::"memory");
837 18207 __asm__ volatile(EMMS:::"memory");
838
2/2
✓ Branch 0 taken 64736 times.
✓ Branch 1 taken 18207 times.
82943 while (s < end) {
839 register uint16_t bgr;
840 64736 bgr = *s++;
841 64736 *d++ = ((bgr&0x1F)<<3) | ((bgr&0x1F)>>2);
842 64736 *d++ = ((bgr&0x3E0)>>2) | ((bgr&0x3E0)>>7);
843 64736 *d++ = ((bgr&0x7C00)>>7) | ((bgr&0x7C00)>>12);
844 }
845 18207 }
846
847 18207 static inline void rgb16tobgr24_mmxext(const uint8_t *src, uint8_t *dst, int src_size)
848 {
849 const uint16_t *end;
850 const uint16_t *mm_end;
851 18207 uint8_t *d = (uint8_t *)dst;
852 18207 const uint16_t *s = (const uint16_t *)src;
853 18207 end = s + src_size/2;
854 18207 __asm__ volatile(PREFETCH" %0"::"m"(*s):"memory");
855 18207 mm_end = end - 7;
856
2/2
✓ Branch 0 taken 64736 times.
✓ Branch 1 taken 18207 times.
82943 while (s < mm_end) {
857 64736 __asm__ volatile(
858 PREFETCH" 32(%1) \n\t"
859 "movq (%1), %%mm0 \n\t"
860 "movq (%1), %%mm1 \n\t"
861 "movq (%1), %%mm2 \n\t"
862 "pand %2, %%mm0 \n\t"
863 "pand %3, %%mm1 \n\t"
864 "pand %4, %%mm2 \n\t"
865 "psllq $5, %%mm0 \n\t"
866 "psrlq $1, %%mm2 \n\t"
867 "pmulhw "MANGLE(mul15_mid)", %%mm0 \n\t"
868 "pmulhw "MANGLE(mul16_mid)", %%mm1 \n\t"
869 "pmulhw "MANGLE(mul15_hi)", %%mm2 \n\t"
870 "movq %%mm0, %%mm3 \n\t"
871 "movq %%mm1, %%mm4 \n\t"
872 "movq %%mm2, %%mm5 \n\t"
873 "punpcklwd %5, %%mm0 \n\t"
874 "punpcklwd %5, %%mm1 \n\t"
875 "punpcklwd %5, %%mm2 \n\t"
876 "punpckhwd %5, %%mm3 \n\t"
877 "punpckhwd %5, %%mm4 \n\t"
878 "punpckhwd %5, %%mm5 \n\t"
879 "psllq $8, %%mm1 \n\t"
880 "psllq $16, %%mm2 \n\t"
881 "por %%mm1, %%mm0 \n\t"
882 "por %%mm2, %%mm0 \n\t"
883 "psllq $8, %%mm4 \n\t"
884 "psllq $16, %%mm5 \n\t"
885 "por %%mm4, %%mm3 \n\t"
886 "por %%mm5, %%mm3 \n\t"
887
888 "movq %%mm0, %%mm6 \n\t"
889 "movq %%mm3, %%mm7 \n\t"
890
891 "movq 8(%1), %%mm0 \n\t"
892 "movq 8(%1), %%mm1 \n\t"
893 "movq 8(%1), %%mm2 \n\t"
894 "pand %2, %%mm0 \n\t"
895 "pand %3, %%mm1 \n\t"
896 "pand %4, %%mm2 \n\t"
897 "psllq $5, %%mm0 \n\t"
898 "psrlq $1, %%mm2 \n\t"
899 "pmulhw "MANGLE(mul15_mid)", %%mm0 \n\t"
900 "pmulhw "MANGLE(mul16_mid)", %%mm1 \n\t"
901 "pmulhw "MANGLE(mul15_hi)", %%mm2 \n\t"
902 "movq %%mm0, %%mm3 \n\t"
903 "movq %%mm1, %%mm4 \n\t"
904 "movq %%mm2, %%mm5 \n\t"
905 "punpcklwd %5, %%mm0 \n\t"
906 "punpcklwd %5, %%mm1 \n\t"
907 "punpcklwd %5, %%mm2 \n\t"
908 "punpckhwd %5, %%mm3 \n\t"
909 "punpckhwd %5, %%mm4 \n\t"
910 "punpckhwd %5, %%mm5 \n\t"
911 "psllq $8, %%mm1 \n\t"
912 "psllq $16, %%mm2 \n\t"
913 "por %%mm1, %%mm0 \n\t"
914 "por %%mm2, %%mm0 \n\t"
915 "psllq $8, %%mm4 \n\t"
916 "psllq $16, %%mm5 \n\t"
917 "por %%mm4, %%mm3 \n\t"
918 "por %%mm5, %%mm3 \n\t"
919 :"=m"(*d)
920 :"r"(s),"m"(mask16b),"m"(mask16g),"m"(mask16r),"m"(mmx_null)
921 NAMED_CONSTRAINTS_ADD(mul15_mid,mul16_mid,mul15_hi)
922 :"memory");
923 /* borrowed 32 to 24 */
924 64736 __asm__ volatile(
925 "movq %%mm0, %%mm4 \n\t"
926 "movq %%mm3, %%mm5 \n\t"
927 "movq %%mm6, %%mm0 \n\t"
928 "movq %%mm7, %%mm1 \n\t"
929
930 "movq %%mm4, %%mm6 \n\t"
931 "movq %%mm5, %%mm7 \n\t"
932 "movq %%mm0, %%mm2 \n\t"
933 "movq %%mm1, %%mm3 \n\t"
934
935 STORE_BGR24_MMX
936
937 :: "r"(d), "m"(*s)
938 NAMED_CONSTRAINTS_ADD(mask24l,mask24h)
939 :"memory");
940 64736 d += 24;
941 64736 s += 8;
942 }
943 18207 __asm__ volatile(SFENCE:::"memory");
944 18207 __asm__ volatile(EMMS:::"memory");
945
2/2
✓ Branch 0 taken 64736 times.
✓ Branch 1 taken 18207 times.
82943 while (s < end) {
946 register uint16_t bgr;
947 64736 bgr = *s++;
948 64736 *d++ = ((bgr&0x1F)<<3) | ((bgr&0x1F)>>2);
949 64736 *d++ = ((bgr&0x7E0)>>3) | ((bgr&0x7E0)>>9);
950 64736 *d++ = ((bgr&0xF800)>>8) | ((bgr&0xF800)>>13);
951 }
952 18207 }
953
954 /*
955 * mm0 = 00 B3 00 B2 00 B1 00 B0
956 * mm1 = 00 G3 00 G2 00 G1 00 G0
957 * mm2 = 00 R3 00 R2 00 R1 00 R0
958 * mm6 = FF FF FF FF FF FF FF FF
959 * mm7 = 00 00 00 00 00 00 00 00
960 */
961 #define PACK_RGB32 \
962 "packuswb %%mm7, %%mm0 \n\t" /* 00 00 00 00 B3 B2 B1 B0 */ \
963 "packuswb %%mm7, %%mm1 \n\t" /* 00 00 00 00 G3 G2 G1 G0 */ \
964 "packuswb %%mm7, %%mm2 \n\t" /* 00 00 00 00 R3 R2 R1 R0 */ \
965 "punpcklbw %%mm1, %%mm0 \n\t" /* G3 B3 G2 B2 G1 B1 G0 B0 */ \
966 "punpcklbw %%mm6, %%mm2 \n\t" /* FF R3 FF R2 FF R1 FF R0 */ \
967 "movq %%mm0, %%mm3 \n\t" \
968 "punpcklwd %%mm2, %%mm0 \n\t" /* FF R1 G1 B1 FF R0 G0 B0 */ \
969 "punpckhwd %%mm2, %%mm3 \n\t" /* FF R3 G3 B3 FF R2 G2 B2 */ \
970 MOVNTQ" %%mm0, (%0) \n\t" \
971 MOVNTQ" %%mm3, 8(%0) \n\t" \
972
973 18207 static inline void rgb15to32_mmxext(const uint8_t *src, uint8_t *dst, int src_size)
974 {
975 const uint16_t *end;
976 const uint16_t *mm_end;
977 18207 uint8_t *d = dst;
978 18207 const uint16_t *s = (const uint16_t *)src;
979 18207 end = s + src_size/2;
980 18207 __asm__ volatile(PREFETCH" %0"::"m"(*s):"memory");
981 18207 __asm__ volatile("pxor %%mm7,%%mm7 \n\t":::"memory");
982 18207 __asm__ volatile("pcmpeqd %%mm6,%%mm6 \n\t":::"memory");
983 18207 mm_end = end - 3;
984
2/2
✓ Branch 0 taken 138720 times.
✓ Branch 1 taken 18207 times.
156927 while (s < mm_end) {
985 138720 __asm__ volatile(
986 PREFETCH" 32(%1) \n\t"
987 "movq (%1), %%mm0 \n\t"
988 "movq (%1), %%mm1 \n\t"
989 "movq (%1), %%mm2 \n\t"
990 "pand %2, %%mm0 \n\t"
991 "pand %3, %%mm1 \n\t"
992 "pand %4, %%mm2 \n\t"
993 "psllq $5, %%mm0 \n\t"
994 "pmulhw %5, %%mm0 \n\t"
995 "pmulhw %5, %%mm1 \n\t"
996 "pmulhw "MANGLE(mul15_hi)", %%mm2 \n\t"
997 PACK_RGB32
998 ::"r"(d),"r"(s),"m"(mask15b),"m"(mask15g),"m"(mask15r) ,"m"(mul15_mid)
999 NAMED_CONSTRAINTS_ADD(mul15_hi)
1000 :"memory");
1001 138720 d += 16;
1002 138720 s += 4;
1003 }
1004 18207 __asm__ volatile(SFENCE:::"memory");
1005 18207 __asm__ volatile(EMMS:::"memory");
1006
2/2
✓ Branch 0 taken 27744 times.
✓ Branch 1 taken 18207 times.
45951 while (s < end) {
1007 register uint16_t bgr;
1008 27744 bgr = *s++;
1009 27744 *d++ = ((bgr&0x1F)<<3) | ((bgr&0x1F)>>2);
1010 27744 *d++ = ((bgr&0x3E0)>>2) | ((bgr&0x3E0)>>7);
1011 27744 *d++ = ((bgr&0x7C00)>>7) | ((bgr&0x7C00)>>12);
1012 27744 *d++ = 255;
1013 }
1014 18207 }
1015
1016 18207 static inline void rgb16to32_mmxext(const uint8_t *src, uint8_t *dst, int src_size)
1017 {
1018 const uint16_t *end;
1019 const uint16_t *mm_end;
1020 18207 uint8_t *d = dst;
1021 18207 const uint16_t *s = (const uint16_t*)src;
1022 18207 end = s + src_size/2;
1023 18207 __asm__ volatile(PREFETCH" %0"::"m"(*s):"memory");
1024 18207 __asm__ volatile("pxor %%mm7,%%mm7 \n\t":::"memory");
1025 18207 __asm__ volatile("pcmpeqd %%mm6,%%mm6 \n\t":::"memory");
1026 18207 mm_end = end - 3;
1027
2/2
✓ Branch 0 taken 138720 times.
✓ Branch 1 taken 18207 times.
156927 while (s < mm_end) {
1028 138720 __asm__ volatile(
1029 PREFETCH" 32(%1) \n\t"
1030 "movq (%1), %%mm0 \n\t"
1031 "movq (%1), %%mm1 \n\t"
1032 "movq (%1), %%mm2 \n\t"
1033 "pand %2, %%mm0 \n\t"
1034 "pand %3, %%mm1 \n\t"
1035 "pand %4, %%mm2 \n\t"
1036 "psllq $5, %%mm0 \n\t"
1037 "psrlq $1, %%mm2 \n\t"
1038 "pmulhw %5, %%mm0 \n\t"
1039 "pmulhw "MANGLE(mul16_mid)", %%mm1 \n\t"
1040 "pmulhw "MANGLE(mul15_hi)", %%mm2 \n\t"
1041 PACK_RGB32
1042 ::"r"(d),"r"(s),"m"(mask16b),"m"(mask16g),"m"(mask16r),"m"(mul15_mid)
1043 NAMED_CONSTRAINTS_ADD(mul16_mid,mul15_hi)
1044 :"memory");
1045 138720 d += 16;
1046 138720 s += 4;
1047 }
1048 18207 __asm__ volatile(SFENCE:::"memory");
1049 18207 __asm__ volatile(EMMS:::"memory");
1050
2/2
✓ Branch 0 taken 27744 times.
✓ Branch 1 taken 18207 times.
45951 while (s < end) {
1051 register uint16_t bgr;
1052 27744 bgr = *s++;
1053 27744 *d++ = ((bgr&0x1F)<<3) | ((bgr&0x1F)>>2);
1054 27744 *d++ = ((bgr&0x7E0)>>3) | ((bgr&0x7E0)>>9);
1055 27744 *d++ = ((bgr&0xF800)>>8) | ((bgr&0xF800)>>13);
1056 27744 *d++ = 255;
1057 }
1058 18207 }
1059
1060 18215 static inline void rgb24tobgr24_mmxext(const uint8_t *src, uint8_t *dst, int src_size)
1061 {
1062 18215 x86_reg mmx_size= 23 - src_size;
1063 18215 __asm__ volatile (
1064 "test %%"FF_REG_a", %%"FF_REG_a" \n\t"
1065 "jns 2f \n\t"
1066 "movq "MANGLE(mask24r)", %%mm5 \n\t"
1067 "movq "MANGLE(mask24g)", %%mm6 \n\t"
1068 "movq "MANGLE(mask24b)", %%mm7 \n\t"
1069 ".p2align 4 \n\t"
1070 "1: \n\t"
1071 PREFETCH" 32(%1, %%"FF_REG_a") \n\t"
1072 "movq (%1, %%"FF_REG_a"), %%mm0 \n\t" // BGR BGR BG
1073 "movq (%1, %%"FF_REG_a"), %%mm1 \n\t" // BGR BGR BG
1074 "movq 2(%1, %%"FF_REG_a"), %%mm2 \n\t" // R BGR BGR B
1075 "psllq $16, %%mm0 \n\t" // 00 BGR BGR
1076 "pand %%mm5, %%mm0 \n\t"
1077 "pand %%mm6, %%mm1 \n\t"
1078 "pand %%mm7, %%mm2 \n\t"
1079 "por %%mm0, %%mm1 \n\t"
1080 "por %%mm2, %%mm1 \n\t"
1081 "movq 6(%1, %%"FF_REG_a"), %%mm0 \n\t" // BGR BGR BG
1082 MOVNTQ" %%mm1,(%2, %%"FF_REG_a") \n\t" // RGB RGB RG
1083 "movq 8(%1, %%"FF_REG_a"), %%mm1 \n\t" // R BGR BGR B
1084 "movq 10(%1, %%"FF_REG_a"), %%mm2 \n\t" // GR BGR BGR
1085 "pand %%mm7, %%mm0 \n\t"
1086 "pand %%mm5, %%mm1 \n\t"
1087 "pand %%mm6, %%mm2 \n\t"
1088 "por %%mm0, %%mm1 \n\t"
1089 "por %%mm2, %%mm1 \n\t"
1090 "movq 14(%1, %%"FF_REG_a"), %%mm0 \n\t" // R BGR BGR B
1091 MOVNTQ" %%mm1, 8(%2, %%"FF_REG_a")\n\t" // B RGB RGB R
1092 "movq 16(%1, %%"FF_REG_a"), %%mm1 \n\t" // GR BGR BGR
1093 "movq 18(%1, %%"FF_REG_a"), %%mm2 \n\t" // BGR BGR BG
1094 "pand %%mm6, %%mm0 \n\t"
1095 "pand %%mm7, %%mm1 \n\t"
1096 "pand %%mm5, %%mm2 \n\t"
1097 "por %%mm0, %%mm1 \n\t"
1098 "por %%mm2, %%mm1 \n\t"
1099 MOVNTQ" %%mm1, 16(%2, %%"FF_REG_a") \n\t"
1100 "add $24, %%"FF_REG_a" \n\t"
1101 " js 1b \n\t"
1102 "2: \n\t"
1103 : "+a" (mmx_size)
1104 18215 : "r" (src-mmx_size), "r"(dst-mmx_size)
1105 NAMED_CONSTRAINTS_ADD(mask24r,mask24g,mask24b)
1106 );
1107
1108 18215 __asm__ volatile(SFENCE:::"memory");
1109 18215 __asm__ volatile(EMMS:::"memory");
1110
1111
2/2
✓ Branch 0 taken 2027 times.
✓ Branch 1 taken 16188 times.
18215 if (mmx_size==23) return; //finished, was multiple of 8
1112
1113 16188 src+= src_size;
1114 16188 dst+= src_size;
1115 16188 src_size= 23-mmx_size;
1116 16188 src-= src_size;
1117 16188 dst-= src_size;
1118
2/2
✓ Branch 0 taken 64747 times.
✓ Branch 1 taken 16188 times.
80935 for (unsigned i = 0; i < src_size; i +=3) {
1119 register uint8_t x;
1120 64747 x = src[i + 2];
1121 64747 dst[i + 1] = src[i + 1];
1122 64747 dst[i + 2] = src[i + 0];
1123 64747 dst[i + 0] = x;
1124 }
1125 }
1126
1127 ✗ static inline void yuvPlanartoyuy2_line_mmxext(uint8_t *dst, const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc,
1128 x86_reg chromWidth)
1129 {
1130 ✗ __asm__ volatile(
1131 "xor %%"FF_REG_a", %%"FF_REG_a" \n\t"
1132 ".p2align 4 \n\t"
1133 "1: \n\t"
1134 PREFETCH" 32(%1, %%"FF_REG_a", 2) \n\t"
1135 PREFETCH" 32(%2, %%"FF_REG_a") \n\t"
1136 PREFETCH" 32(%3, %%"FF_REG_a") \n\t"
1137 "movq (%2, %%"FF_REG_a"), %%mm0 \n\t" // U(0)
1138 "movq %%mm0, %%mm2 \n\t" // U(0)
1139 "movq (%3, %%"FF_REG_a"), %%mm1 \n\t" // V(0)
1140 "punpcklbw %%mm1, %%mm0 \n\t" // UVUV UVUV(0)
1141 "punpckhbw %%mm1, %%mm2 \n\t" // UVUV UVUV(8)
1142
1143 "movq (%1, %%"FF_REG_a",2), %%mm3 \n\t" // Y(0)
1144 "movq 8(%1, %%"FF_REG_a",2), %%mm5 \n\t" // Y(8)
1145 "movq %%mm3, %%mm4 \n\t" // Y(0)
1146 "movq %%mm5, %%mm6 \n\t" // Y(8)
1147 "punpcklbw %%mm0, %%mm3 \n\t" // YUYV YUYV(0)
1148 "punpckhbw %%mm0, %%mm4 \n\t" // YUYV YUYV(4)
1149 "punpcklbw %%mm2, %%mm5 \n\t" // YUYV YUYV(8)
1150 "punpckhbw %%mm2, %%mm6 \n\t" // YUYV YUYV(12)
1151
1152 MOVNTQ" %%mm3, (%0, %%"FF_REG_a", 4) \n\t"
1153 MOVNTQ" %%mm4, 8(%0, %%"FF_REG_a", 4) \n\t"
1154 MOVNTQ" %%mm5, 16(%0, %%"FF_REG_a", 4) \n\t"
1155 MOVNTQ" %%mm6, 24(%0, %%"FF_REG_a", 4) \n\t"
1156
1157 "add $8, %%"FF_REG_a" \n\t"
1158 "cmp %4, %%"FF_REG_a" \n\t"
1159 " jb 1b \n\t"
1160 ::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "g" (chromWidth)
1161 : "%"FF_REG_a
1162 );
1163 ✗ }
1164
1165 ✗ static inline void yuvPlanartouyvy_line_mmxext(uint8_t *dst, const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc,
1166 x86_reg chromWidth)
1167 {
1168 ✗ __asm__ volatile(
1169 "xor %%"FF_REG_a", %%"FF_REG_a" \n\t"
1170 ".p2align 4 \n\t"
1171 "1: \n\t"
1172 PREFETCH" 32(%1, %%"FF_REG_a", 2) \n\t"
1173 PREFETCH" 32(%2, %%"FF_REG_a") \n\t"
1174 PREFETCH" 32(%3, %%"FF_REG_a") \n\t"
1175 "movq (%2, %%"FF_REG_a"), %%mm0 \n\t" // U(0)
1176 "movq %%mm0, %%mm2 \n\t" // U(0)
1177 "movq (%3, %%"FF_REG_a"), %%mm1 \n\t" // V(0)
1178 "punpcklbw %%mm1, %%mm0 \n\t" // UVUV UVUV(0)
1179 "punpckhbw %%mm1, %%mm2 \n\t" // UVUV UVUV(8)
1180
1181 "movq (%1, %%"FF_REG_a",2), %%mm3 \n\t" // Y(0)
1182 "movq 8(%1, %%"FF_REG_a",2), %%mm5 \n\t" // Y(8)
1183 "movq %%mm0, %%mm4 \n\t" // Y(0)
1184 "movq %%mm2, %%mm6 \n\t" // Y(8)
1185 "punpcklbw %%mm3, %%mm0 \n\t" // YUYV YUYV(0)
1186 "punpckhbw %%mm3, %%mm4 \n\t" // YUYV YUYV(4)
1187 "punpcklbw %%mm5, %%mm2 \n\t" // YUYV YUYV(8)
1188 "punpckhbw %%mm5, %%mm6 \n\t" // YUYV YUYV(12)
1189
1190 MOVNTQ" %%mm0, (%0, %%"FF_REG_a", 4) \n\t"
1191 MOVNTQ" %%mm4, 8(%0, %%"FF_REG_a", 4) \n\t"
1192 MOVNTQ" %%mm2, 16(%0, %%"FF_REG_a", 4) \n\t"
1193 MOVNTQ" %%mm6, 24(%0, %%"FF_REG_a", 4) \n\t"
1194
1195 "add $8, %%"FF_REG_a" \n\t"
1196 "cmp %4, %%"FF_REG_a" \n\t"
1197 " jb 1b \n\t"
1198 ::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "g" (chromWidth)
1199 : "%"FF_REG_a
1200 );
1201 ✗ }
1202
1203 ✗ static inline void yuvPlanartopacked_mmxext(void (*pack_line)(uint8_t *, const uint8_t *, const uint8_t *, const uint8_t *, x86_reg),
1204 int luma_first,
1205 const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
1206 int width, int height,
1207 int lumStride, int chromStride, int dstStride, int vertLumPerChroma)
1208 {
1209 ✗ const x86_reg chromWidth= width>>1;
1210 ✗ for (int y = 0; y < height; y++) {
1211 //FIXME handle 2 lines at once (fewer prefetches, reuse some chroma, but very likely memory-limited anyway)
1212 ✗ if (chromWidth < 8) {
1213 ✗ ff_pack_yuv422_line(dst, ysrc, usrc, vsrc, 0, chromWidth, luma_first);
1214 } else {
1215 ✗ pack_line(dst, ysrc, usrc, vsrc, chromWidth & ~7);
1216 ✗ if (chromWidth & 7) {
1217 ✗ x86_reg i = chromWidth - 8;
1218 ✗ pack_line(dst + 4 * i, ysrc + 2 * i, usrc + i, vsrc + i, 8);
1219 }
1220 }
1221 ✗ if ((y&(vertLumPerChroma-1)) == vertLumPerChroma-1) {
1222 ✗ usrc += chromStride;
1223 ✗ vsrc += chromStride;
1224 }
1225 ✗ ysrc += lumStride;
1226 ✗ dst += dstStride;
1227 }
1228 ✗ __asm__(EMMS" \n\t"
1229 SFENCE" \n\t"
1230 :::"memory");
1231 ✗ }
1232
1233 ✗ static inline void yv12toyuy2_mmxext(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
1234 int width, int height,
1235 int lumStride, int chromStride, int dstStride)
1236 {
1237 //FIXME interpolate chroma
1238 ✗ yuvPlanartopacked_mmxext(yuvPlanartoyuy2_line_mmxext, 1, ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 2);
1239 ✗ }
1240
1241 ✗ static inline void yv12touyvy_mmxext(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
1242 int width, int height,
1243 int lumStride, int chromStride, int dstStride)
1244 {
1245 //FIXME interpolate chroma
1246 ✗ yuvPlanartopacked_mmxext(yuvPlanartouyvy_line_mmxext, 0, ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 2);
1247 ✗ }
1248
1249 ✗ static inline void yuv422ptouyvy_mmxext(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
1250 int width, int height,
1251 int lumStride, int chromStride, int dstStride)
1252 {
1253 ✗ yuvPlanartopacked_mmxext(yuvPlanartouyvy_line_mmxext, 0, ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 1);
1254 ✗ }
1255
1256 ✗ static inline void yuv422ptoyuy2_mmxext(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
1257 int width, int height,
1258 int lumStride, int chromStride, int dstStride)
1259 {
1260 ✗ yuvPlanartopacked_mmxext(yuvPlanartoyuy2_line_mmxext, 1, ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 1);
1261 ✗ }
1262
1263 ✗ static inline void planar2x_mmxext(const uint8_t *src, uint8_t *dst, int srcWidth, int srcHeight, int srcStride, int dstStride)
1264 {
1265 ✗ dst[0]= src[0];
1266
1267 // first line
1268 ✗ for (int x = 0; x < srcWidth - 1; x++) {
1269 ✗ dst[2*x+1]= (3*src[x] + src[x+1])>>2;
1270 ✗ dst[2*x+2]= ( src[x] + 3*src[x+1])>>2;
1271 }
1272 ✗ dst[2*srcWidth-1]= src[srcWidth-1];
1273
1274 ✗ dst+= dstStride;
1275
1276 ✗ for (int y = 1; y < srcHeight; y++) {
1277 ✗ x86_reg mmxSize= srcWidth&~15;
1278
1279 ✗ if (mmxSize) {
1280 ✗ __asm__ volatile(
1281 "mov %4, %%"FF_REG_a" \n\t"
1282 "movq "MANGLE(mmx_ff)", %%mm0 \n\t"
1283 "movq (%0, %%"FF_REG_a"), %%mm4 \n\t"
1284 "movq %%mm4, %%mm2 \n\t"
1285 "psllq $8, %%mm4 \n\t"
1286 "pand %%mm0, %%mm2 \n\t"
1287 "por %%mm2, %%mm4 \n\t"
1288 "movq (%1, %%"FF_REG_a"), %%mm5 \n\t"
1289 "movq %%mm5, %%mm3 \n\t"
1290 "psllq $8, %%mm5 \n\t"
1291 "pand %%mm0, %%mm3 \n\t"
1292 "por %%mm3, %%mm5 \n\t"
1293 "1: \n\t"
1294 "movq (%0, %%"FF_REG_a"), %%mm0 \n\t"
1295 "movq (%1, %%"FF_REG_a"), %%mm1 \n\t"
1296 "movq 1(%0, %%"FF_REG_a"), %%mm2 \n\t"
1297 "movq 1(%1, %%"FF_REG_a"), %%mm3 \n\t"
1298 PAVGB" %%mm0, %%mm5 \n\t"
1299 PAVGB" %%mm0, %%mm3 \n\t"
1300 PAVGB" %%mm0, %%mm5 \n\t"
1301 PAVGB" %%mm0, %%mm3 \n\t"
1302 PAVGB" %%mm1, %%mm4 \n\t"
1303 PAVGB" %%mm1, %%mm2 \n\t"
1304 PAVGB" %%mm1, %%mm4 \n\t"
1305 PAVGB" %%mm1, %%mm2 \n\t"
1306 "movq %%mm5, %%mm7 \n\t"
1307 "movq %%mm4, %%mm6 \n\t"
1308 "punpcklbw %%mm3, %%mm5 \n\t"
1309 "punpckhbw %%mm3, %%mm7 \n\t"
1310 "punpcklbw %%mm2, %%mm4 \n\t"
1311 "punpckhbw %%mm2, %%mm6 \n\t"
1312 MOVNTQ" %%mm5, (%2, %%"FF_REG_a", 2) \n\t"
1313 MOVNTQ" %%mm7, 8(%2, %%"FF_REG_a", 2) \n\t"
1314 MOVNTQ" %%mm4, (%3, %%"FF_REG_a", 2) \n\t"
1315 MOVNTQ" %%mm6, 8(%3, %%"FF_REG_a", 2) \n\t"
1316 "add $8, %%"FF_REG_a" \n\t"
1317 "movq -1(%0, %%"FF_REG_a"), %%mm4 \n\t"
1318 "movq -1(%1, %%"FF_REG_a"), %%mm5 \n\t"
1319 " js 1b \n\t"
1320 ✗ :: "r" (src + mmxSize ), "r" (src + srcStride + mmxSize ),
1321 ✗ "r" (dst + mmxSize*2), "r" (dst + dstStride + mmxSize*2),
1322 ✗ "g" (-mmxSize)
1323 NAMED_CONSTRAINTS_ADD(mmx_ff)
1324 : "%"FF_REG_a
1325 );
1326 } else {
1327 ✗ mmxSize = 1;
1328 ✗ dst[0] = (src[0] * 3 + src[srcStride]) >> 2;
1329 ✗ dst[dstStride] = (src[0] + 3 * src[srcStride]) >> 2;
1330 }
1331
1332 ✗ for (int x = mmxSize - 1; x < srcWidth - 1; x++) {
1333 ✗ dst[2*x +1]= (3*src[x+0] + src[x+srcStride+1])>>2;
1334 ✗ dst[2*x+dstStride+2]= ( src[x+0] + 3*src[x+srcStride+1])>>2;
1335 ✗ dst[2*x+dstStride+1]= ( src[x+1] + 3*src[x+srcStride ])>>2;
1336 ✗ dst[2*x +2]= (3*src[x+1] + src[x+srcStride ])>>2;
1337 }
1338 ✗ dst[srcWidth*2 -1 ]= (3*src[srcWidth-1] + src[srcWidth-1 + srcStride])>>2;
1339 ✗ dst[srcWidth*2 -1 + dstStride]= ( src[srcWidth-1] + 3*src[srcWidth-1 + srcStride])>>2;
1340
1341 ✗ dst+=dstStride*2;
1342 ✗ src+=srcStride;
1343 }
1344
1345 // last line
1346 ✗ dst[0]= src[0];
1347
1348 ✗ for (int x = 0; x < srcWidth - 1; x++) {
1349 ✗ dst[2*x+1]= (3*src[x] + src[x+1])>>2;
1350 ✗ dst[2*x+2]= ( src[x] + 3*src[x+1])>>2;
1351 }
1352 ✗ dst[2*srcWidth-1]= src[srcWidth-1];
1353
1354 ✗ __asm__ volatile(EMMS" \n\t"
1355 SFENCE" \n\t"
1356 :::"memory");
1357 ✗ }
1358
1359 /**
1360 * Height should be a multiple of 2 and width should be a multiple of 2.
1361 * (If this is a problem for anyone then tell me, and I will fix it.)
1362 * Chrominance data is only taken from every second line,
1363 * others are ignored in the C version.
1364 * FIXME: Write HQ version.
1365 */
1366 #if ARCH_X86_32 && HAVE_X86_7REGS
1367 DECLARE_ASM_CONST(8, uint64_t, bgr2YOffset) = 0x1010101010101010ULL;
1368 DECLARE_ASM_CONST(8, uint64_t, bgr2UVOffset) = 0x8080808080808080ULL;
1369 DECLARE_ASM_CONST(8, uint64_t, w1111) = 0x0001000100010001ULL;
1370
1371 static inline void rgb24toyv12_mmxext(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
1372 int width, int height,
1373 int lumStride, int chromStride, int srcStride,
1374 const int32_t *rgb2yuv)
1375 {
1376 #define BGR2Y_IDX "16*4+16*32"
1377 #define BGR2U_IDX "16*4+16*33"
1378 #define BGR2V_IDX "16*4+16*34"
1379 int y;
1380 const x86_reg chromWidth= width>>1;
1381
1382 if (height > 2) {
1383 ff_rgb24toyv12_c(src, ydst, udst, vdst, width, 2, lumStride, chromStride, srcStride, rgb2yuv);
1384 src += 2*srcStride;
1385 ydst += 2*lumStride;
1386 udst += chromStride;
1387 vdst += chromStride;
1388 height -= 2;
1389 }
1390
1391 for (y = 0; y < height - 2; y += 2) {
1392 for (int i = 0; i < 2; i++) {
1393 __asm__ volatile(
1394 "mov %2, %%"FF_REG_a"\n\t"
1395 "movq "BGR2Y_IDX"(%3), %%mm6 \n\t"
1396 "movq "MANGLE(w1111)", %%mm5 \n\t"
1397 "pxor %%mm7, %%mm7 \n\t"
1398 "lea (%%"FF_REG_a", %%"FF_REG_a", 2), %%"FF_REG_d" \n\t"
1399 ".p2align 4 \n\t"
1400 "1: \n\t"
1401 PREFETCH" 64(%0, %%"FF_REG_d") \n\t"
1402 "movd (%0, %%"FF_REG_d"), %%mm0 \n\t"
1403 "movd 3(%0, %%"FF_REG_d"), %%mm1 \n\t"
1404 "punpcklbw %%mm7, %%mm0 \n\t"
1405 "punpcklbw %%mm7, %%mm1 \n\t"
1406 "movd 6(%0, %%"FF_REG_d"), %%mm2 \n\t"
1407 "movd 9(%0, %%"FF_REG_d"), %%mm3 \n\t"
1408 "punpcklbw %%mm7, %%mm2 \n\t"
1409 "punpcklbw %%mm7, %%mm3 \n\t"
1410 "pmaddwd %%mm6, %%mm0 \n\t"
1411 "pmaddwd %%mm6, %%mm1 \n\t"
1412 "pmaddwd %%mm6, %%mm2 \n\t"
1413 "pmaddwd %%mm6, %%mm3 \n\t"
1414 "psrad $8, %%mm0 \n\t"
1415 "psrad $8, %%mm1 \n\t"
1416 "psrad $8, %%mm2 \n\t"
1417 "psrad $8, %%mm3 \n\t"
1418 "packssdw %%mm1, %%mm0 \n\t"
1419 "packssdw %%mm3, %%mm2 \n\t"
1420 "pmaddwd %%mm5, %%mm0 \n\t"
1421 "pmaddwd %%mm5, %%mm2 \n\t"
1422 "packssdw %%mm2, %%mm0 \n\t"
1423 "psraw $7, %%mm0 \n\t"
1424
1425 "movd 12(%0, %%"FF_REG_d"), %%mm4 \n\t"
1426 "movd 15(%0, %%"FF_REG_d"), %%mm1 \n\t"
1427 "punpcklbw %%mm7, %%mm4 \n\t"
1428 "punpcklbw %%mm7, %%mm1 \n\t"
1429 "movd 18(%0, %%"FF_REG_d"), %%mm2 \n\t"
1430 "movd 21(%0, %%"FF_REG_d"), %%mm3 \n\t"
1431 "punpcklbw %%mm7, %%mm2 \n\t"
1432 "punpcklbw %%mm7, %%mm3 \n\t"
1433 "pmaddwd %%mm6, %%mm4 \n\t"
1434 "pmaddwd %%mm6, %%mm1 \n\t"
1435 "pmaddwd %%mm6, %%mm2 \n\t"
1436 "pmaddwd %%mm6, %%mm3 \n\t"
1437 "psrad $8, %%mm4 \n\t"
1438 "psrad $8, %%mm1 \n\t"
1439 "psrad $8, %%mm2 \n\t"
1440 "psrad $8, %%mm3 \n\t"
1441 "packssdw %%mm1, %%mm4 \n\t"
1442 "packssdw %%mm3, %%mm2 \n\t"
1443 "pmaddwd %%mm5, %%mm4 \n\t"
1444 "pmaddwd %%mm5, %%mm2 \n\t"
1445 "add $24, %%"FF_REG_d"\n\t"
1446 "packssdw %%mm2, %%mm4 \n\t"
1447 "psraw $7, %%mm4 \n\t"
1448
1449 "packuswb %%mm4, %%mm0 \n\t"
1450 "paddusb "MANGLE(bgr2YOffset)", %%mm0 \n\t"
1451
1452 MOVNTQ" %%mm0, (%1, %%"FF_REG_a") \n\t"
1453 "add $8, %%"FF_REG_a" \n\t"
1454 " js 1b \n\t"
1455 : : "r" (src+width*3), "r" (ydst+width), "g" ((x86_reg)-width), "r"(rgb2yuv)
1456 NAMED_CONSTRAINTS_ADD(w1111,bgr2YOffset)
1457 : "%"FF_REG_a, "%"FF_REG_d
1458 );
1459 ydst += lumStride;
1460 src += srcStride;
1461 }
1462 src -= srcStride*2;
1463 __asm__ volatile(
1464 "mov %4, %%"FF_REG_a"\n\t"
1465 "movq "MANGLE(w1111)", %%mm5 \n\t"
1466 "movq "BGR2U_IDX"(%5), %%mm6 \n\t"
1467 "pxor %%mm7, %%mm7 \n\t"
1468 "lea (%%"FF_REG_a", %%"FF_REG_a", 2), %%"FF_REG_d" \n\t"
1469 "add %%"FF_REG_d", %%"FF_REG_d"\n\t"
1470 ".p2align 4 \n\t"
1471 "1: \n\t"
1472 PREFETCH" 64(%0, %%"FF_REG_d") \n\t"
1473 PREFETCH" 64(%1, %%"FF_REG_d") \n\t"
1474 "movq (%0, %%"FF_REG_d"), %%mm0 \n\t"
1475 "movq (%1, %%"FF_REG_d"), %%mm1 \n\t"
1476 "movq 6(%0, %%"FF_REG_d"), %%mm2 \n\t"
1477 "movq 6(%1, %%"FF_REG_d"), %%mm3 \n\t"
1478 PAVGB" %%mm1, %%mm0 \n\t"
1479 PAVGB" %%mm3, %%mm2 \n\t"
1480 "movq %%mm0, %%mm1 \n\t"
1481 "movq %%mm2, %%mm3 \n\t"
1482 "psrlq $24, %%mm0 \n\t"
1483 "psrlq $24, %%mm2 \n\t"
1484 PAVGB" %%mm1, %%mm0 \n\t"
1485 PAVGB" %%mm3, %%mm2 \n\t"
1486 "punpcklbw %%mm7, %%mm0 \n\t"
1487 "punpcklbw %%mm7, %%mm2 \n\t"
1488 "movq "BGR2V_IDX"(%5), %%mm1 \n\t"
1489 "movq "BGR2V_IDX"(%5), %%mm3 \n\t"
1490
1491 "pmaddwd %%mm0, %%mm1 \n\t"
1492 "pmaddwd %%mm2, %%mm3 \n\t"
1493 "pmaddwd %%mm6, %%mm0 \n\t"
1494 "pmaddwd %%mm6, %%mm2 \n\t"
1495 "psrad $8, %%mm0 \n\t"
1496 "psrad $8, %%mm1 \n\t"
1497 "psrad $8, %%mm2 \n\t"
1498 "psrad $8, %%mm3 \n\t"
1499 "packssdw %%mm2, %%mm0 \n\t"
1500 "packssdw %%mm3, %%mm1 \n\t"
1501 "pmaddwd %%mm5, %%mm0 \n\t"
1502 "pmaddwd %%mm5, %%mm1 \n\t"
1503 "packssdw %%mm1, %%mm0 \n\t" // V1 V0 U1 U0
1504 "psraw $7, %%mm0 \n\t"
1505
1506 "movq 12(%0, %%"FF_REG_d"), %%mm4 \n\t"
1507 "movq 12(%1, %%"FF_REG_d"), %%mm1 \n\t"
1508 "movq 18(%0, %%"FF_REG_d"), %%mm2 \n\t"
1509 "movq 18(%1, %%"FF_REG_d"), %%mm3 \n\t"
1510 PAVGB" %%mm1, %%mm4 \n\t"
1511 PAVGB" %%mm3, %%mm2 \n\t"
1512 "movq %%mm4, %%mm1 \n\t"
1513 "movq %%mm2, %%mm3 \n\t"
1514 "psrlq $24, %%mm4 \n\t"
1515 "psrlq $24, %%mm2 \n\t"
1516 PAVGB" %%mm1, %%mm4 \n\t"
1517 PAVGB" %%mm3, %%mm2 \n\t"
1518 "punpcklbw %%mm7, %%mm4 \n\t"
1519 "punpcklbw %%mm7, %%mm2 \n\t"
1520 "movq "BGR2V_IDX"(%5), %%mm1 \n\t"
1521 "movq "BGR2V_IDX"(%5), %%mm3 \n\t"
1522
1523 "pmaddwd %%mm4, %%mm1 \n\t"
1524 "pmaddwd %%mm2, %%mm3 \n\t"
1525 "pmaddwd %%mm6, %%mm4 \n\t"
1526 "pmaddwd %%mm6, %%mm2 \n\t"
1527 "psrad $8, %%mm4 \n\t"
1528 "psrad $8, %%mm1 \n\t"
1529 "psrad $8, %%mm2 \n\t"
1530 "psrad $8, %%mm3 \n\t"
1531 "packssdw %%mm2, %%mm4 \n\t"
1532 "packssdw %%mm3, %%mm1 \n\t"
1533 "pmaddwd %%mm5, %%mm4 \n\t"
1534 "pmaddwd %%mm5, %%mm1 \n\t"
1535 "add $24, %%"FF_REG_d"\n\t"
1536 "packssdw %%mm1, %%mm4 \n\t" // V3 V2 U3 U2
1537 "psraw $7, %%mm4 \n\t"
1538
1539 "movq %%mm0, %%mm1 \n\t"
1540 "punpckldq %%mm4, %%mm0 \n\t"
1541 "punpckhdq %%mm4, %%mm1 \n\t"
1542 "packsswb %%mm1, %%mm0 \n\t"
1543 "paddb "MANGLE(bgr2UVOffset)", %%mm0 \n\t"
1544 "movd %%mm0, (%2, %%"FF_REG_a") \n\t"
1545 "punpckhdq %%mm0, %%mm0 \n\t"
1546 "movd %%mm0, (%3, %%"FF_REG_a") \n\t"
1547 "add $4, %%"FF_REG_a" \n\t"
1548 " js 1b \n\t"
1549 : : "r" (src+chromWidth*6), "r" (src+srcStride+chromWidth*6), "r" (udst+chromWidth), "r" (vdst+chromWidth), "g" (-chromWidth), "r"(rgb2yuv)
1550 NAMED_CONSTRAINTS_ADD(w1111,bgr2UVOffset)
1551 : "%"FF_REG_a, "%"FF_REG_d
1552 );
1553
1554 udst += chromStride;
1555 vdst += chromStride;
1556 src += srcStride*2;
1557 }
1558
1559 __asm__ volatile(EMMS" \n\t"
1560 SFENCE" \n\t"
1561 :::"memory");
1562
1563 ff_rgb24toyv12_c(src, ydst, udst, vdst, width, height-y, lumStride, chromStride, srcStride, rgb2yuv);
1564 }
1565 #endif /* HAVE_X86_7REGS */
1566
1567 1020 static void extract_even_mmxext(const uint8_t *src, uint8_t *dst, x86_reg count)
1568 {
1569 1020 dst += count;
1570 1020 src += 2*count;
1571 1020 count= - count;
1572
1573
2/2
✓ Branch 0 taken 672 times.
✓ Branch 1 taken 348 times.
1020 if(count <= -16) {
1574 672 count += 15;
1575 672 __asm__ volatile(
1576 "pcmpeqw %%mm7, %%mm7 \n\t"
1577 "psrlw $8, %%mm7 \n\t"
1578 "1: \n\t"
1579 "movq -30(%1, %0, 2), %%mm0 \n\t"
1580 "movq -22(%1, %0, 2), %%mm1 \n\t"
1581 "movq -14(%1, %0, 2), %%mm2 \n\t"
1582 "movq -6(%1, %0, 2), %%mm3 \n\t"
1583 "pand %%mm7, %%mm0 \n\t"
1584 "pand %%mm7, %%mm1 \n\t"
1585 "pand %%mm7, %%mm2 \n\t"
1586 "pand %%mm7, %%mm3 \n\t"
1587 "packuswb %%mm1, %%mm0 \n\t"
1588 "packuswb %%mm3, %%mm2 \n\t"
1589 MOVNTQ" %%mm0,-15(%2, %0) \n\t"
1590 MOVNTQ" %%mm2,- 7(%2, %0) \n\t"
1591 "add $16, %0 \n\t"
1592 " js 1b \n\t"
1593 : "+r"(count)
1594 : "r"(src), "r"(dst)
1595 );
1596 672 count -= 15;
1597 }
1598
2/2
✓ Branch 0 taken 3570 times.
✓ Branch 1 taken 1020 times.
4590 while(count<0) {
1599 3570 dst[count]= src[2*count];
1600 3570 count++;
1601 }
1602 1020 }
1603
1604 510 static void extract_odd_mmxext(const uint8_t *src, uint8_t *dst, x86_reg count)
1605 {
1606 510 src ++;
1607 510 dst += count;
1608 510 src += 2*count;
1609 510 count= - count;
1610
1611
2/2
✓ Branch 0 taken 320 times.
✓ Branch 1 taken 190 times.
510 if(count < -16) {
1612 320 count += 16;
1613 320 __asm__ volatile(
1614 "pcmpeqw %%mm7, %%mm7 \n\t"
1615 "psrlw $8, %%mm7 \n\t"
1616 "1: \n\t"
1617 "movq -32(%1, %0, 2), %%mm0 \n\t"
1618 "movq -24(%1, %0, 2), %%mm1 \n\t"
1619 "movq -16(%1, %0, 2), %%mm2 \n\t"
1620 "movq -8(%1, %0, 2), %%mm3 \n\t"
1621 "pand %%mm7, %%mm0 \n\t"
1622 "pand %%mm7, %%mm1 \n\t"
1623 "pand %%mm7, %%mm2 \n\t"
1624 "pand %%mm7, %%mm3 \n\t"
1625 "packuswb %%mm1, %%mm0 \n\t"
1626 "packuswb %%mm3, %%mm2 \n\t"
1627 MOVNTQ" %%mm0,-16(%2, %0) \n\t"
1628 MOVNTQ" %%mm2,- 8(%2, %0) \n\t"
1629 "add $16, %0 \n\t"
1630 " js 1b \n\t"
1631 : "+r"(count)
1632 : "r"(src), "r"(dst)
1633 );
1634 320 count -= 16;
1635 }
1636
2/2
✓ Branch 0 taken 6441 times.
✓ Branch 1 taken 510 times.
6951 while(count<0) {
1637 6441 dst[count]= src[2*count];
1638 6441 count++;
1639 }
1640 510 }
1641
1642 #if ARCH_X86_32
1643 static void extract_even2_mmxext(const uint8_t *src, uint8_t *dst0, uint8_t *dst1, x86_reg count)
1644 {
1645 dst0+= count;
1646 dst1+= count;
1647 src += 4*count;
1648 count= - count;
1649 if(count <= -8) {
1650 count += 7;
1651 __asm__ volatile(
1652 "pcmpeqw %%mm7, %%mm7 \n\t"
1653 "psrlw $8, %%mm7 \n\t"
1654 "1: \n\t"
1655 "movq -28(%1, %0, 4), %%mm0 \n\t"
1656 "movq -20(%1, %0, 4), %%mm1 \n\t"
1657 "movq -12(%1, %0, 4), %%mm2 \n\t"
1658 "movq -4(%1, %0, 4), %%mm3 \n\t"
1659 "pand %%mm7, %%mm0 \n\t"
1660 "pand %%mm7, %%mm1 \n\t"
1661 "pand %%mm7, %%mm2 \n\t"
1662 "pand %%mm7, %%mm3 \n\t"
1663 "packuswb %%mm1, %%mm0 \n\t"
1664 "packuswb %%mm3, %%mm2 \n\t"
1665 "movq %%mm0, %%mm1 \n\t"
1666 "movq %%mm2, %%mm3 \n\t"
1667 "psrlw $8, %%mm0 \n\t"
1668 "psrlw $8, %%mm2 \n\t"
1669 "pand %%mm7, %%mm1 \n\t"
1670 "pand %%mm7, %%mm3 \n\t"
1671 "packuswb %%mm2, %%mm0 \n\t"
1672 "packuswb %%mm3, %%mm1 \n\t"
1673 MOVNTQ" %%mm0,- 7(%3, %0) \n\t"
1674 MOVNTQ" %%mm1,- 7(%2, %0) \n\t"
1675 "add $8, %0 \n\t"
1676 " js 1b \n\t"
1677 : "+r"(count)
1678 : "r"(src), "r"(dst0), "r"(dst1)
1679 );
1680 count -= 7;
1681 }
1682 while(count<0) {
1683 dst0[count]= src[4*count+0];
1684 dst1[count]= src[4*count+2];
1685 count++;
1686 }
1687 }
1688 #endif /* ARCH_X86_32 */
1689
1690 251 static void extract_even2avg_mmxext(const uint8_t *src0, const uint8_t *src1, uint8_t *dst0, uint8_t *dst1, x86_reg count)
1691 {
1692 251 dst0 += count;
1693 251 dst1 += count;
1694 251 src0 += 4*count;
1695 251 src1 += 4*count;
1696 251 count= - count;
1697 #ifdef PAVGB
1698
2/2
✓ Branch 0 taken 165 times.
✓ Branch 1 taken 86 times.
251 if(count <= -8) {
1699 165 count += 7;
1700 165 __asm__ volatile(
1701 "pcmpeqw %%mm7, %%mm7 \n\t"
1702 "psrlw $8, %%mm7 \n\t"
1703 "1: \n\t"
1704 "movq -28(%1, %0, 4), %%mm0 \n\t"
1705 "movq -20(%1, %0, 4), %%mm1 \n\t"
1706 "movq -12(%1, %0, 4), %%mm2 \n\t"
1707 "movq -4(%1, %0, 4), %%mm3 \n\t"
1708 PAVGB" -28(%2, %0, 4), %%mm0 \n\t"
1709 PAVGB" -20(%2, %0, 4), %%mm1 \n\t"
1710 PAVGB" -12(%2, %0, 4), %%mm2 \n\t"
1711 PAVGB" - 4(%2, %0, 4), %%mm3 \n\t"
1712 "pand %%mm7, %%mm0 \n\t"
1713 "pand %%mm7, %%mm1 \n\t"
1714 "pand %%mm7, %%mm2 \n\t"
1715 "pand %%mm7, %%mm3 \n\t"
1716 "packuswb %%mm1, %%mm0 \n\t"
1717 "packuswb %%mm3, %%mm2 \n\t"
1718 "movq %%mm0, %%mm1 \n\t"
1719 "movq %%mm2, %%mm3 \n\t"
1720 "psrlw $8, %%mm0 \n\t"
1721 "psrlw $8, %%mm2 \n\t"
1722 "pand %%mm7, %%mm1 \n\t"
1723 "pand %%mm7, %%mm3 \n\t"
1724 "packuswb %%mm2, %%mm0 \n\t"
1725 "packuswb %%mm3, %%mm1 \n\t"
1726 MOVNTQ" %%mm0,- 7(%4, %0) \n\t"
1727 MOVNTQ" %%mm1,- 7(%3, %0) \n\t"
1728 "add $8, %0 \n\t"
1729 " js 1b \n\t"
1730 : "+r"(count)
1731 : "r"(src0), "r"(src1), "r"(dst0), "r"(dst1)
1732 );
1733 165 count -= 7;
1734 }
1735 #endif
1736
2/2
✓ Branch 0 taken 404 times.
✓ Branch 1 taken 251 times.
655 while(count<0) {
1737 404 dst0[count] = (src0[4*count+0]+src1[4*count+0]+1)>>1;
1738 404 dst1[count] = (src0[4*count+2]+src1[4*count+2]+1)>>1;
1739 404 count++;
1740 }
1741 251 }
1742
1743 510 static void extract_odd2_mmxext(const uint8_t *src, uint8_t *dst0, uint8_t *dst1, x86_reg count)
1744 {
1745 510 dst0+= count;
1746 510 dst1+= count;
1747 510 src += 4*count;
1748 510 count= - count;
1749
2/2
✓ Branch 0 taken 336 times.
✓ Branch 1 taken 174 times.
510 if(count <= -8) {
1750 336 count += 7;
1751 336 __asm__ volatile(
1752 "pcmpeqw %%mm7, %%mm7 \n\t"
1753 "psrlw $8, %%mm7 \n\t"
1754 "1: \n\t"
1755 "movq -28(%1, %0, 4), %%mm0 \n\t"
1756 "movq -20(%1, %0, 4), %%mm1 \n\t"
1757 "movq -12(%1, %0, 4), %%mm2 \n\t"
1758 "movq -4(%1, %0, 4), %%mm3 \n\t"
1759 "psrlw $8, %%mm0 \n\t"
1760 "psrlw $8, %%mm1 \n\t"
1761 "psrlw $8, %%mm2 \n\t"
1762 "psrlw $8, %%mm3 \n\t"
1763 "packuswb %%mm1, %%mm0 \n\t"
1764 "packuswb %%mm3, %%mm2 \n\t"
1765 "movq %%mm0, %%mm1 \n\t"
1766 "movq %%mm2, %%mm3 \n\t"
1767 "psrlw $8, %%mm0 \n\t"
1768 "psrlw $8, %%mm2 \n\t"
1769 "pand %%mm7, %%mm1 \n\t"
1770 "pand %%mm7, %%mm3 \n\t"
1771 "packuswb %%mm2, %%mm0 \n\t"
1772 "packuswb %%mm3, %%mm1 \n\t"
1773 MOVNTQ" %%mm0,- 7(%3, %0) \n\t"
1774 MOVNTQ" %%mm1,- 7(%2, %0) \n\t"
1775 "add $8, %0 \n\t"
1776 " js 1b \n\t"
1777 : "+r"(count)
1778 : "r"(src), "r"(dst0), "r"(dst1)
1779 );
1780 336 count -= 7;
1781 }
1782 510 src++;
1783
2/2
✓ Branch 0 taken 822 times.
✓ Branch 1 taken 510 times.
1332 while(count<0) {
1784 822 dst0[count]= src[4*count+0];
1785 822 dst1[count]= src[4*count+2];
1786 822 count++;
1787 }
1788 510 }
1789
1790 251 static void extract_odd2avg_mmxext(const uint8_t *src0, const uint8_t *src1, uint8_t *dst0, uint8_t *dst1, x86_reg count)
1791 {
1792 251 dst0 += count;
1793 251 dst1 += count;
1794 251 src0 += 4*count;
1795 251 src1 += 4*count;
1796 251 count= - count;
1797 #ifdef PAVGB
1798
2/2
✓ Branch 0 taken 165 times.
✓ Branch 1 taken 86 times.
251 if(count <= -8) {
1799 165 count += 7;
1800 165 __asm__ volatile(
1801 "pcmpeqw %%mm7, %%mm7 \n\t"
1802 "psrlw $8, %%mm7 \n\t"
1803 "1: \n\t"
1804 "movq -28(%1, %0, 4), %%mm0 \n\t"
1805 "movq -20(%1, %0, 4), %%mm1 \n\t"
1806 "movq -12(%1, %0, 4), %%mm2 \n\t"
1807 "movq -4(%1, %0, 4), %%mm3 \n\t"
1808 PAVGB" -28(%2, %0, 4), %%mm0 \n\t"
1809 PAVGB" -20(%2, %0, 4), %%mm1 \n\t"
1810 PAVGB" -12(%2, %0, 4), %%mm2 \n\t"
1811 PAVGB" - 4(%2, %0, 4), %%mm3 \n\t"
1812 "psrlw $8, %%mm0 \n\t"
1813 "psrlw $8, %%mm1 \n\t"
1814 "psrlw $8, %%mm2 \n\t"
1815 "psrlw $8, %%mm3 \n\t"
1816 "packuswb %%mm1, %%mm0 \n\t"
1817 "packuswb %%mm3, %%mm2 \n\t"
1818 "movq %%mm0, %%mm1 \n\t"
1819 "movq %%mm2, %%mm3 \n\t"
1820 "psrlw $8, %%mm0 \n\t"
1821 "psrlw $8, %%mm2 \n\t"
1822 "pand %%mm7, %%mm1 \n\t"
1823 "pand %%mm7, %%mm3 \n\t"
1824 "packuswb %%mm2, %%mm0 \n\t"
1825 "packuswb %%mm3, %%mm1 \n\t"
1826 MOVNTQ" %%mm0,- 7(%4, %0) \n\t"
1827 MOVNTQ" %%mm1,- 7(%3, %0) \n\t"
1828 "add $8, %0 \n\t"
1829 " js 1b \n\t"
1830 : "+r"(count)
1831 : "r"(src0), "r"(src1), "r"(dst0), "r"(dst1)
1832 );
1833 165 count -= 7;
1834 }
1835 #endif
1836 251 src0++;
1837 251 src1++;
1838
2/2
✓ Branch 0 taken 404 times.
✓ Branch 1 taken 251 times.
655 while(count<0) {
1839 404 dst0[count] = (src0[4*count+0]+src1[4*count+0]+1)>>1;
1840 404 dst1[count] = (src0[4*count+2]+src1[4*count+2]+1)>>1;
1841 404 count++;
1842 }
1843 251 }
1844
1845 17 static void yuyvtoyuv420_mmxext(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src,
1846 int width, int height,
1847 int lumStride, int chromStride, int srcStride)
1848 {
1849 17 const int chromWidth = AV_CEIL_RSHIFT(width, 1);
1850
1851
2/2
✓ Branch 0 taken 510 times.
✓ Branch 1 taken 17 times.
527 for (int y = 0; y < height; y++) {
1852 510 extract_even_mmxext(src, ydst, width);
1853
2/2
✓ Branch 0 taken 251 times.
✓ Branch 1 taken 259 times.
510 if(y&1) {
1854 251 extract_odd2avg_mmxext(src-srcStride, src, udst, vdst, chromWidth);
1855 251 udst+= chromStride;
1856 251 vdst+= chromStride;
1857 }
1858
1859 510 src += srcStride;
1860 510 ydst+= lumStride;
1861 }
1862 17 __asm__(
1863 EMMS" \n\t"
1864 SFENCE" \n\t"
1865 ::: "memory"
1866 );
1867 17 }
1868
1869 17 static void yuyvtoyuv422_mmxext(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src,
1870 int width, int height,
1871 int lumStride, int chromStride, int srcStride)
1872 {
1873 17 const int chromWidth = AV_CEIL_RSHIFT(width, 1);
1874
1875
2/2
✓ Branch 0 taken 510 times.
✓ Branch 1 taken 17 times.
527 for (int y = 0; y < height; y++) {
1876 510 extract_even_mmxext(src, ydst, width);
1877 510 extract_odd2_mmxext(src, udst, vdst, chromWidth);
1878
1879 510 src += srcStride;
1880 510 ydst+= lumStride;
1881 510 udst+= chromStride;
1882 510 vdst+= chromStride;
1883 }
1884 17 __asm__(
1885 EMMS" \n\t"
1886 SFENCE" \n\t"
1887 ::: "memory"
1888 );
1889 17 }
1890
1891 17 static void uyvytoyuv420_mmxext(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src,
1892 int width, int height,
1893 int lumStride, int chromStride, int srcStride)
1894 {
1895 17 const int chromWidth = AV_CEIL_RSHIFT(width, 1);
1896
1897
2/2
✓ Branch 0 taken 510 times.
✓ Branch 1 taken 17 times.
527 for (int y = 0; y < height; y++) {
1898 510 extract_odd_mmxext(src, ydst, width);
1899
2/2
✓ Branch 0 taken 251 times.
✓ Branch 1 taken 259 times.
510 if(y&1) {
1900 251 extract_even2avg_mmxext(src-srcStride, src, udst, vdst, chromWidth);
1901 251 udst+= chromStride;
1902 251 vdst+= chromStride;
1903 }
1904
1905 510 src += srcStride;
1906 510 ydst+= lumStride;
1907 }
1908 17 __asm__(
1909 EMMS" \n\t"
1910 SFENCE" \n\t"
1911 ::: "memory"
1912 );
1913 17 }
1914
1915 #if ARCH_X86_32
1916 static void uyvytoyuv422_mmxext(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src,
1917 int width, int height,
1918 int lumStride, int chromStride, int srcStride)
1919 {
1920 const int chromWidth = AV_CEIL_RSHIFT(width, 1);
1921
1922 for (int y = 0; y < height; y++) {
1923 extract_odd_mmxext(src, ydst, width);
1924 extract_even2_mmxext(src, udst, vdst, chromWidth);
1925
1926 src += srcStride;
1927 ydst+= lumStride;
1928 udst+= chromStride;
1929 vdst+= chromStride;
1930 }
1931 __asm__(
1932 EMMS" \n\t"
1933 SFENCE" \n\t"
1934 ::: "memory"
1935 );
1936 }
1937 #endif /* ARCH_X86_32 */
1938
1939 33 static av_cold void rgb2rgb_init_mmxext(void)
1940 {
1941 33 rgb15to16 = rgb15to16_mmxext;
1942 33 rgb15tobgr24 = rgb15tobgr24_mmxext;
1943 33 rgb15to32 = rgb15to32_mmxext;
1944 33 rgb16tobgr24 = rgb16tobgr24_mmxext;
1945 33 rgb16to32 = rgb16to32_mmxext;
1946 33 rgb16to15 = rgb16to15_mmxext;
1947 33 rgb24tobgr16 = rgb24tobgr16_mmxext;
1948 33 rgb24tobgr15 = rgb24tobgr15_mmxext;
1949 33 rgb24tobgr32 = rgb24tobgr32_mmxext;
1950 33 rgb32to16 = rgb32to16_mmxext;
1951 33 rgb32to15 = rgb32to15_mmxext;
1952 33 rgb32tobgr24 = rgb32tobgr24_mmxext;
1953 33 rgb24to15 = rgb24to15_mmxext;
1954 33 rgb24to16 = rgb24to16_mmxext;
1955 33 rgb24tobgr24 = rgb24tobgr24_mmxext;
1956 33 rgb32tobgr16 = rgb32tobgr16_mmxext;
1957 33 rgb32tobgr15 = rgb32tobgr15_mmxext;
1958 33 yv12toyuy2 = yv12toyuy2_mmxext;
1959 33 yv12touyvy = yv12touyvy_mmxext;
1960 33 yuv422ptoyuy2 = yuv422ptoyuy2_mmxext;
1961 33 yuv422ptouyvy = yuv422ptouyvy_mmxext;
1962 #if ARCH_X86_32
1963 uyvytoyuv422 = uyvytoyuv422_mmxext;
1964 #endif
1965 33 yuyvtoyuv422 = yuyvtoyuv422_mmxext;
1966
1967 33 planar2x = planar2x_mmxext;
1968 #if ARCH_X86_32 && HAVE_X86_7REGS
1969 ff_rgb24toyv12 = rgb24toyv12_mmxext;
1970 #endif /* ARCH_X86_32 && HAVE_X86_7REGS */
1971
1972 33 yuyvtoyuv420 = yuyvtoyuv420_mmxext;
1973 33 uyvytoyuv420 = uyvytoyuv420_mmxext;
1974 33 }
1975
1976 //SSE2 versions
1977 19 static void interleave_bytes_sse2(const uint8_t *src1, const uint8_t *src2, uint8_t *dest,
1978 int width, int height, int src1Stride,
1979 int src2Stride, int dstStride)
1980 {
1981
2/2
✓ Branch 0 taken 1531 times.
✓ Branch 1 taken 19 times.
1550 for (int h = 0; h < height; h++) {
1982
2/2
✓ Branch 0 taken 493 times.
✓ Branch 1 taken 1038 times.
1531 if (width >= 16) {
1983
2/2
✓ Branch 0 taken 128 times.
✓ Branch 1 taken 365 times.
493 if (!((((intptr_t)src1) | ((intptr_t)src2) | ((intptr_t)dest))&15)) {
1984 128 __asm__(
1985 "xor %%"FF_REG_a", %%"FF_REG_a" \n\t"
1986 "1: \n\t"
1987 PREFETCH" 64(%1, %%"FF_REG_a") \n\t"
1988 PREFETCH" 64(%2, %%"FF_REG_a") \n\t"
1989 "movdqa (%1, %%"FF_REG_a"), %%xmm0 \n\t"
1990 "movdqa (%1, %%"FF_REG_a"), %%xmm1 \n\t"
1991 "movdqa (%2, %%"FF_REG_a"), %%xmm2 \n\t"
1992 "punpcklbw %%xmm2, %%xmm0 \n\t"
1993 "punpckhbw %%xmm2, %%xmm1 \n\t"
1994 "movntdq %%xmm0, (%0, %%"FF_REG_a", 2) \n\t"
1995 "movntdq %%xmm1, 16(%0, %%"FF_REG_a", 2) \n\t"
1996 "add $16, %%"FF_REG_a" \n\t"
1997 "cmp %3, %%"FF_REG_a" \n\t"
1998 " jb 1b \n\t"
1999 128 ::"r"(dest), "r"(src1), "r"(src2), "r" ((x86_reg)width-15)
2000 : "memory", XMM_CLOBBERS("xmm0", "xmm1", "xmm2",) "%"FF_REG_a
2001 );
2002 } else
2003 365 __asm__(
2004 "xor %%"FF_REG_a", %%"FF_REG_a" \n\t"
2005 "1: \n\t"
2006 PREFETCH" 64(%1, %%"FF_REG_a") \n\t"
2007 PREFETCH" 64(%2, %%"FF_REG_a") \n\t"
2008 "movq (%1, %%"FF_REG_a"), %%mm0 \n\t"
2009 "movq 8(%1, %%"FF_REG_a"), %%mm2 \n\t"
2010 "movq %%mm0, %%mm1 \n\t"
2011 "movq %%mm2, %%mm3 \n\t"
2012 "movq (%2, %%"FF_REG_a"), %%mm4 \n\t"
2013 "movq 8(%2, %%"FF_REG_a"), %%mm5 \n\t"
2014 "punpcklbw %%mm4, %%mm0 \n\t"
2015 "punpckhbw %%mm4, %%mm1 \n\t"
2016 "punpcklbw %%mm5, %%mm2 \n\t"
2017 "punpckhbw %%mm5, %%mm3 \n\t"
2018 MOVNTQ" %%mm0, (%0, %%"FF_REG_a", 2) \n\t"
2019 MOVNTQ" %%mm1, 8(%0, %%"FF_REG_a", 2) \n\t"
2020 MOVNTQ" %%mm2, 16(%0, %%"FF_REG_a", 2) \n\t"
2021 MOVNTQ" %%mm3, 24(%0, %%"FF_REG_a", 2) \n\t"
2022 "add $16, %%"FF_REG_a" \n\t"
2023 "cmp %3, %%"FF_REG_a" \n\t"
2024 " jb 1b \n\t"
2025 365 ::"r"(dest), "r"(src1), "r"(src2), "r" ((x86_reg)width-15)
2026 : "memory", "%"FF_REG_a
2027 );
2028
2029 }
2030
2/2
✓ Branch 0 taken 11433 times.
✓ Branch 1 taken 1531 times.
12964 for (int w = (width & (~15)); w < width; w++) {
2031 11433 dest[2*w+0] = src1[w];
2032 11433 dest[2*w+1] = src2[w];
2033 }
2034 1531 dest += dstStride;
2035 1531 src1 += src1Stride;
2036 1531 src2 += src2Stride;
2037 }
2038 19 __asm__(
2039 EMMS" \n\t"
2040 SFENCE" \n\t"
2041 ::: "memory"
2042 );
2043 19 }
2044
2045 /*
2046 RGB15->RGB16 original by Strepto/Astral
2047 ported to gcc & bugfixed : A'rpi
2048 MMXEXT, 3DNOW optimization by Nick Kurshev
2049 32-bit C version, and and&add trick by Michael Niedermayer
2050 */
2051
2052 #endif /* HAVE_INLINE_ASM */
2053
2054 void ff_shuffle_bytes_2103_ssse3(const uint8_t *src, uint8_t *dst, int src_size);
2055 void ff_shuffle_bytes_0321_ssse3(const uint8_t *src, uint8_t *dst, int src_size);
2056 void ff_shuffle_bytes_1230_ssse3(const uint8_t *src, uint8_t *dst, int src_size);
2057 void ff_shuffle_bytes_3012_ssse3(const uint8_t *src, uint8_t *dst, int src_size);
2058 void ff_shuffle_bytes_3210_ssse3(const uint8_t *src, uint8_t *dst, int src_size);
2059 void ff_shuffle_bytes_3102_ssse3(const uint8_t *src, uint8_t *dst, int src_size);
2060 void ff_shuffle_bytes_2013_ssse3(const uint8_t *src, uint8_t *dst, int src_size);
2061 void ff_shuffle_bytes_2130_ssse3(const uint8_t *src, uint8_t *dst, int src_size);
2062 void ff_shuffle_bytes_1203_ssse3(const uint8_t *src, uint8_t *dst, int src_size);
2063
2064 #if ARCH_X86_64
2065 void ff_shuffle_bytes_2103_avx2(const uint8_t *src, uint8_t *dst, int src_size);
2066 void ff_shuffle_bytes_0321_avx2(const uint8_t *src, uint8_t *dst, int src_size);
2067 void ff_shuffle_bytes_1230_avx2(const uint8_t *src, uint8_t *dst, int src_size);
2068 void ff_shuffle_bytes_3012_avx2(const uint8_t *src, uint8_t *dst, int src_size);
2069 void ff_shuffle_bytes_3210_avx2(const uint8_t *src, uint8_t *dst, int src_size);
2070 void ff_shuffle_bytes_3102_avx2(const uint8_t *src, uint8_t *dst, int src_size);
2071 void ff_shuffle_bytes_2013_avx2(const uint8_t *src, uint8_t *dst, int src_size);
2072 void ff_shuffle_bytes_2130_avx2(const uint8_t *src, uint8_t *dst, int src_size);
2073 void ff_shuffle_bytes_1203_avx2(const uint8_t *src, uint8_t *dst, int src_size);
2074
2075 void ff_shuffle_bytes_2103_avx512icl(const uint8_t *src, uint8_t *dst, int src_size);
2076 void ff_shuffle_bytes_0321_avx512icl(const uint8_t *src, uint8_t *dst, int src_size);
2077 void ff_shuffle_bytes_1230_avx512icl(const uint8_t *src, uint8_t *dst, int src_size);
2078 void ff_shuffle_bytes_3012_avx512icl(const uint8_t *src, uint8_t *dst, int src_size);
2079 void ff_shuffle_bytes_3210_avx512icl(const uint8_t *src, uint8_t *dst, int src_size);
2080 void ff_shuffle_bytes_3102_avx512icl(const uint8_t *src, uint8_t *dst, int src_size);
2081 void ff_shuffle_bytes_2013_avx512icl(const uint8_t *src, uint8_t *dst, int src_size);
2082 void ff_shuffle_bytes_2130_avx512icl(const uint8_t *src, uint8_t *dst, int src_size);
2083 void ff_shuffle_bytes_1203_avx512icl(const uint8_t *src, uint8_t *dst, int src_size);
2084
2085 void ff_uyvytoyuv422_sse2(uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
2086 const uint8_t *src, int width, int height,
2087 int lumStride, int chromStride, int srcStride);
2088 void ff_uyvytoyuv422_avx(uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
2089 const uint8_t *src, int width, int height,
2090 int lumStride, int chromStride, int srcStride);
2091 void ff_uyvytoyuv422_avx2(uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
2092 const uint8_t *src, int width, int height,
2093 int lumStride, int chromStride, int srcStride);
2094 void ff_uyvytoyuv422_avx512icl(uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
2095 const uint8_t *src, int width, int height,
2096 int lumStride, int chromStride, int srcStride);
2097 #endif
2098
2099 #define DEINTERLEAVE_BYTES(cpuext) \
2100 void ff_nv12ToUV_ ## cpuext(uint8_t *dstU, uint8_t *dstV, \
2101 const uint8_t *unused, \
2102 const uint8_t *src1, \
2103 const uint8_t *src2, \
2104 int w, \
2105 uint32_t *unused2, \
2106 void *opq); \
2107 static void deinterleave_bytes_ ## cpuext(const uint8_t *src, uint8_t *dst1, uint8_t *dst2, \
2108 int width, int height, int srcStride, \
2109 int dst1Stride, int dst2Stride) \
2110 { \
2111 for (int h = 0; h < height; h++) { \
2112 if (width >= 16) \
2113 ff_nv12ToUV_ ## cpuext(dst1, dst2, NULL, src, NULL, width - 15, NULL, NULL); \
2114 for (int w = (width & (~15)); w < width; w++) { \
2115 dst1[w] = src[2*w+0]; \
2116 dst2[w] = src[2*w+1]; \
2117 } \
2118 src += srcStride; \
2119 dst1 += dst1Stride; \
2120 dst2 += dst2Stride; \
2121 } \
2122 }
2123
2124 #if HAVE_SSE2_EXTERNAL
2125
6/6
✓ Branch 0 taken 730 times.
✓ Branch 1 taken 2076 times.
✓ Branch 3 taken 20946 times.
✓ Branch 4 taken 2806 times.
✓ Branch 5 taken 2806 times.
✓ Branch 6 taken 36 times.
23788 DEINTERLEAVE_BYTES(sse2)
2126 #endif
2127 #if HAVE_AVX_EXTERNAL
2128
6/6
✓ Branch 0 taken 493 times.
✓ Branch 1 taken 1038 times.
✓ Branch 3 taken 11433 times.
✓ Branch 4 taken 1531 times.
✓ Branch 5 taken 1531 times.
✓ Branch 6 taken 19 times.
12983 DEINTERLEAVE_BYTES(avx)
2129 #endif
2130
2131 5221 av_cold void rgb2rgb_init_x86(void)
2132 {
2133 5221 int cpu_flags = av_get_cpu_flags();
2134
2135 #if HAVE_INLINE_ASM
2136
2/2
✓ Branch 0 taken 33 times.
✓ Branch 1 taken 5188 times.
5221 if (INLINE_MMXEXT(cpu_flags))
2137 33 rgb2rgb_init_mmxext();
2138
2/2
✓ Branch 0 taken 31 times.
✓ Branch 1 taken 5190 times.
5221 if (INLINE_SSE2(cpu_flags))
2139 31 interleaveBytes = interleave_bytes_sse2;
2140 #endif /* HAVE_INLINE_ASM */
2141
2142 #if HAVE_SSE2_EXTERNAL
2143
2/2
✓ Branch 0 taken 31 times.
✓ Branch 1 taken 5190 times.
5221 if (EXTERNAL_SSE2(cpu_flags)) {
2144 #if ARCH_X86_64
2145 31 uyvytoyuv422 = ff_uyvytoyuv422_sse2;
2146 #endif
2147 31 deinterleaveBytes = deinterleave_bytes_sse2;
2148 }
2149 #endif
2150
2/2
✓ Branch 0 taken 29 times.
✓ Branch 1 taken 5192 times.
5221 if (EXTERNAL_SSSE3(cpu_flags)) {
2151 29 shuffle_bytes_0321 = ff_shuffle_bytes_0321_ssse3;
2152 29 shuffle_bytes_2103 = ff_shuffle_bytes_2103_ssse3;
2153 29 shuffle_bytes_1230 = ff_shuffle_bytes_1230_ssse3;
2154 29 shuffle_bytes_3012 = ff_shuffle_bytes_3012_ssse3;
2155 29 shuffle_bytes_3210 = ff_shuffle_bytes_3210_ssse3;
2156 29 shuffle_bytes_3102 = ff_shuffle_bytes_3102_ssse3;
2157 29 shuffle_bytes_2013 = ff_shuffle_bytes_2013_ssse3;
2158 29 shuffle_bytes_2130 = ff_shuffle_bytes_2130_ssse3;
2159 29 shuffle_bytes_1203 = ff_shuffle_bytes_1203_ssse3;
2160 }
2161 #if HAVE_AVX_EXTERNAL
2162
2/2
✓ Branch 0 taken 24 times.
✓ Branch 1 taken 5197 times.
5221 if (EXTERNAL_AVX(cpu_flags)) {
2163 24 deinterleaveBytes = deinterleave_bytes_avx;
2164 #if ARCH_X86_64
2165 24 uyvytoyuv422 = ff_uyvytoyuv422_avx;
2166 }
2167
3/4
✓ Branch 0 taken 22 times.
✓ Branch 1 taken 5199 times.
✓ Branch 2 taken 22 times.
✗ Branch 3 not taken.
5221 if (EXTERNAL_AVX2_FAST(cpu_flags)) {
2168 22 shuffle_bytes_0321 = ff_shuffle_bytes_0321_avx2;
2169 22 shuffle_bytes_2103 = ff_shuffle_bytes_2103_avx2;
2170 22 shuffle_bytes_1230 = ff_shuffle_bytes_1230_avx2;
2171 22 shuffle_bytes_3012 = ff_shuffle_bytes_3012_avx2;
2172 22 shuffle_bytes_3210 = ff_shuffle_bytes_3210_avx2;
2173 22 shuffle_bytes_3102 = ff_shuffle_bytes_3102_avx2;
2174 22 shuffle_bytes_2013 = ff_shuffle_bytes_2013_avx2;
2175 22 shuffle_bytes_2130 = ff_shuffle_bytes_2130_avx2;
2176 22 shuffle_bytes_1203 = ff_shuffle_bytes_1203_avx2;
2177 }
2178
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5221 times.
5221 if (EXTERNAL_AVX512ICL(cpu_flags)) {
2179 ✗ shuffle_bytes_0321 = ff_shuffle_bytes_0321_avx512icl;
2180 ✗ shuffle_bytes_2103 = ff_shuffle_bytes_2103_avx512icl;
2181 ✗ shuffle_bytes_1230 = ff_shuffle_bytes_1230_avx512icl;
2182 ✗ shuffle_bytes_3012 = ff_shuffle_bytes_3012_avx512icl;
2183 ✗ shuffle_bytes_3210 = ff_shuffle_bytes_3210_avx512icl;
2184 ✗ shuffle_bytes_3102 = ff_shuffle_bytes_3102_avx512icl;
2185 ✗ shuffle_bytes_2013 = ff_shuffle_bytes_2013_avx512icl;
2186 ✗ shuffle_bytes_2130 = ff_shuffle_bytes_2130_avx512icl;
2187 ✗ shuffle_bytes_1203 = ff_shuffle_bytes_1203_avx512icl;
2188 }
2189
3/4
✓ Branch 0 taken 22 times.
✓ Branch 1 taken 5199 times.
✓ Branch 2 taken 22 times.
✗ Branch 3 not taken.
5221 if (EXTERNAL_AVX2_FAST(cpu_flags)) {
2190 22 uyvytoyuv422 = ff_uyvytoyuv422_avx2;
2191 }
2192
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5221 times.
5221 if (EXTERNAL_AVX512ICL(cpu_flags)) {
2193 ✗ uyvytoyuv422 = ff_uyvytoyuv422_avx512icl;
2194 #endif
2195 }
2196 #endif
2197 5221 }
2198