2 * Copyright (C) 2001-2011 Michael Niedermayer <michaelni@gmx.at>
4 * This file is part of FFmpeg.
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.
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.
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
23 #include "libswscale/swscale.h"
24 #include "libswscale/swscale_internal.h"
25 #include "libavutil/intreadwrite.h"
26 #include "libavutil/x86_cpu.h"
27 #include "libavutil/cpu.h"
28 #include "libavutil/pixdesc.h"
32 DECLARE_ASM_CONST(8, uint64_t, bF8)= 0xF8F8F8F8F8F8F8F8LL;
33 DECLARE_ASM_CONST(8, uint64_t, bFC)= 0xFCFCFCFCFCFCFCFCLL;
34 DECLARE_ASM_CONST(8, uint64_t, w10)= 0x0010001000100010LL;
35 DECLARE_ASM_CONST(8, uint64_t, w02)= 0x0002000200020002LL;
37 const DECLARE_ALIGNED(8, uint64_t, ff_dither4)[2] = {
39 0x0200020002000200LL,};
41 const DECLARE_ALIGNED(8, uint64_t, ff_dither8)[2] = {
43 0x0004000400040004LL,};
45 DECLARE_ASM_CONST(8, uint64_t, b16Mask)= 0x001F001F001F001FLL;
46 DECLARE_ASM_CONST(8, uint64_t, g16Mask)= 0x07E007E007E007E0LL;
47 DECLARE_ASM_CONST(8, uint64_t, r16Mask)= 0xF800F800F800F800LL;
48 DECLARE_ASM_CONST(8, uint64_t, b15Mask)= 0x001F001F001F001FLL;
49 DECLARE_ASM_CONST(8, uint64_t, g15Mask)= 0x03E003E003E003E0LL;
50 DECLARE_ASM_CONST(8, uint64_t, r15Mask)= 0x7C007C007C007C00LL;
52 DECLARE_ALIGNED(8, const uint64_t, ff_M24A) = 0x00FF0000FF0000FFLL;
53 DECLARE_ALIGNED(8, const uint64_t, ff_M24B) = 0xFF0000FF0000FF00LL;
54 DECLARE_ALIGNED(8, const uint64_t, ff_M24C) = 0x0000FF0000FF0000LL;
57 DECLARE_ALIGNED(8, const uint64_t, ff_bgr2YCoeff) = 0x000000210041000DULL;
58 DECLARE_ALIGNED(8, const uint64_t, ff_bgr2UCoeff) = 0x0000FFEEFFDC0038ULL;
59 DECLARE_ALIGNED(8, const uint64_t, ff_bgr2VCoeff) = 0x00000038FFD2FFF8ULL;
61 DECLARE_ALIGNED(8, const uint64_t, ff_bgr2YCoeff) = 0x000020E540830C8BULL;
62 DECLARE_ALIGNED(8, const uint64_t, ff_bgr2UCoeff) = 0x0000ED0FDAC23831ULL;
63 DECLARE_ALIGNED(8, const uint64_t, ff_bgr2VCoeff) = 0x00003831D0E6F6EAULL;
64 #endif /* FAST_BGR2YV12 */
65 DECLARE_ALIGNED(8, const uint64_t, ff_bgr2YOffset) = 0x1010101010101010ULL;
66 DECLARE_ALIGNED(8, const uint64_t, ff_bgr2UVOffset) = 0x8080808080808080ULL;
67 DECLARE_ALIGNED(8, const uint64_t, ff_w1111) = 0x0001000100010001ULL;
73 #define COMPILE_TEMPLATE_MMX2 0
74 #define RENAME(a) a ## _MMX
75 #include "swscale_template.c"
81 #undef COMPILE_TEMPLATE_MMX2
82 #define COMPILE_TEMPLATE_MMX2 1
83 #define RENAME(a) a ## _MMX2
84 #include "swscale_template.c"
87 void updateMMXDitherTables(SwsContext *c, int dstY, int lumBufIndex, int chrBufIndex,
88 int lastInLumBuf, int lastInChrBuf)
90 const int dstH= c->dstH;
91 const int flags= c->flags;
92 int16_t **lumPixBuf= c->lumPixBuf;
93 int16_t **chrUPixBuf= c->chrUPixBuf;
94 int16_t **alpPixBuf= c->alpPixBuf;
95 const int vLumBufSize= c->vLumBufSize;
96 const int vChrBufSize= c->vChrBufSize;
97 int16_t *vLumFilterPos= c->vLumFilterPos;
98 int16_t *vChrFilterPos= c->vChrFilterPos;
99 int16_t *vLumFilter= c->vLumFilter;
100 int16_t *vChrFilter= c->vChrFilter;
101 int32_t *lumMmxFilter= c->lumMmxFilter;
102 int32_t *chrMmxFilter= c->chrMmxFilter;
103 int32_t av_unused *alpMmxFilter= c->alpMmxFilter;
104 const int vLumFilterSize= c->vLumFilterSize;
105 const int vChrFilterSize= c->vChrFilterSize;
106 const int chrDstY= dstY>>c->chrDstVSubSample;
107 const int firstLumSrcY= vLumFilterPos[dstY]; //First line needed as input
108 const int firstChrSrcY= vChrFilterPos[chrDstY]; //First line needed as input
110 c->blueDither= ff_dither8[dstY&1];
111 if (c->dstFormat == PIX_FMT_RGB555 || c->dstFormat == PIX_FMT_BGR555)
112 c->greenDither= ff_dither8[dstY&1];
114 c->greenDither= ff_dither4[dstY&1];
115 c->redDither= ff_dither8[(dstY+1)&1];
116 if (dstY < dstH - 2) {
117 const int16_t **lumSrcPtr= (const int16_t **)(void*) lumPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize;
118 const int16_t **chrUSrcPtr= (const int16_t **)(void*) chrUPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize;
119 const int16_t **alpSrcPtr= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? (const int16_t **)(void*) alpPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize : NULL;
121 if (flags & SWS_ACCURATE_RND) {
122 int s= APCK_SIZE / 8;
123 for (i=0; i<vLumFilterSize; i+=2) {
124 *(const void**)&lumMmxFilter[s*i ]= lumSrcPtr[i ];
125 *(const void**)&lumMmxFilter[s*i+APCK_PTR2/4 ]= lumSrcPtr[i+(vLumFilterSize>1)];
126 lumMmxFilter[s*i+APCK_COEF/4 ]=
127 lumMmxFilter[s*i+APCK_COEF/4+1]= vLumFilter[dstY*vLumFilterSize + i ]
128 + (vLumFilterSize>1 ? vLumFilter[dstY*vLumFilterSize + i + 1]<<16 : 0);
129 if (CONFIG_SWSCALE_ALPHA && alpPixBuf) {
130 *(const void**)&alpMmxFilter[s*i ]= alpSrcPtr[i ];
131 *(const void**)&alpMmxFilter[s*i+APCK_PTR2/4 ]= alpSrcPtr[i+(vLumFilterSize>1)];
132 alpMmxFilter[s*i+APCK_COEF/4 ]=
133 alpMmxFilter[s*i+APCK_COEF/4+1]= lumMmxFilter[s*i+APCK_COEF/4 ];
136 for (i=0; i<vChrFilterSize; i+=2) {
137 *(const void**)&chrMmxFilter[s*i ]= chrUSrcPtr[i ];
138 *(const void**)&chrMmxFilter[s*i+APCK_PTR2/4 ]= chrUSrcPtr[i+(vChrFilterSize>1)];
139 chrMmxFilter[s*i+APCK_COEF/4 ]=
140 chrMmxFilter[s*i+APCK_COEF/4+1]= vChrFilter[chrDstY*vChrFilterSize + i ]
141 + (vChrFilterSize>1 ? vChrFilter[chrDstY*vChrFilterSize + i + 1]<<16 : 0);
144 for (i=0; i<vLumFilterSize; i++) {
145 *(const void**)&lumMmxFilter[4*i+0]= lumSrcPtr[i];
148 ((uint16_t)vLumFilter[dstY*vLumFilterSize + i])*0x10001;
149 if (CONFIG_SWSCALE_ALPHA && alpPixBuf) {
150 *(const void**)&alpMmxFilter[4*i+0]= alpSrcPtr[i];
152 alpMmxFilter[4*i+3]= lumMmxFilter[4*i+2];
155 for (i=0; i<vChrFilterSize; i++) {
156 *(const void**)&chrMmxFilter[4*i+0]= chrUSrcPtr[i];
159 ((uint16_t)vChrFilter[chrDstY*vChrFilterSize + i])*0x10001;
166 static void yuv2yuvX_sse3(const int16_t *filter, int filterSize,
167 const int16_t **src, uint8_t *dest, int dstW,
168 const uint8_t *dither, int offset)
170 if(((int)dest) & 15){
171 return yuv2yuvX_MMX2(filter, filterSize, src, dest, dstW, dither, offset);
174 __asm__ volatile("movq (%0), %%xmm3\n\t"
175 "movdqa %%xmm3, %%xmm4\n\t"
176 "psrlq $24, %%xmm3\n\t"
177 "psllq $40, %%xmm4\n\t"
178 "por %%xmm4, %%xmm3\n\t"
182 __asm__ volatile("movq (%0), %%xmm3\n\t"
187 "pxor %%xmm0, %%xmm0\n\t"
188 "punpcklbw %%xmm0, %%xmm3\n\t"
189 "psraw $4, %%xmm3\n\t"
190 "movdqa %%xmm3, %%xmm4\n\t"
191 "movdqa %%xmm3, %%xmm7\n\t"
193 "mov %0, %%"REG_d" \n\t"\
194 "mov (%%"REG_d"), %%"REG_S" \n\t"\
195 ".p2align 4 \n\t" /* FIXME Unroll? */\
197 "movddup 8(%%"REG_d"), %%xmm0 \n\t" /* filterCoeff */\
198 "movdqa (%%"REG_S", %%"REG_c", 2), %%xmm2 \n\t" /* srcData */\
199 "movdqa 16(%%"REG_S", %%"REG_c", 2), %%xmm5 \n\t" /* srcData */\
200 "add $16, %%"REG_d" \n\t"\
201 "mov (%%"REG_d"), %%"REG_S" \n\t"\
202 "test %%"REG_S", %%"REG_S" \n\t"\
203 "pmulhw %%xmm0, %%xmm2 \n\t"\
204 "pmulhw %%xmm0, %%xmm5 \n\t"\
205 "paddw %%xmm2, %%xmm3 \n\t"\
206 "paddw %%xmm5, %%xmm4 \n\t"\
208 "psraw $3, %%xmm3 \n\t"\
209 "psraw $3, %%xmm4 \n\t"\
210 "packuswb %%xmm4, %%xmm3 \n\t"
211 "movntdq %%xmm3, (%1, %%"REG_c")\n\t"
212 "add $16, %%"REG_c" \n\t"\
213 "cmp %2, %%"REG_c" \n\t"\
214 "movdqa %%xmm7, %%xmm3\n\t"
215 "movdqa %%xmm7, %%xmm4\n\t"
216 "mov %0, %%"REG_d" \n\t"\
217 "mov (%%"REG_d"), %%"REG_S" \n\t"\
220 "r" (dest-offset), "g" ((x86_reg)(dstW+offset)), "m" (offset)
221 : "%"REG_d, "%"REG_S, "%"REG_c
226 #define SCALE_FUNC(filter_n, from_bpc, to_bpc, opt) \
227 extern void ff_hscale ## from_bpc ## to ## to_bpc ## _ ## filter_n ## _ ## opt( \
228 SwsContext *c, int16_t *data, \
229 int dstW, const uint8_t *src, \
230 const int16_t *filter, \
231 const int16_t *filterPos, int filterSize)
233 #define SCALE_FUNCS(filter_n, opt) \
234 SCALE_FUNC(filter_n, 8, 15, opt); \
235 SCALE_FUNC(filter_n, 9, 15, opt); \
236 SCALE_FUNC(filter_n, 10, 15, opt); \
237 SCALE_FUNC(filter_n, 14, 15, opt); \
238 SCALE_FUNC(filter_n, 16, 15, opt); \
239 SCALE_FUNC(filter_n, 8, 19, opt); \
240 SCALE_FUNC(filter_n, 9, 19, opt); \
241 SCALE_FUNC(filter_n, 10, 19, opt); \
242 SCALE_FUNC(filter_n, 14, 19, opt); \
243 SCALE_FUNC(filter_n, 16, 19, opt)
245 #define SCALE_FUNCS_MMX(opt) \
246 SCALE_FUNCS(4, opt); \
247 SCALE_FUNCS(8, opt); \
250 #define SCALE_FUNCS_SSE(opt) \
251 SCALE_FUNCS(4, opt); \
252 SCALE_FUNCS(8, opt); \
253 SCALE_FUNCS(X4, opt); \
257 SCALE_FUNCS_MMX(mmx);
259 SCALE_FUNCS_SSE(sse2);
260 SCALE_FUNCS_SSE(ssse3);
261 SCALE_FUNCS_SSE(sse4);
263 #define VSCALEX_FUNC(size, opt) \
264 extern void ff_yuv2planeX_ ## size ## _ ## opt(const int16_t *filter, int filterSize, \
265 const int16_t **src, uint8_t *dest, int dstW, \
266 const uint8_t *dither, int offset)
267 #define VSCALEX_FUNCS(opt) \
268 VSCALEX_FUNC(8, opt); \
269 VSCALEX_FUNC(9, opt); \
270 VSCALEX_FUNC(10, opt)
277 VSCALEX_FUNC(16, sse4);
280 #define VSCALE_FUNC(size, opt) \
281 extern void ff_yuv2plane1_ ## size ## _ ## opt(const int16_t *src, uint8_t *dst, int dstW, \
282 const uint8_t *dither, int offset)
283 #define VSCALE_FUNCS(opt1, opt2) \
284 VSCALE_FUNC(8, opt1); \
285 VSCALE_FUNC(9, opt2); \
286 VSCALE_FUNC(10, opt2); \
287 VSCALE_FUNC(16, opt1)
290 VSCALE_FUNCS(mmx, mmx2);
292 VSCALE_FUNCS(sse2, sse2);
293 VSCALE_FUNC(16, sse4);
294 VSCALE_FUNCS(avx, avx);
296 #define INPUT_Y_FUNC(fmt, opt) \
297 extern void ff_ ## fmt ## ToY_ ## opt(uint8_t *dst, const uint8_t *src, \
298 int w, uint32_t *unused)
299 #define INPUT_UV_FUNC(fmt, opt) \
300 extern void ff_ ## fmt ## ToUV_ ## opt(uint8_t *dstU, uint8_t *dstV, \
301 const uint8_t *src, const uint8_t *unused1, \
302 int w, uint32_t *unused2)
303 #define INPUT_FUNC(fmt, opt) \
304 INPUT_Y_FUNC(fmt, opt); \
305 INPUT_UV_FUNC(fmt, opt)
306 #define INPUT_FUNCS(opt) \
307 INPUT_FUNC(uyvy, opt); \
308 INPUT_FUNC(yuyv, opt); \
309 INPUT_UV_FUNC(nv12, opt); \
310 INPUT_UV_FUNC(nv21, opt); \
311 INPUT_FUNC(rgba, opt); \
312 INPUT_FUNC(bgra, opt); \
313 INPUT_FUNC(argb, opt); \
314 INPUT_FUNC(abgr, opt); \
315 INPUT_FUNC(rgb24, opt); \
316 INPUT_FUNC(bgr24, opt)
325 void ff_sws_init_swScale_mmx(SwsContext *c)
327 int cpu_flags = av_get_cpu_flags();
329 if (cpu_flags & AV_CPU_FLAG_MMX)
330 sws_init_swScale_MMX(c);
332 if (cpu_flags & AV_CPU_FLAG_MMX2)
333 sws_init_swScale_MMX2(c);
334 if (cpu_flags & AV_CPU_FLAG_SSE3){
335 if(c->use_mmx_vfilter && !(c->flags & SWS_ACCURATE_RND))
336 c->yuv2planeX = yuv2yuvX_sse3;
341 #define ASSIGN_SCALE_FUNC2(hscalefn, filtersize, opt1, opt2) do { \
342 if (c->srcBpc == 8) { \
343 hscalefn = c->dstBpc <= 10 ? ff_hscale8to15_ ## filtersize ## _ ## opt2 : \
344 ff_hscale8to19_ ## filtersize ## _ ## opt1; \
345 } else if (c->srcBpc == 9) { \
346 hscalefn = c->dstBpc <= 10 ? ff_hscale9to15_ ## filtersize ## _ ## opt2 : \
347 ff_hscale9to19_ ## filtersize ## _ ## opt1; \
348 } else if (c->srcBpc == 10) { \
349 hscalefn = c->dstBpc <= 10 ? ff_hscale10to15_ ## filtersize ## _ ## opt2 : \
350 ff_hscale10to19_ ## filtersize ## _ ## opt1; \
351 } else if (c->srcBpc == 14 || ((c->srcFormat==PIX_FMT_PAL8||isAnyRGB(c->srcFormat)) && av_pix_fmt_descriptors[c->srcFormat].comp[0].depth_minus1<15)) { \
352 hscalefn = c->dstBpc <= 10 ? ff_hscale14to15_ ## filtersize ## _ ## opt2 : \
353 ff_hscale14to19_ ## filtersize ## _ ## opt1; \
354 } else { /* c->srcBpc == 16 */ \
355 hscalefn = c->dstBpc <= 10 ? ff_hscale16to15_ ## filtersize ## _ ## opt2 : \
356 ff_hscale16to19_ ## filtersize ## _ ## opt1; \
359 #define ASSIGN_MMX_SCALE_FUNC(hscalefn, filtersize, opt1, opt2) \
360 switch (filtersize) { \
361 case 4: ASSIGN_SCALE_FUNC2(hscalefn, 4, opt1, opt2); break; \
362 case 8: ASSIGN_SCALE_FUNC2(hscalefn, 8, opt1, opt2); break; \
363 default: ASSIGN_SCALE_FUNC2(hscalefn, X, opt1, opt2); break; \
365 #define ASSIGN_VSCALEX_FUNC(vscalefn, opt, do_16_case) \
367 case 16: /*do_16_case;*/ break; \
368 case 10: if (!isBE(c->dstFormat)) /*vscalefn = ff_yuv2planeX_10_ ## opt;*/ break; \
369 case 9: if (!isBE(c->dstFormat)) /*vscalefn = ff_yuv2planeX_9_ ## opt;*/ break; \
370 default: /*vscalefn = ff_yuv2planeX_8_ ## opt;*/ break; \
372 #define ASSIGN_VSCALE_FUNC(vscalefn, opt1, opt2, opt2chk) \
374 case 16: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2plane1_16_ ## opt1; break; \
375 case 10: if (!isBE(c->dstFormat) && opt2chk) vscalefn = ff_yuv2plane1_10_ ## opt2; break; \
376 case 9: if (!isBE(c->dstFormat) && opt2chk) vscalefn = ff_yuv2plane1_9_ ## opt2; break; \
377 default: vscalefn = ff_yuv2plane1_8_ ## opt1; break; \
379 #define case_rgb(x, X, opt) \
380 case PIX_FMT_ ## X: \
381 c->lumToYV12 = ff_ ## x ## ToY_ ## opt; \
382 if (!c->chrSrcHSubSample) \
383 c->chrToYV12 = ff_ ## x ## ToUV_ ## opt; \
386 if (cpu_flags & AV_CPU_FLAG_MMX) {
387 ASSIGN_MMX_SCALE_FUNC(c->hyScale, c->hLumFilterSize, mmx, mmx);
388 ASSIGN_MMX_SCALE_FUNC(c->hcScale, c->hChrFilterSize, mmx, mmx);
389 ASSIGN_VSCALE_FUNC(c->yuv2plane1, mmx, mmx2, cpu_flags & AV_CPU_FLAG_MMX2);
391 switch (c->srcFormat) {
393 c->lumToYV12 = ff_yuyvToY_mmx;
395 c->alpToYV12 = ff_uyvyToY_mmx;
397 case PIX_FMT_YUYV422:
398 c->lumToYV12 = ff_yuyvToY_mmx;
399 c->chrToYV12 = ff_yuyvToUV_mmx;
401 case PIX_FMT_UYVY422:
402 c->lumToYV12 = ff_uyvyToY_mmx;
403 c->chrToYV12 = ff_uyvyToUV_mmx;
406 c->chrToYV12 = ff_nv12ToUV_mmx;
409 c->chrToYV12 = ff_nv21ToUV_mmx;
411 case_rgb(rgb24, RGB24, mmx);
412 case_rgb(bgr24, BGR24, mmx);
413 case_rgb(bgra, BGRA, mmx);
414 case_rgb(rgba, RGBA, mmx);
415 case_rgb(abgr, ABGR, mmx);
416 case_rgb(argb, ARGB, mmx);
421 if (cpu_flags & AV_CPU_FLAG_MMX2) {
422 ASSIGN_VSCALEX_FUNC(c->yuv2planeX, mmx2,);
425 #define ASSIGN_SSE_SCALE_FUNC(hscalefn, filtersize, opt1, opt2) \
426 switch (filtersize) { \
427 case 4: ASSIGN_SCALE_FUNC2(hscalefn, 4, opt1, opt2); break; \
428 case 8: ASSIGN_SCALE_FUNC2(hscalefn, 8, opt1, opt2); break; \
429 default: if (filtersize & 4) ASSIGN_SCALE_FUNC2(hscalefn, X4, opt1, opt2); \
430 else ASSIGN_SCALE_FUNC2(hscalefn, X8, opt1, opt2); \
433 if (cpu_flags & AV_CPU_FLAG_SSE2) {
434 ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, sse2, sse2);
435 ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, sse2, sse2);
436 ASSIGN_VSCALEX_FUNC(c->yuv2planeX, sse2,);
437 ASSIGN_VSCALE_FUNC(c->yuv2plane1, sse2, sse2, 1);
439 switch (c->srcFormat) {
441 c->lumToYV12 = ff_yuyvToY_sse2;
443 c->alpToYV12 = ff_uyvyToY_sse2;
445 case PIX_FMT_YUYV422:
446 c->lumToYV12 = ff_yuyvToY_sse2;
447 c->chrToYV12 = ff_yuyvToUV_sse2;
449 case PIX_FMT_UYVY422:
450 c->lumToYV12 = ff_uyvyToY_sse2;
451 c->chrToYV12 = ff_uyvyToUV_sse2;
454 c->chrToYV12 = ff_nv12ToUV_sse2;
457 c->chrToYV12 = ff_nv21ToUV_sse2;
459 case_rgb(rgb24, RGB24, sse2);
460 case_rgb(bgr24, BGR24, sse2);
461 case_rgb(bgra, BGRA, sse2);
462 case_rgb(rgba, RGBA, sse2);
463 case_rgb(abgr, ABGR, sse2);
464 case_rgb(argb, ARGB, sse2);
469 if (cpu_flags & AV_CPU_FLAG_SSSE3) {
470 ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, ssse3, ssse3);
471 ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, ssse3, ssse3);
472 switch (c->srcFormat) {
473 case_rgb(rgb24, RGB24, ssse3);
474 case_rgb(bgr24, BGR24, ssse3);
479 if (cpu_flags & AV_CPU_FLAG_SSE4) {
480 /* Xto15 don't need special sse4 functions */
481 ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, sse4, ssse3);
482 ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, sse4, ssse3);
483 ASSIGN_VSCALEX_FUNC(c->yuv2planeX, sse4,
484 if (!isBE(c->dstFormat)) c->yuv2planeX = ff_yuv2planeX_16_sse4);
485 if (c->dstBpc == 16 && !isBE(c->dstFormat))
486 c->yuv2plane1 = ff_yuv2plane1_16_sse4;
489 if (HAVE_AVX && cpu_flags & AV_CPU_FLAG_AVX) {
490 ASSIGN_VSCALEX_FUNC(c->yuv2planeX, avx,);
491 ASSIGN_VSCALE_FUNC(c->yuv2plane1, avx, avx, 1);
493 switch (c->srcFormat) {
494 case PIX_FMT_YUYV422:
495 c->chrToYV12 = ff_yuyvToUV_avx;
497 case PIX_FMT_UYVY422:
498 c->chrToYV12 = ff_uyvyToUV_avx;
501 c->chrToYV12 = ff_nv12ToUV_avx;
504 c->chrToYV12 = ff_nv21ToUV_avx;
506 case_rgb(rgb24, RGB24, avx);
507 case_rgb(bgr24, BGR24, avx);
508 case_rgb(bgra, BGRA, avx);
509 case_rgb(rgba, RGBA, avx);
510 case_rgb(abgr, ABGR, avx);
511 case_rgb(argb, ARGB, avx);