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
a4f2fc93
Commit
a4f2fc93
authored
Jan 24, 2020
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_v360: fix fov calculation from dfov for fisheye input/output
parent
cbb254cb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
11 deletions
+26
-11
vf_v360.c
libavfilter/vf_v360.c
+26
-11
No files found.
libavfilter/vf_v360.c
View file @
a4f2fc93
...
...
@@ -3006,18 +3006,33 @@ static int allocate_plane(V360Context *s, int sizeof_uv, int sizeof_ker, int p)
return
0
;
}
static
void
fov_from_dfov
(
float
d_fov
,
float
w
,
float
h
,
float
*
h_fov
,
float
*
v_fov
)
static
void
fov_from_dfov
(
int
format
,
float
d_fov
,
float
w
,
float
h
,
float
*
h_fov
,
float
*
v_fov
)
{
const
float
da
=
tanf
(
0
.
5
*
FFMIN
(
d_fov
,
359
.
f
)
*
M_PI
/
180
.
f
);
const
float
d
=
hypotf
(
w
,
h
);
switch
(
format
)
{
case
FISHEYE
:
{
const
float
d
=
0
.
5
f
*
hypotf
(
w
,
h
);
*
h_fov
=
atan2f
(
da
*
w
,
d
)
*
360
.
f
/
M_PI
;
*
v_fov
=
atan2f
(
da
*
h
,
d
)
*
360
.
f
/
M_PI
;
*
h_fov
=
d
/
h
*
d_fov
;
*
v_fov
=
d
/
w
*
d_fov
;
}
break
;
case
FLAT
:
default
:
{
const
float
da
=
tanf
(
0
.
5
*
FFMIN
(
d_fov
,
359
.
f
)
*
M_PI
/
180
.
f
);
const
float
d
=
hypotf
(
w
,
h
);
if
(
*
h_fov
<
0
.
f
)
*
h_fov
+=
360
.
f
;
if
(
*
v_fov
<
0
.
f
)
*
v_fov
+=
360
.
f
;
*
h_fov
=
atan2f
(
da
*
w
,
d
)
*
360
.
f
/
M_PI
;
*
v_fov
=
atan2f
(
da
*
h
,
d
)
*
360
.
f
/
M_PI
;
if
(
*
h_fov
<
0
.
f
)
*
h_fov
+=
360
.
f
;
if
(
*
v_fov
<
0
.
f
)
*
v_fov
+=
360
.
f
;
}
break
;
}
}
static
void
set_dimensions
(
int
*
outw
,
int
*
outh
,
int
w
,
int
h
,
const
AVPixFmtDescriptor
*
desc
)
...
...
@@ -3190,7 +3205,7 @@ static int config_output(AVFilterLink *outlink)
s
->
in_height
=
s
->
inplaneheight
[
0
];
if
(
s
->
id_fov
>
0
.
f
)
fov_from_dfov
(
s
->
id_fov
,
w
,
h
,
&
s
->
ih_fov
,
&
s
->
iv_fov
);
fov_from_dfov
(
s
->
i
n
,
s
->
i
d_fov
,
w
,
h
,
&
s
->
ih_fov
,
&
s
->
iv_fov
);
if
(
s
->
in_transpose
)
FFSWAP
(
int
,
s
->
in_width
,
s
->
in_height
);
...
...
@@ -3435,7 +3450,7 @@ static int config_output(AVFilterLink *outlink)
}
if
(
s
->
d_fov
>
0
.
f
)
fov_from_dfov
(
s
->
d_fov
,
w
,
h
,
&
s
->
h_fov
,
&
s
->
v_fov
);
fov_from_dfov
(
s
->
out
,
s
->
d_fov
,
w
,
h
,
&
s
->
h_fov
,
&
s
->
v_fov
);
if
(
prepare_out
)
{
err
=
prepare_out
(
ctx
);
...
...
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