1 /*
2 * Discrete wavelet transform
3 * Copyright (c) 2007 Kamil Nowosad
4 * Copyright (c) 2013 Nicolas Bertrand <nicoinattendu@gmail.com>
5 *
6 * This file is part of FFmpeg.
7 *
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23 #include <inttypes.h>
24 #include <stdio.h>
25
27
29
31
33
37 int64_t err2 = 0;
38
41 fprintf(stderr, "ff_jpeg2000_dwt_init failed\n");
42 return 1;
43 }
46 fprintf(stderr, "ff_dwt_encode failed\n");
47 return 1;
48 }
51 fprintf(stderr, "ff_dwt_encode failed\n");
52 return 1;
53 }
56 fprintf(stderr, "missmatch at %d (%d != %d) decomp:%d border %d %d %d %d\n",
57 j,
array[j],
ref[j],decomp_levels, border[0][0], border[0][1], border[1][0], border[1][1]);
58 return 2;
59 }
62 }
64
65 printf(
"%s, decomp:%2d border %3d %3d %3d %3d milli-err2:%9"PRId64
"\n",
67 decomp_levels, border[0][0], border[0][1], border[1][0], border[1][1],
68 1000*err2 / ((border[0][1] - border[0][0])*(border[1][1] - border[1][0])));
69
70 return 0;
71 }
72
73 static int test_dwtf(
float *
array,
float *
ref,
int border[2][2],
int decomp_levels,
float max_diff) {
76 double err2 = 0;
77
80 fprintf(stderr, "ff_jpeg2000_dwt_init failed\n");
81 return 1;
82 }
85 fprintf(stderr, "ff_dwt_encode failed\n");
86 return 1;
87 }
90 fprintf(stderr, "ff_dwt_encode failed\n");
91 return 1;
92 }
95 fprintf(stderr, "missmatch at %d (%f != %f) decomp:%d border %d %d %d %d\n",
96 j,
array[j],
ref[j],decomp_levels, border[0][0], border[0][1], border[1][0], border[1][1]);
97 return 2;
98 }
101 }
103
104 printf(
"9/7f, decomp:%2d border %3d %3d %3d %3d err2:%20.3f\n",
105 decomp_levels, border[0][0], border[0][1], border[1][0], border[1][1],
106 err2 / ((border[0][1] - border[0][0])*(border[1][1] - border[1][0])));
107
108 return 0;
109 }
110
115
119 int border[2][2];
120 int ret, decomp_levels;
121
123
126
127 for (
i = 0;
i < 100;
i++) {
128 for (j=0; j<4; j++)
130 if (border[0][0] >= border[0][1] || border[1][0] >= border[1][1])
131 continue;
133
143 }
144
145 return 0;
146 }