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
22
33 API changes, most recent first:
44
5+2024-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+
514 2024-06-18 - xxxxxxxxxx - lavu 59.23.100 - spherical.h
615 Add AV_SPHERICAL_HALF_EQUIRECTANGULAR, AV_SPHERICAL_RECTILINEAR, and
716 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
5555 [AV_STEREO3D_COLUMNS] = "interleaved columns",
5656 };
5757
58+static 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+
64+static 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+
5870 const char *av_stereo3d_type_name(unsigned int type)
5971 {
6072 if (type >= FF_ARRAY_ELEMS(stereo3d_type_names))
@@ -74,3 +86,43 @@ int av_stereo3d_from_name(const char *name) · 13 unmodified lines
7486
7587 return -1;
7688 }
89+
90+const 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+
98+int 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+
110+const 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+
118+int 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
158158 AV_STEREO3D_VIEW_RIGHT,
159159 };
160160
161+/**
162+ * List of possible primary eyes.
163+ */
164+enum 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+
161181 /**
162182 * Inverted views, Right/Bottom represents the left view.
163183 */
@@ -185,6 +205,28 @@ typedef struct AVStereo3D { · 21 unmodified lines
185205 * Determines which views are packed.
186206 */
187207 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;
188230 } AVStereo3D;
189231
190232 /**
@@ -222,6 +264,42 @@ const char *av_stereo3d_type_name(unsigned int type); · 31 unmodified lines
222264 */
223265 int av_stereo3d_from_name(const char *name);
224266
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+ */
274+const 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+ */
283+int 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+ */
292+const 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+ */
301+int av_stereo3d_primary_eye_from_name(const char *name);
302+
225303 /**
226304 * @}
227305 */
libavutil/version.h+1−1
@@ -79,7 +79,7 @@ · 78 unmodified lines
7979 */
8080
8181 #define LIBAVUTIL_VERSION_MAJOR 59
82−#define LIBAVUTIL_VERSION_MINOR 23
82+#define LIBAVUTIL_VERSION_MINOR 24
8383 #define LIBAVUTIL_VERSION_MICRO 100
8484
8585 #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