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
6e1913a0
Commit
6e1913a0
authored
Mar 02, 2020
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_v360: add truncated square pyramid input format
parent
3dd81be8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
1 deletion
+78
-1
filters.texi
doc/filters.texi
+1
-1
vf_v360.c
libavfilter/vf_v360.c
+77
-0
No files found.
doc/filters.texi
View file @
6e1913a0
...
...
@@ -19029,7 +19029,7 @@ Set perspective parameter.
Tetrahedron
projection
.
@
item
tsp
Truncated
square
pyramid
projection
.
@
i
{(
output
only
)}
Truncated
square
pyramid
projection
.
@
end
table
...
...
libavfilter/vf_v360.c
View file @
6e1913a0
...
...
@@ -77,6 +77,7 @@ static const AVOption v360_options[] = {
{
"cylindrical"
,
"cylindrical"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
CYLINDRICAL
},
0
,
0
,
FLAGS
,
"in"
},
{
"tetrahedron"
,
"tetrahedron"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
TETRAHEDRON
},
0
,
0
,
FLAGS
,
"in"
},
{
"barrelsplit"
,
"barrel split facebook's 360 format"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
BARREL_SPLIT
},
0
,
0
,
FLAGS
,
"in"
},
{
"tsp"
,
"truncated square pyramid"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
TSPYRAMID
},
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"
},
...
...
@@ -3286,6 +3287,76 @@ static int tspyramid_to_xyz(const V360Context *s,
return
1
;
}
/**
* Calculate frame position in tspyramid format for corresponding 3D coordinates on sphere.
*
* @param s filter private 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
int
xyz_to_tspyramid
(
const
V360Context
*
s
,
const
float
*
vec
,
int
width
,
int
height
,
int16_t
us
[
4
][
4
],
int16_t
vs
[
4
][
4
],
float
*
du
,
float
*
dv
)
{
float
uf
,
vf
;
int
ui
,
vi
;
int
face
;
xyz_to_cube
(
s
,
vec
,
&
uf
,
&
vf
,
&
face
);
uf
=
(
uf
+
1
.
f
)
*
0
.
5
f
;
vf
=
(
vf
+
1
.
f
)
*
0
.
5
f
;
switch
(
face
)
{
case
UP
:
uf
=
0
.
1875
f
*
vf
-
0
.
375
f
*
uf
*
vf
-
0
.
125
f
*
uf
+
0
.
8125
f
;
vf
=
0
.
375
f
-
0
.
375
f
*
vf
;
break
;
case
FRONT
:
uf
=
0
.
5
f
*
uf
;
break
;
case
DOWN
:
uf
=
1
.
f
-
0
.
1875
f
*
vf
-
0
.
5
f
*
uf
+
0
.
375
f
*
uf
*
vf
;
vf
=
1
.
f
-
0
.
375
f
*
vf
;
break
;
case
LEFT
:
vf
=
0
.
25
f
*
vf
+
0
.
75
f
*
uf
*
vf
-
0
.
375
f
*
uf
+
0
.
375
f
;
uf
=
0
.
1875
f
*
uf
+
0
.
8125
f
;
break
;
case
RIGHT
:
vf
=
0
.
375
f
*
uf
-
0
.
75
f
*
uf
*
vf
+
vf
;
uf
=
0
.
1875
f
*
uf
+
0
.
5
f
;
break
;
case
BACK
:
uf
=
0
.
125
f
*
uf
+
0
.
6875
f
;
vf
=
0
.
25
f
*
vf
+
0
.
375
f
;
break
;
}
uf
*=
width
;
vf
*=
height
;
ui
=
floorf
(
uf
);
vi
=
floorf
(
vf
);
*
du
=
uf
-
ui
;
*
dv
=
vf
-
vi
;
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
for
(
int
j
=
0
;
j
<
4
;
j
++
)
{
us
[
i
][
j
]
=
reflectx
(
ui
+
j
-
1
,
vi
+
i
-
1
,
width
,
height
);
vs
[
i
][
j
]
=
reflecty
(
vi
+
i
-
1
,
height
);
}
}
return
1
;
}
static
void
multiply_matrix
(
float
c
[
3
][
3
],
const
float
a
[
3
][
3
],
const
float
b
[
3
][
3
])
{
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
...
...
@@ -3727,6 +3798,12 @@ static int config_output(AVFilterLink *outlink)
wf
=
w
*
4
.
f
/
3
.
f
;
hf
=
h
;
break
;
case
TSPYRAMID
:
s
->
in_transform
=
xyz_to_tspyramid
;
err
=
0
;
wf
=
w
;
hf
=
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