FFmpeg
svq1enc.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2023 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 "libavutil/mem.h"
22 #include "libavutil/mem_internal.h"
23 
24 #include "libavcodec/svq1encdsp.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() % 65281) - 32641); \
34  } while (0)
35 
37  declare_func(int, const int8_t *pix1, const int16_t *pix2, intptr_t size);
38 
39  int r1, r2;
40 
41  if (check_func(s->ssd_int8_vs_int16, "ssd_int8_vs_int16")) {
42  LOCAL_ALIGNED_4(int8_t, p1, [BUF_SIZE]);
43  LOCAL_ALIGNED_16(int16_t, p2, [BUF_SIZE]);
44 
45  randomize(p1, BUF_SIZE);
46  randomize(p2, BUF_SIZE);
47 
48  r1 = call_ref(p1, p2, BUF_SIZE);
49  r2 = call_new(p1, p2, BUF_SIZE);
50 
51  if (r1 != r2) {
52  fail();
53  }
54 
55  bench_new(p1, p2, BUF_SIZE);
56  }
57 
58  report("ssd_int8_vs_int16");
59 
60 }
61 
63 {
64  SVQ1EncDSPContext s = { 0 };
66 
68 }
mem_internal.h
check_func
#define check_func(func,...)
Definition: checkasm.h:170
call_ref
#define call_ref(...)
Definition: checkasm.h:185
svq1encdsp.h
fail
#define fail()
Definition: checkasm.h:179
checkasm.h
s
#define s(width, name)
Definition: cbs_vp9.c:198
BUF_SIZE
#define BUF_SIZE
Definition: svq1enc.c:28
LOCAL_ALIGNED_16
#define LOCAL_ALIGNED_16(t, v,...)
Definition: mem_internal.h:150
test_ssd_int8_vs_int16
static void test_ssd_int8_vs_int16(SVQ1EncDSPContext *s)
Definition: svq1enc.c:36
call_new
#define call_new(...)
Definition: checkasm.h:288
ff_svq1enc_init
static void ff_svq1enc_init(SVQ1EncDSPContext *c)
Definition: svq1encdsp.h:47
size
int size
Definition: twinvq_data.h:10344
LOCAL_ALIGNED_4
#define LOCAL_ALIGNED_4(t, v,...)
Definition: mem_internal.h:138
report
#define report
Definition: checkasm.h:182
bench_new
#define bench_new(...)
Definition: checkasm.h:358
SVQ1EncDSPContext
Definition: svq1encdsp.h:28
mem.h
declare_func
#define declare_func(ret,...)
Definition: checkasm.h:174
randomize
#define randomize(buf, len)
Definition: svq1enc.c:30
checkasm_check_svq1enc
void checkasm_check_svq1enc(void)
Definition: svq1enc.c:62