FFmpeg
tests
checkasm
exrdsp.c
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2017 James Almer
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
23
#include "
checkasm.h
"
24
#include "
libavcodec/avcodec.h
"
25
#include "
libavcodec/exrdsp.h
"
26
#include "
libavutil/intreadwrite.h
"
27
28
#define BUF_SIZE 5120
29
#define PADDED_BUF_SIZE BUF_SIZE+AV_INPUT_BUFFER_PADDING_SIZE*2
30
31
#define randomize_buffers() \
32
do { \
33
int i; \
34
for (i = 0; i < BUF_SIZE; i += 4) { \
35
uint32_t r = rnd(); \
36
AV_WN32A(src + i, r); \
37
} \
38
} while (0)
39
40
static
void
check_reorder_pixels
(
void
) {
41
LOCAL_ALIGNED_32
(
uint8_t
,
src
, [
PADDED_BUF_SIZE
]);
42
LOCAL_ALIGNED_32
(
uint8_t
, dst_ref, [
PADDED_BUF_SIZE
]);
43
LOCAL_ALIGNED_32
(
uint8_t
, dst_new, [
PADDED_BUF_SIZE
]);
44
45
declare_func
(
void
,
uint8_t
*dst,
const
uint8_t
*
src
, ptrdiff_t
size
);
46
47
memset(
src
, 0,
PADDED_BUF_SIZE
);
48
memset(dst_ref, 0,
PADDED_BUF_SIZE
);
49
memset(dst_new, 0,
PADDED_BUF_SIZE
);
50
randomize_buffers
();
51
call_ref
(dst_ref,
src
,
BUF_SIZE
);
52
call_new
(dst_new,
src
,
BUF_SIZE
);
53
if
(memcmp(dst_ref, dst_new,
BUF_SIZE
))
54
fail
();
55
bench_new
(dst_new,
src
,
BUF_SIZE
);
56
}
57
58
static
void
check_predictor
(
void
) {
59
LOCAL_ALIGNED_32
(
uint8_t
,
src
, [
PADDED_BUF_SIZE
]);
60
LOCAL_ALIGNED_32
(
uint8_t
, dst_ref, [
PADDED_BUF_SIZE
]);
61
LOCAL_ALIGNED_32
(
uint8_t
, dst_new, [
PADDED_BUF_SIZE
]);
62
63
declare_func
(
void
,
uint8_t
*
src
, ptrdiff_t
size
);
64
65
memset(
src
, 0,
PADDED_BUF_SIZE
);
66
randomize_buffers
();
67
memcpy(dst_ref,
src
,
PADDED_BUF_SIZE
);
68
memcpy(dst_new,
src
,
PADDED_BUF_SIZE
);
69
call_ref
(dst_ref,
BUF_SIZE
);
70
call_new
(dst_new,
BUF_SIZE
);
71
if
(memcmp(dst_ref, dst_new,
BUF_SIZE
))
72
fail
();
73
bench_new
(dst_new,
BUF_SIZE
);
74
}
75
76
void
checkasm_check_exrdsp
(
void
)
77
{
78
ExrDSPContext
h
;
79
80
ff_exrdsp_init
(&
h
);
81
82
if
(
check_func
(
h
.reorder_pixels,
"reorder_pixels"
))
83
check_reorder_pixels
();
84
85
report
(
"reorder_pixels"
);
86
87
if
(
check_func
(
h
.predictor,
"predictor"
))
88
check_predictor
();
89
90
report
(
"predictor"
);
91
}
randomize_buffers
#define randomize_buffers()
Definition:
exrdsp.c:31
check_func
#define check_func(func,...)
Definition:
checkasm.h:111
call_ref
#define call_ref(...)
Definition:
checkasm.h:126
fail
#define fail()
Definition:
checkasm.h:120
checkasm.h
check_predictor
static void check_predictor(void)
Definition:
exrdsp.c:58
src
#define src
Definition:
vp8dsp.c:254
checkasm_check_exrdsp
void checkasm_check_exrdsp(void)
Definition:
exrdsp.c:76
ExrDSPContext
Definition:
exrdsp.h:25
intreadwrite.h
BUF_SIZE
#define BUF_SIZE
Definition:
exrdsp.c:28
call_new
#define call_new(...)
Definition:
checkasm.h:193
exrdsp.h
ff_exrdsp_init
av_cold void ff_exrdsp_init(ExrDSPContext *c)
Definition:
exrdsp.c:49
size
int size
Definition:
twinvq_data.h:11134
report
#define report
Definition:
checkasm.h:123
bench_new
#define bench_new(...)
Definition:
checkasm.h:253
PADDED_BUF_SIZE
#define PADDED_BUF_SIZE
Definition:
exrdsp.c:29
uint8_t
uint8_t
Definition:
audio_convert.c:194
avcodec.h
check_reorder_pixels
static void check_reorder_pixels(void)
Definition:
exrdsp.c:40
declare_func
#define declare_func(ret,...)
Definition:
checkasm.h:115
LOCAL_ALIGNED_32
#define LOCAL_ALIGNED_32(t, v,...)
Definition:
internal.h:137
h
h
Definition:
vp9dsp_template.c:2038
Generated on Wed Aug 24 2022 21:26:39 for FFmpeg by
1.8.17