* (c) 2001 Fabrice Bellard
* 2007 Marc Hoffman <marc.hoffman@analog.com>
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#endif
}
-static int dct_error(const struct algo *dct, int test, int is_idct, int speed)
+
+static int dct_error(const struct algo *dct, int test, int is_idct, int speed, const int bits)
{
void (*ref)(DCTELEM *block) = is_idct ? ff_ref_idct : ff_ref_fdct;
int it, i, scale;
int maxout = 0;
int blockSumErrMax = 0, blockSumErr;
AVLFG prng;
+ const int vals=1<<bits;
double omse, ome;
int spec_err;
switch (test) {
case 0:
for (i = 0; i < 64; i++)
- block1[i] = (av_lfg_get(&prng) % 512) - 256;
+ block1[i] = (av_lfg_get(&prng) % (2*vals)) -vals;
if (is_idct) {
ff_ref_fdct(block1);
for (i = 0; i < 64; i++)
case 1: {
int num = av_lfg_get(&prng) % 10 + 1;
for (i = 0; i < num; i++)
- block1[av_lfg_get(&prng) % 64] =
- av_lfg_get(&prng) % 512 - 256;
+ block1[av_lfg_get(&prng) % 64] = av_lfg_get(&prng) % (2*vals) -vals;
}
break;
case 2:
- block1[0] = av_lfg_get(&prng) % 4096 - 2048;
+ block1[0] = av_lfg_get(&prng) % (16*vals) - (8*vals);
block1[63] = (block1[0] & 1) ^ 1;
break;
}
switch (test) {
case 0:
for (i = 0; i < 64; i++)
- block1[i] = av_lfg_get(&prng) % 512 - 256;
+ block1[i] = av_lfg_get(&prng) % (2*vals) -vals;
if (is_idct) {
ff_ref_fdct(block1);
for (i = 0; i < 64; i++)
break;
case 1:
case 2:
- block1[0] = av_lfg_get(&prng) % 512 - 256;
- block1[1] = av_lfg_get(&prng) % 512 - 256;
- block1[2] = av_lfg_get(&prng) % 512 - 256;
- block1[3] = av_lfg_get(&prng) % 512 - 256;
+ block1[0] = av_lfg_get(&prng) % (2*vals) -vals;
+ block1[1] = av_lfg_get(&prng) % (2*vals) -vals;
+ block1[2] = av_lfg_get(&prng) % (2*vals) -vals;
+ block1[3] = av_lfg_get(&prng) % (2*vals) -vals;
break;
}
if (v > err_max)
err_max = v;
}
+#if 0
+ printf("ref=\n");
+ for(i=0;i<8;i++) {
+ int j;
+ for(j=0;j<8;j++) {
+ printf(" %3d", img_dest1[i*8+j]);
+ }
+ printf("\n");
+ }
+
+ printf("out=\n");
+ for(i=0;i<8;i++) {
+ int j;
+ for(j=0;j<8;j++) {
+ printf(" %3d", img_dest[i*8+j]);
+ }
+ printf("\n");
+ }
+#endif
}
printf("%s %s: err_inf=%d\n", 1 ? "IDCT248" : "DCT248", name, err_max);
int test = 1;
int speed = 0;
int err = 0;
+ int bits=8;
cpu_flags = av_get_cpu_flags();
if (optind < argc)
test = atoi(argv[optind]);
+ if(optind+1 < argc) bits= atoi(argv[optind+1]);
printf("ffmpeg DCT/IDCT test\n");
const struct algo *algos = test_idct ? idct_tab : fdct_tab;
for (i = 0; algos[i].name; i++)
if (!(~cpu_flags & algos[i].mm_support)) {
- err |= dct_error(&algos[i], test, test_idct, speed);
+ err |= dct_error(&algos[i], test, test_idct, speed, bits);
}
}