FFmpeg
rv40dsp.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2024 Institue 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 <string.h>
22 #include <stdint.h>
23 #include "checkasm.h"
24 #include "libavcodec/rv40dsp.c"
25 #include "libavutil/mem_internal.h"
26 
27 #define randomize_buffers() \
28  do { \
29  for (int i = 0; i < 16*18*2; i++) \
30  src[i] = rnd() & 0x3; \
31  } while (0)
32 
33 static void check_chroma_mc(void)
34 {
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]);
39 
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);
42 
45  for (int size = 0; size < 2; size++) {
46 
47 #define CHECK_CHROMA_MC(name) \
48  do { \
49  if (check_func(h.name## _pixels_tab[size], #name "_mc%d", 1 << (3 - size))) { \
50  for (int x = 0; x < 2; x++) { \
51  for (int y = 0; y < 2; y++) { \
52  memcpy(dst0, src, 16 * 18); \
53  memcpy(dst1, src, 16 * 18); \
54  call_ref(dst0, src, 16, 16, x, y); \
55  call_new(dst1, src, 16, 16, x, y); \
56  if (memcmp(dst0, dst1, 16 * 16)) { \
57  fprintf(stderr, #name ": x:%i, y:%i\n", x, y); \
58  fail(); \
59  } \
60  bench_new(dst1, src, 16, 16, x, y); \
61  } \
62  } \
63  } \
64  } while (0)
65 
66  CHECK_CHROMA_MC(put_chroma);
67  CHECK_CHROMA_MC(avg_chroma);
68  }
69 }
70 
72 {
74  report("chroma_mc");
75 }
declare_func_emms
#define declare_func_emms(cpu_flags, ret,...)
Definition: checkasm.h:179
mem_internal.h
checkasm_check_rv40dsp
void checkasm_check_rv40dsp(void)
Definition: rv40dsp.c:71
rv40dsp.c
checkasm.h
LOCAL_ALIGNED_32
#define LOCAL_ALIGNED_32(t, v,...)
Definition: mem_internal.h:156
check_chroma_mc
static void check_chroma_mc(void)
Definition: rv40dsp.c:33
RV34DSPContext
Definition: rv34dsp.h:57
CHECK_CHROMA_MC
#define CHECK_CHROMA_MC(name)
size
int size
Definition: twinvq_data.h:10344
randomize_buffers
#define randomize_buffers()
Definition: rv40dsp.c:27
report
#define report
Definition: checkasm.h:185
stride
#define stride
Definition: h264pred_template.c:537
AV_CPU_FLAG_MMX
#define AV_CPU_FLAG_MMX
standard MMX
Definition: cpu.h:29
ff_rv40dsp_init
av_cold void ff_rv40dsp_init(RV34DSPContext *c)
Definition: rv40dsp.c:619
src
INIT_CLIP pixel * src
Definition: h264pred_template.c:418
h
h
Definition: vp9dsp_template.c:2038