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
7ce70026
Commit
7ce70026
authored
Sep 11, 2019
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_v360: refactor FoV calculation for stereographic
Move in out of loop.
parent
78b86c30
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
6 deletions
+23
-6
vf_v360.c
libavfilter/vf_v360.c
+23
-6
No files found.
libavfilter/vf_v360.c
View file @
7ce70026
...
...
@@ -1396,6 +1396,26 @@ static void equirect_to_xyz(const V360Context *s,
vec
[
2
]
=
-
cos_theta
*
cos_phi
;
}
/**
* Prepare data for processing stereographic output format.
*
* @param ctx filter context
*
* @return error code
*/
static
int
prepare_stereographic_out
(
AVFilterContext
*
ctx
)
{
V360Context
*
s
=
ctx
->
priv
;
const
float
h_angle
=
tan
(
FFMIN
(
s
->
h_fov
,
359
.
f
)
*
M_PI
/
720
.
f
);
const
float
v_angle
=
tan
(
FFMIN
(
s
->
v_fov
,
359
.
f
)
*
M_PI
/
720
.
f
);
s
->
flat_range
[
0
]
=
h_angle
;
s
->
flat_range
[
1
]
=
v_angle
;
return
0
;
}
/**
* Calculate 3D coordinates on sphere for corresponding frame position in stereographic format.
*
...
...
@@ -1410,11 +1430,8 @@ static void stereographic_to_xyz(const V360Context *s,
int
i
,
int
j
,
int
width
,
int
height
,
float
*
vec
)
{
const
float
h_angle
=
tan
(
FFMIN
(
s
->
h_fov
,
359
.
f
)
*
M_PI
/
720
.
f
);
const
float
v_angle
=
tan
(
FFMIN
(
s
->
v_fov
,
359
.
f
)
*
M_PI
/
720
.
f
);
const
float
x
=
((
2
.
f
*
i
)
/
width
-
1
.
f
)
*
h_angle
;
const
float
y
=
((
2
.
f
*
j
)
/
height
-
1
.
f
)
*
v_angle
;
const
float
x
=
((
2
.
f
*
i
)
/
width
-
1
.
f
)
*
s
->
flat_range
[
0
];
const
float
y
=
((
2
.
f
*
j
)
/
height
-
1
.
f
)
*
s
->
flat_range
[
1
];
const
float
xy
=
x
*
x
+
y
*
y
;
vec
[
0
]
=
2
.
f
*
x
/
(
1
.
f
+
xy
);
...
...
@@ -2282,7 +2299,7 @@ static int config_output(AVFilterLink *outlink)
break
;
case
STEREOGRAPHIC
:
out_transform
=
stereographic_to_xyz
;
err
=
0
;
err
=
prepare_stereographic_out
(
ctx
)
;
w
=
FFMAX
(
roundf
(
wf
),
roundf
(
hf
));
h
=
w
;
break
;
...
...
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