You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

447 lines
17KB

  1. /*
  2. * Copyright (C) 2001-2003 Michael Niedermayer <michaelni@gmx.at>
  3. *
  4. * This file is part of Libav.
  5. *
  6. * Libav is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * Libav is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with Libav; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #include <inttypes.h>
  21. #include "config.h"
  22. #include "libswscale/swscale.h"
  23. #include "libswscale/swscale_internal.h"
  24. #include "libavutil/intreadwrite.h"
  25. #include "libavutil/x86_cpu.h"
  26. #include "libavutil/cpu.h"
  27. #include "libavutil/pixdesc.h"
  28. #define DITHER1XBPP
  29. DECLARE_ASM_CONST(8, uint64_t, bF8)= 0xF8F8F8F8F8F8F8F8LL;
  30. DECLARE_ASM_CONST(8, uint64_t, bFC)= 0xFCFCFCFCFCFCFCFCLL;
  31. DECLARE_ASM_CONST(8, uint64_t, w10)= 0x0010001000100010LL;
  32. DECLARE_ASM_CONST(8, uint64_t, w02)= 0x0002000200020002LL;
  33. const DECLARE_ALIGNED(8, uint64_t, ff_dither4)[2] = {
  34. 0x0103010301030103LL,
  35. 0x0200020002000200LL,};
  36. const DECLARE_ALIGNED(8, uint64_t, ff_dither8)[2] = {
  37. 0x0602060206020602LL,
  38. 0x0004000400040004LL,};
  39. DECLARE_ASM_CONST(8, uint64_t, b16Mask)= 0x001F001F001F001FLL;
  40. DECLARE_ASM_CONST(8, uint64_t, g16Mask)= 0x07E007E007E007E0LL;
  41. DECLARE_ASM_CONST(8, uint64_t, r16Mask)= 0xF800F800F800F800LL;
  42. DECLARE_ASM_CONST(8, uint64_t, b15Mask)= 0x001F001F001F001FLL;
  43. DECLARE_ASM_CONST(8, uint64_t, g15Mask)= 0x03E003E003E003E0LL;
  44. DECLARE_ASM_CONST(8, uint64_t, r15Mask)= 0x7C007C007C007C00LL;
  45. DECLARE_ALIGNED(8, const uint64_t, ff_M24A) = 0x00FF0000FF0000FFLL;
  46. DECLARE_ALIGNED(8, const uint64_t, ff_M24B) = 0xFF0000FF0000FF00LL;
  47. DECLARE_ALIGNED(8, const uint64_t, ff_M24C) = 0x0000FF0000FF0000LL;
  48. #ifdef FAST_BGR2YV12
  49. DECLARE_ALIGNED(8, const uint64_t, ff_bgr2YCoeff) = 0x000000210041000DULL;
  50. DECLARE_ALIGNED(8, const uint64_t, ff_bgr2UCoeff) = 0x0000FFEEFFDC0038ULL;
  51. DECLARE_ALIGNED(8, const uint64_t, ff_bgr2VCoeff) = 0x00000038FFD2FFF8ULL;
  52. #else
  53. DECLARE_ALIGNED(8, const uint64_t, ff_bgr2YCoeff) = 0x000020E540830C8BULL;
  54. DECLARE_ALIGNED(8, const uint64_t, ff_bgr2UCoeff) = 0x0000ED0FDAC23831ULL;
  55. DECLARE_ALIGNED(8, const uint64_t, ff_bgr2VCoeff) = 0x00003831D0E6F6EAULL;
  56. #endif /* FAST_BGR2YV12 */
  57. DECLARE_ALIGNED(8, const uint64_t, ff_bgr2YOffset) = 0x1010101010101010ULL;
  58. DECLARE_ALIGNED(8, const uint64_t, ff_bgr2UVOffset) = 0x8080808080808080ULL;
  59. DECLARE_ALIGNED(8, const uint64_t, ff_w1111) = 0x0001000100010001ULL;
  60. //MMX versions
  61. #if HAVE_MMX
  62. #undef RENAME
  63. #define COMPILE_TEMPLATE_MMX2 0
  64. #define RENAME(a) a ## _MMX
  65. #include "swscale_template.c"
  66. #endif
  67. //MMX2 versions
  68. #if HAVE_MMX2
  69. #undef RENAME
  70. #undef COMPILE_TEMPLATE_MMX2
  71. #define COMPILE_TEMPLATE_MMX2 1
  72. #define RENAME(a) a ## _MMX2
  73. #include "swscale_template.c"
  74. #endif
  75. void updateMMXDitherTables(SwsContext *c, int dstY, int lumBufIndex, int chrBufIndex,
  76. int lastInLumBuf, int lastInChrBuf)
  77. {
  78. const int dstH= c->dstH;
  79. const int flags= c->flags;
  80. int16_t **lumPixBuf= c->lumPixBuf;
  81. int16_t **chrUPixBuf= c->chrUPixBuf;
  82. int16_t **alpPixBuf= c->alpPixBuf;
  83. const int vLumBufSize= c->vLumBufSize;
  84. const int vChrBufSize= c->vChrBufSize;
  85. int16_t *vLumFilterPos= c->vLumFilterPos;
  86. int16_t *vChrFilterPos= c->vChrFilterPos;
  87. int16_t *vLumFilter= c->vLumFilter;
  88. int16_t *vChrFilter= c->vChrFilter;
  89. int32_t *lumMmxFilter= c->lumMmxFilter;
  90. int32_t *chrMmxFilter= c->chrMmxFilter;
  91. int32_t av_unused *alpMmxFilter= c->alpMmxFilter;
  92. const int vLumFilterSize= c->vLumFilterSize;
  93. const int vChrFilterSize= c->vChrFilterSize;
  94. const int chrDstY= dstY>>c->chrDstVSubSample;
  95. const int firstLumSrcY= vLumFilterPos[dstY]; //First line needed as input
  96. const int firstChrSrcY= vChrFilterPos[chrDstY]; //First line needed as input
  97. c->blueDither= ff_dither8[dstY&1];
  98. if (c->dstFormat == PIX_FMT_RGB555 || c->dstFormat == PIX_FMT_BGR555)
  99. c->greenDither= ff_dither8[dstY&1];
  100. else
  101. c->greenDither= ff_dither4[dstY&1];
  102. c->redDither= ff_dither8[(dstY+1)&1];
  103. if (dstY < dstH - 2) {
  104. const int16_t **lumSrcPtr= (const int16_t **) lumPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize;
  105. const int16_t **chrUSrcPtr= (const int16_t **) chrUPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize;
  106. const int16_t **alpSrcPtr= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? (const int16_t **) alpPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize : NULL;
  107. int i;
  108. if (flags & SWS_ACCURATE_RND) {
  109. int s= APCK_SIZE / 8;
  110. for (i=0; i<vLumFilterSize; i+=2) {
  111. *(const void**)&lumMmxFilter[s*i ]= lumSrcPtr[i ];
  112. *(const void**)&lumMmxFilter[s*i+APCK_PTR2/4 ]= lumSrcPtr[i+(vLumFilterSize>1)];
  113. lumMmxFilter[s*i+APCK_COEF/4 ]=
  114. lumMmxFilter[s*i+APCK_COEF/4+1]= vLumFilter[dstY*vLumFilterSize + i ]
  115. + (vLumFilterSize>1 ? vLumFilter[dstY*vLumFilterSize + i + 1]<<16 : 0);
  116. if (CONFIG_SWSCALE_ALPHA && alpPixBuf) {
  117. *(const void**)&alpMmxFilter[s*i ]= alpSrcPtr[i ];
  118. *(const void**)&alpMmxFilter[s*i+APCK_PTR2/4 ]= alpSrcPtr[i+(vLumFilterSize>1)];
  119. alpMmxFilter[s*i+APCK_COEF/4 ]=
  120. alpMmxFilter[s*i+APCK_COEF/4+1]= lumMmxFilter[s*i+APCK_COEF/4 ];
  121. }
  122. }
  123. for (i=0; i<vChrFilterSize; i+=2) {
  124. *(const void**)&chrMmxFilter[s*i ]= chrUSrcPtr[i ];
  125. *(const void**)&chrMmxFilter[s*i+APCK_PTR2/4 ]= chrUSrcPtr[i+(vChrFilterSize>1)];
  126. chrMmxFilter[s*i+APCK_COEF/4 ]=
  127. chrMmxFilter[s*i+APCK_COEF/4+1]= vChrFilter[chrDstY*vChrFilterSize + i ]
  128. + (vChrFilterSize>1 ? vChrFilter[chrDstY*vChrFilterSize + i + 1]<<16 : 0);
  129. }
  130. } else {
  131. for (i=0; i<vLumFilterSize; i++) {
  132. *(const void**)&lumMmxFilter[4*i+0]= lumSrcPtr[i];
  133. lumMmxFilter[4*i+2]=
  134. lumMmxFilter[4*i+3]=
  135. ((uint16_t)vLumFilter[dstY*vLumFilterSize + i])*0x10001;
  136. if (CONFIG_SWSCALE_ALPHA && alpPixBuf) {
  137. *(const void**)&alpMmxFilter[4*i+0]= alpSrcPtr[i];
  138. alpMmxFilter[4*i+2]=
  139. alpMmxFilter[4*i+3]= lumMmxFilter[4*i+2];
  140. }
  141. }
  142. for (i=0; i<vChrFilterSize; i++) {
  143. *(const void**)&chrMmxFilter[4*i+0]= chrUSrcPtr[i];
  144. chrMmxFilter[4*i+2]=
  145. chrMmxFilter[4*i+3]=
  146. ((uint16_t)vChrFilter[chrDstY*vChrFilterSize + i])*0x10001;
  147. }
  148. }
  149. }
  150. }
  151. #define SCALE_FUNC(filter_n, from_bpc, to_bpc, opt) \
  152. extern void ff_hscale ## from_bpc ## to ## to_bpc ## _ ## filter_n ## _ ## opt( \
  153. SwsContext *c, int16_t *data, \
  154. int dstW, const uint8_t *src, \
  155. const int16_t *filter, \
  156. const int16_t *filterPos, int filterSize)
  157. #define SCALE_FUNCS(filter_n, opt) \
  158. SCALE_FUNC(filter_n, 8, 15, opt); \
  159. SCALE_FUNC(filter_n, 9, 15, opt); \
  160. SCALE_FUNC(filter_n, 10, 15, opt); \
  161. SCALE_FUNC(filter_n, 16, 15, opt); \
  162. SCALE_FUNC(filter_n, 8, 19, opt); \
  163. SCALE_FUNC(filter_n, 9, 19, opt); \
  164. SCALE_FUNC(filter_n, 10, 19, opt); \
  165. SCALE_FUNC(filter_n, 16, 19, opt)
  166. #define SCALE_FUNCS_MMX(opt) \
  167. SCALE_FUNCS(4, opt); \
  168. SCALE_FUNCS(8, opt); \
  169. SCALE_FUNCS(X, opt)
  170. #define SCALE_FUNCS_SSE(opt) \
  171. SCALE_FUNCS(4, opt); \
  172. SCALE_FUNCS(8, opt); \
  173. SCALE_FUNCS(X4, opt); \
  174. SCALE_FUNCS(X8, opt)
  175. #if ARCH_X86_32
  176. SCALE_FUNCS_MMX(mmx);
  177. #endif
  178. SCALE_FUNCS_SSE(sse2);
  179. SCALE_FUNCS_SSE(ssse3);
  180. SCALE_FUNCS_SSE(sse4);
  181. #define VSCALEX_FUNC(size, opt) \
  182. extern void ff_yuv2planeX_ ## size ## _ ## opt(const int16_t *filter, int filterSize, \
  183. const int16_t **src, uint8_t *dest, int dstW, \
  184. const uint8_t *dither, int offset)
  185. #define VSCALEX_FUNCS(opt) \
  186. VSCALEX_FUNC(8, opt); \
  187. VSCALEX_FUNC(9, opt); \
  188. VSCALEX_FUNC(10, opt)
  189. #if ARCH_X86_32
  190. VSCALEX_FUNCS(mmx2);
  191. #endif
  192. VSCALEX_FUNCS(sse2);
  193. VSCALEX_FUNCS(sse4);
  194. VSCALEX_FUNC(16, sse4);
  195. VSCALEX_FUNCS(avx);
  196. #define VSCALE_FUNC(size, opt) \
  197. extern void ff_yuv2plane1_ ## size ## _ ## opt(const int16_t *src, uint8_t *dst, int dstW, \
  198. const uint8_t *dither, int offset)
  199. #define VSCALE_FUNCS(opt1, opt2) \
  200. VSCALE_FUNC(8, opt1); \
  201. VSCALE_FUNC(9, opt2); \
  202. VSCALE_FUNC(10, opt2); \
  203. VSCALE_FUNC(16, opt1)
  204. #if ARCH_X86_32
  205. VSCALE_FUNCS(mmx, mmx2);
  206. #endif
  207. VSCALE_FUNCS(sse2, sse2);
  208. VSCALE_FUNC(16, sse4);
  209. VSCALE_FUNCS(avx, avx);
  210. #define INPUT_Y_FUNC(fmt, opt) \
  211. extern void ff_ ## fmt ## ToY_ ## opt(uint8_t *dst, const uint8_t *src, \
  212. int w, uint32_t *unused)
  213. #define INPUT_UV_FUNC(fmt, opt) \
  214. extern void ff_ ## fmt ## ToUV_ ## opt(uint8_t *dstU, uint8_t *dstV, \
  215. const uint8_t *src, const uint8_t *unused1, \
  216. int w, uint32_t *unused2)
  217. #define INPUT_FUNC(fmt, opt) \
  218. INPUT_Y_FUNC(fmt, opt); \
  219. INPUT_UV_FUNC(fmt, opt)
  220. #define INPUT_FUNCS(opt) \
  221. INPUT_FUNC(uyvy, opt); \
  222. INPUT_FUNC(yuyv, opt); \
  223. INPUT_UV_FUNC(nv12, opt); \
  224. INPUT_UV_FUNC(nv21, opt); \
  225. INPUT_FUNC(rgba, opt); \
  226. INPUT_FUNC(bgra, opt); \
  227. INPUT_FUNC(argb, opt); \
  228. INPUT_FUNC(abgr, opt); \
  229. INPUT_FUNC(rgb24, opt); \
  230. INPUT_FUNC(bgr24, opt)
  231. #if ARCH_X86_32
  232. INPUT_FUNCS(mmx);
  233. #endif
  234. INPUT_FUNCS(sse2);
  235. INPUT_FUNCS(ssse3);
  236. INPUT_FUNCS(avx);
  237. void ff_sws_init_swScale_mmx(SwsContext *c)
  238. {
  239. int cpu_flags = av_get_cpu_flags();
  240. if (cpu_flags & AV_CPU_FLAG_MMX)
  241. sws_init_swScale_MMX(c);
  242. #if HAVE_MMX2
  243. if (cpu_flags & AV_CPU_FLAG_MMX2)
  244. sws_init_swScale_MMX2(c);
  245. #endif
  246. #if HAVE_YASM
  247. #define ASSIGN_SCALE_FUNC2(hscalefn, filtersize, opt1, opt2) do { \
  248. if (c->srcBpc == 8) { \
  249. hscalefn = c->dstBpc <= 10 ? ff_hscale8to15_ ## filtersize ## _ ## opt2 : \
  250. ff_hscale8to19_ ## filtersize ## _ ## opt1; \
  251. } else if (c->srcBpc == 9) { \
  252. hscalefn = c->dstBpc <= 10 ? ff_hscale9to15_ ## filtersize ## _ ## opt2 : \
  253. ff_hscale9to19_ ## filtersize ## _ ## opt1; \
  254. } else if (c->srcBpc == 10) { \
  255. hscalefn = c->dstBpc <= 10 ? ff_hscale10to15_ ## filtersize ## _ ## opt2 : \
  256. ff_hscale10to19_ ## filtersize ## _ ## opt1; \
  257. } else /* c->srcBpc == 16 */ { \
  258. hscalefn = c->dstBpc <= 10 ? ff_hscale16to15_ ## filtersize ## _ ## opt2 : \
  259. ff_hscale16to19_ ## filtersize ## _ ## opt1; \
  260. } \
  261. } while (0)
  262. #define ASSIGN_MMX_SCALE_FUNC(hscalefn, filtersize, opt1, opt2) \
  263. switch (filtersize) { \
  264. case 4: ASSIGN_SCALE_FUNC2(hscalefn, 4, opt1, opt2); break; \
  265. case 8: ASSIGN_SCALE_FUNC2(hscalefn, 8, opt1, opt2); break; \
  266. default: ASSIGN_SCALE_FUNC2(hscalefn, X, opt1, opt2); break; \
  267. }
  268. #define ASSIGN_VSCALEX_FUNC(vscalefn, opt, do_16_case) \
  269. switch(c->dstBpc){ \
  270. case 16: do_16_case; break; \
  271. case 10: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2planeX_10_ ## opt; break; \
  272. case 9: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2planeX_9_ ## opt; break; \
  273. default: vscalefn = ff_yuv2planeX_8_ ## opt; break; \
  274. }
  275. #define ASSIGN_VSCALE_FUNC(vscalefn, opt1, opt2, opt2chk) \
  276. switch(c->dstBpc){ \
  277. case 16: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2plane1_16_ ## opt1; break; \
  278. case 10: if (!isBE(c->dstFormat) && opt2chk) vscalefn = ff_yuv2plane1_10_ ## opt2; break; \
  279. case 9: if (!isBE(c->dstFormat) && opt2chk) vscalefn = ff_yuv2plane1_9_ ## opt2; break; \
  280. default: vscalefn = ff_yuv2plane1_8_ ## opt1; break; \
  281. }
  282. #define case_rgb(x, X, opt) \
  283. case PIX_FMT_ ## X: \
  284. c->lumToYV12 = ff_ ## x ## ToY_ ## opt; \
  285. if (!c->chrSrcHSubSample) \
  286. c->chrToYV12 = ff_ ## x ## ToUV_ ## opt; \
  287. break
  288. #if ARCH_X86_32
  289. if (cpu_flags & AV_CPU_FLAG_MMX) {
  290. ASSIGN_MMX_SCALE_FUNC(c->hyScale, c->hLumFilterSize, mmx, mmx);
  291. ASSIGN_MMX_SCALE_FUNC(c->hcScale, c->hChrFilterSize, mmx, mmx);
  292. ASSIGN_VSCALE_FUNC(c->yuv2plane1, mmx, mmx2, cpu_flags & AV_CPU_FLAG_MMX2);
  293. switch (c->srcFormat) {
  294. case PIX_FMT_Y400A:
  295. c->lumToYV12 = ff_yuyvToY_mmx;
  296. if (c->alpPixBuf)
  297. c->alpToYV12 = ff_uyvyToY_mmx;
  298. break;
  299. case PIX_FMT_YUYV422:
  300. c->lumToYV12 = ff_yuyvToY_mmx;
  301. c->chrToYV12 = ff_yuyvToUV_mmx;
  302. break;
  303. case PIX_FMT_UYVY422:
  304. c->lumToYV12 = ff_uyvyToY_mmx;
  305. c->chrToYV12 = ff_uyvyToUV_mmx;
  306. break;
  307. case PIX_FMT_NV12:
  308. c->chrToYV12 = ff_nv12ToUV_mmx;
  309. break;
  310. case PIX_FMT_NV21:
  311. c->chrToYV12 = ff_nv21ToUV_mmx;
  312. break;
  313. case_rgb(rgb24, RGB24, mmx);
  314. case_rgb(bgr24, BGR24, mmx);
  315. case_rgb(bgra, BGRA, mmx);
  316. case_rgb(rgba, RGBA, mmx);
  317. case_rgb(abgr, ABGR, mmx);
  318. case_rgb(argb, ARGB, mmx);
  319. default:
  320. break;
  321. }
  322. }
  323. if (cpu_flags & AV_CPU_FLAG_MMX2) {
  324. ASSIGN_VSCALEX_FUNC(c->yuv2planeX, mmx2,);
  325. }
  326. #endif
  327. #define ASSIGN_SSE_SCALE_FUNC(hscalefn, filtersize, opt1, opt2) \
  328. switch (filtersize) { \
  329. case 4: ASSIGN_SCALE_FUNC2(hscalefn, 4, opt1, opt2); break; \
  330. case 8: ASSIGN_SCALE_FUNC2(hscalefn, 8, opt1, opt2); break; \
  331. default: if (filtersize & 4) ASSIGN_SCALE_FUNC2(hscalefn, X4, opt1, opt2); \
  332. else ASSIGN_SCALE_FUNC2(hscalefn, X8, opt1, opt2); \
  333. break; \
  334. }
  335. if (cpu_flags & AV_CPU_FLAG_SSE2) {
  336. ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, sse2, sse2);
  337. ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, sse2, sse2);
  338. ASSIGN_VSCALEX_FUNC(c->yuv2planeX, sse2,);
  339. ASSIGN_VSCALE_FUNC(c->yuv2plane1, sse2, sse2, 1);
  340. switch (c->srcFormat) {
  341. case PIX_FMT_Y400A:
  342. c->lumToYV12 = ff_yuyvToY_sse2;
  343. if (c->alpPixBuf)
  344. c->alpToYV12 = ff_uyvyToY_sse2;
  345. break;
  346. case PIX_FMT_YUYV422:
  347. c->lumToYV12 = ff_yuyvToY_sse2;
  348. c->chrToYV12 = ff_yuyvToUV_sse2;
  349. break;
  350. case PIX_FMT_UYVY422:
  351. c->lumToYV12 = ff_uyvyToY_sse2;
  352. c->chrToYV12 = ff_uyvyToUV_sse2;
  353. break;
  354. case PIX_FMT_NV12:
  355. c->chrToYV12 = ff_nv12ToUV_sse2;
  356. break;
  357. case PIX_FMT_NV21:
  358. c->chrToYV12 = ff_nv21ToUV_sse2;
  359. break;
  360. case_rgb(rgb24, RGB24, sse2);
  361. case_rgb(bgr24, BGR24, sse2);
  362. case_rgb(bgra, BGRA, sse2);
  363. case_rgb(rgba, RGBA, sse2);
  364. case_rgb(abgr, ABGR, sse2);
  365. case_rgb(argb, ARGB, sse2);
  366. default:
  367. break;
  368. }
  369. }
  370. if (cpu_flags & AV_CPU_FLAG_SSSE3) {
  371. ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, ssse3, ssse3);
  372. ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, ssse3, ssse3);
  373. switch (c->srcFormat) {
  374. case_rgb(rgb24, RGB24, ssse3);
  375. case_rgb(bgr24, BGR24, ssse3);
  376. default:
  377. break;
  378. }
  379. }
  380. if (cpu_flags & AV_CPU_FLAG_SSE4) {
  381. /* Xto15 don't need special sse4 functions */
  382. ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, sse4, ssse3);
  383. ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, sse4, ssse3);
  384. ASSIGN_VSCALEX_FUNC(c->yuv2planeX, sse4,
  385. if (!isBE(c->dstFormat)) c->yuv2planeX = ff_yuv2planeX_16_sse4);
  386. if (c->dstBpc == 16 && !isBE(c->dstFormat))
  387. c->yuv2plane1 = ff_yuv2plane1_16_sse4;
  388. }
  389. if (cpu_flags & AV_CPU_FLAG_AVX) {
  390. ASSIGN_VSCALEX_FUNC(c->yuv2planeX, avx,);
  391. ASSIGN_VSCALE_FUNC(c->yuv2plane1, avx, avx, 1);
  392. switch (c->srcFormat) {
  393. case PIX_FMT_YUYV422:
  394. c->chrToYV12 = ff_yuyvToUV_avx;
  395. break;
  396. case PIX_FMT_UYVY422:
  397. c->chrToYV12 = ff_uyvyToUV_avx;
  398. break;
  399. case PIX_FMT_NV12:
  400. c->chrToYV12 = ff_nv12ToUV_avx;
  401. break;
  402. case PIX_FMT_NV21:
  403. c->chrToYV12 = ff_nv21ToUV_avx;
  404. break;
  405. case_rgb(rgb24, RGB24, avx);
  406. case_rgb(bgr24, BGR24, avx);
  407. case_rgb(bgra, BGRA, avx);
  408. case_rgb(rgba, RGBA, avx);
  409. case_rgb(abgr, ABGR, avx);
  410. case_rgb(argb, ARGB, avx);
  411. default:
  412. break;
  413. }
  414. }
  415. #endif
  416. }