| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * Copyright (c) 2023-2024 Nuo Mi | ||
| 3 | * Copyright (c) 2023-2024 Wu Jianhua | ||
| 4 | * | ||
| 5 | * This file is part of FFmpeg. | ||
| 6 | * | ||
| 7 | * FFmpeg is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; either version 2 of the License, or | ||
| 10 | * (at your option) any later version. | ||
| 11 | * | ||
| 12 | * FFmpeg is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License along | ||
| 18 | * with FFmpeg; if not, write to the Free Software Foundation, Inc., | ||
| 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include <string.h> | ||
| 23 | |||
| 24 | #include "checkasm.h" | ||
| 25 | #include "libavcodec/vvc/ctu.h" | ||
| 26 | #include "libavcodec/vvc/data.h" | ||
| 27 | #include "libavcodec/vvc/dsp.h" | ||
| 28 | |||
| 29 | #include "libavutil/common.h" | ||
| 30 | #include "libavutil/intreadwrite.h" | ||
| 31 | #include "libavutil/mem_internal.h" | ||
| 32 | |||
| 33 | static const uint32_t pixel_mask[] = { 0xffffffff, 0x03ff03ff, 0x0fff0fff, 0x3fff3fff, 0xffffffff }; | ||
| 34 | static const int sizes[] = { 2, 4, 8, 16, 32, 64, 128 }; | ||
| 35 | |||
| 36 | #define SIZEOF_PIXEL ((bit_depth + 7) / 8) | ||
| 37 | #define PIXEL_STRIDE (MAX_CTU_SIZE * 2) | ||
| 38 | #define EXTRA_BEFORE 3 | ||
| 39 | #define EXTRA_AFTER 4 | ||
| 40 | #define SRC_EXTRA (EXTRA_BEFORE + EXTRA_AFTER) * 2 | ||
| 41 | #define SRC_BUF_SIZE (PIXEL_STRIDE + SRC_EXTRA) * (PIXEL_STRIDE + SRC_EXTRA) | ||
| 42 | #define DST_BUF_SIZE (MAX_CTU_SIZE * MAX_CTU_SIZE * 2) | ||
| 43 | #define SRC_OFFSET ((PIXEL_STRIDE + EXTRA_BEFORE * 2) * EXTRA_BEFORE) | ||
| 44 | |||
| 45 | #define randomize_buffers(buf0, buf1, size, mask) \ | ||
| 46 | do { \ | ||
| 47 | int k; \ | ||
| 48 | for (k = 0; k < size; k += 4 / sizeof(*buf0)) { \ | ||
| 49 | uint32_t r = rnd() & mask; \ | ||
| 50 | AV_WN32A(buf0 + k, r); \ | ||
| 51 | AV_WN32A(buf1 + k, r); \ | ||
| 52 | } \ | ||
| 53 | } while (0) | ||
| 54 | |||
| 55 | #define randomize_pixels(buf0, buf1, size) \ | ||
| 56 | do { \ | ||
| 57 | uint32_t mask = pixel_mask[(bit_depth - 8) >> 1]; \ | ||
| 58 | randomize_buffers(buf0, buf1, size, mask); \ | ||
| 59 | } while (0) | ||
| 60 | |||
| 61 | #define randomize_avg_src(buf0, buf1, size) \ | ||
| 62 | do { \ | ||
| 63 | uint32_t mask = 0x3fff3fff; \ | ||
| 64 | randomize_buffers(buf0, buf1, size, mask); \ | ||
| 65 | } while (0) | ||
| 66 | |||
| 67 | #define randomize_prof_src(buf0, buf1, size) \ | ||
| 68 | do { \ | ||
| 69 | const int shift = 14 - bit_depth; \ | ||
| 70 | const int mask16 = 0x3fff >> shift << shift; \ | ||
| 71 | uint32_t mask = (mask16 << 16) | mask16; \ | ||
| 72 | randomize_buffers(buf0, buf1, size, mask); \ | ||
| 73 | } while (0) | ||
| 74 | |||
| 75 | 14 | static void check_put_vvc_luma(void) | |
| 76 | { | ||
| 77 | 14 | LOCAL_ALIGNED_32(int16_t, dst0, [DST_BUF_SIZE / 2]); | |
| 78 | 14 | LOCAL_ALIGNED_32(int16_t, dst1, [DST_BUF_SIZE / 2]); | |
| 79 | 14 | LOCAL_ALIGNED_32(uint8_t, src0, [SRC_BUF_SIZE]); | |
| 80 | 14 | LOCAL_ALIGNED_32(uint8_t, src1, [SRC_BUF_SIZE]); | |
| 81 | VVCDSPContext c; | ||
| 82 | |||
| 83 | 14 | declare_func(void, int16_t *dst, const uint8_t *src, const ptrdiff_t src_stride, | |
| 84 | const int height, const int8_t *hf, const int8_t *vf, const int width); | ||
| 85 | |||
| 86 |
2/2✓ Branch 0 taken 42 times.
✓ Branch 1 taken 14 times.
|
56 | for (int bit_depth = 8; bit_depth <= 12; bit_depth += 2) { |
| 87 |
2/2✓ Branch 1 taken 765450 times.
✓ Branch 2 taken 42 times.
|
765492 | randomize_pixels(src0, src1, SRC_BUF_SIZE); |
| 88 | 42 | ff_vvc_dsp_init(&c, bit_depth); | |
| 89 |
2/2✓ Branch 0 taken 84 times.
✓ Branch 1 taken 42 times.
|
126 | for (int i = 0; i < 2; i++) { |
| 90 |
2/2✓ Branch 0 taken 168 times.
✓ Branch 1 taken 84 times.
|
252 | for (int j = 0; j < 2; j++) { |
| 91 |
2/2✓ Branch 0 taken 1008 times.
✓ Branch 1 taken 168 times.
|
1176 | for (int h = 4; h <= MAX_CTU_SIZE; h *= 2) { |
| 92 |
2/2✓ Branch 0 taken 6048 times.
✓ Branch 1 taken 1008 times.
|
7056 | for (int w = 4; w <= MAX_CTU_SIZE; w *= 2) { |
| 93 | 6048 | const int idx = av_log2(w) - 1; | |
| 94 | 6048 | const int mx = rnd() % 16; | |
| 95 | 6048 | const int my = rnd() % 16; | |
| 96 | 6048 | const int8_t *hf = ff_vvc_inter_luma_filters[rnd() % 3][mx]; | |
| 97 | 6048 | const int8_t *vf = ff_vvc_inter_luma_filters[rnd() % 3][my]; | |
| 98 | const char *type; | ||
| 99 |
4/5✓ Branch 0 taken 1512 times.
✓ Branch 1 taken 1512 times.
✓ Branch 2 taken 1512 times.
✓ Branch 3 taken 1512 times.
✗ Branch 4 not taken.
|
6048 | switch ((j << 1) | i) { |
| 100 | 1512 | case 0: type = "put_luma_pixels"; break; // 0 0 | |
| 101 | 1512 | case 1: type = "put_luma_h"; break; // 0 1 | |
| 102 | 1512 | case 2: type = "put_luma_v"; break; // 1 0 | |
| 103 | 1512 | case 3: type = "put_luma_hv"; break; // 1 1 | |
| 104 | } | ||
| 105 |
2/2✓ Branch 3 taken 1110 times.
✓ Branch 4 taken 4938 times.
|
6048 | if (check_func(c.inter.put[LUMA][idx][j][i], "%s_%d_%dx%d", type, bit_depth, w, h)) { |
| 106 | 1110 | memset(dst0, 0, DST_BUF_SIZE); | |
| 107 | 1110 | memset(dst1, 0, DST_BUF_SIZE); | |
| 108 | 1110 | call_ref(dst0, src0 + SRC_OFFSET, PIXEL_STRIDE, h, hf, vf, w); | |
| 109 | 1110 | call_new(dst1, src1 + SRC_OFFSET, PIXEL_STRIDE, h, hf, vf, w); | |
| 110 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1110 times.
|
1110 | if (memcmp(dst0, dst1, DST_BUF_SIZE)) |
| 111 | ✗ | fail(); | |
| 112 |
2/2✓ Branch 0 taken 185 times.
✓ Branch 1 taken 925 times.
|
1110 | if (w == h) |
| 113 |
1/8✗ Branch 1 not taken.
✓ Branch 2 taken 185 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.
|
185 | bench_new(dst1, src1 + SRC_OFFSET, PIXEL_STRIDE, h, hf, vf, w); |
| 114 | } | ||
| 115 | } | ||
| 116 | } | ||
| 117 | } | ||
| 118 | } | ||
| 119 | } | ||
| 120 | 14 | report("put_luma"); | |
| 121 | 14 | } | |
| 122 | |||
| 123 | 14 | static void check_put_vvc_luma_uni(void) | |
| 124 | { | ||
| 125 | 14 | LOCAL_ALIGNED_32(uint8_t, dst0, [DST_BUF_SIZE]); | |
| 126 | 14 | LOCAL_ALIGNED_32(uint8_t, dst1, [DST_BUF_SIZE]); | |
| 127 | 14 | LOCAL_ALIGNED_32(uint8_t, src0, [SRC_BUF_SIZE]); | |
| 128 | 14 | LOCAL_ALIGNED_32(uint8_t, src1, [SRC_BUF_SIZE]); | |
| 129 | |||
| 130 | VVCDSPContext c; | ||
| 131 | 14 | declare_func(void, uint8_t *dst, ptrdiff_t dststride, | |
| 132 | const uint8_t *src, ptrdiff_t srcstride, int height, | ||
| 133 | const int8_t *hf, const int8_t *vf, int width); | ||
| 134 | |||
| 135 |
2/2✓ Branch 0 taken 42 times.
✓ Branch 1 taken 14 times.
|
56 | for (int bit_depth = 8; bit_depth <= 12; bit_depth += 2) { |
| 136 | 42 | ff_vvc_dsp_init(&c, bit_depth); | |
| 137 |
2/2✓ Branch 1 taken 765450 times.
✓ Branch 2 taken 42 times.
|
765492 | randomize_pixels(src0, src1, SRC_BUF_SIZE); |
| 138 |
2/2✓ Branch 0 taken 84 times.
✓ Branch 1 taken 42 times.
|
126 | for (int i = 0; i < 2; i++) { |
| 139 |
2/2✓ Branch 0 taken 168 times.
✓ Branch 1 taken 84 times.
|
252 | for (int j = 0; j < 2; j++) { |
| 140 |
2/2✓ Branch 0 taken 1008 times.
✓ Branch 1 taken 168 times.
|
1176 | for (int h = 4; h <= MAX_CTU_SIZE; h *= 2) { |
| 141 |
2/2✓ Branch 0 taken 6048 times.
✓ Branch 1 taken 1008 times.
|
7056 | for (int w = 4; w <= MAX_CTU_SIZE; w *= 2) { |
| 142 | 6048 | const int idx = av_log2(w) - 1; | |
| 143 | 6048 | const int mx = rnd() % VVC_INTER_LUMA_FACTS; | |
| 144 | 6048 | const int my = rnd() % VVC_INTER_LUMA_FACTS; | |
| 145 | 6048 | const int8_t *hf = ff_vvc_inter_luma_filters[rnd() % VVC_INTER_LUMA_FILTER_TYPES][mx]; | |
| 146 | 6048 | const int8_t *vf = ff_vvc_inter_luma_filters[rnd() % VVC_INTER_LUMA_FILTER_TYPES][my]; | |
| 147 | const char *type; | ||
| 148 | |||
| 149 |
4/5✓ Branch 0 taken 1512 times.
✓ Branch 1 taken 1512 times.
✓ Branch 2 taken 1512 times.
✓ Branch 3 taken 1512 times.
✗ Branch 4 not taken.
|
6048 | switch ((j << 1) | i) { |
| 150 | 1512 | case 0: type = "put_uni_pixels"; break; // 0 0 | |
| 151 | 1512 | case 1: type = "put_uni_h"; break; // 0 1 | |
| 152 | 1512 | case 2: type = "put_uni_v"; break; // 1 0 | |
| 153 | 1512 | case 3: type = "put_uni_hv"; break; // 1 1 | |
| 154 | } | ||
| 155 | |||
| 156 |
2/2✓ Branch 3 taken 1110 times.
✓ Branch 4 taken 4938 times.
|
6048 | if (check_func(c.inter.put_uni[LUMA][idx][j][i], "%s_luma_%d_%dx%d", type, bit_depth, w, h)) { |
| 157 | 1110 | memset(dst0, 0, DST_BUF_SIZE); | |
| 158 | 1110 | memset(dst1, 0, DST_BUF_SIZE); | |
| 159 | 1110 | call_ref(dst0, PIXEL_STRIDE, src0 + SRC_OFFSET, PIXEL_STRIDE, h, hf, vf, w); | |
| 160 | 1110 | call_new(dst1, PIXEL_STRIDE, src1 + SRC_OFFSET, PIXEL_STRIDE, h, hf, vf, w); | |
| 161 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1110 times.
|
1110 | if (memcmp(dst0, dst1, DST_BUF_SIZE)) |
| 162 | ✗ | fail(); | |
| 163 |
2/2✓ Branch 0 taken 185 times.
✓ Branch 1 taken 925 times.
|
1110 | if (w == h) |
| 164 |
1/8✗ Branch 1 not taken.
✓ Branch 2 taken 185 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.
|
185 | bench_new(dst1, PIXEL_STRIDE, src1 + SRC_OFFSET, PIXEL_STRIDE, h, hf, vf, w); |
| 165 | } | ||
| 166 | } | ||
| 167 | } | ||
| 168 | } | ||
| 169 | } | ||
| 170 | } | ||
| 171 | 14 | report("put_uni_luma"); | |
| 172 | 14 | } | |
| 173 | |||
| 174 | 14 | static void check_put_vvc_chroma(void) | |
| 175 | { | ||
| 176 | 14 | LOCAL_ALIGNED_32(int16_t, dst0, [DST_BUF_SIZE / 2]); | |
| 177 | 14 | LOCAL_ALIGNED_32(int16_t, dst1, [DST_BUF_SIZE / 2]); | |
| 178 | 14 | LOCAL_ALIGNED_32(uint8_t, src0, [SRC_BUF_SIZE]); | |
| 179 | 14 | LOCAL_ALIGNED_32(uint8_t, src1, [SRC_BUF_SIZE]); | |
| 180 | VVCDSPContext c; | ||
| 181 | |||
| 182 | 14 | declare_func(void, int16_t *dst, const uint8_t *src, const ptrdiff_t src_stride, | |
| 183 | const int height, const int8_t *hf, const int8_t *vf, const int width); | ||
| 184 | |||
| 185 |
2/2✓ Branch 0 taken 42 times.
✓ Branch 1 taken 14 times.
|
56 | for (int bit_depth = 8; bit_depth <= 12; bit_depth += 2) { |
| 186 |
2/2✓ Branch 1 taken 765450 times.
✓ Branch 2 taken 42 times.
|
765492 | randomize_pixels(src0, src1, SRC_BUF_SIZE); |
| 187 | 42 | ff_vvc_dsp_init(&c, bit_depth); | |
| 188 |
2/2✓ Branch 0 taken 84 times.
✓ Branch 1 taken 42 times.
|
126 | for (int i = 0; i < 2; i++) { |
| 189 |
2/2✓ Branch 0 taken 168 times.
✓ Branch 1 taken 84 times.
|
252 | for (int j = 0; j < 2; j++) { |
| 190 |
2/2✓ Branch 0 taken 1176 times.
✓ Branch 1 taken 168 times.
|
1344 | for (int h = 2; h <= MAX_CTU_SIZE; h *= 2) { |
| 191 |
2/2✓ Branch 0 taken 8232 times.
✓ Branch 1 taken 1176 times.
|
9408 | for (int w = 2; w <= MAX_CTU_SIZE; w *= 2) { |
| 192 | 8232 | const int idx = av_log2(w) - 1; | |
| 193 | 8232 | const int mx = rnd() % VVC_INTER_CHROMA_FACTS; | |
| 194 | 8232 | const int my = rnd() % VVC_INTER_CHROMA_FACTS; | |
| 195 | 8232 | const int8_t *hf = ff_vvc_inter_chroma_filters[rnd() % VVC_INTER_CHROMA_FILTER_TYPES][mx]; | |
| 196 | 8232 | const int8_t *vf = ff_vvc_inter_chroma_filters[rnd() % VVC_INTER_CHROMA_FILTER_TYPES][my]; | |
| 197 | const char *type; | ||
| 198 |
4/5✓ Branch 0 taken 2058 times.
✓ Branch 1 taken 2058 times.
✓ Branch 2 taken 2058 times.
✓ Branch 3 taken 2058 times.
✗ Branch 4 not taken.
|
8232 | switch ((j << 1) | i) { |
| 199 | 2058 | case 0: type = "put_chroma_pixels"; break; // 0 0 | |
| 200 | 2058 | case 1: type = "put_chroma_h"; break; // 0 1 | |
| 201 | 2058 | case 2: type = "put_chroma_v"; break; // 1 0 | |
| 202 | 2058 | case 3: type = "put_chroma_hv"; break; // 1 1 | |
| 203 | } | ||
| 204 |
2/2✓ Branch 3 taken 1463 times.
✓ Branch 4 taken 6769 times.
|
8232 | if (check_func(c.inter.put[CHROMA][idx][j][i], "%s_%d_%dx%d", type, bit_depth, w, h)) { |
| 205 | 1463 | memset(dst0, 0, DST_BUF_SIZE); | |
| 206 | 1463 | memset(dst1, 0, DST_BUF_SIZE); | |
| 207 | 1463 | call_ref(dst0, src0 + SRC_OFFSET, PIXEL_STRIDE, h, hf, vf, w); | |
| 208 | 1463 | call_new(dst1, src1 + SRC_OFFSET, PIXEL_STRIDE, h, hf, vf, w); | |
| 209 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1463 times.
|
1463 | if (memcmp(dst0, dst1, DST_BUF_SIZE)) |
| 210 | ✗ | fail(); | |
| 211 |
2/2✓ Branch 0 taken 209 times.
✓ Branch 1 taken 1254 times.
|
1463 | if (w == h) |
| 212 |
1/8✗ Branch 1 not taken.
✓ Branch 2 taken 209 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.
|
209 | bench_new(dst1, src1 + SRC_OFFSET, PIXEL_STRIDE, h, hf, vf, w); |
| 213 | } | ||
| 214 | } | ||
| 215 | } | ||
| 216 | } | ||
| 217 | } | ||
| 218 | } | ||
| 219 | 14 | report("put_chroma"); | |
| 220 | 14 | } | |
| 221 | |||
| 222 | 14 | static void check_put_vvc_chroma_uni(void) | |
| 223 | { | ||
| 224 | 14 | LOCAL_ALIGNED_32(uint8_t, dst0, [DST_BUF_SIZE]); | |
| 225 | 14 | LOCAL_ALIGNED_32(uint8_t, dst1, [DST_BUF_SIZE]); | |
| 226 | 14 | LOCAL_ALIGNED_32(uint8_t, src0, [SRC_BUF_SIZE]); | |
| 227 | 14 | LOCAL_ALIGNED_32(uint8_t, src1, [SRC_BUF_SIZE]); | |
| 228 | |||
| 229 | VVCDSPContext c; | ||
| 230 | 14 | declare_func(void, uint8_t *dst, ptrdiff_t dststride, | |
| 231 | const uint8_t *src, ptrdiff_t srcstride, int height, | ||
| 232 | const int8_t *hf, const int8_t *vf, int width); | ||
| 233 | |||
| 234 |
2/2✓ Branch 0 taken 42 times.
✓ Branch 1 taken 14 times.
|
56 | for (int bit_depth = 8; bit_depth <= 12; bit_depth += 2) { |
| 235 | 42 | ff_vvc_dsp_init(&c, bit_depth); | |
| 236 |
2/2✓ Branch 1 taken 765450 times.
✓ Branch 2 taken 42 times.
|
765492 | randomize_pixels(src0, src1, SRC_BUF_SIZE); |
| 237 |
2/2✓ Branch 0 taken 84 times.
✓ Branch 1 taken 42 times.
|
126 | for (int i = 0; i < 2; i++) { |
| 238 |
2/2✓ Branch 0 taken 168 times.
✓ Branch 1 taken 84 times.
|
252 | for (int j = 0; j < 2; j++) { |
| 239 |
2/2✓ Branch 0 taken 1008 times.
✓ Branch 1 taken 168 times.
|
1176 | for (int h = 4; h <= MAX_CTU_SIZE; h *= 2) { |
| 240 |
2/2✓ Branch 0 taken 6048 times.
✓ Branch 1 taken 1008 times.
|
7056 | for (int w = 4; w <= MAX_CTU_SIZE; w *= 2) { |
| 241 | 6048 | const int idx = av_log2(w) - 1; | |
| 242 | 6048 | const int mx = rnd() % VVC_INTER_CHROMA_FACTS; | |
| 243 | 6048 | const int my = rnd() % VVC_INTER_CHROMA_FACTS; | |
| 244 | 6048 | const int8_t *hf = ff_vvc_inter_chroma_filters[rnd() % VVC_INTER_CHROMA_FILTER_TYPES][mx]; | |
| 245 | 6048 | const int8_t *vf = ff_vvc_inter_chroma_filters[rnd() % VVC_INTER_CHROMA_FILTER_TYPES][my]; | |
| 246 | const char *type; | ||
| 247 | |||
| 248 |
4/5✓ Branch 0 taken 1512 times.
✓ Branch 1 taken 1512 times.
✓ Branch 2 taken 1512 times.
✓ Branch 3 taken 1512 times.
✗ Branch 4 not taken.
|
6048 | switch ((j << 1) | i) { |
| 249 | 1512 | case 0: type = "put_uni_pixels"; break; // 0 0 | |
| 250 | 1512 | case 1: type = "put_uni_h"; break; // 0 1 | |
| 251 | 1512 | case 2: type = "put_uni_v"; break; // 1 0 | |
| 252 | 1512 | case 3: type = "put_uni_hv"; break; // 1 1 | |
| 253 | } | ||
| 254 | |||
| 255 |
2/2✓ Branch 3 taken 1110 times.
✓ Branch 4 taken 4938 times.
|
6048 | if (check_func(c.inter.put_uni[CHROMA][idx][j][i], "%s_chroma_%d_%dx%d", type, bit_depth, w, h)) { |
| 256 | 1110 | memset(dst0, 0, DST_BUF_SIZE); | |
| 257 | 1110 | memset(dst1, 0, DST_BUF_SIZE); | |
| 258 | 1110 | call_ref(dst0, PIXEL_STRIDE, src0 + SRC_OFFSET, PIXEL_STRIDE, h, hf, vf, w); | |
| 259 | 1110 | call_new(dst1, PIXEL_STRIDE, src1 + SRC_OFFSET, PIXEL_STRIDE, h, hf, vf, w); | |
| 260 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1110 times.
|
1110 | if (memcmp(dst0, dst1, DST_BUF_SIZE)) |
| 261 | ✗ | fail(); | |
| 262 |
2/2✓ Branch 0 taken 185 times.
✓ Branch 1 taken 925 times.
|
1110 | if (w == h) |
| 263 |
1/8✗ Branch 1 not taken.
✓ Branch 2 taken 185 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.
|
185 | bench_new(dst1, PIXEL_STRIDE, src1 + SRC_OFFSET, PIXEL_STRIDE, h, hf, vf, w); |
| 264 | } | ||
| 265 | } | ||
| 266 | } | ||
| 267 | } | ||
| 268 | } | ||
| 269 | } | ||
| 270 | 14 | report("put_uni_chroma"); | |
| 271 | 14 | } | |
| 272 | |||
| 273 | #define AVG_SRC_BUF_SIZE (MAX_CTU_SIZE * MAX_CTU_SIZE) | ||
| 274 | #define AVG_DST_BUF_SIZE (MAX_PB_SIZE * MAX_PB_SIZE * 2) | ||
| 275 | |||
| 276 | 14 | static void check_avg(void) | |
| 277 | { | ||
| 278 | 14 | LOCAL_ALIGNED_32(int16_t, src00, [AVG_SRC_BUF_SIZE]); | |
| 279 | 14 | LOCAL_ALIGNED_32(int16_t, src01, [AVG_SRC_BUF_SIZE]); | |
| 280 | 14 | LOCAL_ALIGNED_32(int16_t, src10, [AVG_SRC_BUF_SIZE]); | |
| 281 | 14 | LOCAL_ALIGNED_32(int16_t, src11, [AVG_SRC_BUF_SIZE]); | |
| 282 | 14 | LOCAL_ALIGNED_32(uint8_t, dst0, [AVG_DST_BUF_SIZE]); | |
| 283 | 14 | LOCAL_ALIGNED_32(uint8_t, dst1, [AVG_DST_BUF_SIZE]); | |
| 284 | VVCDSPContext c; | ||
| 285 | |||
| 286 |
2/2✓ Branch 0 taken 42 times.
✓ Branch 1 taken 14 times.
|
56 | for (int bit_depth = 8; bit_depth <= 12; bit_depth += 2) { |
| 287 |
2/2✓ Branch 1 taken 344064 times.
✓ Branch 2 taken 42 times.
|
344106 | randomize_avg_src((uint8_t*)src00, (uint8_t*)src10, AVG_SRC_BUF_SIZE * sizeof(int16_t)); |
| 288 |
2/2✓ Branch 1 taken 344064 times.
✓ Branch 2 taken 42 times.
|
344106 | randomize_avg_src((uint8_t*)src01, (uint8_t*)src11, AVG_SRC_BUF_SIZE * sizeof(int16_t)); |
| 289 | 42 | ff_vvc_dsp_init(&c, bit_depth); | |
| 290 |
2/2✓ Branch 0 taken 294 times.
✓ Branch 1 taken 42 times.
|
336 | for (int h = 2; h <= MAX_CTU_SIZE; h *= 2) { |
| 291 |
2/2✓ Branch 0 taken 2058 times.
✓ Branch 1 taken 294 times.
|
2352 | for (int w = 2; w <= MAX_CTU_SIZE; w *= 2) { |
| 292 | { | ||
| 293 | 2058 | declare_func(void, uint8_t *dst, ptrdiff_t dst_stride, | |
| 294 | const int16_t *src0, const int16_t *src1, int width, int height); | ||
| 295 |
2/2✓ Branch 3 taken 294 times.
✓ Branch 4 taken 1764 times.
|
2058 | if (check_func(c.inter.avg, "avg_%d_%dx%d", bit_depth, w, h)) { |
| 296 | 294 | memset(dst0, 0, AVG_DST_BUF_SIZE); | |
| 297 | 294 | memset(dst1, 0, AVG_DST_BUF_SIZE); | |
| 298 | 294 | call_ref(dst0, MAX_CTU_SIZE * SIZEOF_PIXEL, src00, src01, w, h); | |
| 299 | 294 | call_new(dst1, MAX_CTU_SIZE * SIZEOF_PIXEL, src10, src11, w, h); | |
| 300 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 294 times.
|
294 | if (memcmp(dst0, dst1, DST_BUF_SIZE)) |
| 301 | ✗ | fail(); | |
| 302 |
2/2✓ Branch 0 taken 42 times.
✓ Branch 1 taken 252 times.
|
294 | if (w == h) |
| 303 |
1/8✗ Branch 1 not taken.
✓ Branch 2 taken 42 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.
|
42 | bench_new(dst0, MAX_CTU_SIZE * SIZEOF_PIXEL, src00, src01, w, h); |
| 304 | } | ||
| 305 | } | ||
| 306 | { | ||
| 307 | 2058 | declare_func(void, uint8_t *dst, ptrdiff_t dst_stride, | |
| 308 | const int16_t *src0, const int16_t *src1, int width, int height, | ||
| 309 | int denom, int w0, int w1, int o); | ||
| 310 | { | ||
| 311 | 2058 | const int denom = rnd() % 8; | |
| 312 | 2058 | const int w0 = rnd() % 256 - 128; | |
| 313 | 2058 | const int w1 = rnd() % 256 - 128; | |
| 314 | 2058 | const int o0 = rnd() % 256 - 128; | |
| 315 | 2058 | const int o1 = rnd() % 256 - 128; | |
| 316 |
2/2✓ Branch 3 taken 294 times.
✓ Branch 4 taken 1764 times.
|
2058 | if (check_func(c.inter.w_avg, "w_avg_%d_%dx%d", bit_depth, w, h)) { |
| 317 | 294 | memset(dst0, 0, AVG_DST_BUF_SIZE); | |
| 318 | 294 | memset(dst1, 0, AVG_DST_BUF_SIZE); | |
| 319 | |||
| 320 | 294 | call_ref(dst0, MAX_CTU_SIZE * SIZEOF_PIXEL, src00, src01, w, h, denom, w0, w1, o0 + o1); | |
| 321 | 294 | call_new(dst1, MAX_CTU_SIZE * SIZEOF_PIXEL, src10, src11, w, h, denom, w0, w1, o0 + o1); | |
| 322 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 294 times.
|
294 | if (memcmp(dst0, dst1, DST_BUF_SIZE)) |
| 323 | ✗ | fail(); | |
| 324 |
2/2✓ Branch 0 taken 42 times.
✓ Branch 1 taken 252 times.
|
294 | if (w == h) |
| 325 |
1/8✗ Branch 1 not taken.
✓ Branch 2 taken 42 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.
|
42 | bench_new(dst0, MAX_CTU_SIZE * SIZEOF_PIXEL, src00, src01, w, h, denom, w0, w1, o0 + o1); |
| 326 | } | ||
| 327 | } | ||
| 328 | } | ||
| 329 | } | ||
| 330 | } | ||
| 331 | } | ||
| 332 | 14 | report("avg"); | |
| 333 | 14 | } | |
| 334 | |||
| 335 | #define SR_RANGE 2 | ||
| 336 | 14 | static void check_dmvr(void) | |
| 337 | { | ||
| 338 | 14 | LOCAL_ALIGNED_32(uint16_t, dst0, [DST_BUF_SIZE]); | |
| 339 | 14 | LOCAL_ALIGNED_32(uint16_t, dst1, [DST_BUF_SIZE]); | |
| 340 | 14 | LOCAL_ALIGNED_32(uint8_t, src0, [SRC_BUF_SIZE]); | |
| 341 | 14 | LOCAL_ALIGNED_32(uint8_t, src1, [SRC_BUF_SIZE]); | |
| 342 | 14 | const int dst_stride = MAX_PB_SIZE * sizeof(int16_t); | |
| 343 | |||
| 344 | VVCDSPContext c; | ||
| 345 | 14 | declare_func(void, int16_t *dst, const uint8_t *src, ptrdiff_t src_stride, int height, | |
| 346 | intptr_t mx, intptr_t my, int width); | ||
| 347 | |||
| 348 |
2/2✓ Branch 0 taken 42 times.
✓ Branch 1 taken 14 times.
|
56 | for (int bit_depth = 8; bit_depth <= 12; bit_depth += 2) { |
| 349 | 42 | ff_vvc_dsp_init(&c, bit_depth); | |
| 350 |
2/2✓ Branch 1 taken 765450 times.
✓ Branch 2 taken 42 times.
|
765492 | randomize_pixels(src0, src1, SRC_BUF_SIZE); |
| 351 |
2/2✓ Branch 0 taken 84 times.
✓ Branch 1 taken 42 times.
|
126 | for (int i = 0; i < 2; i++) { |
| 352 |
2/2✓ Branch 0 taken 168 times.
✓ Branch 1 taken 84 times.
|
252 | for (int j = 0; j < 2; j++) { |
| 353 |
2/2✓ Branch 0 taken 336 times.
✓ Branch 1 taken 168 times.
|
504 | for (int h = 8; h <= 16; h *= 2) { |
| 354 |
2/2✓ Branch 0 taken 672 times.
✓ Branch 1 taken 336 times.
|
1008 | for (int w = 8; w <= 16; w *= 2) { |
| 355 | 672 | const int pred_w = w + 2 * SR_RANGE; | |
| 356 | 672 | const int pred_h = h + 2 * SR_RANGE; | |
| 357 | 672 | const int mx = rnd() % VVC_INTER_LUMA_DMVR_FACTS; | |
| 358 | 672 | const int my = rnd() % VVC_INTER_LUMA_DMVR_FACTS; | |
| 359 | const char *type; | ||
| 360 | |||
| 361 |
2/2✓ Branch 0 taken 168 times.
✓ Branch 1 taken 504 times.
|
672 | if (w * h < 128) |
| 362 | 168 | continue; | |
| 363 | |||
| 364 |
4/5✓ Branch 0 taken 126 times.
✓ Branch 1 taken 126 times.
✓ Branch 2 taken 126 times.
✓ Branch 3 taken 126 times.
✗ Branch 4 not taken.
|
504 | switch ((j << 1) | i) { |
| 365 | 126 | case 0: type = "dmvr"; break; // 0 0 | |
| 366 | 126 | case 1: type = "dmvr_h"; break; // 0 1 | |
| 367 | 126 | case 2: type = "dmvr_v"; break; // 1 0 | |
| 368 | 126 | case 3: type = "dmvr_hv"; break; // 1 1 | |
| 369 | } | ||
| 370 | |||
| 371 |
2/2✓ Branch 3 taken 72 times.
✓ Branch 4 taken 432 times.
|
504 | if (check_func(c.inter.dmvr[j][i], "%s_%d_%dx%d", type, bit_depth, pred_w, pred_h)) { |
| 372 | 72 | memset(dst0, 0, DST_BUF_SIZE); | |
| 373 | 72 | memset(dst1, 0, DST_BUF_SIZE); | |
| 374 | 72 | call_ref(dst0, src0 + SRC_OFFSET, PIXEL_STRIDE, pred_h, mx, my, pred_w); | |
| 375 | 72 | call_new(dst1, src1 + SRC_OFFSET, PIXEL_STRIDE, pred_h, mx, my, pred_w); | |
| 376 |
2/2✓ Branch 0 taken 1248 times.
✓ Branch 1 taken 72 times.
|
1320 | for (int k = 0; k < pred_h; k++) { |
| 377 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1248 times.
|
1248 | if (memcmp(dst0 + k * dst_stride, dst1 + k * dst_stride, pred_w * sizeof(int16_t))) { |
| 378 | ✗ | fail(); | |
| 379 | ✗ | break; | |
| 380 | } | ||
| 381 | } | ||
| 382 | |||
| 383 |
1/8✗ Branch 1 not taken.
✓ Branch 2 taken 72 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.
|
72 | bench_new(dst1, src1 + SRC_OFFSET, PIXEL_STRIDE, pred_h, mx, my, pred_w); |
| 384 | } | ||
| 385 | } | ||
| 386 | } | ||
| 387 | } | ||
| 388 | } | ||
| 389 | } | ||
| 390 | 14 | report("dmvr"); | |
| 391 | 14 | } | |
| 392 | |||
| 393 | #define BDOF_BLOCK_SIZE 16 | ||
| 394 | #define BDOF_SRC_SIZE (MAX_PB_SIZE* (BDOF_BLOCK_SIZE + 2)) | ||
| 395 | #define BDOF_SRC_OFFSET (MAX_PB_SIZE + 1) | ||
| 396 | #define BDOF_DST_SIZE (BDOF_BLOCK_SIZE * BDOF_BLOCK_SIZE * 2) | ||
| 397 | 14 | static void check_bdof(void) | |
| 398 | { | ||
| 399 | 14 | LOCAL_ALIGNED_32(uint8_t, dst0, [BDOF_DST_SIZE]); | |
| 400 | 14 | LOCAL_ALIGNED_32(uint8_t, dst1, [BDOF_DST_SIZE]); | |
| 401 | 14 | LOCAL_ALIGNED_32(uint16_t, src00, [BDOF_SRC_SIZE]); | |
| 402 | 14 | LOCAL_ALIGNED_32(uint16_t, src01, [BDOF_SRC_SIZE]); | |
| 403 | 14 | LOCAL_ALIGNED_32(uint16_t, src10, [BDOF_SRC_SIZE]); | |
| 404 | 14 | LOCAL_ALIGNED_32(uint16_t, src11, [BDOF_SRC_SIZE]); | |
| 405 | |||
| 406 | VVCDSPContext c; | ||
| 407 | 14 | declare_func(void, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *src0, const int16_t *src1, int block_w, int block_h); | |
| 408 | |||
| 409 |
2/2✓ Branch 0 taken 42 times.
✓ Branch 1 taken 14 times.
|
56 | for (int bit_depth = 8; bit_depth <= 12; bit_depth += 2) { |
| 410 | 42 | const int dst_stride = BDOF_BLOCK_SIZE * SIZEOF_PIXEL; | |
| 411 | |||
| 412 | 42 | ff_vvc_dsp_init(&c, bit_depth); | |
| 413 |
2/2✓ Branch 1 taken 48384 times.
✓ Branch 2 taken 42 times.
|
48426 | randomize_prof_src(src00, src10, BDOF_SRC_SIZE); |
| 414 |
2/2✓ Branch 1 taken 48384 times.
✓ Branch 2 taken 42 times.
|
48426 | randomize_prof_src(src01, src11, BDOF_SRC_SIZE); |
| 415 |
2/2✓ Branch 0 taken 84 times.
✓ Branch 1 taken 42 times.
|
126 | for (int h = 8; h <= 16; h *= 2) { |
| 416 |
2/2✓ Branch 0 taken 168 times.
✓ Branch 1 taken 84 times.
|
252 | for (int w = 8; w <= 16; w *= 2) { |
| 417 |
2/2✓ Branch 0 taken 42 times.
✓ Branch 1 taken 126 times.
|
168 | if (w * h < 128) |
| 418 | 42 | continue; | |
| 419 |
2/2✓ Branch 3 taken 18 times.
✓ Branch 4 taken 108 times.
|
126 | if (check_func(c.inter.apply_bdof, "apply_bdof_%d_%dx%d", bit_depth, w, h)) { |
| 420 | 18 | memset(dst0, 0, BDOF_DST_SIZE); | |
| 421 | 18 | memset(dst1, 0, BDOF_DST_SIZE); | |
| 422 | 18 | call_ref(dst0, dst_stride, src00 + BDOF_SRC_OFFSET, src01 + BDOF_SRC_OFFSET, w, h); | |
| 423 | 18 | call_new(dst1, dst_stride, src10 + BDOF_SRC_OFFSET, src11 + BDOF_SRC_OFFSET, w, h); | |
| 424 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
|
18 | if (memcmp(dst0, dst1, BDOF_DST_SIZE)) |
| 425 | ✗ | fail(); | |
| 426 |
1/8✗ Branch 1 not taken.
✓ Branch 2 taken 18 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.
|
18 | bench_new(dst0, dst_stride, src00 + BDOF_SRC_OFFSET, src01 + BDOF_SRC_OFFSET, w, h); |
| 427 | } | ||
| 428 | } | ||
| 429 | } | ||
| 430 | } | ||
| 431 | 14 | report("apply_bdof"); | |
| 432 | 14 | } | |
| 433 | |||
| 434 | 14 | static void check_vvc_sad(void) | |
| 435 | { | ||
| 436 | 14 | const int bit_depth = 10; | |
| 437 | VVCDSPContext c; | ||
| 438 | 14 | LOCAL_ALIGNED_32(uint16_t, src0, [MAX_CTU_SIZE * MAX_CTU_SIZE * 4]); | |
| 439 | 14 | LOCAL_ALIGNED_32(uint16_t, src1, [MAX_CTU_SIZE * MAX_CTU_SIZE * 4]); | |
| 440 | 14 | declare_func(int, const int16_t *src0, const int16_t *src1, int dx, int dy, int block_w, int block_h); | |
| 441 | |||
| 442 | 14 | ff_vvc_dsp_init(&c, bit_depth); | |
| 443 |
2/2✓ Branch 1 taken 458752 times.
✓ Branch 2 taken 14 times.
|
458766 | randomize_pixels(src0, src1, MAX_CTU_SIZE * MAX_CTU_SIZE * 4); |
| 444 |
2/2✓ Branch 0 taken 28 times.
✓ Branch 1 taken 14 times.
|
42 | for (int h = 8; h <= 16; h *= 2) { |
| 445 |
2/2✓ Branch 0 taken 56 times.
✓ Branch 1 taken 28 times.
|
84 | for (int w = 8; w <= 16; w *= 2) { |
| 446 |
2/2✓ Branch 0 taken 280 times.
✓ Branch 1 taken 56 times.
|
336 | for(int offy = 0; offy <= 4; offy++) { |
| 447 |
2/2✓ Branch 0 taken 1400 times.
✓ Branch 1 taken 280 times.
|
1680 | for(int offx = 0; offx <= 4; offx++) { |
| 448 |
2/2✓ Branch 0 taken 350 times.
✓ Branch 1 taken 1050 times.
|
1400 | if (w * h < 128) |
| 449 | 350 | continue; | |
| 450 | |||
| 451 |
2/2✓ Branch 3 taken 6 times.
✓ Branch 4 taken 1044 times.
|
1050 | if (check_func(c.inter.sad, "sad_%dx%d", w, h)) { |
| 452 | int result0; | ||
| 453 | int result1; | ||
| 454 | |||
| 455 | 6 | result0 = call_ref(src0 + PIXEL_STRIDE * 2 + 2, src1 + PIXEL_STRIDE * 2 + 2, offx, offy, w, h); | |
| 456 | 6 | result1 = call_new(src0 + PIXEL_STRIDE * 2 + 2, src1 + PIXEL_STRIDE * 2 + 2, offx, offy, w, h); | |
| 457 | |||
| 458 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
|
6 | if (result1 != result0) |
| 459 | ✗ | fail(); | |
| 460 |
2/4✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
6 | if(offx == 0 && offy == 0) |
| 461 |
1/8✗ Branch 1 not taken.
✓ Branch 2 taken 6 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.
|
6 | bench_new(src0 + PIXEL_STRIDE * 2 + 2, src1 + PIXEL_STRIDE * 2 + 2, offx, offy, w, h); |
| 462 | } | ||
| 463 | } | ||
| 464 | } | ||
| 465 | } | ||
| 466 | } | ||
| 467 | |||
| 468 | 14 | report("sad"); | |
| 469 | 14 | } | |
| 470 | |||
| 471 | 14 | void checkasm_check_vvc_mc(void) | |
| 472 | { | ||
| 473 | 14 | check_dmvr(); | |
| 474 | 14 | check_bdof(); | |
| 475 | 14 | check_vvc_sad(); | |
| 476 | 14 | check_put_vvc_luma(); | |
| 477 | 14 | check_put_vvc_luma_uni(); | |
| 478 | 14 | check_put_vvc_chroma(); | |
| 479 | 14 | check_put_vvc_chroma_uni(); | |
| 480 | 14 | check_avg(); | |
| 481 | 14 | } | |
| 482 |