History

tests/checkasm/vvc_mc: add check_avg

Wu Jianhua committed 2 years ago

Commit 4720cf51 parent 326cc011 file · +64 −0Browse files

Unified · Split

tests/checkasm/vvc_mc.c+64−0
@@ -35,6 +35,7 @@ · 34 unmodified lines
35static const uint32_t pixel_mask[] = { 0xffffffff, 0x03ff03ff, 0x0fff0fff, 0x3fff3fff, 0xffffffff };35static const uint32_t pixel_mask[] = { 0xffffffff, 0x03ff03ff, 0x0fff0fff, 0x3fff3fff, 0xffffffff };
36static const int sizes[] = { 2, 4, 8, 16, 32, 64, 128 };36static const int sizes[] = { 2, 4, 8, 16, 32, 64, 128 };
37 37
38#define SIZEOF_PIXEL ((bit_depth + 7) / 8)
38#define PIXEL_STRIDE (MAX_CTU_SIZE * 2)39#define PIXEL_STRIDE (MAX_CTU_SIZE * 2)
39#define EXTRA_BEFORE 340#define EXTRA_BEFORE 3
40#define EXTRA_AFTER 441#define EXTRA_AFTER 4
@@ -261,10 +262,73 @@ static void check_put_vvc_chroma_uni(void) · 220 unmodified lines
261 report("put_uni_chroma");262 report("put_uni_chroma");
262}263}
263 264
265#define AVG_SRC_BUF_SIZE (MAX_CTU_SIZE * MAX_CTU_SIZE)
266#define AVG_DST_BUF_SIZE (MAX_PB_SIZE * MAX_PB_SIZE * 2)
267
268static void check_avg(void)
269{
270 LOCAL_ALIGNED_32(int16_t, src00, [AVG_SRC_BUF_SIZE]);
271 LOCAL_ALIGNED_32(int16_t, src01, [AVG_SRC_BUF_SIZE]);
272 LOCAL_ALIGNED_32(int16_t, src10, [AVG_SRC_BUF_SIZE]);
273 LOCAL_ALIGNED_32(int16_t, src11, [AVG_SRC_BUF_SIZE]);
274 LOCAL_ALIGNED_32(uint8_t, dst0, [AVG_DST_BUF_SIZE]);
275 LOCAL_ALIGNED_32(uint8_t, dst1, [AVG_DST_BUF_SIZE]);
276 VVCDSPContext c;
277
278 for (int bit_depth = 8; bit_depth <= 12; bit_depth += 2) {
279 randomize_avg_src((uint8_t*)src00, (uint8_t*)src10, AVG_SRC_BUF_SIZE * sizeof(int16_t));
280 randomize_avg_src((uint8_t*)src01, (uint8_t*)src11, AVG_SRC_BUF_SIZE * sizeof(int16_t));
281 ff_vvc_dsp_init(&c, bit_depth);
282 for (int h = 2; h <= MAX_CTU_SIZE; h *= 2) {
283 for (int w = 2; w <= MAX_CTU_SIZE; w *= 2) {
284 {
285 declare_func_emms(AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT, void, uint8_t *dst, ptrdiff_t dst_stride,
286 const int16_t *src0, const int16_t *src1, int width, int height);
287 if (check_func(c.inter.avg, "avg_%d_%dx%d", bit_depth, w, h)) {
288 memset(dst0, 0, AVG_DST_BUF_SIZE);
289 memset(dst1, 0, AVG_DST_BUF_SIZE);
290 call_ref(dst0, MAX_CTU_SIZE * SIZEOF_PIXEL, src00, src01, w, h);
291 call_new(dst1, MAX_CTU_SIZE * SIZEOF_PIXEL, src10, src11, w, h);
292 if (memcmp(dst0, dst1, DST_BUF_SIZE))
293 fail();
294 if (w == h)
295 bench_new(dst0, MAX_CTU_SIZE * SIZEOF_PIXEL, src00, src01, w, h);
296 }
297 }
298 {
299 declare_func_emms(AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT, void, uint8_t *dst, ptrdiff_t dst_stride,
300 const int16_t *src0, const int16_t *src1, int width, int height,
301 int denom, int w0, int w1, int o0, int o1);
302 {
303 const int denom = rnd() % 8;
304 const int w0 = rnd() % 256 - 128;
305 const int w1 = rnd() % 256 - 128;
306 const int o0 = rnd() % 256 - 128;
307 const int o1 = rnd() % 256 - 128;
308 if (check_func(c.inter.w_avg, "w_avg_%d_%dx%d", bit_depth, w, h)) {
309 memset(dst0, 0, AVG_DST_BUF_SIZE);
310 memset(dst1, 0, AVG_DST_BUF_SIZE);
311
312 call_ref(dst0, MAX_CTU_SIZE * SIZEOF_PIXEL, src00, src01, w, h, denom, w0, w1, o0, o1);
313 call_new(dst1, MAX_CTU_SIZE * SIZEOF_PIXEL, src10, src11, w, h, denom, w0, w1, o0, o1);
314 if (memcmp(dst0, dst1, DST_BUF_SIZE))
315 fail();
316 if (w == h)
317 bench_new(dst0, MAX_CTU_SIZE * SIZEOF_PIXEL, src00, src01, w, h, denom, w0, w1, o0, o1);
318 }
319 }
320 }
321 }
322 }
323 }
324 report("avg");
325}
326
264void checkasm_check_vvc_mc(void)327void checkasm_check_vvc_mc(void)
265{328{
266 check_put_vvc_luma();329 check_put_vvc_luma();
267 check_put_vvc_luma_uni();330 check_put_vvc_luma_uni();
268 check_put_vvc_chroma();331 check_put_vvc_chroma();
269 check_put_vvc_chroma_uni();332 check_put_vvc_chroma_uni();
333 check_avg();
270}334}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t