Commit 35e481c2 authored by stefano's avatar stefano

Deprecate av_init_random() in favour of av_random_init(), with a more natural

name and order of parameters.


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@16679 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 8791f321
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c) #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
#define LIBAVUTIL_VERSION_MAJOR 49 #define LIBAVUTIL_VERSION_MAJOR 49
#define LIBAVUTIL_VERSION_MINOR 13 #define LIBAVUTIL_VERSION_MINOR 14
#define LIBAVUTIL_VERSION_MICRO 0 #define LIBAVUTIL_VERSION_MICRO 0
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
......
...@@ -36,7 +36,7 @@ see http://en.wikipedia.org/wiki/Mersenne_twister for an explanation of this alg ...@@ -36,7 +36,7 @@ see http://en.wikipedia.org/wiki/Mersenne_twister for an explanation of this alg
#define LOWER_MASK 0x7fffffff /* least significant r bits */ #define LOWER_MASK 0x7fffffff /* least significant r bits */
/** initializes mt[AV_RANDOM_N] with a seed */ /** initializes mt[AV_RANDOM_N] with a seed */
void av_init_random(unsigned int seed, AVRandomState *state) void av_random_init(AVRandomState *state, unsigned int seed)
{ {
int index; int index;
...@@ -55,6 +55,11 @@ void av_init_random(unsigned int seed, AVRandomState *state) ...@@ -55,6 +55,11 @@ void av_init_random(unsigned int seed, AVRandomState *state)
state->index= index; // will cause it to generate untempered numbers the first iteration state->index= index; // will cause it to generate untempered numbers the first iteration
} }
void av_init_random(unsigned int seed, AVRandomState *state)
{
av_random_init(state, seed);
}
/** generate AV_RANDOM_N words at one time (which will then be tempered later) (av_random calls this; you shouldn't) */ /** generate AV_RANDOM_N words at one time (which will then be tempered later) (av_random calls this; you shouldn't) */
void av_random_generate_untempered_numbers(AVRandomState *state) void av_random_generate_untempered_numbers(AVRandomState *state)
{ {
......
...@@ -26,13 +26,16 @@ ...@@ -26,13 +26,16 @@
#define AV_RANDOM_N 624 #define AV_RANDOM_N 624
#include "common.h"
typedef struct { typedef struct {
unsigned int mt[AV_RANDOM_N]; ///< the array for the state vector unsigned int mt[AV_RANDOM_N]; ///< the array for the state vector
int index; ///< Current untempered value we use as the base. int index; ///< Current untempered value we use as the base.
} AVRandomState; } AVRandomState;
void av_init_random(unsigned int seed, AVRandomState *state); ///< To be inlined, the struct must be visible. So it does not make sense to try and keep it opaque with malloc/free-like calls. attribute_deprecated void av_init_random(unsigned int seed, AVRandomState *state);
void av_random_init(AVRandomState *state, unsigned int seed); ///< To be inlined, the struct must be visible. So it does not make sense to try and keep it opaque with malloc/free-like calls.
void av_random_generate_untempered_numbers(AVRandomState *state); ///< Regenerate the untempered numbers (must be done every 624 iterations, or it will loop). void av_random_generate_untempered_numbers(AVRandomState *state); ///< Regenerate the untempered numbers (must be done every 624 iterations, or it will loop).
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment