Loading...
Searching...
No Matches
stereo3d.h
Go to the documentation of this file.
/*
* Copyright (c) 2013 Vittorio Giovara <vittorio.giovara@gmail.com>
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file
* @ingroup lavu_video_stereo3d
* Stereoscopic video
*/
#ifndef AVUTIL_STEREO3D_H
#define AVUTIL_STEREO3D_H
#include <stdint.h>
#include "frame.h"
/**
* @defgroup lavu_video_stereo3d Stereo3D types and functions
* @ingroup lavu_video
*
* A stereoscopic video file consists in multiple views embedded in a single
* frame, usually describing two views of a scene. This file describes all
* possible codec-independent view arrangements.
*
* @{
*/
/**
* List of possible 3D Types
*/
enum AVStereo3DType {
/**
* Video is not stereoscopic (and metadata has to be there).
*/
AV_STEREO3D_2D,
/**
* Views are next to each other.
*
* @code{.unparsed}
* LLLLRRRR
* LLLLRRRR
* LLLLRRRR
* ...
* @endcode
*/
AV_STEREO3D_SIDEBYSIDE,
/**
* Views are on top of each other.
*
* @code{.unparsed}
* LLLLLLLL
* LLLLLLLL
* RRRRRRRR
* RRRRRRRR
* @endcode
*/
AV_STEREO3D_TOPBOTTOM,
/**
* Views are alternated temporally.
*
* @code{.unparsed}
* frame0 frame1 frame2 ...
* LLLLLLLL RRRRRRRR LLLLLLLL
* LLLLLLLL RRRRRRRR LLLLLLLL
* LLLLLLLL RRRRRRRR LLLLLLLL
* ... ... ...
* @endcode
*/
AV_STEREO3D_FRAMESEQUENCE,
/**
* Views are packed in a checkerboard-like structure per pixel.
*
* @code{.unparsed}
* LRLRLRLR
* RLRLRLRL
* LRLRLRLR
* ...
* @endcode
*/
AV_STEREO3D_CHECKERBOARD,
/**
* Views are next to each other, but when upscaling
* apply a checkerboard pattern.
*
* @code{.unparsed}
* LLLLRRRR L L L L R R R R
* LLLLRRRR => L L L L R R R R
* LLLLRRRR L L L L R R R R
* LLLLRRRR L L L L R R R R
* @endcode
*/
AV_STEREO3D_SIDEBYSIDE_QUINCUNX,
/**
* Views are packed per line, as if interlaced.
*
* @code{.unparsed}
* LLLLLLLL
* RRRRRRRR
* LLLLLLLL
* ...
* @endcode
*/
AV_STEREO3D_LINES,
/**
* Views are packed per column.
*
* @code{.unparsed}
* LRLRLRLR
* LRLRLRLR
* LRLRLRLR
* ...
* @endcode
*/
AV_STEREO3D_COLUMNS,
/**
* Video is stereoscopic but the packing is unspecified.
*/
AV_STEREO3D_UNSPEC,
};
/**
* List of possible view types.
*/
enum AVStereo3DView {
/**
* Frame contains two packed views.
*/
AV_STEREO3D_VIEW_PACKED,
/**
* Frame contains only the left view.
*/
AV_STEREO3D_VIEW_LEFT,
/**
* Frame contains only the right view.
*/
AV_STEREO3D_VIEW_RIGHT,
/**
* Content is unspecified.
*/
AV_STEREO3D_VIEW_UNSPEC,
};
/**
* List of possible primary eyes.
*/
enum AVStereo3DPrimaryEye {
/**
* Neither eye.
*/
AV_PRIMARY_EYE_NONE,
/**
* Left eye.
*/
AV_PRIMARY_EYE_LEFT,
/**
* Right eye
*/
AV_PRIMARY_EYE_RIGHT,
};
/**
* Inverted views, Right/Bottom represents the left view.
*/
#define AV_STEREO3D_FLAG_INVERT (1 << 0)
/**
* Stereo 3D type: this structure describes how two videos are packed
* within a single video surface, with additional information as needed.
*
* @note The struct must be allocated with av_stereo3d_alloc() and
* its size is not a part of the public ABI.
*/
typedef struct AVStereo3D {
/**
* How views are packed within the video.
*/
enum AVStereo3DType type;
/**
* Additional information about the frame packing.
*/
int flags;
/**
* Determines which views are packed.
*/
enum AVStereo3DView view;
/**
* Which eye is the primary eye when rendering in 2D.
*/
enum AVStereo3DPrimaryEye primary_eye;
/**
* The distance between the centres of the lenses of the camera system,
* in micrometers. Zero if unset.
*/
uint32_t baseline;
/**
* Relative shift of the left and right images, which changes the zero parallax plane.
* Range is -1.0 to 1.0. Zero if unset.
*/
AVRational horizontal_disparity_adjustment;
/**
* Horizontal field of view, in degrees. Zero if unset.
*/
AVRational horizontal_field_of_view;
} AVStereo3D;
/**
* Allocate an AVStereo3D structure and set its fields to default values.
* The resulting struct can be freed using av_freep().
*
* @return An AVStereo3D filled with default values or NULL on failure.
*/
AVStereo3D *av_stereo3d_alloc(void);
/**
* Allocate an AVStereo3D structure and set its fields to default values.
* The resulting struct can be freed using av_freep().
*
* @return An AVStereo3D filled with default values or NULL on failure.
*/
AVStereo3D *av_stereo3d_alloc_size(size_t *size);
/**
* Allocate a complete AVFrameSideData and add it to the frame.
*
* @param frame The frame which side data is added to.
*
* @return The AVStereo3D structure to be filled by caller.
*/
AVStereo3D *av_stereo3d_create_side_data(AVFrame *frame);
/**
* Provide a human-readable name of a given stereo3d type.
*
* @param type The input stereo3d type value.
*
* @return The name of the stereo3d value, or "unknown".
*/
const char *av_stereo3d_type_name(unsigned int type);
/**
* Get the AVStereo3DType form a human-readable name.
*
* @param name The input string.
*
* @return The AVStereo3DType value, or -1 if not found.
*/
int av_stereo3d_from_name(const char *name);
/**
* Provide a human-readable name of a given stereo3d view.
*
* @param type The input stereo3d view value.
*
* @return The name of the stereo3d view value, or "unknown".
*/
const char *av_stereo3d_view_name(unsigned int view);
/**
* Get the AVStereo3DView form a human-readable name.
*
* @param name The input string.
*
* @return The AVStereo3DView value, or -1 if not found.
*/
int av_stereo3d_view_from_name(const char *name);
/**
* Provide a human-readable name of a given stereo3d primary eye.
*
* @param type The input stereo3d primary eye value.
*
* @return The name of the stereo3d primary eye value, or "unknown".
*/
const char *av_stereo3d_primary_eye_name(unsigned int eye);
/**
* Get the AVStereo3DPrimaryEye form a human-readable name.
*
* @param name The input string.
*
* @return The AVStereo3DPrimaryEye value, or -1 if not found.
*/
int av_stereo3d_primary_eye_from_name(const char *name);
/**
* @}
*/
#endif /* AVUTIL_STEREO3D_H */
frame
static AVFrame * frame
Definition demux_decode.c:54
frame.h
reference-counted frame API
AVStereo3DType
AVStereo3DType
List of possible 3D Types.
Definition stereo3d.h:48
av_stereo3d_view_name
const char * av_stereo3d_view_name(unsigned int view)
Provide a human-readable name of a given stereo3d view.
av_stereo3d_alloc
AVStereo3D * av_stereo3d_alloc(void)
Allocate an AVStereo3D structure and set its fields to default values.
av_stereo3d_alloc_size
AVStereo3D * av_stereo3d_alloc_size(size_t *size)
Allocate an AVStereo3D structure and set its fields to default values.
av_stereo3d_primary_eye_from_name
int av_stereo3d_primary_eye_from_name(const char *name)
Get the AVStereo3DPrimaryEye form a human-readable name.
av_stereo3d_type_name
const char * av_stereo3d_type_name(unsigned int type)
Provide a human-readable name of a given stereo3d type.
av_stereo3d_from_name
int av_stereo3d_from_name(const char *name)
Get the AVStereo3DType form a human-readable name.
AVStereo3DPrimaryEye
AVStereo3DPrimaryEye
List of possible primary eyes.
Definition stereo3d.h:174
av_stereo3d_create_side_data
AVStereo3D * av_stereo3d_create_side_data(AVFrame *frame)
Allocate a complete AVFrameSideData and add it to the frame.
av_stereo3d_primary_eye_name
const char * av_stereo3d_primary_eye_name(unsigned int eye)
Provide a human-readable name of a given stereo3d primary eye.
AVStereo3DView
AVStereo3DView
List of possible view types.
Definition stereo3d.h:149
av_stereo3d_view_from_name
int av_stereo3d_view_from_name(const char *name)
Get the AVStereo3DView form a human-readable name.
AV_STEREO3D_COLUMNS
@ AV_STEREO3D_COLUMNS
Views are packed per column.
Definition stereo3d.h:138
AV_STEREO3D_LINES
@ AV_STEREO3D_LINES
Views are packed per line, as if interlaced.
Definition stereo3d.h:126
AV_STEREO3D_2D
@ AV_STEREO3D_2D
Video is not stereoscopic (and metadata has to be there).
Definition stereo3d.h:52
AV_STEREO3D_CHECKERBOARD
@ AV_STEREO3D_CHECKERBOARD
Views are packed in a checkerboard-like structure per pixel.
Definition stereo3d.h:101
AV_STEREO3D_TOPBOTTOM
@ AV_STEREO3D_TOPBOTTOM
Views are on top of each other.
Definition stereo3d.h:76
AV_STEREO3D_SIDEBYSIDE_QUINCUNX
@ AV_STEREO3D_SIDEBYSIDE_QUINCUNX
Views are next to each other, but when upscaling apply a checkerboard pattern.
Definition stereo3d.h:114
AV_STEREO3D_UNSPEC
@ AV_STEREO3D_UNSPEC
Video is stereoscopic but the packing is unspecified.
Definition stereo3d.h:143
AV_STEREO3D_FRAMESEQUENCE
@ AV_STEREO3D_FRAMESEQUENCE
Views are alternated temporally.
Definition stereo3d.h:89
AV_STEREO3D_SIDEBYSIDE
@ AV_STEREO3D_SIDEBYSIDE
Views are next to each other.
Definition stereo3d.h:64
AV_PRIMARY_EYE_NONE
@ AV_PRIMARY_EYE_NONE
Neither eye.
Definition stereo3d.h:178
AV_PRIMARY_EYE_LEFT
@ AV_PRIMARY_EYE_LEFT
Left eye.
Definition stereo3d.h:183
AV_PRIMARY_EYE_RIGHT
@ AV_PRIMARY_EYE_RIGHT
Right eye.
Definition stereo3d.h:188
AV_STEREO3D_VIEW_RIGHT
@ AV_STEREO3D_VIEW_RIGHT
Frame contains only the right view.
Definition stereo3d.h:163
AV_STEREO3D_VIEW_PACKED
@ AV_STEREO3D_VIEW_PACKED
Frame contains two packed views.
Definition stereo3d.h:153
AV_STEREO3D_VIEW_LEFT
@ AV_STEREO3D_VIEW_LEFT
Frame contains only the left view.
Definition stereo3d.h:158
AV_STEREO3D_VIEW_UNSPEC
@ AV_STEREO3D_VIEW_UNSPEC
Content is unspecified.
Definition stereo3d.h:168
AVFrame
This structure describes decoded (raw) audio or video data.
Definition frame.h:427
AVRational
Rational number (pair of numerator and denominator).
Definition rational.h:58
AVStereo3D
Stereo 3D type: this structure describes how two videos are packed within a single video surface,...
Definition stereo3d.h:203
AVStereo3D::type
enum AVStereo3DType type
How views are packed within the video.
Definition stereo3d.h:207
AVStereo3D::baseline
uint32_t baseline
The distance between the centres of the lenses of the camera system, in micrometers.
Definition stereo3d.h:228
AVStereo3D::horizontal_disparity_adjustment
AVRational horizontal_disparity_adjustment
Relative shift of the left and right images, which changes the zero parallax plane.
Definition stereo3d.h:234
AVStereo3D::primary_eye
enum AVStereo3DPrimaryEye primary_eye
Which eye is the primary eye when rendering in 2D.
Definition stereo3d.h:222
AVStereo3D::flags
int flags
Additional information about the frame packing.
Definition stereo3d.h:212
AVStereo3D::horizontal_field_of_view
AVRational horizontal_field_of_view
Horizontal field of view, in degrees.
Definition stereo3d.h:239
AVStereo3D::view
enum AVStereo3DView view
Determines which views are packed.
Definition stereo3d.h:217