[FFmpeg-devel] [PATCH] libavfilter/af_ambisonic.c Added File for Ambisonic Filter

Michael Niedermayer michael at niedermayer.cc
Fri Aug 18 03:02:35 EEST 2017


On Thu, Aug 17, 2017 at 02:57:05PM +0530, Sanchit Sinha wrote:
> On Thu, Aug 17, 2017 at 7:31 AM, Michael Niedermayer <michael at niedermayer.cc
> > wrote:
> 
> > On Thu, Aug 17, 2017 at 04:35:13AM +0530, Sanchit Sinha wrote:
> > > On Thu, Aug 17, 2017 at 1:32 AM, Michael Niedermayer
> > <michael at niedermayer.cc
> > > > wrote:
> > >
> > > > On Tue, Aug 15, 2017 at 11:57:18PM +0530, Sanchit Sinha wrote:
> > > > > On Tue, Aug 15, 2017 at 4:46 PM, Paul B Mahol <onemda at gmail.com>
> > wrote:
> > > > >
> > > > > > Hi,
> > > > > >
> > > > > > subject of patch file is wrong.
> > > > > >
> > > > > > Why is code for rotation so limited? One should be able to rotate
> > by
> > > > > > all 3 directions at once.
> > > > > > _______________________________________________
> > > > > > ffmpeg-devel mailing list
> > > > > > ffmpeg-devel at ffmpeg.org
> > > > > > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > [...]
> > > >
> > > > > +/*Matrix for scaling options*/
> > > > > +static const struct {
> > > > > +    float matrix[4][1];
> > > > > +} scaler_matrix[]= {
> > > > > +    [N3D]={
> > > > > +        .matrix={
> > > > > +            {1},
> > > > > +            {1},
> > > > > +            {1},
> > > > > +            {1},
> > > > > +        },
> > > > > +    },
> > > > > +    [SN3D]={
> > > > > +        .matrix={
> > > > > +            {sqrt(2*floor(sqrt(0))+1)},
> > > > > +            {sqrt(2*floor(sqrt(1))+1)},
> > > > > +            {sqrt(2*floor(sqrt(2))+1)},
> > > > > +            {sqrt(2*floor(sqrt(3))+1)},
> > > > > +        },
> > > > > +    },
> > > > > +    [FURMUL]={
> > > > > +        .matrix={
> > > > > +            {sqrt(2)},
> > > > > +            {sqrt(3)},
> > > > > +            {sqrt(3)},
> > > > > +            {sqrt(3)},
> > > > > +        },
> > > > > +    },
> > > > > +};
> > > >
> > > > fails to build:
> > > >
> > > > src/libavfilter/af_ambisonic.c:225:14: error: initializer element is
> > not
> > > > a compile-time constant
> > > >             {sqrt(2*floor(sqrt(0))+1)},
> > > >
> > > >
> > > > [...]
> > > >
> > > > --
> > > > Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC7
> > 87040B0FAB
> > > >
> > > > Elect your leaders based on what they did after the last election, not
> > > > based on what they say before an election.
> > > >
> > > >
> > > > _______________________________________________
> > > > ffmpeg-devel mailing list
> > > > ffmpeg-devel at ffmpeg.org
> > > > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > > >
> > > >
> > >
> > >
> > > --
> > > Sanchit Sinha
> > > B.Tech- CSE
> > > IIIT-Delhi
> > > Roll-2015083
> > > https://sinhaaftersanchit.com/
> >
> > >  Changelog                  |    1
> > >  libavfilter/Makefile       |    1
> > >  libavfilter/af_ambisonic.c |  733 ++++++++++++++++++++++++++++++
> > +++++++++++++++
> > >  libavfilter/allfilters.c   |    1
> > >  4 files changed, 736 insertions(+)
> > > 6b86b37d0b2ce57e59a0afe6a4e933c016e29108  0001-libavfilter-af_ambisonic.
> > c-Added-File-for-Ambisonic-.patch
> > > From 47da82bdbe31708f843052744ffc98488fa406c1 Mon Sep 17 00:00:00 2001
> > > From: Sanchit Sinha <sanchit15083 at iiitd.ac.in>
> > > Date: Thu, 17 Aug 2017 04:33:36 +0530
> > > Subject: [PATCH] libavfilter/af_ambisonic.c:Added File for Ambisonic
> > Decoding
> >
> > src/libavfilter/af_ambisonic.c:226:14: error: initializer element is not
> > a compile-time constant
> >             {sqrt(3)},
> >              ^~~~~~~
> > 1 error generated.
> >
> >
> > [...]
> >
> > --
> > Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> >
> > it is not once nor twice but times without number that the same ideas make
> > their appearance in the world. -- Aristotle
> >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel at ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> >
> 
> 
> -- 
> Sanchit Sinha
> B.Tech- CSE
> IIIT-Delhi
> Roll-2015083
> https://sinhaaftersanchit.com/

>  Changelog                  |    1 
>  libavfilter/Makefile       |    1 
>  libavfilter/af_ambisonic.c |  733 +++++++++++++++++++++++++++++++++++++++++++++
>  libavfilter/allfilters.c   |    1 
>  4 files changed, 736 insertions(+)
> bd319cd94ae9f6d4467af3ab0e584e25197c5272  0001-libavfilter-af_ambisonic.c-Added-File-for-Ambisonic-.patch
> From 9d3514cf54ac362614c89652c2939c8ea8e6653d Mon Sep 17 00:00:00 2001
> From: Sanchit Sinha <sanchit15083 at iiitd.ac.in>
> Date: Thu, 17 Aug 2017 14:47:14 +0530
> Subject: [PATCH] libavfilter/af_ambisonic.c:Added File for Ambisonic Decoding
>

this one builds correctly

a few more comments below (i didnt really review the code)


[...]
> +    {"enable_shelf","Set if shelf filtering is required",OFFSET(enable_shelf), AV_OPT_TYPE_INT, {.i64=1}, 0, 1, FLAGS},
> +    {"e_s","Set if shelf filtering is required",OFFSET(enable_shelf), AV_OPT_TYPE_INT, {.i64=1}, 0, 1, FLAGS},
> +    {"e_nf","Set if Near Field Compensation is required/Input distance",OFFSET(e_nf), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, 100.0, FLAGS},
> +    {"e_ni","Set if Near Field Compensation is required/Output distance",OFFSET(e_ni), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, 100.0, FLAGS},
> +    {"output_layout","Enter Layout of output",OFFSET(lyt), AV_OPT_TYPE_INT, {.i64=SQUARE}, MONO, DODECAHEDRON, FLAGS,"lyt"},
> +    {"o_l","Enter Layout of output",OFFSET(lyt), AV_OPT_TYPE_INT, {.i64=SQUARE}, MONO, DODECAHEDRON, FLAGS,"lyt"},
> +    {"scaling_option","Set the input format (N3D, SN3D, Furse Malham)",OFFSET(s_o), AV_OPT_TYPE_INT, {.i64=N3D}, 0, 0, FLAGS, "scl"},
> +    {"s_o","Set the input format (N3D, SN3D, Furse Malham)",OFFSET(s_o), AV_OPT_TYPE_INT, {.i64=N3D}, N3D, FURMUL, FLAGS, "scl"},
> +    {"tilt","Set angle for tilt(x-axis)",OFFSET(tilt),AV_OPT_TYPE_DOUBLE, {.dbl=0.0}, 0.0, 180.0, FLAGS},
> +    {"tumble","Set angle for tumble(y-axis)",OFFSET(tumble),AV_OPT_TYPE_DOUBLE, {.dbl=0.0}, 0.0, 180.0, FLAGS},
> +    {"yaw","Set angle for yaw(z-axis)",OFFSET(yaw),AV_OPT_TYPE_DOUBLE, {.dbl=0.0}, 0.0, 180.0, FLAGS},
> +    {"mono","Mono Speaker Layout",0, AV_OPT_TYPE_CONST, {.i64=MONO}, 0, 0, FLAGS,"lyt"},
> +    {"stereo","Stereo Speaker Layout",0, AV_OPT_TYPE_CONST, {.i64=STEREO}, 0, 0, FLAGS,"lyt"},
> +    {"triangle","Triangle Speaker Layout",0, AV_OPT_TYPE_CONST, {.i64=TRIANGLE}, 0, 0, FLAGS,"lyt"},
> +    {"quad","Square Speaker Layout",0, AV_OPT_TYPE_CONST, {.i64=SQUARE}, 0, 0, FLAGS,"lyt"},
> +    {"pentagon","Pentagonal Speaker Layout",0, AV_OPT_TYPE_CONST, {.i64=PENTAGON}, 0, 0, FLAGS,"lyt"},
> +    {"hexagon","Hexagonal Speaker Layout",0, AV_OPT_TYPE_CONST, {.i64=HEXAGON}, 0, 0, FLAGS,"lyt"},
> +    {"hepatagon","Hepatagonal Speaker Layout",0, AV_OPT_TYPE_CONST, {.i64=HEPTAGON}, 0, 0, FLAGS,"lyt"},
> +    {"octagon","Octagonal Speaker Layout",0, AV_OPT_TYPE_CONST, {.i64=OCTAGON}, 0, 0, FLAGS,"lyt"},
> +    {"octahedron","Octahedron Speaker Layout",0, AV_OPT_TYPE_CONST, {.i64=OCTAHEDRON}, 0, 0, FLAGS,"lyt"},
> +    {"cube","Cube Speaker Layout",0, AV_OPT_TYPE_CONST, {.i64=CUBE}, 0, 0, FLAGS,"lyt"},
> +    {"icosahedron","Icosahedron Speaker Layout",0, AV_OPT_TYPE_CONST, {.i64=ICOSAHEDRON}, 0, 0, FLAGS,"lyt"},
> +    {"dodecahedron","Dodecahedron Speaker Layout",0, AV_OPT_TYPE_CONST, {.i64=DODECAHEDRON}, 0, 0, FLAGS,"lyt"},
> +    {"n3d","N3D Scaling(Normalised)",0, AV_OPT_TYPE_CONST, {.i64=N3D}, 0, 0, FLAGS,"scl"},
> +    {"sn3d","SN3D Scaling(Semi-Normalised)",0, AV_OPT_TYPE_CONST, {.i64=SN3D}, 0, 0, FLAGS,"scl"},
> +    {"fm","Furse Malham Scaling",0, AV_OPT_TYPE_CONST, {.i64=FURMUL}, 0, 0, FLAGS,"scl"},

this would be a more readable with vertical alignment


[...]
> +    for(int i=0;i<s->nb_channels;i++)
> +    {
> +        input_arr[i]=(float*)in[i];
> +    }
> +
> +    //forward filter
> +    if(d1) {
> +        for(int i=0;i<s->nb_channels;i++) {

the coding style is inconsistent
also "for(int ..." is not used anywhere else, it did break compilers
in the past
there are more loops with the same issue


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20170818/0c0d441d/attachment.sig>


More information about the ffmpeg-devel mailing list