duckstation

duckstation, but archived from the revision just before upstream changed it to a proprietary software project, this version is the libre one
git clone https://git.neptards.moe/u3shit/duckstation.git
Log | Files | Refs | README | LICENSE

stereo3d.h (5224B)


      1 /*
      2  * Copyright (c) 2013 Vittorio Giovara <vittorio.giovara@gmail.com>
      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 /**
     22  * @file
     23  * @ingroup lavu_video_stereo3d
     24  * Stereoscopic video
     25  */
     26 
     27 #ifndef AVUTIL_STEREO3D_H
     28 #define AVUTIL_STEREO3D_H
     29 
     30 #include <stdint.h>
     31 
     32 #include "frame.h"
     33 
     34 /**
     35  * @defgroup lavu_video_stereo3d Stereo3D types and functions
     36  * @ingroup lavu_video
     37  *
     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.
     41  *
     42  * @{
     43  */
     44 
     45 /**
     46  * List of possible 3D Types
     47  */
     48 enum AVStereo3DType {
     49     /**
     50      * Video is not stereoscopic (and metadata has to be there).
     51      */
     52     AV_STEREO3D_2D,
     53 
     54     /**
     55      * Views are next to each other.
     56      *
     57      * @code{.unparsed}
     58      *    LLLLRRRR
     59      *    LLLLRRRR
     60      *    LLLLRRRR
     61      *    ...
     62      * @endcode
     63      */
     64     AV_STEREO3D_SIDEBYSIDE,
     65 
     66     /**
     67      * Views are on top of each other.
     68      *
     69      * @code{.unparsed}
     70      *    LLLLLLLL
     71      *    LLLLLLLL
     72      *    RRRRRRRR
     73      *    RRRRRRRR
     74      * @endcode
     75      */
     76     AV_STEREO3D_TOPBOTTOM,
     77 
     78     /**
     79      * Views are alternated temporally.
     80      *
     81      * @code{.unparsed}
     82      *     frame0   frame1   frame2   ...
     83      *    LLLLLLLL RRRRRRRR LLLLLLLL
     84      *    LLLLLLLL RRRRRRRR LLLLLLLL
     85      *    LLLLLLLL RRRRRRRR LLLLLLLL
     86      *    ...      ...      ...
     87      * @endcode
     88      */
     89     AV_STEREO3D_FRAMESEQUENCE,
     90 
     91     /**
     92      * Views are packed in a checkerboard-like structure per pixel.
     93      *
     94      * @code{.unparsed}
     95      *    LRLRLRLR
     96      *    RLRLRLRL
     97      *    LRLRLRLR
     98      *    ...
     99      * @endcode
    100      */
    101     AV_STEREO3D_CHECKERBOARD,
    102 
    103     /**
    104      * Views are next to each other, but when upscaling
    105      * apply a checkerboard pattern.
    106      *
    107      * @code{.unparsed}
    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
    112      * @endcode
    113      */
    114     AV_STEREO3D_SIDEBYSIDE_QUINCUNX,
    115 
    116     /**
    117      * Views are packed per line, as if interlaced.
    118      *
    119      * @code{.unparsed}
    120      *    LLLLLLLL
    121      *    RRRRRRRR
    122      *    LLLLLLLL
    123      *    ...
    124      * @endcode
    125      */
    126     AV_STEREO3D_LINES,
    127 
    128     /**
    129      * Views are packed per column.
    130      *
    131      * @code{.unparsed}
    132      *    LRLRLRLR
    133      *    LRLRLRLR
    134      *    LRLRLRLR
    135      *    ...
    136      * @endcode
    137      */
    138     AV_STEREO3D_COLUMNS,
    139 };
    140 
    141 /**
    142  * List of possible view types.
    143  */
    144 enum AVStereo3DView {
    145     /**
    146      * Frame contains two packed views.
    147      */
    148     AV_STEREO3D_VIEW_PACKED,
    149 
    150     /**
    151      * Frame contains only the left view.
    152      */
    153     AV_STEREO3D_VIEW_LEFT,
    154 
    155     /**
    156      * Frame contains only the right view.
    157      */
    158     AV_STEREO3D_VIEW_RIGHT,
    159 };
    160 
    161 /**
    162  * Inverted views, Right/Bottom represents the left view.
    163  */
    164 #define AV_STEREO3D_FLAG_INVERT     (1 << 0)
    165 
    166 /**
    167  * Stereo 3D type: this structure describes how two videos are packed
    168  * within a single video surface, with additional information as needed.
    169  *
    170  * @note The struct must be allocated with av_stereo3d_alloc() and
    171  *       its size is not a part of the public ABI.
    172  */
    173 typedef struct AVStereo3D {
    174     /**
    175      * How views are packed within the video.
    176      */
    177     enum AVStereo3DType type;
    178 
    179     /**
    180      * Additional information about the frame packing.
    181      */
    182     int flags;
    183 
    184     /**
    185      * Determines which views are packed.
    186      */
    187     enum AVStereo3DView view;
    188 } AVStereo3D;
    189 
    190 /**
    191  * Allocate an AVStereo3D structure and set its fields to default values.
    192  * The resulting struct can be freed using av_freep().
    193  *
    194  * @return An AVStereo3D filled with default values or NULL on failure.
    195  */
    196 AVStereo3D *av_stereo3d_alloc(void);
    197 
    198 /**
    199  * Allocate a complete AVFrameSideData and add it to the frame.
    200  *
    201  * @param frame The frame which side data is added to.
    202  *
    203  * @return The AVStereo3D structure to be filled by caller.
    204  */
    205 AVStereo3D *av_stereo3d_create_side_data(AVFrame *frame);
    206 
    207 /**
    208  * Provide a human-readable name of a given stereo3d type.
    209  *
    210  * @param type The input stereo3d type value.
    211  *
    212  * @return The name of the stereo3d value, or "unknown".
    213  */
    214 const char *av_stereo3d_type_name(unsigned int type);
    215 
    216 /**
    217  * Get the AVStereo3DType form a human-readable name.
    218  *
    219  * @param name The input string.
    220  *
    221  * @return The AVStereo3DType value, or -1 if not found.
    222  */
    223 int av_stereo3d_from_name(const char *name);
    224 
    225 /**
    226  * @}
    227  */
    228 
    229 #endif /* AVUTIL_STEREO3D_H */