diff mbox series

[FFmpeg-devel,1/5] avutil/spherical: Add more spherical types

Message ID 20240610184408.68171-2-derek.buitenhuis@gmail.com
State New
Headers show
Series Apple Spatial Metadata | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Derek Buitenhuis June 10, 2024, 6:44 p.m. UTC
These originate from the Apple Vision Pro, and are documented here:

    https://developer.apple.com/documentation/coremedia/cmprojectiontype

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
---
 libavutil/spherical.c |  3 +++
 libavutil/spherical.h | 16 ++++++++++++++++
 2 files changed, 19 insertions(+)

Comments

James Almer June 11, 2024, 6:44 p.m. UTC | #1
On 6/10/2024 3:44 PM, Derek Buitenhuis wrote:
> These originate from the Apple Vision Pro, and are documented here:
> 
>      https://developer.apple.com/documentation/coremedia/cmprojectiontype
> 
> Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
> ---
>   libavutil/spherical.c |  3 +++
>   libavutil/spherical.h | 16 ++++++++++++++++
>   2 files changed, 19 insertions(+)
> 
> diff --git a/libavutil/spherical.c b/libavutil/spherical.c
> index 800d3459a5..d78f98f945 100644
> --- a/libavutil/spherical.c
> +++ b/libavutil/spherical.c
> @@ -57,6 +57,9 @@ static const char *const spherical_projection_names[] = {
>       [AV_SPHERICAL_EQUIRECTANGULAR]      = "equirectangular",
>       [AV_SPHERICAL_CUBEMAP]              = "cubemap",
>       [AV_SPHERICAL_EQUIRECTANGULAR_TILE] = "tiled equirectangular",
> +    [AV_SPHERICAL_HALF_EQUIRECTANGULAR] = "half equirectangular",
> +    [AV_SPHERICAL_RECTANGULAR]          = "rectangular",
> +    [AV_SPHERICAL_FISHEYE]              = "fisheye",
>   };
>   
>   const char *av_spherical_projection_name(enum AVSphericalProjection projection)
> diff --git a/libavutil/spherical.h b/libavutil/spherical.h
> index 828ac836da..118fbcc3d1 100644
> --- a/libavutil/spherical.h
> +++ b/libavutil/spherical.h
> @@ -66,6 +66,22 @@ enum AVSphericalProjection {
>        * the position of the current video in a larger surface.
>        */
>       AV_SPHERICAL_EQUIRECTANGULAR_TILE,
> +
> +    /**
> +     * Video frame displays as a 180 degree equirectangular projection.
> +     */
> +    AV_SPHERICAL_HALF_EQUIRECTANGULAR,
> +
> +    /**
> +     * Video contentframe displays on a flat, rectangular 2D surface.
> +     */
> +    AV_SPHERICAL_RECTANGULAR,

This should ideally be the enum with value 0, but until next major when 
such a change can happen, it would be IMO a good idea if you set 
spherical->projection to AV_SPHERICAL_RECTANGULAR in av_spherical_alloc().

> +
> +    /**
> +     * Fisheye projection (Apple).
> +     * See: https://developer.apple.com/documentation/coremedia/cmprojectiontype/fisheye
> +     */
> +    AV_SPHERICAL_FISHEYE,
>   };
>   
>   /**
Derek Buitenhuis June 14, 2024, 1:03 p.m. UTC | #2
On 6/11/2024 7:44 PM, James Almer wrote:
> This should ideally be the enum with value 0, but until next major when 
> such a change can happen, it would be IMO a good idea if you set 
> spherical->projection to AV_SPHERICAL_RECTANGULAR in av_spherical_alloc().

I think setting it to 0 (AV_STEREO3D_2D) is correct rather than this (and is already
done), and I don't think we need to reorder.

I had discussed this with Vittorio and it was decided that it was good to disambiguate
between 2D (not stereoscopic) and coded rectangular.

- Derek
Derek Buitenhuis June 17, 2024, 1:11 p.m. UTC | #3
On 6/14/2024 2:03 PM, Derek Buitenhuis wrote:
> I think setting it to 0 (AV_STEREO3D_2D) is correct rather than this (and is already
> done), and I don't think we need to reorder.
> 
> I had discussed this with Vittorio and it was decided that it was good to disambiguate
> between 2D (not stereoscopic) and coded rectangular.

Please disregard this, my brain got two enums mixed up. You're right, and I have made
this change locally.

- Derek
diff mbox series

Patch

diff --git a/libavutil/spherical.c b/libavutil/spherical.c
index 800d3459a5..d78f98f945 100644
--- a/libavutil/spherical.c
+++ b/libavutil/spherical.c
@@ -57,6 +57,9 @@  static const char *const spherical_projection_names[] = {
     [AV_SPHERICAL_EQUIRECTANGULAR]      = "equirectangular",
     [AV_SPHERICAL_CUBEMAP]              = "cubemap",
     [AV_SPHERICAL_EQUIRECTANGULAR_TILE] = "tiled equirectangular",
+    [AV_SPHERICAL_HALF_EQUIRECTANGULAR] = "half equirectangular",
+    [AV_SPHERICAL_RECTANGULAR]          = "rectangular",
+    [AV_SPHERICAL_FISHEYE]              = "fisheye",
 };
 
 const char *av_spherical_projection_name(enum AVSphericalProjection projection)
diff --git a/libavutil/spherical.h b/libavutil/spherical.h
index 828ac836da..118fbcc3d1 100644
--- a/libavutil/spherical.h
+++ b/libavutil/spherical.h
@@ -66,6 +66,22 @@  enum AVSphericalProjection {
      * the position of the current video in a larger surface.
      */
     AV_SPHERICAL_EQUIRECTANGULAR_TILE,
+
+    /**
+     * Video frame displays as a 180 degree equirectangular projection.
+     */
+    AV_SPHERICAL_HALF_EQUIRECTANGULAR,
+
+    /**
+     * Video contentframe displays on a flat, rectangular 2D surface.
+     */
+    AV_SPHERICAL_RECTANGULAR,
+
+    /**
+     * Fisheye projection (Apple).
+     * See: https://developer.apple.com/documentation/coremedia/cmprojectiontype/fisheye
+     */
+    AV_SPHERICAL_FISHEYE,
 };
 
 /**