summaryrefslogtreecommitdiff
path: root/libavutil/random_seed.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-12-05 00:11:57 +0100
committerMichael Niedermayer <michaelni@gmx.at>2011-12-05 00:11:57 +0100
commit707138593af5c4783035d0b9cc2d7c8cb2137dfa (patch)
tree7ead2e3c73fd33764dede26546b0238bb40d484b /libavutil/random_seed.c
parent2f8b6e909dd733d9b722a5266ca516a9a5ba67e9 (diff)
parentdc6d0430503ecd7ed0d81276f977b26b4c4bd916 (diff)
downloadffmpeg-707138593af5c4783035d0b9cc2d7c8cb2137dfa.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: adpcmenc: cosmetics: pretty-printing ac3dec: cosmetics: pretty-printing yuv4mpeg: cosmetics: pretty-printing shorten: remove dead initialization roqvideodec: set AVFrame reference before reget_buffer. bmp: fix some 1bit samples. latmdec: add fate test for audio config change oma: PCM support oma: better format detection with small probe buffer oma: clearify ambiguous if condition wavpack: Properly clip samples during lossy decode Code clean-up for crc.c, lfg.c, log.c, random_see.d, rational.c and tree.c. Cleaned pixdesc.c file in libavutil zmbv.c: coding style clean-up. xan.c: coding style clean-up. mpegvideo.c: code cleanup - first 500 lines. Conflicts: Changelog libavcodec/adpcmenc.c libavcodec/bmp.c libavcodec/zmbv.c libavutil/log.c libavutil/pixdesc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/random_seed.c')
-rw-r--r--libavutil/random_seed.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/libavutil/random_seed.c b/libavutil/random_seed.c
index 81805e5db0..235028b5c5 100644
--- a/libavutil/random_seed.c
+++ b/libavutil/random_seed.c
@@ -40,24 +40,24 @@ static int read_random(uint32_t *dst, const char *file)
static uint32_t get_generic_seed(void)
{
- clock_t last_t=0;
- int bits=0;
- uint64_t random=0;
+ clock_t last_t = 0;
+ int bits = 0;
+ uint64_t random = 0;
unsigned i;
- float s=0.000000000001;
+ float s = 0.000000000001;
- for(i=0;bits<64;i++){
- clock_t t= clock();
- if(last_t && fabs(t-last_t)>s || t==(clock_t)-1){
- if(i<10000 && s<(1<<24)){
- s+=s;
- i=t=0;
- }else{
- random= 2*random + (i&1);
+ for (i = 0; bits < 64; i++) {
+ clock_t t = clock();
+ if (last_t && fabs(t - last_t) > s || t == (clock_t) -1) {
+ if (i < 10000 && s < (1 << 24)) {
+ s += s;
+ i = t = 0;
+ } else {
+ random = 2 * random + (i & 1);
bits++;
}
}
- last_t= t;
+ last_t = t;
}
#ifdef AV_READ_TIME
random ^= AV_READ_TIME();
@@ -65,7 +65,7 @@ static uint32_t get_generic_seed(void)
random ^= clock();
#endif
- random += random>>32;
+ random += random >> 32;
return random;
}