Commit 64bde197 authored by Diego Biurrun's avatar Diego Biurrun

cosmetics: Rename prn variable to prng (Pseudo Random Number Generator).

Originally committed as revision 18422 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent ee30cdab
...@@ -191,14 +191,14 @@ int main(void){ ...@@ -191,14 +191,14 @@ int main(void){
uint8_t r[9*SIZE]; uint8_t r[9*SIZE];
int i; int i;
uint8_t state[10]= {0}; uint8_t state[10]= {0};
AVLFG prn; AVLFG prng;
av_lfg_init(&prn, 1); av_lfg_init(&prng, 1);
ff_init_cabac_encoder(&c, b, SIZE); ff_init_cabac_encoder(&c, b, SIZE);
ff_init_cabac_states(&c); ff_init_cabac_states(&c);
for(i=0; i<SIZE; i++){ for(i=0; i<SIZE; i++){
r[i] = av_lfg_get(&prn) % 7; r[i] = av_lfg_get(&prng) % 7;
} }
for(i=0; i<SIZE; i++){ for(i=0; i<SIZE; i++){
......
...@@ -208,9 +208,9 @@ static void dct_error(const char *name, int is_idct, ...@@ -208,9 +208,9 @@ static void dct_error(const char *name, int is_idct,
int64_t sysErr[64], sysErrMax=0; int64_t sysErr[64], sysErrMax=0;
int maxout=0; int maxout=0;
int blockSumErrMax=0, blockSumErr; int blockSumErrMax=0, blockSumErr;
AVLFG prn; AVLFG prng;
av_lfg_init(&prn, 1); av_lfg_init(&prng, 1);
err_inf = 0; err_inf = 0;
err2 = 0; err2 = 0;
...@@ -221,7 +221,7 @@ static void dct_error(const char *name, int is_idct, ...@@ -221,7 +221,7 @@ static void dct_error(const char *name, int is_idct,
switch(test){ switch(test){
case 0: case 0:
for(i=0;i<64;i++) for(i=0;i<64;i++)
block1[i] = (av_lfg_get(&prn) % 512) -256; block1[i] = (av_lfg_get(&prng) % 512) -256;
if (is_idct){ if (is_idct){
ff_ref_fdct(block1); ff_ref_fdct(block1);
...@@ -230,12 +230,12 @@ static void dct_error(const char *name, int is_idct, ...@@ -230,12 +230,12 @@ static void dct_error(const char *name, int is_idct,
} }
break; break;
case 1:{ case 1:{
int num = av_lfg_get(&prn) % 10 + 1; int num = av_lfg_get(&prng) % 10 + 1;
for(i=0;i<num;i++) for(i=0;i<num;i++)
block1[av_lfg_get(&prn) % 64] = av_lfg_get(&prn) % 512 -256; block1[av_lfg_get(&prng) % 64] = av_lfg_get(&prng) % 512 -256;
}break; }break;
case 2: case 2:
block1[0] = av_lfg_get(&prn) % 4096 - 2048; block1[0] = av_lfg_get(&prng) % 4096 - 2048;
block1[63]= (block1[0]&1)^1; block1[63]= (block1[0]&1)^1;
break; break;
} }
...@@ -335,7 +335,7 @@ static void dct_error(const char *name, int is_idct, ...@@ -335,7 +335,7 @@ static void dct_error(const char *name, int is_idct,
switch(test){ switch(test){
case 0: case 0:
for(i=0;i<64;i++) for(i=0;i<64;i++)
block1[i] = av_lfg_get(&prn) % 512 -256; block1[i] = av_lfg_get(&prng) % 512 -256;
if (is_idct){ if (is_idct){
ff_ref_fdct(block1); ff_ref_fdct(block1);
...@@ -345,10 +345,10 @@ static void dct_error(const char *name, int is_idct, ...@@ -345,10 +345,10 @@ static void dct_error(const char *name, int is_idct,
break; break;
case 1:{ case 1:{
case 2: case 2:
block1[0] = av_lfg_get(&prn) % 512 -256; block1[0] = av_lfg_get(&prng) % 512 -256;
block1[1] = av_lfg_get(&prn) % 512 -256; block1[1] = av_lfg_get(&prng) % 512 -256;
block1[2] = av_lfg_get(&prn) % 512 -256; block1[2] = av_lfg_get(&prng) % 512 -256;
block1[3] = av_lfg_get(&prn) % 512 -256; block1[3] = av_lfg_get(&prng) % 512 -256;
}break; }break;
} }
...@@ -472,9 +472,9 @@ static void idct248_error(const char *name, ...@@ -472,9 +472,9 @@ static void idct248_error(const char *name,
{ {
int it, i, it1, ti, ti1, err_max, v; int it, i, it1, ti, ti1, err_max, v;
AVLFG prn; AVLFG prng;
av_lfg_init(&prn, 1); av_lfg_init(&prng, 1);
/* just one test to see if code is correct (precision is less /* just one test to see if code is correct (precision is less
important here) */ important here) */
...@@ -483,7 +483,7 @@ static void idct248_error(const char *name, ...@@ -483,7 +483,7 @@ static void idct248_error(const char *name,
/* XXX: use forward transform to generate values */ /* XXX: use forward transform to generate values */
for(i=0;i<64;i++) for(i=0;i<64;i++)
block1[i] = av_lfg_get(&prn) % 256 - 128; block1[i] = av_lfg_get(&prng) % 256 - 128;
block1[0] += 1024; block1[0] += 1024;
for(i=0; i<64; i++) for(i=0; i<64; i++)
......
...@@ -131,9 +131,9 @@ static void mdct_ref(float *output, float *input, int nbits) ...@@ -131,9 +131,9 @@ static void mdct_ref(float *output, float *input, int nbits)
static float frandom(void) static float frandom(void)
{ {
AVLFG prn; AVLFG prng;
av_lfg_init(&prn, 1); av_lfg_init(&prng, 1);
return (float)((av_lfg_get(&prn) & 0xffff) - 32768) / 32768.0; return (float)((av_lfg_get(&prng) & 0xffff) - 32768) / 32768.0;
} }
static int64_t gettime(void) static int64_t gettime(void)
......
...@@ -45,12 +45,12 @@ uint8_t img2[WIDTH * HEIGHT]; ...@@ -45,12 +45,12 @@ uint8_t img2[WIDTH * HEIGHT];
static void fill_random(uint8_t *tab, int size) static void fill_random(uint8_t *tab, int size)
{ {
int i; int i;
AVLFG prn; AVLFG prng;
av_lfg_init(&prn, 1); av_lfg_init(&prng, 1);
for(i=0;i<size;i++) { for(i=0;i<size;i++) {
#if 1 #if 1
tab[i] = av_lfg_get(&prn) % 256; tab[i] = av_lfg_get(&prng) % 256;
#else #else
tab[i] = i; tab[i] = i;
#endif #endif
......
...@@ -120,9 +120,9 @@ int main(void){ ...@@ -120,9 +120,9 @@ int main(void){
uint8_t r[9*SIZE]; uint8_t r[9*SIZE];
int i; int i;
uint8_t state[10]= {0}; uint8_t state[10]= {0};
AVLFG prn; AVLFG prng;
av_lfg_init(&prn, 1); av_lfg_init(&prng, 1);
ff_init_range_encoder(&c, b, SIZE); ff_init_range_encoder(&c, b, SIZE);
ff_build_rac_states(&c, 0.05*(1LL<<32), 128+64+32+16); ff_build_rac_states(&c, 0.05*(1LL<<32), 128+64+32+16);
...@@ -130,7 +130,7 @@ int main(void){ ...@@ -130,7 +130,7 @@ int main(void){
memset(state, 128, sizeof(state)); memset(state, 128, sizeof(state));
for(i=0; i<SIZE; i++){ for(i=0; i<SIZE; i++){
r[i] = av_lfg_get(&prn) % 7; r[i] = av_lfg_get(&prng) % 7;
} }
for(i=0; i<SIZE; i++){ for(i=0; i<SIZE; i++){
......
...@@ -4721,15 +4721,15 @@ int main(void){ ...@@ -4721,15 +4721,15 @@ int main(void){
int buffer[2][width*height]; int buffer[2][width*height];
SnowContext s; SnowContext s;
int i; int i;
AVLFG prn; AVLFG prng;
s.spatial_decomposition_count=6; s.spatial_decomposition_count=6;
s.spatial_decomposition_type=1; s.spatial_decomposition_type=1;
av_lfg_init(&prn, 1); av_lfg_init(&prng, 1);
printf("testing 5/3 DWT\n"); printf("testing 5/3 DWT\n");
for(i=0; i<width*height; i++) for(i=0; i<width*height; i++)
buffer[0][i] = buffer[1][i] = av_lfg_get(&prn) % 54321 - 12345; buffer[0][i] = buffer[1][i] = av_lfg_get(&prng) % 54321 - 12345;
ff_spatial_dwt(buffer[0], width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count); ff_spatial_dwt(buffer[0], width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count);
ff_spatial_idwt(buffer[0], width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count); ff_spatial_idwt(buffer[0], width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count);
...@@ -4740,7 +4740,7 @@ int main(void){ ...@@ -4740,7 +4740,7 @@ int main(void){
printf("testing 9/7 DWT\n"); printf("testing 9/7 DWT\n");
s.spatial_decomposition_type=0; s.spatial_decomposition_type=0;
for(i=0; i<width*height; i++) for(i=0; i<width*height; i++)
buffer[0][i] = buffer[1][i] = av_lfg_get(&prn) % 54321 - 12345; buffer[0][i] = buffer[1][i] = av_lfg_get(&prng) % 54321 - 12345;
ff_spatial_dwt(buffer[0], width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count); ff_spatial_dwt(buffer[0], width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count);
ff_spatial_idwt(buffer[0], width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count); ff_spatial_idwt(buffer[0], width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count);
......
...@@ -208,12 +208,12 @@ int main(void){ ...@@ -208,12 +208,12 @@ int main(void){
{0x73, 0x22, 0x81, 0xc0, 0xa0, 0xaa, 0xb8, 0xf7, 0xa5, 0x4a, 0x0c, 0x67, 0xa0, 0xc4, 0x5e, 0xcf}, {0x73, 0x22, 0x81, 0xc0, 0xa0, 0xaa, 0xb8, 0xf7, 0xa5, 0x4a, 0x0c, 0x67, 0xa0, 0xc4, 0x5e, 0xcf},
{0x6d, 0x25, 0x1e, 0x69, 0x44, 0xb0, 0x51, 0xe0, 0x4e, 0xaa, 0x6f, 0xb4, 0xdb, 0xf7, 0x84, 0x65}}; {0x6d, 0x25, 0x1e, 0x69, 0x44, 0xb0, 0x51, 0xe0, 0x4e, 0xaa, 0x6f, 0xb4, 0xdb, 0xf7, 0x84, 0x65}};
uint8_t temp[16]; uint8_t temp[16];
AVLFG prn; AVLFG prng;
av_aes_init(&ae, "PI=3.141592654..", 128, 0); av_aes_init(&ae, "PI=3.141592654..", 128, 0);
av_aes_init(&ad, "PI=3.141592654..", 128, 1); av_aes_init(&ad, "PI=3.141592654..", 128, 1);
av_log_set_level(AV_LOG_DEBUG); av_log_set_level(AV_LOG_DEBUG);
av_lfg_init(&prn, 1); av_lfg_init(&prng, 1);
for(i=0; i<2; i++){ for(i=0; i<2; i++){
av_aes_init(&b, rkey[i], 128, 1); av_aes_init(&b, rkey[i], 128, 1);
...@@ -225,7 +225,7 @@ int main(void){ ...@@ -225,7 +225,7 @@ int main(void){
for(i=0; i<10000; i++){ for(i=0; i<10000; i++){
for(j=0; j<16; j++){ for(j=0; j<16; j++){
pt[j] = av_lfg_get(&prn); pt[j] = av_lfg_get(&prng);
} }
{START_TIMER {START_TIMER
av_aes_crypt(&ae, temp, pt, 1, NULL, 0); av_aes_crypt(&ae, temp, pt, 1, NULL, 0);
......
...@@ -174,18 +174,18 @@ int main(void){ ...@@ -174,18 +174,18 @@ int main(void){
#define LEN 8 #define LEN 8
double eigenvector[LEN*LEN]; double eigenvector[LEN*LEN];
double eigenvalue[LEN]; double eigenvalue[LEN];
AVLFG prn; AVLFG prng;
av_lfg_init(&prn, 1); av_lfg_init(&prng, 1);
pca= ff_pca_init(LEN); pca= ff_pca_init(LEN);
for(i=0; i<9000000; i++){ for(i=0; i<9000000; i++){
double v[2*LEN+100]; double v[2*LEN+100];
double sum=0; double sum=0;
int pos = av_lfg_get(&prn) % LEN; int pos = av_lfg_get(&prng) % LEN;
int v2 = av_lfg_get(&prn) % 101 - 50; int v2 = av_lfg_get(&prng) % 101 - 50;
v[0] = av_lfg_get(&prn) % 101 - 50; v[0] = av_lfg_get(&prng) % 101 - 50;
for(j=1; j<8; j++){ for(j=1; j<8; j++){
if(j<=pos) v[j]= v[0]; if(j<=pos) v[j]= v[0];
else v[j]= v2; else v[j]= v2;
...@@ -194,7 +194,7 @@ int main(void){ ...@@ -194,7 +194,7 @@ int main(void){
/* for(j=0; j<LEN; j++){ /* for(j=0; j<LEN; j++){
v[j] -= v[pos]; v[j] -= v[pos];
}*/ }*/
// sum += av_lfg_get(&prn) % 10; // sum += av_lfg_get(&prng) % 10;
/* for(j=0; j<LEN; j++){ /* for(j=0; j<LEN; j++){
v[j] -= sum/LEN; v[j] -= sum/LEN;
}*/ }*/
......
...@@ -182,12 +182,12 @@ int main(void){ ...@@ -182,12 +182,12 @@ int main(void){
int i; int i;
void *k; void *k;
AVTreeNode *root= NULL, *node=NULL; AVTreeNode *root= NULL, *node=NULL;
AVLFG prn; AVLFG prng;
av_lfg_init(&prn, 1); av_lfg_init(&prng, 1);
for(i=0; i<10000; i++){ for(i=0; i<10000; i++){
int j = av_lfg_get(&prn) % 86294; int j = av_lfg_get(&prng) % 86294;
if(check(root) > 999){ if(check(root) > 999){
av_log(NULL, AV_LOG_ERROR, "FATAL error %d\n", i); av_log(NULL, AV_LOG_ERROR, "FATAL error %d\n", i);
print(root, 0); print(root, 0);
...@@ -198,7 +198,7 @@ int main(void){ ...@@ -198,7 +198,7 @@ int main(void){
node= av_mallocz(av_tree_node_size); node= av_mallocz(av_tree_node_size);
av_tree_insert(&root, (void*)(j+1), cmp, &node); av_tree_insert(&root, (void*)(j+1), cmp, &node);
j = av_lfg_get(&prn) % 86294; j = av_lfg_get(&prng) % 86294;
{ {
AVTreeNode *node2=NULL; AVTreeNode *node2=NULL;
av_log(NULL, AV_LOG_ERROR, "removing %4d\n", j); av_log(NULL, AV_LOG_ERROR, "removing %4d\n", j);
......
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