Message ID | 20210218144107.13356-1-jamrial@gmail.com |
---|---|
State | Accepted |
Headers | show |
Series | [FFmpeg-devel] swscale/x86/swscale: fix mix of inline and external function definitions | expand |
Context | Check | Description |
---|---|---|
andriy/x86_make | success | Make finished |
andriy/x86_make_fate | success | Make fate finished |
andriy/PPC64_make | success | Make finished |
andriy/PPC64_make_fate | success | Make fate finished |
On 2/18/2021 11:41 AM, James Almer wrote: > This includes removing pointless static function forward declarations. > > Signed-off-by: James Almer <jamrial@gmail.com> > --- > libswscale/x86/swscale.c | 40 ++++++++++++++++++------------- > libswscale/x86/swscale_template.c | 1 - > 2 files changed, 23 insertions(+), 18 deletions(-) > > diff --git a/libswscale/x86/swscale.c b/libswscale/x86/swscale.c > index 316a824e87..12e7799d0f 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,8 +371,22 @@ 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 HAVE_MMX_EXTERNAL > + if (EXTERNAL_MMX(cpu_flags)) { > + if(c->use_mmx_vfilter && !(c->flags & SWS_ACCURATE_RND)){ > + c->yuv2planeX = yuv2yuvX_mmx; > + } > + } > +#endif > +#if HAVE_MMXEXT_EXTERNAL > + if (EXTERNAL_MMXEXT(cpu_flags)) { > + if(c->use_mmx_vfilter && !(c->flags & SWS_ACCURATE_RND)){ > + c->yuv2planeX = yuv2yuvX_mmxext; > + } > + } > +#endif > +#if HAVE_SSE3_EXTERNAL > + if (EXTERNAL_SSE3(cpu_flags)) { > if(c->use_mmx_vfilter && !(c->flags & SWS_ACCURATE_RND)){ > c->yuv2planeX = yuv2yuvX_sse3; > } > 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; Will apply soon as this fixes compilation with MSVC, where inline asm is not available.
diff --git a/libswscale/x86/swscale.c b/libswscale/x86/swscale.c index 316a824e87..12e7799d0f 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,8 +371,22 @@ 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 HAVE_MMX_EXTERNAL + if (EXTERNAL_MMX(cpu_flags)) { + if(c->use_mmx_vfilter && !(c->flags & SWS_ACCURATE_RND)){ + c->yuv2planeX = yuv2yuvX_mmx; + } + } +#endif +#if HAVE_MMXEXT_EXTERNAL + if (EXTERNAL_MMXEXT(cpu_flags)) { + if(c->use_mmx_vfilter && !(c->flags & SWS_ACCURATE_RND)){ + c->yuv2planeX = yuv2yuvX_mmxext; + } + } +#endif +#if HAVE_SSE3_EXTERNAL + if (EXTERNAL_SSE3(cpu_flags)) { if(c->use_mmx_vfilter && !(c->flags & SWS_ACCURATE_RND)){ c->yuv2planeX = yuv2yuvX_sse3; } 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;
This includes removing pointless static function forward declarations. Signed-off-by: James Almer <jamrial@gmail.com> --- libswscale/x86/swscale.c | 40 ++++++++++++++++++------------- libswscale/x86/swscale_template.c | 1 - 2 files changed, 23 insertions(+), 18 deletions(-)