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
ddf844d1
Commit
ddf844d1
authored
May 01, 2018
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_neighbor: simplify code little
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
273edb2f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
34 deletions
+32
-34
vf_neighbor.c
libavfilter/vf_neighbor.c
+32
-34
No files found.
libavfilter/vf_neighbor.c
View file @
ddf844d1
...
...
@@ -165,41 +165,39 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
for
(
plane
=
0
;
plane
<
s
->
nb_planes
;
plane
++
)
{
const
int
threshold
=
s
->
threshold
[
plane
];
const
int
stride
=
in
->
linesize
[
plane
];
const
int
dstride
=
out
->
linesize
[
plane
];
const
uint8_t
*
src
=
in
->
data
[
plane
];
uint8_t
*
dst
=
out
->
data
[
plane
];
const
int
height
=
s
->
planeheight
[
plane
];
const
int
width
=
s
->
planewidth
[
plane
];
if
(
!
threshold
)
{
av_image_copy_plane
(
dst
,
dstride
,
src
,
stride
,
width
,
height
);
continue
;
}
if
(
threshold
)
{
const
int
stride
=
in
->
linesize
[
plane
];
const
int
dstride
=
out
->
linesize
[
plane
];
const
uint8_t
*
src
=
in
->
data
[
plane
];
uint8_t
*
dst
=
out
->
data
[
plane
];
const
int
height
=
s
->
planeheight
[
plane
];
const
int
width
=
s
->
planewidth
[
plane
];
for
(
y
=
0
;
y
<
height
;
y
++
)
{
const
int
nh
=
y
>
0
;
const
int
ph
=
y
<
height
-
1
;
const
uint8_t
*
coordinates
[]
=
{
src
-
nh
*
stride
,
src
+
1
-
nh
*
stride
,
src
+
2
-
nh
*
stride
,
src
,
src
+
2
,
src
+
ph
*
stride
,
src
+
1
+
ph
*
stride
,
src
+
2
+
ph
*
stride
};
const
uint8_t
*
coordinateslb
[]
=
{
src
-
nh
*
stride
,
src
-
nh
*
stride
,
src
+
1
-
nh
*
stride
,
src
,
src
+
1
,
src
+
ph
*
stride
,
src
+
ph
*
stride
,
src
+
1
+
ph
*
stride
};
const
uint8_t
*
coordinatesrb
[]
=
{
src
+
width
-
2
-
nh
*
stride
,
src
+
width
-
1
-
nh
*
stride
,
src
+
width
-
1
-
nh
*
stride
,
src
+
width
-
2
,
src
+
width
-
1
,
src
+
width
-
2
+
ph
*
stride
,
src
+
width
-
1
+
ph
*
stride
,
src
+
width
-
1
+
ph
*
stride
};
s
->
filter
(
dst
,
src
,
1
,
threshold
,
coordinateslb
,
s
->
coordinates
);
s
->
filter
(
dst
+
1
,
src
+
1
,
width
-
2
,
threshold
,
coordinates
,
s
->
coordinates
);
s
->
filter
(
dst
+
width
-
1
,
src
+
width
-
1
,
1
,
threshold
,
coordinatesrb
,
s
->
coordinates
);
src
+=
stride
;
dst
+=
dstride
;
}
}
else
{
av_image_copy_plane
(
out
->
data
[
plane
],
out
->
linesize
[
plane
],
in
->
data
[
plane
],
in
->
linesize
[
plane
],
s
->
planewidth
[
plane
],
s
->
planeheight
[
plane
]);
for
(
y
=
0
;
y
<
height
;
y
++
)
{
const
int
nh
=
y
>
0
;
const
int
ph
=
y
<
height
-
1
;
const
uint8_t
*
coordinates
[]
=
{
src
-
nh
*
stride
,
src
+
1
-
nh
*
stride
,
src
+
2
-
nh
*
stride
,
src
,
src
+
2
,
src
+
ph
*
stride
,
src
+
1
+
ph
*
stride
,
src
+
2
+
ph
*
stride
};
const
uint8_t
*
coordinateslb
[]
=
{
src
-
nh
*
stride
,
src
-
nh
*
stride
,
src
+
1
-
nh
*
stride
,
src
,
src
+
1
,
src
+
ph
*
stride
,
src
+
ph
*
stride
,
src
+
1
+
ph
*
stride
};
const
uint8_t
*
coordinatesrb
[]
=
{
src
+
width
-
2
-
nh
*
stride
,
src
+
width
-
1
-
nh
*
stride
,
src
+
width
-
1
-
nh
*
stride
,
src
+
width
-
2
,
src
+
width
-
1
,
src
+
width
-
2
+
ph
*
stride
,
src
+
width
-
1
+
ph
*
stride
,
src
+
width
-
1
+
ph
*
stride
};
s
->
filter
(
dst
,
src
,
1
,
threshold
,
coordinateslb
,
s
->
coordinates
);
s
->
filter
(
dst
+
1
,
src
+
1
,
width
-
2
,
threshold
,
coordinates
,
s
->
coordinates
);
s
->
filter
(
dst
+
width
-
1
,
src
+
width
-
1
,
1
,
threshold
,
coordinatesrb
,
s
->
coordinates
);
src
+=
stride
;
dst
+=
dstride
;
}
}
...
...
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