44 fprintf(stderr,
"Failed to allocate memory\n");
50 printf(
"testing 5/3 DWT\n");
52 buffer[0][i] = buffer[1][i] =
av_lfg_get(&prng) % 54321 - 12345;
58 if(buffer[0][i]!= buffer[1][i]) printf(
"fsck: %6d %12d %7d\n",i, buffer[0][i], buffer[1][i]);
60 printf(
"testing 9/7 DWT\n");
63 buffer[0][i] = buffer[1][i] =
av_lfg_get(&prng) % 54321 - 12345;
69 if(
FFABS(buffer[0][i] - buffer[1][i])>20) printf(
"fsck: %6d %12d %7d\n",i, buffer[0][i], buffer[1][i]);
72 int level, orientation, x, y;
76 memset(errors, 0,
sizeof(errors));
80 for(orientation=level ? 1 : 0; orientation<4; orientation++){
87 if(orientation&1) buf+=
w;
88 if(orientation>1) buf+=stride>>1;
90 memset(buffer[0], 0,
sizeof(
int)*
width*height);
91 buf[w/2 + h/2*
stride]= 256*256;
94 for(x=0; x<
width; x++){
95 int64_t d= buffer[0][x + y*
width];
97 if(
FFABS(width/2-x)<9 &&
FFABS(height/2-y)<9 && level==2) printf(
"%8"PRId64
" ", d);
99 if(
FFABS(height/2-y)<9 && level==2) printf(
"\n");
101 error= (
int)(sqrt(error)+0.5);
107 printf(
"static int const visual_weight[][4]={\n");
110 for(orientation=0; orientation<4; orientation++){
111 printf(
"%8"PRId64
",", errors[level][orientation]/g);
127 memset(buffer[0], 0,
sizeof(
int)*
width*height);
129 for(x=0; x<
width; x++){
130 int tab[4]={0,2,3,1};
131 buffer[0][x+width*y]= 256*256*tab[(x&1) + 2*(y&1)];
136 for(x=0; x<
width; x++){
137 int64_t d= buffer[0][x + y*
width];
139 if(
FFABS(width/2-x)<9 &&
FFABS(height/2-y)<9) printf(
"%8"PRId64
" ", d);
141 if(
FFABS(height/2-y)<9) printf(
"\n");
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 ...
static void error(const char *err)
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
GLint GLenum GLboolean GLsizei stride
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)