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
976617c7
Commit
976617c7
authored
Sep 09, 2019
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_v360: extend stereographic projection
Add option to change central point projection.
parent
7985430c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
9 deletions
+31
-9
filters.texi
doc/filters.texi
+6
-1
v360.h
libavfilter/v360.h
+1
-0
vf_v360.c
libavfilter/vf_v360.c
+24
-8
No files found.
doc/filters.texi
View file @
976617c7
...
...
@@ -18038,7 +18038,12 @@ Stereographic format. @i{(output only)}
Format specific options:
@table @option
@item h_fov
Set field of view. Values in degrees.
@item v_fov
Set horizontal/vertical field of view. Values in degrees.
@item p_lon
@item p_lat
Set central point of projection longitude/latitude. Values in degrees.
@end table
@end table
...
...
libavfilter/v360.h
View file @
976617c7
...
...
@@ -105,6 +105,7 @@ typedef struct V360Context {
float
h_fov
,
v_fov
;
float
flat_range
[
3
];
float
p_lon
,
p_lat
;
float
input_mirror_modifier
[
2
];
...
...
libavfilter/vf_v360.c
View file @
976617c7
...
...
@@ -33,6 +33,8 @@
* 5) Remap input frame to output frame using precalculated data
*/
#include <float.h>
#include "libavutil/avassert.h"
#include "libavutil/imgutils.h"
#include "libavutil/pixdesc.h"
...
...
@@ -105,6 +107,8 @@ static const AVOption v360_options[] = {
{
"iv_flip"
,
"flip in video vertically"
,
OFFSET
(
iv_flip
),
AV_OPT_TYPE_BOOL
,
{.
i64
=
0
},
0
,
1
,
FLAGS
,
"iv_flip"
},
{
"in_trans"
,
"transpose video input"
,
OFFSET
(
in_transpose
),
AV_OPT_TYPE_BOOL
,
{.
i64
=
0
},
0
,
1
,
FLAGS
,
"in_transpose"
},
{
"out_trans"
,
"transpose video output"
,
OFFSET
(
out_transpose
),
AV_OPT_TYPE_BOOL
,
{.
i64
=
0
},
0
,
1
,
FLAGS
,
"out_transpose"
},
{
"p_lon"
,
"central projection longitude"
,
OFFSET
(
p_lon
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
0
.
f
},
-
180
.
f
,
180
.
f
,
FLAGS
,
"p_lon"
},
{
"p_lat"
,
"central projection latitude"
,
OFFSET
(
p_lat
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
90
.
f
},
-
90
.
f
,
90
.
f
,
FLAGS
,
"p_lat"
},
{
NULL
}
};
...
...
@@ -1406,14 +1410,26 @@ static void stereographic_to_xyz(const V360Context *s,
int
i
,
int
j
,
int
width
,
int
height
,
float
*
vec
)
{
const
float
z
=
0
.
5
f
*
s
->
h_fov
*
M_PI
/
180
.
f
;
const
float
x
=
z
*
(
2
.
f
*
i
/
width
-
1
.
f
);
const
float
y
=
z
*
(
2
.
f
*
j
/
height
-
1
.
f
);
const
float
xy
=
x
*
x
+
y
*
y
;
vec
[
0
]
=
2
.
f
*
x
/
(
1
.
f
+
xy
);
vec
[
1
]
=
(
-
1
.
f
+
xy
)
/
(
1
.
f
+
xy
);
vec
[
2
]
=
2
.
f
*
y
/
(
1
.
f
+
xy
);
const
float
x
=
((
2
.
f
*
i
)
/
width
-
1
.
f
)
*
(
s
->
h_fov
/
180
.
f
)
*
M_PI
;
const
float
y
=
((
2
.
f
*
j
)
/
height
-
1
.
f
)
*
(
s
->
v_fov
/
90
.
f
)
*
M_PI_2
;
const
float
rho
=
hypotf
(
x
,
y
)
+
FLT_EPSILON
;
const
float
c
=
2
.
f
*
atan2f
(
rho
,
0
.
15
f
/
2
.
f
);
const
float
cos_c
=
cosf
(
c
);
const
float
sin_c
=
sinf
(
c
);
const
float
cp_x
=
s
->
p_lon
/
180
.
f
*
M_PI
;
const
float
cp_y
=
s
->
p_lat
/
90
.
f
*
M_PI_2
;
const
float
phi
=
cp_x
+
atan2f
(
x
*
sin_c
,
rho
*
cosf
(
cp_y
)
*
cos_c
-
y
*
sinf
(
cp_y
)
*
sin_c
);
const
float
theta
=
asinf
(
cos_c
*
sinf
(
cp_y
)
+
(
y
*
sin_c
*
cosf
(
cp_y
))
/
rho
);
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
;
normalize_vector
(
vec
);
}
...
...
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