History

avutil/stereo3d: Fill out stereo info provided by Vision Pro files

Based on what is in the files themselves, and what the API provides to users. URLs: * https://developer.apple.com/documentation/videotoolbox/kvtcompressionpropertykey_heroeye * https://developer.apple.com/documentation/videotoolbox/kvtcompressionpropertykey_stereocamerabaseline * https://developer.apple.com/documentation/videotoolbox/kvtcompressionpropertykey_horizontaldisparityadjustment * https://developer.apple.com/documentation/coremedia/kcmformatdescriptionextension_horizontalfieldofview

Derek Buitenhuis committed 2 years ago

Commit cf2436a1 parent 57bfba34 files · +140 −1Browse files

Unified · Split

4 files
  1. doc/APIchanges +9 −0
  2. libavutil/stereo3d.c +52 −0
  3. libavutil/stereo3d.h +78 −0
  4. libavutil/version.h +1 −1
doc/APIchanges+9−0
@@ -2,6 +2,15 @@ The last version increases of all libraries were on 2024-03-07 · 1 unmodified line
2 2
3API changes, most recent first:3API changes, most recent first:
4 4
52024-06-18 - xxxxxxxxxx - lavu 59.24.100 - stereo3d.h
6 Add primary_eye, baseline, horizontal_disparity_adjustment, and
7 horizontal_field_of_view fields to AVStereo3D.
8 Add AVStereo3DPrimaryEye.
9 Add av_stereo3d_view_name.
10 Add av_stereo3d_view_from_name.
11 Add av_stereo3d_primary_eye_name.
12 Add av_stereo3d_primary_eye_from_name.
13
52024-06-18 - xxxxxxxxxx - lavu 59.23.100 - spherical.h142024-06-18 - xxxxxxxxxx - lavu 59.23.100 - spherical.h
6 Add AV_SPHERICAL_HALF_EQUIRECTANGULAR, AV_SPHERICAL_RECTILINEAR, and15 Add AV_SPHERICAL_HALF_EQUIRECTANGULAR, AV_SPHERICAL_RECTILINEAR, and
7 AV_SPHERICAL_FISHEYE values to AVSphericalProjection, and initialize16 AV_SPHERICAL_FISHEYE values to AVSphericalProjection, and initialize
libavutil/stereo3d.c+52−0
@@ -55,6 +55,18 @@ static const char * const stereo3d_type_names[] = { · 54 unmodified lines
55 [AV_STEREO3D_COLUMNS] = "interleaved columns",55 [AV_STEREO3D_COLUMNS] = "interleaved columns",
56};56};
57 57
58static const char * const stereo3d_view_names[] = {
59 [AV_STEREO3D_VIEW_PACKED] = "packed",
60 [AV_STEREO3D_VIEW_LEFT] = "left",
61 [AV_STEREO3D_VIEW_RIGHT] = "right",
62};
63
64static const char * const stereo3d_primary_eye_names[] = {
65 [AV_PRIMARY_EYE_NONE] = "none",
66 [AV_PRIMARY_EYE_LEFT] = "left",
67 [AV_PRIMARY_EYE_RIGHT] = "right",
68};
69
58const char *av_stereo3d_type_name(unsigned int type)70const char *av_stereo3d_type_name(unsigned int type)
59{71{
60 if (type >= FF_ARRAY_ELEMS(stereo3d_type_names))72 if (type >= FF_ARRAY_ELEMS(stereo3d_type_names))
@@ -74,3 +86,43 @@ int av_stereo3d_from_name(const char *name) · 13 unmodified lines
74 86
75 return -1;87 return -1;
76}88}
89
90const char *av_stereo3d_view_name(unsigned int view)
91{
92 if (view >= FF_ARRAY_ELEMS(stereo3d_view_names))
93 return "unknown";
94
95 return stereo3d_view_names[view];
96}
97
98int av_stereo3d_view_from_name(const char *name)
99{
100 int i;
101
102 for (i = 0; i < FF_ARRAY_ELEMS(stereo3d_view_names); i++) {
103 if (av_strstart(name, stereo3d_view_names[i], NULL))
104 return i;
105 }
106
107 return -1;
108}
109
110const char *av_stereo3d_primary_eye_name(unsigned int eye)
111{
112 if (eye >= FF_ARRAY_ELEMS(stereo3d_primary_eye_names))
113 return "unknown";
114
115 return stereo3d_primary_eye_names[eye];
116}
117
118int av_stereo3d_primary_eye_from_name(const char *name)
119{
120 int i;
121
122 for (i = 0; i < FF_ARRAY_ELEMS(stereo3d_primary_eye_names); i++) {
123 if (av_strstart(name, stereo3d_primary_eye_names[i], NULL))
124 return i;
125 }
126
127 return -1;
128}
libavutil/stereo3d.h+78−0
@@ -158,6 +158,26 @@ enum AVStereo3DView { · 157 unmodified lines
158 AV_STEREO3D_VIEW_RIGHT,158 AV_STEREO3D_VIEW_RIGHT,
159};159};
160 160
161/**
162 * List of possible primary eyes.
163 */
164enum AVStereo3DPrimaryEye {
165 /**
166 * Neither eye.
167 */
168 AV_PRIMARY_EYE_NONE,
169
170 /**
171 * Left eye.
172 */
173 AV_PRIMARY_EYE_LEFT,
174
175 /**
176 * Right eye
177 */
178 AV_PRIMARY_EYE_RIGHT,
179};
180
161/**181/**
162 * Inverted views, Right/Bottom represents the left view.182 * Inverted views, Right/Bottom represents the left view.
163 */183 */
@@ -185,6 +205,28 @@ typedef struct AVStereo3D { · 21 unmodified lines
185 * Determines which views are packed.205 * Determines which views are packed.
186 */206 */
187 enum AVStereo3DView view;207 enum AVStereo3DView view;
208
209 /**
210 * Which eye is the primary eye when rendering in 2D.
211 */
212 enum AVStereo3DPrimaryEye primary_eye;
213
214 /**
215 * The distance between the centres of the lenses of the camera system,
216 * in micrometers. Zero if unset.
217 */
218 uint32_t baseline;
219
220 /**
221 * Relative shift of the left and right images, which changes the zero parallax plane.
222 * Range is -1.0 to 1.0. Zero if unset.
223 */
224 AVRational horizontal_disparity_adjustment;
225
226 /**
227 * Horizontal field of view in thousanths of a degree. Zero if unset.
228 */
229 uint32_t horizontal_field_of_view;
188} AVStereo3D;230} AVStereo3D;
189 231
190/**232/**
@@ -222,6 +264,42 @@ const char *av_stereo3d_type_name(unsigned int type); · 31 unmodified lines
222 */264 */
223int av_stereo3d_from_name(const char *name);265int av_stereo3d_from_name(const char *name);
224 266
267/**
268 * Provide a human-readable name of a given stereo3d view.
269 *
270 * @param type The input stereo3d view value.
271 *
272 * @return The name of the stereo3d view value, or "unknown".
273 */
274const char *av_stereo3d_view_name(unsigned int view);
275
276/**
277 * Get the AVStereo3DView form a human-readable name.
278 *
279 * @param name The input string.
280 *
281 * @return The AVStereo3DView value, or -1 if not found.
282 */
283int av_stereo3d_view_from_name(const char *name);
284
285/**
286 * Provide a human-readable name of a given stereo3d primary eye.
287 *
288 * @param type The input stereo3d primary eye value.
289 *
290 * @return The name of the stereo3d primary eye value, or "unknown".
291 */
292const char *av_stereo3d_primary_eye_name(unsigned int eye);
293
294/**
295 * Get the AVStereo3DPrimaryEye form a human-readable name.
296 *
297 * @param name The input string.
298 *
299 * @return The AVStereo3DPrimaryEye value, or -1 if not found.
300 */
301int av_stereo3d_primary_eye_from_name(const char *name);
302
225/**303/**
226 * @}304 * @}
227 */305 */
libavutil/version.h+1−1
@@ -79,7 +79,7 @@ · 78 unmodified lines
79 */79 */
80 80
81#define LIBAVUTIL_VERSION_MAJOR 5981#define LIBAVUTIL_VERSION_MAJOR 59
82#define LIBAVUTIL_VERSION_MINOR 2382#define LIBAVUTIL_VERSION_MINOR 24
83#define LIBAVUTIL_VERSION_MICRO 10083#define LIBAVUTIL_VERSION_MICRO 100
84 84
85#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \85#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t