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:
authorJonathan Campbell <jonathan@castus.tv>2016-09-03 13:29:29 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2017-01-22 04:28:53 +0300
commit76c5a69e26afbfdfc5b6f538594ea12efa31fc9a (patch)
tree0cef85bf008e1670513082029c727a5b38cc3979 /libavutil/lfg.h
parent0a5add45c7527bbe627899be744f962588e5b2fa (diff)
libavutil: add av_lfg_init_from_data() function
seeds an AVLFG from binary data. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavutil/lfg.h')
-rw-r--r--libavutil/lfg.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/libavutil/lfg.h b/libavutil/lfg.h
index ec90562cf2..03f779ad8a 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;
@@ -30,6 +32,13 @@ typedef struct AVLFG {
void av_lfg_init(AVLFG *c, unsigned int seed);
/**
+ * Seed the state of the ALFG using binary data.
+ *
+ * Return value: 0 on success, negative value (AVERROR) on failure.
+ */
+int av_lfg_init_from_data(AVLFG *c, const uint8_t *data, unsigned int length);
+
+/**
* Get the next random unsigned 32-bit number using an ALFG.
*
* Please also consider a simple LCG like state= state*1664525+1013904223,