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

2017-08-19 Thread Sanchit Sinha
On Fri, Aug 18, 2017 at 2:57 PM, Mailtrack Reminder <remind...@mailtrack.io>
wrote:

> ⚠️ Your email to ffmpeg-devel@ffmpeg.org has not been opened yet. Be
> reminded in 24H
> <https://mailtrack.io/reauth?url=https%3A%2F%2Fmailtrack.io%2Freminder%2Fschedule%3Fid%3De39725b884cf2b0ba3c4c2b7098ac344d73c1937%26delay%3D1_DAY_hint=sanchit15083%40iiitd.ac.in>
>  or 48H
> <https://mailtrack.io/reauth?url=https%3A%2F%2Fmailtrack.io%2Freminder%2Fschedule%3Fid%3De39725b884cf2b0ba3c4c2b7098ac344d73c1937%26delay%3D2_DAYS_hint=sanchit15083%40iiitd.ac.in>
>  (disable
> <https://mailtrack.io/reauth?url=https%3A%2F%2Fmailtrack.io%2Freminder%2Fdisable%3Fid%3De39725b884cf2b0ba3c4c2b7098ac344d73c1937_hint=sanchit15083%40iiitd.ac.in>)
>
>



-- 
Sanchit Sinha
B.Tech- CSE
IIIT-Delhi
Roll-2015083
https://sinhaaftersanchit.com/
From 93d709a6c04af3749cd12ed98791bceb05f3f626 Mon Sep 17 00:00:00 2001
From: Sanchit Sinha <sanchit15...@iiitd.ac.in>
Date: Sun, 20 Aug 2017 03:02:00 +0530
Subject: [PATCH] libavfilter/af_ambisonic.c:Added File for Ambisonic Decoding

Signed-off-by: Sanchit Sinha <sanchit15...@iiitd.ac.in>
---
 Changelog  |   1 +
 libavfilter/Makefile   |   1 +
 libavfilter/af_ambisonic.c | 736 +
 libavfilter/allfilters.c   |   1 +
 4 files changed, 739 insertions(+)
 create mode 100644 libavfilter/af_ambisonic.c

diff --git a/Changelog b/Changelog
index 7a6987a..f4fb9df 100644
--- a/Changelog
+++ b/Changelog
@@ -33,6 +33,7 @@ version :
 - tlut2 video filter
 - floodfill video filter
 - pseudocolor video filter
+- Ambisonic Decoder
 
 version 3.3:
 - CrystalHD decoder moved to new decode API
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 1d92dc1..32bf378 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -45,6 +45,7 @@ OBJS-$(CONFIG_AINTERLEAVE_FILTER)+= f_interleave.o
 OBJS-$(CONFIG_ALIMITER_FILTER)   += af_alimiter.o
 OBJS-$(CONFIG_ALLPASS_FILTER)+= af_biquads.o
 OBJS-$(CONFIG_ALOOP_FILTER)  += f_loop.o
+OBJS-$(CONFIG_AMBISONIC_FILTER)  += af_ambisonic.o
 OBJS-$(CONFIG_AMERGE_FILTER) += af_amerge.o
 OBJS-$(CONFIG_AMETADATA_FILTER)  += f_metadata.o
 OBJS-$(CONFIG_AMIX_FILTER)   += af_amix.o
diff --git a/libavfilter/af_ambisonic.c b/libavfilter/af_ambisonic.c
new file mode 100644
index 000..d18e7e2
--- /dev/null
+++ b/libavfilter/af_ambisonic.c
@@ -0,0 +1,736 @@
+/*
+ * Copyright (c) 2017 Sanchit Sinha
+ * 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 along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/avstring.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/opt.h"
+#include "libavutil/avassert.h"
+#include "audio.h"
+#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include 
+#include 
+#define SQRT_3 1.732051
+
+enum FilterType {
+shelf,
+nearfield
+};
+
+enum InputFormat {
+  N3D,
+  SN3D   ,
+  FURMUL
+};
+
+enum Rotate {
+TILT  ,
+TUMBLE,
+YAW
+};
+
+enum Layouts {
+MONO,
+STEREO  ,
+TRIANGLE,
+SQUARE  ,
+PENTAGON,
+HEXAGON ,
+HEPTAGON,
+OCTAGON ,
+TETRAHEDRON ,
+OCTAHEDRON  ,
+CUBE,
+DODECAHEDRON,
+ICOSAHEDRON
+};
+
+typedef struct Cache {
+double i1, i2;
+double o1, o2;
+} Cache;
+
+/*Decoding matrix for 1st order files. Similar can be done for 2nd, 3rd etc*/
+static const struct {
+  int speakers;
+float matrix[22][15];
+} ambisonic_matrix[]= {
+[MONO]={
+  .speakers=1,
+.matrix={
+{0.22156, 0, 0, 0},
+},
+},
+[TRIANGLE]={
+  .speakers=3,
+.matrix={
+{0.17836, 0.32555, 0.18795, 0},
+{0.17836, 0  ,-0.37591, 0},
+{0.17836,-0.32555, 0.18795, 0},
+},
+},
+[SQUARE]={
+  .speakers=4,
+.matrix={
+{0.39388, 0.18690, 0.18690, 0},
+{0.39388,-0.18690, 0.18690, 0},
+{0.39388,-0.18690,-0.18690, 0},
+{0.39388, 0.18690,-0.18690, 0},
+},
+},
+[PENTAGON]={
+  

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

2017-08-17 Thread Sanchit Sinha
On Thu, Aug 17, 2017 at 7:31 AM, Michael Niedermayer <mich...@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
> <mich...@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 <one...@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@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@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 <sanchit15...@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@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>


-- 
Sanchit Sinha
B.Tech- CSE
IIIT-Delhi
Roll-2015083
https://sinhaaftersanchit.com/
From 9d3514cf54ac362614c89652c2939c8ea8e6653d Mon Sep 17 00:00:00 2001
From: Sanchit Sinha <sanchit15...@iiitd.ac.in>
Date: Thu, 17 Aug 2017 14:47:14 +0530
Subject: [PATCH] libavfilter/af_ambisonic.c:Added File for Ambisonic Decoding

Signed-off-by: Sanchit Sin

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

2017-08-16 Thread Sanchit Sinha
On Thu, Aug 17, 2017 at 1:32 AM, Michael Niedermayer <mich...@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 <one...@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@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: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> 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@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>


-- 
Sanchit Sinha
B.Tech- CSE
IIIT-Delhi
Roll-2015083
https://sinhaaftersanchit.com/
From 47da82bdbe31708f843052744ffc98488fa406c1 Mon Sep 17 00:00:00 2001
From: Sanchit Sinha <sanchit15...@iiitd.ac.in>
Date: Thu, 17 Aug 2017 04:33:36 +0530
Subject: [PATCH] libavfilter/af_ambisonic.c:Added File for Ambisonic Decoding

Signed-off-by: Sanchit Sinha <sanchit15...@iiitd.ac.in>
---
 Changelog  |   1 +
 libavfilter/Makefile   |   1 +
 libavfilter/af_ambisonic.c | 733 +
 libavfilter/allfilters.c   |   1 +
 4 files changed, 736 insertions(+)
 create mode 100644 libavfilter/af_ambisonic.c

diff --git a/Changelog b/Changelog
index c797d68..e09c48b 100644
--- a/Changelog
+++ b/Changelog
@@ -32,6 +32,7 @@ version :
 - unpremultiply video filter
 - tlut2 video filter
 - floodfill video filter
+- Ambisonic Decoder
 
 version 3.3:
 - CrystalHD decoder moved to new decode API
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 545b871..bf2634b 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -45,6 +45,7 @@ OBJS-$(CONFIG_AINTERLEAVE_FILTER)+= f_interleave.o
 OBJS-$(CONFIG_ALIMITER_FILTER)   += af_alimiter.o
 OBJS-$(CONFIG_ALLPASS_FILTER)+= af_biquads.o
 OBJS-$(CONFIG_ALOOP_FILTER)  += f_loop.o
+OBJS-$(CONFIG_AMBISONIC_FILTER)  += af_ambisonic.o
 OBJS-$(CONFIG_AMERGE_FILTER) += af_amerge.o
 OBJS-$(CONFIG_AMETADATA_FILTER)  += f_metadata.o
 OBJS-$(CONFIG_AMIX_FILTER)   += af_amix.o
diff --git a/libavfilter/af_ambisonic.c b/libavfilter/af_ambisonic.c
new file mode 100644
index 000..d81c382
--- /dev/null
+++ b/libavfilter/af_ambisonic.c
@@ -0,0 +1,733 @@
+/*
+ * Copyright (c) 2017 Sanchit Sinha
+ * 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 along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/avstring.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/opt.h"
+#include "libavutil

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

2017-08-15 Thread Sanchit Sinha
On Tue, Aug 15, 2017 at 4:46 PM, Paul B Mahol <one...@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@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>



-- 
Sanchit Sinha
B.Tech- CSE
IIIT-Delhi
Roll-2015083
https://sinhaaftersanchit.com/
From c802c29bd9d6b141cf0d273d480f00fef97d617f Mon Sep 17 00:00:00 2001
From: Sanchit Sinha <sanchit15...@iiitd.ac.in>
Date: Tue, 15 Aug 2017 23:55:44 +0530
Subject: [PATCH] libavfilter/af_ambisonic.c:Added File for Ambisonic Decoding

Signed-off-by: Sanchit Sinha <sanchit15...@iiitd.ac.in>
---
 Changelog  |   1 +
 libavfilter/Makefile   |   1 +
 libavfilter/af_ambisonic.c | 732 +
 libavfilter/allfilters.c   |   1 +
 4 files changed, 735 insertions(+)
 create mode 100644 libavfilter/af_ambisonic.c

diff --git a/Changelog b/Changelog
index c797d68..e09c48b 100644
--- a/Changelog
+++ b/Changelog
@@ -32,6 +32,7 @@ version :
 - unpremultiply video filter
 - tlut2 video filter
 - floodfill video filter
+- Ambisonic Decoder
 
 version 3.3:
 - CrystalHD decoder moved to new decode API
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 06b915f..c1ca5ea 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -45,6 +45,7 @@ OBJS-$(CONFIG_AINTERLEAVE_FILTER)+= f_interleave.o
 OBJS-$(CONFIG_ALIMITER_FILTER)   += af_alimiter.o
 OBJS-$(CONFIG_ALLPASS_FILTER)+= af_biquads.o
 OBJS-$(CONFIG_ALOOP_FILTER)  += f_loop.o
+OBJS-$(CONFIG_AMBISONIC_FILTER)  += af_ambisonic.o
 OBJS-$(CONFIG_AMERGE_FILTER) += af_amerge.o
 OBJS-$(CONFIG_AMETADATA_FILTER)  += f_metadata.o
 OBJS-$(CONFIG_AMIX_FILTER)   += af_amix.o
diff --git a/libavfilter/af_ambisonic.c b/libavfilter/af_ambisonic.c
new file mode 100644
index 000..3097268
--- /dev/null
+++ b/libavfilter/af_ambisonic.c
@@ -0,0 +1,732 @@
+/*
+ * Copyright (c) 2017 Sanchit Sinha
+ * 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 along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/avstring.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/opt.h"
+#include "libavutil/avassert.h"
+#include "audio.h"
+#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include 
+#include 
+
+enum FilterType {
+shelf,
+nearfield
+};
+
+enum InputFormat {
+  N3D,
+  SN3D   ,
+  FURMUL
+};
+
+enum Rotate {
+TILT  ,
+TUMBLE,
+YAW
+};
+
+enum Layouts {
+MONO,
+STEREO  ,
+TRIANGLE,
+SQUARE  ,
+PENTAGON,
+HEXAGON ,
+HEPTAGON,
+OCTAGON ,
+TETRAHEDRON ,
+OCTAHEDRON  ,
+CUBE,
+DODECAHEDRON,
+ICOSAHEDRON
+};
+
+typedef struct Cache {
+double i1, i2;
+double o1, o2;
+} Cache;
+
+/*Decoding matrix for 1st order files. Similar can be done for 2nd, 3rd etc*/
+static const struct {
+  int speakers;
+float matrix[22][15];
+} ambisonic_matrix[]= {
+[MONO]={
+  .speakers=1,
+.matrix={
+{0.22156, 0, 0, 0},
+},
+},
+[TRIANGLE]={
+  .speakers=3,
+.matrix={
+{0.17836, 0.32555, 0.18795, 0},
+{0.17836, 0  ,-0.37591, 0},
+{0.17836,-0.32555, 0.18795, 0},
+},
+},
+[SQUARE]={
+  .speakers=4,
+.matrix={
+{0.39388, 0.18690, 0.18690, 0},
+{0.39388,-0.18690, 0.18690, 0},
+{0.39388,-0.18690,-0.18690, 0},
+{0.39388, 0.18690,-0.18690, 0},
+},
+},
+[PENTAGON]={
+  .speakers=5,
+.matrix={
+{0.20195, 0  , 0.33420, 0},
+{0.11356, 0.2901 , 0.04186, 0},
+{0.19654,-0.07993,-0.34782, 0},
+{0.19654, 0.07993,-0.34782, 0},
+{0.19654,-0.2901 , 0.04186, 0},
+},
+},
+[HEXAGON]={
+  .speakers=6,
+.matrix={
+{0.26259, 0  ,  0.31326, 0},
+   

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

2017-08-14 Thread Sanchit Sinha
On Mon, Mar 20, 2017 at 2:16 PM, Carl Eugen Hoyos <ceffm...@gmail.com>
wrote:

> 2017-03-13 10:15 GMT+01:00 Sanchit Sinha <sanchit15...@iiitd.ac.in>:
> > Sir, I cannot find any tabs in the code.
>
> For the future:
> There is a script in tools/patcheck that helps you with some basic
> issues.
>
> Carl Eugen
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>



-- 
Sanchit Sinha
B.Tech- CSE
IIIT-Delhi
Roll-2015083
https://sinhaaftersanchit.com/
From f01fb13355643d331df4a6bf8ce622a2cdb8568a Mon Sep 17 00:00:00 2001
From: Sanchit Sinha <sanchit15...@iiitd.ac.in>
Date: Tue, 15 Aug 2017 01:36:23 +0530
Subject: [PATCH] PATCH1

Signed-off-by: Sanchit Sinha <sanchit15...@iiitd.ac.in>
---
 Changelog  |   1 +
 libavfilter/Makefile   |   1 +
 libavfilter/af_ambisonic.c | 732 +
 libavfilter/allfilters.c   |   1 +
 4 files changed, 735 insertions(+)
 create mode 100644 libavfilter/af_ambisonic.c

diff --git a/Changelog b/Changelog
index c797d68..e09c48b 100644
--- a/Changelog
+++ b/Changelog
@@ -32,6 +32,7 @@ version :
 - unpremultiply video filter
 - tlut2 video filter
 - floodfill video filter
+- Ambisonic Decoder
 
 version 3.3:
 - CrystalHD decoder moved to new decode API
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 06b915f..c1ca5ea 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -45,6 +45,7 @@ OBJS-$(CONFIG_AINTERLEAVE_FILTER)+= f_interleave.o
 OBJS-$(CONFIG_ALIMITER_FILTER)   += af_alimiter.o
 OBJS-$(CONFIG_ALLPASS_FILTER)+= af_biquads.o
 OBJS-$(CONFIG_ALOOP_FILTER)  += f_loop.o
+OBJS-$(CONFIG_AMBISONIC_FILTER)  += af_ambisonic.o
 OBJS-$(CONFIG_AMERGE_FILTER) += af_amerge.o
 OBJS-$(CONFIG_AMETADATA_FILTER)  += f_metadata.o
 OBJS-$(CONFIG_AMIX_FILTER)   += af_amix.o
diff --git a/libavfilter/af_ambisonic.c b/libavfilter/af_ambisonic.c
new file mode 100644
index 000..fa6782d
--- /dev/null
+++ b/libavfilter/af_ambisonic.c
@@ -0,0 +1,732 @@
+/*
+ * Copyright (c) 2017 Sanchit Sinha
+ * 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 along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/avstring.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/opt.h"
+#include "libavutil/avassert.h"
+#include "audio.h"
+#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include 
+#include 
+
+enum FilterType {
+shelf,
+nearfield
+};
+
+enum InputFormat {
+  N3D,
+  SN3D   ,
+  FURMUL
+};
+
+enum Rotate {
+TILT  ,
+TUMBLE,
+YAW
+};
+
+enum Layouts {
+MONO,
+STEREO  ,
+TRIANGLE,
+SQUARE  ,
+PENTAGON,
+HEXAGON ,
+HEPTAGON,
+OCTAGON ,
+TETRAHEDRON ,
+OCTAHEDRON  ,
+CUBE,
+DODECAHEDRON,
+ICOSAHEDRON
+};
+
+typedef struct Cache {
+double i1, i2;
+double o1, o2;
+} Cache;
+
+/*Decoding matrix for 1st order files. Similar can be done for 2nd, 3rd etc*/
+static const struct {
+  int speakers;
+float matrix[22][15];
+} ambisonic_matrix[]= {
+[MONO]={
+  .speakers=1,
+.matrix={
+{0.22156, 0, 0, 0},
+},
+},
+[TRIANGLE]={
+  .speakers=3,
+.matrix={
+{0.17836, 0.32555, 0.18795, 0},
+{0.17836, 0  ,-0.37591, 0},
+{0.17836,-0.32555, 0.18795, 0},
+},
+},
+[SQUARE]={
+  .speakers=4,
+.matrix={
+{0.39388, 0.18690, 0.18690, 0},
+{0.39388,-0.18690, 0.18690, 0},
+{0.39388,-0.18690,-0.18690, 0},
+{0.39388, 0.18690,-0.18690, 0},
+},
+},
+[PENTAGON]={
+  .speakers=5,
+.matrix={
+{0.20195, 0  , 0.33420, 0},
+{0.11356, 0.2901 , 0.04186, 0},
+{0.19654,-0.07993,-0.34782, 0},
+{0.19654, 0.07993,-0.34782, 0},
+{0.19654,-0.2901 , 0.04186, 0},
+},
+},
+[HEXAGON]={
+  .speakers=6,
+.matrix={
+

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

2017-03-18 Thread Sanchit Sinha
On Sat, Mar 18, 2017 at 1:15 PM, Rostislav Pehlivanov <atomnu...@gmail.com>
wrote:

> > static const AVOption ambisonic_options[] = {
> > {NULL}
> > };
>
> You're missing spaces on the second line here.
>
> > if ((ret = ff_add_format (, AV_SAMPLE_FMT_FLTP   )) < 0 ||
> > (ret = ff_set_common_formats (ctx, formats )) < 0 ||
> > (ret = ff_add_channel_layout ( , AV_CH_LAYOUT_4POINT0)) < 0 ||
> > (ret = ff_set_common_channel_layouts (ctx, layout   )) < 0)
> > return ret;
>
> No indentation.
>
> > AVFilter ff_af_ambisonic = {
> > .name  = "ambisonic",
> > .description= NULL_IF_CONFIG_SMALL("An ambisonic filter"),
> > .query_formats  = query_formats,
> > .priv_size= sizeof(AmbisonicContext),
> > .priv_class  = _class,
> > .inputs  = inputs,
> > .outputs= outputs,
> > };
>
> Align such that all equal signs are in the same column, look at how other
> filters do it.
>
>
>
> On 13 March 2017 at 03:12, Sanchit Sinha <sanchit15...@iiitd.ac.in> wrote:
>
> > On Mon, Mar 13, 2017 at 2:36 AM, Paul B Mahol <one...@gmail.com> wrote:
> >
> > > On 3/12/17, Sanchit Sinha <sanchit15...@iiitd.ac.in> wrote:
> > > > Any changes required in this one?
> > >
> > > Please do not top post.
> > >
> > > Expect vertical alignment, no changes are needed.
> > > ___
> > > ffmpeg-devel mailing list
> > > ffmpeg-devel@ffmpeg.org
> > > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > >
> >
> >
> >
> > --
> > Sanchit Sinha
> > B.Tech- CSE
> > IIIT-Delhi
> > Roll-2015083
> >
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> >
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>



-- 
Sanchit Sinha
B.Tech- CSE
IIIT-Delhi
Roll-2015083
From 870baf207a74d3700954ba4c07a25f85a3730989 Mon Sep 17 00:00:00 2001
From: Sanchit Sinha <sanchit15...@iiitd.ac.in>
Date: Sat, 18 Mar 2017 15:11:50 +0530
Subject: [PATCH] added: lavf/af_ambisonic.c makefile allfilters.c changelog

Signed-off-by: Sanchit Sinha <sanchit15...@iiitd.ac.in>
---
 Changelog  |   1 +
 libavfilter/Makefile   |   1 +
 libavfilter/af_ambisonic.c | 122 +
 libavfilter/allfilters.c   |   1 +
 4 files changed, 125 insertions(+)
 create mode 100644 libavfilter/af_ambisonic.c

diff --git a/Changelog b/Changelog
index 13628ca..b917ac2 100644
--- a/Changelog
+++ b/Changelog
@@ -26,6 +26,7 @@ version :
 - native Opus encoder
 - ScreenPressor decoder
 - incomplete ClearVideo decoder
+- Ambisonic Decoder
 
 version 3.2:
 - libopenmpt demuxer
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 0ba1c74..4ebbd5a 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -44,6 +44,7 @@ OBJS-$(CONFIG_AINTERLEAVE_FILTER)+= f_interleave.o
 OBJS-$(CONFIG_ALIMITER_FILTER)   += af_alimiter.o
 OBJS-$(CONFIG_ALLPASS_FILTER)+= af_biquads.o
 OBJS-$(CONFIG_ALOOP_FILTER)  += f_loop.o
+OBJS-$(CONFIG_AMBISONIC_FILTER)  += af_ambisonic.o
 OBJS-$(CONFIG_AMERGE_FILTER) += af_amerge.o
 OBJS-$(CONFIG_AMETADATA_FILTER)  += f_metadata.o
 OBJS-$(CONFIG_AMIX_FILTER)   += af_amix.o
diff --git a/libavfilter/af_ambisonic.c b/libavfilter/af_ambisonic.c
new file mode 100644
index 000..7817bdc
--- /dev/null
+++ b/libavfilter/af_ambisonic.c
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2017 Sanchit Sinha
+ * Copyright (c) 2017 Paul B Mahol
+ * 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 along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include 
+#include "libavutil/avstring.h"
+#include "libavutil/channel_layout.h"
+#include "liba

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

2017-03-13 Thread Sanchit Sinha
Sir, I cannot find any tabs in the code. Can you point out where exactly?
Thank You


On Mon, Mar 13, 2017 at 2:20 PM, Paul B Mahol <one...@gmail.com> wrote:

> On 3/13/17, Sanchit Sinha <sanchit15...@iiitd.ac.in> wrote:
> > On Mon, Mar 13, 2017 at 2:36 AM, Paul B Mahol <one...@gmail.com> wrote:
> >
> >> On 3/12/17, Sanchit Sinha <sanchit15...@iiitd.ac.in> wrote:
> >> > Any changes required in this one?
> >>
> >> Please do not top post.
> >>
> >> Expect vertical alignment, no changes are needed.
>
> When you introduced tabs? That is unacceptable.
> Please take look at other filters. Can you atleast try to mimic their
> style?
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>



-- 
Sanchit Sinha
B.Tech- CSE
IIIT-Delhi
Roll-2015083
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


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

2017-03-12 Thread Sanchit Sinha
On Mon, Mar 13, 2017 at 2:36 AM, Paul B Mahol <one...@gmail.com> wrote:

> On 3/12/17, Sanchit Sinha <sanchit15...@iiitd.ac.in> wrote:
> > Any changes required in this one?
>
> Please do not top post.
>
> Expect vertical alignment, no changes are needed.
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>



-- 
Sanchit Sinha
B.Tech- CSE
IIIT-Delhi
Roll-2015083
From dbfed83e1f6ed215025878e3e0e27b55f86bb29c Mon Sep 17 00:00:00 2001
From: Sanchit Sinha <sanchit15...@iiitd.ac.in>
Date: Mon, 13 Mar 2017 08:39:43 +0530
Subject: [PATCH] lavf/af_ambisonic.c added lavf/Makefile and allfilters.c
 updated changelog update

Signed-off-by: Sanchit Sinha <sanchit15...@iiitd.ac.in>
---
 Changelog  |   1 +
 libavfilter/Makefile   |   1 +
 libavfilter/af_ambisonic.c | 122 +
 libavfilter/allfilters.c   |   1 +
 4 files changed, 125 insertions(+)
 create mode 100644 libavfilter/af_ambisonic.c

diff --git a/Changelog b/Changelog
index 13628ca..b917ac2 100644
--- a/Changelog
+++ b/Changelog
@@ -26,6 +26,7 @@ version :
 - native Opus encoder
 - ScreenPressor decoder
 - incomplete ClearVideo decoder
+- Ambisonic Decoder
 
 version 3.2:
 - libopenmpt demuxer
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 0ba1c74..4ebbd5a 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -44,6 +44,7 @@ OBJS-$(CONFIG_AINTERLEAVE_FILTER)+= f_interleave.o
 OBJS-$(CONFIG_ALIMITER_FILTER)   += af_alimiter.o
 OBJS-$(CONFIG_ALLPASS_FILTER)+= af_biquads.o
 OBJS-$(CONFIG_ALOOP_FILTER)  += f_loop.o
+OBJS-$(CONFIG_AMBISONIC_FILTER)  += af_ambisonic.o
 OBJS-$(CONFIG_AMERGE_FILTER) += af_amerge.o
 OBJS-$(CONFIG_AMETADATA_FILTER)  += f_metadata.o
 OBJS-$(CONFIG_AMIX_FILTER)   += af_amix.o
diff --git a/libavfilter/af_ambisonic.c b/libavfilter/af_ambisonic.c
new file mode 100644
index 000..59c99f3
--- /dev/null
+++ b/libavfilter/af_ambisonic.c
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2017 Sanchit Sinha
+ * Copyright (c) 2017 Paul B Mahol
+ * 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 along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include 
+#include "libavutil/avstring.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/opt.h"
+#include "audio.h"
+#include "avfilter.h"
+#include "formats.h"
+#include 
+
+typedef struct AmbisonicContext {
+const AVClass *class;
+} AmbisonicContext;
+
+static const AVOption ambisonic_options[] = {
+{NULL}
+};
+
+AVFILTER_DEFINE_CLASS(ambisonic);
+
+static int query_formats(AVFilterContext *ctx)
+{
+AVFilterFormats *formats = NULL;
+AVFilterChannelLayouts *layout = NULL;
+int ret;
+
+if ((ret = ff_add_format (, AV_SAMPLE_FMT_FLTP   )) < 0 ||
+(ret = ff_set_common_formats (ctx, formats )) < 0 ||
+(ret = ff_add_channel_layout ( , AV_CH_LAYOUT_4POINT0)) < 0 ||
+(ret = ff_set_common_channel_layouts (ctx, layout   )) < 0)
+return ret;
+
+formats = ff_all_samplerates();
+return ff_set_common_samplerates(ctx, formats);
+}
+static int filter_frame(AVFilterLink *inlink, AVFrame *in)
+{
+AVFilterContext *ctx = inlink->dst;
+AVFilterLink *outlink = ctx->outputs[0];
+AVFrame *out;
+int itr;
+float *w,*x,*y,*c1,*c2,*c3,*c4;
+float root8 = sqrt(8);
+float lf=0,lb=0,rb=0,rf=0;
+
+if (av_frame_is_writable(in)) {
+out = in;
+} else {
+out = ff_get_audio_buffer(inlink, in->nb_samples);
+if (!out){
+av_frame_free();
+return AVERROR(ENOMEM);
+}
+av_frame_copy_props(out, in);
+}
+
+w=(float *)in->extended_data[0];
+x=(float *)in->extended_data[1];
+y=(float *)in->extended_data[2];
+c1=(float *)out->extended_data[0];
+c2=(float *)out->extended_data[1];
+c3=(float *)out->extended_data[2];
+c4=(float *)out->extended_data[3];
+
+for(itr=0;itrnb_samples;itr++){
+lf = root8 * (2*(w[itr])+x[itr]+y[itr]);

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

2017-03-12 Thread Sanchit Sinha
Any changes required in this one?

On Mar 11, 2017 10:53 PM, "Sanchit Sinha" <sanchit15...@iiitd.ac.in> wrote:

>
>
>
>
>
> On Sat, Mar 11, 2017 at 10:38 PM, Paul B Mahol <one...@gmail.com> wrote:
>
>> On 3/11/17, Sanchit Sinha <sanchit15...@iiitd.ac.in> wrote:
>> > On Sat, Mar 11, 2017 at 9:46 PM, Sanchit Sinha <
>> sanchit15...@iiitd.ac.in>
>> > wrote:
>> >
>>
>> tabs are forbidden use 4 spaces for identation, remove commented out code.
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>
>
>
> --
> Sanchit Sinha
> B.Tech- CSE
> IIIT-Delhi
> Roll-2015083
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


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

2017-03-11 Thread Sanchit Sinha
On Sat, Mar 11, 2017 at 10:38 PM, Paul B Mahol <one...@gmail.com> wrote:

> On 3/11/17, Sanchit Sinha <sanchit15...@iiitd.ac.in> wrote:
> > On Sat, Mar 11, 2017 at 9:46 PM, Sanchit Sinha <sanchit15...@iiitd.ac.in
> >
> > wrote:
> >
>
> tabs are forbidden use 4 spaces for identation, remove commented out code.
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>



-- 
Sanchit Sinha
B.Tech- CSE
IIIT-Delhi
Roll-2015083
From 5bc88aeb43ffbf835910daba671ff26021457a1a Mon Sep 17 00:00:00 2001
From: Sanchit Sinha <sanchit15...@iiitd.ac.in>
Date: Sat, 11 Mar 2017 22:51:34 +0530
Subject: [PATCH] avfilter : af_ambisonic added avfilter/Makefile allfilters
 updated Changelog update

Signed-off-by: Sanchit Sinha <sanchit15...@iiitd.ac.in>
---
 Changelog  |   1 +
 libavfilter/Makefile   |   1 +
 libavfilter/af_ambisonic.c | 117 +
 libavfilter/allfilters.c   |   1 +
 4 files changed, 120 insertions(+)
 create mode 100644 libavfilter/af_ambisonic.c

diff --git a/Changelog b/Changelog
index 13628ca..b917ac2 100644
--- a/Changelog
+++ b/Changelog
@@ -26,6 +26,7 @@ version :
 - native Opus encoder
 - ScreenPressor decoder
 - incomplete ClearVideo decoder
+- Ambisonic Decoder
 
 version 3.2:
 - libopenmpt demuxer
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 0ba1c74..4ebbd5a 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -44,6 +44,7 @@ OBJS-$(CONFIG_AINTERLEAVE_FILTER)+= f_interleave.o
 OBJS-$(CONFIG_ALIMITER_FILTER)   += af_alimiter.o
 OBJS-$(CONFIG_ALLPASS_FILTER)+= af_biquads.o
 OBJS-$(CONFIG_ALOOP_FILTER)  += f_loop.o
+OBJS-$(CONFIG_AMBISONIC_FILTER)  += af_ambisonic.o
 OBJS-$(CONFIG_AMERGE_FILTER) += af_amerge.o
 OBJS-$(CONFIG_AMETADATA_FILTER)  += f_metadata.o
 OBJS-$(CONFIG_AMIX_FILTER)   += af_amix.o
diff --git a/libavfilter/af_ambisonic.c b/libavfilter/af_ambisonic.c
new file mode 100644
index 000..5974bc9
--- /dev/null
+++ b/libavfilter/af_ambisonic.c
@@ -0,0 +1,117 @@
+/*
+ * 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 along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include 
+#include "libavutil/avstring.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/opt.h"
+#include "audio.h"
+#include "avfilter.h"
+#include "formats.h"
+#include 
+
+typedef struct AmbisonicContext {
+const AVClass *class;
+} AmbisonicContext;
+
+#define OFFSET(x) offsetof(AmbisonicContext, x)
+
+static const AVOption ambisonic_options[] = {
+{NULL}
+};
+
+AVFILTER_DEFINE_CLASS(ambisonic);
+static int query_formats(AVFilterContext *ctx)
+{
+AVFilterFormats *formats = NULL;
+AVFilterChannelLayouts *layout = NULL;
+int ret;
+if ((ret = ff_add_format (, AV_SAMPLE_FMT_FLTP   )) < 0 ||
+(ret = ff_set_common_formats (ctx, formats )) < 0 ||
+(ret = ff_add_channel_layout ( , AV_CH_LAYOUT_4POINT0)) < 0 ||
+(ret = ff_set_common_channel_layouts (ctx, layout   )) < 0)
+return ret;
+formats = ff_all_samplerates();
+return ff_set_common_samplerates(ctx, formats);
+}
+static int filter_frame(AVFilterLink *inlink, AVFrame *in)
+{
+AVFilterContext *ctx = inlink->dst;
+AVFilterLink *outlink = ctx->outputs[0];
+AVFrame *out;
+int itr;
+float *w,*x,*y,*c1,*c2,*c3,*c4;
+float root8 = sqrt(8);
+float lf=0,lb=0,rb=0,rf=0;
+if (av_frame_is_writable(in)) {
+out = in;
+} else {
+out = ff_get_audio_buffer(inlink, in->nb_samples);
+if (!out){
+av_frame_free();
+return AVERROR(ENOMEM);
+}
+av_frame_copy_props(out, in);
+}
+w=(float *)in->extended_data[0];
+x=(float *)in->extended_data[1];
+y=(float *)in->extended_data[2];
+
+c1=(float *)out->extended_data[0];
+c2=(float *)out->extended_data[1];
+c3=(float *)out->extended_data[2];
+c4=(float *)out->extended_data[3];
+
+for(itr=0;itrnb_samples;itr++){
+   

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

2017-03-11 Thread Sanchit Sinha
On Sat, Mar 11, 2017 at 9:46 PM, Sanchit Sinha <sanchit15...@iiitd.ac.in>
wrote:

>
>
>
>
>
> On Sat, Mar 11, 2017 at 9:18 PM, Paul B Mahol <one...@gmail.com> wrote:
>
>> On 3/11/17, Sanchit Sinha <sanchit15...@iiitd.ac.in> wrote:
>> > On Sat, Mar 11, 2017 at 5:57 PM, Paul B Mahol <one...@gmail.com> wrote:
>> >
>>
>> Please do not post diff of patch but full patch, diff from master branch.
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>
>
>
> --
> Sanchit Sinha
> B.Tech- CSE
> IIIT-Delhi
> Roll-2015083
>



-- 
Sanchit Sinha
B.Tech- CSE
IIIT-Delhi
Roll-2015083
From d40d85bd8591eef34eb9f71ba12c10190dead1a6 Mon Sep 17 00:00:00 2001
From: Sanchit Sinha <sanchit15...@iiitd.ac.in>
Date: Sat, 11 Mar 2017 21:58:39 +0530
Subject: [PATCH] avfilter : af_ambisonic added avfilter/Makefile allfilters
 updated Changelog update

Signed-off-by: Sanchit Sinha <sanchit15...@iiitd.ac.in>
---
 Changelog  |   1 +
 libavfilter/Makefile   |   1 +
 libavfilter/af_ambisonic.c | 117 +
 libavfilter/allfilters.c   |   1 +
 4 files changed, 120 insertions(+)
 create mode 100644 libavfilter/af_ambisonic.c

diff --git a/Changelog b/Changelog
index 13628ca..b917ac2 100644
--- a/Changelog
+++ b/Changelog
@@ -26,6 +26,7 @@ version :
 - native Opus encoder
 - ScreenPressor decoder
 - incomplete ClearVideo decoder
+- Ambisonic Decoder
 
 version 3.2:
 - libopenmpt demuxer
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 0ba1c74..4ebbd5a 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -44,6 +44,7 @@ OBJS-$(CONFIG_AINTERLEAVE_FILTER)+= f_interleave.o
 OBJS-$(CONFIG_ALIMITER_FILTER)   += af_alimiter.o
 OBJS-$(CONFIG_ALLPASS_FILTER)+= af_biquads.o
 OBJS-$(CONFIG_ALOOP_FILTER)  += f_loop.o
+OBJS-$(CONFIG_AMBISONIC_FILTER)  += af_ambisonic.o
 OBJS-$(CONFIG_AMERGE_FILTER) += af_amerge.o
 OBJS-$(CONFIG_AMETADATA_FILTER)  += f_metadata.o
 OBJS-$(CONFIG_AMIX_FILTER)   += af_amix.o
diff --git a/libavfilter/af_ambisonic.c b/libavfilter/af_ambisonic.c
new file mode 100644
index 000..70c5299
--- /dev/null
+++ b/libavfilter/af_ambisonic.c
@@ -0,0 +1,117 @@
+/*
+ * 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 along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include 
+#include "libavutil/avstring.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/opt.h"
+#include "audio.h"
+#include "avfilter.h"
+#include "formats.h"
+#include 
+
+typedef struct AmbisonicContext {
+	const AVClass *class;
+} AmbisonicContext;
+
+#define OFFSET(x) offsetof(AmbisonicContext, x)
+
+static const AVOption ambisonic_options[] = {
+{NULL}
+};
+
+AVFILTER_DEFINE_CLASS(ambisonic);
+static int query_formats(AVFilterContext *ctx)
+{
+	AVFilterFormats *formats = NULL;
+	AVFilterChannelLayouts *layout = NULL;
+	int ret;
+	if ((ret = ff_add_format (, AV_SAMPLE_FMT_FLTP   )) < 0 ||
+	(ret = ff_set_common_formats (ctx, formats )) < 0 ||
+	(ret = ff_add_channel_layout ( , AV_CH_LAYOUT_4POINT0)) < 0 ||
+	(ret = ff_set_common_channel_layouts (ctx, layout   )) < 0)
+	return ret;
+	formats = ff_all_samplerates();
+	return ff_set_common_samplerates(ctx, formats);
+}
+static int filter_frame(AVFilterLink *inlink, AVFrame *in)
+{
+	AVFilterContext *ctx = inlink->dst;
+	AVFilterLink *outlink = ctx->outputs[0];
+	AVFrame *out;
+	int itr;
+	float *w,*x,*y,*c1,*c2,*c3,*c4;
+	float root8 = sqrt(8);
+	float lf=0,lb=0,rb=0,rf=0;
+	if (av_frame_is_writable(in)) {
+		out = in;
+	} else {
+		out = ff_get_audio_buffer(inlink, in->nb_samples);
+		if (!out){
+			av_frame_free();
+			return AVERROR(ENOMEM);
+		}
+		av_frame_copy_props(out, in);
+	}
+	w=(float *)in->extended_data[0];
+	x=(float *)in->extended_data[1];
+	y=(float *)in->extended_data[2];
+
+	c1=(float *)out->extended_data[0];
+	c2=(float *)out->extended_data[1];
+	c3=(float *)out->ext

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

2017-03-11 Thread Sanchit Sinha
On Sat, Mar 11, 2017 at 9:18 PM, Paul B Mahol <one...@gmail.com> wrote:

> On 3/11/17, Sanchit Sinha <sanchit15...@iiitd.ac.in> wrote:
> > On Sat, Mar 11, 2017 at 5:57 PM, Paul B Mahol <one...@gmail.com> wrote:
> >
>
> Please do not post diff of patch but full patch, diff from master branch.
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>



-- 
Sanchit Sinha
B.Tech- CSE
IIIT-Delhi
Roll-2015083
From 49ef0db3f2e8dfc1a2f8a829f64a453bac78e559 Mon Sep 17 00:00:00 2001
From: Sanchit Sinha <sanchit15...@iiitd.ac.in>
Date: Sat, 11 Mar 2017 21:44:45 +0530
Subject: [PATCH] avfilter : af_ambisonic added avfilter/Makefile allfilters
 updated Changelog update

Signed-off-by: Sanchit Sinha <sanchit15...@iiitd.ac.in>
---
 Changelog  |   1 +
 libavfilter/Makefile   |   1 +
 libavfilter/af_ambisonic.c | 117 +
 libavfilter/allfilters.c   |   1 +
 4 files changed, 120 insertions(+)
 create mode 100644 libavfilter/af_ambisonic.c

diff --git a/Changelog b/Changelog
index 13628ca..b917ac2 100644
--- a/Changelog
+++ b/Changelog
@@ -26,6 +26,7 @@ version :
 - native Opus encoder
 - ScreenPressor decoder
 - incomplete ClearVideo decoder
+- Ambisonic Decoder
 
 version 3.2:
 - libopenmpt demuxer
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 0ba1c74..16fd612 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -47,6 +47,7 @@ OBJS-$(CONFIG_ALOOP_FILTER)  += f_loop.o
 OBJS-$(CONFIG_AMERGE_FILTER) += af_amerge.o
 OBJS-$(CONFIG_AMETADATA_FILTER)  += f_metadata.o
 OBJS-$(CONFIG_AMIX_FILTER)   += af_amix.o
+OBJS-$(CONFIG_AMBISONIC_FILTER)  += af_ambisonic.o
 OBJS-$(CONFIG_ANEQUALIZER_FILTER)+= af_anequalizer.o
 OBJS-$(CONFIG_ANULL_FILTER)  += af_anull.o
 OBJS-$(CONFIG_APAD_FILTER)   += af_apad.o
diff --git a/libavfilter/af_ambisonic.c b/libavfilter/af_ambisonic.c
new file mode 100644
index 000..351ffe9
--- /dev/null
+++ b/libavfilter/af_ambisonic.c
@@ -0,0 +1,117 @@
+/*
+ * 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 along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include 
+#include "libavutil/avstring.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/opt.h"
+#include "audio.h"
+#include "avfilter.h"
+#include "formats.h"
+#include 
+
+typedef struct AmbisonicContext {
+	const AVClass *class;
+} AmbisonicContext;
+
+#define OFFSET(x) offsetof(AmbisonicContext, x)
+
+static const AVOption ambisonic_options[] = {
+{NULL}
+};
+
+AVFILTER_DEFINE_CLASS(ambisonic);
+static int query_formats(AVFilterContext *ctx)
+{
+	AVFilterFormats *formats = NULL;
+	AVFilterChannelLayouts *layout = NULL;
+	int ret;
+	if ((ret = ff_add_format (, AV_SAMPLE_FMT_FLTP   )) < 0 ||
+	(ret = ff_set_common_formats (ctx, formats )) < 0 ||
+	(ret = ff_add_channel_layout ( , AV_CH_LAYOUT_4POINT0)) < 0 ||
+	(ret = ff_set_common_channel_layouts (ctx, layout   )) < 0)
+	return ret;
+	formats = ff_all_samplerates();
+	return ff_set_common_samplerates(ctx, formats);
+}
+static int filter_frame(AVFilterLink *inlink, AVFrame *in)
+{
+	AVFilterContext *ctx = inlink->dst;
+	AVFilterLink *outlink = ctx->outputs[0];
+	AVFrame *out;
+	int itr;
+	float *w,*x,*y,*c1,*c2,*c3,*c4;
+	float root8 = sqrt(8);
+	float lf=0,lb=0,rb=0,rf=0;
+	if (av_frame_is_writable(in)) {
+		out = in;
+	} else {
+		out = ff_get_audio_buffer(inlink, in->nb_samples);
+		if (!out){
+			av_frame_free();
+			return AVERROR(ENOMEM);
+		}
+		av_frame_copy_props(out, in);
+	}
+	w=(float *)in->extended_data[0];
+	x=(float *)in->extended_data[1];
+	y=(float *)in->extended_data[2];
+
+	c1=(float *)out->extended_data[0];
+	c2=(float *)out->extended_data[1];
+	c3=(float *)out->extended_data[2];
+	c4=(float *)out->extended_data[3];
+
+	for(itr=0;itrnb_samples;itr++){
+		lf = root8 * (2*(w[itr])+x[itr]+y[itr]);
+		lb = root8 * (2*(w[itr])-x[itr]+y[itr]);
+		rb = root8 * (2*(w[itr])-x[itr]-y[itr]);
+		rf = root8 * (2*(w[itr])+x[itr]-y[itr

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

2017-03-11 Thread Sanchit Sinha
On Sat, Mar 11, 2017 at 5:57 PM, Paul B Mahol <one...@gmail.com> wrote:

> On 3/11/17, Sanchit Sinha <sanchit15...@iiitd.ac.in> wrote:
> > Patch details:
> > File added avfilter/af_ambisonic.c
> > Entries made in avfilter/Makefile and avfilter/allfilters.c
> > Entry made in Changelog
>
> Learn not to top post.
>
> > From bb9915658d1089e36f5b3131ec5851a058a57c62 Mon Sep 17 00:00:00 2001
> > From: Sanchit Sinha <sanchit15...@iiitd.ac.in>
> > Date: Sat, 11 Mar 2017 17:04:47 +0530
> > Subject: [PATCH] avfiler/af_ambisonic.c: file added
> avfilter/allfilters.c and
> >  Makefile: entry added Changelog: entry mentioned
> >
> > ---
> >  Changelog  |   1 +
> >  libavfilter/Makefile   |   1 +
> >  libavfilter/af_ambisonic.c | 137 ++
> +++
> >  libavfilter/allfilters.c   |   1 +
> >  4 files changed, 140 insertions(+)
> >  create mode 100644 libavfilter/af_ambisonic.c
> >
> > diff --git a/Changelog b/Changelog
> > index 13628ca..b917ac2 100644
> > --- a/Changelog
> > +++ b/Changelog
> > @@ -26,6 +26,7 @@ version :
> >  - native Opus encoder
> >  - ScreenPressor decoder
> >  - incomplete ClearVideo decoder
> > +- Ambisonic Decoder
> >
> >  version 3.2:
> >  - libopenmpt demuxer
> > diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> > index 0ba1c74..16fd612 100644
> > --- a/libavfilter/Makefile
> > +++ b/libavfilter/Makefile
> > @@ -47,6 +47,7 @@ OBJS-$(CONFIG_ALOOP_FILTER)  +=
> f_loop.o
> >  OBJS-$(CONFIG_AMERGE_FILTER) += af_amerge.o
> >  OBJS-$(CONFIG_AMETADATA_FILTER)  += f_metadata.o
> >  OBJS-$(CONFIG_AMIX_FILTER)   += af_amix.o
> > +OBJS-$(CONFIG_AMBISONIC_FILTER)  += af_ambisonic.o
>
> B comes before I
>
> >  OBJS-$(CONFIG_ANEQUALIZER_FILTER)+= af_anequalizer.o
> >  OBJS-$(CONFIG_ANULL_FILTER)  += af_anull.o
> >  OBJS-$(CONFIG_APAD_FILTER)   += af_apad.o
> > diff --git a/libavfilter/af_ambisonic.c b/libavfilter/af_ambisonic.c
> > new file mode 100644
> > index 000..32f3c0c
> > --- /dev/null
> > +++ b/libavfilter/af_ambisonic.c
> > @@ -0,0 +1,137 @@
> > +/*
> > + * 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 along with FFmpeg; if not, write to the Free Software
> > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301 USA
> > + */
> > +
> > +#include 
> > +#include "libavutil/avstring.h"
> > +#include "libavutil/channel_layout.h"
> > +#include "libavutil/opt.h"
> > +#include "audio.h"
> > +#include "avfilter.h"
> > +#include "formats.h"
> > +#include 
> > +
> > +typedef struct AmbisonicContext {
> > + const AVClass *class;
> > + /*Not needed, if any new variables are to be used, this struct can
> be populated(f)*/
> > +
> > +} AmbisonicContext;
> > +
> > +#define OFFSET(x) offsetof(AmbisonicContext, x)
> > +
> > +static const AVOption ambisonic_options[] = {  //square will be an
> option
> > +{NULL}
> > +};
> > +
> > +AVFILTER_DEFINE_CLASS(ambisonic);
> > +static int query_formats(AVFilterContext *ctx)
> > +{
> > + AVFilterFormats *formats = NULL;
> > + AVFilterChannelLayouts *layout = NULL;
> > + int ret;
> > + if ((ret = ff_add_format (, AV_SAMPLE_FMT_FLTP   )) <
> 0 ||
> > + (ret = ff_set_common_formats (ctx, formats )) < 0 ||
> > + (ret = ff_add_channel_layout ( , AV_CH_LAYOUT_4POINT0))
> < 0 ||
> > + (ret = ff_set_common_channel_layouts (ctx, layout   )) < 0)
> > + return ret;
> > + formats = ff_all_samplerates();
> > + return ff_set_common_samplerates(ctx, formats);
> > +}

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

2017-03-11 Thread Sanchit Sinha
Patch details:
File added avfilter/af_ambisonic.c
Entries made in avfilter/Makefile and avfilter/allfilters.c
Entry made in Changelog




On Sat, Mar 11, 2017 at 4:29 PM, Sanchit Sinha <sanchit15...@iiitd.ac.in>
wrote:

>
> Thanks Andy for the valuable info! It would be good to talk and learn from
> these guys, especially for an amateur like me. :)
>
> On Sat, Mar 11, 2017 at 4:23 PM, Andy Furniss <adf.li...@gmail.com> wrote:
>
>> Paul B Mahol wrote:
>>
>>> On 3/11/17, Andy Furniss <adf.li...@gmail.com> wrote:
>>>
>>>> Sanchit Sinha wrote:
>>>>
>>>>> libavfilter/af_ambisonic.c | 139
>>>>>
>>>>
>>>> +w=(float *)(*(in->extended_data)+itr);
>>>>> +x=(float *)(*(in->extended_data+1)+itr);
>>>>> +y=(float *)(*(in->extended_data+2)+itr);
>>>>> +
>>>>> +*lf = root8 * (2*(*w)+*x+*y);
>>>>> +*lb = root8 * (2*(*w)-*x+*y);
>>>>> +*rb = root8 * (2*(*w)-*x-*y);
>>>>> +*rf = root8 * (2*(*w)+*x-*y);
>>>>>
>>>>
>>>> Seems a bit misleading to call something ambisonic if all it will
>>>> do is 2d, so partial b-format to (square?) 4 channel.
>>>>
>>>> Why not be more specific in the name so the limitation is clear.
>>>>
>>>
>>> This is just for qualification task. Later filter willl be extended.
>>>
>>> It will not be applied as is in tree.
>>>
>>
>> Ahh, OK.
>>
>> A complicated subject.
>>
>> Sanchit, in case you don't know, some of the people who were around at
>> the birth of ambisonics, plus ambdec author can be found on the list -
>>
>> https://mail.music.vt.edu/mailman/listinfo/sursound
>>
>>
>>
>>
>>
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>
>
>
> --
> Sanchit Sinha
> B.Tech- CSE
> IIIT-Delhi
> Roll-2015083
>



-- 
Sanchit Sinha
B.Tech- CSE
IIIT-Delhi
Roll-2015083
From bb9915658d1089e36f5b3131ec5851a058a57c62 Mon Sep 17 00:00:00 2001
From: Sanchit Sinha <sanchit15...@iiitd.ac.in>
Date: Sat, 11 Mar 2017 17:04:47 +0530
Subject: [PATCH] avfiler/af_ambisonic.c: file added avfilter/allfilters.c and
 Makefile: entry added Changelog: entry mentioned

---
 Changelog  |   1 +
 libavfilter/Makefile   |   1 +
 libavfilter/af_ambisonic.c | 137 +
 libavfilter/allfilters.c   |   1 +
 4 files changed, 140 insertions(+)
 create mode 100644 libavfilter/af_ambisonic.c

diff --git a/Changelog b/Changelog
index 13628ca..b917ac2 100644
--- a/Changelog
+++ b/Changelog
@@ -26,6 +26,7 @@ version :
 - native Opus encoder
 - ScreenPressor decoder
 - incomplete ClearVideo decoder
+- Ambisonic Decoder
 
 version 3.2:
 - libopenmpt demuxer
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 0ba1c74..16fd612 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -47,6 +47,7 @@ OBJS-$(CONFIG_ALOOP_FILTER)  += f_loop.o
 OBJS-$(CONFIG_AMERGE_FILTER) += af_amerge.o
 OBJS-$(CONFIG_AMETADATA_FILTER)  += f_metadata.o
 OBJS-$(CONFIG_AMIX_FILTER)   += af_amix.o
+OBJS-$(CONFIG_AMBISONIC_FILTER)  += af_ambisonic.o
 OBJS-$(CONFIG_ANEQUALIZER_FILTER)+= af_anequalizer.o
 OBJS-$(CONFIG_ANULL_FILTER)  += af_anull.o
 OBJS-$(CONFIG_APAD_FILTER)   += af_apad.o
diff --git a/libavfilter/af_ambisonic.c b/libavfilter/af_ambisonic.c
new file mode 100644
index 000..32f3c0c
--- /dev/null
+++ b/libavfilter/af_ambisonic.c
@@ -0,0 +1,137 @@
+/*
+ * 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 along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include 
+#include "libavutil/avstring.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/opt.h"
+#include "audio

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

2017-03-11 Thread Sanchit Sinha
Apologies I will update it asap

On Mar 11, 2017 3:07 PM, "Paul B Mahol" <one...@gmail.com> wrote:

> On 3/10/17, Sanchit Sinha <sanchit15...@iiitd.ac.in> wrote:
> > Hi,
> > I specific changes we talked about. Also updated apart from
> af_ambisonic.c
> > : allfilters.c, Makefile and Changelog.
> >
> > From b74755ae0ea6741f01d2c1b2c79056984674c331 Mon Sep 17 00:00:00 2001
> > From: Sanchit Sinha <sanchit15...@iiitd.ac.in>
> > Date: Sat, 11 Mar 2017 03:31:51 +0530
> > Subject: [PATCH] Changes to af_ambisonic, Makefile, allfilters.c and
> > Changelog
> >
>
> Unaccpetable. This is not patch.
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


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

2017-03-10 Thread Sanchit Sinha
Hi,
I specific changes we talked about. Also updated apart from af_ambisonic.c
: allfilters.c, Makefile and Changelog.

From b74755ae0ea6741f01d2c1b2c79056984674c331 Mon Sep 17 00:00:00 2001
From: Sanchit Sinha <sanchit15...@iiitd.ac.in>
Date: Sat, 11 Mar 2017 03:31:51 +0530
Subject: [PATCH] Changes to af_ambisonic, Makefile, allfilters.c and
Changelog

---
 Changelog  | 1591

 libavfilter/Makefile   |  375 +++
 libavfilter/af_ambisonic.c |  137 
 libavfilter/allfilters.c   |  383 +++
 4 files changed, 2486 insertions(+)
 create mode 100644 Changelog
 create mode 100644 libavfilter/Makefile
 create mode 100644 libavfilter/af_ambisonic.c
 create mode 100644 libavfilter/allfilters.c

diff --git a/Changelog b/Changelog
new file mode 100644
index 000..155c309
--- /dev/null
+++ b/Changelog
@@ -0,0 +1,1591 @@
+Entries are sorted chronologically from oldest to youngest within each
release,
+releases are sorted from youngest to oldest.
+
+version :
+- CrystalHD decoder moved to new decode API
+- add internal ebur128 library, remove external libebur128 dependency
+- Pro-MPEG CoP #3-R2 FEC protocol
+- premultiply video filter
+- Support for spherical videos
+- configure now fails if autodetect-libraries are requested but not found
+- PSD Decoder
+- 16.8 floating point pcm decoder
+- 24.0 floating point pcm decoder
+- Apple Pixlet decoder
+- QDMC audio decoder
+- NewTek SpeedHQ decoder
+- MIDI Sample Dump Standard demuxer
+- readeia608 filter
+- Sample Dump eXchange demuxer
+- abitscope multimedia filter
+- Scenarist Closed Captions demuxer and muxer
+- threshold filter
+- midequalizer filter
+- Optimal Huffman tables for (M)JPEG encoding
+- FM Screen Capture Codec decoder
+- native Opus encoder
+- ScreenPressor decoder
+- incomplete ClearVideo decoder
+- Ambisonic Decoder
+
+version 3.2:
+- libopenmpt demuxer
+- tee protocol
+- Changed metadata print option to accept general urls
+- Alias muxer for Ogg Video (.ogv)
+- VP8 in Ogg muxing
+- curves filter doesn't automatically insert points at x=0 and x=1 anymore
+- 16-bit support in curves filter and selectivecolor filter
+- OpenH264 decoder wrapper
+- MediaCodec H.264/HEVC/MPEG-4/VP8/VP9 hwaccel
+- True Audio (TTA) muxer
+- crystalizer audio filter
+- acrusher audio filter
+- bitplanenoise video filter
+- floating point support in als decoder
+- fifo muxer
+- maskedclamp filter
+- hysteresis filter
+- lut2 filter
+- yuvtestsrc filter
+- CUDA CUVID H.263/VP8/VP9/10 bit HEVC (Dithered) Decoding
+- vaguedenoiser filter
+- added threads option per filter instance
+- weave filter
+- gblur filter
+- avgblur filter
+- sobel and prewitt filter
+- MediaCodec HEVC/MPEG-4/VP8/VP9 decoding
+- Meridian Lossless Packing (MLP) / TrueHD encoder
+- Non-Local Means (nlmeans) denoising filter
+- sdl2 output device and ffplay support
+- sdl1 output device and sdl1 support removed
+- extended mov edit list support
+- libfaac encoder removed
+- Matroska muxer now writes CRC32 elements by default in all Level 1
elements
+- sidedata video and asidedata audio filter
+- Changed mapping of rtp MIME type G726 to codec g726le.
+- spec compliant VAAPI/DXVA2 VC-1 decoding of slices in frame-coded images
+
+
+version 3.1:
+- DXVA2-accelerated HEVC Main10 decoding
+- fieldhint filter
+- loop video filter and aloop audio filter
+- Bob Weaver deinterlacing filter
+- firequalizer filter
+- datascope filter
+- bench and abench filters
+- ciescope filter
+- protocol blacklisting API
+- MediaCodec H264 decoding
+- VC-2 HQ RTP payload format (draft v1) depacketizer and packetizer
+- VP9 RTP payload format (draft v2) packetizer
+- AudioToolbox audio decoders
+- AudioToolbox audio encoders
+- coreimage filter (GPU based image filtering on OSX)
+- libdcadec removed
+- bitstream filter for extracting DTS core
+- ADPCM IMA DAT4 decoder
+- musx demuxer
+- aix demuxer
+- remap filter
+- hash and framehash muxers
+- colorspace filter
+- hdcd filter
+- readvitc filter
+- VAAPI-accelerated format conversion and scaling
+- libnpp/CUDA-accelerated format conversion and scaling
+- Duck TrueMotion 2.0 Real Time decoder
+- Wideband Single-bit Data (WSD) demuxer
+- VAAPI-accelerated H.264/HEVC/MJPEG encoding
+- DTS Express (LBR) decoder
+- Generic OpenMAX IL encoder with support for Raspberry Pi
+- IFF ANIM demuxer & decoder
+- Direct Stream Transfer (DST) decoder
+- loudnorm filter
+- MTAF demuxer and decoder
+- MagicYUV decoder
+- OpenExr improvements (tile data and B44/B44A support)
+- BitJazz SheerVideo decoder
+- CUDA CUVID H264/HEVC decoder
+- 10-bit depth support in native utvideo decoder
+- libutvideo wrapper removed
+- YUY2 Lossless Codec decoder
+- VideoToolbox H.264 encoder
+- VAAPI-accelerated MPEG-2 and VP8 encoding
+
+
+version 3.0:
+- Common Encryption (CENC) MP4 encoding and decoding support
+- DXV decoding
+- extrastereo filter
+- ocr filter
+- alimiter filter
+- stereowiden filter
+- stereotools filter
+- 

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

2017-03-10 Thread Sanchit Sinha
Is the conversion okay now? I used pointers there because in one of our
discussions you mentioned that out->ex should also be written on by
references.(Maybe I didn't comprehend.. apologies on that). I will patch
the makefile, allfilters.c and changelog in a while.
Thank You




On Sat, Mar 11, 2017 at 1:50 AM, Paul B Mahol <one...@gmail.com> wrote:

> On 3/10/17, Sanchit Sinha <sanchit15...@iiitd.ac.in> wrote:
> > Okay made some changes,
> >
>
> Do all changes, not just some.
> Also this must be full patch.
>
> You are missing Makefile, Changelog and so on...
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>



-- 
Sanchit Sinha
B.Tech- CSE
IIIT-Delhi
Roll-2015083
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


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

2017-03-10 Thread Sanchit Sinha
Okay made some changes,

From c0c1a1e7d4ad1fcbd96827725a47af20145c7621 Mon Sep 17 00:00:00 2001
From: Sanchit Sinha <sanchit15...@iiitd.ac.in>
Date: Sat, 11 Mar 2017 01:27:38 +0530
Subject: [PATCH] Changes to af_ambisonic.c, makefile and allfilters.c

---
 libavfilter/af_ambisonic.c | 136
+
 1 file changed, 136 insertions(+)
 create mode 100644 libavfilter/af_ambisonic.c

diff --git a/libavfilter/af_ambisonic.c b/libavfilter/af_ambisonic.c
new file mode 100644
index 000..03409a6
--- /dev/null
+++ b/libavfilter/af_ambisonic.c
@@ -0,0 +1,136 @@
+/*
+ * 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 along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
+ */
+
+#include 
+#include "libavutil/avstring.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/opt.h"
+#include "audio.h"
+#include "avfilter.h"
+#include "formats.h"
+#include 
+
+typedef struct AmbisonicContext {
+ const AVClass *class;
+ /*Not needed, if any new variables are to be used, this struct can be
populated(f)*/
+
+} AmbisonicContext;
+
+#define OFFSET(x) offsetof(AmbisonicContext, x)
+
+static const AVOption ambisonic_options[] = {  //square will be an option
+{NULL}
+};
+
+AVFILTER_DEFINE_CLASS(ambisonic);
+static int query_formats(AVFilterContext *ctx)
+{
+ AVFilterFormats *formats = NULL;
+ AVFilterChannelLayouts *layout = NULL;
+ int ret;
+ if ((ret = ff_add_format (, AV_SAMPLE_FMT_FLTP   )) < 0 ||
+ (ret = ff_set_common_formats (ctx, formats )) < 0 ||
+ (ret = ff_add_channel_layout ( , AV_CH_LAYOUT_4POINT0)) < 0 ||
+ (ret = ff_set_common_channel_layouts (ctx, layout   )) < 0)
+ return ret;
+ formats = ff_all_samplerates();
+ return ff_set_common_samplerates(ctx, formats);
+}
+static int filter_frame(AVFilterLink *inlink, AVFrame *in)
+{
+ AVFilterContext *ctx = inlink->dst;
+ AVFilterLink *outlink = ctx->outputs[0];
+ /*If variables used, this has to be created*/
+ // AmbisonicContext *s = ctx->priv;
+ // const float *src = (const float *)in->data[0];
+ // float *dst;
+ AVFrame *out;
+ int itr;
+ float *w,*x,*y;
+
+ if (av_frame_is_writable(in))
+ {
+ out = in;
+ }
+ else
+ {
+ out = ff_get_audio_buffer(inlink, in->nb_samples);
+ if (!out)
+ {
+ av_frame_free();
+ return AVERROR(ENOMEM);
+ }
+ av_frame_copy_props(out, in);
+ }
+
+ /*If planar samples are used, output must be put in dst*/
+ //dst = (float *)out->data[0];
+
+ float root8= sqrt(8);
+ float lf=0,lb=0,rb=0,rf=0;
+ for(itr=0;itrnb_samples;itr++)
+ {
+ /*Float pointers to the samples*/
+ w=(float *)(*(in->extended_data)+itr);
+ x=(float *)(*(in->extended_data+1)+itr);
+ y=(float *)(*(in->extended_data+2)+itr);
+
+ lf = root8 * (2*(*w)+*x+*y);
+ lb = root8 * (2*(*w)-*x+*y);
+ rb = root8 * (2*(*w)-*x-*y);
+ rf = root8 * (2*(*w)+*x-*y);
+
+ out->extended_data[0][itr]= lf;
+ out->extended_data[1][itr]= lb;
+ out->extended_data[2][itr]= rb;
+ out->extended_data[3][itr]= rf;
+ }
+
+ if (out != in)
+ av_frame_free();
+ return ff_filter_frame(outlink, out);
+}
+
+static const AVFilterPad inputs[] = {
+ {
+ .name= "default",
+ .type= AVMEDIA_TYPE_AUDIO,
+ .filter_frame = filter_frame,
+ // .config_props = config_input,
+ },
+ { NULL }
+};
+
+static const AVFilterPad outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_AUDIO,
+ },
+ { NULL }
+};
+
+AVFilter ff_af_ambisonic = {
+ .name  = "ambisonic",
+ .description= NULL_IF_CONFIG_SMALL("An ambisonic filter"),
+ .query_formats  = query_formats,
+ .priv_size= sizeof(AmbisonicContext),
+ .priv_class  = _class,
+ // .uninit   = uninit,
+ .inputs  = inputs,
+ .outputs    = outputs,
+};
\ No newline at end of file
-- 
2.7.4





On Sat, Mar 11, 2017 at 12:33 AM, Paul B Mahol <one...@gmail.com> wrote:

> On 3/10/17, Sanchit Sinha <sanchit15...@iiitd.ac.in> wrote:
> > libavfilter/af_ambisonic.c | 139
> > +
> >  1 file changed, 139 insertions(+)
> >  create mode 100644 libavfilter/af_ambisonic.c
> >
>
> Incomplete patch.
>
> > diff --git a/libavfilter/af_ambisonic.c b/libavfilter/af_ambisonic.c
> > new file

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

2017-03-10 Thread Sanchit Sinha
libavfilter/af_ambisonic.c | 139
+
 1 file changed, 139 insertions(+)
 create mode 100644 libavfilter/af_ambisonic.c

diff --git a/libavfilter/af_ambisonic.c b/libavfilter/af_ambisonic.c
new file mode 100644
index 000..98b0e44
--- /dev/null
+++ b/libavfilter/af_ambisonic.c
@@ -0,0 +1,139 @@
+/*
+ * 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 along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
+ */
+
+#include 
+#include "libavutil/avstring.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/opt.h"
+#include "audio.h"
+#include "avfilter.h"
+#include "formats.h"
+
+#define root8 2.828
+
+typedef struct AmbisonicContext {
+const AVClass *class;
+/*Not needed, if any new variables are to be used, this struct can be
populated*/
+
+} AmbisonicContext;
+
+#define OFFSET(x) offsetof(AmbisonicContext, x) //Future use(maybe)
+
+static const AVOption ambisonic_options[] = {  //square will be an option
+{NULL}
+};
+
+AVFILTER_DEFINE_CLASS(ambisonic);
+static int query_formats(AVFilterContext *ctx)
+{
+AVFilterFormats *formats = NULL;
+AVFilterChannelLayouts *layout = NULL;
+int ret;
+if ((ret = ff_add_format (, AV_SAMPLE_FMT_FLTP
  )) < 0 ||
+(ret = ff_set_common_formats (ctx , formats
 )) < 0 ||
+(ret = ff_add_channel_layout ( ,
AV_CH_LAYOUT_4POINT0)) < 0 ||
+(ret = ff_set_common_channel_layouts (ctx , layout
)) < 0)
+return ret;
+formats = ff_all_samplerates();
+return ff_set_common_samplerates(ctx, formats);
+}
+static int filter_frame(AVFilterLink *inlink, AVFrame *in)
+{
+AVFilterContext *ctx = inlink->dst;
+AVFilterLink *outlink = ctx->outputs[0];
+/*If variables used, this has to be created*/
+// AmbisonicContext *s = ctx->priv;
+// const float *src = (const float *)in->data[0];
+// float *dst;
+float *lf,*lb,*rb,*rf;
+AVFrame *out;
+int itr;
+float *w,*x,*y;
+
+if (av_frame_is_writable(in)) {
+out = in;
+} else {
+out = ff_get_audio_buffer(inlink, in->nb_samples);
+if (!out) {
+av_frame_free();
+return AVERROR(ENOMEM);
+}
+av_frame_copy_props(out, in);
+}
+
+/*If planar samples are used, output must be put in dst*/
+//dst = (float *)out->data[0];
+
+lf = (float *)malloc(sizeof(float));
+lb = (float *)malloc(sizeof(float));
+rb = (float *)malloc(sizeof(float));
+rf = (float *)malloc(sizeof(float));
+
+for(itr=0;itrnb_samples;itr++)
+{
+*lf=0,*lb=0,*rb=0,*rf=0;
+/*Float pointers to the samples*/
+w=(float *)(*(in->extended_data)+itr);
+x=(float *)(*(in->extended_data+1)+itr);
+y=(float *)(*(in->extended_data+2)+itr);
+
+*lf = root8 * (2*(*w)+*x+*y);
+*lb = root8 * (2*(*w)-*x+*y);
+*rb = root8 * (2*(*w)-*x-*y);
+*rf = root8 * (2*(*w)+*x-*y);
+
+/*Mathematical coefficients taken from :
https://en.wikipedia.org/wiki/Ambisonics*/
+out->extended_data[0][itr]= *lf;
+out->extended_data[1][itr]= *lb;
+out->extended_data[2][itr]= *rb;
+out->extended_data[3][itr]= *rf;
+}
+
+if (out != in)
+av_frame_free();
+return ff_filter_frame(outlink, out);
+}
+
+static const AVFilterPad inputs[] = {
+{
+.name = "default",
+.type = AVMEDIA_TYPE_AUDIO,
+.filter_frame = filter_frame,
+// .config_props = config_input,
+},
+{ NULL }
+};
+
+static const AVFilterPad outputs[] = {
+{
+.name = "default",
+.type = AVMEDIA_TYPE_AUDIO,
+},
+{ NULL }
+};
+
+AVFilter ff_af_ambisonic = {
+.name   = "ambisonic",
+.description= NULL_IF_CONFIG_SMALL("An ambisonic filter"),
+.query_formats  = query_formats,
+.priv_size  = sizeof(AmbisonicContext),
+.priv_class = _class,
+// .uninit = uninit,
+.inputs = inputs,
+.outputs= outputs,
+};
\ No newline at end of file
-- 
2.7.4
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel