Path: blob/master/dep/ffmpeg/include/libavcodec/tdrdi.h
5196 views
/*1* This file is part of FFmpeg.2*3* FFmpeg is free software; you can redistribute it and/or4* modify it under the terms of the GNU Lesser General Public5* License as published by the Free Software Foundation; either6* version 2.1 of the License, or (at your option) any later version.7*8* FFmpeg is distributed in the hope that it will be useful,9* but WITHOUT ANY WARRANTY; without even the implied warranty of10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU11* Lesser General Public License for more details.12*13* You should have received a copy of the GNU Lesser General Public14* License along with FFmpeg; if not, write to the Free Software15* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA16*/1718/**19* @file20* @ingroup lavu_video_3d_reference_displays_info21* Spherical video22*/2324#ifndef AVUTIL_TDRDI_H25#define AVUTIL_TDRDI_H2627#include <stddef.h>28#include <stdint.h>2930#include "libavutil/avassert.h"3132/**33* @defgroup lavu_video_3d_reference_displays_info 3D Reference Displays Information34* @ingroup lavu_video35*36* The 3D Reference Displays Information describes information about the reference display37* width(s) and reference viewing distance(s) as well as information about the corresponding38* reference stereo pair(s).39* @{40*/4142#define AV_TDRDI_MAX_NUM_REF_DISPLAY 324344/**45* This structure describes information about the reference display width(s) and reference46* viewing distance(s) as well as information about the corresponding reference stereo pair(s).47* See section G.14.3.2.3 of ITU-T H.265 for more information.48*49* @note The struct must be allocated with av_tdrdi_alloc() and50* its size is not a part of the public ABI.51*/52typedef struct AV3DReferenceDisplaysInfo {53/**54* The exponent of the maximum allowable truncation error for55* {exponent,mantissa}_ref_display_width as given by 2<sup>(-prec_ref_display_width)</sup>.56*/57uint8_t prec_ref_display_width;5859/**60* A flag to indicate the presence of reference viewing distance.61* If false, the values of prec_ref_viewing_dist, exponent_ref_viewing_distance,62* and mantissa_ref_viewing_distance are undefined.63*/64uint8_t ref_viewing_distance_flag;6566/**67* The exponent of the maximum allowable truncation error for68* {exponent,mantissa}_ref_viewing_distance as given by 2<sup>^(-prec_ref_viewing_dist)</sup>.69* The value of prec_ref_viewing_dist shall be in the range of 0 to 31, inclusive.70*/71uint8_t prec_ref_viewing_dist;7273/**74* The number of reference displays that are signalled in this struct.75* Allowed range is 1 to 32, inclusive.76*/77uint8_t num_ref_displays;7879/**80* Offset in bytes from the beginning of this structure at which the array81* of reference displays starts.82*/83size_t entries_offset;8485/**86* Size of each entry in bytes. May not match sizeof(AV3DReferenceDisplay).87*/88size_t entry_size;89} AV3DReferenceDisplaysInfo;9091/**92* Data structure for single deference display information.93* It is allocated as a part of AV3DReferenceDisplaysInfo and should be retrieved with94* av_tdrdi_get_display().95*96* sizeof(AV3DReferenceDisplay) is not a part of the ABI and new fields may be97* added to it.98*/99typedef struct AV3DReferenceDisplay {100/**101* The ViewId of the left view of a stereo pair corresponding to the n-th reference display.102*/103uint16_t left_view_id;104105/**106* The ViewId of the left view of a stereo pair corresponding to the n-th reference display.107*/108uint16_t right_view_id;109110/**111* The exponent part of the reference display width of the n-th reference display.112*/113uint8_t exponent_ref_display_width;114115/**116* The mantissa part of the reference display width of the n-th reference display.117*/118uint8_t mantissa_ref_display_width;119120/**121* The exponent part of the reference viewing distance of the n-th reference display.122*/123uint8_t exponent_ref_viewing_distance;124125/**126* The mantissa part of the reference viewing distance of the n-th reference display.127*/128uint8_t mantissa_ref_viewing_distance;129130/**131* An array of flags to indicates that the information about additional horizontal shift of132* the left and right views for the n-th reference display is present.133*/134uint8_t additional_shift_present_flag;135136/**137* The recommended additional horizontal shift for a stereo pair corresponding to the n-th138* reference baseline and the n-th reference display.139*/140int16_t num_sample_shift;141} AV3DReferenceDisplay;142143static av_always_inline AV3DReferenceDisplay*144av_tdrdi_get_display(AV3DReferenceDisplaysInfo *tdrdi, unsigned int idx)145{146av_assert0(idx < tdrdi->num_ref_displays);147return (AV3DReferenceDisplay *)((uint8_t *)tdrdi + tdrdi->entries_offset +148idx * tdrdi->entry_size);149}150151/**152* Allocate a AV3DReferenceDisplaysInfo structure and initialize its fields to default153* values.154*155* @return the newly allocated struct or NULL on failure156*/157AV3DReferenceDisplaysInfo *av_tdrdi_alloc(unsigned int nb_displays, size_t *size);158159/**160* @}161*/162163#endif /* AVUTIL_TDRDI_H */164165166