Mercurial > libavcodec.hg
comparison snow.c @ 9199:ea0e5e9a520f libavcodec
Replace random() usage in test programs by av_lfg_*().
author | diego |
---|---|
date | Fri, 20 Mar 2009 11:48:27 +0000 |
parents | ce32a456ce9a |
children | 6220870901f5 |
comparison
equal
deleted
inserted
replaced
9198:342e95d4784b | 9199:ea0e5e9a520f |
---|---|
4687 | 4687 |
4688 #ifdef TEST | 4688 #ifdef TEST |
4689 #undef malloc | 4689 #undef malloc |
4690 #undef free | 4690 #undef free |
4691 #undef printf | 4691 #undef printf |
4692 #undef random | 4692 |
4693 #include "libavutil/lfg.h" | |
4693 | 4694 |
4694 int main(void){ | 4695 int main(void){ |
4695 int width=256; | 4696 int width=256; |
4696 int height=256; | 4697 int height=256; |
4697 int buffer[2][width*height]; | 4698 int buffer[2][width*height]; |
4698 SnowContext s; | 4699 SnowContext s; |
4699 int i; | 4700 int i; |
4700 s.spatial_decomposition_count=6; | 4701 s.spatial_decomposition_count=6; |
4701 s.spatial_decomposition_type=1; | 4702 s.spatial_decomposition_type=1; |
4703 AVLFG prn; | |
4704 | |
4705 av_lfg_init(&prn, 1); | |
4702 | 4706 |
4703 printf("testing 5/3 DWT\n"); | 4707 printf("testing 5/3 DWT\n"); |
4704 for(i=0; i<width*height; i++) | 4708 for(i=0; i<width*height; i++) |
4705 buffer[0][i]= buffer[1][i]= random()%54321 - 12345; | 4709 buffer[0][i] = buffer[1][i] = av_lfg_get(&prn) % 54321 - 12345; |
4706 | 4710 |
4707 ff_spatial_dwt(buffer[0], width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count); | 4711 ff_spatial_dwt(buffer[0], width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count); |
4708 ff_spatial_idwt(buffer[0], width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count); | 4712 ff_spatial_idwt(buffer[0], width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count); |
4709 | 4713 |
4710 for(i=0; i<width*height; i++) | 4714 for(i=0; i<width*height; i++) |
4711 if(buffer[0][i]!= buffer[1][i]) printf("fsck: %6d %12d %7d\n",i, buffer[0][i], buffer[1][i]); | 4715 if(buffer[0][i]!= buffer[1][i]) printf("fsck: %6d %12d %7d\n",i, buffer[0][i], buffer[1][i]); |
4712 | 4716 |
4713 printf("testing 9/7 DWT\n"); | 4717 printf("testing 9/7 DWT\n"); |
4714 s.spatial_decomposition_type=0; | 4718 s.spatial_decomposition_type=0; |
4715 for(i=0; i<width*height; i++) | 4719 for(i=0; i<width*height; i++) |
4716 buffer[0][i]= buffer[1][i]= random()%54321 - 12345; | 4720 buffer[0][i] = buffer[1][i] = av_lfg_get(&prn) % 54321 - 12345; |
4717 | 4721 |
4718 ff_spatial_dwt(buffer[0], width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count); | 4722 ff_spatial_dwt(buffer[0], width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count); |
4719 ff_spatial_idwt(buffer[0], width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count); | 4723 ff_spatial_idwt(buffer[0], width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count); |
4720 | 4724 |
4721 for(i=0; i<width*height; i++) | 4725 for(i=0; i<width*height; i++) |