From c00567647e9002094255df755e18c719e75b3333 Mon Sep 17 00:00:00 2001 From: James Almer Date: Thu, 18 Feb 2021 11:35:08 -0300 Subject: swscale/x86/swscale: fix mix of inline and external function definitions This includes removing pointless static function forward declarations. Signed-off-by: James Almer --- libswscale/x86/swscale.c | 44 ++++++++++++++++++--------------------- libswscale/x86/swscale_template.c | 1 - 2 files changed, 20 insertions(+), 25 deletions(-) (limited to 'libswscale') diff --git a/libswscale/x86/swscale.c b/libswscale/x86/swscale.c index 316a824e87..1e865914cb 100644 --- a/libswscale/x86/swscale.c +++ b/libswscale/x86/swscale.c @@ -63,16 +63,6 @@ DECLARE_ASM_ALIGNED(8, const uint64_t, ff_bgr2UVOffset) = 0x8080808080808080ULL; DECLARE_ASM_ALIGNED(8, const uint64_t, ff_w1111) = 0x0001000100010001ULL; -#define YUV2YUVX_FUNC_DECL(opt) \ -static void yuv2yuvX_ ##opt(const int16_t *filter, int filterSize, const int16_t **src, \ - uint8_t *dest, int dstW, \ - const uint8_t *dither, int offset); \ - -YUV2YUVX_FUNC_DECL(mmx) -YUV2YUVX_FUNC_DECL(mmxext) -YUV2YUVX_FUNC_DECL(sse3) -YUV2YUVX_FUNC_DECL(avx2) - //MMX versions #if HAVE_MMX_INLINE #undef RENAME @@ -206,8 +196,8 @@ void ff_updateMMXDitherTables(SwsContext *c, int dstY) } } } +#endif /* HAVE_INLINE_ASM */ -#if HAVE_MMXEXT #define YUV2YUVX_FUNC_MMX(opt, step) \ void ff_yuv2yuvX_ ##opt(const int16_t *filter, int filterSize, int srcOffset, \ uint8_t *dest, int dstW, \ @@ -241,17 +231,19 @@ static void yuv2yuvX_ ##opt(const int16_t *filter, int filterSize, \ return; \ } +#if HAVE_MMX_EXTERNAL YUV2YUVX_FUNC_MMX(mmx, 16) +#endif +#if HAVE_MMXEXT_EXTERNAL YUV2YUVX_FUNC_MMX(mmxext, 16) +#endif +#if HAVE_SSE3_EXTERNAL YUV2YUVX_FUNC(sse3, 32) +#endif #if HAVE_AVX2_EXTERNAL YUV2YUVX_FUNC(avx2, 64) #endif -#endif - -#endif /* HAVE_INLINE_ASM */ - #define SCALE_FUNC(filter_n, from_bpc, to_bpc, opt) \ void ff_hscale ## from_bpc ## to ## to_bpc ## _ ## filter_n ## _ ## opt( \ SwsContext *c, int16_t *data, \ @@ -379,20 +371,24 @@ av_cold void ff_sws_init_swscale_x86(SwsContext *c) if (INLINE_MMXEXT(cpu_flags)) sws_init_swscale_mmxext(c); #endif -#if HAVE_SSSE3_EXTERNAL - if (EXTERNAL_SSSE3(cpu_flags)) { - if(c->use_mmx_vfilter && !(c->flags & SWS_ACCURATE_RND)){ + if(c->use_mmx_vfilter && !(c->flags & SWS_ACCURATE_RND)) { +#if HAVE_MMX_EXTERNAL + if (EXTERNAL_MMX(cpu_flags)) + c->yuv2planeX = yuv2yuvX_mmx; +#endif +#if HAVE_MMXEXT_EXTERNAL + if (EXTERNAL_MMXEXT(cpu_flags)) + c->yuv2planeX = yuv2yuvX_mmxext; +#endif +#if HAVE_SSE3_EXTERNAL + if (EXTERNAL_SSE3(cpu_flags)) c->yuv2planeX = yuv2yuvX_sse3; - } - } #endif #if HAVE_AVX2_EXTERNAL - if (EXTERNAL_AVX2_FAST(cpu_flags)) { - if(c->use_mmx_vfilter && !(c->flags & SWS_ACCURATE_RND)){ + if (EXTERNAL_AVX2_FAST(cpu_flags)) c->yuv2planeX = yuv2yuvX_avx2; - } - } #endif + } #define ASSIGN_SCALE_FUNC2(hscalefn, filtersize, opt1, opt2) do { \ if (c->srcBpc == 8) { \ diff --git a/libswscale/x86/swscale_template.c b/libswscale/x86/swscale_template.c index cb33af97e4..97d8cae613 100644 --- a/libswscale/x86/swscale_template.c +++ b/libswscale/x86/swscale_template.c @@ -1435,7 +1435,6 @@ static av_cold void RENAME(sws_init_swscale)(SwsContext *c) } } else { c->use_mmx_vfilter= 1; - c->yuv2planeX = RENAME(yuv2yuvX ); if (!(c->flags & SWS_FULL_CHR_H_INT)) { switch (c->dstFormat) { case AV_PIX_FMT_RGB32: c->yuv2packedX = RENAME(yuv2rgb32_X); break; -- cgit v1.2.3