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