stereo3d.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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. #ifndef AVUTIL_STEREO3D_H
  21. #define AVUTIL_STEREO3D_H
  22. #include <stdint.h>
  23. #include "frame.h"
  24. /**
  25. * List of possible 3D Types
  26. */
  27. enum AVStereo3DType {
  28. /**
  29. * Video is not stereoscopic (and metadata has to be there).
  30. */
  31. AV_STEREO3D_2D,
  32. /**
  33. * Views are next to each other.
  34. *
  35. * LLLLRRRR
  36. * LLLLRRRR
  37. * LLLLRRRR
  38. * ...
  39. */
  40. AV_STEREO3D_SIDEBYSIDE,
  41. /**
  42. * Views are on top of each other.
  43. *
  44. * LLLLLLLL
  45. * LLLLLLLL
  46. * RRRRRRRR
  47. * RRRRRRRR
  48. */
  49. AV_STEREO3D_TOPBOTTOM,
  50. /**
  51. * Views are alternated temporally.
  52. *
  53. * frame0 frame1 frame2 ...
  54. * LLLLLLLL RRRRRRRR LLLLLLLL
  55. * LLLLLLLL RRRRRRRR LLLLLLLL
  56. * LLLLLLLL RRRRRRRR LLLLLLLL
  57. * ... ... ...
  58. */
  59. AV_STEREO3D_FRAMESEQUENCE,
  60. /**
  61. * Views are packed in a checkerboard-like structure per pixel.
  62. *
  63. * LRLRLRLR
  64. * RLRLRLRL
  65. * LRLRLRLR
  66. * ...
  67. */
  68. AV_STEREO3D_CHECKERBOARD,
  69. /**
  70. * Views are next to each other, but when upscaling
  71. * apply a checkerboard pattern.
  72. *
  73. * LLLLRRRR L L L L R R R R
  74. * LLLLRRRR => L L L L R R R R
  75. * LLLLRRRR L L L L R R R R
  76. * LLLLRRRR L L L L R R R R
  77. */
  78. AV_STEREO3D_SIDEBYSIDE_QUINCUNX,
  79. /**
  80. * Views are packed per line, as if interlaced.
  81. *
  82. * LLLLLLLL
  83. * RRRRRRRR
  84. * LLLLLLLL
  85. * ...
  86. */
  87. AV_STEREO3D_LINES,
  88. /**
  89. * Views are packed per column.
  90. *
  91. * LRLRLRLR
  92. * LRLRLRLR
  93. * LRLRLRLR
  94. * ...
  95. */
  96. AV_STEREO3D_COLUMNS,
  97. };
  98. /**
  99. * Inverted views, Right/Bottom represents the left view.
  100. */
  101. #define AV_STEREO3D_FLAG_INVERT (1 << 0)
  102. /**
  103. * Stereo 3D type: this structure describes how two videos are packed
  104. * within a single video surface, with additional information as needed.
  105. *
  106. * @note The struct must be allocated with av_stereo3d_alloc() and
  107. * its size is not a part of the public ABI.
  108. */
  109. typedef struct AVStereo3D {
  110. /**
  111. * How views are packed within the video.
  112. */
  113. enum AVStereo3DType type;
  114. /**
  115. * Additional information about the frame packing.
  116. */
  117. int flags;
  118. } AVStereo3D;
  119. /**
  120. * Allocate an AVStereo3D structure and set its fields to default values.
  121. * The resulting struct can be freed using av_freep().
  122. *
  123. * @return An AVStereo3D filled with default values or NULL on failure.
  124. */
  125. AVStereo3D *av_stereo3d_alloc(void);
  126. /**
  127. * Allocate a complete AVFrameSideData and add it to the frame.
  128. *
  129. * @param frame The frame which side data is added to.
  130. *
  131. * @return The AVStereo3D structure to be filled by caller.
  132. */
  133. AVStereo3D *av_stereo3d_create_side_data(AVFrame *frame);
  134. #endif /* AVUTIL_STEREO3D_H */