changeset 900:5dcfac995af3 libavutil

Move clipping of audio samples (for those codecs outputting float) from decoder to the audio conversion routines.
author rbultje
date Wed, 21 Apr 2010 17:57:48 +0000
parents 0795a743bda1
children 5b60f5ff30da
files common.h
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/common.h	Tue Apr 20 14:45:34 2010 +0000
+++ b/common.h	Wed Apr 21 17:57:48 2010 +0000
@@ -145,6 +145,17 @@
 }
 
 /**
+ * Clips a signed 64-bit integer value into the -2147483648,2147483647 range.
+ * @param a value to clip
+ * @return clipped value
+ */
+static inline av_const int32_t av_clipl_int32(int64_t a)
+{
+    if ((a+2147483648) & ~2147483647) return (a>>63) ^ 2147483647;
+    else                              return a;
+}
+
+/**
  * Clips a float value into the amin-amax range.
  * @param a value to clip
  * @param amin minimum value of the clip range