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
26 #ifndef AVUTIL_STEREO3D_H
27 #define AVUTIL_STEREO3D_H
34 * @addtogroup lavu_video
37 * @defgroup lavu_video_stereo3d Stereo3D types and functions
42 * @addtogroup lavu_video_stereo3d
43 * A stereoscopic video file consists in multiple views embedded in a single
44 * frame, usually describing two views of a scene. This file describes all
45 * possible codec-independent view arrangements.
49 * List of possible 3D Types
53 * Video is not stereoscopic (and metadata has to be there).
58 * Views are next to each other.
67 AV_STEREO3D_SIDEBYSIDE,
70 * Views are on top of each other.
79 AV_STEREO3D_TOPBOTTOM,
82 * Views are alternated temporally.
85 * frame0 frame1 frame2 ...
86 * LLLLLLLL RRRRRRRR LLLLLLLL
87 * LLLLLLLL RRRRRRRR LLLLLLLL
88 * LLLLLLLL RRRRRRRR LLLLLLLL
92 AV_STEREO3D_FRAMESEQUENCE,
95 * Views are packed in a checkerboard-like structure per pixel.
104 AV_STEREO3D_CHECKERBOARD,
107 * Views are next to each other, but when upscaling
108 * apply a checkerboard pattern.
111 * LLLLRRRR L L L L R R R R
112 * LLLLRRRR => L L L L R R R R
113 * LLLLRRRR L L L L R R R R
114 * LLLLRRRR L L L L R R R R
117 AV_STEREO3D_SIDEBYSIDE_QUINCUNX,
120 * Views are packed per line, as if interlaced.
132 * Views are packed per column.
145 * List of possible view types.
147 enum AVStereo3DView {
149 * Frame contains two packed views.
151 AV_STEREO3D_VIEW_PACKED,
154 * Frame contains only the left view.
156 AV_STEREO3D_VIEW_LEFT,
159 * Frame contains only the right view.
161 AV_STEREO3D_VIEW_RIGHT,
165 * Inverted views, Right/Bottom represents the left view.
167 #define AV_STEREO3D_FLAG_INVERT (1 << 0)
170 * Stereo 3D type: this structure describes how two videos are packed
171 * within a single video surface, with additional information as needed.
173 * @note The struct must be allocated with av_stereo3d_alloc() and
174 * its size is not a part of the public ABI.
176 typedef struct AVStereo3D {
178 * How views are packed within the video.
180 enum AVStereo3DType type;
183 * Additional information about the frame packing.
188 * Determines which views are packed.
190 enum AVStereo3DView view;
194 * Allocate an AVStereo3D structure and set its fields to default values.
195 * The resulting struct can be freed using av_freep().
197 * @return An AVStereo3D filled with default values or NULL on failure.
199 AVStereo3D *av_stereo3d_alloc(void);
202 * Allocate a complete AVFrameSideData and add it to the frame.
204 * @param frame The frame which side data is added to.
206 * @return The AVStereo3D structure to be filled by caller.
208 AVStereo3D *av_stereo3d_create_side_data(AVFrame *frame);
211 * Provide a human-readable name of a given stereo3d type.
213 * @param type The input stereo3d type value.
215 * @return The name of the stereo3d value, or "unknown".
217 const char *av_stereo3d_type_name(unsigned int type);
220 * Get the AVStereo3DType form a human-readable name.
222 * @param name The input string.
224 * @return The AVStereo3DType value, or -1 if not found.
226 int av_stereo3d_from_name(const char *name);
233 #endif /* AVUTIL_STEREO3D_H */