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
f1248b77
Commit
f1248b77
authored
May 05, 2018
by
Clément Bœsch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/nlmeans: random code shuffling to help compiler
This makes nlmeans_slice() slightly faster at least on GCC 7.3.
parent
0683ad70
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
vf_nlmeans.c
libavfilter/vf_nlmeans.c
+4
-4
No files found.
libavfilter/vf_nlmeans.c
View file @
f1248b77
...
...
@@ -368,7 +368,6 @@ static int nlmeans_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs
int
x
,
y
;
NLMeansContext
*
s
=
ctx
->
priv
;
const
struct
thread_data
*
td
=
arg
;
const
uint8_t
*
src
=
td
->
src
;
const
int
src_linesize
=
td
->
src_linesize
;
const
int
process_h
=
td
->
endy
-
td
->
starty
;
const
int
slice_start
=
(
process_h
*
jobnr
)
/
nb_jobs
;
...
...
@@ -377,14 +376,15 @@ static int nlmeans_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs
const
int
endy
=
td
->
starty
+
slice_end
;
for
(
y
=
starty
;
y
<
endy
;
y
++
)
{
const
uint8_t
*
src
=
td
->
src
+
y
*
src_linesize
;
struct
weighted_avg
*
wa
=
s
->
wa
+
y
*
s
->
wa_linesize
;
for
(
x
=
td
->
startx
;
x
<
td
->
endx
;
x
++
)
{
const
int
patch_diff_sq
=
get_integral_patch_value
(
td
->
ii_start
,
s
->
ii_lz_32
,
x
,
y
,
td
->
p
);
if
(
patch_diff_sq
<
s
->
max_meaningful_diff
)
{
struct
weighted_avg
*
wa
=
&
s
->
wa
[
y
*
s
->
wa_linesize
+
x
];
const
int
weight_lut_idx
=
patch_diff_sq
*
s
->
pdiff_lut_scale
;
const
double
weight
=
s
->
weight_lut
[
weight_lut_idx
];
// exp(-patch_diff_sq * s->pdiff_scale)
wa
->
total_weight
+=
weight
;
wa
->
sum
+=
weight
*
src
[
y
*
src_linesize
+
x
];
wa
[
x
].
total_weight
+=
weight
;
wa
[
x
].
sum
+=
weight
*
src
[
x
];
}
}
}
...
...
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