summaryrefslogtreecommitdiff
path: root/libavutil/x86/intmath.h
diff options
context:
space:
mode:
authorMark Reid <mindmark@gmail.com>2021-11-14 22:22:20 -0800
committerJames Almer <jamrial@gmail.com>2021-11-15 16:50:08 -0300
commitc3502f4f75583a530bc54e2cb6754236d72f204b (patch)
treebd4b459538e7298a8dc4002916861690644ca3f6 /libavutil/x86/intmath.h
parenta7dfa6b446e8ced9f25efd0597e6073e6b22a94b (diff)
libavutil/common: clip nan value to amin
Changes av_clipf to return amin if a is nan. Before if a is nan av_clipf_c returned nan and av_clipf_sse would return amax. Now the both should behave the same. This works because nan > amin is false. The max(nan, amin) will be amin. Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavutil/x86/intmath.h')
-rw-r--r--libavutil/x86/intmath.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavutil/x86/intmath.h b/libavutil/x86/intmath.h
index 40743fd13e..1520c25ec9 100644
--- a/libavutil/x86/intmath.h
+++ b/libavutil/x86/intmath.h
@@ -110,8 +110,8 @@ static av_always_inline av_const double av_clipd_sse2(double a, double amin, dou
#if defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
if (amin > amax) abort();
#endif
- __asm__ ("minsd %2, %0 \n\t"
- "maxsd %1, %0 \n\t"
+ __asm__ ("maxsd %1, %0 \n\t"
+ "minsd %2, %0 \n\t"
: "+&x"(a) : "xm"(amin), "xm"(amax));
return a;
}
@@ -126,8 +126,8 @@ static av_always_inline av_const float av_clipf_sse(float a, float amin, float a
#if defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
if (amin > amax) abort();
#endif
- __asm__ ("minss %2, %0 \n\t"
- "maxss %1, %0 \n\t"
+ __asm__ ("maxss %1, %0 \n\t"
+ "minss %2, %0 \n\t"
: "+&x"(a) : "xm"(amin), "xm"(amax));
return a;
}