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
329505d9
Commit
329505d9
authored
Sep 10, 2019
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_v360: add support for stereographic as input projection
parent
10ea6c31
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
1 deletion
+46
-1
filters.texi
doc/filters.texi
+1
-1
vf_v360.c
libavfilter/vf_v360.c
+45
-0
No files found.
doc/filters.texi
View file @
329505d9
...
...
@@ -18033,7 +18033,7 @@ Default value is @b{@samp{0}}.
Facebook's 360 format.
@item sg
Stereographic format.
@i{(output only)}
Stereographic format.
Format specific options:
@table @option
...
...
libavfilter/vf_v360.c
View file @
329505d9
...
...
@@ -64,6 +64,7 @@ static const AVOption v360_options[] = {
{
"barrel"
,
"barrel facebook's 360 format"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
BARREL
},
0
,
0
,
FLAGS
,
"in"
},
{
"fb"
,
"barrel facebook's 360 format"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
BARREL
},
0
,
0
,
FLAGS
,
"in"
},
{
"c1x6"
,
"cubemap 1x6"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
CUBEMAP_1_6
},
0
,
0
,
FLAGS
,
"in"
},
{
"sg"
,
"stereographic"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
STEREOGRAPHIC
},
0
,
0
,
FLAGS
,
"in"
},
{
"output"
,
"set output projection"
,
OFFSET
(
out
),
AV_OPT_TYPE_INT
,
{.
i64
=
CUBEMAP_3_2
},
0
,
NB_PROJECTIONS
-
1
,
FLAGS
,
"out"
},
{
"e"
,
"equirectangular"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
EQUIRECTANGULAR
},
0
,
0
,
FLAGS
,
"out"
},
{
"equirect"
,
"equirectangular"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
EQUIRECTANGULAR
},
0
,
0
,
FLAGS
,
"out"
},
...
...
@@ -1420,6 +1421,44 @@ static void stereographic_to_xyz(const V360Context *s,
normalize_vector
(
vec
);
}
/**
* Calculate frame position in stereographic format for corresponding 3D coordinates on sphere.
*
* @param s filter context
* @param vec coordinates on sphere
* @param width frame width
* @param height frame height
* @param us horizontal coordinates for interpolation window
* @param vs vertical coordinates for interpolation window
* @param du horizontal relative coordinate
* @param dv vertical relative coordinate
*/
static
void
xyz_to_stereographic
(
const
V360Context
*
s
,
const
float
*
vec
,
int
width
,
int
height
,
uint16_t
us
[
4
][
4
],
uint16_t
vs
[
4
][
4
],
float
*
du
,
float
*
dv
)
{
const
float
x
=
av_clipf
(
vec
[
0
]
/
(
1
.
f
-
vec
[
1
]),
-
1
.
f
,
1
.
f
)
*
s
->
input_mirror_modifier
[
0
];
const
float
y
=
av_clipf
(
vec
[
2
]
/
(
1
.
f
-
vec
[
1
]),
-
1
.
f
,
1
.
f
)
*
s
->
input_mirror_modifier
[
1
];
float
uf
,
vf
;
int
ui
,
vi
;
int
i
,
j
;
uf
=
(
x
+
1
.
f
)
*
width
/
2
.
f
;
vf
=
(
y
+
1
.
f
)
*
height
/
2
.
f
;
ui
=
floorf
(
uf
);
vi
=
floorf
(
vf
);
*
du
=
uf
-
ui
;
*
dv
=
vf
-
vi
;
for
(
i
=
-
1
;
i
<
3
;
i
++
)
{
for
(
j
=
-
1
;
j
<
3
;
j
++
)
{
us
[
i
+
1
][
j
+
1
]
=
av_clip
(
ui
+
j
,
0
,
width
-
1
);
vs
[
i
+
1
][
j
+
1
]
=
av_clip
(
vi
+
i
,
0
,
height
-
1
);
}
}
}
/**
* Calculate frame position in equirectangular format for corresponding 3D coordinates on sphere.
*
...
...
@@ -2177,6 +2216,12 @@ static int config_output(AVFilterLink *outlink)
wf
=
inlink
->
w
/
5
.
f
*
4
.
f
;
hf
=
inlink
->
h
;
break
;
case
STEREOGRAPHIC
:
in_transform
=
xyz_to_stereographic
;
err
=
0
;
wf
=
inlink
->
w
;
hf
=
inlink
->
h
;
break
;
default
:
av_log
(
ctx
,
AV_LOG_ERROR
,
"Specified input format is not handled.
\n
"
);
return
AVERROR_BUG
;
...
...
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