2 * Copyright (c) 2024 Institute of Software Chinese Academy of Sciences (ISCAS).
4 * This file is part of FFmpeg.
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.
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.
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.
21 #include "libavutil/mem.h"
22 #include "libavutil/mem_internal.h"
24 #include "libavcodec/rv34dsp.h"
30 #define randomize(buf, len) \
32 for (int i = 0; i < len; i++) \
36 static void test_rv34_inv_transform_dc(RV34DSPContext
*s
) {
37 declare_func_emms(AV_CPU_FLAG_MMX
, void, int16_t *block
);
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
]);
43 randomize(p1
, BUF_SIZE
);
44 memcpy(p2
, p1
, BUF_SIZE
* sizeof(*p1
));
49 if (memcmp(p1
, p2
, BUF_SIZE
* sizeof (*p1
)) != 0) {
56 report("rv34_inv_transform_dc");
59 static void test_rv34_idct_dc_add(RV34DSPContext
*s
) {
60 declare_func(void, uint8_t *dst
, ptrdiff_t stride
, int dc
);
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
]);
66 randomize(p1
, BUF_SIZE
);
67 memcpy(p2
, p1
, BUF_SIZE
* sizeof(*p1
));
72 if (memcmp(p1
, p2
, BUF_SIZE
* sizeof (*p1
)) != 0) {
79 report("rv34_idct_dc_add");
82 void checkasm_check_rv34dsp(void)
84 RV34DSPContext s
= { 0 };
87 test_rv34_inv_transform_dc(&s
);
88 test_rv34_idct_dc_add(&s
);