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

Paul B Mahol onemda at gmail.com
Fri Mar 9 13:38:48 EET 2018


On 3/9/18, Hazem Ashmawy <hazem.s.ashmawy at gmail.com> wrote:
> Add filter to convert between various panorama projections. It supports
> Equirectangular and Cubemaps (3x2 and 6x1 cubemap layouts).
>
> commit a8d80408bd9d99542cc29f30d7e6b00771846029
> Author: Hazem Ashmawy <hazem.s.ashmawy at gmail.com>
> Date:   Thu Mar 8 10:09:36 2018 +0200
>
>     avfilter: add convertion to/from cubemap 6x1
>
>     Signed-off-by: Hazem Ashmawy <hazem.s.ashmawy at gmail.com>
>
> commit f9f6a6cc0ceb1a4e749041658b7a441696b82588
> Author: Paul B Mahol <onemda at gmail.com>
> Date:   Thu Dec 3 21:15:13 2015 +0100
>
>     avfilter: add panorama filter
>
>     Signed-off-by: Paul B Mahol <onemda at gmail.com>
>
> Signed-off-by: Hazem Ashmawy <hazem.s.ashmawy at gmail.com>
> ---
>  libavfilter/Makefile      |   1 +
>  libavfilter/allfilters.c  |   1 +
>  libavfilter/vf_panorama.c | 553
> ++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 555 insertions(+)
>  create mode 100644 libavfilter/vf_panorama.c
>

Here is partial change for converting 3x2 cubemap as given by latest
youtube videos to
equirectangular projection:

| diff --git a/libavfilter/vf_panorama.c b/libavfilter/vf_panorama.c
| index 7d9de5b62c..4d43fc0dd5 100644
| --- a/libavfilter/vf_panorama.c
| +++ b/libavfilter/vf_panorama.c
| @@ -394,9 +394,9 @@ static int config_output(AVFilterLink *outlink)
|
|                      phi_threshold = atan2(1., 1. / cos(theta_norm));
|                      if (phi > phi_threshold) {
| -                        face = DOWN;
| -                    } else if (phi < -phi_threshold) {
|                          face = TOP;
| +                    } else if (phi < -phi_threshold) {
| +                        face = DOWN;
|                      } else {
|                          ;
|                      }
| @@ -411,14 +411,14 @@ static int config_output(AVFilterLink *outlink)
|                      case RIGHT:
|                          locate(z, y, x, M_PI_2, rw, rh, &ox, &oy);
|                          break;
| -                    case TOP:
| -                        locate(y, z, x, M_PI,   rw, rh, &ox, &oy);
| +                    case DOWN:
| +                        locate(y, z, x, M_PI_2, rw, rh, &ox, &oy);
|                          break;
|                      case BACK:
| -                        locate(x, y, z,-M_PI_2, rw, rh, &ox, &oy);
| +                        locate(x, y, z, 0,      rw, rh, &ox, &oy);
|                          break;
| -                    case DOWN:
| -                        locate(y, x, z,-M_PI_2, rw, rh, &ox, &oy);
| +                    case TOP:
| +                        locate(y, x, z, M_PI  , rw, rh, &ox, &oy);
|                          break;
|                      }
|

Could you incorporate this?
And also update all other conversions so thay match with this one?


More information about the ffmpeg-devel mailing list