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.
24 #include "libavcodec/rv40dsp.c"
25 #include "libavutil/mem_internal.h"
27 #define randomize_buffers() \
29 for (int i = 0; i < 16*18*2; i++) \
30 src[i] = rnd() & 0xff; \
33 static void check_chroma_mc(void)
36 LOCAL_ALIGNED_32(uint8_t, src
, [16 * 18 * 2]);
37 LOCAL_ALIGNED_32(uint8_t, dst0
, [16 * 18 * 2]);
38 LOCAL_ALIGNED_32(uint8_t, dst1
, [16 * 18 * 2]);
40 declare_func_emms(AV_CPU_FLAG_MMX
, void, uint8_t *dst
, const uint8_t *src
,
41 ptrdiff_t stride
, int h
, int x
, int y
);
45 for (int size
= 0; size
< 2; size
++) {
47 #define CHECK_CHROMA_MC(name) \
49 if (check_func(h.name## _pixels_tab[size], #name "_mc%d", 1 << (3 - size))) { \
50 for (int x = 0, mx = 0; x < 2; x++, mx = 1 + (rnd() % 7)) { \
51 for (int y = 0, my = 0; y < 2; y++, my = 1 + (rnd() % 7)) { \
52 memcpy(dst0, src, 16 * 18); \
53 memcpy(dst1, src, 16 * 18); \
54 call_ref(dst0, src, 16, 16, mx, my); \
55 call_new(dst1, src, 16, 16, mx, my); \
56 if (memcmp(dst0, dst1, 16 * 16)) { \
57 fprintf(stderr, #name ": x:%i, y:%i\n", x, y); \
60 bench_new(dst1, src, 16, 16, x, y); \
66 CHECK_CHROMA_MC(put_chroma
);
67 CHECK_CHROMA_MC(avg_chroma
);
71 void checkasm_check_rv40dsp(void)