[FFmpeg-devel] avfilter: add panorama filter

Submitted by Hazem Ashmawy on March 12, 2018, 7:25 a.m.

Details

Message ID CA+h=yPtRSbei9kxxs8h5ywwf=yd0scjjJx7jSp_8RG_G2DXurw@mail.gmail.com
State New
Headers show

Commit Message

Hazem Ashmawy March 12, 2018, 7:25 a.m.
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

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

Comments

Paul B Mahol March 12, 2018, 7:59 a.m.
On 3/12/18, Hazem Ashmawy <hazem.s.ashmawy@gmail.com> wrote:
> 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

The video linked here does not have name of faces, so you can not know
what is front and what is back.

Just add support for typical cubemap layout currently used.
Hazem Ashmawy March 12, 2018, 8:27 a.m.
On 3/12/18, Paul B Mahol <onemda@gmail.com> wrote:
> On 3/12/18, Hazem Ashmawy <hazem.s.ashmawy@gmail.com> wrote:
>> 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
>
> The video linked here does not have name of faces, so you can not know
> what is front and what is back.
>
> Just add support for typical cubemap layout currently used.
You mean In the video linked?
Or the Google's specification and ignore the linked video?
Or current layout order originally used in the patch?
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
Paul B Mahol March 12, 2018, 8:42 a.m.
On 3/12/18, Hazem Ashmawy <hazem.s.ashmawy@gmail.com> wrote:
> On 3/12/18, Paul B Mahol <onemda@gmail.com> wrote:
>> On 3/12/18, Hazem Ashmawy <hazem.s.ashmawy@gmail.com> wrote:
>>> 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
>>
>> The video linked here does not have name of faces, so you can not know
>> what is front and what is back.
>>
>> Just add support for typical cubemap layout currently used.
> You mean In the video linked?
> Or the Google's specification and ignore the linked video?
> Or current layout order originally used in the patch?

Just use what currently cubemap layout is used by youtube.

Patch hide | download patch | download mbox

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;
                     }