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 
59 };
60 
71 };
72 
73 enum Faces {
81 };
82 
83 enum Direction {
84  RIGHT, ///< Axis +X
85  LEFT, ///< Axis -X
86  UP, ///< Axis +Y
87  DOWN, ///< Axis -Y
88  FRONT, ///< Axis -Z
89  BACK, ///< Axis +Z
91 };
92 
93 enum Rotation {
99 };
100 
106 };
107 
108 typedef struct XYRemap {
109  int16_t u[4][4];
110  int16_t v[4][4];
111  float ker[4][4];
112 } XYRemap;
113 
114 typedef struct SliceXYRemap {
115  int16_t *u[2], *v[2];
116  int16_t *ker[2];
117  uint8_t *mask;
118 } SliceXYRemap;
119 
120 typedef struct V360Context {
121  const AVClass *class;
122  int in, out;
123  int interp;
124  int alpha;
126  int width, height;
127  char *in_forder;
128  char *out_forder;
129  char *in_frot;
130  char *out_frot;
131  char *rorder;
132 
138 
140 
141  float in_pad, out_pad;
143 
144  float yaw, pitch, roll;
146 
150 
151  float h_fov, v_fov, d_fov;
153  float flat_range[2];
154  float iflat_range[2];
155 
156  float rot_quaternion[2][4];
157 
159 
162 
164 
167 
173  int elements;
177 
180 
181  int (*in_transform)(const struct V360Context *s,
182  const float *vec, int width, int height,
183  int16_t us[4][4], int16_t vs[4][4], float *du, float *dv);
184 
185  int (*out_transform)(const struct V360Context *s,
186  int i, int j, int width, int height,
187  float *vec);
188 
189  void (*calculate_kernel)(float du, float dv, const XYRemap *rmap,
190  int16_t *u, int16_t *v, int16_t *ker);
191 
192  int (*remap_slice)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs);
193 
194  void (*remap_line)(uint8_t *dst, int width, const uint8_t *const src, ptrdiff_t in_linesize,
195  const int16_t *const u, const int16_t *const v, const int16_t *const ker);
196 } V360Context;
197 
198 void ff_v360_init(V360Context *s, int depth);
199 void ff_v360_init_x86(V360Context *s, int depth);
200 
201 #endif /* AVFILTER_V360_H */
V360Context::rot_quaternion
float rot_quaternion[2][4]
Definition: v360.h:156
Rotation
Rotation
Definition: v360.h:93
V360Context::uv_linesize
int uv_linesize[AV_VIDEO_MAX_PLANES]
Definition: v360.h:170
V360Context::out_width
int out_width
Definition: v360.h:161
V360Context::in_offset_h
int in_offset_h[AV_VIDEO_MAX_PLANES]
Definition: v360.h:165
V360Context::in_cubemap_face_rotation
int in_cubemap_face_rotation[6]
Definition: v360.h:135
XYRemap::u
int16_t u[4][4]
Definition: v360.h:109
V360Context::in_forder
char * in_forder
Definition: v360.h:127
V360Context::in_height
int in_height
Definition: v360.h:160
ROT_180
@ ROT_180
Definition: v360.h:96
u
#define u(width, name, range_min, range_max)
Definition: cbs_h2645.c:251
SliceXYRemap::u
int16_t * u[2]
Definition: v360.h:115
EQUIANGULAR
@ EQUIANGULAR
Definition: v360.h:36
ORTHOGRAPHIC
@ ORTHOGRAPHIC
Definition: v360.h:55
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:194
ff_v360_init_x86
void ff_v360_init_x86(V360Context *s, int depth)
Definition: vf_v360_init.c:44
AV_VIDEO_MAX_PLANES
#define AV_VIDEO_MAX_PLANES
Maximum number of planes in any pixel format.
Definition: pixfmt.h:40
DOWN
@ DOWN
Axis -Y.
Definition: v360.h:87
V360Context::planewidth
int planewidth[AV_VIDEO_MAX_PLANES]
Definition: v360.h:168
V360Context::pr_height
int pr_height[AV_VIDEO_MAX_PLANES]
Definition: v360.h:163
ROLL
@ ROLL
Definition: v360.h:104
V360Context::h_offset
float h_offset
Definition: v360.h:145
V360Context::slice_remap
SliceXYRemap * slice_remap
Definition: v360.h:178
FRONT
@ FRONT
Axis -Z.
Definition: v360.h:88
CUBEMAP_3_2
@ CUBEMAP_3_2
Definition: v360.h:34
NB_PROJECTIONS
@ NB_PROJECTIONS
Definition: v360.h:58
V360Context::in_frot
char * in_frot
Definition: v360.h:129
V360Context::out
int out
Definition: v360.h:122
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:189
BARREL
@ BARREL
Definition: v360.h:39
V360Context::output_mirror_modifier
float output_mirror_modifier[3]
Definition: v360.h:158
V360Context::iv_flip
int iv_flip
Definition: v360.h:147
V360Context::out_stereo
int out_stereo
Definition: v360.h:139
HAMMER
@ HAMMER
Definition: v360.h:44
RIGHT
@ RIGHT
Axis +X.
Definition: v360.h:84
V360Context::in_pad
float in_pad
Definition: v360.h:141
FISHEYE
@ FISHEYE
Definition: v360.h:46
MERCATOR
@ MERCATOR
Definition: v360.h:42
BOTTOM_LEFT
@ BOTTOM_LEFT
Definition: v360.h:77
PERSPECTIVE
@ PERSPECTIVE
Definition: v360.h:49
V360Context::alpha
int alpha
Definition: v360.h:124
V360Context::height
int height
Definition: v360.h:126
us
#define us(width, name, range_min, range_max, subs,...)
Definition: cbs_h2645.c:263
TOP_RIGHT
@ TOP_RIGHT
Definition: v360.h:76
ROT_270
@ ROT_270
Definition: v360.h:97
TSPYRAMID
@ TSPYRAMID
Definition: v360.h:52
FLAT
@ FLAT
Definition: v360.h:37
V360Context::nb_allocated
int nb_allocated
Definition: v360.h:172
V360Context::flat_range
float flat_range[2]
Definition: v360.h:153
BARREL_SPLIT
@ BARREL_SPLIT
Definition: v360.h:51
V360Context::pr_width
int pr_width[AV_VIDEO_MAX_PLANES]
Definition: v360.h:163
CYLINDRICAL
@ CYLINDRICAL
Definition: v360.h:48
V360Context::in_cubemap_face_order
int in_cubemap_face_order[6]
Definition: v360.h:133
XYRemap
Definition: v360.h:108
ROT_90
@ ROT_90
Definition: v360.h:95
s
#define s(width, name)
Definition: cbs_vp9.c:198
V360Context::rotation_order
int rotation_order[3]
Definition: v360.h:137
V360Context::in_stereo
int in_stereo
Definition: v360.h:139
UP
@ UP
Axis +Y.
Definition: v360.h:86
PANNINI
@ PANNINI
Definition: v360.h:47
V360Context::in_width
int in_width
Definition: v360.h:160
V360Context::d_fov
float d_fov
Definition: v360.h:151
XYRemap::v
int16_t v[4][4]
Definition: v360.h:110
TOP_LEFT
@ TOP_LEFT
Definition: v360.h:74
V360Context::in_offset_w
int in_offset_w[AV_VIDEO_MAX_PLANES]
Definition: v360.h:165
ctx
AVFormatContext * ctx
Definition: movenc.c:49
LANCZOS
@ LANCZOS
Definition: v360.h:66
Direction
Direction
Definition: v360.h:83
V360Context::v_offset
float v_offset
Definition: v360.h:145
arg
const char * arg
Definition: jacosubdec.c:67
V360Context::reset_rot
int reset_rot
Definition: v360.h:125
V360Context::in_transpose
int in_transpose
Definition: v360.h:149
OCTAHEDRON
@ OCTAHEDRON
Definition: v360.h:56
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:185
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:75
V360Context::interp
int interp
Definition: v360.h:123
V360Context::rorder
char * rorder
Definition: v360.h:131
V360Context::nb_planes
int nb_planes
Definition: v360.h:171
V360Context::out_forder
char * out_forder
Definition: v360.h:128
V360Context::yaw
float yaw
Definition: v360.h:144
CYLINDRICALEA
@ CYLINDRICALEA
Definition: v360.h:57
V360Context::out_pad
float out_pad
Definition: v360.h:141
V360Context::h_fov
float h_fov
Definition: v360.h:151
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:181
V360Context::mask_size
int mask_size
Definition: v360.h:174
ROT_0
@ ROT_0
Definition: v360.h:94
V360Context::max_value
int max_value
Definition: v360.h:175
V360Context::h_flip
int h_flip
Definition: v360.h:148
V360Context::out_offset_h
int out_offset_h[AV_VIDEO_MAX_PLANES]
Definition: v360.h:166
NB_RORDERS
@ NB_RORDERS
Definition: v360.h:105
SliceXYRemap::v
int16_t * v[2]
Definition: v360.h:115
Faces
Faces
Definition: v360.h:73
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:83
ff_v360_init
void ff_v360_init(V360Context *s, int depth)
Definition: vf_v360.c:376
BALL
@ BALL
Definition: v360.h:43
V360Context::nb_threads
int nb_threads
Definition: v360.h:176
CUBEMAP_6_1
@ CUBEMAP_6_1
Definition: v360.h:35
MITCHELL
@ MITCHELL
Definition: v360.h:69
NEAREST
@ NEAREST
Definition: v360.h:62
V360Context::ih_flip
int ih_flip
Definition: v360.h:147
SliceXYRemap
Definition: v360.h:114
V360Context::out_offset_w
int out_offset_w[AV_VIDEO_MAX_PLANES]
Definition: v360.h:166
V360Context
Definition: v360.h:120
V360Context::remap_slice
int(* remap_slice)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: v360.h:192
BICUBIC
@ BICUBIC
Definition: v360.h:65
V360Context::out_height
int out_height
Definition: v360.h:161
YAW
@ YAW
Definition: v360.h:102
V360Context::inplaneheight
int inplaneheight[AV_VIDEO_MAX_PLANES]
Definition: v360.h:169
HEQUIRECTANGULAR
@ HEQUIRECTANGULAR
Definition: v360.h:53
V360Context::map
unsigned map[AV_VIDEO_MAX_PLANES]
Definition: v360.h:179
V360Context::inplanewidth
int inplanewidth[AV_VIDEO_MAX_PLANES]
Definition: v360.h:169
V360Context::out_cubemap_direction_order
int out_cubemap_direction_order[6]
Definition: v360.h:134
EQUISOLID
@ EQUISOLID
Definition: v360.h:54
NB_FACES
@ NB_FACES
Definition: v360.h:80
V360Context::iv_fov
float iv_fov
Definition: v360.h:152
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
BOTTOM_MIDDLE
@ BOTTOM_MIDDLE
Definition: v360.h:78
SPLINE16
@ SPLINE16
Definition: v360.h:67
V360Context::ih_fov
float ih_fov
Definition: v360.h:152
V360Context::id_fov
float id_fov
Definition: v360.h:152
LEFT
@ LEFT
Axis -X.
Definition: v360.h:85
GAUSSIAN
@ GAUSSIAN
Definition: v360.h:68
DUAL_FISHEYE
@ DUAL_FISHEYE
Definition: v360.h:38
BACK
@ BACK
Axis +Z.
Definition: v360.h:89
STEREOGRAPHIC
@ STEREOGRAPHIC
Definition: v360.h:41
V360Context::in
int in
Definition: v360.h:122
CUBEMAP_1_6
@ CUBEMAP_1_6
Definition: v360.h:40
NB_ROTATIONS
@ NB_ROTATIONS
Definition: v360.h:98
V360Context::d_flip
int d_flip
Definition: v360.h:148
NB_INTERP_METHODS
@ NB_INTERP_METHODS
Definition: v360.h:70
PITCH
@ PITCH
Definition: v360.h:103
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:75
EQUIRECTANGULAR
@ EQUIRECTANGULAR
Definition: v360.h:33
V360Context::v_fov
float v_fov
Definition: v360.h:151
BILINEAR
@ BILINEAR
Definition: v360.h:63
V360Context::out_frot
char * out_frot
Definition: v360.h:130
V360Context::roll
float roll
Definition: v360.h:144
NB_DIRECTIONS
@ NB_DIRECTIONS
Definition: v360.h:90
STEREO_TB
@ STEREO_TB
Definition: v360.h:28
avfilter.h
V360Context::out_cubemap_face_rotation
int out_cubemap_face_rotation[6]
Definition: v360.h:136
SINUSOIDAL
@ SINUSOIDAL
Definition: v360.h:45
LAGRANGE9
@ LAGRANGE9
Definition: v360.h:64
AVFilterContext
An instance of a filter.
Definition: avfilter.h:457
RotationOrder
RotationOrder
Definition: v360.h:101
V360Context::planeheight
int planeheight[AV_VIDEO_MAX_PLANES]
Definition: v360.h:168
V360Context::pitch
float pitch
Definition: v360.h:144
XYRemap::ker
float ker[4][4]
Definition: v360.h:111
V360Context::fin_pad
int fin_pad
Definition: v360.h:142
STEREO_SBS
@ STEREO_SBS
Definition: v360.h:27
V360Context::out_transpose
int out_transpose
Definition: v360.h:149
V360Context::iflat_range
float iflat_range[2]
Definition: v360.h:154
SliceXYRemap::mask
uint8_t * mask
Definition: v360.h:117
V360Context::width
int width
Definition: v360.h:126
V360Context::elements
int elements
Definition: v360.h:173
SliceXYRemap::ker
int16_t * ker[2]
Definition: v360.h:116
InterpMethod
InterpMethod
Definition: v360.h:61
StereoFormats
StereoFormats
Definition: v360.h:25
TETRAHEDRON
@ TETRAHEDRON
Definition: v360.h:50
src
#define src
Definition: vp8dsp.c:248
V360Context::v_flip
int v_flip
Definition: v360.h:148
BOTTOM_RIGHT
@ BOTTOM_RIGHT
Definition: v360.h:79
V360Context::fout_pad
int fout_pad
Definition: v360.h:142