| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * Copyright (c) 2024 FFmpeg contributors | ||
| 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 | |||
| 23 | #include "libavutil/intreadwrite.h" | ||
| 24 | #include "libavutil/mem_internal.h" | ||
| 25 | |||
| 26 | #include "libavcodec/hevc/dsp.h" | ||
| 27 | |||
| 28 | #include "checkasm.h" | ||
| 29 | |||
| 30 | #define randomize_buffers(buf, size) \ | ||
| 31 | do { \ | ||
| 32 | int j; \ | ||
| 33 | for (j = 0; j < size; j++) { \ | ||
| 34 | int16_t r = rnd() & 0x7FFF; \ | ||
| 35 | if (rnd() & 1) r = -r; \ | ||
| 36 | AV_WN16A(buf + j, r); \ | ||
| 37 | } \ | ||
| 38 | } while (0) | ||
| 39 | |||
| 40 | 42 | static void check_dequant(HEVCDSPContext *h, int bit_depth) | |
| 41 | { | ||
| 42 | int i; | ||
| 43 | 42 | LOCAL_ALIGNED(32, int16_t, coeffs0, [32 * 32]); | |
| 44 | 42 | LOCAL_ALIGNED(32, int16_t, coeffs1, [32 * 32]); | |
| 45 | |||
| 46 |
2/2✓ Branch 0 taken 168 times.
✓ Branch 1 taken 42 times.
|
210 | for (i = 2; i <= 5; i++) { |
| 47 | 168 | int block_size = 1 << i; | |
| 48 | 168 | int size = block_size * block_size; | |
| 49 | 168 | declare_func(void, int16_t *coeffs, int16_t log2_size); | |
| 50 | |||
| 51 |
2/2✓ Branch 3 taken 16 times.
✓ Branch 4 taken 152 times.
|
168 | if (check_func(h->dequant, "hevc_dequant_%dx%d_%d", |
| 52 | block_size, block_size, bit_depth)) { | ||
| 53 |
4/4✓ Branch 2 taken 2685 times.
✓ Branch 3 taken 2755 times.
✓ Branch 4 taken 5440 times.
✓ Branch 5 taken 16 times.
|
5456 | randomize_buffers(coeffs0, size); |
| 54 | 16 | memcpy(coeffs1, coeffs0, sizeof(*coeffs0) * size); | |
| 55 | |||
| 56 | 16 | call_ref(coeffs0, i); | |
| 57 | 16 | call_new(coeffs1, i); | |
| 58 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
|
16 | if (memcmp(coeffs0, coeffs1, sizeof(*coeffs0) * size)) |
| 59 | ✗ | fail(); | |
| 60 |
1/8✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
|
16 | bench_new(coeffs1, i); |
| 61 | } | ||
| 62 | } | ||
| 63 | 42 | } | |
| 64 | |||
| 65 | 14 | void checkasm_check_hevc_dequant(void) | |
| 66 | { | ||
| 67 | int bit_depth; | ||
| 68 | |||
| 69 |
2/2✓ Branch 0 taken 42 times.
✓ Branch 1 taken 14 times.
|
56 | for (bit_depth = 8; bit_depth <= 12; bit_depth += 2) { |
| 70 | HEVCDSPContext h; | ||
| 71 | |||
| 72 | 42 | ff_hevc_dsp_init(&h, bit_depth); | |
| 73 | 42 | check_dequant(&h, bit_depth); | |
| 74 | } | ||
| 75 | 14 | report("dequant"); | |
| 76 | 14 | } | |
| 77 |