1 /*
2 * Copyright (c) 2024 Institute of Software Chinese Academy of Sciences (ISCAS).
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 #include <stdint.h>
26
27 #define randomize_buffers() \
28 do { \
29 for (int i = 0; i < 16*18*2; i++) \
30 src[i] = rnd() & 0xff; \
31 } while (0)
32
34 {
39
41 ptrdiff_t
stride,
int h,
int x,
int y);
42
46
47 #define CHECK_CHROMA_MC(name) \
48 do { \
49 if (check_func(h.name## _pixels_tab[size], #name "_mc%d", 1 << (3 - size))) { \
50 for (int x = 0, mx = 0; x < 2; x++, mx = 1 + (rnd() % 7)) { \
51 for (int y = 0, my = 0; y < 2; y++, my = 1 + (rnd() % 7)) { \
52 memcpy(dst0, src, 16 * 18); \
53 memcpy(dst1, src, 16 * 18); \
54 call_ref(dst0, src, 16, 16, mx, my); \
55 call_new(dst1, src, 16, 16, mx, my); \
56 if (memcmp(dst0, dst1, 16 * 16)) { \
57 fprintf(stderr, #name ": x:%i, y:%i\n", x, y); \
58 fail(); \
59 } \
60 bench_new(dst1, src, 16, 16, x, y); \
61 } \
62 } \
63 } \
64 } while (0)
65
68 }
69 }
70
72 {
75 }