FFmpeg
v360.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 Eugene Lyapustin
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #ifndef AVFILTER_V360_H
22 #define AVFILTER_V360_H
23 #include "avfilter.h"
24 
30 };
31 
55 };
56 
66 };
67 
68 enum Faces {
76 };
77 
78 enum Direction {
79  RIGHT, ///< Axis +X
80  LEFT, ///< Axis -X
81  UP, ///< Axis +Y
82  DOWN, ///< Axis -Y
83  FRONT, ///< Axis -Z
84  BACK, ///< Axis +Z
86 };
87 
88 enum Rotation {
94 };
95 
97  YAW,
101 };
102 
103 typedef struct XYRemap {
104  int16_t u[4][4];
105  int16_t v[4][4];
106  float ker[4][4];
107 } XYRemap;
108 
109 typedef struct V360Context {
110  const AVClass *class;
111  int in, out;
112  int interp;
113  int alpha;
114  int width, height;
115  char *in_forder;
116  char *out_forder;
117  char *in_frot;
118  char *out_frot;
119  char *rorder;
120 
126 
128 
129  float in_pad, out_pad;
131 
132  float yaw, pitch, roll;
133 
137 
138  float h_fov, v_fov, d_fov;
140  float flat_range[2];
141  float iflat_range[2];
142 
143  float rot_mat[3][3];
144 
147 
150 
151  int pr_width[4], pr_height[4];
152 
155 
158  int uv_linesize[4];
161  int elements;
164 
165  int16_t *u[2], *v[2];
166  int16_t *ker[2];
168  unsigned map[4];
169 
170  int (*in_transform)(const struct V360Context *s,
171  const float *vec, int width, int height,
172  int16_t us[4][4], int16_t vs[4][4], float *du, float *dv);
173 
174  int (*out_transform)(const struct V360Context *s,
175  int i, int j, int width, int height,
176  float *vec);
177 
178  void (*calculate_kernel)(float du, float dv, const XYRemap *rmap,
179  int16_t *u, int16_t *v, int16_t *ker);
180 
181  int (*remap_slice)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs);
182 
183  void (*remap_line)(uint8_t *dst, int width, const uint8_t *const src, ptrdiff_t in_linesize,
184  const int16_t *const u, const int16_t *const v, const int16_t *const ker);
185 } V360Context;
186 
187 void ff_v360_init(V360Context *s, int depth);
188 void ff_v360_init_x86(V360Context *s, int depth);
189 
190 #endif /* AVFILTER_V360_H */
Rotation
Rotation
Definition: v360.h:88
V360Context::planeheight
int planeheight[4]
Definition: v360.h:156
V360Context::rot_mat
float rot_mat[3][3]
Definition: v360.h:143
V360Context::out_width
int out_width
Definition: v360.h:149
V360Context::in_cubemap_face_rotation
int in_cubemap_face_rotation[6]
Definition: v360.h:123
XYRemap::u
int16_t u[4][4]
Definition: v360.h:104
V360Context::in_forder
char * in_forder
Definition: v360.h:115
V360Context::in_height
int in_height
Definition: v360.h:148
ROT_180
@ ROT_180
Definition: v360.h:91
EQUIANGULAR
@ EQUIANGULAR
Definition: v360.h:36
V360Context::remap_line
void(* remap_line)(uint8_t *dst, int width, const uint8_t *const src, ptrdiff_t in_linesize, const int16_t *const u, const int16_t *const v, const int16_t *const ker)
Definition: v360.h:183
ff_v360_init_x86
void ff_v360_init_x86(V360Context *s, int depth)
Definition: vf_v360_init.c:44
DOWN
@ DOWN
Axis -Y.
Definition: v360.h:82
V360Context::in_offset_h
int in_offset_h[4]
Definition: v360.h:153
ROLL
@ ROLL
Definition: v360.h:99
FRONT
@ FRONT
Axis -Z.
Definition: v360.h:83
CUBEMAP_3_2
@ CUBEMAP_3_2
Definition: v360.h:34
NB_PROJECTIONS
@ NB_PROJECTIONS
Definition: v360.h:54
V360Context::in_frot
char * in_frot
Definition: v360.h:117
V360Context::pr_width
int pr_width[4]
Definition: v360.h:151
V360Context::out
int out
Definition: v360.h:111
V360Context::calculate_kernel
void(* calculate_kernel)(float du, float dv, const XYRemap *rmap, int16_t *u, int16_t *v, int16_t *ker)
Definition: v360.h:178
BARREL
@ BARREL
Definition: v360.h:39
V360Context::input_mirror_modifier
float input_mirror_modifier[2]
Definition: v360.h:145
V360Context::ker
int16_t * ker[2]
Definition: v360.h:166
V360Context::output_mirror_modifier
float output_mirror_modifier[3]
Definition: v360.h:146
V360Context::iv_flip
int iv_flip
Definition: v360.h:134
V360Context::out_stereo
int out_stereo
Definition: v360.h:127
HAMMER
@ HAMMER
Definition: v360.h:44
RIGHT
@ RIGHT
Axis +X.
Definition: v360.h:79
V360Context::in_pad
float in_pad
Definition: v360.h:129
FISHEYE
@ FISHEYE
Definition: v360.h:46
V360Context::v
int16_t * v[2]
Definition: v360.h:165
V360Context::planewidth
int planewidth[4]
Definition: v360.h:156
V360Context::inplanewidth
int inplanewidth[4]
Definition: v360.h:157
MERCATOR
@ MERCATOR
Definition: v360.h:42
BOTTOM_LEFT
@ BOTTOM_LEFT
Definition: v360.h:72
PERSPECTIVE
@ PERSPECTIVE
Definition: v360.h:49
V360Context::alpha
int alpha
Definition: v360.h:113
V360Context::height
int height
Definition: v360.h:114
us
#define us(width, name, range_min, range_max, subs,...)
Definition: cbs_h2645.c:276
TOP_RIGHT
@ TOP_RIGHT
Definition: v360.h:71
ROT_270
@ ROT_270
Definition: v360.h:92
TSPYRAMID
@ TSPYRAMID
Definition: v360.h:52
FLAT
@ FLAT
Definition: v360.h:37
V360Context::nb_allocated
int nb_allocated
Definition: v360.h:160
V360Context::flat_range
float flat_range[2]
Definition: v360.h:140
BARREL_SPLIT
@ BARREL_SPLIT
Definition: v360.h:51
CYLINDRICAL
@ CYLINDRICAL
Definition: v360.h:48
V360Context::in_cubemap_face_order
int in_cubemap_face_order[6]
Definition: v360.h:121
XYRemap
Definition: v360.h:103
ROT_90
@ ROT_90
Definition: v360.h:90
s
#define s(width, name)
Definition: cbs_vp9.c:257
V360Context::map
unsigned map[4]
Definition: v360.h:168
V360Context::rotation_order
int rotation_order[3]
Definition: v360.h:125
V360Context::in_stereo
int in_stereo
Definition: v360.h:127
UP
@ UP
Axis +Y.
Definition: v360.h:81
PANNINI
@ PANNINI
Definition: v360.h:47
V360Context::in_width
int in_width
Definition: v360.h:148
V360Context::d_fov
float d_fov
Definition: v360.h:138
XYRemap::v
int16_t v[4][4]
Definition: v360.h:105
TOP_LEFT
@ TOP_LEFT
Definition: v360.h:69
ctx
AVFormatContext * ctx
Definition: movenc.c:48
LANCZOS
@ LANCZOS
Definition: v360.h:62
Direction
Direction
Definition: v360.h:78
arg
const char * arg
Definition: jacosubdec.c:66
V360Context::in_transpose
int in_transpose
Definition: v360.h:136
Projections
Projections
Definition: v360.h:32
V360Context::out_transform
int(* out_transform)(const struct V360Context *s, int i, int j, int width, int height, float *vec)
Definition: v360.h:174
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:67
V360Context::interp
int interp
Definition: v360.h:112
V360Context::pr_height
int pr_height[4]
Definition: v360.h:151
V360Context::rorder
char * rorder
Definition: v360.h:119
V360Context::nb_planes
int nb_planes
Definition: v360.h:159
V360Context::out_forder
char * out_forder
Definition: v360.h:116
V360Context::yaw
float yaw
Definition: v360.h:132
V360Context::out_pad
float out_pad
Definition: v360.h:129
src
#define src
Definition: vp8dsp.c:254
V360Context::h_fov
float h_fov
Definition: v360.h:138
V360Context::uv_linesize
int uv_linesize[4]
Definition: v360.h:158
V360Context::in_transform
int(* in_transform)(const struct V360Context *s, const float *vec, int width, int height, int16_t us[4][4], int16_t vs[4][4], float *du, float *dv)
Definition: v360.h:170
V360Context::mask_size
int mask_size
Definition: v360.h:162
ROT_0
@ ROT_0
Definition: v360.h:89
V360Context::max_value
int max_value
Definition: v360.h:163
V360Context::h_flip
int h_flip
Definition: v360.h:135
NB_RORDERS
@ NB_RORDERS
Definition: v360.h:100
Faces
Faces
Definition: v360.h:68
ff_v360_init
void ff_v360_init(V360Context *s, int depth)
Definition: vf_v360.c:359
BALL
@ BALL
Definition: v360.h:43
CUBEMAP_6_1
@ CUBEMAP_6_1
Definition: v360.h:35
NEAREST
@ NEAREST
Definition: v360.h:58
V360Context::ih_flip
int ih_flip
Definition: v360.h:134
V360Context
Definition: v360.h:109
V360Context::inplaneheight
int inplaneheight[4]
Definition: v360.h:157
V360Context::remap_slice
int(* remap_slice)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: v360.h:181
BICUBIC
@ BICUBIC
Definition: v360.h:61
V360Context::out_height
int out_height
Definition: v360.h:149
YAW
@ YAW
Definition: v360.h:97
HEQUIRECTANGULAR
@ HEQUIRECTANGULAR
Definition: v360.h:53
V360Context::out_cubemap_direction_order
int out_cubemap_direction_order[6]
Definition: v360.h:122
NB_FACES
@ NB_FACES
Definition: v360.h:75
V360Context::iv_fov
float iv_fov
Definition: v360.h:139
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
BOTTOM_MIDDLE
@ BOTTOM_MIDDLE
Definition: v360.h:73
SPLINE16
@ SPLINE16
Definition: v360.h:63
V360Context::ih_fov
float ih_fov
Definition: v360.h:139
uint8_t
uint8_t
Definition: audio_convert.c:194
V360Context::id_fov
float id_fov
Definition: v360.h:139
LEFT
@ LEFT
Axis -X.
Definition: v360.h:80
GAUSSIAN
@ GAUSSIAN
Definition: v360.h:64
DUAL_FISHEYE
@ DUAL_FISHEYE
Definition: v360.h:38
BACK
@ BACK
Axis +Z.
Definition: v360.h:84
STEREOGRAPHIC
@ STEREOGRAPHIC
Definition: v360.h:41
V360Context::u
int16_t * u[2]
Definition: v360.h:165
V360Context::in
int in
Definition: v360.h:111
CUBEMAP_1_6
@ CUBEMAP_1_6
Definition: v360.h:40
NB_ROTATIONS
@ NB_ROTATIONS
Definition: v360.h:93
V360Context::d_flip
int d_flip
Definition: v360.h:135
NB_INTERP_METHODS
@ NB_INTERP_METHODS
Definition: v360.h:65
PITCH
@ PITCH
Definition: v360.h:98
STEREO_2D
@ STEREO_2D
Definition: v360.h:26
NB_STEREO_FMTS
@ NB_STEREO_FMTS
Definition: v360.h:29
TOP_MIDDLE
@ TOP_MIDDLE
Definition: v360.h:70
EQUIRECTANGULAR
@ EQUIRECTANGULAR
Definition: v360.h:33
V360Context::v_fov
float v_fov
Definition: v360.h:138
BILINEAR
@ BILINEAR
Definition: v360.h:59
V360Context::out_offset_h
int out_offset_h[4]
Definition: v360.h:154
V360Context::out_frot
char * out_frot
Definition: v360.h:118
V360Context::roll
float roll
Definition: v360.h:132
NB_DIRECTIONS
@ NB_DIRECTIONS
Definition: v360.h:85
STEREO_TB
@ STEREO_TB
Definition: v360.h:28
V360Context::mask
uint8_t * mask
Definition: v360.h:167
avfilter.h
V360Context::out_cubemap_face_rotation
int out_cubemap_face_rotation[6]
Definition: v360.h:124
SINUSOIDAL
@ SINUSOIDAL
Definition: v360.h:45
LAGRANGE9
@ LAGRANGE9
Definition: v360.h:60
AVFilterContext
An instance of a filter.
Definition: avfilter.h:338
RotationOrder
RotationOrder
Definition: v360.h:96
V360Context::pitch
float pitch
Definition: v360.h:132
XYRemap::ker
float ker[4][4]
Definition: v360.h:106
V360Context::fin_pad
int fin_pad
Definition: v360.h:130
STEREO_SBS
@ STEREO_SBS
Definition: v360.h:27
V360Context::out_transpose
int out_transpose
Definition: v360.h:136
V360Context::iflat_range
float iflat_range[2]
Definition: v360.h:141
V360Context::width
int width
Definition: v360.h:114
V360Context::out_offset_w
int out_offset_w[4]
Definition: v360.h:154
V360Context::elements
int elements
Definition: v360.h:161
InterpMethod
InterpMethod
Definition: v360.h:57
StereoFormats
StereoFormats
Definition: v360.h:25
int
int
Definition: ffmpeg_filter.c:192
TETRAHEDRON
@ TETRAHEDRON
Definition: v360.h:50
V360Context::v_flip
int v_flip
Definition: v360.h:135
V360Context::in_offset_w
int in_offset_w[4]
Definition: v360.h:153
BOTTOM_RIGHT
@ BOTTOM_RIGHT
Definition: v360.h:74
V360Context::fout_pad
int fout_pad
Definition: v360.h:130