36 fprintf(stderr,
"ff_jpeg2000_dwt_init failed\n");
41 fprintf(stderr,
"ff_dwt_encode failed\n");
46 fprintf(stderr,
"ff_dwt_encode failed\n");
50 if (
FFABS(array[j] - ref[j]) > max_diff) {
51 fprintf(stderr,
"missmatch at %d (%d != %d) decomp:%d border %d %d %d %d\n",
52 j, array[j], ref[j],decomp_levels, border[0][0], border[0][1], border[1][0], border[1][1]);
55 err2 += (array[j] - ref[j]) * (array[j] - ref[j]);
60 printf(
"%s, decomp:%2d border %3d %3d %3d %3d milli-err2:%9"PRId64
"\n",
62 decomp_levels, border[0][0], border[0][1], border[1][0], border[1][1],
63 1000*err2 / ((border[0][1] - border[0][0])*(border[1][1] - border[1][0])));
68 static int test_dwtf(
float *
array,
float *
ref,
int border[2][2],
int decomp_levels,
float max_diff) {
75 fprintf(stderr,
"ff_jpeg2000_dwt_init failed\n");
80 fprintf(stderr,
"ff_dwt_encode failed\n");
85 fprintf(stderr,
"ff_dwt_encode failed\n");
89 if (
FFABS(array[j] - ref[j]) > max_diff) {
90 fprintf(stderr,
"missmatch at %d (%f != %f) decomp:%d border %d %d %d %d\n",
91 j, array[j], ref[j],decomp_levels, border[0][0], border[0][1], border[1][0], border[1][1]);
94 err2 += (array[j] - ref[j]) * (array[j] - ref[j]);
99 printf(
"9/7f, decomp:%2d border %3d %3d %3d %3d err2:%20.3f\n",
100 decomp_levels, border[0][0], border[0][1], border[1][0], border[1][1],
101 err2 / ((border[0][1] - border[0][0])*(border[1][1] - border[1][0])));
115 int ret, decomp_levels;
122 for (i = 0; i < 100; i++) {
125 if (border[0][0] >= border[0][1] || border[1][0] >= border[1][1])
Discrete wavelet transform.
int ff_jpeg2000_dwt_init(DWTContext *s, int border[2][2], int decomp_levels, int type)
Initialize DWT.
void ff_dwt_destroy(DWTContext *s)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
int ff_dwt_encode(DWTContext *s, void *t)
static int test_dwtf(float *array, float *ref, int border[2][2], int decomp_levels, float max_diff)
#define FF_DWT_MAX_DECLVLS
max number of decomposition levels
static float arrayf[MAX_W *MAX_W]
static unsigned int av_lfg_get(AVLFG *c)
Get the next random unsigned 32-bit number using an ALFG.
av_cold void av_lfg_init(AVLFG *c, unsigned int seed)
static float reff[MAX_W *MAX_W]
static int ref[MAX_W *MAX_W]
int ff_dwt_decode(DWTContext *s, void *t)
static int array[MAX_W *MAX_W]
static int test_dwt(int *array, int *ref, int border[2][2], int decomp_levels, int type, int max_diff)