Mercurial > libavutil.hg
comparison lfg.h @ 957:e34e8d654ded libavutil
Fix grammar errors in documentation
author | mru |
---|---|
date | Wed, 30 Jun 2010 15:38:06 +0000 |
parents | 41da9d9d39b7 |
children | bb966549e097 |
comparison
equal
deleted
inserted
replaced
956:2894d4c208dc | 957:e34e8d654ded |
---|---|
28 } AVLFG; | 28 } AVLFG; |
29 | 29 |
30 void av_lfg_init(AVLFG *c, unsigned int seed); | 30 void av_lfg_init(AVLFG *c, unsigned int seed); |
31 | 31 |
32 /** | 32 /** |
33 * Gets the next random unsigned 32-bit number using an ALFG. | 33 * Get the next random unsigned 32-bit number using an ALFG. |
34 * | 34 * |
35 * Please also consider a simple LCG like state= state*1664525+1013904223, | 35 * Please also consider a simple LCG like state= state*1664525+1013904223, |
36 * it may be good enough and faster for your specific use case. | 36 * it may be good enough and faster for your specific use case. |
37 */ | 37 */ |
38 static inline unsigned int av_lfg_get(AVLFG *c){ | 38 static inline unsigned int av_lfg_get(AVLFG *c){ |
39 c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63]; | 39 c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63]; |
40 return c->state[c->index++ & 63]; | 40 return c->state[c->index++ & 63]; |
41 } | 41 } |
42 | 42 |
43 /** | 43 /** |
44 * Gets the next random unsigned 32-bit number using a MLFG. | 44 * Get the next random unsigned 32-bit number using a MLFG. |
45 * | 45 * |
46 * Please also consider av_lfg_get() above, it is faster. | 46 * Please also consider av_lfg_get() above, it is faster. |
47 */ | 47 */ |
48 static inline unsigned int av_mlfg_get(AVLFG *c){ | 48 static inline unsigned int av_mlfg_get(AVLFG *c){ |
49 unsigned int a= c->state[(c->index-55) & 63]; | 49 unsigned int a= c->state[(c->index-55) & 63]; |
50 unsigned int b= c->state[(c->index-24) & 63]; | 50 unsigned int b= c->state[(c->index-24) & 63]; |
51 return c->state[c->index++ & 63] = 2*a*b+a+b; | 51 return c->state[c->index++ & 63] = 2*a*b+a+b; |
52 } | 52 } |
53 | 53 |
54 /** | 54 /** |
55 * Gets the next two numbers generated by a Box-Muller Gaussian | 55 * Get the next two numbers generated by a Box-Muller Gaussian |
56 * generator using the random numbers issued by lfg. | 56 * generator using the random numbers issued by lfg. |
57 * | 57 * |
58 * @param out[2] array where are placed the two generated numbers | 58 * @param out[2] array where are placed the two generated numbers |
59 */ | 59 */ |
60 void av_bmg_get(AVLFG *lfg, double out[2]); | 60 void av_bmg_get(AVLFG *lfg, double out[2]); |