---
doc/APIchanges | 3 +++
libavutil/lfg.h | 19 +++++++++++++++++++
libavutil/version.h | 2 +-
3 files changed, 23 insertions(+), 1 deletions(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index 1c6247e..4fb94c8 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil: 2012-10-22
API changes, most recent first:
+2012-xx-xx - xxxxxxx - lavu 52.3.0 - lfg.h
+ Add av_lfg_get_flt() to get a random float
+
2012-xx-xx - xxxxxxx - lavu 52.2.0 - audioconvert.h
Rename audioconvert.h to channel_layout.h. audioconvert.h is now deprecated.
diff --git a/libavutil/lfg.h b/libavutil/lfg.h
index 5e526c1..4d2941c 100644
--- a/libavutil/lfg.h
+++ b/libavutil/lfg.h
@@ -22,6 +22,8 @@
#ifndef AVUTIL_LFG_H
#define AVUTIL_LFG_H
+#include <stdint.h>
+
typedef struct AVLFG {
unsigned int state[64];
int index;
@@ -41,6 +43,23 @@ static inline unsigned int av_lfg_get(AVLFG *c){
}
/**
+ * Get the next random float using an ALFG.
+ *
+ * @param lfg LFG state
+ * @param scale scale factor
+ * @return next random float, in the range -scale to scale
+ */
+static inline float av_lfg_get_flt(AVLFG *lfg, float scale)
+{
+ union {
+ unsigned u;
+ signed s;
+ } r;
+ r.u = av_lfg_get(lfg);
+ return r.s * (scale / INT32_MAX);
+}
+
+/**
* Get the next random unsigned 32-bit number using a MLFG.
*
* Please also consider av_lfg_get() above, it is faster.
diff --git a/libavutil/version.h b/libavutil/version.h
index f69c73e..1dbb11c 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -37,7 +37,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 52
-#define LIBAVUTIL_VERSION_MINOR 2
+#define LIBAVUTIL_VERSION_MINOR 3
#define LIBAVUTIL_VERSION_MICRO 0
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
--
1.7.1
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel