| Line | Branch | Exec | Source |
|---|---|---|---|
| 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> | ||
| 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() & 0xff; \ | ||
| 31 | } while (0) | ||
| 32 | |||
| 33 | 14 | static void check_chroma_mc(void) | |
| 34 | { | ||
| 35 | RV34DSPContext h; | ||
| 36 | 14 | LOCAL_ALIGNED_32(uint8_t, src, [16 * 18 * 2]); | |
| 37 | 14 | LOCAL_ALIGNED_32(uint8_t, dst0, [16 * 18 * 2]); | |
| 38 | 14 | LOCAL_ALIGNED_32(uint8_t, dst1, [16 * 18 * 2]); | |
| 39 | |||
| 40 | 14 | declare_func(void, uint8_t *dst, const uint8_t *src, | |
| 41 | ptrdiff_t stride, int h, int x, int y); | ||
| 42 | |||
| 43 | 14 | ff_rv40dsp_init(&h); | |
| 44 |
2/2✓ Branch 1 taken 8064 times.
✓ Branch 2 taken 14 times.
|
8078 | randomize_buffers(); |
| 45 |
2/2✓ Branch 0 taken 28 times.
✓ Branch 1 taken 14 times.
|
42 | 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, 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 | |||
| 66 |
8/16✓ Branch 3 taken 4 times.
✓ Branch 4 taken 24 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 16 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 16 times.
✗ Branch 56 not taken.
✗ Branch 57 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✓ Branch 65 taken 16 times.
✓ Branch 66 taken 8 times.
✓ Branch 68 taken 8 times.
✓ Branch 69 taken 4 times.
|
52 | CHECK_CHROMA_MC(put_chroma); |
| 67 |
8/16✓ Branch 3 taken 4 times.
✓ Branch 4 taken 24 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 16 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 16 times.
✗ Branch 56 not taken.
✗ Branch 57 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✓ Branch 65 taken 16 times.
✓ Branch 66 taken 8 times.
✓ Branch 68 taken 8 times.
✓ Branch 69 taken 4 times.
|
52 | CHECK_CHROMA_MC(avg_chroma); |
| 68 | } | ||
| 69 | 14 | } | |
| 70 | |||
| 71 | 14 | void checkasm_check_rv40dsp(void) | |
| 72 | { | ||
| 73 | 14 | check_chroma_mc(); | |
| 74 | 14 | report("chroma_mc"); | |
| 75 | 14 | } | |
| 76 |