[FFmpeg-devel] [PATCH] avfilter: add panorama filter

Hazem Ashmawy hazem.s.ashmawy at gmail.com
Mon Mar 12 09:25:00 EET 2018


So, I spend few hours trying to incorporate the partial change.

I'm not sure that the video sent by <jamrial> earlier follows the
faces order here
https://github.com/google/spatial-media/blob/master/docs/spherical-video-v2-rfc.md#semantics-3

Because when I made this change, I got a reasonable equirectangular ouput:
https://imgur.com/a/BEN00

comparing to the changes sent earlier.
https://imgur.com/a/vaIvW

diff --git a/libavfilter/vf_panorama.c b/libavfilter/vf_panorama.c
index de08ef4..5383d57 100644
--- a/libavfilter/vf_panorama.c
+++ b/libavfilter/vf_panorama.c
@@ -34,12 +34,12 @@ enum Projections {
 };

 enum Faces {
+    DOWN,
     LEFT,
+    TOP,
     FRONT,
     RIGHT,
-    TOP,
     BACK,
-    DOWN,
 };

 struct XYRemap {
@@ -403,7 +403,7 @@ static int config_output(AVFilterLink *outlink)

                     switch (face) {
                     case LEFT:
-                        locate(z, x, y, M_PI,   rw, rh, &ox, &oy);
+                        locate(z, x, y, -M_PI_2,   rw, rh, &ox, &oy);
                         break;
                     case FRONT:
                         locate(x, z, y, 0.,     rw, rh, &ox, &oy);
@@ -418,7 +418,7 @@ static int config_output(AVFilterLink *outlink)
                         locate(x, y, z,-M_PI_2, rw, rh, &ox, &oy);
                         break;
                     case DOWN:
-                        locate(y, x, z,-M_PI_2, rw, rh, &ox, &oy);
+                        locate(y, x, z, M_PI_2, rw, rh, &ox, &oy);
                         break;
                     }

What I'm saying is: when I changed face order to this (which video
sample seems to follow), I got a reasonable output.
down | left | top
front | right | back

Comparing to Google's:
right | left | top
down | front | back


More information about the ffmpeg-devel mailing list