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
f679711c
Commit
f679711c
authored
May 06, 2018
by
Clément Bœsch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
checkasm: add vf_nlmeans test for ssd_integral_image
parent
5a71bce3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
118 additions
and
0 deletions
+118
-0
Makefile
tests/checkasm/Makefile
+1
-0
checkasm.c
tests/checkasm/checkasm.c
+3
-0
checkasm.h
tests/checkasm/checkasm.h
+1
-0
vf_nlmeans.c
tests/checkasm/vf_nlmeans.c
+113
-0
No files found.
tests/checkasm/Makefile
View file @
f679711c
...
...
@@ -35,6 +35,7 @@ AVFILTEROBJS-$(CONFIG_BLEND_FILTER) += vf_blend.o
AVFILTEROBJS-$(CONFIG_COLORSPACE_FILTER)
+=
vf_colorspace.o
AVFILTEROBJS-$(CONFIG_HFLIP_FILTER)
+=
vf_hflip.o
AVFILTEROBJS-$(CONFIG_THRESHOLD_FILTER)
+=
vf_threshold.o
AVFILTEROBJS-$(CONFIG_NLMEANS_FILTER)
+=
vf_nlmeans.o
CHECKASMOBJS-$(CONFIG_AVFILTER)
+=
$(AVFILTEROBJS-yes)
...
...
tests/checkasm/checkasm.c
View file @
f679711c
...
...
@@ -159,6 +159,9 @@ static const struct {
#if CONFIG_HFLIP_FILTER
{
"vf_hflip"
,
checkasm_check_vf_hflip
},
#endif
#if CONFIG_NLMEANS_FILTER
{
"vf_nlmeans"
,
checkasm_check_nlmeans
},
#endif
#if CONFIG_THRESHOLD_FILTER
{
"vf_threshold"
,
checkasm_check_vf_threshold
},
#endif
...
...
tests/checkasm/checkasm.h
View file @
f679711c
...
...
@@ -62,6 +62,7 @@ void checkasm_check_huffyuvdsp(void);
void
checkasm_check_jpeg2000dsp
(
void
);
void
checkasm_check_llviddsp
(
void
);
void
checkasm_check_llviddspenc
(
void
);
void
checkasm_check_nlmeans
(
void
);
void
checkasm_check_pixblockdsp
(
void
);
void
checkasm_check_sbrdsp
(
void
);
void
checkasm_check_synth_filter
(
void
);
...
...
tests/checkasm/vf_nlmeans.c
0 → 100644
View file @
f679711c
/*
* Copyright (c) 2018 Clément Bœsch <u pkh me>
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "checkasm.h"
#include "libavfilter/vf_nlmeans.h"
#include "libavutil/avassert.h"
#define randomize_buffer(buf, size) do { \
int i; \
for (i = 0; i < size / 4; i++) \
((uint32_t *)buf)[i] = rnd(); \
} while (0)
void
checkasm_check_nlmeans
(
void
)
{
NLMeansDSPContext
dsp
=
{
0
};
const
int
w
=
123
;
// source width
const
int
h
=
45
;
// source height
const
int
p
=
3
;
// patch half size
const
int
r
=
2
;
// research window half size
ff_nlmeans_init
(
&
dsp
);
/* See the filter's code for the explanations on the variables */
if
(
check_func
(
dsp
.
compute_safe_ssd_integral_image
,
"ssd_integral_image"
))
{
int
offx
,
offy
;
const
int
e
=
p
+
r
;
const
int
ii_w
=
w
+
e
*
2
;
const
int
ii_h
=
h
+
e
*
2
;
const
int
ii_lz_32
=
FFALIGN
(
ii_w
+
1
,
4
);
uint32_t
*
ii_orig_ref
=
av_mallocz_array
(
ii_h
+
1
,
ii_lz_32
*
sizeof
(
*
ii_orig_ref
));
uint32_t
*
ii_ref
=
ii_orig_ref
+
ii_lz_32
+
1
;
uint32_t
*
ii_orig_new
=
av_mallocz_array
(
ii_h
+
1
,
ii_lz_32
*
sizeof
(
*
ii_orig_new
));
uint32_t
*
ii_new
=
ii_orig_new
+
ii_lz_32
+
1
;
const
int
src_lz
=
FFALIGN
(
w
,
16
);
uint8_t
*
src
=
av_mallocz_array
(
h
,
src_lz
);
declare_func
(
void
,
uint32_t
*
dst
,
ptrdiff_t
dst_linesize_32
,
const
uint8_t
*
s1
,
ptrdiff_t
linesize1
,
const
uint8_t
*
s2
,
ptrdiff_t
linesize2
,
int
w
,
int
h
);
randomize_buffer
(
src
,
h
*
src_lz
);
for
(
offy
=
-
r
;
offy
<=
r
;
offy
++
)
{
for
(
offx
=
-
r
;
offx
<=
r
;
offx
++
)
{
if
(
offx
||
offy
)
{
const
int
s1x
=
e
;
const
int
s1y
=
e
;
const
int
s2x
=
e
+
offx
;
const
int
s2y
=
e
+
offy
;
const
int
startx_safe
=
FFMAX
(
s1x
,
s2x
);
const
int
starty_safe
=
FFMAX
(
s1y
,
s2y
);
const
int
u_endx_safe
=
FFMIN
(
s1x
+
w
,
s2x
+
w
);
const
int
endy_safe
=
FFMIN
(
s1y
+
h
,
s2y
+
h
);
const
int
safe_pw
=
(
u_endx_safe
-
startx_safe
)
&
~
0xf
;
const
int
safe_ph
=
endy_safe
-
starty_safe
;
av_assert0
(
safe_pw
&&
safe_ph
);
av_assert0
(
startx_safe
-
s1x
>=
0
);
av_assert0
(
startx_safe
-
s1x
<
w
);
av_assert0
(
starty_safe
-
s1y
>=
0
);
av_assert0
(
starty_safe
-
s1y
<
h
);
av_assert0
(
startx_safe
-
s2x
>=
0
);
av_assert0
(
startx_safe
-
s2x
<
w
);
av_assert0
(
starty_safe
-
s2y
>=
0
);
av_assert0
(
starty_safe
-
s2y
<
h
);
memset
(
ii_ref
,
0
,
ii_lz_32
*
ii_h
*
sizeof
(
*
ii_ref
));
memset
(
ii_new
,
0
,
ii_lz_32
*
ii_h
*
sizeof
(
*
ii_new
));
call_ref
(
ii_ref
+
starty_safe
*
ii_lz_32
+
startx_safe
,
ii_lz_32
,
src
+
(
starty_safe
-
s1y
)
*
src_lz
+
(
startx_safe
-
s1x
),
src_lz
,
src
+
(
starty_safe
-
s2y
)
*
src_lz
+
(
startx_safe
-
s2x
),
src_lz
,
safe_pw
,
safe_ph
);
call_new
(
ii_new
+
starty_safe
*
ii_lz_32
+
startx_safe
,
ii_lz_32
,
src
+
(
starty_safe
-
s1y
)
*
src_lz
+
(
startx_safe
-
s1x
),
src_lz
,
src
+
(
starty_safe
-
s2y
)
*
src_lz
+
(
startx_safe
-
s2x
),
src_lz
,
safe_pw
,
safe_ph
);
if
(
memcmp
(
ii_ref
,
ii_new
,
ii_h
*
ii_lz_32
*
4
))
fail
();
memset
(
ii_new
,
0
,
ii_lz_32
*
ii_h
*
sizeof
(
*
ii_new
));
bench_new
(
ii_new
+
starty_safe
*
ii_lz_32
+
startx_safe
,
ii_lz_32
,
src
+
(
starty_safe
-
s1y
)
*
src_lz
+
(
startx_safe
-
s1x
),
src_lz
,
src
+
(
starty_safe
-
s2y
)
*
src_lz
+
(
startx_safe
-
s2x
),
src_lz
,
safe_pw
,
safe_ph
);
}
}
}
av_freep
(
&
ii_orig_ref
);
av_freep
(
&
ii_orig_new
);
av_freep
(
&
src
);
}
report
(
"dsp"
);
}
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