Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-08-13 16:38:43 +0400
committerMichael Niedermayer <michaelni@gmx.at>2012-08-13 16:38:43 +0400
commitd8c3170c9ff81b5563eba543ff56687bcb7f5127 (patch)
tree3d99afbb09f2032ef8851736d5f4801a2ba17586 /libavutil/common.h
parentbd70a527129a1c049a8ab38236bf87f7d459df10 (diff)
parent69665bd6f40f02ecf822f80c05dd2765da2dfa7b (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: (22 commits) g723.1: do not pass large structs by value g723.1: do not bounce intermediate values via memory g723.1: declare a variable in the block it is used g723.1: avoid saving/restoring excitation g723.1: avoid unnecessary memcpy() in residual_interp() g723.1: make postfilter write directly to output buffer g723.1: drop unnecessary variable buf_ptr in formant_postfilter() g723.1: make scale_vector() output to a separate buffer g723.1: make autocorr_max() work on an arbitrary buffer g723.1: do not needlessly use int64_t g723.1: use saturating addition functions g723.1: optimise scale_vector() g723.1: remove useless uses of MUL64() g723.1: remove unnecessary argument 'shift' from dot_product() g723.1: deobfuscate "(x << 4) - x" to "15 * x" celp: optimise ff_celp_lp_synthesis_filter() libavutil: add saturating addition functions cllc: Implement ARGB support cllc: Add support for QRGB cllc: Rename some funcs to represent what they actually do ... Conflicts: LICENSE libavcodec/g723_1.c libavcodec/x86/Makefile Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/common.h')
-rw-r--r--libavutil/common.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/libavutil/common.h b/libavutil/common.h
index a11a3251e9..3e3baab3a1 100644
--- a/libavutil/common.h
+++ b/libavutil/common.h
@@ -187,6 +187,30 @@ static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p)
}
/**
+ * Add two signed 32-bit values with saturation.
+ *
+ * @param a one value
+ * @param b another value
+ * @return sum with signed saturation
+ */
+static av_always_inline int av_sat_add32_c(int a, int b)
+{
+ return av_clipl_int32((int64_t)a + b);
+}
+
+/**
+ * Add a doubled value to another value with saturation at both stages.
+ *
+ * @param a first value
+ * @param b value doubled and added to a
+ * @return sum with signed saturation
+ */
+static av_always_inline int av_sat_dadd32_c(int a, int b)
+{
+ return av_sat_add32(a, av_sat_add32(b, b));
+}
+
+/**
* Clip a float value into the amin-amax range.
* @param a value to clip
* @param amin minimum value of the clip range
@@ -392,6 +416,12 @@ static av_always_inline av_const int av_popcount64_c(uint64_t x)
#ifndef av_clip_uintp2
# define av_clip_uintp2 av_clip_uintp2_c
#endif
+#ifndef av_sat_add32
+# define av_sat_add32 av_sat_add32_c
+#endif
+#ifndef av_sat_dadd32
+# define av_sat_dadd32 av_sat_dadd32_c
+#endif
#ifndef av_clipf
# define av_clipf av_clipf_c
#endif