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
8a0d45a9
Commit
8a0d45a9
authored
Oct 11, 2019
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_geq: allow user to set interpolation method
parent
996ff3fe
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
0 deletions
+35
-0
filters.texi
doc/filters.texi
+8
-0
vf_geq.c
libavfilter/vf_geq.c
+27
-0
No files found.
doc/filters.texi
View file @
8a0d45a9
...
...
@@ -11019,6 +11019,14 @@ red/green/blue component. Return 0 if there is no such component.
@
item
alpha
(
x
,
y
)
Return
the
value
of
the
pixel
at
location
(@
var
{
x
},@
var
{
y
})
of
the
alpha
plane
.
Return
0
if
there
is
no
such
plane
.
@
item
interpolation
Set
one
of
interpolation
methods
:
@
table
@
option
@
item
nearest
,
n
@
item
bilinear
,
b
@
end
table
Default
is
bilinear
.
@
end
table
For
functions
,
if
@
var
{
x
}
and
@
var
{
y
}
are
outside
the
area
,
the
value
will
be
...
...
libavfilter/vf_geq.c
View file @
8a0d45a9
...
...
@@ -33,6 +33,12 @@
#include "libavutil/pixdesc.h"
#include "internal.h"
enum
InterpolationMethods
{
INTERP_NEAREST
,
INTERP_BILINEAR
,
NB_INTERP
};
static
const
char
*
const
var_names
[]
=
{
"X"
,
"Y"
,
"W"
,
"H"
,
"N"
,
"SW"
,
"SH"
,
"T"
,
NULL
};
enum
{
VAR_X
,
VAR_Y
,
VAR_W
,
VAR_H
,
VAR_N
,
VAR_SW
,
VAR_SH
,
VAR_T
,
VAR_VARS_NB
};
...
...
@@ -46,6 +52,7 @@ typedef struct GEQContext {
double
values
[
VAR_VARS_NB
];
///< expression values
int
hsub
,
vsub
;
///< chroma subsampling
int
planes
;
///< number of planes
int
interpolation
;
int
is_rgb
;
int
bps
;
}
GEQContext
;
...
...
@@ -70,6 +77,12 @@ static const AVOption geq_options[] = {
{
"g"
,
"set green expression"
,
OFFSET
(
expr_str
[
G
]),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
CHAR_MIN
,
CHAR_MAX
,
FLAGS
},
{
"blue_expr"
,
"set blue expression"
,
OFFSET
(
expr_str
[
B
]),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
CHAR_MIN
,
CHAR_MAX
,
FLAGS
},
{
"b"
,
"set blue expression"
,
OFFSET
(
expr_str
[
B
]),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
CHAR_MIN
,
CHAR_MAX
,
FLAGS
},
{
"interpolation"
,
"set interpolation method"
,
OFFSET
(
interpolation
),
AV_OPT_TYPE_INT
,
{.
i64
=
INTERP_BILINEAR
},
0
,
NB_INTERP
-
1
,
FLAGS
,
"interp"
},
{
"i"
,
"set interpolation method"
,
OFFSET
(
interpolation
),
AV_OPT_TYPE_INT
,
{.
i64
=
INTERP_BILINEAR
},
0
,
NB_INTERP
-
1
,
FLAGS
,
"interp"
},
{
"nearest"
,
"nearest interpolation"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
INTERP_NEAREST
},
0
,
0
,
FLAGS
,
"interp"
},
{
"n"
,
"nearest interpolation"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
INTERP_NEAREST
},
0
,
0
,
FLAGS
,
"interp"
},
{
"bilinear"
,
"bilinear interpolation"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
INTERP_BILINEAR
},
0
,
0
,
FLAGS
,
"interp"
},
{
"b"
,
"bilinear interpolation"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
INTERP_BILINEAR
},
0
,
0
,
FLAGS
,
"interp"
},
{
NULL
},
};
...
...
@@ -88,6 +101,7 @@ static inline double getpix(void *priv, double x, double y, int plane)
if
(
!
src
)
return
0
;
if
(
geq
->
interpolation
==
INTERP_BILINEAR
)
{
xi
=
x
=
av_clipd
(
x
,
0
,
w
-
2
);
yi
=
y
=
av_clipd
(
y
,
0
,
h
-
2
);
...
...
@@ -104,6 +118,19 @@ static inline double getpix(void *priv, double x, double y, int plane)
return
(
1
-
y
)
*
((
1
-
x
)
*
src
[
xi
+
yi
*
linesize
]
+
x
*
src
[
xi
+
1
+
yi
*
linesize
])
+
y
*
((
1
-
x
)
*
src
[
xi
+
(
yi
+
1
)
*
linesize
]
+
x
*
src
[
xi
+
1
+
(
yi
+
1
)
*
linesize
]);
}
}
else
{
xi
=
av_clipd
(
x
,
0
,
w
-
1
);
yi
=
av_clipd
(
y
,
0
,
h
-
1
);
if
(
geq
->
bps
>
8
)
{
const
uint16_t
*
src16
=
(
const
uint16_t
*
)
src
;
linesize
/=
2
;
return
src16
[
xi
+
yi
*
linesize
];
}
else
{
return
src
[
xi
+
yi
*
linesize
];
}
}
}
//TODO: cubic interpolate
...
...
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