Re: [FFmpeg-devel] [PATCH v2 1/3] avfilter: add v360 filter

2019-08-21 Thread Paul B Mahol
On Tue, Aug 20, 2019 at 7:04 PM James Almer  wrote:

> On 8/20/2019 5:29 AM, Paul B Mahol wrote:
> > On Mon, Aug 19, 2019 at 11:31 PM James Almer  wrote:
> >
> >> On 8/13/2019 10:14 PM, Eugene Lyapustin wrote:
> >>> Signed-off-by: Eugene Lyapustin 
> >>> ---
> >>>  doc/filters.texi |  137 +++
> >>>  libavfilter/Makefile |1 +
> >>>  libavfilter/allfilters.c |1 +
> >>>  libavfilter/vf_v360.c| 1847 ++
> >>>  4 files changed, 1986 insertions(+)
> >>>  create mode 100644 libavfilter/vf_v360.c
> >>>
> >>> diff --git a/doc/filters.texi b/doc/filters.texi
> >>
> >> Shouldn't this make use of the AVSphericalMapping frame side data if
> >> available?
> >>
> >
> > It is extremely limited API.
>
> It can surely be extended if required.
>

Yes, it is required first.


>
> > And due lavfi limitations it can only clear current side data and set
> new one.
>
> Isn't that enough? This filter converts from one projection to another.
> Replacing the side data after said conversion to reflect the changes
> would be the expected behavior.
>

Yes. But no guessing of input format is currently possible IMHO.


>
> >
> >
> >> ___
> >> ffmpeg-devel mailing list
> >> ffmpeg-devel@ffmpeg.org
> >> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >>
> >> To unsubscribe, visit link above, or email
> >> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> >
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v2 1/3] avfilter: add v360 filter

2019-08-20 Thread James Almer
On 8/20/2019 5:29 AM, Paul B Mahol wrote:
> On Mon, Aug 19, 2019 at 11:31 PM James Almer  wrote:
> 
>> On 8/13/2019 10:14 PM, Eugene Lyapustin wrote:
>>> Signed-off-by: Eugene Lyapustin 
>>> ---
>>>  doc/filters.texi |  137 +++
>>>  libavfilter/Makefile |1 +
>>>  libavfilter/allfilters.c |1 +
>>>  libavfilter/vf_v360.c| 1847 ++
>>>  4 files changed, 1986 insertions(+)
>>>  create mode 100644 libavfilter/vf_v360.c
>>>
>>> diff --git a/doc/filters.texi b/doc/filters.texi
>>
>> Shouldn't this make use of the AVSphericalMapping frame side data if
>> available?
>>
> 
> It is extremely limited API.

It can surely be extended if required.

> And due lavfi limitations it can only clear current side data and set new one.

Isn't that enough? This filter converts from one projection to another.
Replacing the side data after said conversion to reflect the changes
would be the expected behavior.

> 
> 
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> 

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v2 1/3] avfilter: add v360 filter

2019-08-20 Thread Paul B Mahol
On Mon, Aug 19, 2019 at 11:31 PM James Almer  wrote:

> On 8/13/2019 10:14 PM, Eugene Lyapustin wrote:
> > Signed-off-by: Eugene Lyapustin 
> > ---
> >  doc/filters.texi |  137 +++
> >  libavfilter/Makefile |1 +
> >  libavfilter/allfilters.c |1 +
> >  libavfilter/vf_v360.c| 1847 ++
> >  4 files changed, 1986 insertions(+)
> >  create mode 100644 libavfilter/vf_v360.c
> >
> > diff --git a/doc/filters.texi b/doc/filters.texi
>
> Shouldn't this make use of the AVSphericalMapping frame side data if
> available?
>

It is extremely limited API. And due lavfi limitations it can only clear
current side data and set new one.


> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v2 1/3] avfilter: add v360 filter

2019-08-19 Thread James Almer
On 8/13/2019 10:14 PM, Eugene Lyapustin wrote:
> Signed-off-by: Eugene Lyapustin 
> ---
>  doc/filters.texi |  137 +++
>  libavfilter/Makefile |1 +
>  libavfilter/allfilters.c |1 +
>  libavfilter/vf_v360.c| 1847 ++
>  4 files changed, 1986 insertions(+)
>  create mode 100644 libavfilter/vf_v360.c
> 
> diff --git a/doc/filters.texi b/doc/filters.texi

Shouldn't this make use of the AVSphericalMapping frame side data if
available?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v2 1/3] avfilter: add v360 filter

2019-08-19 Thread Li, Zhong
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> Of Paul B Mahol
> Sent: Wednesday, August 14, 2019 5:38 PM
> To: FFmpeg development discussions and patches
> 
> Subject: Re: [FFmpeg-devel] [PATCH v2 1/3] avfilter: add v360 filter
> 
> On Wed, Aug 14, 2019 at 9:01 AM Li, Zhong  wrote:
> 
> > > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On
> Behalf
> > > Of Eugene Lyapustin
> > > Sent: Wednesday, August 14, 2019 9:14 AM
> > > To: ffmpeg-devel@ffmpeg.org
> > > Subject: [FFmpeg-devel] [PATCH v2 1/3] avfilter: add v360 filter
> > >
> > > Signed-off-by: Eugene Lyapustin 
> > > ---
> > >  doc/filters.texi |  137 +++
> > >  libavfilter/Makefile |1 +
> > >  libavfilter/allfilters.c |1 +
> > >  libavfilter/vf_v360.c| 1847
> > > ++
> >
> > Probably you also want to update the Changelog?
> >
> 
> That is job for comitter.

Patch set merged but without changelog update. 
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v2 1/3] avfilter: add v360 filter

2019-08-14 Thread Li, Zhong
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> Of Thilo Borgmann
> Sent: Wednesday, August 14, 2019 10:06 PM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH v2 1/3] avfilter: add v360 filter
> 
> Am 14.08.19 um 15:14 schrieb Eugene:
> > On 14.08.2019 13:06, Paul B Mahol wrote:
> >
> >> On Wed, Aug 14, 2019 at 11:56 AM Thilo Borgmann
> >> 
> >> wrote:
> >>
> >>> [...]
> >>>
> >>>>>> +static int config_output(AVFilterLink *outlink) {
> >>>>>> +    AVFilterContext *ctx = outlink->src;
> >>>>>> +    AVFilterLink *inlink = ctx->inputs[0];
> >>>>>> +    V360Context *s = ctx->priv;
> >>>>>> +    const AVPixFmtDescriptor *desc =
> >>>>>> av_pix_fmt_desc_get(inlink->format);
> >>>>>> +    const int depth = desc->comp[0].depth;
> >>>>>> +    float remap_data_size = 0.f;
> >>>>>> +    int sizeof_remap;
> >>>>>> +    int err;
> >>>>>> +    int p, h, w;
> >>>>>> +    float hf, wf;
> >>>>>> +    float mirror_modifier[3];
> >>>>>> +    void (*in_transform)(const V360Context *s,
> >>>>>> + const float *vec, int width, int
> >>>>>> +height,
> >>>>>> + uint16_t us[4][4], uint16_t
> vs[4][4],
> >>>>>> +float
> >>>>>> *du, float *dv);
> >>>>>> +    void (*out_transform)(const V360Context *s,
> >>>>>> +  int i, int j, int width, int
> height,
> >>>>>> +  float *vec);
> >>>>>> +    void (*calculate_kernel)(float du, float dv, int shift,
> >>>>>> +const
> >>>>> XYRemap4
> >>>>>> *r_tmp, void *r);
> >>>>>> +    float rot_mat[3][3];
> >>>>>> +
> >>>>>> +    switch (s->interp) {
> >>>>>> +    case NEAREST:
> >>>>>> +    calculate_kernel = nearest_kernel;
> >>>>>> +    s->remap_slice = depth <= 8 ? remap1_8bit_slice :
> >>>>>> remap1_16bit_slice;
> >>>>>> +    sizeof_remap = sizeof(XYRemap1);
> >>>>>> +    break;
> >>>>>> +    case BILINEAR:
> >>>>>> +    calculate_kernel = bilinear_kernel;
> >>>>>> +    s->remap_slice = depth <= 8 ? remap2_8bit_slice :
> >>>>>> remap2_16bit_slice;
> >>>>>> +    sizeof_remap = sizeof(XYRemap2);
> >>>>>> +    break;
> >>>>>> +    case BICUBIC:
> >>>>>> +    calculate_kernel = bicubic_kernel;
> >>>>>> +    s->remap_slice = depth <= 8 ? remap4_8bit_slice :
> >>>>>> remap4_16bit_slice;
> >>>>>> +    sizeof_remap = sizeof(XYRemap4);
> >>>>>> +    break;
> >>>>>> +    case LANCZOS:
> >>>>>> +    calculate_kernel = lanczos_kernel;
> >>>>>> +    s->remap_slice = depth <= 8 ? remap4_8bit_slice :
> >>>>>> remap4_16bit_slice;
> >>>>>> +    sizeof_remap = sizeof(XYRemap4);
> >>>>>> +    break;
> >>>>>> +    }
> >>>>>> +
> >>>>>> +    switch (s->in) {
> >>>>>> +    case EQUIRECTANGULAR:
> >>>>>> +    in_transform = xyz_to_equirect;
> >>>>>> +    err = 0;
> >>>>>> +    wf = inlink->w;
> >>>>>> +    hf = inlink->h;
> >>>>>> +    break;
> >>>>>> +    case CUBEMAP_3_2:
> >>>>>> +    in_transform = xyz_to_cube3x2;
> >>>>>> +    err = prepare_cube_in(ctx);
> >>>>>> +    wf = inlink->w / 3.f * 4.f;
> >>>>>> +    hf = inlink->h;
> >>>>>> +    break;
> >>>>>> +    case CUBEMAP_6_1:
> >>>>>> +    in_transform = xyz_to_cube6x1;
> >>>>>> +    err = prepare_cube_in(ctx);
> >>>>>> +    wf = inlink->w / 3.f * 2.f;
> >>>>&

Re: [FFmpeg-devel] [PATCH v2 1/3] avfilter: add v360 filter

2019-08-14 Thread Thilo Borgmann
Am 14.08.19 um 16:09 schrieb Paul B Mahol:
> On Wed, Aug 14, 2019 at 4:06 PM Thilo Borgmann 
> wrote:
> 
>> Am 14.08.19 um 15:14 schrieb Eugene:
>>> On 14.08.2019 13:06, Paul B Mahol wrote:
>>>
 On Wed, Aug 14, 2019 at 11:56 AM Thilo Borgmann >>
 wrote:

> [...]
>
 +static int config_output(AVFilterLink *outlink)
 +{
 +AVFilterContext *ctx = outlink->src;
 +AVFilterLink *inlink = ctx->inputs[0];
 +V360Context *s = ctx->priv;
 +const AVPixFmtDescriptor *desc =
 av_pix_fmt_desc_get(inlink->format);
 +const int depth = desc->comp[0].depth;
 +float remap_data_size = 0.f;
 +int sizeof_remap;
 +int err;
 +int p, h, w;
 +float hf, wf;
 +float mirror_modifier[3];
 +void (*in_transform)(const V360Context *s,
 + const float *vec, int width, int height,
 + uint16_t us[4][4], uint16_t vs[4][4],
>> float
 *du, float *dv);
 +void (*out_transform)(const V360Context *s,
 +  int i, int j, int width, int height,
 +  float *vec);
 +void (*calculate_kernel)(float du, float dv, int shift, const
>>> XYRemap4
 *r_tmp, void *r);
 +float rot_mat[3][3];
 +
 +switch (s->interp) {
 +case NEAREST:
 +calculate_kernel = nearest_kernel;
 +s->remap_slice = depth <= 8 ? remap1_8bit_slice :
 remap1_16bit_slice;
 +sizeof_remap = sizeof(XYRemap1);
 +break;
 +case BILINEAR:
 +calculate_kernel = bilinear_kernel;
 +s->remap_slice = depth <= 8 ? remap2_8bit_slice :
 remap2_16bit_slice;
 +sizeof_remap = sizeof(XYRemap2);
 +break;
 +case BICUBIC:
 +calculate_kernel = bicubic_kernel;
 +s->remap_slice = depth <= 8 ? remap4_8bit_slice :
 remap4_16bit_slice;
 +sizeof_remap = sizeof(XYRemap4);
 +break;
 +case LANCZOS:
 +calculate_kernel = lanczos_kernel;
 +s->remap_slice = depth <= 8 ? remap4_8bit_slice :
 remap4_16bit_slice;
 +sizeof_remap = sizeof(XYRemap4);
 +break;
 +}
 +
 +switch (s->in) {
 +case EQUIRECTANGULAR:
 +in_transform = xyz_to_equirect;
 +err = 0;
 +wf = inlink->w;
 +hf = inlink->h;
 +break;
 +case CUBEMAP_3_2:
 +in_transform = xyz_to_cube3x2;
 +err = prepare_cube_in(ctx);
 +wf = inlink->w / 3.f * 4.f;
 +hf = inlink->h;
 +break;
 +case CUBEMAP_6_1:
 +in_transform = xyz_to_cube6x1;
 +err = prepare_cube_in(ctx);
 +wf = inlink->w / 3.f * 2.f;
 +hf = inlink->h * 2.f;
 +break;
 +case EQUIANGULAR:
 +in_transform = xyz_to_eac;
 +err = prepare_eac_in(ctx);
 +wf = inlink->w;
 +hf = inlink->h / 9.f * 8.f;
 +break;
 +case FLAT:
 +av_log(ctx, AV_LOG_ERROR, "Flat format is not accepted as
 input.\n");
 +return AVERROR(EINVAL);
 +}
 +
 +if (err != 0) {
 +return err;
 +}
 +
 +switch (s->out) {
 +case EQUIRECTANGULAR:
 +out_transform = equirect_to_xyz;
 +err = 0;
 +w = roundf(wf);
 +h = roundf(hf);
 +break;
 +case CUBEMAP_3_2:
 +out_transform = cube3x2_to_xyz;
 +err = prepare_cube_out(ctx);
 +w = roundf(wf / 4.f * 3.f);
 +h = roundf(hf);
 +break;
 +case CUBEMAP_6_1:
 +out_transform = cube6x1_to_xyz;
 +err = prepare_cube_out(ctx);
 +w = roundf(wf / 2.f * 3.f);
 +h = roundf(hf / 2.f);
 +break;
 +case EQUIANGULAR:
 +out_transform = eac_to_xyz;
 +err = prepare_eac_out(ctx);
 +w = roundf(wf);
 +h = roundf(hf / 8.f * 9.f);
 +break;
 +case FLAT:
 +out_transform = flat_to_xyz;
 +err = prepare_flat_out(ctx);
 +w = roundf(wf * s->flat_range[0] / s->flat_range[1] / 2.f);
 +h = roundf(hf);
 +break;
 +}
 +
 +if (err != 0) {
 +return 

Re: [FFmpeg-devel] [PATCH v2 1/3] avfilter: add v360 filter

2019-08-14 Thread Paul B Mahol
On Wed, Aug 14, 2019 at 4:06 PM Thilo Borgmann 
wrote:

> Am 14.08.19 um 15:14 schrieb Eugene:
> > On 14.08.2019 13:06, Paul B Mahol wrote:
> >
> >> On Wed, Aug 14, 2019 at 11:56 AM Thilo Borgmann  >
> >> wrote:
> >>
> >>> [...]
> >>>
> >> +static int config_output(AVFilterLink *outlink)
> >> +{
> >> +AVFilterContext *ctx = outlink->src;
> >> +AVFilterLink *inlink = ctx->inputs[0];
> >> +V360Context *s = ctx->priv;
> >> +const AVPixFmtDescriptor *desc =
> >> av_pix_fmt_desc_get(inlink->format);
> >> +const int depth = desc->comp[0].depth;
> >> +float remap_data_size = 0.f;
> >> +int sizeof_remap;
> >> +int err;
> >> +int p, h, w;
> >> +float hf, wf;
> >> +float mirror_modifier[3];
> >> +void (*in_transform)(const V360Context *s,
> >> + const float *vec, int width, int height,
> >> + uint16_t us[4][4], uint16_t vs[4][4],
> float
> >> *du, float *dv);
> >> +void (*out_transform)(const V360Context *s,
> >> +  int i, int j, int width, int height,
> >> +  float *vec);
> >> +void (*calculate_kernel)(float du, float dv, int shift, const
> > XYRemap4
> >> *r_tmp, void *r);
> >> +float rot_mat[3][3];
> >> +
> >> +switch (s->interp) {
> >> +case NEAREST:
> >> +calculate_kernel = nearest_kernel;
> >> +s->remap_slice = depth <= 8 ? remap1_8bit_slice :
> >> remap1_16bit_slice;
> >> +sizeof_remap = sizeof(XYRemap1);
> >> +break;
> >> +case BILINEAR:
> >> +calculate_kernel = bilinear_kernel;
> >> +s->remap_slice = depth <= 8 ? remap2_8bit_slice :
> >> remap2_16bit_slice;
> >> +sizeof_remap = sizeof(XYRemap2);
> >> +break;
> >> +case BICUBIC:
> >> +calculate_kernel = bicubic_kernel;
> >> +s->remap_slice = depth <= 8 ? remap4_8bit_slice :
> >> remap4_16bit_slice;
> >> +sizeof_remap = sizeof(XYRemap4);
> >> +break;
> >> +case LANCZOS:
> >> +calculate_kernel = lanczos_kernel;
> >> +s->remap_slice = depth <= 8 ? remap4_8bit_slice :
> >> remap4_16bit_slice;
> >> +sizeof_remap = sizeof(XYRemap4);
> >> +break;
> >> +}
> >> +
> >> +switch (s->in) {
> >> +case EQUIRECTANGULAR:
> >> +in_transform = xyz_to_equirect;
> >> +err = 0;
> >> +wf = inlink->w;
> >> +hf = inlink->h;
> >> +break;
> >> +case CUBEMAP_3_2:
> >> +in_transform = xyz_to_cube3x2;
> >> +err = prepare_cube_in(ctx);
> >> +wf = inlink->w / 3.f * 4.f;
> >> +hf = inlink->h;
> >> +break;
> >> +case CUBEMAP_6_1:
> >> +in_transform = xyz_to_cube6x1;
> >> +err = prepare_cube_in(ctx);
> >> +wf = inlink->w / 3.f * 2.f;
> >> +hf = inlink->h * 2.f;
> >> +break;
> >> +case EQUIANGULAR:
> >> +in_transform = xyz_to_eac;
> >> +err = prepare_eac_in(ctx);
> >> +wf = inlink->w;
> >> +hf = inlink->h / 9.f * 8.f;
> >> +break;
> >> +case FLAT:
> >> +av_log(ctx, AV_LOG_ERROR, "Flat format is not accepted as
> >> input.\n");
> >> +return AVERROR(EINVAL);
> >> +}
> >> +
> >> +if (err != 0) {
> >> +return err;
> >> +}
> >> +
> >> +switch (s->out) {
> >> +case EQUIRECTANGULAR:
> >> +out_transform = equirect_to_xyz;
> >> +err = 0;
> >> +w = roundf(wf);
> >> +h = roundf(hf);
> >> +break;
> >> +case CUBEMAP_3_2:
> >> +out_transform = cube3x2_to_xyz;
> >> +err = prepare_cube_out(ctx);
> >> +w = roundf(wf / 4.f * 3.f);
> >> +h = roundf(hf);
> >> +break;
> >> +case CUBEMAP_6_1:
> >> +out_transform = cube6x1_to_xyz;
> >> +err = prepare_cube_out(ctx);
> >> +w = roundf(wf / 2.f * 3.f);
> >> +h = roundf(hf / 2.f);
> >> +break;
> >> +case EQUIANGULAR:
> >> +out_transform = eac_to_xyz;
> >> +err = prepare_eac_out(ctx);
> >> +w = roundf(wf);
> >> +h = roundf(hf / 8.f * 9.f);
> >> +break;
> >> +case FLAT:
> >> +out_transform = flat_to_xyz;
> >> +err = prepare_flat_out(ctx);
> >> +w = roundf(wf * s->flat_range[0] / s->flat_range[1] / 2.f);
> >> +h = roundf(hf);
> >> +break;
> >> +}
> >> +
> >> +if (err != 0) {
> >> +return err;
> >> +}
> >> +
> >> +if 

Re: [FFmpeg-devel] [PATCH v2 1/3] avfilter: add v360 filter

2019-08-14 Thread Thilo Borgmann
Am 14.08.19 um 15:14 schrieb Eugene:
> On 14.08.2019 13:06, Paul B Mahol wrote:
> 
>> On Wed, Aug 14, 2019 at 11:56 AM Thilo Borgmann 
>> wrote:
>>
>>> [...]
>>>
>> +static int config_output(AVFilterLink *outlink)
>> +{
>> +    AVFilterContext *ctx = outlink->src;
>> +    AVFilterLink *inlink = ctx->inputs[0];
>> +    V360Context *s = ctx->priv;
>> +    const AVPixFmtDescriptor *desc =
>> av_pix_fmt_desc_get(inlink->format);
>> +    const int depth = desc->comp[0].depth;
>> +    float remap_data_size = 0.f;
>> +    int sizeof_remap;
>> +    int err;
>> +    int p, h, w;
>> +    float hf, wf;
>> +    float mirror_modifier[3];
>> +    void (*in_transform)(const V360Context *s,
>> + const float *vec, int width, int height,
>> + uint16_t us[4][4], uint16_t vs[4][4], float
>> *du, float *dv);
>> +    void (*out_transform)(const V360Context *s,
>> +  int i, int j, int width, int height,
>> +  float *vec);
>> +    void (*calculate_kernel)(float du, float dv, int shift, const
> XYRemap4
>> *r_tmp, void *r);
>> +    float rot_mat[3][3];
>> +
>> +    switch (s->interp) {
>> +    case NEAREST:
>> +    calculate_kernel = nearest_kernel;
>> +    s->remap_slice = depth <= 8 ? remap1_8bit_slice :
>> remap1_16bit_slice;
>> +    sizeof_remap = sizeof(XYRemap1);
>> +    break;
>> +    case BILINEAR:
>> +    calculate_kernel = bilinear_kernel;
>> +    s->remap_slice = depth <= 8 ? remap2_8bit_slice :
>> remap2_16bit_slice;
>> +    sizeof_remap = sizeof(XYRemap2);
>> +    break;
>> +    case BICUBIC:
>> +    calculate_kernel = bicubic_kernel;
>> +    s->remap_slice = depth <= 8 ? remap4_8bit_slice :
>> remap4_16bit_slice;
>> +    sizeof_remap = sizeof(XYRemap4);
>> +    break;
>> +    case LANCZOS:
>> +    calculate_kernel = lanczos_kernel;
>> +    s->remap_slice = depth <= 8 ? remap4_8bit_slice :
>> remap4_16bit_slice;
>> +    sizeof_remap = sizeof(XYRemap4);
>> +    break;
>> +    }
>> +
>> +    switch (s->in) {
>> +    case EQUIRECTANGULAR:
>> +    in_transform = xyz_to_equirect;
>> +    err = 0;
>> +    wf = inlink->w;
>> +    hf = inlink->h;
>> +    break;
>> +    case CUBEMAP_3_2:
>> +    in_transform = xyz_to_cube3x2;
>> +    err = prepare_cube_in(ctx);
>> +    wf = inlink->w / 3.f * 4.f;
>> +    hf = inlink->h;
>> +    break;
>> +    case CUBEMAP_6_1:
>> +    in_transform = xyz_to_cube6x1;
>> +    err = prepare_cube_in(ctx);
>> +    wf = inlink->w / 3.f * 2.f;
>> +    hf = inlink->h * 2.f;
>> +    break;
>> +    case EQUIANGULAR:
>> +    in_transform = xyz_to_eac;
>> +    err = prepare_eac_in(ctx);
>> +    wf = inlink->w;
>> +    hf = inlink->h / 9.f * 8.f;
>> +    break;
>> +    case FLAT:
>> +    av_log(ctx, AV_LOG_ERROR, "Flat format is not accepted as
>> input.\n");
>> +    return AVERROR(EINVAL);
>> +    }
>> +
>> +    if (err != 0) {
>> +    return err;
>> +    }
>> +
>> +    switch (s->out) {
>> +    case EQUIRECTANGULAR:
>> +    out_transform = equirect_to_xyz;
>> +    err = 0;
>> +    w = roundf(wf);
>> +    h = roundf(hf);
>> +    break;
>> +    case CUBEMAP_3_2:
>> +    out_transform = cube3x2_to_xyz;
>> +    err = prepare_cube_out(ctx);
>> +    w = roundf(wf / 4.f * 3.f);
>> +    h = roundf(hf);
>> +    break;
>> +    case CUBEMAP_6_1:
>> +    out_transform = cube6x1_to_xyz;
>> +    err = prepare_cube_out(ctx);
>> +    w = roundf(wf / 2.f * 3.f);
>> +    h = roundf(hf / 2.f);
>> +    break;
>> +    case EQUIANGULAR:
>> +    out_transform = eac_to_xyz;
>> +    err = prepare_eac_out(ctx);
>> +    w = roundf(wf);
>> +    h = roundf(hf / 8.f * 9.f);
>> +    break;
>> +    case FLAT:
>> +    out_transform = flat_to_xyz;
>> +    err = prepare_flat_out(ctx);
>> +    w = roundf(wf * s->flat_range[0] / s->flat_range[1] / 2.f);
>> +    h = roundf(hf);
>> +    break;
>> +    }
>> +
>> +    if (err != 0) {
>> +    return err;
>> +    }
>> +
>> +    if (s->width > 0 && s->height > 0) {
>> +    w = s->width;
>> +    h = s->height;
>> +    }
> If s->width/height are checked, should handle the case of no ture,
> Else w/h may be used but not initialized.
>
 Please try more hard to write english. I do not understand what is typed
 above.

Re: [FFmpeg-devel] [PATCH v2 1/3] avfilter: add v360 filter

2019-08-14 Thread Eugene

On 14.08.2019 13:06, Paul B Mahol wrote:


On Wed, Aug 14, 2019 at 11:56 AM Thilo Borgmann 
wrote:


[...]


+static int config_output(AVFilterLink *outlink)
+{
+AVFilterContext *ctx = outlink->src;
+AVFilterLink *inlink = ctx->inputs[0];
+V360Context *s = ctx->priv;
+const AVPixFmtDescriptor *desc =
av_pix_fmt_desc_get(inlink->format);
+const int depth = desc->comp[0].depth;
+float remap_data_size = 0.f;
+int sizeof_remap;
+int err;
+int p, h, w;
+float hf, wf;
+float mirror_modifier[3];
+void (*in_transform)(const V360Context *s,
+ const float *vec, int width, int height,
+ uint16_t us[4][4], uint16_t vs[4][4], float
*du, float *dv);
+void (*out_transform)(const V360Context *s,
+  int i, int j, int width, int height,
+  float *vec);
+void (*calculate_kernel)(float du, float dv, int shift, const

XYRemap4

*r_tmp, void *r);
+float rot_mat[3][3];
+
+switch (s->interp) {
+case NEAREST:
+calculate_kernel = nearest_kernel;
+s->remap_slice = depth <= 8 ? remap1_8bit_slice :
remap1_16bit_slice;
+sizeof_remap = sizeof(XYRemap1);
+break;
+case BILINEAR:
+calculate_kernel = bilinear_kernel;
+s->remap_slice = depth <= 8 ? remap2_8bit_slice :
remap2_16bit_slice;
+sizeof_remap = sizeof(XYRemap2);
+break;
+case BICUBIC:
+calculate_kernel = bicubic_kernel;
+s->remap_slice = depth <= 8 ? remap4_8bit_slice :
remap4_16bit_slice;
+sizeof_remap = sizeof(XYRemap4);
+break;
+case LANCZOS:
+calculate_kernel = lanczos_kernel;
+s->remap_slice = depth <= 8 ? remap4_8bit_slice :
remap4_16bit_slice;
+sizeof_remap = sizeof(XYRemap4);
+break;
+}
+
+switch (s->in) {
+case EQUIRECTANGULAR:
+in_transform = xyz_to_equirect;
+err = 0;
+wf = inlink->w;
+hf = inlink->h;
+break;
+case CUBEMAP_3_2:
+in_transform = xyz_to_cube3x2;
+err = prepare_cube_in(ctx);
+wf = inlink->w / 3.f * 4.f;
+hf = inlink->h;
+break;
+case CUBEMAP_6_1:
+in_transform = xyz_to_cube6x1;
+err = prepare_cube_in(ctx);
+wf = inlink->w / 3.f * 2.f;
+hf = inlink->h * 2.f;
+break;
+case EQUIANGULAR:
+in_transform = xyz_to_eac;
+err = prepare_eac_in(ctx);
+wf = inlink->w;
+hf = inlink->h / 9.f * 8.f;
+break;
+case FLAT:
+av_log(ctx, AV_LOG_ERROR, "Flat format is not accepted as
input.\n");
+return AVERROR(EINVAL);
+}
+
+if (err != 0) {
+return err;
+}
+
+switch (s->out) {
+case EQUIRECTANGULAR:
+out_transform = equirect_to_xyz;
+err = 0;
+w = roundf(wf);
+h = roundf(hf);
+break;
+case CUBEMAP_3_2:
+out_transform = cube3x2_to_xyz;
+err = prepare_cube_out(ctx);
+w = roundf(wf / 4.f * 3.f);
+h = roundf(hf);
+break;
+case CUBEMAP_6_1:
+out_transform = cube6x1_to_xyz;
+err = prepare_cube_out(ctx);
+w = roundf(wf / 2.f * 3.f);
+h = roundf(hf / 2.f);
+break;
+case EQUIANGULAR:
+out_transform = eac_to_xyz;
+err = prepare_eac_out(ctx);
+w = roundf(wf);
+h = roundf(hf / 8.f * 9.f);
+break;
+case FLAT:
+out_transform = flat_to_xyz;
+err = prepare_flat_out(ctx);
+w = roundf(wf * s->flat_range[0] / s->flat_range[1] / 2.f);
+h = roundf(hf);
+break;
+}
+
+if (err != 0) {
+return err;
+}
+
+if (s->width > 0 && s->height > 0) {
+w = s->width;
+h = s->height;
+}

If s->width/height are checked, should handle the case of no ture,
Else w/h may be used but not initialized.


Please try more hard to write english. I do not understand what is typed
above.

If w and h don't have initial values at declaration. So they might never
get set if that last if statement evaluates to false.

So he suggests to add an else case like

if (s->width > 0 && s->height > 0) {
  w = s->width;
  h = s->height;
} else {
  w = 0;
  h = 0;
}

or whatever values might make sense.


else case should have assert or return AVERROR_BUG.


This "if" branch overrides default values with user values. Default 
values are calculated just above this code based on input/output formats.

So w and h do get initialized in any case.





Thilo


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, 

Re: [FFmpeg-devel] [PATCH v2 1/3] avfilter: add v360 filter

2019-08-14 Thread Paul B Mahol
On Wed, Aug 14, 2019 at 11:56 AM Thilo Borgmann 
wrote:

> [...]
>
> >>> +static int config_output(AVFilterLink *outlink)
> >>> +{
> >>> +AVFilterContext *ctx = outlink->src;
> >>> +AVFilterLink *inlink = ctx->inputs[0];
> >>> +V360Context *s = ctx->priv;
> >>> +const AVPixFmtDescriptor *desc =
> >>> av_pix_fmt_desc_get(inlink->format);
> >>> +const int depth = desc->comp[0].depth;
> >>> +float remap_data_size = 0.f;
> >>> +int sizeof_remap;
> >>> +int err;
> >>> +int p, h, w;
> >>> +float hf, wf;
> >>> +float mirror_modifier[3];
> >>> +void (*in_transform)(const V360Context *s,
> >>> + const float *vec, int width, int height,
> >>> + uint16_t us[4][4], uint16_t vs[4][4], float
> >>> *du, float *dv);
> >>> +void (*out_transform)(const V360Context *s,
> >>> +  int i, int j, int width, int height,
> >>> +  float *vec);
> >>> +void (*calculate_kernel)(float du, float dv, int shift, const
> >> XYRemap4
> >>> *r_tmp, void *r);
> >>> +float rot_mat[3][3];
> >>> +
> >>> +switch (s->interp) {
> >>> +case NEAREST:
> >>> +calculate_kernel = nearest_kernel;
> >>> +s->remap_slice = depth <= 8 ? remap1_8bit_slice :
> >>> remap1_16bit_slice;
> >>> +sizeof_remap = sizeof(XYRemap1);
> >>> +break;
> >>> +case BILINEAR:
> >>> +calculate_kernel = bilinear_kernel;
> >>> +s->remap_slice = depth <= 8 ? remap2_8bit_slice :
> >>> remap2_16bit_slice;
> >>> +sizeof_remap = sizeof(XYRemap2);
> >>> +break;
> >>> +case BICUBIC:
> >>> +calculate_kernel = bicubic_kernel;
> >>> +s->remap_slice = depth <= 8 ? remap4_8bit_slice :
> >>> remap4_16bit_slice;
> >>> +sizeof_remap = sizeof(XYRemap4);
> >>> +break;
> >>> +case LANCZOS:
> >>> +calculate_kernel = lanczos_kernel;
> >>> +s->remap_slice = depth <= 8 ? remap4_8bit_slice :
> >>> remap4_16bit_slice;
> >>> +sizeof_remap = sizeof(XYRemap4);
> >>> +break;
> >>> +}
> >>> +
> >>> +switch (s->in) {
> >>> +case EQUIRECTANGULAR:
> >>> +in_transform = xyz_to_equirect;
> >>> +err = 0;
> >>> +wf = inlink->w;
> >>> +hf = inlink->h;
> >>> +break;
> >>> +case CUBEMAP_3_2:
> >>> +in_transform = xyz_to_cube3x2;
> >>> +err = prepare_cube_in(ctx);
> >>> +wf = inlink->w / 3.f * 4.f;
> >>> +hf = inlink->h;
> >>> +break;
> >>> +case CUBEMAP_6_1:
> >>> +in_transform = xyz_to_cube6x1;
> >>> +err = prepare_cube_in(ctx);
> >>> +wf = inlink->w / 3.f * 2.f;
> >>> +hf = inlink->h * 2.f;
> >>> +break;
> >>> +case EQUIANGULAR:
> >>> +in_transform = xyz_to_eac;
> >>> +err = prepare_eac_in(ctx);
> >>> +wf = inlink->w;
> >>> +hf = inlink->h / 9.f * 8.f;
> >>> +break;
> >>> +case FLAT:
> >>> +av_log(ctx, AV_LOG_ERROR, "Flat format is not accepted as
> >>> input.\n");
> >>> +return AVERROR(EINVAL);
> >>> +}
> >>> +
> >>> +if (err != 0) {
> >>> +return err;
> >>> +}
> >>> +
> >>> +switch (s->out) {
> >>> +case EQUIRECTANGULAR:
> >>> +out_transform = equirect_to_xyz;
> >>> +err = 0;
> >>> +w = roundf(wf);
> >>> +h = roundf(hf);
> >>> +break;
> >>> +case CUBEMAP_3_2:
> >>> +out_transform = cube3x2_to_xyz;
> >>> +err = prepare_cube_out(ctx);
> >>> +w = roundf(wf / 4.f * 3.f);
> >>> +h = roundf(hf);
> >>> +break;
> >>> +case CUBEMAP_6_1:
> >>> +out_transform = cube6x1_to_xyz;
> >>> +err = prepare_cube_out(ctx);
> >>> +w = roundf(wf / 2.f * 3.f);
> >>> +h = roundf(hf / 2.f);
> >>> +break;
> >>> +case EQUIANGULAR:
> >>> +out_transform = eac_to_xyz;
> >>> +err = prepare_eac_out(ctx);
> >>> +w = roundf(wf);
> >>> +h = roundf(hf / 8.f * 9.f);
> >>> +break;
> >>> +case FLAT:
> >>> +out_transform = flat_to_xyz;
> >>> +err = prepare_flat_out(ctx);
> >>> +w = roundf(wf * s->flat_range[0] / s->flat_range[1] / 2.f);
> >>> +h = roundf(hf);
> >>> +break;
> >>> +}
> >>> +
> >>> +if (err != 0) {
> >>> +return err;
> >>> +}
> >>> +
> >>> +if (s->width > 0 && s->height > 0) {
> >>> +w = s->width;
> >>> +h = s->height;
> >>> +}
> >>
> >> If s->width/height are checked, should handle the case of no ture,
> >> Else w/h may be used but not initialized.
> >>
> >
> > Please try more hard to write english. I do not understand what is typed
> > above.
>
> If w and h don't have initial values at declaration. So they might never
> get set if that last if statement evaluates to false.
>
> So he suggests to add an else case like
>
> if (s->width > 0 && s->height > 0) {
>  w 

Re: [FFmpeg-devel] [PATCH v2 1/3] avfilter: add v360 filter

2019-08-14 Thread Thilo Borgmann
[...]

>>> +static int config_output(AVFilterLink *outlink)
>>> +{
>>> +AVFilterContext *ctx = outlink->src;
>>> +AVFilterLink *inlink = ctx->inputs[0];
>>> +V360Context *s = ctx->priv;
>>> +const AVPixFmtDescriptor *desc =
>>> av_pix_fmt_desc_get(inlink->format);
>>> +const int depth = desc->comp[0].depth;
>>> +float remap_data_size = 0.f;
>>> +int sizeof_remap;
>>> +int err;
>>> +int p, h, w;
>>> +float hf, wf;
>>> +float mirror_modifier[3];
>>> +void (*in_transform)(const V360Context *s,
>>> + const float *vec, int width, int height,
>>> + uint16_t us[4][4], uint16_t vs[4][4], float
>>> *du, float *dv);
>>> +void (*out_transform)(const V360Context *s,
>>> +  int i, int j, int width, int height,
>>> +  float *vec);
>>> +void (*calculate_kernel)(float du, float dv, int shift, const
>> XYRemap4
>>> *r_tmp, void *r);
>>> +float rot_mat[3][3];
>>> +
>>> +switch (s->interp) {
>>> +case NEAREST:
>>> +calculate_kernel = nearest_kernel;
>>> +s->remap_slice = depth <= 8 ? remap1_8bit_slice :
>>> remap1_16bit_slice;
>>> +sizeof_remap = sizeof(XYRemap1);
>>> +break;
>>> +case BILINEAR:
>>> +calculate_kernel = bilinear_kernel;
>>> +s->remap_slice = depth <= 8 ? remap2_8bit_slice :
>>> remap2_16bit_slice;
>>> +sizeof_remap = sizeof(XYRemap2);
>>> +break;
>>> +case BICUBIC:
>>> +calculate_kernel = bicubic_kernel;
>>> +s->remap_slice = depth <= 8 ? remap4_8bit_slice :
>>> remap4_16bit_slice;
>>> +sizeof_remap = sizeof(XYRemap4);
>>> +break;
>>> +case LANCZOS:
>>> +calculate_kernel = lanczos_kernel;
>>> +s->remap_slice = depth <= 8 ? remap4_8bit_slice :
>>> remap4_16bit_slice;
>>> +sizeof_remap = sizeof(XYRemap4);
>>> +break;
>>> +}
>>> +
>>> +switch (s->in) {
>>> +case EQUIRECTANGULAR:
>>> +in_transform = xyz_to_equirect;
>>> +err = 0;
>>> +wf = inlink->w;
>>> +hf = inlink->h;
>>> +break;
>>> +case CUBEMAP_3_2:
>>> +in_transform = xyz_to_cube3x2;
>>> +err = prepare_cube_in(ctx);
>>> +wf = inlink->w / 3.f * 4.f;
>>> +hf = inlink->h;
>>> +break;
>>> +case CUBEMAP_6_1:
>>> +in_transform = xyz_to_cube6x1;
>>> +err = prepare_cube_in(ctx);
>>> +wf = inlink->w / 3.f * 2.f;
>>> +hf = inlink->h * 2.f;
>>> +break;
>>> +case EQUIANGULAR:
>>> +in_transform = xyz_to_eac;
>>> +err = prepare_eac_in(ctx);
>>> +wf = inlink->w;
>>> +hf = inlink->h / 9.f * 8.f;
>>> +break;
>>> +case FLAT:
>>> +av_log(ctx, AV_LOG_ERROR, "Flat format is not accepted as
>>> input.\n");
>>> +return AVERROR(EINVAL);
>>> +}
>>> +
>>> +if (err != 0) {
>>> +return err;
>>> +}
>>> +
>>> +switch (s->out) {
>>> +case EQUIRECTANGULAR:
>>> +out_transform = equirect_to_xyz;
>>> +err = 0;
>>> +w = roundf(wf);
>>> +h = roundf(hf);
>>> +break;
>>> +case CUBEMAP_3_2:
>>> +out_transform = cube3x2_to_xyz;
>>> +err = prepare_cube_out(ctx);
>>> +w = roundf(wf / 4.f * 3.f);
>>> +h = roundf(hf);
>>> +break;
>>> +case CUBEMAP_6_1:
>>> +out_transform = cube6x1_to_xyz;
>>> +err = prepare_cube_out(ctx);
>>> +w = roundf(wf / 2.f * 3.f);
>>> +h = roundf(hf / 2.f);
>>> +break;
>>> +case EQUIANGULAR:
>>> +out_transform = eac_to_xyz;
>>> +err = prepare_eac_out(ctx);
>>> +w = roundf(wf);
>>> +h = roundf(hf / 8.f * 9.f);
>>> +break;
>>> +case FLAT:
>>> +out_transform = flat_to_xyz;
>>> +err = prepare_flat_out(ctx);
>>> +w = roundf(wf * s->flat_range[0] / s->flat_range[1] / 2.f);
>>> +h = roundf(hf);
>>> +break;
>>> +}
>>> +
>>> +if (err != 0) {
>>> +return err;
>>> +}
>>> +
>>> +if (s->width > 0 && s->height > 0) {
>>> +w = s->width;
>>> +h = s->height;
>>> +}
>>
>> If s->width/height are checked, should handle the case of no ture,
>> Else w/h may be used but not initialized.
>>
> 
> Please try more hard to write english. I do not understand what is typed
> above.

If w and h don't have initial values at declaration. So they might never get 
set if that last if statement evaluates to false.

So he suggests to add an else case like

if (s->width > 0 && s->height > 0) {
 w = s->width;
 h = s->height;
} else {
 w = 0;
 h = 0;
}

or whatever values might make sense.

Thilo


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject 

Re: [FFmpeg-devel] [PATCH v2 1/3] avfilter: add v360 filter

2019-08-14 Thread Paul B Mahol
On Wed, Aug 14, 2019 at 9:01 AM Li, Zhong  wrote:

> > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> > Of Eugene Lyapustin
> > Sent: Wednesday, August 14, 2019 9:14 AM
> > To: ffmpeg-devel@ffmpeg.org
> > Subject: [FFmpeg-devel] [PATCH v2 1/3] avfilter: add v360 filter
> >
> > Signed-off-by: Eugene Lyapustin 
> > ---
> >  doc/filters.texi |  137 +++
> >  libavfilter/Makefile |1 +
> >  libavfilter/allfilters.c |1 +
> >  libavfilter/vf_v360.c| 1847
> > ++
>
> Probably you also want to update the Changelog?
>

That is job for comitter.


>
> >  4 files changed, 1986 insertions(+)
> >  create mode 100644 libavfilter/vf_v360.c
> >
> > diff --git a/doc/filters.texi b/doc/filters.texi
> > index e081cdc7bc..6168a3502a 100644
> > --- a/doc/filters.texi
> > +++ b/doc/filters.texi
> > @@ -17879,6 +17879,143 @@ Force a constant quantization parameter. If
> > not set, the filter will use the QP
> >  from the video stream (if available).
> >  @end table
> >
> > +@section v360
> > +
> > +Convert 360 videos between various formats.
> > +
> > +The filter accepts the following options:
> > +
> > +@table @option
> > +
> > +@item input
> > +@item output
> > +Set format of the input/output video.
> > +
> > +Available formats:
> > +
> > +@table @samp
> > +
> > +@item e
> > +Equirectangular projection.
> > +
> > +@item c3x2
> > +@item c6x1
> > +Cubemap with 3x2/6x1 layout.
> > +
> > +Format specific options:
> > +
> > +@table @option
> > +@item in_forder
> > +@item out_forder
> > +Set order of faces for the input/output cubemap. Choose one direction
> for
> > each position.
> > +
> > +Designation of directions:
> > +@table @samp
> > +@item r
> > +right
> > +@item l
> > +left
> > +@item u
> > +up
> > +@item d
> > +down
> > +@item f
> > +forward
> > +@item b
> > +back
> > +@end table
> > +
> > +Default value is @b{@samp{rludfb}}.
> > +
> > +@item in_frot
> > +@item out_frot
> > +Set rotation of faces for the input/output cubemap. Choose one angle for
> > each position.
> > +
> > +Designation of angles:
> > +@table @samp
> > +@item 0
> > +0 degrees clockwise
> > +@item 1
> > +90 degrees clockwise
> > +@item 2
> > +180 degrees clockwise
> > +@item 4
> > +270 degrees clockwise
> > +@end table
> > +
> > +Default value is @b{@samp{00}}.
> > +@end table
> > +
> > +@item eac
> > +Equi-Angular Cubemap.
> > +
> > +@item flat
> > +Regular video. @i{(output only)}
> > +
> > +Format specific options:
> > +@table @option
> > +@item h_fov
> > +@item v_fov
> > +Set horizontal/vertical field of view. Values in degrees.
> > +@end table
> > +@end table
> > +
> > +@item interp
> > +Set interpolation method.@*
> > +@i{Note: more complex interpolation methods require much more memory
> > to run.}
> > +
> > +Available methods:
> > +
> > +@table @samp
> > +@item near
> > +@item nearest
> > +Nearest neighbour.
> > +@item line
> > +@item linear
> > +Bilinear interpolation.
> > +@item cube
> > +@item cubic
> > +Bicubic interpolation.
> > +@item lanc
> > +@item lanczos
> > +Lanczos interpolation.
> > +@end table
> > +
> > +Default value is @b{@samp{line}}.
> > +
> > +@item w
> > +@item h
> > +Set the output video resolution.
> > +
> > +Default resolution depends on formats.
> > +
> > +@item yaw
> > +@item pitch
> > +@item roll
> > +Set rotation for the output video. Values in degrees.
> > +
> > +@item hflip
> > +@item vflip
> > +@item dflip
> > +Flip the output video horizontally/vertically/in-depth. Boolean values.
> > +
> > +@end table
> > +
> > +@subsection Examples
> > +
> > +@itemize
> > +@item
> > +Convert equirectangular video to cubemap with 3x2 layout using bicubic
> > interpolation:
> > +@example
> > +ffmpeg -i input.mkv -vf v360=e:c3x2:cubic output.mkv
> > +@end example
> > +@item
> > +Extract back view of Equi-Angular Cubemap:
> > +@example
> > +ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
> > +@end example
> > +@end itemize
> > +
> >  @sectio

Re: [FFmpeg-devel] [PATCH v2 1/3] avfilter: add v360 filter

2019-08-14 Thread Li, Zhong
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> Of Eugene Lyapustin
> Sent: Wednesday, August 14, 2019 9:14 AM
> To: ffmpeg-devel@ffmpeg.org
> Subject: [FFmpeg-devel] [PATCH v2 1/3] avfilter: add v360 filter
> 
> Signed-off-by: Eugene Lyapustin 
> ---
>  doc/filters.texi |  137 +++
>  libavfilter/Makefile |1 +
>  libavfilter/allfilters.c |1 +
>  libavfilter/vf_v360.c| 1847
> ++

Probably you also want to update the Changelog?

>  4 files changed, 1986 insertions(+)
>  create mode 100644 libavfilter/vf_v360.c
>
> diff --git a/doc/filters.texi b/doc/filters.texi
> index e081cdc7bc..6168a3502a 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -17879,6 +17879,143 @@ Force a constant quantization parameter. If
> not set, the filter will use the QP
>  from the video stream (if available).
>  @end table
> 
> +@section v360
> +
> +Convert 360 videos between various formats.
> +
> +The filter accepts the following options:
> +
> +@table @option
> +
> +@item input
> +@item output
> +Set format of the input/output video.
> +
> +Available formats:
> +
> +@table @samp
> +
> +@item e
> +Equirectangular projection.
> +
> +@item c3x2
> +@item c6x1
> +Cubemap with 3x2/6x1 layout.
> +
> +Format specific options:
> +
> +@table @option
> +@item in_forder
> +@item out_forder
> +Set order of faces for the input/output cubemap. Choose one direction for
> each position.
> +
> +Designation of directions:
> +@table @samp
> +@item r
> +right
> +@item l
> +left
> +@item u
> +up
> +@item d
> +down
> +@item f
> +forward
> +@item b
> +back
> +@end table
> +
> +Default value is @b{@samp{rludfb}}.
> +
> +@item in_frot
> +@item out_frot
> +Set rotation of faces for the input/output cubemap. Choose one angle for
> each position.
> +
> +Designation of angles:
> +@table @samp
> +@item 0
> +0 degrees clockwise
> +@item 1
> +90 degrees clockwise
> +@item 2
> +180 degrees clockwise
> +@item 4
> +270 degrees clockwise
> +@end table
> +
> +Default value is @b{@samp{00}}.
> +@end table
> +
> +@item eac
> +Equi-Angular Cubemap.
> +
> +@item flat
> +Regular video. @i{(output only)}
> +
> +Format specific options:
> +@table @option
> +@item h_fov
> +@item v_fov
> +Set horizontal/vertical field of view. Values in degrees.
> +@end table
> +@end table
> +
> +@item interp
> +Set interpolation method.@*
> +@i{Note: more complex interpolation methods require much more memory
> to run.}
> +
> +Available methods:
> +
> +@table @samp
> +@item near
> +@item nearest
> +Nearest neighbour.
> +@item line
> +@item linear
> +Bilinear interpolation.
> +@item cube
> +@item cubic
> +Bicubic interpolation.
> +@item lanc
> +@item lanczos
> +Lanczos interpolation.
> +@end table
> +
> +Default value is @b{@samp{line}}.
> +
> +@item w
> +@item h
> +Set the output video resolution.
> +
> +Default resolution depends on formats.
> +
> +@item yaw
> +@item pitch
> +@item roll
> +Set rotation for the output video. Values in degrees.
> +
> +@item hflip
> +@item vflip
> +@item dflip
> +Flip the output video horizontally/vertically/in-depth. Boolean values.
> +
> +@end table
> +
> +@subsection Examples
> +
> +@itemize
> +@item
> +Convert equirectangular video to cubemap with 3x2 layout using bicubic
> interpolation:
> +@example
> +ffmpeg -i input.mkv -vf v360=e:c3x2:cubic output.mkv
> +@end example
> +@item
> +Extract back view of Equi-Angular Cubemap:
> +@example
> +ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
> +@end example
> +@end itemize
> +
>  @section vaguedenoiser
> 
>  Apply a wavelet based denoiser.
> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> index efc7bbb153..345f7c95cd 100644
> --- a/libavfilter/Makefile
> +++ b/libavfilter/Makefile
> @@ -410,6 +410,7 @@ OBJS-$(CONFIG_UNSHARP_FILTER)
> += vf_unsharp.o
>  OBJS-$(CONFIG_UNSHARP_OPENCL_FILTER) +=
> vf_unsharp_opencl.o opencl.o \
> 
> opencl/unsharp.o
>  OBJS-$(CONFIG_USPP_FILTER)   += vf_uspp.o
> +OBJS-$(CONFIG_V360_FILTER)   += vf_v360.o
>  OBJS-$(CONFIG_VAGUEDENOISER_FILTER)  +=
> vf_vaguedenoiser.o
>  OBJS-$(CONFIG_VECTORSCOPE_FILTER)+= vf_vectorscope.o
>  OBJS-$(CONFIG_VFLIP_FILTER)  += vf_vflip.o
> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> index abd726d616..5799fb4b3c 100644
> --- a/libavfilter/allfilters.c
> +++ b/libavfilter/all

[FFmpeg-devel] [PATCH v2 1/3] avfilter: add v360 filter

2019-08-13 Thread Eugene Lyapustin
Signed-off-by: Eugene Lyapustin 
---
 doc/filters.texi |  137 +++
 libavfilter/Makefile |1 +
 libavfilter/allfilters.c |1 +
 libavfilter/vf_v360.c| 1847 ++
 4 files changed, 1986 insertions(+)
 create mode 100644 libavfilter/vf_v360.c

diff --git a/doc/filters.texi b/doc/filters.texi
index e081cdc7bc..6168a3502a 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -17879,6 +17879,143 @@ Force a constant quantization parameter. If not set, 
the filter will use the QP
 from the video stream (if available).
 @end table
 
+@section v360
+
+Convert 360 videos between various formats.
+
+The filter accepts the following options:
+
+@table @option
+
+@item input
+@item output
+Set format of the input/output video.
+
+Available formats:
+
+@table @samp
+
+@item e
+Equirectangular projection.
+
+@item c3x2
+@item c6x1
+Cubemap with 3x2/6x1 layout.
+
+Format specific options:
+
+@table @option
+@item in_forder
+@item out_forder
+Set order of faces for the input/output cubemap. Choose one direction for each 
position.
+
+Designation of directions:
+@table @samp
+@item r
+right
+@item l
+left
+@item u
+up
+@item d
+down
+@item f
+forward
+@item b
+back
+@end table
+
+Default value is @b{@samp{rludfb}}.
+
+@item in_frot
+@item out_frot
+Set rotation of faces for the input/output cubemap. Choose one angle for each 
position.
+
+Designation of angles:
+@table @samp
+@item 0
+0 degrees clockwise
+@item 1
+90 degrees clockwise
+@item 2
+180 degrees clockwise
+@item 4
+270 degrees clockwise
+@end table
+
+Default value is @b{@samp{00}}.
+@end table
+
+@item eac
+Equi-Angular Cubemap.
+
+@item flat
+Regular video. @i{(output only)}
+
+Format specific options:
+@table @option
+@item h_fov
+@item v_fov
+Set horizontal/vertical field of view. Values in degrees.
+@end table
+@end table
+
+@item interp
+Set interpolation method.@*
+@i{Note: more complex interpolation methods require much more memory to run.}
+
+Available methods:
+
+@table @samp
+@item near
+@item nearest
+Nearest neighbour.
+@item line
+@item linear
+Bilinear interpolation.
+@item cube
+@item cubic
+Bicubic interpolation.
+@item lanc
+@item lanczos
+Lanczos interpolation.
+@end table
+
+Default value is @b{@samp{line}}.
+
+@item w
+@item h
+Set the output video resolution.
+
+Default resolution depends on formats.
+
+@item yaw
+@item pitch
+@item roll
+Set rotation for the output video. Values in degrees.
+
+@item hflip
+@item vflip
+@item dflip
+Flip the output video horizontally/vertically/in-depth. Boolean values.
+
+@end table
+
+@subsection Examples
+
+@itemize
+@item
+Convert equirectangular video to cubemap with 3x2 layout using bicubic 
interpolation:
+@example
+ffmpeg -i input.mkv -vf v360=e:c3x2:cubic output.mkv
+@end example
+@item
+Extract back view of Equi-Angular Cubemap:
+@example
+ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
+@end example
+@end itemize
+
 @section vaguedenoiser
 
 Apply a wavelet based denoiser.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index efc7bbb153..345f7c95cd 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -410,6 +410,7 @@ OBJS-$(CONFIG_UNSHARP_FILTER)+= vf_unsharp.o
 OBJS-$(CONFIG_UNSHARP_OPENCL_FILTER) += vf_unsharp_opencl.o opencl.o \
 opencl/unsharp.o
 OBJS-$(CONFIG_USPP_FILTER)   += vf_uspp.o
+OBJS-$(CONFIG_V360_FILTER)   += vf_v360.o
 OBJS-$(CONFIG_VAGUEDENOISER_FILTER)  += vf_vaguedenoiser.o
 OBJS-$(CONFIG_VECTORSCOPE_FILTER)+= vf_vectorscope.o
 OBJS-$(CONFIG_VFLIP_FILTER)  += vf_vflip.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index abd726d616..5799fb4b3c 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -390,6 +390,7 @@ extern AVFilter ff_vf_unpremultiply;
 extern AVFilter ff_vf_unsharp;
 extern AVFilter ff_vf_unsharp_opencl;
 extern AVFilter ff_vf_uspp;
+extern AVFilter ff_vf_v360;
 extern AVFilter ff_vf_vaguedenoiser;
 extern AVFilter ff_vf_vectorscope;
 extern AVFilter ff_vf_vflip;
diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c
new file mode 100644
index 00..5c377827b0
--- /dev/null
+++ b/libavfilter/vf_v360.c
@@ -0,0 +1,1847 @@
+/*
+ * Copyright (c) 2019 Eugene Lyapustin
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License