Re: [FFmpeg-devel] [PATCH] Added AVX2 implementation for VP8 decoder (ff_pred16x16_tm_vp8_8_avx2)

2017-03-11 Thread Michael Niedermayer
On Sun, Mar 12, 2017 at 12:17:34AM -0300, James Almer wrote:
> On 3/12/2017 12:13 AM, Michael Niedermayer wrote:
> > On Sun, Mar 12, 2017 at 12:35:01AM +0530, Mirage Abeysekara wrote:
> >> ---
> >>  libavcodec/x86/h264_intrapred.asm| 35 
> >> +++
> >>  libavcodec/x86/h264_intrapred_init.c |  7 +++
> >>  2 files changed, 42 insertions(+)
> >>
> > 
> > breaks build with nasm
> > 
> > src/libavcodec/x86/h264_intrapred.asm:275: error: parser: instruction 
> > expected
> > src/libavcodec/x86/h264_intrapred.asm:281: error: symbol `vpbroadcastb' 
> > redefined
> > src/libavcodec/x86/h264_intrapred.asm:281: error: parser: instruction 
> > expected
> > src/libavcodec/x86/h264_intrapred.asm:282: error: symbol `vpbroadcastb' 
> > redefined
> > src/libavcodec/x86/h264_intrapred.asm:282: error: parser: instruction 
> > expected
> > src/libavcodec/x86/h264_intrapred.asm:283: error: symbol `vpbroadcastb' 
> > redefined
> > src/libavcodec/x86/h264_intrapred.asm:283: error: parser: instruction 
> > expected
> > src/libavcodec/x86/h264_intrapred.asm:284: error: symbol `vpbroadcastb' 
> > redefined
> > src/libavcodec/x86/h264_intrapred.asm:284: error: parser: instruction 
> > expected
> > src/libavcodec/x86/h264_intrapred.asm:295: error: parser: instruction 
> > expected
> > src/libavcodec/x86/h264_intrapred.asm:296: error: symbol `vpermq' redefined
> > src/libavcodec/x86/h264_intrapred.asm:296: error: parser: instruction 
> > expected
> > src/libavcodec/x86/h264_intrapred.asm:298: error: parser: instruction 
> > expected
> > src/libavcodec/x86/h264_intrapred.asm:300: error: symbol `vextracti128' 
> > redefined
> > src/libavcodec/x86/h264_intrapred.asm:300: error: parser: instruction 
> > expected
> 
> What version? I suppose it's an old one not supporting AVX2.
> It should be a matter of adding a HAVE_AVX2_EXTERNAL preprocessor
> guard to the asm function.

version is:
NASM version 2.09.10 compiled on Oct 17 2011

so yes, not very new

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
then the original author, trying to rewrite it will not make it better.


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Added AVX2 implementation for VP8 decoder (ff_pred16x16_tm_vp8_8_avx2)

2017-03-11 Thread James Almer
On 3/12/2017 12:13 AM, Michael Niedermayer wrote:
> On Sun, Mar 12, 2017 at 12:35:01AM +0530, Mirage Abeysekara wrote:
>> ---
>>  libavcodec/x86/h264_intrapred.asm| 35 
>> +++
>>  libavcodec/x86/h264_intrapred_init.c |  7 +++
>>  2 files changed, 42 insertions(+)
>>
> 
> breaks build with nasm
> 
> src/libavcodec/x86/h264_intrapred.asm:275: error: parser: instruction expected
> src/libavcodec/x86/h264_intrapred.asm:281: error: symbol `vpbroadcastb' 
> redefined
> src/libavcodec/x86/h264_intrapred.asm:281: error: parser: instruction expected
> src/libavcodec/x86/h264_intrapred.asm:282: error: symbol `vpbroadcastb' 
> redefined
> src/libavcodec/x86/h264_intrapred.asm:282: error: parser: instruction expected
> src/libavcodec/x86/h264_intrapred.asm:283: error: symbol `vpbroadcastb' 
> redefined
> src/libavcodec/x86/h264_intrapred.asm:283: error: parser: instruction expected
> src/libavcodec/x86/h264_intrapred.asm:284: error: symbol `vpbroadcastb' 
> redefined
> src/libavcodec/x86/h264_intrapred.asm:284: error: parser: instruction expected
> src/libavcodec/x86/h264_intrapred.asm:295: error: parser: instruction expected
> src/libavcodec/x86/h264_intrapred.asm:296: error: symbol `vpermq' redefined
> src/libavcodec/x86/h264_intrapred.asm:296: error: parser: instruction expected
> src/libavcodec/x86/h264_intrapred.asm:298: error: parser: instruction expected
> src/libavcodec/x86/h264_intrapred.asm:300: error: symbol `vextracti128' 
> redefined
> src/libavcodec/x86/h264_intrapred.asm:300: error: parser: instruction expected

What version? I suppose it's an old one not supporting AVX2.
It should be a matter of adding a HAVE_AVX2_EXTERNAL preprocessor
guard to the asm function.

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


Re: [FFmpeg-devel] [PATCH] Added AVX2 implementation for VP8 decoder (ff_pred16x16_tm_vp8_8_avx2)

2017-03-11 Thread Michael Niedermayer
On Sun, Mar 12, 2017 at 12:35:01AM +0530, Mirage Abeysekara wrote:
> ---
>  libavcodec/x86/h264_intrapred.asm| 35 +++
>  libavcodec/x86/h264_intrapred_init.c |  7 +++
>  2 files changed, 42 insertions(+)
> 

breaks build with nasm

src/libavcodec/x86/h264_intrapred.asm:275: error: parser: instruction expected
src/libavcodec/x86/h264_intrapred.asm:281: error: symbol `vpbroadcastb' 
redefined
src/libavcodec/x86/h264_intrapred.asm:281: error: parser: instruction expected
src/libavcodec/x86/h264_intrapred.asm:282: error: symbol `vpbroadcastb' 
redefined
src/libavcodec/x86/h264_intrapred.asm:282: error: parser: instruction expected
src/libavcodec/x86/h264_intrapred.asm:283: error: symbol `vpbroadcastb' 
redefined
src/libavcodec/x86/h264_intrapred.asm:283: error: parser: instruction expected
src/libavcodec/x86/h264_intrapred.asm:284: error: symbol `vpbroadcastb' 
redefined
src/libavcodec/x86/h264_intrapred.asm:284: error: parser: instruction expected
src/libavcodec/x86/h264_intrapred.asm:295: error: parser: instruction expected
src/libavcodec/x86/h264_intrapred.asm:296: error: symbol `vpermq' redefined
src/libavcodec/x86/h264_intrapred.asm:296: error: parser: instruction expected
src/libavcodec/x86/h264_intrapred.asm:298: error: parser: instruction expected
src/libavcodec/x86/h264_intrapred.asm:300: error: symbol `vextracti128' 
redefined
src/libavcodec/x86/h264_intrapred.asm:300: error: parser: instruction expected


[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/3] avcodec/wavpack: Fix runtime error: signed integer overflow: -2147483648 + -83886075 cannot be represented in type 'int'

2017-03-11 Thread Michael Niedermayer
On Sat, Mar 11, 2017 at 04:11:23AM +0100, Michael Niedermayer wrote:
> Fixes: 761/clusterfuzz-testcase-544252097536
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/wavpack.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

patchset applied

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] avcodec/dca_xll: Fix runtime error: signed integer overflow: 2147286116 + 6298923 cannot be represented in type 'int'

2017-03-11 Thread Michael Niedermayer
On Fri, Mar 10, 2017 at 03:52:06PM +0100, wm4 wrote:
> On Fri, 10 Mar 2017 15:24:51 +0100
> Michael Niedermayer  wrote:
> 
> > Fixes: 732/clusterfuzz-testcase-4872990070145024
> > 
> > See: [FFmpeg-devel] [PATCH 2/6] avcodec/dca_xll: Fix runtime error: signed 
> > integer overflow: 2147286116 + 6298923 cannot be represented in type 'int'
> > Found-by: continuous fuzzing process 
> > https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/dca_xll.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/libavcodec/dca_xll.c b/libavcodec/dca_xll.c
> > index 6cebda35e4..0fe90c7348 100644
> > --- a/libavcodec/dca_xll.c
> > +++ b/libavcodec/dca_xll.c
> > @@ -1312,7 +1312,7 @@ static int combine_residual_frame(DCAXllDecoder *s, 
> > DCAXllChSet *c)
> >  } else {
> >  // No downmix scaling
> >  for (n = 0; n < nsamples; n++)
> > -dst[n] += (src[n] + round) >> shift;
> > +dst[n] += (unsigned)((src[n] + round) >> shift);
> >  }
> >  }
> >  
> 
> Seems reasonable.

applied

thx

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I do not agree with what you have to say, but I'll defend to the death your
right to say it. -- Voltaire


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/3] avcodec/rv34: Fix runtime error: signed integer overflow: 36880 * 66288 cannot be represented in type 'int'

2017-03-11 Thread Michael Niedermayer
Fixes: 768/clusterfuzz-testcase-4807444305805312

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/rv34.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index be49804ebd..d2d676a86d 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -1636,7 +1636,7 @@ static AVRational update_sar(int old_w, int old_h, 
AVRational sar, int new_w, in
 if (!sar.num)
 sar = (AVRational){1, 1};
 
-sar = av_mul_q(sar, (AVRational){new_h * old_w, new_w * old_h});
+sar = av_mul_q(sar, av_mul_q((AVRational){new_h, new_w}, 
(AVRational){old_w, old_h}));
 return sar;
 }
 
-- 
2.11.0

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


[FFmpeg-devel] [PATCH 3/3] avcodec/vp6: clear dimensions on failed resolution change in vp6_parse_header()

2017-03-11 Thread Michael Niedermayer
Fixes: 807/clusterfuzz-testcase-6470061042696192
Fixes null pointer dereference

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vp6.c | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/libavcodec/vp6.c b/libavcodec/vp6.c
index f0e60a3822..4afd67b3a4 100644
--- a/libavcodec/vp6.c
+++ b/libavcodec/vp6.c
@@ -108,7 +108,7 @@ static int vp6_parse_header(VP56Context *s, const uint8_t 
*buf, int buf_size)
 
 ret = ff_vp56_init_range_decoder(c, buf+6, buf_size-6);
 if (ret < 0)
-return ret;
+goto fail;
 vp56_rac_gets(c, 2);
 
 parse_filter_info = s->filter_header;
@@ -162,9 +162,8 @@ static int vp6_parse_header(VP56Context *s, const uint8_t 
*buf, int buf_size)
 buf  += coeff_offset;
 buf_size -= coeff_offset;
 if (buf_size < 0) {
-if (s->frames[VP56_FRAME_CURRENT]->key_frame)
-ff_set_dimensions(s->avctx, 0, 0);
-return AVERROR_INVALIDDATA;
+ret = AVERROR_INVALIDDATA;
+goto fail;
 }
 if (s->use_huffman) {
 s->parse_coeff = vp6_parse_coeff_huffman;
@@ -172,7 +171,7 @@ static int vp6_parse_header(VP56Context *s, const uint8_t 
*buf, int buf_size)
 } else {
 ret = ff_vp56_init_range_decoder(>cc, buf, buf_size);
 if (ret < 0)
-return ret;
+goto fail;
 s->ccp = >cc;
 }
 } else {
@@ -180,6 +179,10 @@ static int vp6_parse_header(VP56Context *s, const uint8_t 
*buf, int buf_size)
 }
 
 return res;
+fail:
+if (res == VP56_SIZE_CHANGE)
+ff_set_dimensions(s->avctx, 0, 0);
+return ret;
 }
 
 static void vp6_coeff_order_table_init(VP56Context *s)
-- 
2.11.0

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


[FFmpeg-devel] [PATCH 1/3] avcodec/mpeg12dec: Fix runtime error: left shift of negative value -1

2017-03-11 Thread Michael Niedermayer
Fixes: 764/clusterfuzz-testcase-6273034652483584

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/mpeg12dec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 27db14c35e..e49167f89e 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -994,7 +994,7 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t 
block[12][64])
 
 cbp = get_vlc2(>gb, ff_mb_pat_vlc.table, MB_PAT_VLC_BITS, 1);
 if (mb_block_count > 6) {
-cbp <<= mb_block_count - 6;
+cbp *= 1 << mb_block_count - 6;
 cbp  |= get_bits(>gb, mb_block_count - 6);
 s->bdsp.clear_blocks(s->block[6]);
 }
-- 
2.11.0

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


[FFmpeg-devel] [PATCH 1/2] tests/api-seek: make the crc array uint32_t

2017-03-11 Thread James Almer
Signed-off-by: James Almer 
---
 tests/api/api-seek-test.c | 17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/tests/api/api-seek-test.c b/tests/api/api-seek-test.c
index cc3287b28f..6ef3b91933 100644
--- a/tests/api/api-seek-test.c
+++ b/tests/api/api-seek-test.c
@@ -30,17 +30,17 @@
 #include "libavutil/imgutils.h"
 
 int64_t *pts_array;
-int64_t *crc_array;
+uint32_t *crc_array;
 int size_of_array;
 int number_of_elements;
 
-static int add_crc_to_array(int64_t crc, int64_t pts)
+static int add_crc_to_array(uint32_t crc, int64_t pts)
 {
 if (size_of_array <= number_of_elements) {
 if (size_of_array == 0)
 size_of_array = 10;
 size_of_array *= 2;
-crc_array = av_realloc(crc_array, size_of_array * sizeof(int64_t));
+crc_array = av_realloc(crc_array, size_of_array * sizeof(uint32_t));
 pts_array = av_realloc(pts_array, size_of_array * sizeof(int64_t));
 if ((crc_array == NULL) || (pts_array == NULL)) {
 av_log(NULL, AV_LOG_ERROR, "Can't allocate array to store crcs\n");
@@ -53,13 +53,13 @@ static int add_crc_to_array(int64_t crc, int64_t pts)
 return 0;
 }
 
-static int compare_crc_in_array(int64_t crc, int64_t pts)
+static int compare_crc_in_array(uint32_t crc, int64_t pts)
 {
 int i;
 for (i = 0; i < number_of_elements; i++) {
 if (pts_array[i] == pts) {
 if (crc_array[i] == crc) {
-printf("Comparing 0x%08lx %"PRId64" %d is OK\n", crc, pts, i);
+printf("Comparing 0x%08"PRIx32" %"PRId64" %d is OK\n", crc, 
pts, i);
 return 0;
 }
 else {
@@ -81,7 +81,7 @@ static int compute_crc_of_packets(AVFormatContext *fmt_ctx, 
int video_stream,
 int end_of_stream = 0;
 int byte_buffer_size;
 uint8_t *byte_buffer;
-int64_t crc;
+uint32_t crc;
 AVPacket pkt;
 
 byte_buffer_size = av_image_get_buffer_size(ctx->pix_fmt, ctx->width, 
ctx->height, 16);
@@ -132,7 +132,7 @@ static int compute_crc_of_packets(AVFormatContext *fmt_ctx, 
int video_stream,
 if ((!no_seeking) && (fr->pts > ts_end))
 break;
 crc = av_adler32_update(0, (const uint8_t*)byte_buffer, 
number_of_written_bytes);
-printf("%10"PRId64", 0x%08lx\n", fr->pts, crc);
+printf("%10"PRId64", 0x%08"PRIx32"\n", fr->pts, crc);
 if (no_seeking) {
 if (add_crc_to_array(crc, fr->pts) < 0)
 return -1;
@@ -185,7 +185,8 @@ static int seek_test(const char *input_filename, const char 
*start, const char *
 
 size_of_array = 0;
 number_of_elements = 0;
-crc_array = pts_array = NULL;
+crc_array = NULL;
+pts_array = NULL;
 
 result = avformat_open_input(_ctx, input_filename, NULL, NULL);
 if (result < 0) {
-- 
2.12.0

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


[FFmpeg-devel] [PATCH 2/2] tests/api-seek: fix memory leak on realloc() failure

2017-03-11 Thread James Almer
Signed-off-by: James Almer 
---
 tests/api/api-seek-test.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/api/api-seek-test.c b/tests/api/api-seek-test.c
index 6ef3b91933..503968fa13 100644
--- a/tests/api/api-seek-test.c
+++ b/tests/api/api-seek-test.c
@@ -40,8 +40,8 @@ static int add_crc_to_array(uint32_t crc, int64_t pts)
 if (size_of_array == 0)
 size_of_array = 10;
 size_of_array *= 2;
-crc_array = av_realloc(crc_array, size_of_array * sizeof(uint32_t));
-pts_array = av_realloc(pts_array, size_of_array * sizeof(int64_t));
+crc_array = av_realloc_f(crc_array, size_of_array, sizeof(uint32_t));
+pts_array = av_realloc_f(pts_array, size_of_array, sizeof(int64_t));
 if ((crc_array == NULL) || (pts_array == NULL)) {
 av_log(NULL, AV_LOG_ERROR, "Can't allocate array to store crcs\n");
 return AVERROR(ENOMEM);
-- 
2.12.0

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


[FFmpeg-devel] [PATCH] Add XPM decoder

2017-03-11 Thread Paras Chadha
Xpm decoder was added
Also added xpm_pipe demuxer with its probe function

Signed-off-by: Paras Chadha 
---
 Changelog|   1 +
 doc/general.texi |   2 +
 libavcodec/Makefile  |   1 +
 libavcodec/allcodecs.c   |   1 +
 libavcodec/avcodec.h |   1 +
 libavcodec/codec_desc.c  |   7 +
 libavcodec/version.h |   4 +-
 libavcodec/xpmdec.c  | 426 +++
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/img2.c   |   1 +
 libavformat/img2dec.c|  10 ++
 12 files changed, 454 insertions(+), 2 deletions(-)
 create mode 100644 libavcodec/xpmdec.c

diff --git a/Changelog b/Changelog
index 13628ca..716b6ff 100644
--- a/Changelog
+++ b/Changelog
@@ -26,6 +26,7 @@ version :
 - native Opus encoder
 - ScreenPressor decoder
 - incomplete ClearVideo decoder
+- XPM decoder

 version 3.2:
 - libopenmpt demuxer
diff --git a/doc/general.texi b/doc/general.texi
index 30450c0..83f54b3 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -607,6 +607,8 @@ following image formats are supported:
 @tab WebP image format, encoding supported through external library libwebp
 @item XBM  @tab X @tab X
 @tab X BitMap image format
+@item XPM  @tab X @tab X
+@tab X PixMap image format
 @item XFace @tab X @tab X
 @tab X-Face image format
 @item XWD  @tab X @tab X
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 65ccbad..b8d7a00 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -650,6 +650,7 @@ OBJS-$(CONFIG_XFACE_ENCODER)   += xfaceenc.o xface.o
 OBJS-$(CONFIG_XL_DECODER)  += xl.o
 OBJS-$(CONFIG_XMA1_DECODER)+= wmaprodec.o wma.o wma_common.o
 OBJS-$(CONFIG_XMA2_DECODER)+= wmaprodec.o wma.o wma_common.o
+OBJS-$(CONFIG_XPM_DECODER) += xpmdec.o
 OBJS-$(CONFIG_XSUB_DECODER)+= xsubdec.o
 OBJS-$(CONFIG_XSUB_ENCODER)+= xsubenc.o
 OBJS-$(CONFIG_XWD_DECODER) += xwddec.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 074efd4..b7d03ad 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -378,6 +378,7 @@ static void register_all(void)
 REGISTER_ENCDEC (XBM,   xbm);
 REGISTER_ENCDEC (XFACE, xface);
 REGISTER_DECODER(XL,xl);
+REGISTER_DECODER(XPM,   xpm);
 REGISTER_ENCDEC (XWD,   xwd);
 REGISTER_ENCDEC (Y41P,  y41p);
 REGISTER_DECODER(YLC,   ylc);
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 30ac236..e32f579 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -439,6 +439,7 @@ enum AVCodecID {
 AV_CODEC_ID_FMVC,
 AV_CODEC_ID_SCPR,
 AV_CODEC_ID_CLEARVIDEO,
+AV_CODEC_ID_XPM,

 /* various PCM "codecs" */
 AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at the 
start of audio codecs
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 06bcfc3..88cfddb 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1591,6 +1591,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
 },
 {
+.id= AV_CODEC_ID_XPM,
+.type  = AVMEDIA_TYPE_VIDEO,
+.name  = "xpm",
+.long_name = NULL_IF_CONFIG_SMALL("XPM (X PixMap) image"),
+.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+},
+{
 .id= AV_CODEC_ID_XWD,
 .type  = AVMEDIA_TYPE_VIDEO,
 .name  = "xwd",
diff --git a/libavcodec/version.h b/libavcodec/version.h
index b00e011..3ed5a71 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,8 +28,8 @@
 #include "libavutil/version.h"

 #define LIBAVCODEC_VERSION_MAJOR  57
-#define LIBAVCODEC_VERSION_MINOR  82
-#define LIBAVCODEC_VERSION_MICRO 102
+#define LIBAVCODEC_VERSION_MINOR  83
+#define LIBAVCODEC_VERSION_MICRO 100

 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
diff --git a/libavcodec/xpmdec.c b/libavcodec/xpmdec.c
new file mode 100644
index 000..7a1f4e1
--- /dev/null
+++ b/libavcodec/xpmdec.c
@@ -0,0 +1,426 @@
+/*
+ * XPM image format
+ *
+ * Copyright (c) 2012 Paul B Mahol
+ * Copyright (c) 2017 Paras Chadha
+ *
+ * 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 

[FFmpeg-devel] [PATCH] Documentation: -vf colormatrix options

2017-03-11 Thread Katherine Frances Nagels
Hi ffmpeg-devel,

This is my first time submitting a patch, so I hope I'm on the right track.

I noticed that not all of the -vf colormatrix options described in ffmpeg
-h filter=colormatrix are included in the docs at
https://ffmpeg.org/ffmpeg-all.html#colormatrix.
Therefore, I've added the missing options.

I've attached the patch (via git format-patch -1), here are the contents
directly:

>From 0bdaddb3ab2d96a975ac29307ecd2bd7a3ab177c Mon Sep 17 00:00:00 2001
> From: Katherine Nagels 
> Date: Sun, 12 Mar 2017 09:39:47 +1300
> Subject: [PATCH] Update colormatrix values ---
> doc/filters.texi | 15 ---
> 1 file changed, 12 insertions(+), 3 deletions(-) diff --git
> a/doc/filters.texi b/doc/filters.texi
> index 192a81a..950ff81 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -5260,15 +5260,24 @@ The accepted values are:
> @item bt709
> BT.709
>
> +@item fcc
> +FCC
> +
> @item bt601
> BT.601
>
> +@item bt470
> +BT.470
> +
> +@item bt470bg
> +BT.470BG
> +
> +@item smpte170m
> +SMPTE-170M
> +
> @item smpte240m
> SMPTE-240M
>
> -@item fcc
> -FCC
> -
> @item bt2020
> BT.2020
> @end table
> --
> 2.7.4


Thank you.

Best, Katherine
From 0bdaddb3ab2d96a975ac29307ecd2bd7a3ab177c Mon Sep 17 00:00:00 2001
From: Katherine Nagels 
Date: Sun, 12 Mar 2017 09:39:47 +1300
Subject: [PATCH] Update colormatrix values

---
 doc/filters.texi | 15 ---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 192a81a..950ff81 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -5260,15 +5260,24 @@ The accepted values are:
 @item bt709
 BT.709
 
+@item fcc
+FCC
+
 @item bt601
 BT.601
 
+@item bt470
+BT.470
+
+@item bt470bg
+BT.470BG
+
+@item smpte170m
+SMPTE-170M
+
 @item smpte240m
 SMPTE-240M
 
-@item fcc
-FCC
-
 @item bt2020
 BT.2020
 @end table
-- 
2.7.4

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


Re: [FFmpeg-devel] [PATCH] avfilter/af_firequalizer: add av_restrict on convolution func

2017-03-11 Thread Muhammad Faiz
On Sat, Mar 11, 2017 at 8:05 PM, wm4  wrote:
> On Sat, 11 Mar 2017 07:56:52 +0700
> Muhammad Faiz  wrote:
>
>> slightly improved speed
>>
>> Signed-off-by: Muhammad Faiz 
>> ---
>>  libavfilter/af_firequalizer.c | 8 
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/libavfilter/af_firequalizer.c b/libavfilter/af_firequalizer.c
>> index 5c6fd54..4243d66 100644
>> --- a/libavfilter/af_firequalizer.c
>> +++ b/libavfilter/af_firequalizer.c
>> @@ -197,8 +197,8 @@ static int query_formats(AVFilterContext *ctx)
>>  return ff_set_common_samplerates(ctx, formats);
>>  }
>>
>> -static void fast_convolute(FIREqualizerContext *s, const float *kernel_buf, 
>> float *conv_buf,
>> -   OverlapIndex *idx, float *data, int nsamples)
>> +static void fast_convolute(FIREqualizerContext *av_restrict s, const float 
>> *av_restrict kernel_buf, float *av_restrict conv_buf,
>> +   OverlapIndex *av_restrict idx, float 
>> *av_restrict data, int nsamples)
>>  {
>>  if (nsamples <= s->nsamples_max) {
>>  float *buf = conv_buf + idx->buf_idx * s->rdft_len;
>> @@ -235,8 +235,8 @@ static void fast_convolute(FIREqualizerContext *s, const 
>> float *kernel_buf, floa
>>  }
>>  }
>>
>> -static void fast_convolute2(FIREqualizerContext *s, const float 
>> *kernel_buf, FFTComplex *conv_buf,
>> -OverlapIndex *idx, float *data0, float *data1, 
>> int nsamples)
>> +static void fast_convolute2(FIREqualizerContext *av_restrict s, const float 
>> *av_restrict kernel_buf, FFTComplex *av_restrict conv_buf,
>> +OverlapIndex *av_restrict idx, float 
>> *av_restrict data0, float *av_restrict data1, int nsamples)
>>  {
>>  if (nsamples <= s->nsamples_max) {
>>  FFTComplex *buf = conv_buf + idx->buf_idx * s->rdft_len;
>
> Seems ok. How much improved?

fast_convolute():
old: 791277 decicycles in fast_convolute(),   65536 runs,  0 skips
new: 775519 decicycles in fast_convolute(),   65536 runs,  0 skips

fast_convolute2():
old: 532707 decicycles in fast_convolute2(),   65535 runs,  1 skips
new: 518874 decicycles in fast_convolute2(),   65536 runs,  0 skips

Applied.

Thank's
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] Added AVX2 implementation for VP8 decoder (ff_pred16x16_tm_vp8_8_avx2)

2017-03-11 Thread Mirage Abeysekara
---
 libavcodec/x86/h264_intrapred.asm| 35 +++
 libavcodec/x86/h264_intrapred_init.c |  7 +++
 2 files changed, 42 insertions(+)

diff --git a/libavcodec/x86/h264_intrapred.asm 
b/libavcodec/x86/h264_intrapred.asm
index c88d91b..a90edc3 100644
--- a/libavcodec/x86/h264_intrapred.asm
+++ b/libavcodec/x86/h264_intrapred.asm
@@ -268,6 +268,41 @@ cglobal pred16x16_tm_vp8_8, 2,6,6
 jg .loop
 REP_RET
 
+INIT_YMM avx2
+cglobal pred16x16_tm_vp8_8, 2, 4, 5, dst, stride, stride3, iteration
+sub   dstq, strideq
+pmovzxbwm0, [dstq]
+vpbroadcastb   xm1, [r0-1]
+pmovzxbwm1, xm1
+psubw   m0, m1
+mov iterationd, 4
+lea   stride3q, [strideq*3]
+.loop:
+vpbroadcastb   xm1, [dstq+strideq*1-1]
+vpbroadcastb   xm2, [dstq+strideq*2-1]
+vpbroadcastb   xm3, [dstq+stride3q-1]
+vpbroadcastb   xm4, [dstq+strideq*4-1]
+pmovzxbwm1, xm1
+pmovzxbwm2, xm2
+pmovzxbwm3, xm3
+pmovzxbwm4, xm4
+paddw   m1, m0
+paddw   m2, m0
+paddw   m3, m0
+paddw   m4, m0
+vpackuswb   m1, m1, m2
+vpackuswb   m3, m3, m4
+vpermq  m1, m1, q3120
+vpermq  m3, m3, q3120
+movdqa[dstq+strideq*1], xm1
+vextracti128  [dstq+strideq*2], m1, 1
+movdqa   [dstq+stride3q*1], xm3
+vextracti128  [dstq+strideq*4], m3, 1
+lea   dstq, [dstq+strideq*4]
+dec iterationd
+jg .loop
+REP_RET
+
 ;-
 ; void ff_pred16x16_plane_*_8(uint8_t *src, int stride)
 ;-
diff --git a/libavcodec/x86/h264_intrapred_init.c 
b/libavcodec/x86/h264_intrapred_init.c
index 528b92e..bdd5125 100644
--- a/libavcodec/x86/h264_intrapred_init.c
+++ b/libavcodec/x86/h264_intrapred_init.c
@@ -127,6 +127,7 @@ PRED16x16(plane_svq3, 8, ssse3)
 PRED16x16(tm_vp8, 8, mmx)
 PRED16x16(tm_vp8, 8, mmxext)
 PRED16x16(tm_vp8, 8, sse2)
+PRED16x16(tm_vp8, 8, avx2)
 
 PRED8x8(top_dc, 8, mmxext)
 PRED8x8(dc_rv40, 8, mmxext)
@@ -323,6 +324,12 @@ av_cold void ff_h264_pred_init_x86(H264PredContext *h, int 
codec_id,
 }
 }
 }
+
+if(EXTERNAL_AVX2(cpu_flags)){
+if (codec_id == AV_CODEC_ID_VP8) {
+h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_tm_vp8_8_avx2;
+}
+}
 } else if (bit_depth == 10) {
 if (EXTERNAL_MMXEXT(cpu_flags)) {
 h->pred4x4[DC_PRED ] = ff_pred4x4_dc_10_mmxext;
-- 
2.7.4

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


[FFmpeg-devel] [PATCH] Added AVX2 implementation for VP8 decoder (ff_pred16x16_tm_vp8_8_avx2)

2017-03-11 Thread Mirage Abeysekara

checkasm --bench results with 5000 runs

32 bit version

pred16x16_tm_vp8_c: 298.4
pred16x16_tm_vp8_mmx: 108.9
pred16x16_tm_vp8_mmxext: 91.0
pred16x16_tm_vp8_sse2: 49.7
pred16x16_tm_vp8_avx2: 37.9


64 bit version

pred16x16_tm_vp8_c: 307.5
pred16x16_tm_vp8_mmx: 101.5
pred16x16_tm_vp8_mmxext: 89.2
pred16x16_tm_vp8_sse2: 94.2
pred16x16_tm_vp8_avx2: 37.5
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 1/2] lavf/vf_framerate: Fix frame leak when increasing framerate.

2017-03-11 Thread Alexis Ballier
---
Can be reproduced with: ffmpeg -f lavfi -i cellauto,framerate=fps=100 -t 1 -f 
null -
(and your favorite memory debugger).
---
 libavfilter/vf_framerate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_framerate.c b/libavfilter/vf_framerate.c
index 237a4873b3..b4a74f7f7d 100644
--- a/libavfilter/vf_framerate.c
+++ b/libavfilter/vf_framerate.c
@@ -526,7 +526,7 @@ static av_cold void uninit(AVFilterContext *ctx)
 FrameRateContext *s = ctx->priv;
 int i;
 
-for (i = s->frst + 1; i < s->last; i++) {
+for (i = s->frst; i < s->last; i++) {
 if (s->srce[i] && (s->srce[i] != s->srce[i + 1]))
 av_frame_free(>srce[i]);
 }
-- 
2.12.0

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


[FFmpeg-devel] [PATCH 2/2] fate: Add vf_framerate test.

2017-03-11 Thread Alexis Ballier
---
 tests/fate/filter-video.mak  |  4 
 tests/ref/fate/filter-framerate-down |  6 ++
 tests/ref/fate/filter-framerate-up   | 15 +++
 3 files changed, 25 insertions(+)
 create mode 100644 tests/ref/fate/filter-framerate-down
 create mode 100644 tests/ref/fate/filter-framerate-up

diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak
index c57c9c7d18..97c5e6c547 100644
--- a/tests/fate/filter-video.mak
+++ b/tests/fate/filter-video.mak
@@ -78,6 +78,10 @@ fate-filter-lavd-scalenorm: tests/data/filtergraphs/scalenorm
 fate-filter-lavd-scalenorm: CMD = framecrc -f lavfi -graph_file 
$(TARGET_PATH)/tests/data/filtergraphs/scalenorm -i dummy
 
 
+FATE_FILTER-$(call ALLYES FRAMERATE_FILTER TESTSRC2_FILTER) += 
fate-filter-framerate-up fate-filter-framerate-down
+fate-filter-framerate-up: CMD = framecrc -lavfi 
testsrc2=r=2:d=10,framerate=fps=10 -t 1
+fate-filter-framerate-down: CMD = framecrc -lavfi 
testsrc2=r=2:d=10,framerate=fps=1 -t 1
+
 FATE_FILTER_VSYNTH-$(CONFIG_BOXBLUR_FILTER) += fate-filter-boxblur
 fate-filter-boxblur: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf boxblur=2:1
 
diff --git a/tests/ref/fate/filter-framerate-down 
b/tests/ref/fate/filter-framerate-down
new file mode 100644
index 00..4eab7aab85
--- /dev/null
+++ b/tests/ref/fate/filter-framerate-down
@@ -0,0 +1,6 @@
+#tb 0: 1/1
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 320x240
+#sar 0: 1/1
+0,  0,  0,1,   115200, 0x3744b3ed
diff --git a/tests/ref/fate/filter-framerate-up 
b/tests/ref/fate/filter-framerate-up
new file mode 100644
index 00..b2af9cb879
--- /dev/null
+++ b/tests/ref/fate/filter-framerate-up
@@ -0,0 +1,15 @@
+#tb 0: 1/10
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 320x240
+#sar 0: 1/1
+0,  0,  0,1,   115200, 0x3744b3ed
+0,  1,  1,1,   115200, 0xc44bdc65
+0,  2,  2,1,   115200, 0xa17f0d74
+0,  3,  3,1,   115200, 0xb0c83274
+0,  4,  4,1,   115200, 0x232d6368
+0,  5,  5,1,   115200, 0x6e318ba0
+0,  6,  6,1,   115200, 0x247e846e
+0,  7,  7,1,   115200, 0x89e27599
+0,  8,  8,1,   115200, 0x31c5704e
+0,  9,  9,1,   115200, 0x97e45fec
-- 
2.12.0

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


[FFmpeg-devel] [PATCH] Added AVX2 implementation for VP8 decoder (ff_pred16x16_tm_vp8_8_avx2)

2017-03-11 Thread Mirage Abeysekara
---
 libavcodec/x86/h264_intrapred.asm| 35 +++
 libavcodec/x86/h264_intrapred_init.c |  7 +++
 2 files changed, 42 insertions(+)

diff --git a/libavcodec/x86/h264_intrapred.asm 
b/libavcodec/x86/h264_intrapred.asm
index c88d91b..a90edc3 100644
--- a/libavcodec/x86/h264_intrapred.asm
+++ b/libavcodec/x86/h264_intrapred.asm
@@ -268,6 +268,41 @@ cglobal pred16x16_tm_vp8_8, 2,6,6
 jg .loop
 REP_RET
 
+INIT_YMM avx2
+cglobal pred16x16_tm_vp8_8, 2, 4, 5, dst, stride, stride3, iteration
+sub   dstq, strideq
+pmovzxbwm0, [dstq]
+vpbroadcastb   xm1, [r0-1]
+pmovzxbwm1, xm1
+psubw   m0, m1
+mov iterationd, 4
+lea   stride3q, [strideq*3]
+.loop:
+vpbroadcastb   xm1, [dstq+strideq*1-1]
+vpbroadcastb   xm2, [dstq+strideq*2-1]
+vpbroadcastb   xm3, [dstq+stride3q-1]
+vpbroadcastb   xm4, [dstq+strideq*4-1]
+pmovzxbwm1, xm1
+pmovzxbwm2, xm2
+pmovzxbwm3, xm3
+pmovzxbwm4, xm4
+paddw   m1, m0
+paddw   m2, m0
+paddw   m3, m0
+paddw   m4, m0
+vpackuswb   m1, m1, m2
+vpackuswb   m3, m3, m4
+vpermq  m1, m1, q3120
+vpermq  m3, m3, q3120
+movdqa[dstq+strideq*1], xm1
+vextracti128  [dstq+strideq*2], m1, 1
+movdqa   [dstq+stride3q*1], xm3
+vextracti128  [dstq+strideq*4], m3, 1
+lea   dstq, [dstq+strideq*4]
+dec iterationd
+jg .loop
+REP_RET
+
 ;-
 ; void ff_pred16x16_plane_*_8(uint8_t *src, int stride)
 ;-
diff --git a/libavcodec/x86/h264_intrapred_init.c 
b/libavcodec/x86/h264_intrapred_init.c
index 528b92e..bdd5125 100644
--- a/libavcodec/x86/h264_intrapred_init.c
+++ b/libavcodec/x86/h264_intrapred_init.c
@@ -127,6 +127,7 @@ PRED16x16(plane_svq3, 8, ssse3)
 PRED16x16(tm_vp8, 8, mmx)
 PRED16x16(tm_vp8, 8, mmxext)
 PRED16x16(tm_vp8, 8, sse2)
+PRED16x16(tm_vp8, 8, avx2)
 
 PRED8x8(top_dc, 8, mmxext)
 PRED8x8(dc_rv40, 8, mmxext)
@@ -323,6 +324,12 @@ av_cold void ff_h264_pred_init_x86(H264PredContext *h, int 
codec_id,
 }
 }
 }
+
+if(EXTERNAL_AVX2(cpu_flags)){
+if (codec_id == AV_CODEC_ID_VP8) {
+h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_tm_vp8_8_avx2;
+}
+}
 } else if (bit_depth == 10) {
 if (EXTERNAL_MMXEXT(cpu_flags)) {
 h->pred4x4[DC_PRED ] = ff_pred4x4_dc_10_mmxext;
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v2] swresample/swresample: do not reset tsf on swr_alloc_set_opts

2017-03-11 Thread Muhammad Faiz
so tsf option in aresample will have effect
previously tsf/internal_sample_format had no effect

fate is updated
s32p previously used fltp internally
dblp previously used fltp/dblp internally

Signed-off-by: Muhammad Faiz 
---
 libswresample/swresample.c   |  3 --
 tests/fate/libswresample.mak | 80 ++--
 2 files changed, 40 insertions(+), 43 deletions(-)

diff --git a/libswresample/swresample.c b/libswresample/swresample.c
index dea6139..f2e6600 100644
--- a/libswresample/swresample.c
+++ b/libswresample/swresample.c
@@ -84,9 +84,6 @@ struct SwrContext *swr_alloc_set_opts(struct SwrContext *s,
 if (av_opt_set_int(s, "isr", in_sample_rate,  0) < 0)
 goto fail;
 
-if (av_opt_set_int(s, "tsf", AV_SAMPLE_FMT_NONE,   0) < 0)
-goto fail;
-
 if (av_opt_set_int(s, "ich", av_get_channel_layout_nb_channels(s-> 
user_in_ch_layout), 0) < 0)
 goto fail;
 
diff --git a/tests/fate/libswresample.mak b/tests/fate/libswresample.mak
index 78dbde7..d9e0fa9 100644
--- a/tests/fate/libswresample.mak
+++ b/tests/fate/libswresample.mak
@@ -218,28 +218,28 @@ fate-swr-resample-s32p-2626-8000: SIZE_TOLERANCE = 31512 
- 20482
 fate-swr-resample-s32p-2626-96000: CMP_TARGET = 1393.00
 fate-swr-resample-s32p-2626-96000: SIZE_TOLERANCE = 31512 - 20480
 
-fate-swr-resample-s32p-44100-2626: CMP_TARGET = 185.82
+fate-swr-resample-s32p-44100-2626: CMP_TARGET = 185.81
 fate-swr-resample-s32p-44100-2626: SIZE_TOLERANCE = 529200 - 20490
 
-fate-swr-resample-s32p-44100-48000: CMP_TARGET = 9.69
+fate-swr-resample-s32p-44100-48000: CMP_TARGET = 9.70
 fate-swr-resample-s32p-44100-48000: SIZE_TOLERANCE = 529200 - 20482
 
 fate-swr-resample-s32p-44100-8000: CMP_TARGET = 75.45
 fate-swr-resample-s32p-44100-8000: SIZE_TOLERANCE = 529200 - 20486
 
-fate-swr-resample-s32p-44100-96000: CMP_TARGET = 11.46
+fate-swr-resample-s32p-44100-96000: CMP_TARGET = 11.47
 fate-swr-resample-s32p-44100-96000: SIZE_TOLERANCE = 529200 - 20482
 
-fate-swr-resample-s32p-48000-2626: CMP_TARGET = 456.51
+fate-swr-resample-s32p-48000-2626: CMP_TARGET = 456.49
 fate-swr-resample-s32p-48000-2626: SIZE_TOLERANCE = 576000 - 20510
 
-fate-swr-resample-s32p-48000-44100: CMP_TARGET = 1.00
+fate-swr-resample-s32p-48000-44100: CMP_TARGET = 1.12
 fate-swr-resample-s32p-48000-44100: SIZE_TOLERANCE = 576000 - 20480
 
-fate-swr-resample-s32p-48000-8000: CMP_TARGET = 62.38
+fate-swr-resample-s32p-48000-8000: CMP_TARGET = 62.37
 fate-swr-resample-s32p-48000-8000: SIZE_TOLERANCE = 576000 - 20484
 
-fate-swr-resample-s32p-48000-96000: CMP_TARGET = 0.47
+fate-swr-resample-s32p-48000-96000: CMP_TARGET = 0.85
 fate-swr-resample-s32p-48000-96000: SIZE_TOLERANCE = 576000 - 20480
 
 fate-swr-resample-s32p-8000-2626: CMP_TARGET = 2503.33
@@ -248,22 +248,22 @@ fate-swr-resample-s32p-8000-2626: SIZE_TOLERANCE = 96000 
- 20486
 fate-swr-resample-s32p-8000-44100: CMP_TARGET = 15.09
 fate-swr-resample-s32p-8000-44100: SIZE_TOLERANCE = 96000 - 20480
 
-fate-swr-resample-s32p-8000-48000: CMP_TARGET = 14.69
+fate-swr-resample-s32p-8000-48000: CMP_TARGET = 14.68
 fate-swr-resample-s32p-8000-48000: SIZE_TOLERANCE = 96000 - 20480
 
 fate-swr-resample-s32p-8000-96000: CMP_TARGET = 13.81
 fate-swr-resample-s32p-8000-96000: SIZE_TOLERANCE = 96000 - 20480
 
-fate-swr-resample-s32p-96000-2626: CMP_TARGET = 675.07
+fate-swr-resample-s32p-96000-2626: CMP_TARGET = 675.05
 fate-swr-resample-s32p-96000-2626: SIZE_TOLERANCE = 1152000 - 20474
 
-fate-swr-resample-s32p-96000-44100: CMP_TARGET = 1.44
+fate-swr-resample-s32p-96000-44100: CMP_TARGET = 1.54
 fate-swr-resample-s32p-96000-44100: SIZE_TOLERANCE = 1152000 - 20480
 
-fate-swr-resample-s32p-96000-48000: CMP_TARGET = 0.99
+fate-swr-resample-s32p-96000-48000: CMP_TARGET = 1.21
 fate-swr-resample-s32p-96000-48000: SIZE_TOLERANCE = 1152000 - 20480
 
-fate-swr-resample-s32p-96000-8000: CMP_TARGET = 58.57
+fate-swr-resample-s32p-96000-8000: CMP_TARGET = 58.59
 fate-swr-resample-s32p-96000-8000: SIZE_TOLERANCE = 1152000 - 20496
 
 
@@ -440,7 +440,7 @@ fate-swr-resample_exact-dblp-8000-96000: SIZE_TOLERANCE = 
96000 - 20480
 fate-swr-resample_exact-dblp-96000-2626: CMP_TARGET = 675.07
 fate-swr-resample_exact-dblp-96000-2626: SIZE_TOLERANCE = 1152000 - 20474
 
-fate-swr-resample_exact-dblp-96000-44100: CMP_TARGET = 1.23
+fate-swr-resample_exact-dblp-96000-44100: CMP_TARGET = 1.24
 fate-swr-resample_exact-dblp-96000-44100: SIZE_TOLERANCE = 1152000 - 20480
 
 fate-swr-resample_exact-dblp-96000-48000: CMP_TARGET = 0.99
@@ -581,52 +581,52 @@ fate-swr-resample_exact-s32p-2626-8000: SIZE_TOLERANCE = 
31512 - 20482
 fate-swr-resample_exact-s32p-2626-96000: CMP_TARGET = 1393.00
 fate-swr-resample_exact-s32p-2626-96000: SIZE_TOLERANCE = 31512 - 20480
 
-fate-swr-resample_exact-s32p-44100-2626: CMP_TARGET = 185.82
+fate-swr-resample_exact-s32p-44100-2626: CMP_TARGET = 185.81
 fate-swr-resample_exact-s32p-44100-2626: SIZE_TOLERANCE = 529200 - 20490
 

[FFmpeg-devel] [PATCH 2/2] lavf: Be more explicit in logging white/black list matches

2017-03-11 Thread Alexander Strasser
The current form of the messages indicating matches in the white
or black lists seems to be a bit too much relying on context.

Make the messages more explicit.

This also matches the way codec white list errors are reported.

Signed-off-by: Alexander Strasser 
---
 libavformat/avio.c  | 4 ++--
 libavformat/utils.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavformat/avio.c b/libavformat/avio.c
index 9020aa9..0e29c61 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -179,12 +179,12 @@ int ffurl_connect(URLContext *uc, AVDictionary **options)
(uc->protocol_blacklist && !strcmp(uc->protocol_blacklist, 
e->value)));
 
 if (uc->protocol_whitelist && av_match_list(uc->prot->name, 
uc->protocol_whitelist, ',') <= 0) {
-av_log(uc, AV_LOG_ERROR, "Protocol not on whitelist '%s'!\n", 
uc->protocol_whitelist);
+av_log(uc, AV_LOG_ERROR, "Protocol (%s) not on whitelist '%s'!\n", 
uc->prot->name, uc->protocol_whitelist);
 return AVERROR(EINVAL);
 }
 
 if (uc->protocol_blacklist && av_match_list(uc->prot->name, 
uc->protocol_blacklist, ',') > 0) {
-av_log(uc, AV_LOG_ERROR, "Protocol blacklisted '%s'!\n", 
uc->protocol_blacklist);
+av_log(uc, AV_LOG_ERROR, "Protocol (%s) on blacklist '%s'!\n", 
uc->prot->name, uc->protocol_blacklist);
 return AVERROR(EINVAL);
 }
 
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 9c8287f..542357e 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -374,7 +374,7 @@ int av_demuxer_open(AVFormatContext *ic) {
 int err;
 
 if (ic->format_whitelist && av_match_list(ic->iformat->name, 
ic->format_whitelist, ',') <= 0) {
-av_log(ic, AV_LOG_ERROR, "Format not on whitelist '%s'\n", 
ic->format_whitelist);
+av_log(ic, AV_LOG_ERROR, "Format (%s) not on whitelist '%s'\n", 
ic->iformat->name, ic->format_whitelist);
 return AVERROR(EINVAL);
 }
 
@@ -554,7 +554,7 @@ int avformat_open_input(AVFormatContext **ps, const char 
*filename,
 }
 
 if (s->format_whitelist && av_match_list(s->iformat->name, 
s->format_whitelist, ',') <= 0) {
-av_log(s, AV_LOG_ERROR, "Format not on whitelist '%s'\n", 
s->format_whitelist);
+av_log(s, AV_LOG_ERROR, "Format (%s) not on whitelist '%s'\n", 
s->iformat->name, s->format_whitelist);
 ret = AVERROR(EINVAL);
 goto fail;
 }
-- 
2.7.4
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 0/2] lavf: Error reporting when matching in black/white lists

2017-03-11 Thread Alexander Strasser
Hi,

while investigating this issue filed at Debian:

  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=857369

I found that the error messages can easily be misunderstood.

Though in that particular case the first problem is the placement
of the whitelist option in front of the output.


Alexander Strasser (2):
  lavf: Remove unnecessary escaping of ' in string literals
  lavf: Be more explicit in logging white/black list matches

 libavformat/avio.c  | 4 ++--
 libavformat/utils.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

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


[FFmpeg-devel] [PATCH 1/2] lavf: Remove unnecessary escaping of ' in string literals

2017-03-11 Thread Alexander Strasser
Signed-off-by: Alexander Strasser 
---
 libavformat/avio.c  | 4 ++--
 libavformat/utils.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavformat/avio.c b/libavformat/avio.c
index 62233a6..9020aa9 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -179,12 +179,12 @@ int ffurl_connect(URLContext *uc, AVDictionary **options)
(uc->protocol_blacklist && !strcmp(uc->protocol_blacklist, 
e->value)));
 
 if (uc->protocol_whitelist && av_match_list(uc->prot->name, 
uc->protocol_whitelist, ',') <= 0) {
-av_log(uc, AV_LOG_ERROR, "Protocol not on whitelist \'%s\'!\n", 
uc->protocol_whitelist);
+av_log(uc, AV_LOG_ERROR, "Protocol not on whitelist '%s'!\n", 
uc->protocol_whitelist);
 return AVERROR(EINVAL);
 }
 
 if (uc->protocol_blacklist && av_match_list(uc->prot->name, 
uc->protocol_blacklist, ',') > 0) {
-av_log(uc, AV_LOG_ERROR, "Protocol blacklisted \'%s\'!\n", 
uc->protocol_blacklist);
+av_log(uc, AV_LOG_ERROR, "Protocol blacklisted '%s'!\n", 
uc->protocol_blacklist);
 return AVERROR(EINVAL);
 }
 
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 37d7024..9c8287f 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -374,7 +374,7 @@ int av_demuxer_open(AVFormatContext *ic) {
 int err;
 
 if (ic->format_whitelist && av_match_list(ic->iformat->name, 
ic->format_whitelist, ',') <= 0) {
-av_log(ic, AV_LOG_ERROR, "Format not on whitelist \'%s\'\n", 
ic->format_whitelist);
+av_log(ic, AV_LOG_ERROR, "Format not on whitelist '%s'\n", 
ic->format_whitelist);
 return AVERROR(EINVAL);
 }
 
@@ -554,7 +554,7 @@ int avformat_open_input(AVFormatContext **ps, const char 
*filename,
 }
 
 if (s->format_whitelist && av_match_list(s->iformat->name, 
s->format_whitelist, ',') <= 0) {
-av_log(s, AV_LOG_ERROR, "Format not on whitelist \'%s\'\n", 
s->format_whitelist);
+av_log(s, AV_LOG_ERROR, "Format not on whitelist '%s'\n", 
s->format_whitelist);
 ret = AVERROR(EINVAL);
 goto fail;
 }
-- 
2.7.4
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] avcodec/h264_direct: Fix runtime error: signed integer overflow: 2147483647 - -14133 cannot be represented in type 'int'

2017-03-11 Thread Michael Niedermayer
On Sat, Mar 11, 2017 at 05:46:31PM +0100, wm4 wrote:
> On Sat, 11 Mar 2017 14:50:42 +0100
> Michael Niedermayer  wrote:
> 
> > On Sat, Mar 11, 2017 at 02:04:25PM +0100, wm4 wrote:
> > > On Sat, 11 Mar 2017 01:26:33 +0100
> > > Michael Niedermayer  wrote:
> > >   
> > > > On Fri, Mar 10, 2017 at 04:01:36PM +0100, wm4 wrote:  
> > > > > On Fri, 10 Mar 2017 15:24:52 +0100
> > > > > Michael Niedermayer  wrote:
> > > > > 
> > > > > > Fixes: 755/clusterfuzz-testcase-5369072516595712
> > > > > > 
> > > > > > See: [FFmpeg-devel] [PATCH 1/2] avcodec/h264_direct: Fix runtime 
> > > > > > error: signed integer overflow: 2147483647 - -14133 cannot be 
> > > > > > represented in type 'int'
> > > > > > 
> > > > > > Found-by: continuous fuzzing process 
> > > > > > https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
> > > > > > Signed-off-by: Michael Niedermayer 
> > > > > > ---
> > > > > >  libavcodec/h264_direct.c | 7 ++-
> > > > > >  1 file changed, 6 insertions(+), 1 deletion(-)
> > > > > > 
> > > > > > diff --git a/libavcodec/h264_direct.c b/libavcodec/h264_direct.c
> > > > > > index cbb84665b3..66e54479d1 100644
> > > > > > --- a/libavcodec/h264_direct.c
> > > > > > +++ b/libavcodec/h264_direct.c
> > > > > > @@ -39,7 +39,12 @@ static int get_scale_factor(H264SliceContext *sl,
> > > > > >  int poc, int poc1, int i)
> > > > > >  {
> > > > > >  int poc0 = sl->ref_list[0][i].poc;
> > > > > > -int td = av_clip_int8(poc1 - poc0);
> > > > > > +int64_t pocdiff = poc1 - (int64_t)poc0;
> > > > > > +int td = av_clip_int8(pocdiff);
> > > > > > +
> > > > > > +if (pocdiff != (int)pocdiff)
> > > > > > +avpriv_request_sample(sl->h264->avctx, "pocdiff 
> > > > > > overflow\n");
> > > > > > +
> > > > > >  if (td == 0 || sl->ref_list[0][i].parent->long_ref) {
> > > > > >  return 256;
> > > > > >  } else {
> > > > > 
> > > > > Hard to image that these poc values aren't bounded by something else,
> > > > > but I don't know.
> > > >   
> > > > > 
> > > > > Also the previous patch didn't have this request_sample call, which
> > > > > inflates this whole thing by 5 lines of code.
> > > > 
> > > > yes thats why i suggested it initially.
> > > > SUINT allows overflow detection simply by  #define CHECKED 1
> > > > and running under ubsan
> > > > 
> > > > otherwise an excplicit check is needed to detect such occurances  
> > > 
> > > You can either
> > > 1. ignore the error in some way that doesn't cause problems
> > > 2. ignore the error in some way that doesn't cause problems in debug
> > >mode
> > > 3. make the error explicit and log it
> > > 
> > > Your first patch did 2 (which I find questionable, btw.), your current  
> > 
> > My first patch should have done 1, why do you think it does not?
> 
> Well, it still allows the signed overflow, but only in release mode. Or

i think you misread the code, the signed overflow is only possible
when CHECKED is enabled, its not enabled in release mode.
It is enabled in DEBUG mode so ubsan can be used to find such overflows
easily while there is no undefined behavior normally or in any default
build.


> do you want this patch only to make ubsan happy? (If it's not UB, why
> does ubsan warn?)

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Old school: Use the lowest level language in which you can solve the problem
conveniently.
New school: Use the highest level language in which the latest supercomputer
can solve the problem without the user falling asleep waiting.


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/vf_interlace: add complex vertcal lowpassfilter

2017-03-11 Thread James Almer
On 3/11/2017 12:39 PM, Thomas Mundt wrote:
>> James Almer  schrieb am Fr, 10.3.2017:
>>> On 3/8/2017 1:58 PM, Thomas Mundt wrote:
>>> Hi,
>>>
>>> attached patch adds a complex (-1 2 6 2 -1) vertcal lowpassfilter to 
>>> vf_interlace. This will better retain detail and reduce blurring compared 
>>> to the existing (1 2 1) filter.
>>>
>>> Please comment.
>>> diff --git a/libavfilter/interlace.h b/libavfilter/interlace.h
>>> index da073ae..7ad457e 100644
>>> --- a/libavfilter/interlace.h
>>> +++ b/libavfilter/interlace.h
>>> @@ -51,6 +51,8 @@ typedef struct InterlaceContext {
>>>  AVFrame *cur, *next;   // the two frames from which the new one is 
>>> obtained
>>>  void (*lowpass_line)(uint8_t *dstp, ptrdiff_t linesize, const uint8_t 
>>> *srcp,
>>>   const uint8_t *srcp_above, const uint8_t 
>>> *srcp_below);
>>> +void (*lowpass_line_complex)(uint8_t *dstp, ptrdiff_t linesize,
>>> + const uint8_t *srcp, int mref, int pref);
>>
>> Why not keep a single prototype, passing mref and pref for both linear
>> and complex? You can calculate srcp_above and srcp_below for linear like
>> you're doing it for complex in both the c and asm versions.
>>
> 
> This would make sense. I just didn´t wanted to change more than necessary in 
> one patch and I´m not such an expert in simd programming.
> This is my second attempt ever.
> Also there is the same function in tinterlace filter that also uses this asm. 
> So I would also need to change the function in tinterlace.

Yes, this would need separate patches. One to change the prototype,
c and asm versions of the linear function for both filters, then
another (One per interlace filter or one for both) adding the
complex lowpass filter.

> I could do all this as a subsequent patch. Do you have a suggestion how to 
> deal with the option name of complex filter in tinterlace?
> There it´s a flag with the names "low_pass_filter" and "vlpf", so I could add 
> "complex_low_pass_filter" and "vclpf"?

With flags you could in theory enable both linear and complex at
the same time, so you'd need to add code to abort in such cases
or default to one of them.
I'd say add a lowpass option similar to vf_interlace's, and leave
the flags as is.

___
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  wrote:

> On 3/11/17, Sanchit Sinha  wrote:
> > On Sat, Mar 11, 2017 at 9:46 PM, Sanchit Sinha  >
> > 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 
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 
---
 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++){
+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 * 

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

2017-03-11 Thread Paul B Mahol
On 3/11/17, Sanchit Sinha  wrote:
> On Sat, Mar 11, 2017 at 9:46 PM, Sanchit Sinha 
> 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


Re: [FFmpeg-devel] [PATCH] swresample/swresample: do not reset tsf on swr_alloc_set_opts

2017-03-11 Thread Muhammad Faiz
On Sat, Mar 11, 2017 at 8:41 PM, Michael Niedermayer
 wrote:
> On Fri, Mar 10, 2017 at 06:55:27AM +0700, Muhammad Faiz wrote:
>> so tsf option in aresample will have effect
>>
>> Signed-off-by: Muhammad Faiz 
>
> breaks fate
>
> TESTswr-resample-s32p-96000-44100
> stddev:1.54 PSNR: 92.56 MAXDIFF:  116 bytes:  1152000/20480
> stddev: |1.54 - 1.44| >= 0.1
> Test swr-resample-s32p-96000-44100 failed. Look at 
> tests/data/fate/swr-resample-s32p-96000-44100.err for details.

The cause probably is that previously it used fltp internally.
I check it using this
./ffmpeg -loglevel debug -i tests/data/asynth-44100-1.wav -af
"aresample=48000:internal_sample_fmt=s32p,aformat=s32p,aresample=44100:internal_sample_fmt=s32p"
-f wav -acodec pcm_s16le -y /dev/null

before patch:
[Parsed_aresample_0 @ 0x296f5e0] [SWR @ 0x296fb80] Using fltp
internally between filters
[Parsed_aresample_0 @ 0x296f5e0] ch:1 chl:mono fmt:s16 r:44100Hz ->
ch:1 chl:mono fmt:s32p r:48000Hz
[Parsed_aresample_2 @ 0x2984f60] [SWR @ 0x2985960] Using fltp
internally between filters
[Parsed_aresample_2 @ 0x2984f60] ch:1 chl:mono fmt:s32p r:48000Hz ->
ch:1 chl:mono fmt:s16 r:44100Hz

after patch:
[Parsed_aresample_0 @ 0x3ccf5e0] [SWR @ 0x3ccfb80] Using s32p
internally between filters
[Parsed_aresample_0 @ 0x3ccf5e0] ch:1 chl:mono fmt:s16 r:44100Hz ->
ch:1 chl:mono fmt:s32p r:48000Hz
[Parsed_aresample_2 @ 0x3ce4f60] [SWR @ 0x3ce5960] Using s32p
internally between filters
[Parsed_aresample_2 @ 0x3ce4f60] ch:1 chl:mono fmt:s32p r:48000Hz ->
ch:1 chl:mono fmt:s16 r:44100Hz


I will post updated patch that modify fate

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


Re: [FFmpeg-devel] [PATCH 2/2] avcodec/h264_direct: Fix runtime error: signed integer overflow: 2147483647 - -14133 cannot be represented in type 'int'

2017-03-11 Thread wm4
On Sat, 11 Mar 2017 14:50:42 +0100
Michael Niedermayer  wrote:

> On Sat, Mar 11, 2017 at 02:04:25PM +0100, wm4 wrote:
> > On Sat, 11 Mar 2017 01:26:33 +0100
> > Michael Niedermayer  wrote:
> >   
> > > On Fri, Mar 10, 2017 at 04:01:36PM +0100, wm4 wrote:  
> > > > On Fri, 10 Mar 2017 15:24:52 +0100
> > > > Michael Niedermayer  wrote:
> > > > 
> > > > > Fixes: 755/clusterfuzz-testcase-5369072516595712
> > > > > 
> > > > > See: [FFmpeg-devel] [PATCH 1/2] avcodec/h264_direct: Fix runtime 
> > > > > error: signed integer overflow: 2147483647 - -14133 cannot be 
> > > > > represented in type 'int'
> > > > > 
> > > > > Found-by: continuous fuzzing process 
> > > > > https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
> > > > > Signed-off-by: Michael Niedermayer 
> > > > > ---
> > > > >  libavcodec/h264_direct.c | 7 ++-
> > > > >  1 file changed, 6 insertions(+), 1 deletion(-)
> > > > > 
> > > > > diff --git a/libavcodec/h264_direct.c b/libavcodec/h264_direct.c
> > > > > index cbb84665b3..66e54479d1 100644
> > > > > --- a/libavcodec/h264_direct.c
> > > > > +++ b/libavcodec/h264_direct.c
> > > > > @@ -39,7 +39,12 @@ static int get_scale_factor(H264SliceContext *sl,
> > > > >  int poc, int poc1, int i)
> > > > >  {
> > > > >  int poc0 = sl->ref_list[0][i].poc;
> > > > > -int td = av_clip_int8(poc1 - poc0);
> > > > > +int64_t pocdiff = poc1 - (int64_t)poc0;
> > > > > +int td = av_clip_int8(pocdiff);
> > > > > +
> > > > > +if (pocdiff != (int)pocdiff)
> > > > > +avpriv_request_sample(sl->h264->avctx, "pocdiff overflow\n");
> > > > > +
> > > > >  if (td == 0 || sl->ref_list[0][i].parent->long_ref) {
> > > > >  return 256;
> > > > >  } else {
> > > > 
> > > > Hard to image that these poc values aren't bounded by something else,
> > > > but I don't know.
> > >   
> > > > 
> > > > Also the previous patch didn't have this request_sample call, which
> > > > inflates this whole thing by 5 lines of code.
> > > 
> > > yes thats why i suggested it initially.
> > > SUINT allows overflow detection simply by  #define CHECKED 1
> > > and running under ubsan
> > > 
> > > otherwise an excplicit check is needed to detect such occurances  
> > 
> > You can either
> > 1. ignore the error in some way that doesn't cause problems
> > 2. ignore the error in some way that doesn't cause problems in debug
> >mode
> > 3. make the error explicit and log it
> > 
> > Your first patch did 2 (which I find questionable, btw.), your current  
> 
> My first patch should have done 1, why do you think it does not?

Well, it still allows the signed overflow, but only in release mode. Or
do you want this patch only to make ubsan happy? (If it's not UB, why
does ubsan warn?)

___
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 9:46 PM, Sanchit Sinha 
wrote:

>
>
>
>
>
> On Sat, Mar 11, 2017 at 9:18 PM, Paul B Mahol  wrote:
>
>> On 3/11/17, Sanchit Sinha  wrote:
>> > On Sat, Mar 11, 2017 at 5:57 PM, Paul B Mahol  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 
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 
---
 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->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 * 

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  wrote:

> On 3/11/17, Sanchit Sinha  wrote:
> > On Sat, Mar 11, 2017 at 5:57 PM, Paul B Mahol  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 
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 
---
 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]);
+		c1[itr] = lf;
+		c2[itr] = rf;
+		c3[itr] = lb;
+		c4[itr] = rb;
+	}
+	if (out != in)
+	av_frame_free();
+	return ff_filter_frame(outlink, out);
+}
+static const 

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

2017-03-11 Thread Paul B Mahol
On 3/11/17, Sanchit Sinha  wrote:
> On Sat, Mar 11, 2017 at 5:57 PM, Paul B Mahol  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


Re: [FFmpeg-devel] [PATCH] avfilter/vf_interlace: add complex vertcal lowpassfilter

2017-03-11 Thread Thomas Mundt
> James Almer  schrieb am Fr, 10.3.2017:
>> On 3/8/2017 1:58 PM, Thomas Mundt wrote:
>> Hi,
>> 
>> attached patch adds a complex (-1 2 6 2 -1) vertcal lowpassfilter to 
>> vf_interlace. This will better retain detail and reduce blurring compared to 
>> the existing (1 2 1) filter.
>> 
>> Please comment.
>> diff --git a/libavfilter/interlace.h b/libavfilter/interlace.h
>> index da073ae..7ad457e 100644
>> --- a/libavfilter/interlace.h
>> +++ b/libavfilter/interlace.h
>> @@ -51,6 +51,8 @@ typedef struct InterlaceContext {
>>  AVFrame *cur, *next;   // the two frames from which the new one is 
>> obtained
>>  void (*lowpass_line)(uint8_t *dstp, ptrdiff_t linesize, const uint8_t 
>> *srcp,
>>   const uint8_t *srcp_above, const uint8_t 
>> *srcp_below);
>> +void (*lowpass_line_complex)(uint8_t *dstp, ptrdiff_t linesize,
>> + const uint8_t *srcp, int mref, int pref);
> 
> Why not keep a single prototype, passing mref and pref for both linear
> and complex? You can calculate srcp_above and srcp_below for linear like
> you're doing it for complex in both the c and asm versions.
> 

This would make sense. I just didn´t wanted to change more than necessary in 
one patch and I´m not such an expert in simd programming.
This is my second attempt ever.
Also there is the same function in tinterlace filter that also uses this asm. 
So I would also need to change the function in tinterlace.
I could do all this as a subsequent patch. Do you have a suggestion how to deal 
with the option name of complex filter in tinterlace?
There it´s a flag with the names "low_pass_filter" and "vlpf", so I could add 
"complex_low_pass_filter" and "vclpf"?

> In any case, mref and pref should be ptrdiff_t and not int.

OK, I´ll change this in patch v2.

> 
>>  } InterlaceContext;
>>  
>>  void ff_interlace_init_x86(InterlaceContext *interlace);
>> diff --git a/libavfilter/vf_interlace.c b/libavfilter/vf_interlace.c
>> index efa3128..e8d5de4 100644
>> --- a/libavfilter/vf_interlace.c
>> +++ b/libavfilter/vf_interlace.c
>> @@ -47,7 +47,7 @@ static const AVOption interlace_options[] = {
>>  { "bff", "bottom field first", 0,
>>  AV_OPT_TYPE_CONST, {.i64 = MODE_BFF }, INT_MIN, INT_MAX, .flags = 
>> FLAGS, .unit = "scan" },
>>  { "lowpass", "set vertical low-pass filter", OFFSET(lowpass),
>> -AV_OPT_TYPE_BOOL,  {.i64 = 1 },0, 1, .flags = FLAGS },
>> +AV_OPT_TYPE_INT,   {.i64 = 1 },0, 2, .flags = FLAGS },
> 
> Maybe add AV_OPT_TYPE_CONST values "off", "linear" and "complex".

OK

>>  { NULL }
>>  };
>>  
>> @@ -67,6 +67,24 @@ static void lowpass_line_c(uint8_t *dstp, ptrdiff_t 
>> linesize,
>>  }
>> +%endmacro
>> +
>> +%macro LOWPASS_LINE_COMPLEX 0
>> +cglobal lowpass_line_complex, 3, 5, 7, dst, h, src, mref, pref
> 
> Make this 5, 5, 7 and remove the two movs below.

OK, I´ll change this in patch v2.

>> +mov r3, mrefmp
>> +mov r4, prefmp
>> +
>> +pxor m6, m6
>> +.loop:
>> +mova m0, [srcq+r3]
> 
> [srcq+mrefq]

OK

>> +mova m2, [srcq+r4]
>
> [srcq+prefq]

OK

>> +mova m1, m0
>> +mova m3, m2
>> +punpcklbw m0, m6
>> +punpcklbw m2, m6
>> +punpckhbw m1, m6
>> +punpckhbw m3, m6
>> +paddw m0, m2
>> +paddw m1, m3
>> +mova m2, [srcq+r3*2]
> 
> [srcq+mrefq*2]

OK

>> +mova m4, [srcq+r4*2]

> [srcq+prefq*2]

OK

>> +add dstq, mmsize
>> +add srcq, mmsize
>> +sub DWORD hm, mmsize
> 
> sub hd, mmsize

OK

>> +
>> +INIT_XMM sse2
>> +LOWPASS_LINE_COMPLEX
>> +
>> +INIT_XMM avx
>> +LOWPASS_LINE_COMPLEX
> 
> There's no reason to add an AVX version. You're not taking advantage of
> the 3 operand instruction format, or any of the new instructions, or the
> 32 byte regs.
> 
> If you merge some of the movas with punpck* instructions and can notice
> a difference when benching, then AVX would make sense.
> 

OK. Speed improvement is marginal so I´ll drop AVX version in patch v2

>> diff --git a/libavfilter/x86/vf_interlace_init.c 
>> b/libavfilter/x86/vf_interlace_init.c
>> index 52a22f8..947ff9a 100644
>> --- a/libavfilter/x86/vf_interlace_init.c
>> +++ b/libavfilter/x86/vf_interlace_init.c
>> @@ -35,12 +35,21 @@ void ff_lowpass_line_avx (uint8_t *dstp, ptrdiff_t 
>> linesize,
>>const uint8_t *srcp_above,
>>const uint8_t *srcp_below);
>>  
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavf/dashenc: update bitrates on dash_write_trailer

2017-03-11 Thread Michael Niedermayer
On Fri, Mar 10, 2017 at 04:27:54PM +0100, Przemysław Sobala wrote:
> On Wed, Mar 8, 2017 at 9:27 AM, Przemysław Sobala <
> przemyslaw.sob...@gmail.com> wrote:
> 
> > On Fri, Mar 3, 2017 at 9:38 AM, Przemysław Sobala <
> > przemyslaw.sob...@gmail.com> wrote:
> >
> >> From: Przemysław Sobala 
> >>
> >> Provides a way to change bandwidth parameter inside DASH manifest after a
> >> non-CBR H.264 encoding.
> >> Caller now is able to compute the bitrate by itself, after all packets
> >> have been written, and then set that value in 
> >> AVFormatContext->streams->codecpar->bit_rate
> >> before calling av_write_trailer. As a result that value will be set in DASH
> >> manifest.
> >> ---
> >>  libavformat/dashenc.c | 42 ++
> >>  1 file changed, 30 insertions(+), 12 deletions(-)
> >>
> >> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
> >> index fa56505..011d2ea 100644
> >> --- a/libavformat/dashenc.c
> >> +++ b/libavformat/dashenc.c
> >> @@ -561,6 +561,30 @@ static int write_manifest(AVFormatContext *s, int
> >> final)
> >>  return 0;
> >>  }
> >>
> >> +static int set_bitrate(AVFormatContext *s)
> >> +{
> >> +DASHContext *c = s->priv_data;
> >> +int i;
> >> +
> >> +for (i = 0; i < s->nb_streams; i++) {
> >> +OutputStream *os = >streams[i];
> >> +
> >> +os->bit_rate = s->streams[i]->codecpar->bit_rate;
> >> +if (os->bit_rate) {
> >> +snprintf(os->bandwidth_str, sizeof(os->bandwidth_str),
> >> + " bandwidth=\"%d\"", os->bit_rate);
> >> +} else {
> >> +int level = s->strict_std_compliance >= FF_COMPLIANCE_STRICT
> >> ?
> >> +AV_LOG_ERROR : AV_LOG_WARNING;
> >> +av_log(s, level, "No bit rate set for stream %d\n", i);
> >> +if (s->strict_std_compliance >= FF_COMPLIANCE_STRICT)
> >> +return AVERROR(EINVAL);
> >> +}
> >> +}
> >> +
> >> +return 0;
> >> +}
> >> +
> >>  static int dash_init(AVFormatContext *s)
> >>  {
> >>  DASHContext *c = s->priv_data;
> >> @@ -597,6 +621,10 @@ static int dash_init(AVFormatContext *s)
> >>  if (!c->streams)
> >>  return AVERROR(ENOMEM);
> >>
> >> +ret = set_bitrate(s);
> >> +if (ret < 0)
> >> +return ret;
> >> +
> >>  for (i = 0; i < s->nb_streams; i++) {
> >>  OutputStream *os = >streams[i];
> >>  AVFormatContext *ctx;
> >> @@ -604,18 +632,6 @@ static int dash_init(AVFormatContext *s)
> >>  AVDictionary *opts = NULL;
> >>  char filename[1024];
> >>
> >> -os->bit_rate = s->streams[i]->codecpar->bit_rate;
> >> -if (os->bit_rate) {
> >> -snprintf(os->bandwidth_str, sizeof(os->bandwidth_str),
> >> - " bandwidth=\"%d\"", os->bit_rate);
> >> -} else {
> >> -int level = s->strict_std_compliance >= FF_COMPLIANCE_STRICT
> >> ?
> >> -AV_LOG_ERROR : AV_LOG_WARNING;
> >> -av_log(s, level, "No bit rate set for stream %d\n", i);
> >> -if (s->strict_std_compliance >= FF_COMPLIANCE_STRICT)
> >> -return AVERROR(EINVAL);
> >> -}
> >> -
> >>  ctx = avformat_alloc_context();
> >>  if (!ctx)
> >>  return AVERROR(ENOMEM);
> >> @@ -981,6 +997,8 @@ static int dash_write_trailer(AVFormatContext *s)
> >>  {
> >>  DASHContext *c = s->priv_data;
> >>
> >> +set_bitrate(s);
> >> +
> >>  if (s->nb_streams > 0) {
> >>  OutputStream *os = >streams[0];
> >>  // If no segments have been written so far, try to do a crude
> >> --
> >> 2.7.4
> >>
> >>
> > ping
> >
> >
> ping, 7 days timeout
> can anyone tak a look at this?
> [
> http://ffmpeg.org/developer.html#Always-wait-long-enough-before-pushing-changes
> ]

applied

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is what and why we do it that matters, not just one of them.


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavf/vf_framerate: Fix frame leak when increasing framerate.

2017-03-11 Thread Michael Niedermayer
On Thu, Mar 09, 2017 at 08:44:21PM +0100, Alexis Ballier wrote:
> ---
> Can be reproduced with: ffmpeg -f lavfi -i cellauto,framerate=fps=100 -t 1 -f 
> null -
> (and your favorite memory debugger).

please add a fate test, one of our fate clients runs with valgrind
so leaks would be detected

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v3 3/3] avcodec: estimate output bitrate for ffv1/huffyuv codecs

2017-03-11 Thread Michael Niedermayer
On Tue, Mar 07, 2017 at 03:39:19PM +0100, Tobias Rapp wrote:
> Allows to get a more realistic total bitrate (and estimated file size)
> in avi_write_header. Previously a static default value of 200k was
> assumed.
> 
> Signed-off-by: Tobias Rapp 
> ---
>  libavcodec/ffv1enc.c   | 3 +++
>  libavcodec/huffyuvenc.c| 3 +++
>  tests/ref/vsynth/vsynth1-ffv1  | 2 +-
>  tests/ref/vsynth/vsynth1-ffv1-v0   | 2 +-
>  tests/ref/vsynth/vsynth1-ffv1-v3-bgr0  | 2 +-
>  tests/ref/vsynth/vsynth1-ffv1-v3-rgb48 | 2 +-
>  tests/ref/vsynth/vsynth1-ffv1-v3-yuv420p   | 2 +-
>  tests/ref/vsynth/vsynth1-ffv1-v3-yuv422p10 | 2 +-
>  tests/ref/vsynth/vsynth1-ffv1-v3-yuv444p16 | 2 +-
>  tests/ref/vsynth/vsynth1-ffvhuff   | 2 +-
>  tests/ref/vsynth/vsynth1-ffvhuff420p12 | 2 +-
>  tests/ref/vsynth/vsynth1-ffvhuff422p10left | 2 +-
>  tests/ref/vsynth/vsynth1-ffvhuff444| 2 +-
>  tests/ref/vsynth/vsynth1-ffvhuff444p16 | 2 +-
>  tests/ref/vsynth/vsynth1-huffyuv   | 2 +-
>  tests/ref/vsynth/vsynth1-huffyuvbgr24  | 2 +-
>  tests/ref/vsynth/vsynth1-huffyuvbgra   | 2 +-
>  tests/ref/vsynth/vsynth2-ffv1  | 2 +-
>  tests/ref/vsynth/vsynth2-ffv1-v0   | 2 +-
>  tests/ref/vsynth/vsynth2-ffv1-v3-bgr0  | 2 +-
>  tests/ref/vsynth/vsynth2-ffv1-v3-rgb48 | 2 +-
>  tests/ref/vsynth/vsynth2-ffv1-v3-yuv420p   | 2 +-
>  tests/ref/vsynth/vsynth2-ffv1-v3-yuv422p10 | 2 +-
>  tests/ref/vsynth/vsynth2-ffv1-v3-yuv444p16 | 2 +-
>  tests/ref/vsynth/vsynth2-ffvhuff   | 2 +-
>  tests/ref/vsynth/vsynth2-ffvhuff420p12 | 2 +-
>  tests/ref/vsynth/vsynth2-ffvhuff422p10left | 2 +-
>  tests/ref/vsynth/vsynth2-ffvhuff444| 2 +-
>  tests/ref/vsynth/vsynth2-ffvhuff444p16 | 2 +-
>  tests/ref/vsynth/vsynth2-huffyuv   | 2 +-
>  tests/ref/vsynth/vsynth2-huffyuvbgr24  | 2 +-
>  tests/ref/vsynth/vsynth2-huffyuvbgra   | 2 +-
>  tests/ref/vsynth/vsynth3-ffv1  | 2 +-
>  tests/ref/vsynth/vsynth3-ffv1-v0   | 2 +-
>  tests/ref/vsynth/vsynth3-ffv1-v3-bgr0  | 2 +-
>  tests/ref/vsynth/vsynth3-ffv1-v3-rgb48 | 2 +-
>  tests/ref/vsynth/vsynth3-ffv1-v3-yuv420p   | 2 +-
>  tests/ref/vsynth/vsynth3-ffv1-v3-yuv422p10 | 2 +-
>  tests/ref/vsynth/vsynth3-ffv1-v3-yuv444p16 | 2 +-
>  tests/ref/vsynth/vsynth3-ffvhuff   | 2 +-
>  tests/ref/vsynth/vsynth3-ffvhuff420p12 | 2 +-
>  tests/ref/vsynth/vsynth3-ffvhuff422p10left | 2 +-
>  tests/ref/vsynth/vsynth3-ffvhuff444| 2 +-
>  tests/ref/vsynth/vsynth3-ffvhuff444p16 | 2 +-
>  tests/ref/vsynth/vsynth3-huffyuv   | 2 +-
>  tests/ref/vsynth/vsynth3-huffyuvbgr24  | 2 +-
>  tests/ref/vsynth/vsynth3-huffyuvbgra   | 2 +-
>  tests/ref/vsynth/vsynth_lena-ffv1  | 2 +-
>  tests/ref/vsynth/vsynth_lena-ffv1-v0   | 2 +-
>  tests/ref/vsynth/vsynth_lena-ffv1-v3-bgr0  | 2 +-
>  tests/ref/vsynth/vsynth_lena-ffv1-v3-rgb48 | 2 +-
>  tests/ref/vsynth/vsynth_lena-ffv1-v3-yuv420p   | 2 +-
>  tests/ref/vsynth/vsynth_lena-ffv1-v3-yuv422p10 | 2 +-
>  tests/ref/vsynth/vsynth_lena-ffv1-v3-yuv444p16 | 2 +-
>  tests/ref/vsynth/vsynth_lena-ffvhuff   | 2 +-
>  tests/ref/vsynth/vsynth_lena-ffvhuff420p12 | 2 +-
>  tests/ref/vsynth/vsynth_lena-ffvhuff422p10left | 2 +-
>  tests/ref/vsynth/vsynth_lena-ffvhuff444| 2 +-
>  tests/ref/vsynth/vsynth_lena-ffvhuff444p16 | 2 +-
>  tests/ref/vsynth/vsynth_lena-huffyuv   | 2 +-
>  tests/ref/vsynth/vsynth_lena-huffyuvbgr24  | 2 +-
>  tests/ref/vsynth/vsynth_lena-huffyuvbgra   | 2 +-
>  62 files changed, 66 insertions(+), 60 deletions(-)
> 
> diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
> index 35f54c6..b57e8ba 100644
> --- a/libavcodec/ffv1enc.c
> +++ b/libavcodec/ffv1enc.c
> @@ -894,6 +894,9 @@ slices_ok:
>  }
>  }
>  
> +// estimate compressed bitrate assuming 40% output size
> +avctx->bit_rate = ff_guess_coded_bitrate(avctx) * 2 / 5;
> +
>  return 0;
>  }
>  
> diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c
> index 89639b7..ddbaf14 100644
> --- a/libavcodec/huffyuvenc.c
> +++ b/libavcodec/huffyuvenc.c
> @@ -446,6 +446,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
>  
>  s->picture_number=0;
>  
> +// estimate compressed bitrate assuming 60% output size
> +avctx->bit_rate = ff_guess_coded_bitrate(avctx) * 3 / 5;

i dont like this, the value is basically random, and not the bitrate

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

When the tyrant has disposed of foreign enemies by conquest or treaty, and
there is nothing more to fear from them, then he is always stirring up
some war or other, in order that the people may require a leader. -- Plato



Re: [FFmpeg-devel] [PATCH v3 2/3] avcodec: estimate output bitrate for uncompressed video codecs

2017-03-11 Thread Michael Niedermayer
On Tue, Mar 07, 2017 at 03:39:18PM +0100, Tobias Rapp wrote:
> Allows to get a more realistic total bitrate (and estimated file size)
> in avi_write_header. Previously a static default value of 200k was
> assumed.
> 
> Adds an internal helper function for bitrate guessing.
> 
> Signed-off-by: Tobias Rapp 
> ---
>  libavcodec/internal.h|  6 ++
>  libavcodec/r210enc.c | 15 +++
>  libavcodec/rawenc.c  |  2 ++
>  libavcodec/utils.c   | 21 +
>  libavcodec/v210enc.c |  3 +++
>  libavcodec/v308enc.c |  3 +++
>  libavcodec/v408enc.c |  2 ++
>  libavcodec/v410enc.c |  3 +++
>  libavcodec/y41penc.c |  1 +
>  tests/ref/fate/v410enc   |  2 +-
>  tests/ref/vsynth/vsynth1-bpp1|  2 +-
>  tests/ref/vsynth/vsynth1-bpp15   |  2 +-
>  tests/ref/vsynth/vsynth1-r210|  2 +-
>  tests/ref/vsynth/vsynth1-rgb |  2 +-
>  tests/ref/vsynth/vsynth1-v210|  2 +-
>  tests/ref/vsynth/vsynth1-v210-10 |  2 +-
>  tests/ref/vsynth/vsynth1-v308|  2 +-
>  tests/ref/vsynth/vsynth1-v408|  2 +-
>  tests/ref/vsynth/vsynth1-y41p|  2 +-
>  tests/ref/vsynth/vsynth1-yuv |  2 +-
>  tests/ref/vsynth/vsynth2-bpp1|  2 +-
>  tests/ref/vsynth/vsynth2-bpp15   |  2 +-
>  tests/ref/vsynth/vsynth2-r210|  2 +-
>  tests/ref/vsynth/vsynth2-rgb |  2 +-
>  tests/ref/vsynth/vsynth2-v210|  2 +-
>  tests/ref/vsynth/vsynth2-v210-10 |  2 +-
>  tests/ref/vsynth/vsynth2-v308|  2 +-
>  tests/ref/vsynth/vsynth2-v408|  2 +-
>  tests/ref/vsynth/vsynth2-y41p|  2 +-
>  tests/ref/vsynth/vsynth2-yuv |  2 +-
>  tests/ref/vsynth/vsynth3-bpp1|  2 +-
>  tests/ref/vsynth/vsynth3-bpp15   |  2 +-
>  tests/ref/vsynth/vsynth3-r210|  2 +-
>  tests/ref/vsynth/vsynth3-rgb |  2 +-
>  tests/ref/vsynth/vsynth3-v210|  2 +-
>  tests/ref/vsynth/vsynth3-v210-10 |  2 +-
>  tests/ref/vsynth/vsynth3-v308|  2 +-
>  tests/ref/vsynth/vsynth3-v408|  2 +-
>  tests/ref/vsynth/vsynth3-yuv |  2 +-
>  tests/ref/vsynth/vsynth_lena-bpp1|  2 +-
>  tests/ref/vsynth/vsynth_lena-bpp15   |  2 +-
>  tests/ref/vsynth/vsynth_lena-r210|  2 +-
>  tests/ref/vsynth/vsynth_lena-rgb |  2 +-
>  tests/ref/vsynth/vsynth_lena-v210|  2 +-
>  tests/ref/vsynth/vsynth_lena-v210-10 |  2 +-
>  tests/ref/vsynth/vsynth_lena-v308|  2 +-
>  tests/ref/vsynth/vsynth_lena-v408|  2 +-
>  tests/ref/vsynth/vsynth_lena-y41p|  2 +-
>  tests/ref/vsynth/vsynth_lena-yuv |  2 +-
>  49 files changed, 96 insertions(+), 40 deletions(-)

should be ok

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No snowflake in an avalanche ever feels responsible. -- Voltaire


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v3 1/3] ffmpeg: set the encoding framerate when the output is CFR

2017-03-11 Thread Michael Niedermayer
On Tue, Mar 07, 2017 at 03:39:17PM +0100, Tobias Rapp wrote:
> From: Anton Khirnov 
> 
> (cherry picked from Libav commit d10102d23c9467d4eb84f58e0cd12be284b982f6)
> 
> Signed-off-by: Tobias Rapp 
> ---
>  ffmpeg.c | 2 ++
>  1 file changed, 2 insertions(+)

maybe ok
is there some testcase or something for this ?

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/mpeg12dec: parse A53 caption data embedded in SCTE-20 user data

2017-03-11 Thread Michael Niedermayer
On Mon, Mar 06, 2017 at 10:23:14AM -0800, Aman Gupta wrote:
> From: Aman Gupta 
> 
> ---
>  libavcodec/mpeg12dec.c | 38 ++
>  1 file changed, 38 insertions(+)
> 
> diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
> index 27db14c..8cafdb0 100644
> --- a/libavcodec/mpeg12dec.c
> +++ b/libavcodec/mpeg12dec.c
> @@ -2260,6 +2260,44 @@ static int mpeg_decode_a53_cc(AVCodecContext *avctx,
>  avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
>  }
>  return 1;
> +} else if (buf_size >= 2 &&
> +   p[0] == 0x03 && (p[1]&0x7f) == 0x01) {
> +/* extract SCTE-20 CC data */
> +GetBitContext gb;
> +int cc_count = 0;
> +int i;
> +
> +init_get_bits(, p + 2, buf_size - 2);
> +cc_count = get_bits(, 5);
> +if (cc_count > 0) {
> +av_freep(>a53_caption);
> +s1->a53_caption_size = cc_count * 3;
> +s1->a53_caption  = av_malloc(s1->a53_caption_size);
> +if (s1->a53_caption) {

a53_caption_size should be reset to 0 if allocation fails to keep the
fields consistent


[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]lavc/avpacket: Make pkt parameter of av_packet_get_side_data() const

2017-03-11 Thread Michael Niedermayer
On Tue, Mar 07, 2017 at 09:59:42AM +0100, Carl Eugen Hoyos wrote:
> 2017-02-26 12:04 GMT+01:00 Carl Eugen Hoyos :
> > 2017-02-26 11:51 GMT+01:00 Nicolas George :
> 
> >>> -uint8_t* av_packet_get_side_data(AVPacket *pkt, enum 
> >>> AVPacketSideDataType type,
> >>
> >>> +uint8_t* av_packet_get_side_data(
> >>> +#if FF_API_CONST_GET_SIDE_DATA
> >>> +const
> >>> +#endif
> >>> + AVPacket *pkt, enum 
> >>> AVPacketSideDataType type,
> >>
> >> I do not think we need the FF_API dance, since it is not an ABI break.
> >
> > I agree that there is no ABI break (but I suspect FF_API does not
> > imply an ABI break).
> >
> >> I think is is not an API break either.
> >
> > I may misremember but I thought it's an API break for c++ users.
> >
> > Anyway, new patch attached.
> 
> Ping.
> Should this not be changed, should one of the patches be applied?

i agree one should be applied, iam not 100% sure if it can break a
user app and need the #if or not

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/vf_interlace: add complex vertcal lowpassfilter

2017-03-11 Thread Thomas Mundt
> Kieran Kunhya  schrieb am Fr, 10.3.2017:
> Hi,
> 
> Just wondering, did you see what this looks like on a CRT, especially with
> interline twitter.
> The original method is similar to what an interlaced camera does, averaging
> alternate lines, deliberately lowpassing the data.
> 
Hi Kieran,

Fortunately I still got some Sony Multiformat CRT at work. I don´t have special 
test pattern that I could use, but some real life clips that produce heavy 
twitter when interlaced without filtering.
My filter reduces this almost the same as existing linear filter does. I tested 
several filter designs and parameters, but (-1 2 6 2 -1) gave the best results. 
Sharpness impression is subjective the same as without filtering.
Only details that produce twitter are extinguished.
There are some rare scenes that already doesn´t look totally clean with linear 
filter. This is slightly increased with complex filter, but it is the same 
amount that sharpness is increased and far away from twitter you get when 
filter is disabled.
I also tested with several deinterlacers, software and professional hardware 
like AJA or Lynx Converters, Sony and TV Logic monitors. They all showed good 
results.
Btw, the (-1 2 6 2 -1) filter also does averaging alternate lines. Black - 
white - black - white  lines will result in a 50% gray output. Only lower 
frequencys and block edges are less influenced.
I don´t know if modern interlaced cameras still using linear filters, however 
they definitely having detail/contour/aperture circuits to compensate blurring.

Regards,
Thomas
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] avcodec/h264_direct: Fix runtime error: signed integer overflow: 2147483647 - -14133 cannot be represented in type 'int'

2017-03-11 Thread Michael Niedermayer
On Sat, Mar 11, 2017 at 02:04:25PM +0100, wm4 wrote:
> On Sat, 11 Mar 2017 01:26:33 +0100
> Michael Niedermayer  wrote:
> 
> > On Fri, Mar 10, 2017 at 04:01:36PM +0100, wm4 wrote:
> > > On Fri, 10 Mar 2017 15:24:52 +0100
> > > Michael Niedermayer  wrote:
> > >   
> > > > Fixes: 755/clusterfuzz-testcase-5369072516595712
> > > > 
> > > > See: [FFmpeg-devel] [PATCH 1/2] avcodec/h264_direct: Fix runtime error: 
> > > > signed integer overflow: 2147483647 - -14133 cannot be represented in 
> > > > type 'int'
> > > > 
> > > > Found-by: continuous fuzzing process 
> > > > https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
> > > > Signed-off-by: Michael Niedermayer 
> > > > ---
> > > >  libavcodec/h264_direct.c | 7 ++-
> > > >  1 file changed, 6 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/libavcodec/h264_direct.c b/libavcodec/h264_direct.c
> > > > index cbb84665b3..66e54479d1 100644
> > > > --- a/libavcodec/h264_direct.c
> > > > +++ b/libavcodec/h264_direct.c
> > > > @@ -39,7 +39,12 @@ static int get_scale_factor(H264SliceContext *sl,
> > > >  int poc, int poc1, int i)
> > > >  {
> > > >  int poc0 = sl->ref_list[0][i].poc;
> > > > -int td = av_clip_int8(poc1 - poc0);
> > > > +int64_t pocdiff = poc1 - (int64_t)poc0;
> > > > +int td = av_clip_int8(pocdiff);
> > > > +
> > > > +if (pocdiff != (int)pocdiff)
> > > > +avpriv_request_sample(sl->h264->avctx, "pocdiff overflow\n");
> > > > +
> > > >  if (td == 0 || sl->ref_list[0][i].parent->long_ref) {
> > > >  return 256;
> > > >  } else {  
> > > 
> > > Hard to image that these poc values aren't bounded by something else,
> > > but I don't know.  
> > 
> > > 
> > > Also the previous patch didn't have this request_sample call, which
> > > inflates this whole thing by 5 lines of code.  
> > 
> > yes thats why i suggested it initially.
> > SUINT allows overflow detection simply by  #define CHECKED 1
> > and running under ubsan
> > 
> > otherwise an excplicit check is needed to detect such occurances
> 
> You can either
> 1. ignore the error in some way that doesn't cause problems
> 2. ignore the error in some way that doesn't cause problems in debug
>mode
> 3. make the error explicit and log it
> 
> Your first patch did 2 (which I find questionable, btw.), your current

My first patch should have done 1, why do you think it does not?


> patch does 3 - why not do 1? That solution seems safest and has the
> smallest footprint.
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have often repented speaking, but never of holding my tongue.
-- Xenocrates


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] swresample/swresample: do not reset tsf on swr_alloc_set_opts

2017-03-11 Thread Michael Niedermayer
On Fri, Mar 10, 2017 at 06:55:27AM +0700, Muhammad Faiz wrote:
> so tsf option in aresample will have effect
> 
> Signed-off-by: Muhammad Faiz 

breaks fate

TESTswr-resample-s32p-96000-44100
stddev:1.54 PSNR: 92.56 MAXDIFF:  116 bytes:  1152000/20480
stddev: |1.54 - 1.44| >= 0.1
Test swr-resample-s32p-96000-44100 failed. Look at 
tests/data/fate/swr-resample-s32p-96000-44100.err for details.



[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2] Allow 'concat' filter to support inputs with different frame rates

2017-03-11 Thread Michael Niedermayer
On Thu, Mar 09, 2017 at 03:27:16PM -0500, Calvin Walton wrote:
> Right now, the concat filter does not set the frame_rate value on any of
> the out links. As a result, the default ffmpeg behaviour kicks in - to
> copy the framerate from the first input to the outputs.
> 
> If a later input is higher framerate, this results in dropped frames; if
> a later input is lower framerate it might cause judder.
> 
> This patch checks if all of the video inputs have the same framerate, and
> if not it sets the out link to use '1/0' as the frame rate, the value
> meaning "unknown/vfr".
> 
> A test is added to verify the VFR behaviour. The existing test for CFR
> behaviour passes unchanged.
> ---
>  libavfilter/avf_concat.c |  15 ++-
>  tests/fate/filter-video.mak  |   4 +-
>  tests/ref/fate/filter-concat-vfr | 224 
> +++
>  3 files changed, 241 insertions(+), 2 deletions(-)
>  create mode 100644 tests/ref/fate/filter-concat-vfr

seem to fail on x86-32

make: *** No rule to make target `tests/data/filtergraphs/concat-vfr', needed 
by `fate-filter-concat-vfr'.  Stop.
make: *** Waiting for unfinished jobs


[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus


signature.asc
Description: Digital signature
___
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 5:57 PM, Paul B Mahol  wrote:

> On 3/11/17, Sanchit Sinha  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 
> > 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);
> > +}
> > +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;
> > + float root8= sqrt(8);
> > + float lf=0,lb=0,rb=0,rf=0;
> > +
> > + if (av_frame_is_writable(in))
> > + {
> > + out = in;
> > + }
> > + else
> > + {
>
> Code style is awful.
>
> > + out = ff_get_audio_buffer(inlink, in->nb_samples);
> > + if (!out)

Re: [FFmpeg-devel] [PATCH] avfilter/af_firequalizer: add av_restrict on convolution func

2017-03-11 Thread wm4
On Sat, 11 Mar 2017 07:56:52 +0700
Muhammad Faiz  wrote:

> slightly improved speed
> 
> Signed-off-by: Muhammad Faiz 
> ---
>  libavfilter/af_firequalizer.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/libavfilter/af_firequalizer.c b/libavfilter/af_firequalizer.c
> index 5c6fd54..4243d66 100644
> --- a/libavfilter/af_firequalizer.c
> +++ b/libavfilter/af_firequalizer.c
> @@ -197,8 +197,8 @@ static int query_formats(AVFilterContext *ctx)
>  return ff_set_common_samplerates(ctx, formats);
>  }
>  
> -static void fast_convolute(FIREqualizerContext *s, const float *kernel_buf, 
> float *conv_buf,
> -   OverlapIndex *idx, float *data, int nsamples)
> +static void fast_convolute(FIREqualizerContext *av_restrict s, const float 
> *av_restrict kernel_buf, float *av_restrict conv_buf,
> +   OverlapIndex *av_restrict idx, float *av_restrict 
> data, int nsamples)
>  {
>  if (nsamples <= s->nsamples_max) {
>  float *buf = conv_buf + idx->buf_idx * s->rdft_len;
> @@ -235,8 +235,8 @@ static void fast_convolute(FIREqualizerContext *s, const 
> float *kernel_buf, floa
>  }
>  }
>  
> -static void fast_convolute2(FIREqualizerContext *s, const float *kernel_buf, 
> FFTComplex *conv_buf,
> -OverlapIndex *idx, float *data0, float *data1, 
> int nsamples)
> +static void fast_convolute2(FIREqualizerContext *av_restrict s, const float 
> *av_restrict kernel_buf, FFTComplex *av_restrict conv_buf,
> +OverlapIndex *av_restrict idx, float 
> *av_restrict data0, float *av_restrict data1, int nsamples)
>  {
>  if (nsamples <= s->nsamples_max) {
>  FFTComplex *buf = conv_buf + idx->buf_idx * s->rdft_len;

Seems ok. How much improved?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] avcodec/h264_direct: Fix runtime error: signed integer overflow: 2147483647 - -14133 cannot be represented in type 'int'

2017-03-11 Thread wm4
On Sat, 11 Mar 2017 01:26:33 +0100
Michael Niedermayer  wrote:

> On Fri, Mar 10, 2017 at 04:01:36PM +0100, wm4 wrote:
> > On Fri, 10 Mar 2017 15:24:52 +0100
> > Michael Niedermayer  wrote:
> >   
> > > Fixes: 755/clusterfuzz-testcase-5369072516595712
> > > 
> > > See: [FFmpeg-devel] [PATCH 1/2] avcodec/h264_direct: Fix runtime error: 
> > > signed integer overflow: 2147483647 - -14133 cannot be represented in 
> > > type 'int'
> > > 
> > > Found-by: continuous fuzzing process 
> > > https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
> > > Signed-off-by: Michael Niedermayer 
> > > ---
> > >  libavcodec/h264_direct.c | 7 ++-
> > >  1 file changed, 6 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/libavcodec/h264_direct.c b/libavcodec/h264_direct.c
> > > index cbb84665b3..66e54479d1 100644
> > > --- a/libavcodec/h264_direct.c
> > > +++ b/libavcodec/h264_direct.c
> > > @@ -39,7 +39,12 @@ static int get_scale_factor(H264SliceContext *sl,
> > >  int poc, int poc1, int i)
> > >  {
> > >  int poc0 = sl->ref_list[0][i].poc;
> > > -int td = av_clip_int8(poc1 - poc0);
> > > +int64_t pocdiff = poc1 - (int64_t)poc0;
> > > +int td = av_clip_int8(pocdiff);
> > > +
> > > +if (pocdiff != (int)pocdiff)
> > > +avpriv_request_sample(sl->h264->avctx, "pocdiff overflow\n");
> > > +
> > >  if (td == 0 || sl->ref_list[0][i].parent->long_ref) {
> > >  return 256;
> > >  } else {  
> > 
> > Hard to image that these poc values aren't bounded by something else,
> > but I don't know.  
> 
> > 
> > Also the previous patch didn't have this request_sample call, which
> > inflates this whole thing by 5 lines of code.  
> 
> yes thats why i suggested it initially.
> SUINT allows overflow detection simply by  #define CHECKED 1
> and running under ubsan
> 
> otherwise an excplicit check is needed to detect such occurances

You can either
1. ignore the error in some way that doesn't cause problems
2. ignore the error in some way that doesn't cause problems in debug
   mode
3. make the error explicit and log it

Your first patch did 2 (which I find questionable, btw.), your current
patch does 3 - why not do 1? That solution seems safest and has the
smallest footprint.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] Add XPM decoder

2017-03-11 Thread Paras Chadha
Signed-off-by: Paras 
---
 Changelog   |   1 +
 doc/general.texi|   2 +
 libavcodec/Makefile |   1 +
 libavcodec/allcodecs.c  |   1 +
 libavcodec/avcodec.h|   1 +
 libavcodec/codec_desc.c |   7 +
 libavcodec/version.h|   4 +-
 libavcodec/xpmdec.c | 430 
 libavformat/img2.c  |   1 +
 9 files changed, 446 insertions(+), 2 deletions(-)
 create mode 100644 libavcodec/xpmdec.c

diff --git a/Changelog b/Changelog
index 13628ca..716b6ff 100644
--- a/Changelog
+++ b/Changelog
@@ -26,6 +26,7 @@ version :
 - native Opus encoder
 - ScreenPressor decoder
 - incomplete ClearVideo decoder
+- XPM decoder

 version 3.2:
 - libopenmpt demuxer
diff --git a/doc/general.texi b/doc/general.texi
index 30450c0..83f54b3 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -607,6 +607,8 @@ following image formats are supported:
 @tab WebP image format, encoding supported through external library libwebp
 @item XBM  @tab X @tab X
 @tab X BitMap image format
+@item XPM  @tab X @tab X
+@tab X PixMap image format
 @item XFace @tab X @tab X
 @tab X-Face image format
 @item XWD  @tab X @tab X
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 65ccbad..b8d7a00 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -650,6 +650,7 @@ OBJS-$(CONFIG_XFACE_ENCODER)   += xfaceenc.o xface.o
 OBJS-$(CONFIG_XL_DECODER)  += xl.o
 OBJS-$(CONFIG_XMA1_DECODER)+= wmaprodec.o wma.o wma_common.o
 OBJS-$(CONFIG_XMA2_DECODER)+= wmaprodec.o wma.o wma_common.o
+OBJS-$(CONFIG_XPM_DECODER) += xpmdec.o
 OBJS-$(CONFIG_XSUB_DECODER)+= xsubdec.o
 OBJS-$(CONFIG_XSUB_ENCODER)+= xsubenc.o
 OBJS-$(CONFIG_XWD_DECODER) += xwddec.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 074efd4..b7d03ad 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -378,6 +378,7 @@ static void register_all(void)
 REGISTER_ENCDEC (XBM,   xbm);
 REGISTER_ENCDEC (XFACE, xface);
 REGISTER_DECODER(XL,xl);
+REGISTER_DECODER(XPM,   xpm);
 REGISTER_ENCDEC (XWD,   xwd);
 REGISTER_ENCDEC (Y41P,  y41p);
 REGISTER_DECODER(YLC,   ylc);
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 30ac236..e32f579 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -439,6 +439,7 @@ enum AVCodecID {
 AV_CODEC_ID_FMVC,
 AV_CODEC_ID_SCPR,
 AV_CODEC_ID_CLEARVIDEO,
+AV_CODEC_ID_XPM,

 /* various PCM "codecs" */
 AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at the 
start of audio codecs
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 06bcfc3..88cfddb 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1591,6 +1591,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
 },
 {
+.id= AV_CODEC_ID_XPM,
+.type  = AVMEDIA_TYPE_VIDEO,
+.name  = "xpm",
+.long_name = NULL_IF_CONFIG_SMALL("XPM (X PixMap) image"),
+.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+},
+{
 .id= AV_CODEC_ID_XWD,
 .type  = AVMEDIA_TYPE_VIDEO,
 .name  = "xwd",
diff --git a/libavcodec/version.h b/libavcodec/version.h
index b00e011..3ed5a71 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,8 +28,8 @@
 #include "libavutil/version.h"

 #define LIBAVCODEC_VERSION_MAJOR  57
-#define LIBAVCODEC_VERSION_MINOR  82
-#define LIBAVCODEC_VERSION_MICRO 102
+#define LIBAVCODEC_VERSION_MINOR  83
+#define LIBAVCODEC_VERSION_MICRO 100

 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
diff --git a/libavcodec/xpmdec.c b/libavcodec/xpmdec.c
new file mode 100644
index 000..6cf036b
--- /dev/null
+++ b/libavcodec/xpmdec.c
@@ -0,0 +1,430 @@
+/*
+ * XPM image format
+ *
+ * Copyright (c) 2012 Paul B Mahol
+ * Copyright (c) 2016 Paras Chadha
+ *
+ * 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, 

Re: [FFmpeg-devel] [PATCH] Add XPM decoder

2017-03-11 Thread Paul B Mahol
On 3/11/17, Paras Chadha  wrote:
> Here is the patch with all the changes mentioned above
>
> Signed-off-by: Paras 
> ---
>  Changelog   |   1 +
>  doc/general.texi|   2 +
>  libavcodec/Makefile |   1 +
>  libavcodec/allcodecs.c  |   1 +
>  libavcodec/avcodec.h|   1 +
>  libavcodec/codec_desc.c |   7 +
>  libavcodec/version.h|   4 +-
>  libavcodec/xpmdec.c | 430
> 
>  libavformat/img2.c  |   1 +
>  9 files changed, 446 insertions(+), 2 deletions(-)
>  create mode 100644 libavcodec/xpmdec.c
>

[...]

> +{ "NavajoWhite",  0xDEAD },
> +{ "Navy", 0xFF80 },
> +{ "None", 0x00FF },

None is 0x AFAIK. Is it?

[...]

> +/*
> +**  functions same as strcspn but ignores characters in reject if they are
> inside a C style comment...
> +**  @param str, reject - same as that of strcspn
> +**  @return length till any character in reject does not occur in str
> +*/
> +static size_t mod_strcspn(const char *str, const char *rej)
> +{
> +size_t v1, v2;
> +const char * ptr = str, *temp;
> +
> +v1 = strcspn(str, "/");
> +v2 = strcspn(str, rej);
> +
> +while (v1 +ptr += v1+1;
> +if (*(ptr)=='*') {
> +if (temp = strstr(ptr, "*/")) {
> +ptr = temp+2;
> +} else {
> +ptr++;
> +}
> +} else if (*(ptr)=='/') {
> +if (temp = strstr(ptr, "\n")) {
> +ptr = temp+1;
> +} else {
> +ptr++;
> +}
> +} else {
> +ptr++;
> +}
> +v1 = strcspn(ptr, "/");
> +v2 = strcspn(ptr, rej);
> +}
> +
> +return (size_t)(ptr-str)+v2;

This looks too complicated. Instead stole strcspn implementation and
do what it does
but also skip C comments.

[...]

 +
> +static int xpm_decode_frame(AVCodecContext *avctx, void *data,
> +int *got_frame, AVPacket *avpkt)
> +{
> +XPMDecContext *x = avctx->priv_data;
> +AVFrame *p=data;
> +const uint8_t *end, *ptr = avpkt->data;
> +int ncolors, cpp, ret, i, j;
> +int64_t size;
> +uint32_t *dst;
> +
> +avctx->pix_fmt = AV_PIX_FMT_BGRA;
> +
> +end = avpkt->data + avpkt->size;
> +if (memcmp(ptr, "/* XPM */", 9)) {
> +av_log(avctx, AV_LOG_ERROR, "missing signature\n");
> +return AVERROR_INVALIDDATA;
> +}
> +
> +ptr += mod_strcspn(ptr, "\"");
> +if (sscanf(ptr, "\"%u %u %u %u\",",
> +   >width, >height, , ) != 4) {
> +av_log(avctx, AV_LOG_ERROR, "missing image parameters\n");
> +return AVERROR_INVALIDDATA;
> +}
> +
> +if ((ret = ff_set_dimensions(avctx, avctx->width, avctx->height)) < 0)
> +return ret;
> +
> +if ((ret = ff_get_buffer(avctx, p, 0)) < 0)
> +return ret;
> +
> +if (ncolors <= 0) {
> +av_log(avctx, AV_LOG_ERROR, "invalid number of colors: %d\n",
> ncolors);
> +return AVERROR_INVALIDDATA;
> +}
> +
> +if (cpp <= 0) {
> +av_log(avctx, AV_LOG_ERROR, "invalid number of chars per pixel:
> %d\n", cpp);
> +return AVERROR_INVALIDDATA;
> +}
> +
> +size = 1;
> +j = 1;
> +for (i=0;i +size += j*94;
> +j *= 95;
> +}
> +size *= 4;
> +
> +if (size<0) {

Please follow style, spaces between '<' : if (size < 0) {...

> +av_log(avctx, AV_LOG_ERROR, "unsupported number of chars per
> pixel: %d\n", cpp);
> +return AVERROR(ENOMEM);
> +}
> +
> +av_fast_padded_malloc(>pixels, >pixels_size, size);
> +if (!x->pixels)
> +return AVERROR(ENOMEM);
> +
> +ptr += mod_strcspn(ptr, ",") + 1;
> +for (i = 0; i < ncolors; i++) {
> +
> +const uint8_t *index;
> +int len;
> +
> +ptr += mod_strcspn(ptr, "\"") + 1;
> +if (ptr + cpp > end)
> +return AVERROR_INVALIDDATA;
> +index = ptr;
> +ptr += cpp;
> +
> +ptr = strstr(ptr, "c ");
> +if (ptr) {
> +ptr += 2;
> +} else {
> +return AVERROR_INVALIDDATA;
> +}
> +
> +len = strcspn(ptr, "\" ");
> +
> +if ((ret = ascii2index(index, cpp)) < 0)
> +return ret;
> +
> +x->pixels[ret] = hexstring_to_rgba(ptr, len);
> +
> +ptr += mod_strcspn(ptr, ",") + 1;
> +}
> +
> +for (i = 0; i < avctx->height; i++) {
> +dst = (uint32_t *)(p->data[0] + i * p->linesize[0]);
> +ptr += mod_strcspn(ptr, "\"") + 1;
> +for (j = 0; j < avctx->width; j++) {
> +if (ptr + cpp > end)
> +return AVERROR_INVALIDDATA;
> +ret = ascii2index(ptr, cpp);

Check ret value, it can be negative.

> +*dst++ = x->pixels[ret];
> +ptr += cpp;
> +}
> +ptr += 

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

2017-03-11 Thread Paul B Mahol
On 3/11/17, Sanchit Sinha  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 
> 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);
> +}
> +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;
> + float root8= sqrt(8);
> + float lf=0,lb=0,rb=0,rf=0;
> +
> + if (av_frame_is_writable(in))
> + {
> + out = in;
> + }
> + else
> + {

Code style is awful.

> + out = ff_get_audio_buffer(inlink, in->nb_samples);
> + if (!out)
> + {

Please do not change code style of code you copied.
Instead follow its style to the end.

> + av_frame_free();
> + return AVERROR(ENOMEM);
> + }
> + av_frame_copy_props(out, in);
> + }
> +
> + /*If planar samples are used, output must be put in 

Re: [FFmpeg-devel] [PATCH] Add XPM decoder

2017-03-11 Thread Michael Niedermayer
On Sat, Mar 11, 2017 at 05:33:30PM +0530, Paras Chadha wrote:
> Here is the patch with all the changes mentioned above
> 
> Signed-off-by: Paras 
> ---
>  Changelog   |   1 +
>  doc/general.texi|   2 +
>  libavcodec/Makefile |   1 +
>  libavcodec/allcodecs.c  |   1 +
>  libavcodec/avcodec.h|   1 +
>  libavcodec/codec_desc.c |   7 +
>  libavcodec/version.h|   4 +-
>  libavcodec/xpmdec.c | 430
> 
>  libavformat/img2.c  |   1 +
>  9 files changed, 446 insertions(+), 2 deletions(-)
>  create mode 100644 libavcodec/xpmdec.c

Applying: Add XPM decoder
error: corrupt patch at line 33
error: could not build fake ancestor
Patch failed at 0001 Add XPM decoder

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]lsws/input: Do not define unused functions

2017-03-11 Thread Michael Niedermayer
On Tue, Mar 07, 2017 at 09:30:18AM +0100, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch fixes a few warnings when compiling with newer gcc.
> 
> Please comment, Carl Eugen

might be simpler t use av_unused

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

You can kill me, but you cannot change the truth.


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/exr

2017-03-11 Thread Michael Niedermayer
On Mon, Mar 06, 2017 at 05:00:22PM +, Dzung Hoang wrote:
> The EXR decoder cannot handle the image files included in NVidia's HDR SDK. 
> After debugging, I found that the line offset table in the image files 
> contained 0's. Other EXR decoders, including the official OpenEXR decoder, 
> can detect and reconstruct missing line offset tables, so I added some code 
> to do so.
> I filed a trac ticket for this issue here: 
> https://trac.ffmpeg.org/ticket/6220.
> 
> 
> The patch is below.
> Regards,Dzung Hoang
> 
> 
> diff --git a/libavcodec/exr.c b/libavcodec/exr.c
> 
> index 034920f..de48e76 100644
> 
> --- a/libavcodec/exr.c
> 
> +++ b/libavcodec/exr.c
> 
> @@ -1726,6 +1726,24 @@ static intdecode_frame(AVCodecContext *avctx, void 
> *data,

this patch looks corrupted
also, if one of the images is small please add a fate test

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

There will always be a question for which you do not know the correct answer.


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Add XPM decoder

2017-03-11 Thread Paras Chadha
On Sat, Mar 11, 2017 at 5:40 AM, Moritz Barsnick  wrote:

>
> > +static int color_table_compare(const void *lhs, const void *rhs)
> > +{
> > +return av_strcasecmp(lhs, ((const ColorEntry *)rhs)->name);
> > +}
> > +
> > +static const ColorEntry color_table[] = {
> > +{ "AliceBlue",{ 0xF0, 0xF8, 0xFF } },
> > +{ "AntiqueWhite", { 0xFA, 0xEB, 0xD7 } },
> > +{ "Aqua", { 0x00, 0xFF, 0xFF } },
> [...]
>
> Is this duplicated from libavutil/parseutils.c?
>

Yes, it is duplicated from parseutils.c
XPM format also specifies a color None which is transparent, it has been
added to the array.
Also ColorEntry is changed a bit.
These changes are in my next patch.


>
> > +static uint32_t hexstring_to_rgba(const char *p, int len){
> > +uint32_t ret = 0xFF00;
> > +const ColorEntry *entry;
> > +char color_name[100];
> > +
> > +if(*p == '#'){
> > +p++;
> > +len--;
> > +if (len == 3) {
> > +ret |= (convert(p[2]) <<  4) |
> > +   (convert(p[1]) << 12) |
> > +   (convert(p[0]) << 20);
>
> So is this a modified or redesigned av_parse_color()? Just wondering.
>

Yes, it is redesigned version of av_parse_color(). It is a bit fast than
the original.


> > +else{
>
> If this is new code, and not copied verbatim from somewhere else, you
> need to follow coding style.
>
> > +av_log(avctx, AV_LOG_ERROR, "invalid number of colors or chars
> per pixel\n");
>
> Feel free to quote actual offending values...
>
> > +av_log(avctx, AV_LOG_ERROR, "unsupported number of chars per
> pixel\n");
> > +return AVERROR_PATCHWELCOME;
>
> ...especially when asking for a patch.
>
> Sorry for nitpicking without looking at the actual code.
>
> Moritz
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

Rest all changes have been made.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Add XPM decoder

2017-03-11 Thread Paras Chadha
Here is the patch with all the changes mentioned above

Signed-off-by: Paras 
---
 Changelog   |   1 +
 doc/general.texi|   2 +
 libavcodec/Makefile |   1 +
 libavcodec/allcodecs.c  |   1 +
 libavcodec/avcodec.h|   1 +
 libavcodec/codec_desc.c |   7 +
 libavcodec/version.h|   4 +-
 libavcodec/xpmdec.c | 430

 libavformat/img2.c  |   1 +
 9 files changed, 446 insertions(+), 2 deletions(-)
 create mode 100644 libavcodec/xpmdec.c

diff --git a/Changelog b/Changelog
index 13628ca..716b6ff 100644
--- a/Changelog
+++ b/Changelog
@@ -26,6 +26,7 @@ version :
 - native Opus encoder
 - ScreenPressor decoder
 - incomplete ClearVideo decoder
+- XPM decoder

 version 3.2:
 - libopenmpt demuxer
diff --git a/doc/general.texi b/doc/general.texi
index 30450c0..83f54b3 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -607,6 +607,8 @@ following image formats are supported:
 @tab WebP image format, encoding supported through external library
libwebp
 @item XBM  @tab X @tab X
 @tab X BitMap image format
+@item XPM  @tab X @tab X
+@tab X PixMap image format
 @item XFace @tab X @tab X
 @tab X-Face image format
 @item XWD  @tab X @tab X
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 65ccbad..b8d7a00 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -650,6 +650,7 @@ OBJS-$(CONFIG_XFACE_ENCODER)   += xfaceenc.o
xface.o
 OBJS-$(CONFIG_XL_DECODER)  += xl.o
 OBJS-$(CONFIG_XMA1_DECODER)+= wmaprodec.o wma.o wma_common.o
 OBJS-$(CONFIG_XMA2_DECODER)+= wmaprodec.o wma.o wma_common.o
+OBJS-$(CONFIG_XPM_DECODER) += xpmdec.o
 OBJS-$(CONFIG_XSUB_DECODER)+= xsubdec.o
 OBJS-$(CONFIG_XSUB_ENCODER)+= xsubenc.o
 OBJS-$(CONFIG_XWD_DECODER) += xwddec.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 074efd4..b7d03ad 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -378,6 +378,7 @@ static void register_all(void)
 REGISTER_ENCDEC (XBM,   xbm);
 REGISTER_ENCDEC (XFACE, xface);
 REGISTER_DECODER(XL,xl);
+REGISTER_DECODER(XPM,   xpm);
 REGISTER_ENCDEC (XWD,   xwd);
 REGISTER_ENCDEC (Y41P,  y41p);
 REGISTER_DECODER(YLC,   ylc);
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 30ac236..e32f579 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -439,6 +439,7 @@ enum AVCodecID {
 AV_CODEC_ID_FMVC,
 AV_CODEC_ID_SCPR,
 AV_CODEC_ID_CLEARVIDEO,
+AV_CODEC_ID_XPM,

 /* various PCM "codecs" */
 AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at the
start of audio codecs
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 06bcfc3..88cfddb 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1591,6 +1591,13 @@ static const AVCodecDescriptor codec_descriptors[] =
{
 .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
 },
 {
+.id= AV_CODEC_ID_XPM,
+.type  = AVMEDIA_TYPE_VIDEO,
+.name  = "xpm",
+.long_name = NULL_IF_CONFIG_SMALL("XPM (X PixMap) image"),
+.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+},
+{
 .id= AV_CODEC_ID_XWD,
 .type  = AVMEDIA_TYPE_VIDEO,
 .name  = "xwd",
diff --git a/libavcodec/version.h b/libavcodec/version.h
index b00e011..3ed5a71 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,8 +28,8 @@
 #include "libavutil/version.h"

 #define LIBAVCODEC_VERSION_MAJOR  57
-#define LIBAVCODEC_VERSION_MINOR  82
-#define LIBAVCODEC_VERSION_MICRO 102
+#define LIBAVCODEC_VERSION_MINOR  83
+#define LIBAVCODEC_VERSION_MICRO 100

 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
diff --git a/libavcodec/xpmdec.c b/libavcodec/xpmdec.c
new file mode 100644
index 000..6cf036b
--- /dev/null
+++ b/libavcodec/xpmdec.c
@@ -0,0 +1,430 @@
+/*
+ * XPM image format
+ *
+ * Copyright (c) 2012 Paul B Mahol
+ * Copyright (c) 2016 Paras Chadha
+ *
+ * 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 

Re: [FFmpeg-devel] [PATCH 0/2] lavc/libfdk-aacenc: VBR check message fix

2017-03-11 Thread Michael Niedermayer
On Thu, Mar 09, 2017 at 10:49:33AM +0100, Moritz Barsnick wrote:
> This patch (series) adjusts the message of the vbr option check to
> be clear about that it's making an adjustment of the option value.
> 
> The second patch is just an extremely minor style fix.
> 
> I am under the impression that Martin Storsjö  is
> maintaining the libfdk_aac wrapper, but primarily on "libav". He is
> listed in MAINTAINERS, but not for libfdk_aac. I'm not sure whether
> he monitors this list though. This is of interest to me as I have
> another change to propose...

you could send martin a private mail and ask

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you fake or manipulate statistics in a paper in physics you will never
get a job again.
If you fake or manipulate statistics in a paper in medicin you will get
a job for life at the pharma industry.


signature.asc
Description: Digital signature
___
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
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 
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  wrote:
>
>> Paul B Mahol wrote:
>>
>>> On 3/11/17, Andy Furniss  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 
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.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 (, 

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

2017-03-11 Thread Andy Furniss

Paul B Mahol wrote:

On 3/11/17, Andy Furniss  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


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

2017-03-11 Thread Paul B Mahol
On 3/11/17, Andy Furniss  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.
___
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 Andy Furniss

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.


___
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
Apologies I will update it asap

On Mar 11, 2017 3:07 PM, "Paul B Mahol"  wrote:

> On 3/10/17, Sanchit Sinha  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 
> > 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-11 Thread Paul B Mahol
On 3/10/17, Sanchit Sinha  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 
> 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