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
e1dd355b
Commit
e1dd355b
authored
Sep 12, 2019
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_v360: add dfisheye output
parent
24d4eea9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
3 deletions
+43
-3
filters.texi
doc/filters.texi
+2
-1
vf_v360.c
libavfilter/vf_v360.c
+41
-2
No files found.
doc/filters.texi
View file @
e1dd355b
...
...
@@ -18010,11 +18010,12 @@ Set horizontal/vertical field of view. Values in degrees.
@end table
@item dfisheye
Dual fisheye.
@i{(input only)}
Dual fisheye.
Format specific options:
@table @option
@item in_pad
@item out_pad
Set padding proportion. Values in decimals.
Example values:
...
...
libavfilter/vf_v360.c
View file @
e1dd355b
...
...
@@ -71,6 +71,7 @@ static const AVOption v360_options[] = {
{
"c3x2"
,
"cubemap 3x2"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
CUBEMAP_3_2
},
0
,
0
,
FLAGS
,
"out"
},
{
"c6x1"
,
"cubemap 6x1"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
CUBEMAP_6_1
},
0
,
0
,
FLAGS
,
"out"
},
{
"eac"
,
"equi-angular cubemap"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
EQUIANGULAR
},
0
,
0
,
FLAGS
,
"out"
},
{
"dfisheye"
,
"dual fisheye"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
DUAL_FISHEYE
},
0
,
0
,
FLAGS
,
"out"
},
{
"flat"
,
"regular video"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
FLAT
},
0
,
0
,
FLAGS
,
"out"
},
{
"rectilinear"
,
"regular video"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
FLAT
},
0
,
0
,
FLAGS
,
"out"
},
{
"gnomonic"
,
"regular video"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
FLAT
},
0
,
0
,
FLAGS
,
"out"
},
...
...
@@ -1813,6 +1814,41 @@ static void flat_to_xyz(const V360Context *s,
normalize_vector
(
vec
);
}
/**
* Calculate 3D coordinates on sphere for corresponding frame position in dual fisheye format.
*
* @param s filter context
* @param i horizontal position on frame [0, width)
* @param j vertical position on frame [0, height)
* @param width frame width
* @param height frame height
* @param vec coordinates on sphere
*/
static
void
dfisheye_to_xyz
(
const
V360Context
*
s
,
int
i
,
int
j
,
int
width
,
int
height
,
float
*
vec
)
{
const
float
scale
=
1
.
f
+
s
->
out_pad
;
const
float
ew
=
width
/
2
.
f
;
const
float
eh
=
height
;
const
int
ei
=
i
>=
ew
?
i
-
ew
:
i
;
const
float
m
=
i
>=
ew
?
-
1
.
f
:
1
.
f
;
const
float
uf
=
((
2
.
f
*
ei
)
/
ew
-
1
.
f
)
*
scale
;
const
float
vf
=
((
2
.
f
*
j
)
/
eh
-
1
.
f
)
*
scale
;
const
float
phi
=
M_PI
+
atan2f
(
vf
,
uf
*
m
);
const
float
theta
=
m
*
M_PI_2
*
(
1
.
f
-
hypotf
(
uf
,
vf
));
vec
[
0
]
=
cosf
(
theta
)
*
cosf
(
phi
);
vec
[
1
]
=
cosf
(
theta
)
*
sinf
(
phi
);
vec
[
2
]
=
sinf
(
theta
);
normalize_vector
(
vec
);
}
/**
* Calculate frame position in dual fisheye format for corresponding 3D coordinates on sphere.
*
...
...
@@ -2289,8 +2325,11 @@ static int config_output(AVFilterLink *outlink)
h
=
roundf
(
hf
);
break
;
case
DUAL_FISHEYE
:
av_log
(
ctx
,
AV_LOG_ERROR
,
"Dual fisheye format is not accepted as output.
\n
"
);
return
AVERROR
(
EINVAL
);
out_transform
=
dfisheye_to_xyz
;
err
=
0
;
w
=
roundf
(
wf
);
h
=
roundf
(
hf
);
break
;
case
BARREL
:
out_transform
=
barrel_to_xyz
;
err
=
0
;
...
...
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