diff options
author | Jonathan Campbell <jonathan@castus.tv> | 2016-09-03 03:29:29 -0700 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-01-22 02:28:53 +0100 |
commit | 76c5a69e26afbfdfc5b6f538594ea12efa31fc9a (patch) | |
tree | 0cef85bf008e1670513082029c727a5b38cc3979 /libavutil/lfg.h | |
parent | 0a5add45c7527bbe627899be744f962588e5b2fa (diff) | |
download | ffmpeg-76c5a69e26afbfdfc5b6f538594ea12efa31fc9a.tar.gz |
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.h | 9 |
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, |