1 /*
2 * Copyright (c) 2022 Ben Avison
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21 #include <string.h>
22
24
27
32
33 #define IDCTDSP_TEST(func) { #func, offsetof(IDCTDSPContext, func) },
34
39
40 #define RANDOMIZE_BUFFER16(name, size) \
41 do { \
42 int i; \
43 for (i = 0; i < size; ++i) { \
44 uint16_t r = rnd() % 0x201 - 0x100; \
45 AV_WN16A(name##0 + i, r); \
46 AV_WN16A(name##1 + i, r); \
47 } \
48 } while (0)
49
50 #define RANDOMIZE_BUFFER8(name, size) \
51 do { \
52 int i; \
53 for (i = 0; i < size; ++i) { \
54 uint8_t r = rnd(); \
55 name##0[i] = r; \
56 name##1[i] = r; \
57 } \
58 } while (0)
59
61 {
62 /* Source buffers are only as big as needed, since any over-read won't affect results */
65 /* Destination buffers have borders of one row above/below and 8 columns left/right to catch overflows */
68
71
76 };
77
79
81 void (*
func)(
const int16_t *, uint8_t * ptrdiff_t) = *(
void **)((intptr_t) &
h +
tests[t].
offset);
83 declare_func(
void,
const int16_t *, uint8_t *, ptrdiff_t);
88 if (memcmp(dst0, dst1, 10 * 24))
91 }
92 }
93 }
94
96 {
99 }