hwcontext_vulkan: fix VkImageToMemoryCopyEXT.sType
[ffmpeg.git] / tests / checkasm / rv34dsp.c
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 "libavutil/mem.h"
22 #include "libavutil/mem_internal.h"
23
24 #include "libavcodec/rv34dsp.h"
25
26 #include "checkasm.h"
27
28 #define BUF_SIZE 1024
29
30 #define randomize(buf, len) \
31 do { \
32 for (int i = 0; i < len; i++) \
33 buf[i] = rnd(); \
34 } while (0)
35
36 static void test_rv34_inv_transform_dc(RV34DSPContext *s) {
37 declare_func_emms(AV_CPU_FLAG_MMX, void, int16_t *block);
38
39 if (check_func(s->rv34_inv_transform_dc, "rv34_inv_transform_dc")) {
40 LOCAL_ALIGNED_16(int16_t, p1, [BUF_SIZE]);
41 LOCAL_ALIGNED_16(int16_t, p2, [BUF_SIZE]);
42
43 randomize(p1, BUF_SIZE);
44 memcpy(p2, p1, BUF_SIZE * sizeof(*p1));
45
46 call_ref(p1);
47 call_new(p2);
48
49 if (memcmp(p1, p2, BUF_SIZE * sizeof (*p1)) != 0) {
50 fail();
51 }
52
53 bench_new(p1);
54 }
55
56 report("rv34_inv_transform_dc");
57 }
58
59 static void test_rv34_idct_dc_add(RV34DSPContext *s) {
60 declare_func(void, uint8_t *dst, ptrdiff_t stride, int dc);
61
62 if (check_func(s->rv34_idct_dc_add, "rv34_idct_dc_add")) {
63 LOCAL_ALIGNED_16(uint8_t, p1, [BUF_SIZE]);
64 LOCAL_ALIGNED_16(uint8_t, p2, [BUF_SIZE]);
65
66 randomize(p1, BUF_SIZE);
67 memcpy(p2, p1, BUF_SIZE * sizeof(*p1));
68
69 call_ref(p1, 4, 5);
70 call_new(p2, 4, 5);
71
72 if (memcmp(p1, p2, BUF_SIZE * sizeof (*p1)) != 0) {
73 fail();
74 }
75
76 bench_new(p1, 4, 5);
77 }
78
79 report("rv34_idct_dc_add");
80 }
81
82 void checkasm_check_rv34dsp(void)
83 {
84 RV34DSPContext s = { 0 };
85 ff_rv34dsp_init(&s);
86
87 test_rv34_inv_transform_dc(&s);
88 test_rv34_idct_dc_add(&s);
89 }