Revision 310d4424 libavutil/lfg.h

View differences:

libavutil/lfg.h
30 30
void av_lfg_init(AVLFG *c, unsigned int seed);
31 31

  
32 32
/**
33
 * Gets the next random unsigned 32bit number.
33
 * Gets the next random unsigned 32bit number using a ALFG.
34 34
 *
35 35
 * Please also consider a simple LCG like state= state*1664525+1013904223,
36 36
 * it may be good enough and faster for your specific use case.
......
40 40
    return c->state[c->index++ & 63];
41 41
}
42 42

  
43
/**
44
 * Gets the next random unsigned 32bit number using a MLFG.
45
 *
46
 * Please also consider the av_lfg_get() above, it is faster.
47
 */
48
static inline unsigned int av_mlfg_get(AVLFG *c){
49
    unsigned int a= c->state[(c->index-55) & 63];
50
    unsigned int b= c->state[(c->index-24) & 63];
51
    return c->state[c->index++ & 63] = a*b+a+b;
52
}
53

  
43 54
#endif //FFMPEG_LFG_H

Also available in: Unified diff