Line | Branch | Exec | Source |
---|---|---|---|
1 | /* | ||
2 | * Copyright (c) 2023 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 "libavutil/mem_internal.h" | ||
22 | |||
23 | #include "libavcodec/svq1encdsp.h" | ||
24 | |||
25 | #include "checkasm.h" | ||
26 | |||
27 | #define BUF_SIZE 1024 | ||
28 | #define MIN_VAL (-255 - 5 * 127) | ||
29 | #define MAX_VAL ( 255 + 5 * 128) | ||
30 | |||
31 | #define randomize(buf, len) \ | ||
32 | do { \ | ||
33 | for (int i = 0; i < len; i++) \ | ||
34 | buf[i] = ((rnd() % (MAX_VAL - MIN_VAL + 1)) + MIN_VAL); \ | ||
35 | } while (0) | ||
36 | |||
37 | 13 | static void test_ssd_int8_vs_int16(SVQ1EncDSPContext *s) { | |
38 | 13 | declare_func(int, const int8_t *pix1, const int16_t *pix2, intptr_t size); | |
39 | |||
40 | int r1, r2; | ||
41 | |||
42 |
2/2✓ Branch 3 taken 2 times.
✓ Branch 4 taken 11 times.
|
13 | if (check_func(s->ssd_int8_vs_int16, "ssd_int8_vs_int16")) { |
43 | 2 | LOCAL_ALIGNED_4(int8_t, p1, [BUF_SIZE]); | |
44 | 2 | LOCAL_ALIGNED_16(int16_t, p2, [BUF_SIZE]); | |
45 | |||
46 |
2/2✓ Branch 1 taken 2048 times.
✓ Branch 2 taken 2 times.
|
2050 | randomize(p1, BUF_SIZE); |
47 |
2/2✓ Branch 1 taken 2048 times.
✓ Branch 2 taken 2 times.
|
2050 | randomize(p2, BUF_SIZE); |
48 | |||
49 | 2 | r1 = call_ref(p1, p2, BUF_SIZE); | |
50 | 2 | r2 = call_new(p1, p2, BUF_SIZE); | |
51 | |||
52 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if (r1 != r2) { |
53 | ✗ | fail(); | |
54 | } | ||
55 | |||
56 |
1/8✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
|
2 | bench_new(p1, p2, BUF_SIZE); |
57 | } | ||
58 | |||
59 | 13 | report("ssd_int8_vs_int16"); | |
60 | |||
61 | 13 | } | |
62 | |||
63 | 13 | void checkasm_check_svq1enc(void) | |
64 | { | ||
65 | 13 | SVQ1EncDSPContext s = { 0 }; | |
66 | 13 | ff_svq1enc_init(&s); | |
67 | |||
68 | 13 | test_ssd_int8_vs_int16(&s); | |
69 | 13 | } | |
70 |