[FFmpeg-devel] [PATCH] x86/intmath: add sse optimized av_clipf and av_clipd
Ronald S. Bultje
rsbultje at gmail.com
Thu Jan 7 04:19:16 CET 2016
Hi,
On Wed, Jan 6, 2016 at 8:09 PM, James Almer <jamrial at gmail.com> wrote:
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
> libavutil/x86/intmath.h | 32 ++++++++++++++++++++++++++++++++
> 1 file changed, 32 insertions(+)
>
> diff --git a/libavutil/x86/intmath.h b/libavutil/x86/intmath.h
> index 611ef88..e1cd596 100644
> --- a/libavutil/x86/intmath.h
> +++ b/libavutil/x86/intmath.h
> @@ -98,6 +98,38 @@ static av_always_inline av_const unsigned
> av_mod_uintp2_bmi2(unsigned a, unsigne
>
> #endif /* __BMI2__ */
>
> +#if defined(__SSE2__)
> +
> +#define av_clipd av_clipd_sse2
> +static av_always_inline av_const double av_clipd_sse2(double a, double
> amin, double amax)
> +{
> +#if defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
> + if (amin > amax) abort();
> +#endif
> + __asm__ ("minsd %2, %0 \n\t"
> + "maxsd %1, %0 \n\t"
> + : "+x"(a) : "xm"(amin), "xm"(amax));
> + return a;
> +}
> +
> +#endif /* __SSE2__ */
This __SSE2__ is kind of strange, and we don't use it anywhere else. I
understand it's not the same thing, but for practical purposes, could we
just use #if ARCH_X86_64 and not care about -msse2?
Ronald
More information about the ffmpeg-devel
mailing list