FFmpeg
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
tests
checkasm
jpeg2000dsp.c
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2015 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 "
checkasm.h
"
22
#include "
libavcodec/jpeg2000dsp.h
"
23
#include "
libavutil/common.h
"
24
#include "
libavutil/internal.h
"
25
#include "
libavutil/intreadwrite.h
"
26
#include "
libavutil/mem_internal.h
"
27
28
#define BUF_SIZE 512
29
30
#define randomize_buffers() \
31
do { \
32
int i; \
33
for (i = 0; i < BUF_SIZE*3; i++) \
34
src[i] = rnd(); \
35
} while (0)
36
37
#define randomize_buffers_float() \
38
do { \
39
int i; \
40
for (i = 0; i < BUF_SIZE*3; i++) \
41
src[i] = (float)rnd() / (UINT_MAX >> 5); \
42
} while (0)
43
44
static
void
check_rct_int
(
void
)
45
{
46
LOCAL_ALIGNED_32
(
int32_t
,
src
, [
BUF_SIZE
*3]);
47
LOCAL_ALIGNED_32
(
int32_t
,
ref
, [
BUF_SIZE
*3]);
48
LOCAL_ALIGNED_32
(
int32_t
,
new
, [
BUF_SIZE
*3]);
49
int32_t
*ref0 = &
ref
[
BUF_SIZE
*0], *new0 = &
new
[
BUF_SIZE
*0];
50
int32_t
*ref1 = &
ref
[
BUF_SIZE
*1], *new1 = &
new
[
BUF_SIZE
*1];
51
int32_t
*ref2 = &
ref
[
BUF_SIZE
*2], *new2 = &
new
[
BUF_SIZE
*2];
52
53
declare_func
(
void
,
void
*
src0
,
void
*
src1
,
void
*src2,
int
csize);
54
55
randomize_buffers
();
56
memcpy(
ref
,
src
,
BUF_SIZE
* 3 *
sizeof
(*
src
));
57
memcpy(
new
,
src
,
BUF_SIZE
* 3 *
sizeof
(*
src
));
58
call_ref
(ref0, ref1, ref2,
BUF_SIZE
);
59
call_new
(new0, new1, new2,
BUF_SIZE
);
60
if
(memcmp(ref0, new0,
BUF_SIZE
*
sizeof
(*
src
)) ||
61
memcmp(ref1, new1,
BUF_SIZE
*
sizeof
(*
src
)) ||
62
memcmp(ref2, new2,
BUF_SIZE
*
sizeof
(*
src
)))
63
fail
();
64
memcpy(
new
,
src
,
BUF_SIZE
* 3 *
sizeof
(*
src
));
65
bench_new
(new0, new1, new2,
BUF_SIZE
);
66
}
67
68
static
void
check_ict_float
(
void
)
69
{
70
LOCAL_ALIGNED_32
(
float
,
src
, [
BUF_SIZE
*3]);
71
LOCAL_ALIGNED_32
(
float
,
ref
, [
BUF_SIZE
*3]);
72
LOCAL_ALIGNED_32
(
float
,
new
, [
BUF_SIZE
*3]);
73
float
*ref0 = &
ref
[
BUF_SIZE
*0], *new0 = &
new
[
BUF_SIZE
*0];
74
float
*ref1 = &
ref
[
BUF_SIZE
*1], *new1 = &
new
[
BUF_SIZE
*1];
75
float
*ref2 = &
ref
[
BUF_SIZE
*2], *new2 = &
new
[
BUF_SIZE
*2];
76
77
declare_func
(
void
,
void
*
src0
,
void
*
src1
,
void
*src2,
int
csize);
78
79
randomize_buffers_float
();
80
memcpy(
ref
,
src
,
BUF_SIZE
* 3 *
sizeof
(*
src
));
81
memcpy(
new
,
src
,
BUF_SIZE
* 3 *
sizeof
(*
src
));
82
call_ref
(ref0, ref1, ref2,
BUF_SIZE
);
83
call_new
(new0, new1, new2,
BUF_SIZE
);
84
if
(!
float_near_abs_eps_array
(ref0, new0, 1.0e-5,
BUF_SIZE
) ||
85
!
float_near_abs_eps_array
(ref1, new1, 1.0e-5,
BUF_SIZE
) ||
86
!
float_near_abs_eps_array
(ref2, new2, 1.0e-5,
BUF_SIZE
))
87
fail
();
88
memcpy(
new
,
src
,
BUF_SIZE
* 3 *
sizeof
(*
src
));
89
bench_new
(new0, new1, new2,
BUF_SIZE
);
90
}
91
92
void
checkasm_check_jpeg2000dsp
(
void
)
93
{
94
Jpeg2000DSPContext
h
;
95
96
ff_jpeg2000dsp_init
(&h);
97
98
if
(
check_func
(h.
mct_decode
[
FF_DWT53
],
"jpeg2000_rct_int"
))
99
check_rct_int
();
100
if
(
check_func
(h.
mct_decode
[
FF_DWT97
],
"jpeg2000_ict_float"
))
101
check_ict_float
();
102
103
report
(
"mct_decode"
);
104
}
Jpeg2000DSPContext::mct_decode
void(* mct_decode[FF_DWT_NB])(void *src0, void *src1, void *src2, int csize)
Definition:
jpeg2000dsp.h:30
randomize_buffers_float
#define randomize_buffers_float()
Definition:
jpeg2000dsp.c:37
float_near_abs_eps_array
int float_near_abs_eps_array(const float *a, const float *b, float eps, unsigned len)
Definition:
checkasm.c:338
h
h
Definition:
vp9dsp_template.c:2038
ff_jpeg2000dsp_init
av_cold void ff_jpeg2000dsp_init(Jpeg2000DSPContext *c)
Definition:
jpeg2000dsp.c:93
FF_DWT53
Definition:
jpeg2000dwt.h:38
report
#define report
Definition:
checkasm.h:136
check_ict_float
static void check_ict_float(void)
Definition:
jpeg2000dsp.c:68
LOCAL_ALIGNED_32
#define LOCAL_ALIGNED_32(t, v,...)
Definition:
mem_internal.h:136
src
#define src
Definition:
vp8dsp.c:255
check_rct_int
static void check_rct_int(void)
Definition:
jpeg2000dsp.c:44
checkasm.h
declare_func
#define declare_func(ret,...)
Definition:
checkasm.h:128
fail
#define fail()
Definition:
checkasm.h:133
internal.h
common internal API header
intreadwrite.h
int32_t
int32_t
Definition:
audio_convert.c:194
call_ref
#define call_ref(...)
Definition:
checkasm.h:139
src1
#define src1
Definition:
h264pred.c:140
Jpeg2000DSPContext
Definition:
jpeg2000dsp.h:29
check_func
#define check_func(func,...)
Definition:
checkasm.h:124
src0
#define src0
Definition:
h264pred.c:139
BUF_SIZE
#define BUF_SIZE
Definition:
jpeg2000dsp.c:28
jpeg2000dsp.h
common.h
common internal and external API header
ref
static int ref[MAX_W *MAX_W]
Definition:
jpeg2000dwt.c:107
randomize_buffers
#define randomize_buffers()
Definition:
jpeg2000dsp.c:30
bench_new
#define bench_new(...)
Definition:
checkasm.h:271
call_new
#define call_new(...)
Definition:
checkasm.h:211
FF_DWT97
Definition:
jpeg2000dwt.h:37
checkasm_check_jpeg2000dsp
void checkasm_check_jpeg2000dsp(void)
Definition:
jpeg2000dsp.c:92
mem_internal.h
Generated on Sun Feb 28 2021 19:21:55 for FFmpeg by
1.8.11