Mercurial > libavcodec.hg
comparison snow.c @ 2951:98a2bd9c8674 libavcodec
make selftest code compile again
author | michael |
---|---|
date | Sat, 03 Dec 2005 03:07:54 +0000 |
parents | 6f8bcb169256 |
children | d7be13d3ef00 |
comparison
equal
deleted
inserted
replaced
2950:2c4753d27834 | 2951:98a2bd9c8674 |
---|---|
3881 | 3881 |
3882 printf("testing 5/3 DWT\n"); | 3882 printf("testing 5/3 DWT\n"); |
3883 for(i=0; i<width*height; i++) | 3883 for(i=0; i<width*height; i++) |
3884 buffer[0][i]= buffer[1][i]= random()%54321 - 12345; | 3884 buffer[0][i]= buffer[1][i]= random()%54321 - 12345; |
3885 | 3885 |
3886 ff_spatial_dwt(buffer[0], width, height, width, s->spatial_decomposition_type, s->spatial_decomposition_count); | 3886 ff_spatial_dwt(buffer[0], width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count); |
3887 ff_spatial_idwt(buffer[0], width, height, width, s->spatial_decomposition_type, s->spatial_decomposition_count); | 3887 ff_spatial_idwt(buffer[0], width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count); |
3888 | 3888 |
3889 for(i=0; i<width*height; i++) | 3889 for(i=0; i<width*height; i++) |
3890 if(buffer[0][i]!= buffer[1][i]) printf("fsck: %d %d %d\n",i, buffer[0][i], buffer[1][i]); | 3890 if(buffer[0][i]!= buffer[1][i]) printf("fsck: %d %d %d\n",i, buffer[0][i], buffer[1][i]); |
3891 | 3891 |
3892 printf("testing 9/7 DWT\n"); | 3892 printf("testing 9/7 DWT\n"); |
3893 s.spatial_decomposition_type=0; | 3893 s.spatial_decomposition_type=0; |
3894 for(i=0; i<width*height; i++) | 3894 for(i=0; i<width*height; i++) |
3895 buffer[0][i]= buffer[1][i]= random()%54321 - 12345; | 3895 buffer[0][i]= buffer[1][i]= random()%54321 - 12345; |
3896 | 3896 |
3897 ff_spatial_dwt(buffer[0], width, height, width, s->spatial_decomposition_type, s->spatial_decomposition_count); | 3897 ff_spatial_dwt(buffer[0], width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count); |
3898 ff_spatial_idwt(buffer[0], width, height, width, s->spatial_decomposition_type, s->spatial_decomposition_count); | 3898 ff_spatial_idwt(buffer[0], width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count); |
3899 | 3899 |
3900 for(i=0; i<width*height; i++) | 3900 for(i=0; i<width*height; i++) |
3901 if(buffer[0][i]!= buffer[1][i]) printf("fsck: %d %d %d\n",i, buffer[0][i], buffer[1][i]); | 3901 if(ABS(buffer[0][i] - buffer[1][i])>20) printf("fsck: %d %d %d\n",i, buffer[0][i], buffer[1][i]); |
3902 | 3902 |
3903 #if 0 | |
3903 printf("testing AC coder\n"); | 3904 printf("testing AC coder\n"); |
3904 memset(s.header_state, 0, sizeof(s.header_state)); | 3905 memset(s.header_state, 0, sizeof(s.header_state)); |
3905 ff_init_range_encoder(&s.c, buffer[0], 256*256); | 3906 ff_init_range_encoder(&s.c, buffer[0], 256*256); |
3906 ff_init_cabac_states(&s.c, ff_h264_lps_range, ff_h264_mps_state, ff_h264_lps_state, 64); | 3907 ff_init_cabac_states(&s.c, ff_h264_lps_range, ff_h264_mps_state, ff_h264_lps_state, 64); |
3907 | 3908 |
3921 START_TIMER | 3922 START_TIMER |
3922 j= get_symbol(&s.c, s.header_state, 1); | 3923 j= get_symbol(&s.c, s.header_state, 1); |
3923 STOP_TIMER("get_symbol") | 3924 STOP_TIMER("get_symbol") |
3924 if(j!=i*i*i/3*ABS(i)) printf("fsck: %d != %d\n", i, j); | 3925 if(j!=i*i*i/3*ABS(i)) printf("fsck: %d != %d\n", i, j); |
3925 } | 3926 } |
3927 #endif | |
3926 { | 3928 { |
3927 int level, orientation, x, y; | 3929 int level, orientation, x, y; |
3928 int64_t errors[8][4]; | 3930 int64_t errors[8][4]; |
3929 int64_t g=0; | 3931 int64_t g=0; |
3930 | 3932 |
3942 if(orientation&1) buf+=w; | 3944 if(orientation&1) buf+=w; |
3943 if(orientation>1) buf+=stride>>1; | 3945 if(orientation>1) buf+=stride>>1; |
3944 | 3946 |
3945 memset(buffer[0], 0, sizeof(int)*width*height); | 3947 memset(buffer[0], 0, sizeof(int)*width*height); |
3946 buf[w/2 + h/2*stride]= 256*256; | 3948 buf[w/2 + h/2*stride]= 256*256; |
3947 ff_spatial_idwt(buffer[0], width, height, width, s->spatial_decomposition_type, s->spatial_decomposition_count); | 3949 ff_spatial_idwt(buffer[0], width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count); |
3948 for(y=0; y<height; y++){ | 3950 for(y=0; y<height; y++){ |
3949 for(x=0; x<width; x++){ | 3951 for(x=0; x<width; x++){ |
3950 int64_t d= buffer[0][x + y*width]; | 3952 int64_t d= buffer[0][x + y*width]; |
3951 error += d*d; | 3953 error += d*d; |
3952 if(ABS(width/2-x)<9 && ABS(height/2-y)<9 && level==2) printf("%8lld ", d); | 3954 if(ABS(width/2-x)<9 && ABS(height/2-y)<9 && level==2) printf("%8lld ", d); |
3986 for(x=0; x<width; x++){ | 3988 for(x=0; x<width; x++){ |
3987 int tab[4]={0,2,3,1}; | 3989 int tab[4]={0,2,3,1}; |
3988 buffer[0][x+width*y]= 256*256*tab[(x&1) + 2*(y&1)]; | 3990 buffer[0][x+width*y]= 256*256*tab[(x&1) + 2*(y&1)]; |
3989 } | 3991 } |
3990 } | 3992 } |
3991 ff_spatial_dwt(buffer[0], width, height, width, s->spatial_decomposition_type, s->spatial_decomposition_count); | 3993 ff_spatial_dwt(buffer[0], width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count); |
3992 #else | 3994 #else |
3993 for(y=0; y<h; y++){ | 3995 for(y=0; y<h; y++){ |
3994 for(x=0; x<w; x++){ | 3996 for(x=0; x<w; x++){ |
3995 buf[x + y*stride ]=169; | 3997 buf[x + y*stride ]=169; |
3996 buf[x + y*stride-w]=64; | 3998 buf[x + y*stride-w]=64; |
3997 } | 3999 } |
3998 } | 4000 } |
3999 ff_spatial_idwt(buffer[0], width, height, width, s->spatial_decomposition_type, s->spatial_decomposition_count); | 4001 ff_spatial_idwt(buffer[0], width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count); |
4000 #endif | 4002 #endif |
4001 for(y=0; y<height; y++){ | 4003 for(y=0; y<height; y++){ |
4002 for(x=0; x<width; x++){ | 4004 for(x=0; x<width; x++){ |
4003 int64_t d= buffer[0][x + y*width]; | 4005 int64_t d= buffer[0][x + y*width]; |
4004 error += d*d; | 4006 error += d*d; |