Line | Branch | Exec | Source |
---|---|---|---|
1 | /* | ||
2 | * Copyright (c) 2024 Institue 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> | ||
23 | #include "checkasm.h" | ||
24 | #include "libavcodec/rv40dsp.c" | ||
25 | #include "libavutil/mem_internal.h" | ||
26 | |||
27 | #define randomize_buffers() \ | ||
28 | do { \ | ||
29 | for (int i = 0; i < 16*18*2; i++) \ | ||
30 | src[i] = rnd() & 0x3; \ | ||
31 | } while (0) | ||
32 | |||
33 | 13 | static void check_chroma_mc(void) | |
34 | { | ||
35 | RV34DSPContext h; | ||
36 | 13 | LOCAL_ALIGNED_32(uint8_t, src, [16 * 18 * 2]); | |
37 | 13 | LOCAL_ALIGNED_32(uint8_t, dst0, [16 * 18 * 2]); | |
38 | 13 | LOCAL_ALIGNED_32(uint8_t, dst1, [16 * 18 * 2]); | |
39 | |||
40 |
2/2✓ Branch 1 taken 12 times.
✓ Branch 2 taken 1 times.
|
13 | declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *dst, const uint8_t *src, |
41 | ptrdiff_t stride, int h, int x, int y); | ||
42 | |||
43 | 13 | ff_rv40dsp_init(&h); | |
44 |
2/2✓ Branch 1 taken 7488 times.
✓ Branch 2 taken 13 times.
|
7501 | randomize_buffers(); |
45 |
2/2✓ Branch 0 taken 26 times.
✓ Branch 1 taken 13 times.
|
39 | for (int size = 0; size < 2; size++) { |
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; x < 2; x++) { \ | ||
51 | for (int y = 0; y < 2; y++) { \ | ||
52 | memcpy(dst0, src, 16 * 18); \ | ||
53 | memcpy(dst1, src, 16 * 18); \ | ||
54 | call_ref(dst0, src, 16, 16, x, y); \ | ||
55 | call_new(dst1, src, 16, 16, x, y); \ | ||
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 | |||
66 |
8/16✓ Branch 3 taken 4 times.
✓ Branch 4 taken 22 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 16 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 16 times.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✓ Branch 36 taken 16 times.
✓ Branch 37 taken 8 times.
✓ Branch 38 taken 8 times.
✓ Branch 39 taken 4 times.
|
50 | CHECK_CHROMA_MC(put_chroma); |
67 |
8/16✓ Branch 3 taken 4 times.
✓ Branch 4 taken 22 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 16 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 16 times.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✓ Branch 36 taken 16 times.
✓ Branch 37 taken 8 times.
✓ Branch 38 taken 8 times.
✓ Branch 39 taken 4 times.
|
50 | CHECK_CHROMA_MC(avg_chroma); |
68 | } | ||
69 | 13 | } | |
70 | |||
71 | 13 | void checkasm_check_rv40dsp(void) | |
72 | { | ||
73 | 13 | check_chroma_mc(); | |
74 | 13 | report("chroma_mc"); | |
75 | 13 | } | |
76 |