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
e6e58de0
Commit
e6e58de0
authored
Sep 03, 2017
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_displace: add mirror edge mode
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
06ed3768
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
3 deletions
+42
-3
filters.texi
doc/filters.texi
+3
-0
vf_displace.c
libavfilter/vf_displace.c
+39
-3
No files found.
doc/filters.texi
View file @
e6e58de0
...
...
@@ -6890,6 +6890,9 @@ Adjacent pixels will spread out to replace missing pixels.
@item wrap
Out of range pixels are wrapped so they point to pixels of other side.
@item mirror
Out of range pixels will be replaced with mirrored pixels.
@end table
Default is @samp{smear}.
...
...
libavfilter/vf_displace.c
View file @
e6e58de0
...
...
@@ -31,6 +31,7 @@ enum EdgeMode {
EDGE_BLANK
,
EDGE_SMEAR
,
EDGE_WRAP
,
EDGE_MIRROR
,
EDGE_NB
};
...
...
@@ -53,9 +54,10 @@ typedef struct DisplaceContext {
static
const
AVOption
displace_options
[]
=
{
{
"edge"
,
"set edge mode"
,
OFFSET
(
edge
),
AV_OPT_TYPE_INT
,
{.
i64
=
EDGE_SMEAR
},
0
,
EDGE_NB
-
1
,
FLAGS
,
"edge"
},
{
"blank"
,
""
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
EDGE_BLANK
},
0
,
0
,
FLAGS
,
"edge"
},
{
"smear"
,
""
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
EDGE_SMEAR
},
0
,
0
,
FLAGS
,
"edge"
},
{
"wrap"
,
""
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
EDGE_WRAP
},
0
,
0
,
FLAGS
,
"edge"
},
{
"blank"
,
""
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
EDGE_BLANK
},
0
,
0
,
FLAGS
,
"edge"
},
{
"smear"
,
""
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
EDGE_SMEAR
},
0
,
0
,
FLAGS
,
"edge"
},
{
"wrap"
,
""
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
EDGE_WRAP
},
0
,
0
,
FLAGS
,
"edge"
},
{
"mirror"
,
""
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
EDGE_MIRROR
},
0
,
0
,
FLAGS
,
"edge"
},
{
NULL
}
};
...
...
@@ -130,6 +132,22 @@ static void displace_planar(DisplaceContext *s, const AVFrame *in,
dst
[
x
]
=
src
[
Y
*
slinesize
+
X
];
}
break
;
case
EDGE_MIRROR
:
for
(
x
=
0
;
x
<
w
;
x
++
)
{
int
Y
=
y
+
ysrc
[
x
]
-
128
;
int
X
=
x
+
xsrc
[
x
]
-
128
;
if
(
Y
<
0
)
Y
=
(
-
Y
)
%
h
;
if
(
X
<
0
)
X
=
(
-
X
)
%
w
;
if
(
Y
>=
h
)
Y
=
h
-
(
Y
%
h
)
-
1
;
if
(
X
>=
w
)
X
=
w
-
(
X
%
w
)
-
1
;
dst
[
x
]
=
src
[
Y
*
slinesize
+
X
];
}
break
;
}
ysrc
+=
ylinesize
;
...
...
@@ -196,6 +214,24 @@ static void displace_packed(DisplaceContext *s, const AVFrame *in,
}
}
break
;
case
EDGE_MIRROR
:
for
(
x
=
0
;
x
<
w
;
x
++
)
{
for
(
c
=
0
;
c
<
s
->
nb_components
;
c
++
)
{
int
Y
=
y
+
ysrc
[
x
*
step
+
c
]
-
128
;
int
X
=
x
+
xsrc
[
x
*
step
+
c
]
-
128
;
if
(
Y
<
0
)
Y
=
(
-
Y
)
%
h
;
if
(
X
<
0
)
X
=
(
-
X
)
%
w
;
if
(
Y
>=
h
)
Y
=
h
-
(
Y
%
h
)
-
1
;
if
(
X
>=
w
)
X
=
w
-
(
X
%
w
)
-
1
;
dst
[
x
*
step
+
c
]
=
src
[
Y
*
slinesize
+
X
*
step
+
c
];
}
}
break
;
}
ysrc
+=
ylinesize
;
...
...
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