Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
de99ce43
Commit
de99ce43
authored
Jun 19, 2015
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/jpeg2000dwt: add test for the 5/3 wavelet
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
75651cd6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
0 deletions
+57
-0
Makefile
libavcodec/Makefile
+1
-0
jpeg2000dwt.c
libavcodec/jpeg2000dwt.c
+56
-0
No files found.
libavcodec/Makefile
View file @
de99ce43
...
...
@@ -892,6 +892,7 @@ SKIPHEADERS-$(CONFIG_VDA) += vda.h vda_internal.h
SKIPHEADERS-$(CONFIG_VDPAU)
+=
vdpau.h
vdpau_internal.h
TESTPROGS
=
imgconvert
\
jpeg2000dwt
\
mathops
\
options
\
avfft
\
...
...
libavcodec/jpeg2000dwt.c
View file @
de99ce43
...
...
@@ -606,3 +606,59 @@ void ff_dwt_destroy(DWTContext *s)
av_freep
(
&
s
->
f_linebuf
);
av_freep
(
&
s
->
i_linebuf
);
}
#ifdef TEST
#include "libavutil/lfg.h"
#define MAX_W 256
int
main
(
void
)
{
int
array
[
MAX_W
*
MAX_W
];
int
ref
[
MAX_W
*
MAX_W
];
AVLFG
prng
;
int
i
,
j
;
DWTContext
s1
=
{{{
0
}}},
*
s
=
&
s1
;
uint16_t
border
[
2
][
2
];
int
ret
,
decomp_levels
;
av_lfg_init
(
&
prng
,
1
);
for
(
i
=
0
;
i
<
MAX_W
*
MAX_W
;
i
++
)
array
[
i
]
=
ref
[
i
]
=
av_lfg_get
(
&
prng
)
%
2048
;
for
(
i
=
0
;
i
<
40
;
i
++
)
{
for
(
j
=
0
;
j
<
4
;
j
++
)
border
[
0
][
j
]
=
av_lfg_get
(
&
prng
)
%
MAX_W
;
border
[
0
][
0
]
=
border
[
1
][
0
]
=
0
;
if
(
border
[
0
][
0
]
>=
border
[
0
][
1
]
||
border
[
1
][
0
]
>=
border
[
1
][
1
])
continue
;
decomp_levels
=
av_lfg_get
(
&
prng
)
%
FF_DWT_MAX_DECLVLS
;
ret
=
ff_jpeg2000_dwt_init
(
s
,
border
,
decomp_levels
,
FF_DWT53
);
if
(
ret
<
0
)
{
fprintf
(
stderr
,
"ff_jpeg2000_dwt_init failed
\n
"
);
return
1
;
}
ret
=
ff_dwt_encode
(
s
,
array
);
if
(
ret
<
0
)
{
fprintf
(
stderr
,
"ff_dwt_encode failed
\n
"
);
return
1
;
}
ret
=
ff_dwt_decode
(
s
,
array
);
if
(
ret
<
0
)
{
fprintf
(
stderr
,
"ff_dwt_encode failed
\n
"
);
return
1
;
}
for
(
j
=
0
;
j
<
MAX_W
*
MAX_W
;
j
++
)
if
(
array
[
j
]
!=
ref
[
j
])
{
fprintf
(
stderr
,
"missmatch at %d (%d != %d) decomp:%d border %d %d %d %d
\n
"
,
j
,
array
[
j
],
ref
[
j
],
decomp_levels
,
border
[
0
][
0
],
border
[
0
][
1
],
border
[
1
][
0
],
border
[
1
][
1
]);
return
2
;
}
ff_dwt_destroy
(
s
);
}
return
0
;
}
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment