46 fprintf(stderr,
"Failed to allocate memory\n");
52 printf(
"testing 5/3 DWT\n");
54 buffer[0][i] = buffer[1][i] =
av_lfg_get(&prng) % 19000 - 9000;
58 obuffer[i] = buffer[0][i];
62 if(buffer[1][i]!= obuffer[i]) {
63 printf(
"fsck: %4dx%4dx %12d %7d\n",i%
width, i/width, buffer[1][i], obuffer[i]);
67 printf(
"testing 9/7 DWT\n");
70 buffer[0][i] = buffer[1][i] =
av_lfg_get(&prng) % 11000 - 5000;
74 obuffer[i] = buffer[0][i];
78 if(
FFABS(buffer[1][i] - obuffer[i])>20) {
79 printf(
"fsck: %4dx%4d %12d %7d\n",i%
width, i/width, buffer[1][i], obuffer[i]);
84 int level, orientation, x, y;
88 memset(errors, 0,
sizeof(errors));
92 for(orientation=level ? 1 : 0; orientation<4; orientation++){
99 if(orientation&1) buf+=
w;
100 if(orientation>1) buf+=stride>>1;
102 memset(obuffer, 0,
sizeof(
short)*
width*height);
103 buf[w/2 + h/2*
stride]= 8*256;
106 for(x=0; x<
width; x++){
107 int64_t d= obuffer[x + y*
width];
109 if(
FFABS(width/2-x)<9 &&
FFABS(height/2-y)<9 && level==2) printf(
"%8"PRId64
" ", d);
111 if(
FFABS(height/2-y)<9 && level==2) printf(
"\n");
113 error= (
int)(sqrt(error)+0.5);
119 printf(
"static int const visual_weight[][4]={\n");
122 for(orientation=0; orientation<4; orientation++){
123 printf(
"%8"PRId64
",", errors[level][orientation]/g);
139 memset(buffer[0], 0,
sizeof(
int)*
width*height);
141 for(x=0; x<
width; x++){
142 int tab[4]={0,2,3,1};
143 buffer[0][x+width*y]= 256*256*tab[(x&1) + 2*(y&1)];
148 for(x=0; x<
width; x++){
149 int64_t d= buffer[0][x + y*
width];
151 if(
FFABS(width/2-x)<9 &&
FFABS(height/2-y)<9) printf(
"%8"PRId64
" ", d);
153 if(
FFABS(height/2-y)<9) printf(
"\n");
Context structure for the Lagged Fibonacci PRNG.
static void error(const char *err)
#define i(width, name, range_min, range_max)
int64_t av_gcd(int64_t a, int64_t b)
Compute the greatest common divisor of two integer operands.
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
int spatial_decomposition_count
static unsigned int av_lfg_get(AVLFG *c)
Get the next random unsigned 32-bit number using an ALFG.
void ff_spatial_idwt(IDWTELEM *buffer, IDWTELEM *temp, int width, int height, int stride, int type, int decomposition_count)
av_cold void av_lfg_init(AVLFG *c, unsigned int seed)
DWTELEM * temp_dwt_buffer
int spatial_decomposition_type
IDWTELEM * temp_idwt_buffer
void ff_spatial_dwt(DWTELEM *buffer, DWTELEM *temp, int width, int height, int stride, int type, int decomposition_count)
static const struct twinvq_data tab
void * av_mallocz_array(size_t nmemb, size_t size)
Allocate a memory block for an array with av_mallocz().