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
ca042319
Commit
ca042319
authored
Mar 03, 2020
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_v360: add half equirectangular output format
parent
f9cb7cf4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
0 deletions
+38
-0
v360.h
libavfilter/v360.h
+1
-0
vf_v360.c
libavfilter/vf_v360.c
+37
-0
No files found.
libavfilter/v360.h
View file @
ca042319
...
...
@@ -50,6 +50,7 @@ enum Projections {
TETRAHEDRON
,
BARREL_SPLIT
,
TSPYRAMID
,
HEQUIRECTANGULAR
,
NB_PROJECTIONS
,
};
...
...
libavfilter/vf_v360.c
View file @
ca042319
...
...
@@ -103,6 +103,8 @@ static const AVOption v360_options[] = {
{
"tetrahedron"
,
"tetrahedron"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
TETRAHEDRON
},
0
,
0
,
FLAGS
,
"out"
},
{
"barrelsplit"
,
"barrel split facebook's 360 format"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
BARREL_SPLIT
},
0
,
0
,
FLAGS
,
"out"
},
{
"tsp"
,
"truncated square pyramid"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
TSPYRAMID
},
0
,
0
,
FLAGS
,
"out"
},
{
"hequirect"
,
"half equirectangular"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
HEQUIRECTANGULAR
},
0
,
0
,
FLAGS
,
"out"
},
{
"he"
,
"half equirectangular"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
HEQUIRECTANGULAR
},
0
,
0
,
FLAGS
,
"out"
},
{
"interp"
,
"set interpolation method"
,
OFFSET
(
interp
),
AV_OPT_TYPE_INT
,
{.
i64
=
BILINEAR
},
0
,
NB_INTERP_METHODS
-
1
,
FLAGS
,
"interp"
},
{
"near"
,
"nearest neighbour"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
NEAREST
},
0
,
0
,
FLAGS
,
"interp"
},
{
"nearest"
,
"nearest neighbour"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
NEAREST
},
0
,
0
,
FLAGS
,
"interp"
},
...
...
@@ -1630,6 +1632,35 @@ static int equirect_to_xyz(const V360Context *s,
return
1
;
}
/**
* Calculate 3D coordinates on sphere for corresponding frame position in half equirectangular format.
*
* @param s filter private 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
int
hequirect_to_xyz
(
const
V360Context
*
s
,
int
i
,
int
j
,
int
width
,
int
height
,
float
*
vec
)
{
const
float
phi
=
((
2
.
f
*
i
+
0
.
5
f
)
/
width
-
1
.
f
)
*
M_PI_2
;
const
float
theta
=
((
2
.
f
*
j
+
0
.
5
f
)
/
height
-
1
.
f
)
*
M_PI_2
;
const
float
sin_phi
=
sinf
(
phi
);
const
float
cos_phi
=
cosf
(
phi
);
const
float
sin_theta
=
sinf
(
theta
);
const
float
cos_theta
=
cosf
(
theta
);
vec
[
0
]
=
cos_theta
*
sin_phi
;
vec
[
1
]
=
-
sin_theta
;
vec
[
2
]
=
-
cos_theta
*
cos_phi
;
return
1
;
}
/**
* Prepare data for processing stereographic output format.
*
...
...
@@ -3934,6 +3965,12 @@ static int config_output(AVFilterLink *outlink)
w
=
lrintf
(
wf
);
h
=
lrintf
(
hf
);
break
;
case
HEQUIRECTANGULAR
:
s
->
out_transform
=
hequirect_to_xyz
;
prepare_out
=
NULL
;
w
=
lrintf
(
wf
/
2
.
f
);
h
=
lrintf
(
hf
);
break
;
default
:
av_log
(
ctx
,
AV_LOG_ERROR
,
"Specified output 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