2 * Copyright (c) 2013 Vittorio Giovara <vittorio.giovara@gmail.com>
4 * This file is part of FFmpeg.
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.
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.
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
23 * @ingroup lavu_video_stereo3d
27 #ifndef AVUTIL_STEREO3D_H
28 #define AVUTIL_STEREO3D_H
35 * @defgroup lavu_video_stereo3d Stereo3D types and functions
38 * A stereoscopic video file consists in multiple views embedded in a single
39 * frame, usually describing two views of a scene. This file describes all
40 * possible codec-independent view arrangements.
46 * List of possible 3D Types
50 * Video is not stereoscopic (and metadata has to be there).
55 * Views are next to each other.
64 AV_STEREO3D_SIDEBYSIDE
,
67 * Views are on top of each other.
76 AV_STEREO3D_TOPBOTTOM
,
79 * Views are alternated temporally.
82 * frame0 frame1 frame2 ...
83 * LLLLLLLL RRRRRRRR LLLLLLLL
84 * LLLLLLLL RRRRRRRR LLLLLLLL
85 * LLLLLLLL RRRRRRRR LLLLLLLL
89 AV_STEREO3D_FRAMESEQUENCE
,
92 * Views are packed in a checkerboard-like structure per pixel.
101 AV_STEREO3D_CHECKERBOARD
,
104 * Views are next to each other, but when upscaling
105 * apply a checkerboard pattern.
108 * LLLLRRRR L L L L R R R R
109 * LLLLRRRR => L L L L R R R R
110 * LLLLRRRR L L L L R R R R
111 * LLLLRRRR L L L L R R R R
114 AV_STEREO3D_SIDEBYSIDE_QUINCUNX
,
117 * Views are packed per line, as if interlaced.
129 * Views are packed per column.
141 * Video is stereoscopic but the packing is unspecified.
147 * List of possible view types.
149 enum AVStereo3DView
{
151 * Frame contains two packed views.
153 AV_STEREO3D_VIEW_PACKED
,
156 * Frame contains only the left view.
158 AV_STEREO3D_VIEW_LEFT
,
161 * Frame contains only the right view.
163 AV_STEREO3D_VIEW_RIGHT
,
166 * Content is unspecified.
168 AV_STEREO3D_VIEW_UNSPEC
,
172 * List of possible primary eyes.
174 enum AVStereo3DPrimaryEye
{
188 AV_PRIMARY_EYE_RIGHT
,
192 * Inverted views, Right/Bottom represents the left view.
194 #define AV_STEREO3D_FLAG_INVERT (1 << 0)
197 * Stereo 3D type: this structure describes how two videos are packed
198 * within a single video surface, with additional information as needed.
200 * @note The struct must be allocated with av_stereo3d_alloc() and
201 * its size is not a part of the public ABI.
203 typedef struct AVStereo3D
{
205 * How views are packed within the video.
207 enum AVStereo3DType type
;
210 * Additional information about the frame packing.
215 * Determines which views are packed.
217 enum AVStereo3DView view
;
220 * Which eye is the primary eye when rendering in 2D.
222 enum AVStereo3DPrimaryEye primary_eye
;
225 * The distance between the centres of the lenses of the camera system,
226 * in micrometers. Zero if unset.
231 * Relative shift of the left and right images, which changes the zero parallax plane.
232 * Range is -1.0 to 1.0. Zero if unset.
234 AVRational horizontal_disparity_adjustment
;
237 * Horizontal field of view, in degrees. Zero if unset.
239 AVRational horizontal_field_of_view
;
243 * Allocate an AVStereo3D structure and set its fields to default values.
244 * The resulting struct can be freed using av_freep().
246 * @return An AVStereo3D filled with default values or NULL on failure.
248 AVStereo3D
*av_stereo3d_alloc(void);
251 * Allocate an AVStereo3D structure and set its fields to default values.
252 * The resulting struct can be freed using av_freep().
254 * @return An AVStereo3D filled with default values or NULL on failure.
256 AVStereo3D
*av_stereo3d_alloc_size(size_t *size
);
259 * Allocate a complete AVFrameSideData and add it to the frame.
261 * @param frame The frame which side data is added to.
263 * @return The AVStereo3D structure to be filled by caller.
265 AVStereo3D
*av_stereo3d_create_side_data(AVFrame
*frame
);
268 * Provide a human-readable name of a given stereo3d type.
270 * @param type The input stereo3d type value.
272 * @return The name of the stereo3d value, or "unknown".
274 const char *av_stereo3d_type_name(unsigned int type
);
277 * Get the AVStereo3DType form a human-readable name.
279 * @param name The input string.
281 * @return The AVStereo3DType value, or -1 if not found.
283 int av_stereo3d_from_name(const char *name
);
286 * Provide a human-readable name of a given stereo3d view.
288 * @param type The input stereo3d view value.
290 * @return The name of the stereo3d view value, or "unknown".
292 const char *av_stereo3d_view_name(unsigned int view
);
295 * Get the AVStereo3DView form a human-readable name.
297 * @param name The input string.
299 * @return The AVStereo3DView value, or -1 if not found.
301 int av_stereo3d_view_from_name(const char *name
);
304 * Provide a human-readable name of a given stereo3d primary eye.
306 * @param type The input stereo3d primary eye value.
308 * @return The name of the stereo3d primary eye value, or "unknown".
310 const char *av_stereo3d_primary_eye_name(unsigned int eye
);
313 * Get the AVStereo3DPrimaryEye form a human-readable name.
315 * @param name The input string.
317 * @return The AVStereo3DPrimaryEye value, or -1 if not found.
319 int av_stereo3d_primary_eye_from_name(const char *name
);
325 #endif /* AVUTIL_STEREO3D_H */