Re: [FFmpeg-devel] [PATCH, V2] avformat/concat: Fix wrong wrapped timestamp

2017-12-17 Thread 吴志强
Thanks for your replay.

I see wrap timestamp control is enable by pts_wrap_bits(default 33),
but mp4 demuxer  will later set this to 64 (means disabled).
Now pts_wrap_bits are always tied to 33 without copy it, which seems
strange.

Normally the pts_wrap_reference  is based on first packet of a file in
avformat_find_stream_info.
Without copy the value,  the value is based on first packet of read_packet,
will be non-zero after seeking.

2017-12-17 22:55 GMT+08:00 Nicolas George :

> mymoey...@gmail.com (2017-12-14):
> > From: Wu Zhiqiang 
> >
> > When using concat protocol, start from middle of file will generate
> non-zero wrap reference.
> > If seek to time before the wrap reference, wrap control will generate
> wrong wrapped timestamp.
> > Copy wrap related stream properties when reading header can fix this
> problem.
> >
> > Signed-off-by: Wu Zhiqiang 
> > ---
> >  libavformat/concatdec.c | 5 +
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
> > index 0e189012ad..8dae2737df 100644
> > --- a/libavformat/concatdec.c
> > +++ b/libavformat/concatdec.c
> > @@ -188,6 +188,11 @@ static int copy_stream_props(AVStream *st, AVStream
> *source_st)
> >  st->time_base   = source_st->time_base;
> >  st->sample_aspect_ratio = source_st->sample_aspect_ratio;
> >
> > +/* Fix wrap control problem */
> > +avpriv_set_pts_info(st, source_st->pts_wrap_bits,
> source_st->time_base.num, source_st->time_base.den);
> > +st->pts_wrap_behavior   = source_st->pts_wrap_behavior;
> > +st->pts_wrap_reference  = source_st->pts_wrap_reference;
> > +
> >  av_dict_copy(>metadata, source_st->metadata, 0);
> >  return 0;
> >  }
>
> The concat demuxer is mine to maintain, but I am not very familiar with
> the wrapped timestamps handling, and the commit message does not
> enlighten me.
>
> (By the way, please wrap it at 60-70 characters.)
>
> The way I see it, if the library takes care of de-wrapping timestamps,
> then the concat demuxer will see de-wrapped timestamps from the
> underlying demuxer, and the timestamps do not need to be de-wrapped a
> second time: setting the wrap information is unnecessary and even wrong.
>
> Please explain what I am missing.
>
> Regards,
>
> --
>   Nicolas George
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libvmaf: exit gracefully if the library fails.

2017-12-17 Thread Gyan Doshi

Hi Ronald,

When do you expect to apply this?

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


[FFmpeg-devel] [PATCH] avfilter/vf_overlay: fix packed_rgb case

2017-12-17 Thread Mateusz
Signed-off-by: Mateusz Brzostek 
---
 libavfilter/vf_overlay.c | 17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index a7d3906016..aa5835ae3a 100644
--- a/libavfilter/vf_overlay.c
+++ b/libavfilter/vf_overlay.c
@@ -456,9 +456,12 @@ static av_always_inline void 
blend_image_packed_rgb(AVFilterContext *ctx,
 default:
 // main_value = main_value * (1 - alpha) + overlay_value * 
alpha
 // since alpha is in the range 0-255, the result must divided 
by 255
-d[dr] = is_straight ? FAST_DIV255(d[dr] * (255 - alpha) + 
S[sr] * alpha) : FAST_DIV255(d[dr] * (255 - alpha) + S[sr]);
-d[dg] = is_straight ? FAST_DIV255(d[dg] * (255 - alpha) + 
S[sg] * alpha) : FAST_DIV255(d[dr] * (255 - alpha) + S[sr]);
-d[db] = is_straight ? FAST_DIV255(d[db] * (255 - alpha) + 
S[sb] * alpha) : FAST_DIV255(d[dr] * (255 - alpha) + S[sr]);
+d[dr] = is_straight ? FAST_DIV255(d[dr] * (255 - alpha) + 
S[sr] * alpha) :
+FFMIN(FAST_DIV255(d[dr] * (255 - alpha)) + S[sr], 255);
+d[dg] = is_straight ? FAST_DIV255(d[dg] * (255 - alpha) + 
S[sg] * alpha) :
+FFMIN(FAST_DIV255(d[dg] * (255 - alpha)) + S[sg], 255);
+d[db] = is_straight ? FAST_DIV255(d[db] * (255 - alpha) + 
S[sb] * alpha) :
+FFMIN(FAST_DIV255(d[db] * (255 - alpha)) + S[sb], 255);
 }
 if (main_has_alpha) {
 switch (alpha) {
@@ -742,22 +745,22 @@ static void blend_image_gbrap_pm(AVFilterContext *ctx, 
AVFrame *dst, const AVFra
 
 static void blend_image_rgb(AVFilterContext *ctx, AVFrame *dst, const AVFrame 
*src, int x, int y)
 {
-blend_image_packed_rgb(ctx, dst, src, 0, x, y, 0);
+blend_image_packed_rgb(ctx, dst, src, 0, x, y, 1);
 }
 
 static void blend_image_rgba(AVFilterContext *ctx, AVFrame *dst, const AVFrame 
*src, int x, int y)
 {
-blend_image_packed_rgb(ctx, dst, src, 1, x, y, 0);
+blend_image_packed_rgb(ctx, dst, src, 1, x, y, 1);
 }
 
 static void blend_image_rgb_pm(AVFilterContext *ctx, AVFrame *dst, const 
AVFrame *src, int x, int y)
 {
-blend_image_packed_rgb(ctx, dst, src, 0, x, y, 1);
+blend_image_packed_rgb(ctx, dst, src, 0, x, y, 0);
 }
 
 static void blend_image_rgba_pm(AVFilterContext *ctx, AVFrame *dst, const 
AVFrame *src, int x, int y)
 {
-blend_image_packed_rgb(ctx, dst, src, 1, x, y, 1);
+blend_image_packed_rgb(ctx, dst, src, 1, x, y, 0);
 }
 
 static int config_input_main(AVFilterLink *inlink)
-- 
2.15.1.windows.2

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


Re: [FFmpeg-devel] [PATCH 2/2] tests/audiomatch: Refine the code.

2017-12-17 Thread Jun Zhao


On 2017/12/18 10:25, Carl Eugen Hoyos wrote:
> 2017-12-18 2:41 GMT+01:00 Jun Zhao :
>
>> tests/audiomatch: Refine the code.
> Shouldn't this be: "tests/audiomatch: Cosmetics, fix whitespace"?
except fix whitespace, the other change is use date type in sizeof.
>
> Carl Eugen
> ___
> 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 2/2] tests/audiomatch: Refine the code.

2017-12-17 Thread Carl Eugen Hoyos
2017-12-18 2:41 GMT+01:00 Jun Zhao :

> tests/audiomatch: Refine the code.

Shouldn't this be: "tests/audiomatch: Cosmetics, fix whitespace"?

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


[FFmpeg-devel] [PATCH 2/2] tests/audiomatch: Refine the code.

2017-12-17 Thread Jun Zhao

From d2e3ba49180883dc71eb0eb0f5fa228368b4c9d5 Mon Sep 17 00:00:00 2001
From: Jun Zhao 
Date: Mon, 18 Dec 2017 09:16:52 +0800
Subject: [PATCH 2/2] tests/audiomatch: Refine the code.

Refine the coding style and change to use sizeof date type.

Signed-off-by: Jun Zhao 
---
 tests/audiomatch.c | 34 +-
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/tests/audiomatch.c b/tests/audiomatch.c
index e63e494add..b432b66ec5 100644
--- a/tests/audiomatch.c
+++ b/tests/audiomatch.c
@@ -25,23 +25,23 @@
 #define FFMIN(a,b) ((a) > (b) ? (b) : (a))
 #define FFMAX(a,b) ((a) > (b) ? (a) : (b))
 
-static int64_t fsize(FILE *f){
-int64_t end, pos= ftell(f);
+static int64_t fsize(FILE *f) {
+int64_t end, pos = ftell(f);
 fseek(f, 0, SEEK_END);
 end = ftell(f);
 fseek(f, pos, SEEK_SET);
 return end;
 }
 
-int main(int argc, char **argv){
+int main(int argc, char **argv) {
 FILE *f[2];
 int i, pos;
 int siglen, datlen;
 int bestpos = 0;
-double bestc=0;
-double sigamp= 0;
+double bestc = 0;
+double sigamp = 0;
 int16_t *signal, *data;
-int maxshift= 16384;
+int maxshift = 16384;
 
 if (argc < 3) {
 printf("audiomatch  \n");
@@ -77,8 +77,8 @@ int main(int argc, char **argv){
 
 datlen = fsize(f[0]) - ftell(f[0]);
 siglen = fsize(f[1]) - ftell(f[1]);
-data   = malloc(datlen * sizeof(*data));
-signal = malloc(siglen * sizeof(*signal));
+data   = malloc(datlen * sizeof(int16_t));
+signal = malloc(siglen * sizeof(int16_t));
 
 if (fread(data  , 1, datlen, f[0]) != datlen)
 return 1;
@@ -87,24 +87,24 @@ int main(int argc, char **argv){
 datlen /= 2;
 siglen /= 2;
 
-for(i=0; i sigamp * 0.94)
+if (fabs(c) > sigamp * 0.94)
 maxshift = FFMIN(maxshift, fabs(pos)+32);
-if(fabs(c)>fabs(bestc)){
-bestc= c;
+if (fabs(c) > fabs(bestc)) {
+bestc = c;
 bestpos = pos;
 }
 }
-- 
2.14.1

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


[FFmpeg-devel] [PATCH 1/2] tests/audiomatch: Add return value check for fread.

2017-12-17 Thread Jun Zhao

From a89964e88080d1cc6e01c99bf8640a1020465762 Mon Sep 17 00:00:00 2001
From: Jun Zhao 
Date: Mon, 18 Dec 2017 08:59:58 +0800
Subject: [PATCH 1/2] tests/audiomatch: Add return value check for fread.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Check fread return value to fix build warning as "ignoring
return value of ‘fread’"

Signed-off-by: Jun Zhao 
---
 tests/audiomatch.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/audiomatch.c b/tests/audiomatch.c
index ca56df09b3..e63e494add 100644
--- a/tests/audiomatch.c
+++ b/tests/audiomatch.c
@@ -80,8 +80,10 @@ int main(int argc, char **argv){
 data   = malloc(datlen * sizeof(*data));
 signal = malloc(siglen * sizeof(*signal));
 
-fread(data  , 1, datlen, f[0]);
-fread(signal, 1, siglen, f[1]);
+if (fread(data  , 1, datlen, f[0]) != datlen)
+return 1;
+if (fread(signal, 1, siglen, f[1]) != siglen)
+return 1;
 datlen /= 2;
 siglen /= 2;
 
-- 
2.14.1

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


Re: [FFmpeg-devel] [PATCH 1/8] sbc: implement SBC decoder (low-complexity subband codec)

2017-12-17 Thread Rostislav Pehlivanov
On 17 December 2017 at 21:47, Aurelien Jacobs  wrote:

> This was originally based on libsbc, and was fully integrated into ffmpeg.
> ---
>  doc/general.texi |   2 +
>  libavcodec/Makefile  |   2 +
>  libavcodec/allcodecs.c   |   2 +
>  libavcodec/avcodec.h |   2 +
>  libavcodec/codec_desc.c  |  14 ++
>  libavcodec/sbc.c | 316 
>  libavcodec/sbc.h | 118 
>  libavcodec/sbcdec.c  | 464 ++
> +
>  libavcodec/sbcdec_data.c | 127 +
>  libavcodec/sbcdec_data.h |  44 +
>  10 files changed, 1091 insertions(+)
>  create mode 100644 libavcodec/sbc.c
>  create mode 100644 libavcodec/sbc.h
>  create mode 100644 libavcodec/sbcdec.c
>  create mode 100644 libavcodec/sbcdec_data.c
>  create mode 100644 libavcodec/sbcdec_data.h
>
>
> +
> +/*
> + * Calculates the CRC-8 of the first len bits in data
> + */
> +static const uint8_t crc_table[256] = {
> +0x00, 0x1D, 0x3A, 0x27, 0x74, 0x69, 0x4E, 0x53,
> +0xE8, 0xF5, 0xD2, 0xCF, 0x9C, 0x81, 0xA6, 0xBB,
> +0xCD, 0xD0, 0xF7, 0xEA, 0xB9, 0xA4, 0x83, 0x9E,
> +0x25, 0x38, 0x1F, 0x02, 0x51, 0x4C, 0x6B, 0x76,
> +0x87, 0x9A, 0xBD, 0xA0, 0xF3, 0xEE, 0xC9, 0xD4,
> +0x6F, 0x72, 0x55, 0x48, 0x1B, 0x06, 0x21, 0x3C,
> +0x4A, 0x57, 0x70, 0x6D, 0x3E, 0x23, 0x04, 0x19,
> +0xA2, 0xBF, 0x98, 0x85, 0xD6, 0xCB, 0xEC, 0xF1,
> +0x13, 0x0E, 0x29, 0x34, 0x67, 0x7A, 0x5D, 0x40,
> +0xFB, 0xE6, 0xC1, 0xDC, 0x8F, 0x92, 0xB5, 0xA8,
> +0xDE, 0xC3, 0xE4, 0xF9, 0xAA, 0xB7, 0x90, 0x8D,
> +0x36, 0x2B, 0x0C, 0x11, 0x42, 0x5F, 0x78, 0x65,
> +0x94, 0x89, 0xAE, 0xB3, 0xE0, 0xFD, 0xDA, 0xC7,
> +0x7C, 0x61, 0x46, 0x5B, 0x08, 0x15, 0x32, 0x2F,
> +0x59, 0x44, 0x63, 0x7E, 0x2D, 0x30, 0x17, 0x0A,
> +0xB1, 0xAC, 0x8B, 0x96, 0xC5, 0xD8, 0xFF, 0xE2,
> +0x26, 0x3B, 0x1C, 0x01, 0x52, 0x4F, 0x68, 0x75,
> +0xCE, 0xD3, 0xF4, 0xE9, 0xBA, 0xA7, 0x80, 0x9D,
> +0xEB, 0xF6, 0xD1, 0xCC, 0x9F, 0x82, 0xA5, 0xB8,
> +0x03, 0x1E, 0x39, 0x24, 0x77, 0x6A, 0x4D, 0x50,
> +0xA1, 0xBC, 0x9B, 0x86, 0xD5, 0xC8, 0xEF, 0xF2,
> +0x49, 0x54, 0x73, 0x6E, 0x3D, 0x20, 0x07, 0x1A,
> +0x6C, 0x71, 0x56, 0x4B, 0x18, 0x05, 0x22, 0x3F,
> +0x84, 0x99, 0xBE, 0xA3, 0xF0, 0xED, 0xCA, 0xD7,
> +0x35, 0x28, 0x0F, 0x12, 0x41, 0x5C, 0x7B, 0x66,
> +0xDD, 0xC0, 0xE7, 0xFA, 0xA9, 0xB4, 0x93, 0x8E,
> +0xF8, 0xE5, 0xC2, 0xDF, 0x8C, 0x91, 0xB6, 0xAB,
> +0x10, 0x0D, 0x2A, 0x37, 0x64, 0x79, 0x5E, 0x43,
> +0xB2, 0xAF, 0x88, 0x95, 0xC6, 0xDB, 0xFC, 0xE1,
> +0x5A, 0x47, 0x60, 0x7D, 0x2E, 0x33, 0x14, 0x09,
> +0x7F, 0x62, 0x45, 0x58, 0x0B, 0x16, 0x31, 0x2C,
> +0x97, 0x8A, 0xAD, 0xB0, 0xE3, 0xFE, 0xD9, 0xC4
> +};
> +
> +uint8_t ff_sbc_crc8(const uint8_t *data, size_t len)
> +{
> +uint8_t crc = 0x0f;
> +size_t i;
> +uint8_t octet;
> +
> +for (i = 0; i < len / 8; i++)
> +crc = crc_table[crc ^ data[i]];
> +
> +octet = data[i];
> +for (i = 0; i < len % 8; i++) {
> +char bit = ((octet ^ crc) & 0x80) >> 7;
> +
> +crc = ((crc & 0x7f) << 1) ^ (bit ? 0x1d : 0);
> +
> +octet = octet << 1;
> +}
> +
> +return crc;
> +}
>


Yeah, no, I absolutely insist on using av_crc. The init function can handle
any byte-length CRC method as its done here.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] aptx: add codec cap SMALL_LAST_FRAME and INIT_THREADSAFE as appropriate

2017-12-17 Thread Rostislav Pehlivanov
On 17 December 2017 at 22:06, Aurelien Jacobs  wrote:

> ---
>  libavcodec/aptx.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/libavcodec/aptx.c b/libavcodec/aptx.c
> index d09ce8f838..a35d2861c1 100644
> --- a/libavcodec/aptx.c
> +++ b/libavcodec/aptx.c
> @@ -836,6 +836,7 @@ AVCodec ff_aptx_decoder = {
>  .decode= aptx_decode_frame,
>  .close = aptx_close,
>  .capabilities  = AV_CODEC_CAP_DR1,
> +.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
>  .channel_layouts   = (const uint64_t[]) { AV_CH_LAYOUT_STEREO, 0},
>  .sample_fmts   = (const enum AVSampleFormat[]) {
> AV_SAMPLE_FMT_S32P,
>
> AV_SAMPLE_FMT_NONE },
> @@ -852,6 +853,8 @@ AVCodec ff_aptx_encoder = {
>  .init  = aptx_init,
>  .encode2   = aptx_encode_frame,
>  .close = aptx_close,
> +.capabilities  = AV_CODEC_CAP_SMALL_LAST_FRAME,
> +.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
>  .channel_layouts   = (const uint64_t[]) { AV_CH_LAYOUT_STEREO, 0},
>  .sample_fmts   = (const enum AVSampleFormat[]) {
> AV_SAMPLE_FMT_S32P,
>
> AV_SAMPLE_FMT_NONE },
> --
> 2.15.1
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

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


Re: [FFmpeg-devel] [PATCH 8/8] Changelog: list the new SBC features

2017-12-17 Thread Aurelien Jacobs
On Mon, Dec 18, 2017 at 12:22:27AM +0100, Carl Eugen Hoyos wrote:
> 2017-12-17 22:47 GMT+01:00 Aurelien Jacobs :
> > ---
> >  Changelog | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/Changelog b/Changelog
> > index ee48876128..8eebcd810c 100644
> > --- a/Changelog
> > +++ b/Changelog
> > @@ -27,6 +27,8 @@ version :
> >  - video setrange filter
> >  - nsp demuxer
> >  - support LibreSSL (via libtls)
> > +- native SBC and mSBC encoder and decoder
> 
> > +- Raw SBC and mSBC muxer and demuxer
> 
> Imo, codec is enough, no need to mention a raw
> (de)muxer for a codec that has no other usage.

OK, there it is.>From de4d68b738cbb3598614831b181048591395840f Mon Sep 17 00:00:00 2001
From: Aurelien Jacobs 
Date: Sun, 17 Dec 2017 20:27:04 +0100
Subject: [PATCH 8/8] Changelog: list the new SBC codec

---
 Changelog | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Changelog b/Changelog
index ee48876128..4a98884a3c 100644
--- a/Changelog
+++ b/Changelog
@@ -27,6 +27,7 @@ version :
 - video setrange filter
 - nsp demuxer
 - support LibreSSL (via libtls)
+- native SBC and mSBC encoder and decoder
 
 
 version 3.4:
-- 
2.15.1

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


Re: [FFmpeg-devel] [PATCH 6/8] sbcenc: add MMX optimizations

2017-12-17 Thread Aurelien Jacobs
On Mon, Dec 18, 2017 at 12:21:00AM +0100, Carl Eugen Hoyos wrote:
> 2017-12-17 22:47 GMT+01:00 Aurelien Jacobs :
> > This was originally based on libsbc, and was fully integrated into ffmpeg.
> 
> Very rough numbers are useful in the commit message.

Here you go.>From 2227f8d8302fe37da00f34efacdf6b4941220330 Mon Sep 17 00:00:00 2001
From: Aurelien Jacobs 
Date: Sun, 17 Dec 2017 20:07:33 +0100
Subject: [PATCH 6/8] sbcenc: add MMX optimizations

This was originally based on libsbc, and was fully integrated into ffmpeg.

Rough speed test:
C version:speed= 592x
MMX version:  speed= 785x
---
 libavcodec/sbcdsp.c  |   3 +
 libavcodec/sbcdsp.h  |   2 +
 libavcodec/x86/Makefile  |   2 +
 libavcodec/x86/sbcdsp.asm| 284 +++
 libavcodec/x86/sbcdsp_init.c |  51 
 5 files changed, 342 insertions(+)
 create mode 100644 libavcodec/x86/sbcdsp.asm
 create mode 100644 libavcodec/x86/sbcdsp_init.c

diff --git a/libavcodec/sbcdsp.c b/libavcodec/sbcdsp.c
index 16faf5ba9b..9bb60cdd5e 100644
--- a/libavcodec/sbcdsp.c
+++ b/libavcodec/sbcdsp.c
@@ -387,4 +387,7 @@ av_cold void ff_sbcdsp_init(SBCDSPContext *s)
 /* Default implementation for scale factors calculation */
 s->sbc_calc_scalefactors = sbc_calc_scalefactors;
 s->sbc_calc_scalefactors_j = sbc_calc_scalefactors_j;
+
+if (ARCH_X86)
+ff_sbcdsp_init_x86(s);
 }
diff --git a/libavcodec/sbcdsp.h b/libavcodec/sbcdsp.h
index 66ed7d324e..127e6a8a11 100644
--- a/libavcodec/sbcdsp.h
+++ b/libavcodec/sbcdsp.h
@@ -80,4 +80,6 @@ struct sbc_dsp_context {
  */
 void ff_sbcdsp_init(SBCDSPContext *s);
 
+void ff_sbcdsp_init_x86(SBCDSPContext *s);
+
 #endif /* AVCODEC_SBCDSP_H */
diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile
index a805cd37b4..2350c8bbee 100644
--- a/libavcodec/x86/Makefile
+++ b/libavcodec/x86/Makefile
@@ -63,6 +63,7 @@ OBJS-$(CONFIG_PNG_DECODER) += x86/pngdsp_init.o
 OBJS-$(CONFIG_PRORES_DECODER)  += x86/proresdsp_init.o
 OBJS-$(CONFIG_PRORES_LGPL_DECODER) += x86/proresdsp_init.o
 OBJS-$(CONFIG_RV40_DECODER)+= x86/rv40dsp_init.o
+OBJS-$(CONFIG_SBC_ENCODER) += x86/sbcdsp_init.o
 OBJS-$(CONFIG_SVQ1_ENCODER)+= x86/svq1enc_init.o
 OBJS-$(CONFIG_TAK_DECODER) += x86/takdsp_init.o
 OBJS-$(CONFIG_TRUEHD_DECODER)  += x86/mlpdsp_init.o
@@ -172,6 +173,7 @@ X86ASM-OBJS-$(CONFIG_PNG_DECODER)  += x86/pngdsp.o
 X86ASM-OBJS-$(CONFIG_PRORES_DECODER)   += x86/proresdsp.o
 X86ASM-OBJS-$(CONFIG_PRORES_LGPL_DECODER) += x86/proresdsp.o
 X86ASM-OBJS-$(CONFIG_RV40_DECODER) += x86/rv40dsp.o
+X86ASM-OBJS-$(CONFIG_SBC_ENCODER)  += x86/sbcdsp.o
 X86ASM-OBJS-$(CONFIG_SVQ1_ENCODER) += x86/svq1enc.o
 X86ASM-OBJS-$(CONFIG_TAK_DECODER)  += x86/takdsp.o
 X86ASM-OBJS-$(CONFIG_TRUEHD_DECODER)   += x86/mlpdsp.o
diff --git a/libavcodec/x86/sbcdsp.asm b/libavcodec/x86/sbcdsp.asm
new file mode 100644
index 00..00b48a821b
--- /dev/null
+++ b/libavcodec/x86/sbcdsp.asm
@@ -0,0 +1,284 @@
+;**
+;* SIMD optimized SBC encoder DSP functions
+;*
+;* Copyright (C) 2017  Aurelien Jacobs 
+;* Copyright (C) 2008-2010  Nokia Corporation
+;* Copyright (C) 2004-2010  Marcel Holtmann 
+;* Copyright (C) 2004-2005  Henryk Ploetz 
+;* Copyright (C) 2005-2006  Brad Midgley 
+;*
+;* This file is part of FFmpeg.
+;*
+;* FFmpeg is free software; you can redistribute it and/or
+;* modify it under the terms of the GNU Lesser General Public
+;* License as published by the Free Software Foundation; either
+;* version 2.1 of the License, or (at your option) any later version.
+;*
+;* FFmpeg is distributed in the hope that it will be useful,
+;* but WITHOUT ANY WARRANTY; without even the implied warranty of
+;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;* Lesser General Public License for more details.
+;*
+;* You should have received a copy of the GNU Lesser General Public
+;* License along with FFmpeg; if not, write to the Free Software
+;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+;**
+
+%include "libavutil/x86/x86util.asm"
+
+SECTION_RODATA
+
+scale_mask: times 2 dd 0x8000; 1 << (SBC_PROTO_FIXED_SCALE - 1)
+
+SECTION .text
+
+;***
+;void ff_sbc_analyze_4(const int16_t *in, int32_t *out, const int16_t *consts);
+;***
+INIT_MMX mmx
+cglobal sbc_analyze_4, 3, 3, 4, in, out, consts
+movq  m0, [inq]
+movq  m1, [inq+8]
+pmaddwd   m0, [constsq]
+pmaddwd   m1, [constsq+8]
+paddd m0, [scale_mask]
+paddd m1, 

Re: [FFmpeg-devel] [PATCH 3/8] sbc: add raw demuxer for SBC

2017-12-17 Thread Aurelien Jacobs
On Mon, Dec 18, 2017 at 12:19:06AM +0100, Carl Eugen Hoyos wrote:
> 2017-12-17 22:47 GMT+01:00 Aurelien Jacobs :
> 
> > +#if CONFIG_SBC_DEMUXER
> > +AVInputFormat ff_sbc_demuxer = {
> > +.name   = "sbc",
> > +.long_name  = NULL_IF_CONFIG_SMALL("raw SBC (low-complexity 
> > subband codec)"),
> > +.extensions = "sbc",
> > +.raw_codec_id   = AV_CODEC_ID_SBC,
> > +.read_header= ff_raw_audio_read_header,
> > +.read_packet= ff_raw_read_partial_packet,
> > +.flags  = AVFMT_GENERIC_INDEX,
> > +};
> > +#endif
> > +
> > +#if CONFIG_MSBC_DEMUXER
> > +AVInputFormat ff_msbc_demuxer = {
> > +.name   = "msbc",
> > +.long_name  = NULL_IF_CONFIG_SMALL("raw mSBC (wideband speech mono 
> > SBC)"),
> > +.extensions = "msbc",
> > +.raw_codec_id   = AV_CODEC_ID_MSBC,
> > +.read_header= ff_raw_audio_read_header,
> > +.read_packet= ff_raw_read_partial_packet,
> > +.flags  = AVFMT_GENERIC_INDEX,
> > +};
> 
> If auto-detection is impossible, this could be moved into
> libavformat/rawdec.c.

I'm not really fond of this, but OK.

> > +#endif
> > diff --git a/libavformat/utils.c b/libavformat/utils.c
> > index 84e49208b8..860fbc30c9 100644
> > --- a/libavformat/utils.c
> > +++ b/libavformat/utils.c
> > @@ -336,6 +336,7 @@ static int set_codec_from_probe_data(AVFormatContext 
> > *s, AVStream *st,
> >  { "mjpeg_2000",AV_CODEC_ID_JPEG2000,   AVMEDIA_TYPE_VIDEO },
> >  { "mp3",   AV_CODEC_ID_MP3,AVMEDIA_TYPE_AUDIO },
> >  { "mpegvideo", AV_CODEC_ID_MPEG2VIDEO, AVMEDIA_TYPE_VIDEO },
> 
> > +{ "sbc",   AV_CODEC_ID_SBC,AVMEDIA_TYPE_AUDIO },
> 
> I believe this line should not be added.

Indeed, this is not needed anymore.

Here is an updated patch.>From a0613dfc9df64b8d8c71af48bb5c6fdd8bf8c212 Mon Sep 17 00:00:00 2001
From: Aurelien Jacobs 
Date: Sun, 17 Dec 2017 20:23:25 +0100
Subject: [PATCH 3/8] sbc: add raw demuxer for SBC

---
 doc/general.texi |  1 +
 libavformat/Makefile |  2 ++
 libavformat/allformats.c |  2 ++
 libavformat/rawdec.c | 24 
 4 files changed, 29 insertions(+)

diff --git a/doc/general.texi b/doc/general.texi
index ed137f999f..65aee47f2a 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -466,6 +466,7 @@ library:
 @item raw NULL  @tab X @tab
 @item raw video @tab X @tab X
 @item raw id RoQ@tab X @tab
+@item raw SBC   @tab   @tab X
 @item raw Shorten   @tab   @tab X
 @item raw TAK   @tab   @tab X
 @item raw TrueHD@tab X @tab X
diff --git a/libavformat/Makefile b/libavformat/Makefile
index cb70eac920..88d2cbd2b3 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -447,6 +447,8 @@ OBJS-$(CONFIG_S337M_DEMUXER) += s337m.o spdif.o
 OBJS-$(CONFIG_SAMI_DEMUXER)  += samidec.o subtitles.o
 OBJS-$(CONFIG_SAP_DEMUXER)   += sapdec.o
 OBJS-$(CONFIG_SAP_MUXER) += sapenc.o
+OBJS-$(CONFIG_SBC_DEMUXER)   += rawdec.o
+OBJS-$(CONFIG_MSBC_DEMUXER)  += rawdec.o
 OBJS-$(CONFIG_SBG_DEMUXER)   += sbgdec.o
 OBJS-$(CONFIG_SCC_DEMUXER)   += sccdec.o subtitles.o
 OBJS-$(CONFIG_SCC_MUXER) += sccenc.o subtitles.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 6a9b9883c9..a6b72715bd 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -211,6 +211,7 @@ static void register_all(void)
 REGISTER_MUXDEMUX(MPJPEG,   mpjpeg);
 REGISTER_DEMUXER (MPL2, mpl2);
 REGISTER_DEMUXER (MPSUB,mpsub);
+REGISTER_DEMUXER (MSBC, msbc);
 REGISTER_DEMUXER (MSF,  msf);
 REGISTER_DEMUXER (MSNWC_TCP,msnwc_tcp);
 REGISTER_DEMUXER (MTAF, mtaf);
@@ -277,6 +278,7 @@ static void register_all(void)
 REGISTER_DEMUXER (S337M,s337m);
 REGISTER_DEMUXER (SAMI, sami);
 REGISTER_MUXDEMUX(SAP,  sap);
+REGISTER_DEMUXER (SBC,  sbc);
 REGISTER_DEMUXER (SBG,  sbg);
 REGISTER_MUXDEMUX(SCC,  scc);
 REGISTER_DEMUXER (SDP,  sdp);
diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c
index e926549a60..d94f4972cb 100644
--- a/libavformat/rawdec.c
+++ b/libavformat/rawdec.c
@@ -191,3 +191,27 @@ static int mjpeg_probe(AVProbeData *p)
 
 FF_DEF_RAWVIDEO_DEMUXER2(mjpeg, "raw MJPEG video", mjpeg_probe, "mjpg,mjpeg,mpo", AV_CODEC_ID_MJPEG, AVFMT_GENERIC_INDEX|AVFMT_NOTIMESTAMPS)
 #endif
+
+#if CONFIG_SBC_DEMUXER
+AVInputFormat ff_sbc_demuxer = {
+.name   = "sbc",
+.long_name  = NULL_IF_CONFIG_SMALL("raw SBC (low-complexity subband codec)"),
+.extensions = "sbc",
+.raw_codec_id   = AV_CODEC_ID_SBC,
+.read_header= 

Re: [FFmpeg-devel] [FFmpeg-cvslog] lavc: enable hwaccel_flags option

2017-12-17 Thread Jun Zhao


On 2017/12/17 0:04, Michael Niedermayer wrote:
> On Mon, Oct 09, 2017 at 10:24:30PM +, Jun Zhao wrote:
>> ffmpeg | branch: master | Jun Zhao  | Mon Oct  9 
>> 15:49:58 2017 +0800| [71e2ec017a1b51987d50b97d48b6a6114a58507d] | committer: 
>> Mark Thompson
>>
>> lavc: enable hwaccel_flags option
>>
>> Enable per-stream hwaccel_flags.
>>
>> Signed-off-by: Jun Zhao 
>> Signed-off-by: Mark Thompson 
>>
>>> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=71e2ec017a1b51987d50b97d48b6a6114a58507d
>> ---
>>
>>  libavcodec/options_table.h | 4 
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
>> index 12712fb541..2ac37c3ff1 100644
>> --- a/libavcodec/options_table.h
>> +++ b/libavcodec/options_table.h
>> @@ -576,6 +576,10 @@ static const AVOption avcodec_options[] = {
>>  {"pixel_format", "set pixel format", OFFSET(pix_fmt), 
>> AV_OPT_TYPE_PIXEL_FMT, {.i64=AV_PIX_FMT_NONE}, -1, INT_MAX, 0 },
>>  {"video_size", "set video size", OFFSET(width), AV_OPT_TYPE_IMAGE_SIZE, 
>> {.str=NULL}, 0, INT_MAX, 0 },
>>  {"max_pixels", "Maximum number of pixels", OFFSET(max_pixels), 
>> AV_OPT_TYPE_INT64, {.i64 = INT_MAX }, 0, INT_MAX, A|V|S|D|E },
>> +{"hwaccel_flags", NULL, OFFSET(hwaccel_flags), AV_OPT_TYPE_FLAGS, {.i64 = 
>> AV_HWACCEL_FLAG_IGNORE_LEVEL }, 0, UINT_MAX, V|D, "hwaccel_flags"},
>> +{"ignore_level", "ignore level even if the codec level used is unknown or 
>> higher than the maximum supported level reported by the hardware driver", 0, 
>> AV_OPT_TYPE_CONST, { .i64 = AV_HWACCEL_FLAG_IGNORE_LEVEL }, INT_MIN, 
>> INT_MAX, V | D, "hwaccel_flags" },
>> +{"allow_high_depth", "allow to output YUV pixel formats with a different 
>> chroma sampling than 4:2:0 and/or other than 8 bits per component", 0, 
>> AV_OPT_TYPE_CONST, {.i64 = AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH }, INT_MIN, 
>> INT_MAX, V | D, "hwaccel_flags"},
>> +{"allow_profile_mismatch", "attempt to decode anyway if HW accelerated 
>> decoder's supported profiles do not exactly match the stream", 0, 
>> AV_OPT_TYPE_CONST, {.i64 = AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH }, 
>> INT_MIN, INT_MAX, V | D, "hwaccel_flags"},
> These flags are not documented in doc/* as other flags are, it seems it
> was forgotten to document them.
Will document the flags with other patch.
>
> [...]

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


Re: [FFmpeg-devel] [PATCH 07/25] avfilter: negotiate color_range between filters

2017-12-17 Thread Michael Niedermayer
On Sun, Dec 17, 2017 at 11:00:13AM +0100, Paul B Mahol wrote:
[...]

> @@ -130,17 +165,26 @@ static int query_formats(AVFilterContext *ctx)
>  {
>  FormatContext *s = ctx->priv;
>  AVFilterFormats *formats = ff_make_format_list(s->formats);
> +AVFilterFormats *color_ranges = 
> ff_make_color_range_list(s->color_ranges);
> +int ret;

this results in a warning:

libavfilter/vf_format.c: In function ‘query_formats’:
libavfilter/vf_format.c:168:5: warning: passing argument 1 of 
‘ff_make_color_range_list’ from incompatible pointer type [enabled by default]

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Into a blind darkness they enter who follow after the Ignorance,
they as if into a greater darkness enter who devote themselves
to the Knowledge alone. -- Isha Upanishad


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


Re: [FFmpeg-devel] [FFmpeg-cvslog] avfilter/vf_overlay: add premultiplied alpha mode

2017-12-17 Thread James Almer
On 12/17/2017 8:26 PM, Michael Niedermayer wrote:
> On Sat, Dec 16, 2017 at 05:44:03PM +, Paul B Mahol wrote:
>> ffmpeg | branch: master | Paul B Mahol  | Tue Aug  1 
>> 12:34:44 2017 +0200| [d29f784a54f2c91a0cdd3a2cc3bb000a99244f49] | committer: 
>> Paul B Mahol
>>
>> avfilter/vf_overlay: add premultiplied alpha mode
>>
>> Signed-off-by: Paul B Mahol 
>>
>>> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d29f784a54f2c91a0cdd3a2cc3bb000a99244f49
>> ---
> 
> This breaks fate here (gcc (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5 x86-64)
> 
> --- ./tests/ref/fate/filter-overlay_rgb_rgba  2017-12-15 20:24:03.586225583 
> +0100
> +++ tests/data/fate/filter-overlay_rgb_rgba   2017-12-18 00:23:08.601649951 
> +0100
> @@ -3,4 +3,4 @@
>  #codec_id 0: rawvideo
>  #dimensions 0: 128x128
>  #sar 0: 1/1
> -0,  0,  0,1,49152, 0xb0e3d586
> +0,  0,  0,1,49152, 0xcd3d78ab
> Test filter-overlay_rgb_rgba failed. Look at 
> tests/data/fate/filter-overlay_rgb_rgba.err for details.
> make: *** [fate-filter-overlay_rgb_rgba] Error 1
> make: *** Waiting for unfinished jobs
> --- ./tests/ref/fate/filter-overlay_rgba_rgba 2017-12-15 20:24:03.586225583 
> +0100
> +++ tests/data/fate/filter-overlay_rgba_rgba  2017-12-18 00:23:08.669649953 
> +0100
> @@ -3,4 +3,4 @@
>  #codec_id 0: rawvideo
>  #dimensions 0: 128x128
>  #sar 0: 1/1
> -0,  0,  0,1,65536, 0x33549946
> +0,  0,  0,1,65536, 0x37743c6b
> Test filter-overlay_rgba_rgba failed. Look at 
> tests/data/fate/filter-overlay_rgba_rgba.err for details.
> make: *** [fate-filter-overlay_rgba_rgba] Error 1

It actually broke fate for every x86 target, at least.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [FFmpeg-cvslog] avfilter/vf_overlay: add premultiplied alpha mode

2017-12-17 Thread Michael Niedermayer
On Sat, Dec 16, 2017 at 05:44:03PM +, Paul B Mahol wrote:
> ffmpeg | branch: master | Paul B Mahol  | Tue Aug  1 
> 12:34:44 2017 +0200| [d29f784a54f2c91a0cdd3a2cc3bb000a99244f49] | committer: 
> Paul B Mahol
> 
> avfilter/vf_overlay: add premultiplied alpha mode
> 
> Signed-off-by: Paul B Mahol 
> 
> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d29f784a54f2c91a0cdd3a2cc3bb000a99244f49
> ---

This breaks fate here (gcc (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5 x86-64)

--- ./tests/ref/fate/filter-overlay_rgb_rgba2017-12-15 20:24:03.586225583 
+0100
+++ tests/data/fate/filter-overlay_rgb_rgba 2017-12-18 00:23:08.601649951 
+0100
@@ -3,4 +3,4 @@
 #codec_id 0: rawvideo
 #dimensions 0: 128x128
 #sar 0: 1/1
-0,  0,  0,1,49152, 0xb0e3d586
+0,  0,  0,1,49152, 0xcd3d78ab
Test filter-overlay_rgb_rgba failed. Look at 
tests/data/fate/filter-overlay_rgb_rgba.err for details.
make: *** [fate-filter-overlay_rgb_rgba] Error 1
make: *** Waiting for unfinished jobs
--- ./tests/ref/fate/filter-overlay_rgba_rgba   2017-12-15 20:24:03.586225583 
+0100
+++ tests/data/fate/filter-overlay_rgba_rgba2017-12-18 00:23:08.669649953 
+0100
@@ -3,4 +3,4 @@
 #codec_id 0: rawvideo
 #dimensions 0: 128x128
 #sar 0: 1/1
-0,  0,  0,1,65536, 0x33549946
+0,  0,  0,1,65536, 0x37743c6b
Test filter-overlay_rgba_rgba failed. Look at 
tests/data/fate/filter-overlay_rgba_rgba.err for details.
make: *** [fate-filter-overlay_rgba_rgba] Error 1

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

If a bugfix only changes things apparently unrelated to the bug with no
further explanation, that is a good sign that the bugfix is wrong.


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


Re: [FFmpeg-devel] [PATCH 8/8] Changelog: list the new SBC features

2017-12-17 Thread Carl Eugen Hoyos
2017-12-17 22:47 GMT+01:00 Aurelien Jacobs :
> ---
>  Changelog | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/Changelog b/Changelog
> index ee48876128..8eebcd810c 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -27,6 +27,8 @@ version :
>  - video setrange filter
>  - nsp demuxer
>  - support LibreSSL (via libtls)
> +- native SBC and mSBC encoder and decoder

> +- Raw SBC and mSBC muxer and demuxer

Imo, codec is enough, no need to mention a raw
(de)muxer for a codec that has no other usage.

Thank you, Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 6/8] sbcenc: add MMX optimizations

2017-12-17 Thread Carl Eugen Hoyos
2017-12-17 22:47 GMT+01:00 Aurelien Jacobs :
> This was originally based on libsbc, and was fully integrated into ffmpeg.

Very rough numbers are useful in the commit message.

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


Re: [FFmpeg-devel] Refund request of travel costs for GSoC Summit 2017

2017-12-17 Thread Carl Eugen Hoyos
2017-12-17 14:30 GMT+01:00 Thilo Borgmann :
> As long as there is dedicated money left for this, I'd appreciate
> to be also reimbursed for the shoulder night I had to book at
> the venue hotel.

I'd like to add that the additional night was the reason for Thilo's
low(er) flight fare.

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


Re: [FFmpeg-devel] [PATCH 3/8] sbc: add raw demuxer for SBC

2017-12-17 Thread Carl Eugen Hoyos
2017-12-17 22:47 GMT+01:00 Aurelien Jacobs :

> +#if CONFIG_SBC_DEMUXER
> +AVInputFormat ff_sbc_demuxer = {
> +.name   = "sbc",
> +.long_name  = NULL_IF_CONFIG_SMALL("raw SBC (low-complexity subband 
> codec)"),
> +.extensions = "sbc",
> +.raw_codec_id   = AV_CODEC_ID_SBC,
> +.read_header= ff_raw_audio_read_header,
> +.read_packet= ff_raw_read_partial_packet,
> +.flags  = AVFMT_GENERIC_INDEX,
> +};
> +#endif
> +
> +#if CONFIG_MSBC_DEMUXER
> +AVInputFormat ff_msbc_demuxer = {
> +.name   = "msbc",
> +.long_name  = NULL_IF_CONFIG_SMALL("raw mSBC (wideband speech mono 
> SBC)"),
> +.extensions = "msbc",
> +.raw_codec_id   = AV_CODEC_ID_MSBC,
> +.read_header= ff_raw_audio_read_header,
> +.read_packet= ff_raw_read_partial_packet,
> +.flags  = AVFMT_GENERIC_INDEX,
> +};

If auto-detection is impossible, this could be moved into
libavformat/rawdec.c.

> +#endif
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 84e49208b8..860fbc30c9 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -336,6 +336,7 @@ static int set_codec_from_probe_data(AVFormatContext *s, 
> AVStream *st,
>  { "mjpeg_2000",AV_CODEC_ID_JPEG2000,   AVMEDIA_TYPE_VIDEO },
>  { "mp3",   AV_CODEC_ID_MP3,AVMEDIA_TYPE_AUDIO },
>  { "mpegvideo", AV_CODEC_ID_MPEG2VIDEO, AVMEDIA_TYPE_VIDEO },

> +{ "sbc",   AV_CODEC_ID_SBC,AVMEDIA_TYPE_AUDIO },

I believe this line should not be added.

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


Re: [FFmpeg-devel] avfilter/vf_interlace and vf_tinterlace : remove avx version

2017-12-17 Thread Thomas Mundt
Hi,

2017-12-16 18:38 GMT+01:00 Martin Vignali :

> Hello,
>
> Following discussion "avfilter/vf_interlace : add checkasm for lowpass_line
> and AVX2 version"
> the AVX version seems to be slower than SSE
>
> Patch in attach remove it, for vf_interlace and vf_tinterlace (both use the
> same SIMD)
>

when running checkasm several times sse2 is mostly faster here, not always.
But the difference is quite small.
Since I´m not an SIMD expert I´m fine with this patch as long as no one
with more expertise objects.

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


Re: [FFmpeg-devel] avfilter/vf_interlace : add checkasm for lowpass_line and AVX2 version

2017-12-17 Thread Thomas Mundt
Hi,

2017-12-16 18:35 GMT+01:00 Martin Vignali :

> 2017-12-16 14:48 GMT+01:00 Carl Eugen Hoyos :
>
> > 2017-12-16 14:17 GMT+01:00 Martin Vignali :
> >
> > > 002 : Checkasm test for lowpass_line
> >
> > The change to checkasm.mak contains unexpected tabs iiuc.
> >
>
> New patch in attach
>

Please also add the changes you made in patch 1 and avx2 to vf_tinterlace.

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


Re: [FFmpeg-devel] Refund request of travel costs for GSoC Summit 2017

2017-12-17 Thread Michael Niedermayer
On Sun, Dec 17, 2017 at 12:20:57PM +0100, Stefano Sabatini wrote:
> On date Sunday 2017-12-17 12:11:15 +0100, Stefano Sabatini encoded:
> > On date Tuesday 2017-11-21 19:15:33 +0100, Stefano Sabatini encoded:
> > > On Sat, Nov 18, 2017 at 6:26 PM, Thilo Borgmann 
> > > wrote:
> > > 
> > > > Hi,
> > > >
> > > > some time ago Carl Eugen and me went to the GSoC Summit. See review mail
> > > > for details.
> > > >
> > > > Here comes the refund request for my flight. Costs were 478.82€ total,
> > > > I'll send the invoice to Stefano privately as usual.
> > > >
> > > 
> > > Approved by me, still missing approval from Michael.
> > 
> > @Michael: ping (although I don't think this should be subject to
> > explicit approval, since it's implied by the contract between FFmpeg
> > and GSOC).
> 
> BTW, I also suggest since we had a total of 2200 EUR from Google to
> use the residual part to cover other accomodation and travel expenses.
> Rationale: representing FFmpeg in such events is a very important and
> strategic task for the project, it can be an exciting experience foar
> the delegates but it also takes much time and effort, and would be
> unfair to let the delegates spend their own monetary resources,
> especially given that the host organization is covering the expenses.

i agree about things needed for strategic tasks.

about this specific refund request, approved

thx


> 
> Please, Thilo and Carl, update this thread with other travel/attendace
> cost you had to cover.
> 
> Best.
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin


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


Re: [FFmpeg-devel] Refund request for FFshirt merchandise

2017-12-17 Thread Michael Niedermayer
On Sun, Dec 17, 2017 at 12:22:29PM +0100, Stefano Sabatini wrote:
> On date Tuesday 2017-11-21 18:50:44 +0100, Thilo Borgmann encoded:
> > Hi,
> > 
> 
> > here comes the refund request for getting us developer T-shirts and
> > sending them around the world as well as getting a stock of T-shirts
> > for future developers to come and for giveaways at conferences and
> > to honored users:
> > 
> > 
> > ItemNo  Cost
> > Shirt Samples672,00€
> > Shirts (Thomas) 19   228,00€
> > Shirts (Lou)25   300,00€
> > Shipping1885,69€
> > 
> > Total685,69€
> > 
> > See the corresponding thread for more details. Will send all the
> > invoices to Stefano privately (at least I hope so this time).
> 
> Approved by me, pending approval from Michael Niedermayer.

approved


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

"I am not trying to be anyone's saviour, I'm trying to think about the
 future and not be sad" - Elon Musk



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


Re: [FFmpeg-devel] [PATCH] Adding mkdir option for img2enc

2017-12-17 Thread Carl Eugen Hoyos
2017-12-17 23:41 GMT+01:00 Dr Alan Barclay :

> Please would someone with an interest in img2enc take a look
> at my minor feature addition and consider committing it to the
> main line for me.

To be acceptable, the patch has to be split in two and please
move the definition into internal.h

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


Re: [FFmpeg-devel] [PATCH v2 3/5] avformat/hls: add http_persistent option

2017-12-17 Thread Aman Gupta
On Sun, Dec 17, 2017 at 1:21 PM Anssi Hannula  wrote:

> Aman Gupta kirjoitti 2017-12-17 22:41:
> > On Sun, Dec 17, 2017 at 12:34 PM Anssi Hannula 
> > wrote:
> >
> >> Hi!
> >>
> >> Aman Gupta kirjoitti 2017-12-13 02:35:
> >> > From: Aman Gupta 
> >> >
> >> > This teaches the HLS demuxer to use the HTTP protocols
> >> > multiple_requests=1 option, to take advantage of "Connection:
> >> > Keep-Alive" when downloading playlists and segments from the HLS
> >> > server.
> >> >
> >> > With the new option, you can avoid TCP connection and TLS negotiation
> >> > overhead, which is particularly beneficial when streaming via a
> >> > high-latency internet connection.
> >> >
> >> > Similar to the http_persistent option recently implemented in hlsenc.c
> >>
> >> Why is this implemented as an option instead of simply being always
> >> used
> >> by the demuxer?
> >
> >
> > I have no strong feeling on this either way. I've tested the new option
> > against a few different HLS servers and would be comfortable enabling
> > it by
> > default. I do think it's worth keeping as an option in case someone
> > wants
> > to turn it off for whatever reason.
>
> OK. The only other demuxer that reuses HTTP connections seems to be
> rtmphttp, and it does not have an option.
> I think I'd prefer no option here as well unless a use case is known,
> but I'm not too strongly against it so I guess it could stay (but
> default to true).


>
> Does anyone else have any thoughts?


>
>
> Also, what happens if the hostname in the URI varies, does it properly
> open a new connection then?


Yes, ff_http_do_new_request will return EINVAL because of an earlier patch
in the series, and so the demuxer will print "keepalive request failed" and
fallback to a new connection.

I also tested with an http server configured to allow only N keepalive
requests on a socket. An ECONNRESET is similarly caught and printed, and
then a new connection is made.

There might be other cases or specific webserver/proxy behaviors not
correctly accounted for, which I why I think the option should be left in
place for now in case anyone need to force http/1.0 compatible behavior.

Aman


>
> >
> >>
> >> > ---
> >> >  doc/demuxers.texi |  3 +++
> >> >  libavformat/hls.c | 68
> >> > +++
> >> >  2 files changed, 67 insertions(+), 4 deletions(-)
> >> >
> >> > diff --git a/doc/demuxers.texi b/doc/demuxers.texi
> >> > index 73dc0feec1..18ff7101ac 100644
> >> > --- a/doc/demuxers.texi
> >> > +++ b/doc/demuxers.texi
> >> > @@ -316,6 +316,9 @@ segment index to start live streams at (negative
> >> > values are from the end).
> >> >  @item max_reload
> >> >  Maximum number of times a insufficient list is attempted to be
> >> > reloaded.
> >> >  Default value is 1000.
> >> > +
> >> > +@item http_persistent
> >> > +Use persistent HTTP connections. Applicable only for HTTP streams.
> >> >  @end table
> >> >
> >> >  @section image2
> >> > diff --git a/libavformat/hls.c b/libavformat/hls.c
> >> > index ab6ff187a6..5c1895c180 100644
> >> > --- a/libavformat/hls.c
> >> > +++ b/libavformat/hls.c
> >> > @@ -26,6 +26,7 @@
> >> >   * http://tools.ietf.org/html/draft-pantos-http-live-streaming
> >> >   */
> >> >
> >> > +#include "libavformat/http.h"
> >> >  #include "libavutil/avstring.h"
> >> >  #include "libavutil/avassert.h"
> >> >  #include "libavutil/intreadwrite.h"
> >> > @@ -94,6 +95,7 @@ struct playlist {
> >> >  AVIOContext pb;
> >> >  uint8_t* read_buffer;
> >> >  AVIOContext *input;
> >> > +int input_read_done;
> >> >  AVFormatContext *parent;
> >> >  int index;
> >> >  AVFormatContext *ctx;
> >> > @@ -206,6 +208,8 @@ typedef struct HLSContext {
> >> >  int strict_std_compliance;
> >> >  char *allowed_extensions;
> >> >  int max_reload;
> >> > +int http_persistent;
> >> > +AVIOContext *playlist_pb;
> >> >  } HLSContext;
> >> >
> >> >  static int read_chomp_line(AVIOContext *s, char *buf, int maxlen)
> >> > @@ -256,6 +260,7 @@ static void free_playlist_list(HLSContext *c)
> >> >  av_freep(>pb.buffer);
> >> >  if (pls->input)
> >> >  ff_format_io_close(c->ctx, >input);
> >> > +pls->input_read_done = 0;
> >> >  if (pls->ctx) {
> >> >  pls->ctx->pb = NULL;
> >> >  avformat_close_input(>ctx);
> >> > @@ -640,7 +645,24 @@ static int open_url(AVFormatContext *s,
> >> > AVIOContext **pb, const char *url,
> >> >  else if (strcmp(proto_name, "file") || !strncmp(url, "file,", 5))
> >> >  return AVERROR_INVALIDDATA;
> >> >
> >> > -ret = s->io_open(s, pb, url, AVIO_FLAG_READ, );
> >> > +if (c->http_persistent && *pb && av_strstart(proto_name, "http",
> >> > NULL)) {
> >> > +URLContext *uc = ffio_geturlcontext(*pb);
> >> > +av_assert0(uc);
> >> > +(*pb)->eof_reached = 0;
> >> > +ret = ff_http_do_new_request(uc, url);
> >> 

[FFmpeg-devel] [PATCH] Adding mkdir option for img2enc

2017-12-17 Thread Dr Alan Barclay

Hi All,

Please would someone with an interest in img2enc take a look at my minor 
feature addition and consider committing it to the main line for me.


Example:
ffmpeg -i ~/trailer.mp4 -strftime 1 -mkdir 1 %Y/%m/%d/out_%H-%M-%S.jpg

Without the new mkdir option, this command will fail if the directory 
hierarchy for the jpg files does not already exist, which can be 
difficult to predict for time-stamped directories.


This patch adds a mkdir option to img2enc which invites it to make 
whatever directory hierarchy is necessary for each output file. When 
used in conjunction with the strftime then the jpg files will be located 
in a newly created (time-stamped) directory as processing progresses.


My typical usage scenario is capturing a long-running live video feed 
(perhaps time-lapsed) and storing the resulting images in a time-stamped 
directory hierarchy fashion, rather than as a numbered sequence of files 
in a single directory.


If you look at the code you will see that only a half dozen lines of 
code were required in img2enc. The function for creating directories 
already existed in hlsenc.c but I've moved into utils.c as I presumed 
that was a more generic location for it.


All comments appreciated.

Thanks ad Regards,
Alan.

>From 666ba7be8878a401c1e7fedd6dd7f56c9e049e14 Mon Sep 17 00:00:00 2001
From: "Dr. Alan Barclay" 
Date: Sun, 17 Dec 2017 19:24:44 +
Subject: [PATCH] Adding mkdir option for img2enc.

---
 libavformat/avformat.h |  7 +++
 libavformat/hlsenc.c   | 33 -
 libavformat/img2enc.c  |  8 
 libavformat/utils.c| 33 +
 4 files changed, 48 insertions(+), 33 deletions(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 4f2798a871..8e76fb3349 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -2990,6 +2990,13 @@ int avformat_transfer_internal_stream_timing_info(const AVOutputFormat *ofmt,
 AVRational av_stream_get_codec_timebase(const AVStream *st);
 
 /**
+ * Make the specified directory.
+ *
+ * @param path  path for directory
+ */
+int mkdir_p(const char *path);
+
+/**
  * @}
  */
 
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index dd09739651..8523916d98 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -205,39 +205,6 @@ typedef struct HLSContext {
 int http_persistent;
 } HLSContext;
 
-static int mkdir_p(const char *path) {
-int ret = 0;
-char *temp = av_strdup(path);
-char *pos = temp;
-char tmp_ch = '\0';
-
-if (!path || !temp) {
-return -1;
-}
-
-if (!strncmp(temp, "/", 1) || !strncmp(temp, "\\", 1)) {
-pos++;
-} else if (!strncmp(temp, "./", 2) || !strncmp(temp, ".\\", 2)) {
-pos += 2;
-}
-
-for ( ; *pos != '\0'; ++pos) {
-if (*pos == '/' || *pos == '\\') {
-tmp_ch = *pos;
-*pos = '\0';
-ret = mkdir(temp, 0755);
-*pos = tmp_ch;
-}
-}
-
-if ((*(pos - 1) != '/') || (*(pos - 1) != '\\')) {
-ret = mkdir(temp, 0755);
-}
-
-av_free(temp);
-return ret;
-}
-
 static int is_http_proto(char *filename) {
 const char *proto = avio_find_protocol_name(filename);
 return proto ? (!av_strcasecmp(proto, "http") || !av_strcasecmp(proto, "https")) : 0;
diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c
index b680676bff..d037719ca1 100644
--- a/libavformat/img2enc.c
+++ b/libavformat/img2enc.c
@@ -42,6 +42,7 @@ typedef struct VideoMuxData {
 char target[4][1024];
 int update;
 int use_strftime;
+int use_mkdir;
 int frame_pts;
 const char *muxer;
 int use_rename;
@@ -114,6 +115,12 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
img->img_number, img->path);
 return AVERROR(EINVAL);
 }
+if (img->use_mkdir) {
+char *temp_filename = av_strdup(filename);
+const char *temp_path = av_dirname(temp_filename);
+mkdir_p(temp_path);
+av_free(temp_filename);
+}
 for (i = 0; i < 4; i++) {
 snprintf(img->tmp[i], sizeof(img->tmp[i]), "%s.tmp", filename);
 av_strlcpy(img->target[i], filename, sizeof(img->target[i]));
@@ -212,6 +219,7 @@ static const AVOption muxoptions[] = {
 { "update",   "continuously overwrite one file", OFFSET(update),  AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0,   1, ENC },
 { "start_number", "set first number in the sequence", OFFSET(img_number), AV_OPT_TYPE_INT,  { .i64 = 1 }, 0, INT_MAX, ENC },
 { "strftime", "use strftime for filename", OFFSET(use_strftime),  AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, ENC },
+{ "mkdir","make sub-dirs as required", OFFSET(use_mkdir),  AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, ENC },
 { "frame_pts","use current frame pts for filename", OFFSET(frame_pts),  AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, ENC },
 { 

[FFmpeg-devel] [PATCH 2/2] avcodec/jpeg2000dec: Free lengthinc earlier

2017-12-17 Thread Michael Niedermayer
Reduces memory needed
---
 libavcodec/jpeg2000dec.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index a9633fb9d1..d510004114 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -1044,6 +1044,8 @@ static int jpeg2000_decode_packet(Jpeg2000DecoderContext 
*s, Jpeg2000Tile *tile,
 nb_code_blocks = prec->nb_codeblocks_height * 
prec->nb_codeblocks_width;
 for (cblkno = 0; cblkno < nb_code_blocks; cblkno++) {
 Jpeg2000Cblk *cblk = prec->cblk + cblkno;
+if (!cblk->nb_terminationsinc && !cblk->lengthinc)
+continue;
 for (cwsno = 0; cwsno < cblk->nb_lengthinc; cwsno ++) {
 if (cblk->data_allocated < cblk->length + 
cblk->lengthinc[cwsno] + 4) {
 size_t new_size = FFMAX(2*cblk->data_allocated, 
cblk->length + cblk->lengthinc[cwsno] + 4);
@@ -1073,6 +1075,7 @@ static int jpeg2000_decode_packet(Jpeg2000DecoderContext 
*s, Jpeg2000Tile *tile,
 cblk->data_start[cblk->nb_terminations] = cblk->length;
 }
 }
+av_freep(>lengthinc);
 }
 }
 return 0;
-- 
2.15.1

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


[FFmpeg-devel] [PATCH 1/2] avcodec/jpeg2000dec: Allocate lengthinc and data_start arrays as needed

2017-12-17 Thread Michael Niedermayer
Decreases memory requirements
Fixes: OOM
Fixes: 4525/clusterfuzz-testcase-minimized-6400713073623040

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/jpeg2000.c| 3 ++-
 libavcodec/jpeg2000.h| 4 ++--
 libavcodec/jpeg2000dec.c | 7 +++
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c
index 5f3965047f..e7f03bd0df 100644
--- a/libavcodec/jpeg2000.c
+++ b/libavcodec/jpeg2000.c
@@ -359,7 +359,6 @@ static int init_prec(Jpeg2000Band *band,
 
 cblk->lblock= 3;
 cblk->length= 0;
-memset(cblk->lengthinc, 0, sizeof(cblk->lengthinc));
 cblk->npasses   = 0;
 }
 
@@ -607,6 +606,8 @@ void ff_jpeg2000_cleanup(Jpeg2000Component *comp, 
Jpeg2000CodingStyle *codsty)
 Jpeg2000Cblk *cblk = >cblk[cblkno];
 av_freep(>data);
 av_freep(>passes);
+av_freep(>lengthinc);
+av_freep(>data_start);
 }
 av_freep(>cblk);
 }
diff --git a/libavcodec/jpeg2000.h b/libavcodec/jpeg2000.h
index 752feae96b..c429ca5996 100644
--- a/libavcodec/jpeg2000.h
+++ b/libavcodec/jpeg2000.h
@@ -165,14 +165,14 @@ typedef struct Jpeg2000Cblk {
 uint8_t ninclpasses; // number coding of passes included in codestream
 uint8_t nonzerobits;
 uint16_t length;
-uint16_t lengthinc[JPEG2000_MAX_PASSES];
+uint16_t *lengthinc;
 uint8_t nb_lengthinc;
 uint8_t lblock;
 uint8_t *data;
 size_t data_allocated;
 int nb_terminations;
 int nb_terminationsinc;
-int data_start[JPEG2000_MAX_PASSES];
+int *data_start;
 Jpeg2000Pass *passes;
 int coord[2][2]; // border coordinates {{x0, x1}, {y0, y1}}
 } Jpeg2000Cblk; // code block
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 0309b1f6fb..a9633fb9d1 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -949,6 +949,7 @@ static int jpeg2000_decode_packet(Jpeg2000DecoderContext 
*s, Jpeg2000Tile *tile,
 for (cblkno = 0; cblkno < nb_code_blocks; cblkno++) {
 Jpeg2000Cblk *cblk = prec->cblk + cblkno;
 int incl, newpasses, llen;
+void *tmp;
 
 if (cblk->npasses)
 incl = get_bits(s, 1);
@@ -988,6 +989,12 @@ static int jpeg2000_decode_packet(Jpeg2000DecoderContext 
*s, Jpeg2000Tile *tile,
 
 cblk->nb_lengthinc = 0;
 cblk->nb_terminationsinc = 0;
+av_free(cblk->lengthinc);
+cblk->lengthinc  = av_mallocz_array(newpasses, 
sizeof(*cblk->lengthinc));
+tmp = av_realloc_array(cblk->data_start, cblk->nb_terminations + 
newpasses + 1, sizeof(*cblk->data_start));
+if (!tmp || !cblk->lengthinc)
+return AVERROR(ENOMEM);
+cblk->data_start = tmp;
 do {
 int newpasses1 = 0;
 
-- 
2.15.1

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


Re: [FFmpeg-devel] CoC enforcement activated

2017-12-17 Thread Compn
On Sun, 17 Dec 2017 22:16:50 +, Josh de Kock 
wrote:

> On Sun, 17 Dec 2017 17:12:24 -0500
> Compn  wrote:
> 
> > On Sun, 17 Dec 2017 21:57:07 +, Josh de Kock 
> > wrote:
> > 
> > > On Sun, 17 Dec 2017 15:36:53 -0500
> > > Compn  wrote:
> > > 
> > > > [...]
> > > >
> > > > emergency moderation has now been enabled.
> > > > 
> > > > why do i have to enforce the COC?
> > > > 
> > > > the ffmpeg-devel mailing list is for technical discussions of
> > > > developing ffmpeg. personal insults will not be tolerated.
> > > > 
> > > 
> > > Note that there is nothing on how the CoC should be 'enforced'. Also 
> > > consider that the CoC in our case is more of guidelines than strict rules 
> > > to be followed. There has also been no consensus on moderation being 
> > > enabled under what circumstances. 
> > 
> > right, i brought this up in april.
> > 
> > http://ffmpeg.org/pipermail/ffmpeg-devel/2017-April/210519.html
> > 
> 
> My point is: You should turn off this 'emergency moderation' as there's 
> nothing in the *non-existent* guidelines which say you are allowed to do so.

as said on irc, emergency moderation is the standard and expected tool
for ml admins to use to stomp out flame wars.

When this option is enabled, all list traffic is emergency moderated,
i.e. held for moderation. Turn this option on when your list is
experiencing a flamewar and you want a cooling off period.


emergency moderation is part of an ml admins job. it is not something i
thought up, invented, or wrote guidelines for. it is not something i
enjoy either.

having mails delayed ~2 minutes never hurt anyone.

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


Re: [FFmpeg-devel] CoC enforcement activated

2017-12-17 Thread Josh de Kock
On Sun, 17 Dec 2017 17:12:24 -0500
Compn  wrote:

> On Sun, 17 Dec 2017 21:57:07 +, Josh de Kock 
> wrote:
> 
> > On Sun, 17 Dec 2017 15:36:53 -0500
> > Compn  wrote:
> > 
> > > [...]
> > >
> > > emergency moderation has now been enabled.
> > > 
> > > why do i have to enforce the COC?
> > > 
> > > the ffmpeg-devel mailing list is for technical discussions of
> > > developing ffmpeg. personal insults will not be tolerated.
> > > 
> > 
> > Note that there is nothing on how the CoC should be 'enforced'. Also 
> > consider that the CoC in our case is more of guidelines than strict rules 
> > to be followed. There has also been no consensus on moderation being 
> > enabled under what circumstances. 
> 
> right, i brought this up in april.
> 
> http://ffmpeg.org/pipermail/ffmpeg-devel/2017-April/210519.html
> 

My point is: You should turn off this 'emergency moderation' as there's nothing 
in the *non-existent* guidelines which say you are allowed to do so.

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


Re: [FFmpeg-devel] CoC enforcement activated

2017-12-17 Thread Compn
On Sun, 17 Dec 2017 21:57:07 +, Josh de Kock 
wrote:

> On Sun, 17 Dec 2017 15:36:53 -0500
> Compn  wrote:
> 
> > [...]
> >
> > emergency moderation has now been enabled.
> > 
> > why do i have to enforce the COC?
> > 
> > the ffmpeg-devel mailing list is for technical discussions of
> > developing ffmpeg. personal insults will not be tolerated.
> > 
> 
> Note that there is nothing on how the CoC should be 'enforced'. Also consider 
> that the CoC in our case is more of guidelines than strict rules to be 
> followed. There has also been no consensus on moderation being enabled under 
> what circumstances. 

right, i brought this up in april.

http://ffmpeg.org/pipermail/ffmpeg-devel/2017-April/210519.html

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


[FFmpeg-devel] [PATCH] aptx: add codec cap SMALL_LAST_FRAME and INIT_THREADSAFE as appropriate

2017-12-17 Thread Aurelien Jacobs
---
 libavcodec/aptx.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/aptx.c b/libavcodec/aptx.c
index d09ce8f838..a35d2861c1 100644
--- a/libavcodec/aptx.c
+++ b/libavcodec/aptx.c
@@ -836,6 +836,7 @@ AVCodec ff_aptx_decoder = {
 .decode= aptx_decode_frame,
 .close = aptx_close,
 .capabilities  = AV_CODEC_CAP_DR1,
+.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
 .channel_layouts   = (const uint64_t[]) { AV_CH_LAYOUT_STEREO, 0},
 .sample_fmts   = (const enum AVSampleFormat[]) { 
AV_SAMPLE_FMT_S32P,
  
AV_SAMPLE_FMT_NONE },
@@ -852,6 +853,8 @@ AVCodec ff_aptx_encoder = {
 .init  = aptx_init,
 .encode2   = aptx_encode_frame,
 .close = aptx_close,
+.capabilities  = AV_CODEC_CAP_SMALL_LAST_FRAME,
+.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
 .channel_layouts   = (const uint64_t[]) { AV_CH_LAYOUT_STEREO, 0},
 .sample_fmts   = (const enum AVSampleFormat[]) { 
AV_SAMPLE_FMT_S32P,
  
AV_SAMPLE_FMT_NONE },
-- 
2.15.1

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


[FFmpeg-devel] [PATCH 1/2] avcodec/jpeg2000dec: Allocate lengthinc and data_start arrays as needed

2017-12-17 Thread Michael Niedermayer
Decreases memory requirements
Fixes: OOM
Fixes: 4525/clusterfuzz-testcase-minimized-6400713073623040

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/jpeg2000.c| 3 ++-
 libavcodec/jpeg2000.h| 4 ++--
 libavcodec/jpeg2000dec.c | 7 +++
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c
index 5f3965047f..e7f03bd0df 100644
--- a/libavcodec/jpeg2000.c
+++ b/libavcodec/jpeg2000.c
@@ -359,7 +359,6 @@ static int init_prec(Jpeg2000Band *band,
 
 cblk->lblock= 3;
 cblk->length= 0;
-memset(cblk->lengthinc, 0, sizeof(cblk->lengthinc));
 cblk->npasses   = 0;
 }
 
@@ -607,6 +606,8 @@ void ff_jpeg2000_cleanup(Jpeg2000Component *comp, 
Jpeg2000CodingStyle *codsty)
 Jpeg2000Cblk *cblk = >cblk[cblkno];
 av_freep(>data);
 av_freep(>passes);
+av_freep(>lengthinc);
+av_freep(>data_start);
 }
 av_freep(>cblk);
 }
diff --git a/libavcodec/jpeg2000.h b/libavcodec/jpeg2000.h
index 752feae96b..c429ca5996 100644
--- a/libavcodec/jpeg2000.h
+++ b/libavcodec/jpeg2000.h
@@ -165,14 +165,14 @@ typedef struct Jpeg2000Cblk {
 uint8_t ninclpasses; // number coding of passes included in codestream
 uint8_t nonzerobits;
 uint16_t length;
-uint16_t lengthinc[JPEG2000_MAX_PASSES];
+uint16_t *lengthinc;
 uint8_t nb_lengthinc;
 uint8_t lblock;
 uint8_t *data;
 size_t data_allocated;
 int nb_terminations;
 int nb_terminationsinc;
-int data_start[JPEG2000_MAX_PASSES];
+int *data_start;
 Jpeg2000Pass *passes;
 int coord[2][2]; // border coordinates {{x0, x1}, {y0, y1}}
 } Jpeg2000Cblk; // code block
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 0309b1f6fb..a9633fb9d1 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -949,6 +949,7 @@ static int jpeg2000_decode_packet(Jpeg2000DecoderContext 
*s, Jpeg2000Tile *tile,
 for (cblkno = 0; cblkno < nb_code_blocks; cblkno++) {
 Jpeg2000Cblk *cblk = prec->cblk + cblkno;
 int incl, newpasses, llen;
+void *tmp;
 
 if (cblk->npasses)
 incl = get_bits(s, 1);
@@ -988,6 +989,12 @@ static int jpeg2000_decode_packet(Jpeg2000DecoderContext 
*s, Jpeg2000Tile *tile,
 
 cblk->nb_lengthinc = 0;
 cblk->nb_terminationsinc = 0;
+av_free(cblk->lengthinc);
+cblk->lengthinc  = av_mallocz_array(newpasses, 
sizeof(*cblk->lengthinc));
+tmp = av_realloc_array(cblk->data_start, cblk->nb_terminations + 
newpasses + 1, sizeof(*cblk->data_start));
+if (!tmp || !cblk->lengthinc)
+return AVERROR(ENOMEM);
+cblk->data_start = tmp;
 do {
 int newpasses1 = 0;
 
-- 
2.15.1

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


Re: [FFmpeg-devel] CoC enforcement activated

2017-12-17 Thread Josh de Kock
On Sun, 17 Dec 2017 15:36:53 -0500
Compn  wrote:

> [...]
>
> emergency moderation has now been enabled.
> 
> why do i have to enforce the COC?
> 
> the ffmpeg-devel mailing list is for technical discussions of
> developing ffmpeg. personal insults will not be tolerated.
> 

Note that there is nothing on how the CoC should be 'enforced'. Also consider 
that the CoC in our case is more of guidelines than strict rules to be 
followed. There has also been no consensus on moderation being enabled under 
what circumstances. 

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


[FFmpeg-devel] [PATCH 2/2] avcodec/jpeg2000dec: Free lengthinc earlier

2017-12-17 Thread Michael Niedermayer
Reduces memory needed
---
 libavcodec/jpeg2000dec.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index a9633fb9d1..d510004114 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -1044,6 +1044,8 @@ static int jpeg2000_decode_packet(Jpeg2000DecoderContext 
*s, Jpeg2000Tile *tile,
 nb_code_blocks = prec->nb_codeblocks_height * 
prec->nb_codeblocks_width;
 for (cblkno = 0; cblkno < nb_code_blocks; cblkno++) {
 Jpeg2000Cblk *cblk = prec->cblk + cblkno;
+if (!cblk->nb_terminationsinc && !cblk->lengthinc)
+continue;
 for (cwsno = 0; cwsno < cblk->nb_lengthinc; cwsno ++) {
 if (cblk->data_allocated < cblk->length + 
cblk->lengthinc[cwsno] + 4) {
 size_t new_size = FFMAX(2*cblk->data_allocated, 
cblk->length + cblk->lengthinc[cwsno] + 4);
@@ -1073,6 +1075,7 @@ static int jpeg2000_decode_packet(Jpeg2000DecoderContext 
*s, Jpeg2000Tile *tile,
 cblk->data_start[cblk->nb_terminations] = cblk->length;
 }
 }
+av_freep(>lengthinc);
 }
 }
 return 0;
-- 
2.15.1

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


[FFmpeg-devel] [PATCH 8/8] Changelog: list the new SBC features

2017-12-17 Thread Aurelien Jacobs
---
 Changelog | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Changelog b/Changelog
index ee48876128..8eebcd810c 100644
--- a/Changelog
+++ b/Changelog
@@ -27,6 +27,8 @@ version :
 - video setrange filter
 - nsp demuxer
 - support LibreSSL (via libtls)
+- native SBC and mSBC encoder and decoder
+- Raw SBC and mSBC muxer and demuxer
 
 
 version 3.4:
-- 
2.15.1

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


[FFmpeg-devel] [PATCH 7/8] sbcenc: add armv6 and neon asm optimizations

2017-12-17 Thread Aurelien Jacobs
This was originally based on libsbc, and was fully integrated into ffmpeg.
---
 libavcodec/arm/Makefile  |   3 +
 libavcodec/arm/sbcdsp_armv6.S| 245 ++
 libavcodec/arm/sbcdsp_init_arm.c | 105 ++
 libavcodec/arm/sbcdsp_neon.S | 714 +++
 libavcodec/sbcdsp.c  |   2 +
 libavcodec/sbcdsp.h  |   1 +
 6 files changed, 1070 insertions(+)
 create mode 100644 libavcodec/arm/sbcdsp_armv6.S
 create mode 100644 libavcodec/arm/sbcdsp_init_arm.c
 create mode 100644 libavcodec/arm/sbcdsp_neon.S

diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile
index 1eeac5449e..fd2401f4e5 100644
--- a/libavcodec/arm/Makefile
+++ b/libavcodec/arm/Makefile
@@ -42,6 +42,7 @@ OBJS-$(CONFIG_DCA_DECODER) += 
arm/synth_filter_init_arm.o
 OBJS-$(CONFIG_HEVC_DECODER)+= arm/hevcdsp_init_arm.o
 OBJS-$(CONFIG_MLP_DECODER) += arm/mlpdsp_init_arm.o
 OBJS-$(CONFIG_RV40_DECODER)+= arm/rv40dsp_init_arm.o
+OBJS-$(CONFIG_SBC_ENCODER) += arm/sbcdsp_init_arm.o
 OBJS-$(CONFIG_VORBIS_DECODER)  += arm/vorbisdsp_init_arm.o
 OBJS-$(CONFIG_VP6_DECODER) += arm/vp6dsp_init_arm.o
 OBJS-$(CONFIG_VP9_DECODER) += arm/vp9dsp_init_10bpp_arm.o   \
@@ -81,6 +82,7 @@ ARMV6-OBJS-$(CONFIG_VP8DSP)+= arm/vp8_armv6.o 
  \
 
 # decoders/encoders
 ARMV6-OBJS-$(CONFIG_MLP_DECODER)   += arm/mlpdsp_armv6.o
+ARMV6-OBJS-$(CONFIG_SBC_ENCODER)   += arm/sbcdsp_armv6.o
 
 
 # VFP optimizations
@@ -140,6 +142,7 @@ NEON-OBJS-$(CONFIG_HEVC_DECODER)   += 
arm/hevcdsp_init_neon.o   \
 NEON-OBJS-$(CONFIG_RV30_DECODER)   += arm/rv34dsp_neon.o
 NEON-OBJS-$(CONFIG_RV40_DECODER)   += arm/rv34dsp_neon.o\
   arm/rv40dsp_neon.o
+NEON-OBJS-$(CONFIG_SBC_ENCODER)+= arm/sbcdsp_neon.o
 NEON-OBJS-$(CONFIG_VORBIS_DECODER) += arm/vorbisdsp_neon.o
 NEON-OBJS-$(CONFIG_VP6_DECODER)+= arm/vp6dsp_neon.o
 NEON-OBJS-$(CONFIG_VP9_DECODER)+= arm/vp9itxfm_16bpp_neon.o \
diff --git a/libavcodec/arm/sbcdsp_armv6.S b/libavcodec/arm/sbcdsp_armv6.S
new file mode 100644
index 00..f1ff845798
--- /dev/null
+++ b/libavcodec/arm/sbcdsp_armv6.S
@@ -0,0 +1,245 @@
+/*
+ * Bluetooth low-complexity, subband codec (SBC)
+ *
+ * Copyright (C) 2017  Aurelien Jacobs 
+ * Copyright (C) 2008-2010  Nokia Corporation
+ * Copyright (C) 2004-2010  Marcel Holtmann 
+ * Copyright (C) 2004-2005  Henryk Ploetz 
+ * Copyright (C) 2005-2006  Brad Midgley 
+ *
+ * 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
+ */
+
+/**
+ * @file
+ * SBC ARMv6 optimizations. The instructions are scheduled for ARM11 pipeline.
+ */
+
+#include "libavutil/arm/asm.S"
+
+function ff_sbc_analyze_4_armv6, export=1
+@ r0 = in, r1 = out, r2 = consts
+push{r1, r3-r7, lr}
+push{r8-r12, r14}
+ldrdr4,  r5,  [r0, #0]
+ldrdr6,  r7,  [r2, #0]
+ldrdr8,  r9,  [r0, #16]
+ldrdr10, r11, [r2, #16]
+mov r14, #0x8000
+smlad   r3,  r4,  r6,  r14
+smlad   r12, r5,  r7,  r14
+ldrdr4,  r5,  [r0, #32]
+ldrdr6,  r7,  [r2, #32]
+smlad   r3,  r8,  r10, r3
+smlad   r12, r9,  r11, r12
+ldrdr8,  r9,  [r0, #48]
+ldrdr10, r11, [r2, #48]
+smlad   r3,  r4,  r6,  r3
+smlad   r12, r5,  r7,  r12
+ldrdr4,  r5,  [r0, #64]
+ldrdr6,  r7,  [r2, #64]
+smlad   r3,  r8,  r10, r3
+smlad   r12, r9,  r11, r12
+ldrdr8,  r9,  [r0, #8]
+ldrdr10, r11, [r2, #8]
+smlad   r3,  r4,  r6,  r3@ t1[0] is done
+smlad   r12, r5,  r7,  r12   @ t1[1] is done
+ldrdr4,  r5,  [r0, #24]
+ldrdr6,  r7,  [r2, #24]
+pkhtb   r3,  r12, r3, asr #16@ combine t1[0] and t1[1]
+smlad   

[FFmpeg-devel] [PATCH 6/8] sbcenc: add MMX optimizations

2017-12-17 Thread Aurelien Jacobs
This was originally based on libsbc, and was fully integrated into ffmpeg.
---
 libavcodec/sbcdsp.c  |   3 +
 libavcodec/sbcdsp.h  |   2 +
 libavcodec/x86/Makefile  |   2 +
 libavcodec/x86/sbcdsp.asm| 284 +++
 libavcodec/x86/sbcdsp_init.c |  51 
 5 files changed, 342 insertions(+)
 create mode 100644 libavcodec/x86/sbcdsp.asm
 create mode 100644 libavcodec/x86/sbcdsp_init.c

diff --git a/libavcodec/sbcdsp.c b/libavcodec/sbcdsp.c
index 16faf5ba9b..9bb60cdd5e 100644
--- a/libavcodec/sbcdsp.c
+++ b/libavcodec/sbcdsp.c
@@ -387,4 +387,7 @@ av_cold void ff_sbcdsp_init(SBCDSPContext *s)
 /* Default implementation for scale factors calculation */
 s->sbc_calc_scalefactors = sbc_calc_scalefactors;
 s->sbc_calc_scalefactors_j = sbc_calc_scalefactors_j;
+
+if (ARCH_X86)
+ff_sbcdsp_init_x86(s);
 }
diff --git a/libavcodec/sbcdsp.h b/libavcodec/sbcdsp.h
index 66ed7d324e..127e6a8a11 100644
--- a/libavcodec/sbcdsp.h
+++ b/libavcodec/sbcdsp.h
@@ -80,4 +80,6 @@ struct sbc_dsp_context {
  */
 void ff_sbcdsp_init(SBCDSPContext *s);
 
+void ff_sbcdsp_init_x86(SBCDSPContext *s);
+
 #endif /* AVCODEC_SBCDSP_H */
diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile
index a805cd37b4..2350c8bbee 100644
--- a/libavcodec/x86/Makefile
+++ b/libavcodec/x86/Makefile
@@ -63,6 +63,7 @@ OBJS-$(CONFIG_PNG_DECODER) += x86/pngdsp_init.o
 OBJS-$(CONFIG_PRORES_DECODER)  += x86/proresdsp_init.o
 OBJS-$(CONFIG_PRORES_LGPL_DECODER) += x86/proresdsp_init.o
 OBJS-$(CONFIG_RV40_DECODER)+= x86/rv40dsp_init.o
+OBJS-$(CONFIG_SBC_ENCODER) += x86/sbcdsp_init.o
 OBJS-$(CONFIG_SVQ1_ENCODER)+= x86/svq1enc_init.o
 OBJS-$(CONFIG_TAK_DECODER) += x86/takdsp_init.o
 OBJS-$(CONFIG_TRUEHD_DECODER)  += x86/mlpdsp_init.o
@@ -172,6 +173,7 @@ X86ASM-OBJS-$(CONFIG_PNG_DECODER)  += x86/pngdsp.o
 X86ASM-OBJS-$(CONFIG_PRORES_DECODER)   += x86/proresdsp.o
 X86ASM-OBJS-$(CONFIG_PRORES_LGPL_DECODER) += x86/proresdsp.o
 X86ASM-OBJS-$(CONFIG_RV40_DECODER) += x86/rv40dsp.o
+X86ASM-OBJS-$(CONFIG_SBC_ENCODER)  += x86/sbcdsp.o
 X86ASM-OBJS-$(CONFIG_SVQ1_ENCODER) += x86/svq1enc.o
 X86ASM-OBJS-$(CONFIG_TAK_DECODER)  += x86/takdsp.o
 X86ASM-OBJS-$(CONFIG_TRUEHD_DECODER)   += x86/mlpdsp.o
diff --git a/libavcodec/x86/sbcdsp.asm b/libavcodec/x86/sbcdsp.asm
new file mode 100644
index 00..00b48a821b
--- /dev/null
+++ b/libavcodec/x86/sbcdsp.asm
@@ -0,0 +1,284 @@
+;**
+;* SIMD optimized SBC encoder DSP functions
+;*
+;* Copyright (C) 2017  Aurelien Jacobs 
+;* Copyright (C) 2008-2010  Nokia Corporation
+;* Copyright (C) 2004-2010  Marcel Holtmann 
+;* Copyright (C) 2004-2005  Henryk Ploetz 
+;* Copyright (C) 2005-2006  Brad Midgley 
+;*
+;* This file is part of FFmpeg.
+;*
+;* FFmpeg is free software; you can redistribute it and/or
+;* modify it under the terms of the GNU Lesser General Public
+;* License as published by the Free Software Foundation; either
+;* version 2.1 of the License, or (at your option) any later version.
+;*
+;* FFmpeg is distributed in the hope that it will be useful,
+;* but WITHOUT ANY WARRANTY; without even the implied warranty of
+;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;* Lesser General Public License for more details.
+;*
+;* You should have received a copy of the GNU Lesser General Public
+;* License along with FFmpeg; if not, write to the Free Software
+;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+;**
+
+%include "libavutil/x86/x86util.asm"
+
+SECTION_RODATA
+
+scale_mask: times 2 dd 0x8000; 1 << (SBC_PROTO_FIXED_SCALE - 1)
+
+SECTION .text
+
+;***
+;void ff_sbc_analyze_4(const int16_t *in, int32_t *out, const int16_t *consts);
+;***
+INIT_MMX mmx
+cglobal sbc_analyze_4, 3, 3, 4, in, out, consts
+movq  m0, [inq]
+movq  m1, [inq+8]
+pmaddwd   m0, [constsq]
+pmaddwd   m1, [constsq+8]
+paddd m0, [scale_mask]
+paddd m1, [scale_mask]
+
+movq  m2, [inq+16]
+movq  m3, [inq+24]
+pmaddwd   m2, [constsq+16]
+pmaddwd   m3, [constsq+24]
+paddd m0, m2
+paddd m1, m3
+
+movq  m2, [inq+32]
+movq  m3, [inq+40]
+pmaddwd   m2, [constsq+32]
+pmaddwd   m3, [constsq+40]
+paddd m0, m2
+paddd m1, m3
+
+movq  m2, [inq+48]
+movq  m3, [inq+56]
+pmaddwd   m2, [constsq+48]
+pmaddwd   m3, [constsq+56]
+paddd m0, m2

[FFmpeg-devel] [PATCH 1/8] sbc: implement SBC decoder (low-complexity subband codec)

2017-12-17 Thread Aurelien Jacobs
This was originally based on libsbc, and was fully integrated into ffmpeg.
---
 doc/general.texi |   2 +
 libavcodec/Makefile  |   2 +
 libavcodec/allcodecs.c   |   2 +
 libavcodec/avcodec.h |   2 +
 libavcodec/codec_desc.c  |  14 ++
 libavcodec/sbc.c | 316 
 libavcodec/sbc.h | 118 
 libavcodec/sbcdec.c  | 464 +++
 libavcodec/sbcdec_data.c | 127 +
 libavcodec/sbcdec_data.h |  44 +
 10 files changed, 1091 insertions(+)
 create mode 100644 libavcodec/sbc.c
 create mode 100644 libavcodec/sbc.h
 create mode 100644 libavcodec/sbcdec.c
 create mode 100644 libavcodec/sbcdec_data.c
 create mode 100644 libavcodec/sbcdec_data.h

diff --git a/doc/general.texi b/doc/general.texi
index 26919c9287..ed137f999f 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -1102,6 +1102,8 @@ following image formats are supported:
 @tab Real low bitrate AC-3 codec
 @item RealAudio Lossless @tab @tab  X
 @item RealAudio SIPR / ACELP.NET @tab @tab  X
+@item SBC (low-complexity subband codec) @tab @tab  X
+@tab Used in Bluetooth A2DP
 @item Shorten@tab @tab  X
 @item Sierra VMD audio   @tab @tab  X
 @tab Used in Sierra VMD files.
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index ca72138c02..c46d102227 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -581,6 +581,8 @@ OBJS-$(CONFIG_SUBVIEWER_DECODER)   += subviewerdec.o 
ass.o
 OBJS-$(CONFIG_SUNRAST_DECODER) += sunrast.o
 OBJS-$(CONFIG_SUNRAST_ENCODER) += sunrastenc.o
 OBJS-$(CONFIG_LIBRSVG_DECODER) += librsvgdec.o
+OBJS-$(CONFIG_SBC_DECODER) += sbcdec.o sbcdec_data.o sbc.o
+OBJS-$(CONFIG_MSBC_DECODER)+= sbcdec.o sbcdec_data.o sbc.o
 OBJS-$(CONFIG_SVQ1_DECODER)+= svq1dec.o svq1.o svq13.o h263data.o
 OBJS-$(CONFIG_SVQ1_ENCODER)+= svq1enc.o svq1.o  h263data.o  \
   h263.o ituh263enc.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index ed1e7ab06e..9e2480d2d4 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -379,6 +379,7 @@ static void register_all(void)
 REGISTER_DECODER(MP3ON4FLOAT,   mp3on4float);
 REGISTER_DECODER(MPC7,  mpc7);
 REGISTER_DECODER(MPC8,  mpc8);
+REGISTER_DECODER(MSBC,  msbc);
 REGISTER_ENCDEC (NELLYMOSER,nellymoser);
 REGISTER_DECODER(ON2AVC,on2avc);
 REGISTER_ENCDEC (OPUS,  opus);
@@ -392,6 +393,7 @@ static void register_all(void)
 REGISTER_DECODER(SHORTEN,   shorten);
 REGISTER_DECODER(SIPR,  sipr);
 REGISTER_DECODER(SMACKAUD,  smackaud);
+REGISTER_DECODER(SBC,   sbc);
 REGISTER_ENCDEC (SONIC, sonic);
 REGISTER_ENCODER(SONIC_LS,  sonic_ls);
 REGISTER_DECODER(TAK,   tak);
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index ce089b7c4a..5b7ec8541d 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -634,6 +634,8 @@ enum AVCodecID {
 AV_CODEC_ID_ATRAC3PAL,
 AV_CODEC_ID_DOLBY_E,
 AV_CODEC_ID_APTX,
+AV_CODEC_ID_SBC,
+AV_CODEC_ID_MSBC,
 
 /* subtitle codecs */
 AV_CODEC_ID_FIRST_SUBTITLE = 0x17000,  ///< A dummy ID pointing at 
the start of subtitle codecs.
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index c3688de1d6..a69897d379 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -2866,6 +2866,20 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("aptX (Audio Processing Technology 
for Bluetooth)"),
 .props = AV_CODEC_PROP_LOSSY,
 },
+{
+.id= AV_CODEC_ID_SBC,
+.type  = AVMEDIA_TYPE_AUDIO,
+.name  = "sbc",
+.long_name = NULL_IF_CONFIG_SMALL("SBC (low-complexity subband 
codec)"),
+.props = AV_CODEC_PROP_LOSSY,
+},
+{
+.id= AV_CODEC_ID_MSBC,
+.type  = AVMEDIA_TYPE_AUDIO,
+.name  = "msbc",
+.long_name = NULL_IF_CONFIG_SMALL("mSBC (wideband speech mono SBC)"),
+.props = AV_CODEC_PROP_LOSSY,
+},
 
 /* subtitle codecs */
 {
diff --git a/libavcodec/sbc.c b/libavcodec/sbc.c
new file mode 100644
index 00..99d02cc56a
--- /dev/null
+++ b/libavcodec/sbc.c
@@ -0,0 +1,316 @@
+/*
+ * Bluetooth low-complexity, subband codec (SBC)
+ *
+ * Copyright (C) 2017  Aurelien Jacobs 
+ * Copyright (C) 2012-2013  Intel Corporation
+ * Copyright (C) 2008-2010  Nokia Corporation
+ * Copyright (C) 2004-2010  Marcel Holtmann 
+ * Copyright (C) 2004-2005  Henryk Ploetz 
+ * Copyright (C) 2005-2008  Brad Midgley 
+ *
+ * This file is part of FFmpeg.
+ *
+ * 

[FFmpeg-devel] [PATCH 4/8] sbc: implement SBC encoder (low-complexity subband codec)

2017-12-17 Thread Aurelien Jacobs
This was originally based on libsbc, and was fully integrated into ffmpeg.
---
 doc/general.texi |   2 +-
 libavcodec/Makefile  |   2 +
 libavcodec/allcodecs.c   |   4 +-
 libavcodec/sbcdsp.c  | 390 +
 libavcodec/sbcdsp.h  |  83 +
 libavcodec/sbcdsp_data.c | 329 +++
 libavcodec/sbcdsp_data.h |  55 ++
 libavcodec/sbcenc.c  | 440 +++
 8 files changed, 1302 insertions(+), 3 deletions(-)
 create mode 100644 libavcodec/sbcdsp.c
 create mode 100644 libavcodec/sbcdsp.h
 create mode 100644 libavcodec/sbcdsp_data.c
 create mode 100644 libavcodec/sbcdsp_data.h
 create mode 100644 libavcodec/sbcenc.c

diff --git a/doc/general.texi b/doc/general.texi
index 65aee47f2a..e5669b0e93 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -1103,7 +1103,7 @@ following image formats are supported:
 @tab Real low bitrate AC-3 codec
 @item RealAudio Lossless @tab @tab  X
 @item RealAudio SIPR / ACELP.NET @tab @tab  X
-@item SBC (low-complexity subband codec) @tab @tab  X
+@item SBC (low-complexity subband codec) @tab  X  @tab  X
 @tab Used in Bluetooth A2DP
 @item Shorten@tab @tab  X
 @item Sierra VMD audio   @tab @tab  X
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 58c8c6e499..d237deeefc 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -582,7 +582,9 @@ OBJS-$(CONFIG_SUNRAST_DECODER) += sunrast.o
 OBJS-$(CONFIG_SUNRAST_ENCODER) += sunrastenc.o
 OBJS-$(CONFIG_LIBRSVG_DECODER) += librsvgdec.o
 OBJS-$(CONFIG_SBC_DECODER) += sbcdec.o sbcdec_data.o sbc.o
+OBJS-$(CONFIG_SBC_ENCODER) += sbcenc.o sbc.o sbcdsp.o sbcdsp_data.o
 OBJS-$(CONFIG_MSBC_DECODER)+= sbcdec.o sbcdec_data.o sbc.o
+OBJS-$(CONFIG_MSBC_ENCODER)+= sbcenc.o sbc.o sbcdsp.o sbcdsp_data.o
 OBJS-$(CONFIG_SVQ1_DECODER)+= svq1dec.o svq1.o svq13.o h263data.o
 OBJS-$(CONFIG_SVQ1_ENCODER)+= svq1enc.o svq1.o  h263data.o  \
   h263.o ituh263enc.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 3e3b37f638..e5b3c20ec7 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -379,7 +379,7 @@ static void register_all(void)
 REGISTER_DECODER(MP3ON4FLOAT,   mp3on4float);
 REGISTER_DECODER(MPC7,  mpc7);
 REGISTER_DECODER(MPC8,  mpc8);
-REGISTER_DECODER(MSBC,  msbc);
+REGISTER_ENCDEC (MSBC,  msbc);
 REGISTER_ENCDEC (NELLYMOSER,nellymoser);
 REGISTER_DECODER(ON2AVC,on2avc);
 REGISTER_ENCDEC (OPUS,  opus);
@@ -393,7 +393,7 @@ static void register_all(void)
 REGISTER_DECODER(SHORTEN,   shorten);
 REGISTER_DECODER(SIPR,  sipr);
 REGISTER_DECODER(SMACKAUD,  smackaud);
-REGISTER_DECODER(SBC,   sbc);
+REGISTER_ENCDEC (SBC,   sbc);
 REGISTER_ENCDEC (SONIC, sonic);
 REGISTER_ENCODER(SONIC_LS,  sonic_ls);
 REGISTER_DECODER(TAK,   tak);
diff --git a/libavcodec/sbcdsp.c b/libavcodec/sbcdsp.c
new file mode 100644
index 00..16faf5ba9b
--- /dev/null
+++ b/libavcodec/sbcdsp.c
@@ -0,0 +1,390 @@
+/*
+ * Bluetooth low-complexity, subband codec (SBC)
+ *
+ * Copyright (C) 2017  Aurelien Jacobs 
+ * Copyright (C) 2012-2013  Intel Corporation
+ * Copyright (C) 2008-2010  Nokia Corporation
+ * Copyright (C) 2004-2010  Marcel Holtmann 
+ * Copyright (C) 2004-2005  Henryk Ploetz 
+ * Copyright (C) 2005-2006  Brad Midgley 
+ *
+ * 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
+ */
+
+/**
+ * @file
+ * SBC basic "building bricks"
+ */
+
+#include 
+#include 
+#include 
+#include "libavutil/common.h"
+#include "libavutil/intmath.h"
+#include "libavutil/intreadwrite.h"
+#include "sbc.h"
+#include "sbcdsp.h"
+#include "sbcdsp_data.h"
+
+/*
+ * A reference C code of analysis filter with SIMD-friendly tables
+ * reordering and code layout. This code can be used to develop platform
+ * specific SIMD 

[FFmpeg-devel] [PATCH 2/8] sbc: add parser for SBC

2017-12-17 Thread Aurelien Jacobs
---
 libavcodec/Makefile |   1 +
 libavcodec/allcodecs.c  |   1 +
 libavcodec/sbc_parser.c | 124 
 3 files changed, 126 insertions(+)
 create mode 100644 libavcodec/sbc_parser.c

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index c46d102227..58c8c6e499 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -1012,6 +1012,7 @@ OBJS-$(CONFIG_PNG_PARSER)  += png_parser.o
 OBJS-$(CONFIG_PNM_PARSER)  += pnm_parser.o pnm.o
 OBJS-$(CONFIG_RV30_PARSER) += rv34_parser.o
 OBJS-$(CONFIG_RV40_PARSER) += rv34_parser.o
+OBJS-$(CONFIG_SBC_PARSER)  += sbc_parser.o
 OBJS-$(CONFIG_SIPR_PARSER) += sipr_parser.o
 OBJS-$(CONFIG_TAK_PARSER)  += tak_parser.o tak.o
 OBJS-$(CONFIG_VC1_PARSER)  += vc1_parser.o vc1.o vc1data.o  \
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 9e2480d2d4..3e3b37f638 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -653,6 +653,7 @@ static void register_all(void)
 REGISTER_PARSER(PNM,pnm);
 REGISTER_PARSER(RV30,   rv30);
 REGISTER_PARSER(RV40,   rv40);
+REGISTER_PARSER(SBC,sbc);
 REGISTER_PARSER(SIPR,   sipr);
 REGISTER_PARSER(TAK,tak);
 REGISTER_PARSER(VC1,vc1);
diff --git a/libavcodec/sbc_parser.c b/libavcodec/sbc_parser.c
new file mode 100644
index 00..032f72cf2b
--- /dev/null
+++ b/libavcodec/sbc_parser.c
@@ -0,0 +1,124 @@
+/*
+ * SBC parser
+ *
+ * Copyright (C) 2017  Aurelien Jacobs 
+ *
+ * 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 "sbc.h"
+#include "parser.h"
+
+typedef struct SBCParseContext {
+ParseContext pc;
+uint8_t header[3];
+int header_size;
+int buffered_size;
+} SBCParseContext;
+
+static int sbc_parse_header(AVCodecParserContext *s, AVCodecContext *avctx,
+const uint8_t *data, size_t len)
+{
+static const int sample_rates[4] = { 16000, 32000, 44100, 48000 };
+int sr, blocks, mode, subbands, bitpool, channels, joint;
+int length;
+
+if (len < 3)
+return -1;
+
+if (data[0] == MSBC_SYNCWORD && data[1] == 0 && data[2] == 0) {
+avctx->channels = 1;
+avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+avctx->sample_rate = 16000;
+avctx->frame_size = 120;
+s->duration = avctx->frame_size;
+return 57;
+}
+
+if (data[0] != SBC_SYNCWORD)
+return -2;
+
+sr   =   (data[1] >> 6) & 0x03;
+blocks   = (((data[1] >> 4) & 0x03) + 1) << 2;
+mode =   (data[1] >> 2) & 0x03;
+subbands = (((data[1] >> 0) & 0x01) + 1) << 2;
+bitpool  = data[2];
+
+channels = mode == SBC_MODE_MONO ? 1 : 2;
+joint= mode == SBC_MODE_JOINT_STEREO;
+
+length = 4 + (subbands * channels) / 2;
+if (channels == 1 || mode == SBC_MODE_DUAL_CHANNEL)
+length += ((channels * blocks * bitpool) + 7) / 8;
+else
+length += (((joint ? subbands : 0) + blocks * bitpool) + 7) / 8;
+
+avctx->channels = channels;
+avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+avctx->sample_rate = sample_rates[sr];
+avctx->frame_size = subbands * blocks;
+s->duration = avctx->frame_size;
+return length;
+}
+
+static int sbc_parse(AVCodecParserContext *s, AVCodecContext *avctx,
+ const uint8_t **poutbuf, int *poutbuf_size,
+ const uint8_t *buf, int buf_size)
+{
+SBCParseContext *pc = s->priv_data;
+int next;
+
+if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) {
+next = buf_size;
+} else {
+if (pc->header_size) {
+memcpy(pc->header + pc->header_size, buf,
+   sizeof(pc->header) - pc->header_size);
+next = sbc_parse_header(s, avctx, pc->header, sizeof(pc->header))
+ - pc->buffered_size;
+pc->header_size = 0;
+} else {
+next = sbc_parse_header(s, avctx, buf, buf_size);
+if (next >= buf_size)
+next = -1;
+}
+
+if (next < 0) {
+pc->header_size = FFMIN(sizeof(pc->header), 

[FFmpeg-devel] [PATCH 3/8] sbc: add raw demuxer for SBC

2017-12-17 Thread Aurelien Jacobs
---
 doc/general.texi |  1 +
 libavformat/Makefile |  2 ++
 libavformat/allformats.c |  2 ++
 libavformat/sbcdec.c | 47 +++
 libavformat/utils.c  |  1 +
 5 files changed, 53 insertions(+)
 create mode 100644 libavformat/sbcdec.c

diff --git a/doc/general.texi b/doc/general.texi
index ed137f999f..65aee47f2a 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -466,6 +466,7 @@ library:
 @item raw NULL  @tab X @tab
 @item raw video @tab X @tab X
 @item raw id RoQ@tab X @tab
+@item raw SBC   @tab   @tab X
 @item raw Shorten   @tab   @tab X
 @item raw TAK   @tab   @tab X
 @item raw TrueHD@tab X @tab X
diff --git a/libavformat/Makefile b/libavformat/Makefile
index cb70eac920..6270c28a8a 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -447,6 +447,8 @@ OBJS-$(CONFIG_S337M_DEMUXER) += s337m.o spdif.o
 OBJS-$(CONFIG_SAMI_DEMUXER)  += samidec.o subtitles.o
 OBJS-$(CONFIG_SAP_DEMUXER)   += sapdec.o
 OBJS-$(CONFIG_SAP_MUXER) += sapenc.o
+OBJS-$(CONFIG_SBC_DEMUXER)   += sbcdec.o rawdec.o
+OBJS-$(CONFIG_MSBC_DEMUXER)  += sbcdec.o rawdec.o
 OBJS-$(CONFIG_SBG_DEMUXER)   += sbgdec.o
 OBJS-$(CONFIG_SCC_DEMUXER)   += sccdec.o subtitles.o
 OBJS-$(CONFIG_SCC_MUXER) += sccenc.o subtitles.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 6a9b9883c9..a6b72715bd 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -211,6 +211,7 @@ static void register_all(void)
 REGISTER_MUXDEMUX(MPJPEG,   mpjpeg);
 REGISTER_DEMUXER (MPL2, mpl2);
 REGISTER_DEMUXER (MPSUB,mpsub);
+REGISTER_DEMUXER (MSBC, msbc);
 REGISTER_DEMUXER (MSF,  msf);
 REGISTER_DEMUXER (MSNWC_TCP,msnwc_tcp);
 REGISTER_DEMUXER (MTAF, mtaf);
@@ -277,6 +278,7 @@ static void register_all(void)
 REGISTER_DEMUXER (S337M,s337m);
 REGISTER_DEMUXER (SAMI, sami);
 REGISTER_MUXDEMUX(SAP,  sap);
+REGISTER_DEMUXER (SBC,  sbc);
 REGISTER_DEMUXER (SBG,  sbg);
 REGISTER_MUXDEMUX(SCC,  scc);
 REGISTER_DEMUXER (SDP,  sdp);
diff --git a/libavformat/sbcdec.c b/libavformat/sbcdec.c
new file mode 100644
index 00..a04a7c4328
--- /dev/null
+++ b/libavformat/sbcdec.c
@@ -0,0 +1,47 @@
+/*
+ * RAW SBC demuxer
+ * Copyright (C) 2017  Aurelien Jacobs 
+ *
+ * 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 "avformat.h"
+#include "rawdec.h"
+
+#if CONFIG_SBC_DEMUXER
+AVInputFormat ff_sbc_demuxer = {
+.name   = "sbc",
+.long_name  = NULL_IF_CONFIG_SMALL("raw SBC (low-complexity subband 
codec)"),
+.extensions = "sbc",
+.raw_codec_id   = AV_CODEC_ID_SBC,
+.read_header= ff_raw_audio_read_header,
+.read_packet= ff_raw_read_partial_packet,
+.flags  = AVFMT_GENERIC_INDEX,
+};
+#endif
+
+#if CONFIG_MSBC_DEMUXER
+AVInputFormat ff_msbc_demuxer = {
+.name   = "msbc",
+.long_name  = NULL_IF_CONFIG_SMALL("raw mSBC (wideband speech mono 
SBC)"),
+.extensions = "msbc",
+.raw_codec_id   = AV_CODEC_ID_MSBC,
+.read_header= ff_raw_audio_read_header,
+.read_packet= ff_raw_read_partial_packet,
+.flags  = AVFMT_GENERIC_INDEX,
+};
+#endif
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 84e49208b8..860fbc30c9 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -336,6 +336,7 @@ static int set_codec_from_probe_data(AVFormatContext *s, 
AVStream *st,
 { "mjpeg_2000",AV_CODEC_ID_JPEG2000,   AVMEDIA_TYPE_VIDEO },
 { "mp3",   AV_CODEC_ID_MP3,AVMEDIA_TYPE_AUDIO },
 { "mpegvideo", AV_CODEC_ID_MPEG2VIDEO, AVMEDIA_TYPE_VIDEO },
+{ "sbc",   AV_CODEC_ID_SBC,AVMEDIA_TYPE_AUDIO },
 { "truehd",AV_CODEC_ID_TRUEHD, AVMEDIA_TYPE_AUDIO },
 { 0 }
 };
-- 
2.15.1

___
ffmpeg-devel 

[FFmpeg-devel] [PATCH 5/8] sbc: add raw muxer for SBC

2017-12-17 Thread Aurelien Jacobs
---
 doc/general.texi |  2 +-
 libavformat/Makefile |  2 ++
 libavformat/allformats.c |  4 ++--
 libavformat/rawenc.c | 28 
 4 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/doc/general.texi b/doc/general.texi
index e5669b0e93..560465a4b8 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -466,7 +466,7 @@ library:
 @item raw NULL  @tab X @tab
 @item raw video @tab X @tab X
 @item raw id RoQ@tab X @tab
-@item raw SBC   @tab   @tab X
+@item raw SBC   @tab X @tab X
 @item raw Shorten   @tab   @tab X
 @item raw TAK   @tab   @tab X
 @item raw TrueHD@tab X @tab X
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 6270c28a8a..689fc6b23f 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -448,7 +448,9 @@ OBJS-$(CONFIG_SAMI_DEMUXER)  += samidec.o 
subtitles.o
 OBJS-$(CONFIG_SAP_DEMUXER)   += sapdec.o
 OBJS-$(CONFIG_SAP_MUXER) += sapenc.o
 OBJS-$(CONFIG_SBC_DEMUXER)   += sbcdec.o rawdec.o
+OBJS-$(CONFIG_SBC_MUXER) += rawenc.o
 OBJS-$(CONFIG_MSBC_DEMUXER)  += sbcdec.o rawdec.o
+OBJS-$(CONFIG_MSBC_MUXER)+= rawenc.o
 OBJS-$(CONFIG_SBG_DEMUXER)   += sbgdec.o
 OBJS-$(CONFIG_SCC_DEMUXER)   += sccdec.o subtitles.o
 OBJS-$(CONFIG_SCC_MUXER) += sccenc.o subtitles.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index a6b72715bd..eb1d17d38c 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -211,7 +211,7 @@ static void register_all(void)
 REGISTER_MUXDEMUX(MPJPEG,   mpjpeg);
 REGISTER_DEMUXER (MPL2, mpl2);
 REGISTER_DEMUXER (MPSUB,mpsub);
-REGISTER_DEMUXER (MSBC, msbc);
+REGISTER_MUXDEMUX(MSBC, msbc);
 REGISTER_DEMUXER (MSF,  msf);
 REGISTER_DEMUXER (MSNWC_TCP,msnwc_tcp);
 REGISTER_DEMUXER (MTAF, mtaf);
@@ -278,7 +278,7 @@ static void register_all(void)
 REGISTER_DEMUXER (S337M,s337m);
 REGISTER_DEMUXER (SAMI, sami);
 REGISTER_MUXDEMUX(SAP,  sap);
-REGISTER_DEMUXER (SBC,  sbc);
+REGISTER_MUXDEMUX(SBC,  sbc);
 REGISTER_DEMUXER (SBG,  sbg);
 REGISTER_MUXDEMUX(SCC,  scc);
 REGISTER_DEMUXER (SDP,  sdp);
diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c
index aa3ef76fbf..e27b280014 100644
--- a/libavformat/rawenc.c
+++ b/libavformat/rawenc.c
@@ -426,6 +426,34 @@ AVOutputFormat ff_rawvideo_muxer = {
 };
 #endif
 
+#if CONFIG_SBC_MUXER
+AVOutputFormat ff_sbc_muxer = {
+.name  = "sbc",
+.long_name = NULL_IF_CONFIG_SMALL("raw SBC"),
+.mime_type = "audio/x-sbc",
+.extensions= "sbc",
+.audio_codec   = AV_CODEC_ID_SBC,
+.video_codec   = AV_CODEC_ID_NONE,
+.write_header  = force_one_stream,
+.write_packet  = ff_raw_write_packet,
+.flags = AVFMT_NOTIMESTAMPS,
+};
+#endif
+
+#if CONFIG_MSBC_MUXER
+AVOutputFormat ff_msbc_muxer = {
+.name  = "msbc",
+.long_name = NULL_IF_CONFIG_SMALL("raw mSBC"),
+.mime_type = "audio/x-msbc",
+.extensions= "msbc",
+.audio_codec   = AV_CODEC_ID_MSBC,
+.video_codec   = AV_CODEC_ID_NONE,
+.write_header  = force_one_stream,
+.write_packet  = ff_raw_write_packet,
+.flags = AVFMT_NOTIMESTAMPS,
+};
+#endif
+
 #if CONFIG_TRUEHD_MUXER
 AVOutputFormat ff_truehd_muxer = {
 .name  = "truehd",
-- 
2.15.1

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


Re: [FFmpeg-devel] [PATCH 1/3] sbc: implement SBC codec (low-complexity subband codec)

2017-12-17 Thread Aurelien Jacobs
On Mon, Nov 06, 2017 at 12:53:38PM -0300, James Almer wrote:
> On 11/5/2017 8:35 PM, Aurelien Jacobs wrote:
> > This was originally based on libsbc, and was fully integrated into ffmpeg.
> > ---
> >  doc/general.texi |   2 +
> >  libavcodec/Makefile  |   4 +
> >  libavcodec/allcodecs.c   |   2 +
> >  libavcodec/arm/Makefile  |   3 +
> >  libavcodec/arm/sbcdsp_armv6.S| 245 ++
> >  libavcodec/arm/sbcdsp_init_arm.c | 105 ++
> >  libavcodec/arm/sbcdsp_neon.S | 714 
> > +++
> >  libavcodec/avcodec.h |   2 +
> >  libavcodec/codec_desc.c  |  12 +
> >  libavcodec/sbc.c | 316 +
> >  libavcodec/sbc.h | 121 +++
> >  libavcodec/sbcdec.c  | 469 +
> >  libavcodec/sbcdec_data.c | 127 +++
> >  libavcodec/sbcdec_data.h |  44 +++
> >  libavcodec/sbcdsp.c  | 569 +++
> >  libavcodec/sbcdsp.h  |  86 +
> >  libavcodec/sbcdsp_data.c | 335 ++
> >  libavcodec/sbcdsp_data.h |  57 
> >  libavcodec/sbcenc.c  | 461 +
> >  libavcodec/x86/Makefile  |   2 +
> >  libavcodec/x86/sbcdsp.asm| 290 
> >  libavcodec/x86/sbcdsp_init.c |  51 +++
> >  22 files changed, 4017 insertions(+)
> >  create mode 100644 libavcodec/arm/sbcdsp_armv6.S
> >  create mode 100644 libavcodec/arm/sbcdsp_init_arm.c
> >  create mode 100644 libavcodec/arm/sbcdsp_neon.S
> >  create mode 100644 libavcodec/sbc.c
> >  create mode 100644 libavcodec/sbc.h
> >  create mode 100644 libavcodec/sbcdec.c
> >  create mode 100644 libavcodec/sbcdec_data.c
> >  create mode 100644 libavcodec/sbcdec_data.h
> >  create mode 100644 libavcodec/sbcdsp.c
> >  create mode 100644 libavcodec/sbcdsp.h
> >  create mode 100644 libavcodec/sbcdsp_data.c
> >  create mode 100644 libavcodec/sbcdsp_data.h
> >  create mode 100644 libavcodec/sbcenc.c
> >  create mode 100644 libavcodec/x86/sbcdsp.asm
> >  create mode 100644 libavcodec/x86/sbcdsp_init.c
> 
> This needs to be split into at least four patches.
> One to add the decoder (plus codec ID, descriptor and such things), one
> to add the encoder (and the dsp framework), one to add the x86 assembly
> optimizations for the encoder, and one for the arm optimizations.

OK. New patchset is split this way.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/3] sbc: implement SBC codec (low-complexity subband codec)

2017-12-17 Thread Aurelien Jacobs
On Mon, Nov 06, 2017 at 04:40:56AM +, Rostislav Pehlivanov wrote:
> On 5 November 2017 at 23:35, Aurelien Jacobs  wrote:
> 
> > This was originally based on libsbc, and was fully integrated into ffmpeg.
> > ---
> >  doc/general.texi |   2 +
> >  libavcodec/Makefile  |   4 +
> >  libavcodec/allcodecs.c   |   2 +
> >  libavcodec/arm/Makefile  |   3 +
> >  libavcodec/arm/sbcdsp_armv6.S| 245 ++
> >  libavcodec/arm/sbcdsp_init_arm.c | 105 ++
> >  libavcodec/arm/sbcdsp_neon.S | 714 ++
> > +
> >  libavcodec/avcodec.h |   2 +
> >  libavcodec/codec_desc.c  |  12 +
> >  libavcodec/sbc.c | 316 +
> >  libavcodec/sbc.h | 121 +++
> >  libavcodec/sbcdec.c  | 469 +
> >  libavcodec/sbcdec_data.c | 127 +++
> >  libavcodec/sbcdec_data.h |  44 +++
> >  libavcodec/sbcdsp.c  | 569 +++
> >  libavcodec/sbcdsp.h  |  86 +
> >  libavcodec/sbcdsp_data.c | 335 ++
> >  libavcodec/sbcdsp_data.h |  57 
> >  libavcodec/sbcenc.c  | 461 +
> >  libavcodec/x86/Makefile  |   2 +
> >  libavcodec/x86/sbcdsp.asm| 290 
> >  libavcodec/x86/sbcdsp_init.c |  51 +++
> >  22 files changed, 4017 insertions(+)
> >  create mode 100644 libavcodec/arm/sbcdsp_armv6.S
> >  create mode 100644 libavcodec/arm/sbcdsp_init_arm.c
> >  create mode 100644 libavcodec/arm/sbcdsp_neon.S
> >  create mode 100644 libavcodec/sbc.c
> >  create mode 100644 libavcodec/sbc.h
> >  create mode 100644 libavcodec/sbcdec.c
> >  create mode 100644 libavcodec/sbcdec_data.c
> >  create mode 100644 libavcodec/sbcdec_data.h
> >  create mode 100644 libavcodec/sbcdsp.c
> >  create mode 100644 libavcodec/sbcdsp.h
> >  create mode 100644 libavcodec/sbcdsp_data.c
> >  create mode 100644 libavcodec/sbcdsp_data.h
> >  create mode 100644 libavcodec/sbcenc.c
> >  create mode 100644 libavcodec/x86/sbcdsp.asm
> >  create mode 100644 libavcodec/x86/sbcdsp_init.c
> >
> > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> > index c4134424f0..2d541bf64a 100644
> > --- a/libavcodec/avcodec.h
> > +++ b/libavcodec/avcodec.h
> > @@ -632,6 +632,8 @@ enum AVCodecID {
> >  AV_CODEC_ID_ATRAC3AL,
> >  AV_CODEC_ID_ATRAC3PAL,
> >  AV_CODEC_ID_DOLBY_E,
> > +AV_CODEC_ID_SBC,
> > +AV_CODEC_ID_MSBC,
> >
> >
> See below.
> 
> 
> >  /* subtitle codecs */
> >  AV_CODEC_ID_FIRST_SUBTITLE = 0x17000,  ///< A dummy ID
> > pointing at the start of subtitle codecs.
> > diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
> > index 92bf1d2681..8d613507e0 100644
> > --- a/libavcodec/codec_desc.c
> > +++ b/libavcodec/codec_desc.c
> > @@ -2859,6 +2859,18 @@ static const AVCodecDescriptor codec_descriptors[]
> > = {
> >  .long_name = NULL_IF_CONFIG_SMALL("ADPCM MTAF"),
> >  .props = AV_CODEC_PROP_LOSSY,
> >  },
> > +{
> > +.id= AV_CODEC_ID_SBC,
> > +.type  = AVMEDIA_TYPE_AUDIO,
> > +.name  = "sbc",
> > +.long_name = NULL_IF_CONFIG_SMALL("SBC (low-complexity subband
> > codec)"),
> > +},
> > +{
> > +.id= AV_CODEC_ID_MSBC,
> > +.type  = AVMEDIA_TYPE_AUDIO,
> > +.name  = "msbc",
> > +.long_name = NULL_IF_CONFIG_SMALL("mSBC (wideband speech mono
> > SBC)"),
> > +},
> >
> 
> Is there a bitstream difference between the two? I don't think so, so you
> should instead define FF_PROFILE_SBC_WB and use a single codec ID.

SBC support various samplerates while mSBC is limited to 16 kHz.
I think the only way to declare this properly and to get automatic
conversion to 16 kHz when encoding to mSBC is to have 2 separate
codec ID.
So I kept the 2 separate codec ID.

> > diff --git a/libavcodec/sbc.c b/libavcodec/sbc.c
> > new file mode 100644
> > index 00..99d02cc56a
> > --- /dev/null
> > +++ b/libavcodec/sbc.c
> > @@ -0,0 +1,316 @@
> > +/*
> > + * Bluetooth low-complexity, subband codec (SBC)
> > + *
> > + * Copyright (C) 2017  Aurelien Jacobs 
> > + * Copyright (C) 2012-2013  Intel Corporation
> > + * Copyright (C) 2008-2010  Nokia Corporation
> > + * Copyright (C) 2004-2010  Marcel Holtmann 
> > + * Copyright (C) 2004-2005  Henryk Ploetz 
> > + * Copyright (C) 2005-2008  Brad Midgley 
> > + *
> > + * 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 

Re: [FFmpeg-devel] [PATCH 1/3] sbc: implement SBC codec (low-complexity subband codec)

2017-12-17 Thread Aurelien Jacobs
On Mon, Nov 06, 2017 at 04:22:30AM +0100, Michael Niedermayer wrote:
> Hi 
> 
> On Mon, Nov 06, 2017 at 12:35:18AM +0100, Aurelien Jacobs wrote:
> > This was originally based on libsbc, and was fully integrated into ffmpeg.
> > ---
> >  doc/general.texi |   2 +
> >  libavcodec/Makefile  |   4 +
> >  libavcodec/allcodecs.c   |   2 +
> >  libavcodec/arm/Makefile  |   3 +
> >  libavcodec/arm/sbcdsp_armv6.S| 245 ++
> >  libavcodec/arm/sbcdsp_init_arm.c | 105 ++
> >  libavcodec/arm/sbcdsp_neon.S | 714 
> > +++
> >  libavcodec/avcodec.h |   2 +
> >  libavcodec/codec_desc.c  |  12 +
> >  libavcodec/sbc.c | 316 +
> >  libavcodec/sbc.h | 121 +++
> >  libavcodec/sbcdec.c  | 469 +
> >  libavcodec/sbcdec_data.c | 127 +++
> >  libavcodec/sbcdec_data.h |  44 +++
> >  libavcodec/sbcdsp.c  | 569 +++
> >  libavcodec/sbcdsp.h  |  86 +
> >  libavcodec/sbcdsp_data.c | 335 ++
> >  libavcodec/sbcdsp_data.h |  57 
> >  libavcodec/sbcenc.c  | 461 +
> >  libavcodec/x86/Makefile  |   2 +
> >  libavcodec/x86/sbcdsp.asm| 290 
> >  libavcodec/x86/sbcdsp_init.c |  51 +++
> >  22 files changed, 4017 insertions(+)
> >  create mode 100644 libavcodec/arm/sbcdsp_armv6.S
> >  create mode 100644 libavcodec/arm/sbcdsp_init_arm.c
> >  create mode 100644 libavcodec/arm/sbcdsp_neon.S
> >  create mode 100644 libavcodec/sbc.c
> >  create mode 100644 libavcodec/sbc.h
> >  create mode 100644 libavcodec/sbcdec.c
> >  create mode 100644 libavcodec/sbcdec_data.c
> >  create mode 100644 libavcodec/sbcdec_data.h
> >  create mode 100644 libavcodec/sbcdsp.c
> >  create mode 100644 libavcodec/sbcdsp.h
> >  create mode 100644 libavcodec/sbcdsp_data.c
> >  create mode 100644 libavcodec/sbcdsp_data.h
> >  create mode 100644 libavcodec/sbcenc.c
> >  create mode 100644 libavcodec/x86/sbcdsp.asm
> >  create mode 100644 libavcodec/x86/sbcdsp_init.c
> 
> this seems to fail to build on x86-32

Ooops... Haven't use x86-32 for so long that it didn't even occured to
me to test it.

> libavcodec/x86/sbcdsp_init.o
> src/libavcodec/x86/sbcdsp.asm:251: error: invalid operands in non-64-bit mode
> src/libavcodec/x86/sbcdsp.asm:264: error: invalid operands in non-64-bit mode
> src/libavcodec/x86/sbcdsp.asm:267: error: invalid operands in non-64-bit mode
> src/libavcodec/x86/sbcdsp.asm:269: error: invalid operands in non-64-bit mode
> src/libavcodec/x86/sbcdsp.asm:270: error: invalid operands in non-64-bit mode
> src/libavcodec/x86/sbcdsp.asm:271: error: invalid operands in non-64-bit mode
> src/libavcodec/x86/sbcdsp.asm:273: error: invalid operands in non-64-bit mode
> src/libavcodec/x86/sbcdsp.asm:274: error: invalid operands in non-64-bit mode
> src/libavcodec/x86/sbcdsp.asm:275: error: invalid operands in non-64-bit mode
> src/libavcodec/x86/sbcdsp.asm:276: error: invalid operands in non-64-bit mode
> STRIP   libavcodec/x86/opus_pvq_search.o

Fixed in upcoming patchset.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2 3/5] avformat/hls: add http_persistent option

2017-12-17 Thread Anssi Hannula

Aman Gupta kirjoitti 2017-12-17 22:41:
On Sun, Dec 17, 2017 at 12:34 PM Anssi Hannula  
wrote:



Hi!

Aman Gupta kirjoitti 2017-12-13 02:35:
> From: Aman Gupta 
>
> This teaches the HLS demuxer to use the HTTP protocols
> multiple_requests=1 option, to take advantage of "Connection:
> Keep-Alive" when downloading playlists and segments from the HLS
> server.
>
> With the new option, you can avoid TCP connection and TLS negotiation
> overhead, which is particularly beneficial when streaming via a
> high-latency internet connection.
>
> Similar to the http_persistent option recently implemented in hlsenc.c

Why is this implemented as an option instead of simply being always 
used

by the demuxer?



I have no strong feeling on this either way. I've tested the new option
against a few different HLS servers and would be comfortable enabling 
it by
default. I do think it's worth keeping as an option in case someone 
wants

to turn it off for whatever reason.


OK. The only other demuxer that reuses HTTP connections seems to be 
rtmphttp, and it does not have an option.
I think I'd prefer no option here as well unless a use case is known, 
but I'm not too strongly against it so I guess it could stay (but 
default to true).


Does anyone else have any thoughts?


Also, what happens if the hostname in the URI varies, does it properly 
open a new connection then?






> ---
>  doc/demuxers.texi |  3 +++
>  libavformat/hls.c | 68
> +++
>  2 files changed, 67 insertions(+), 4 deletions(-)
>
> diff --git a/doc/demuxers.texi b/doc/demuxers.texi
> index 73dc0feec1..18ff7101ac 100644
> --- a/doc/demuxers.texi
> +++ b/doc/demuxers.texi
> @@ -316,6 +316,9 @@ segment index to start live streams at (negative
> values are from the end).
>  @item max_reload
>  Maximum number of times a insufficient list is attempted to be
> reloaded.
>  Default value is 1000.
> +
> +@item http_persistent
> +Use persistent HTTP connections. Applicable only for HTTP streams.
>  @end table
>
>  @section image2
> diff --git a/libavformat/hls.c b/libavformat/hls.c
> index ab6ff187a6..5c1895c180 100644
> --- a/libavformat/hls.c
> +++ b/libavformat/hls.c
> @@ -26,6 +26,7 @@
>   * http://tools.ietf.org/html/draft-pantos-http-live-streaming
>   */
>
> +#include "libavformat/http.h"
>  #include "libavutil/avstring.h"
>  #include "libavutil/avassert.h"
>  #include "libavutil/intreadwrite.h"
> @@ -94,6 +95,7 @@ struct playlist {
>  AVIOContext pb;
>  uint8_t* read_buffer;
>  AVIOContext *input;
> +int input_read_done;
>  AVFormatContext *parent;
>  int index;
>  AVFormatContext *ctx;
> @@ -206,6 +208,8 @@ typedef struct HLSContext {
>  int strict_std_compliance;
>  char *allowed_extensions;
>  int max_reload;
> +int http_persistent;
> +AVIOContext *playlist_pb;
>  } HLSContext;
>
>  static int read_chomp_line(AVIOContext *s, char *buf, int maxlen)
> @@ -256,6 +260,7 @@ static void free_playlist_list(HLSContext *c)
>  av_freep(>pb.buffer);
>  if (pls->input)
>  ff_format_io_close(c->ctx, >input);
> +pls->input_read_done = 0;
>  if (pls->ctx) {
>  pls->ctx->pb = NULL;
>  avformat_close_input(>ctx);
> @@ -640,7 +645,24 @@ static int open_url(AVFormatContext *s,
> AVIOContext **pb, const char *url,
>  else if (strcmp(proto_name, "file") || !strncmp(url, "file,", 5))
>  return AVERROR_INVALIDDATA;
>
> -ret = s->io_open(s, pb, url, AVIO_FLAG_READ, );
> +if (c->http_persistent && *pb && av_strstart(proto_name, "http",
> NULL)) {
> +URLContext *uc = ffio_geturlcontext(*pb);
> +av_assert0(uc);
> +(*pb)->eof_reached = 0;
> +ret = ff_http_do_new_request(uc, url);
> +if (ret == AVERROR_EXIT) {
> +ff_format_io_close(c->ctx, >playlist_pb);
> +return ret;
> +} else if (ret < 0) {
> +av_log(s, AV_LOG_WARNING,
> +"keepalive request failed for '%s', retrying with new
> connection: %s\n",
> +url, av_err2str(ret));
> +ff_format_io_close(c->ctx, pb);
> +ret = s->io_open(s, pb, url, AVIO_FLAG_READ, );
> +}
> +} else {
> +ret = s->io_open(s, pb, url, AVIO_FLAG_READ, );
> +}
>  if (ret >= 0) {
>  // update cookies on http response with setcookies.
>  char *new_cookies = NULL;
> @@ -683,10 +705,27 @@ static int parse_playlist(HLSContext *c, const
> char *url,
>  char tmp_str[MAX_URL_SIZE];
>  struct segment *cur_init_section = NULL;
>
> +if (!in && c->http_persistent && c->playlist_pb) {
> +in = c->playlist_pb;
> +URLContext *uc = ffio_geturlcontext(in);
> +av_assert0(uc);
> +in->eof_reached = 0;
> +ret = ff_http_do_new_request(uc, url);
> +if (ret == AVERROR_EXIT) {
> +ff_format_io_close(c->ctx, 

Re: [FFmpeg-devel] [PATCH v2 5/5] avformat/hls: add http_multiple option

2017-12-17 Thread Aman Gupta
On Sun, Dec 17, 2017 at 12:53 PM Anssi Hannula  wrote:

> Hi!
>
> Aman Gupta kirjoitti 2017-12-13 02:35:
> > From: Aman Gupta 
> >
> > This improves network throughput of the hls demuxer by avoiding
> > the latency introduced by downloading segments one at a time.
> >
> > The problem is particularly noticable over high-latency network
> > connections: for instance, if RTT is 250ms, there will a 250ms idle
> > period between when one segment response is read and the next one
> > starts.
> >
> > The obvious solution to this is to use HTTP pipelining, where a
> > second request can be sent (on the persistent http/1.1 connection)
> > before the first response is fully read. Unfortunately the way the
> > http protocol is implemented in avformat makes implementing pipleining
> > very complex.
> >
> > Instead, this commit simulates pipelining using two separate persistent
> > http connections. This has the advantage of working independently of
> > the http_persistent option, and can be used with http/1.0 servers as
> > well. The pair of connections is swapped every time a new segment
> > starts
> > downloading, and a request for the next segment is sent on the
> > secondary
> > connection right away. This means the second response will be ready and
> > waiting by the time the current response is fully read.
>
> Thanks, seems like an OK idea and the code seems straight-forward.
>
> Why is this a defaults-to-disabled option, instead of defaulting to
> enabled or just not having an option at all?
> I guess there may be a good reason, but I'd like to hear your thoughts
> on that.


I actually had both options enabled by default but changed it before
submitting. There is no good reason to disable by default other than the
fact that it is new code and may still include bugs. However in my testing
it works quite well so I think it is safe to enable by default and let
users disable if they need to for some reason.


>
> > ---
> >  doc/demuxers.texi |  3 +++
> >  libavformat/hls.c | 51
> > ---
> >  2 files changed, 51 insertions(+), 3 deletions(-)
> >
> > diff --git a/doc/demuxers.texi b/doc/demuxers.texi
> > index 18ff7101ac..f2181fbb93 100644
> > --- a/doc/demuxers.texi
> > +++ b/doc/demuxers.texi
> > @@ -319,6 +319,9 @@ Default value is 1000.
> >
> >  @item http_persistent
> >  Use persistent HTTP connections. Applicable only for HTTP streams.
> > +
> > +@item http_multiple
> > +Use multiple HTTP connections for downloading HTTP segments.
> >  @end table
> >
> >  @section image2
> > diff --git a/libavformat/hls.c b/libavformat/hls.c
> > index f75c8f5eaa..487fa9a82f 100644
> > --- a/libavformat/hls.c
> > +++ b/libavformat/hls.c
> [...]
> > @@ -1426,11 +1440,20 @@ reload:
> >  if (ret)
> >  return ret;
> >
> > -ret = open_input(c, v, seg, >input);
> > +if (c->http_multiple && v->input_next_requested) {
> > +AVIOContext *tmp = v->input;
> > +v->input = v->input_next;
> > +v->input_next = tmp;
>
> Use FFSWAP().


Cool, didn't know about that one. Will switch.


>
> [...]
>
> --
> Anssi Hannula
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2 5/5] avformat/hls: add http_multiple option

2017-12-17 Thread Anssi Hannula

Hi!

Aman Gupta kirjoitti 2017-12-13 02:35:

From: Aman Gupta 

This improves network throughput of the hls demuxer by avoiding
the latency introduced by downloading segments one at a time.

The problem is particularly noticable over high-latency network
connections: for instance, if RTT is 250ms, there will a 250ms idle
period between when one segment response is read and the next one
starts.

The obvious solution to this is to use HTTP pipelining, where a
second request can be sent (on the persistent http/1.1 connection)
before the first response is fully read. Unfortunately the way the
http protocol is implemented in avformat makes implementing pipleining
very complex.

Instead, this commit simulates pipelining using two separate persistent
http connections. This has the advantage of working independently of
the http_persistent option, and can be used with http/1.0 servers as
well. The pair of connections is swapped every time a new segment 
starts
downloading, and a request for the next segment is sent on the 
secondary

connection right away. This means the second response will be ready and
waiting by the time the current response is fully read.


Thanks, seems like an OK idea and the code seems straight-forward.

Why is this a defaults-to-disabled option, instead of defaulting to 
enabled or just not having an option at all?
I guess there may be a good reason, but I'd like to hear your thoughts 
on that.



---
 doc/demuxers.texi |  3 +++
 libavformat/hls.c | 51 
---

 2 files changed, 51 insertions(+), 3 deletions(-)

diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index 18ff7101ac..f2181fbb93 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -319,6 +319,9 @@ Default value is 1000.

 @item http_persistent
 Use persistent HTTP connections. Applicable only for HTTP streams.
+
+@item http_multiple
+Use multiple HTTP connections for downloading HTTP segments.
 @end table

 @section image2
diff --git a/libavformat/hls.c b/libavformat/hls.c
index f75c8f5eaa..487fa9a82f 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c

[...]

@@ -1426,11 +1440,20 @@ reload:
 if (ret)
 return ret;

-ret = open_input(c, v, seg, >input);
+if (c->http_multiple && v->input_next_requested) {
+AVIOContext *tmp = v->input;
+v->input = v->input_next;
+v->input_next = tmp;


Use FFSWAP().

[...]

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


Re: [FFmpeg-devel] [PATCH v2 3/5] avformat/hls: add http_persistent option

2017-12-17 Thread Aman Gupta
On Sun, Dec 17, 2017 at 12:34 PM Anssi Hannula  wrote:

> Hi!
>
> Aman Gupta kirjoitti 2017-12-13 02:35:
> > From: Aman Gupta 
> >
> > This teaches the HLS demuxer to use the HTTP protocols
> > multiple_requests=1 option, to take advantage of "Connection:
> > Keep-Alive" when downloading playlists and segments from the HLS
> > server.
> >
> > With the new option, you can avoid TCP connection and TLS negotiation
> > overhead, which is particularly beneficial when streaming via a
> > high-latency internet connection.
> >
> > Similar to the http_persistent option recently implemented in hlsenc.c
>
> Why is this implemented as an option instead of simply being always used
> by the demuxer?


I have no strong feeling on this either way. I've tested the new option
against a few different HLS servers and would be comfortable enabling it by
default. I do think it's worth keeping as an option in case someone wants
to turn it off for whatever reason.


>
> > ---
> >  doc/demuxers.texi |  3 +++
> >  libavformat/hls.c | 68
> > +++
> >  2 files changed, 67 insertions(+), 4 deletions(-)
> >
> > diff --git a/doc/demuxers.texi b/doc/demuxers.texi
> > index 73dc0feec1..18ff7101ac 100644
> > --- a/doc/demuxers.texi
> > +++ b/doc/demuxers.texi
> > @@ -316,6 +316,9 @@ segment index to start live streams at (negative
> > values are from the end).
> >  @item max_reload
> >  Maximum number of times a insufficient list is attempted to be
> > reloaded.
> >  Default value is 1000.
> > +
> > +@item http_persistent
> > +Use persistent HTTP connections. Applicable only for HTTP streams.
> >  @end table
> >
> >  @section image2
> > diff --git a/libavformat/hls.c b/libavformat/hls.c
> > index ab6ff187a6..5c1895c180 100644
> > --- a/libavformat/hls.c
> > +++ b/libavformat/hls.c
> > @@ -26,6 +26,7 @@
> >   * http://tools.ietf.org/html/draft-pantos-http-live-streaming
> >   */
> >
> > +#include "libavformat/http.h"
> >  #include "libavutil/avstring.h"
> >  #include "libavutil/avassert.h"
> >  #include "libavutil/intreadwrite.h"
> > @@ -94,6 +95,7 @@ struct playlist {
> >  AVIOContext pb;
> >  uint8_t* read_buffer;
> >  AVIOContext *input;
> > +int input_read_done;
> >  AVFormatContext *parent;
> >  int index;
> >  AVFormatContext *ctx;
> > @@ -206,6 +208,8 @@ typedef struct HLSContext {
> >  int strict_std_compliance;
> >  char *allowed_extensions;
> >  int max_reload;
> > +int http_persistent;
> > +AVIOContext *playlist_pb;
> >  } HLSContext;
> >
> >  static int read_chomp_line(AVIOContext *s, char *buf, int maxlen)
> > @@ -256,6 +260,7 @@ static void free_playlist_list(HLSContext *c)
> >  av_freep(>pb.buffer);
> >  if (pls->input)
> >  ff_format_io_close(c->ctx, >input);
> > +pls->input_read_done = 0;
> >  if (pls->ctx) {
> >  pls->ctx->pb = NULL;
> >  avformat_close_input(>ctx);
> > @@ -640,7 +645,24 @@ static int open_url(AVFormatContext *s,
> > AVIOContext **pb, const char *url,
> >  else if (strcmp(proto_name, "file") || !strncmp(url, "file,", 5))
> >  return AVERROR_INVALIDDATA;
> >
> > -ret = s->io_open(s, pb, url, AVIO_FLAG_READ, );
> > +if (c->http_persistent && *pb && av_strstart(proto_name, "http",
> > NULL)) {
> > +URLContext *uc = ffio_geturlcontext(*pb);
> > +av_assert0(uc);
> > +(*pb)->eof_reached = 0;
> > +ret = ff_http_do_new_request(uc, url);
> > +if (ret == AVERROR_EXIT) {
> > +ff_format_io_close(c->ctx, >playlist_pb);
> > +return ret;
> > +} else if (ret < 0) {
> > +av_log(s, AV_LOG_WARNING,
> > +"keepalive request failed for '%s', retrying with new
> > connection: %s\n",
> > +url, av_err2str(ret));
> > +ff_format_io_close(c->ctx, pb);
> > +ret = s->io_open(s, pb, url, AVIO_FLAG_READ, );
> > +}
> > +} else {
> > +ret = s->io_open(s, pb, url, AVIO_FLAG_READ, );
> > +}
> >  if (ret >= 0) {
> >  // update cookies on http response with setcookies.
> >  char *new_cookies = NULL;
> > @@ -683,10 +705,27 @@ static int parse_playlist(HLSContext *c, const
> > char *url,
> >  char tmp_str[MAX_URL_SIZE];
> >  struct segment *cur_init_section = NULL;
> >
> > +if (!in && c->http_persistent && c->playlist_pb) {
> > +in = c->playlist_pb;
> > +URLContext *uc = ffio_geturlcontext(in);
> > +av_assert0(uc);
> > +in->eof_reached = 0;
> > +ret = ff_http_do_new_request(uc, url);
> > +if (ret == AVERROR_EXIT) {
> > +ff_format_io_close(c->ctx, >playlist_pb);
> > +return ret;
> > +} else if (ret < 0) {
> > +av_log(c->ctx, AV_LOG_WARNING,
> > +"keepalive request failed for '%s', retrying with new
> > connection: %s\n",
> > +  

[FFmpeg-devel] CoC enforcement activated

2017-12-17 Thread Compn
http://ffmpeg.org/developer.html#Code-of-conduct

5 Code of conduct

Be friendly and respectful towards others and third parties. Treat
others the way you yourself want to be treated. 

Be considerate. Not everyone shares the same viewpoint and priorities
as you do. Different opinions and interpretations help the project.
Looking at issues from a different perspective assists development. 

Do not assume malice for things that can be attributed to incompetence.
Even if it is malice, it’s rarely good to start with that as initial
assumption. 

Stay friendly even if someone acts contrarily. Everyone has a bad day
once in a while. If you yourself have a bad day or are angry then try
to take a break and reply once you are calm and without anger if you
have to. 

Try to help other team members and cooperate if you can. 

The goal of software development is to create technical excellence, not
for any individual to be better and "win" against the others. Large
software projects are only possible and successful through teamwork. 

If someone struggles do not put them down. Give them a helping hand
instead and point them in the right direction. 

Finally, keep in mind the immortal words of Bill and Ted, "Be excellent
to each other."


-


enough fighting on the mailing list.

emergency moderation has now been enabled.

why do i have to enforce the COC?

the ffmpeg-devel mailing list is for technical discussions of
developing ffmpeg. personal insults will not be tolerated.

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


Re: [FFmpeg-devel] [PATCH v2 3/5] avformat/hls: add http_persistent option

2017-12-17 Thread Anssi Hannula

Hi!

Aman Gupta kirjoitti 2017-12-13 02:35:

From: Aman Gupta 

This teaches the HLS demuxer to use the HTTP protocols
multiple_requests=1 option, to take advantage of "Connection:
Keep-Alive" when downloading playlists and segments from the HLS 
server.


With the new option, you can avoid TCP connection and TLS negotiation
overhead, which is particularly beneficial when streaming via a
high-latency internet connection.

Similar to the http_persistent option recently implemented in hlsenc.c


Why is this implemented as an option instead of simply being always used 
by the demuxer?



---
 doc/demuxers.texi |  3 +++
 libavformat/hls.c | 68 
+++

 2 files changed, 67 insertions(+), 4 deletions(-)

diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index 73dc0feec1..18ff7101ac 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -316,6 +316,9 @@ segment index to start live streams at (negative
values are from the end).
 @item max_reload
 Maximum number of times a insufficient list is attempted to be 
reloaded.

 Default value is 1000.
+
+@item http_persistent
+Use persistent HTTP connections. Applicable only for HTTP streams.
 @end table

 @section image2
diff --git a/libavformat/hls.c b/libavformat/hls.c
index ab6ff187a6..5c1895c180 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -26,6 +26,7 @@
  * http://tools.ietf.org/html/draft-pantos-http-live-streaming
  */

+#include "libavformat/http.h"
 #include "libavutil/avstring.h"
 #include "libavutil/avassert.h"
 #include "libavutil/intreadwrite.h"
@@ -94,6 +95,7 @@ struct playlist {
 AVIOContext pb;
 uint8_t* read_buffer;
 AVIOContext *input;
+int input_read_done;
 AVFormatContext *parent;
 int index;
 AVFormatContext *ctx;
@@ -206,6 +208,8 @@ typedef struct HLSContext {
 int strict_std_compliance;
 char *allowed_extensions;
 int max_reload;
+int http_persistent;
+AVIOContext *playlist_pb;
 } HLSContext;

 static int read_chomp_line(AVIOContext *s, char *buf, int maxlen)
@@ -256,6 +260,7 @@ static void free_playlist_list(HLSContext *c)
 av_freep(>pb.buffer);
 if (pls->input)
 ff_format_io_close(c->ctx, >input);
+pls->input_read_done = 0;
 if (pls->ctx) {
 pls->ctx->pb = NULL;
 avformat_close_input(>ctx);
@@ -640,7 +645,24 @@ static int open_url(AVFormatContext *s,
AVIOContext **pb, const char *url,
 else if (strcmp(proto_name, "file") || !strncmp(url, "file,", 5))
 return AVERROR_INVALIDDATA;

-ret = s->io_open(s, pb, url, AVIO_FLAG_READ, );
+if (c->http_persistent && *pb && av_strstart(proto_name, "http", 
NULL)) {

+URLContext *uc = ffio_geturlcontext(*pb);
+av_assert0(uc);
+(*pb)->eof_reached = 0;
+ret = ff_http_do_new_request(uc, url);
+if (ret == AVERROR_EXIT) {
+ff_format_io_close(c->ctx, >playlist_pb);
+return ret;
+} else if (ret < 0) {
+av_log(s, AV_LOG_WARNING,
+"keepalive request failed for '%s', retrying with new
connection: %s\n",
+url, av_err2str(ret));
+ff_format_io_close(c->ctx, pb);
+ret = s->io_open(s, pb, url, AVIO_FLAG_READ, );
+}
+} else {
+ret = s->io_open(s, pb, url, AVIO_FLAG_READ, );
+}
 if (ret >= 0) {
 // update cookies on http response with setcookies.
 char *new_cookies = NULL;
@@ -683,10 +705,27 @@ static int parse_playlist(HLSContext *c, const 
char *url,

 char tmp_str[MAX_URL_SIZE];
 struct segment *cur_init_section = NULL;

+if (!in && c->http_persistent && c->playlist_pb) {
+in = c->playlist_pb;
+URLContext *uc = ffio_geturlcontext(in);
+av_assert0(uc);
+in->eof_reached = 0;
+ret = ff_http_do_new_request(uc, url);
+if (ret == AVERROR_EXIT) {
+ff_format_io_close(c->ctx, >playlist_pb);
+return ret;
+} else if (ret < 0) {
+av_log(c->ctx, AV_LOG_WARNING,
+"keepalive request failed for '%s', retrying with new
connection: %s\n",
+url, av_err2str(ret));
+ff_format_io_close(c->ctx, >playlist_pb);
+in = NULL;
+}
+}
+


The above code seems duplicated, please put it in a common function.


[..]
--
Anssi Hannula
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 08/25] fftools/ffplay: support only limited color range

2017-12-17 Thread Nicolas George
Marton Balint (2017-12-17):
> If this works, that means color_ranges are ignored for RGB. We can do that,
> but please document every color_range field explicitly that they only affect
> YUV, nothing else.

This is very ugly. I can accept that only if several persons who know
about colorspaces and the trends in the industry confirm that it will
not come back to bite us later, i.e. that only YUV pixel formats will
ever need that kind of information.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] avfilter/x86/vf_blend : add avx2 version for 8b func (WIP)

2017-12-17 Thread Henrik Gramner
On Thu, Dec 14, 2017 at 11:16 AM, Martin Vignali
 wrote:
> 2017-12-13 17:37 GMT+01:00 Henrik Gramner :
>> You could also do vextracti128 + 128-bit packuswb instead of 256-bit
>> packuswb + vpermq.
>>
> Sorry don't understand this part
> do you mean 128 bit packuswb + movh for each lane ?
> or something else ?

packuswb  m0, m0
vpermqm0, m0, q3120

vs.

vextracti128 xm1, m0, 1
packuswb xm0, xm1

Uses a 128-bit op instead of a 256-bit one which is generally
preferable whenever possible.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 08/25] fftools/ffplay: support only limited color range

2017-12-17 Thread Marton Balint



On Sat, 16 Dec 2017, Paul B Mahol wrote:


On 12/16/17, Marton Balint  wrote:



On Sat, 16 Dec 2017, Paul B Mahol wrote:


Signed-off-by: Paul B Mahol 
---
fftools/ffplay.c | 6 +-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index 10a917194d..f023c81575 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -1822,6 +1822,7 @@ fail:
static int configure_video_filters(AVFilterGraph *graph, VideoState *is,
const char *vfilters, AVFrame *frame)
{
enum AVPixelFormat pix_fmts[FF_ARRAY_ELEMS(sdl_texture_format_map)];
+enum AVColorRange color_ranges[2] = { AVCOL_RANGE_MPEG,
AVCOL_RANGE_UNSPECIFIED };
char sws_flags_str[512] = "";
char buffersrc_args[256];
int ret;
@@ -1876,7 +1877,10 @@ static int configure_video_filters(AVFilterGraph
*graph, VideoState *is, const c
if ((ret = av_opt_set_int_list(filt_out, "pix_fmts", pix_fmts,
AV_PIX_FMT_NONE, AV_OPT_SEARCH_CHILDREN)) < 0)
goto fail;

-last_filter = filt_out;
+if ((ret = av_opt_set_int_list(filt_out, "color_ranges",
color_ranges, AVCOL_RANGE_UNSPECIFIED, AV_OPT_SEARCH_CHILDREN)) < 0)
+goto fail;
+
+ last_filter = filt_out;


I am afraid this wont work, because ffplay supports full range RGB as
well. Unless there is a way to specify allowed pixel format / color range
combinations (which is the only way to mimic existing behaviour as far as
I see), you have to use hacks like configure the filter graph once without
a range restriction, and if you get an invalid pixel format / color range
combination, you have to configure the graph again with the supported
color range list for that pixel format, hoping that the pixel format will
remain the same.


If you actually checked output, it will appear same as before patchset.


If this works, that means color_ranges are ignored for RGB. We can do 
that, but please document every color_range field explicitly that they 
only affect YUV, nothing else.


Also there is a stray whitespace addition in the last line:
" last_filter = filt_out"

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


Re: [FFmpeg-devel] [PATCH, V2] avformat/concat: Fix wrong wrapped timestamp

2017-12-17 Thread Nicolas George
mymoey...@gmail.com (2017-12-14):
> From: Wu Zhiqiang 
> 
> When using concat protocol, start from middle of file will generate non-zero 
> wrap reference.
> If seek to time before the wrap reference, wrap control will generate wrong 
> wrapped timestamp.
> Copy wrap related stream properties when reading header can fix this problem.
> 
> Signed-off-by: Wu Zhiqiang 
> ---
>  libavformat/concatdec.c | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
> index 0e189012ad..8dae2737df 100644
> --- a/libavformat/concatdec.c
> +++ b/libavformat/concatdec.c
> @@ -188,6 +188,11 @@ static int copy_stream_props(AVStream *st, AVStream 
> *source_st)
>  st->time_base   = source_st->time_base;
>  st->sample_aspect_ratio = source_st->sample_aspect_ratio;
>  
> +/* Fix wrap control problem */
> +avpriv_set_pts_info(st, source_st->pts_wrap_bits, 
> source_st->time_base.num, source_st->time_base.den);
> +st->pts_wrap_behavior   = source_st->pts_wrap_behavior;
> +st->pts_wrap_reference  = source_st->pts_wrap_reference;
> +
>  av_dict_copy(>metadata, source_st->metadata, 0);
>  return 0;
>  }

The concat demuxer is mine to maintain, but I am not very familiar with
the wrapped timestamps handling, and the commit message does not
enlighten me.

(By the way, please wrap it at 60-70 characters.)

The way I see it, if the library takes care of de-wrapping timestamps,
then the concat demuxer will see de-wrapped timestamps from the
underlying demuxer, and the timestamps do not need to be de-wrapped a
second time: setting the wrap information is unnecessary and even wrong.

Please explain what I am missing.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH 2/2] avfilter/vf_aspect: change outlink sample aspect ratio instead of inlink

2017-12-17 Thread wm4
On Sun, 17 Dec 2017 14:03:49 +0100
Carl Eugen Hoyos  wrote:

> 2017-12-17 13:53 GMT+01:00 wm4 :
> 
> > This is a project of volunteers. If you don't want to commit to the
> > rules and responsibilities of the project, you can just remove yourself
> > from the maintainers file and stop reading/posting here.  
> 
> Both in this email and the one before you suggest to ignore our rules:

I do not. What a weak attempt at trying to troll me.

> Does this mean you will now stop posting here or is this just another
> empty promise?

I do not make empty promises, stop slandering me on a public mailing
list.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Refund request of travel costs for GSoC Summit 2017

2017-12-17 Thread Thilo Borgmann
Hi,

 some time ago Carl Eugen and me went to the GSoC Summit. See review mail
 for details.

 Here comes the refund request for my flight. Costs were 478.82€ total,
 I'll send the invoice to Stefano privately as usual.

>>>
>>> Approved by me, still missing approval from Michael.
>>
>> @Michael: ping (although I don't think this should be subject to
>> explicit approval, since it's implied by the contract between FFmpeg
>> and GSOC).
 
> BTW, I also suggest since we had a total of 2200 EUR from Google to
> use the residual part to cover other accomodation and travel expenses.
> Rationale: representing FFmpeg in such events is a very important and
> strategic task for the project, it can be an exciting experience foar
> the delegates but it also takes much time and effort, and would be
> unfair to let the delegates spend their own monetary resources,
> especially given that the host organization is covering the expenses.

thanks for mentioning this! As long as there is dedicated money left for this, 
I'd appreciate to be also reimbursed for the shoulder night I had to book at 
the venue hotel.


> Please, Thilo and Carl, update this thread with other travel/attendace
> cost you had to cover.

That night came for 176.01$, I'll send you the invoice asap.

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


Re: [FFmpeg-devel] [PATCH 2/2] avfilter/vf_aspect: change outlink sample aspect ratio instead of inlink

2017-12-17 Thread Carl Eugen Hoyos
2017-12-17 13:53 GMT+01:00 wm4 :

> This is a project of volunteers. If you don't want to commit to the
> rules and responsibilities of the project, you can just remove yourself
> from the maintainers file and stop reading/posting here.

Both in this email and the one before you suggest to ignore our rules:
Does this mean you will now stop posting here or is this just another
empty promise?

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


Re: [FFmpeg-devel] [PATCH 2/2] avfilter/vf_aspect: change outlink sample aspect ratio instead of inlink

2017-12-17 Thread wm4
On Sun, 17 Dec 2017 13:02:14 +0100
Nicolas George  wrote:

> Paul B Mahol (2017-12-16):
> > What's wrong then your highness?  
> 
> What makes you think it is acceptable to talk to people that way?

Oh boy this sure is a civil and friendly project.

What makes _you_ think it's acceptable to treat people this way? Have
you even seen how long Paul has been trying to get this in? Certainly
he doesn't deserve such a reaction.

It isn't the first time you act this way either. It's hard to work with
you at all. I believe you claim that you have me in your kill file too.

Regarding Paul's "your highness" - well you seem certainly like some
sort of all knowing benevolent (academic?) leader, who has little time
and for who lesser minions like Paul should be thankful to receive any
audience at all, even if they have to wait a week.

> I would not tolerate that kind of address from my students, I would not
> tolerate it from my kids either if I had any, I do not see why I should
> tolerate it from a person I work with on my spare time.

This is a project of volunteers. If you don't want to commit to the
rules and responsibilities of the project, you can just remove yourself
from the maintainers file and stop reading/posting here. This will
probably be less stressy for you too. It's not good to be stuck between
two time demanding jobs.

> You should be glad and thankful when people are willing to review your
> patches, because it reduces the odds that you will cause a regression or
> light up Coverity all over the place. Otherwise, the blame and
> responsibility are all yours.

Oh, now Paul should be thankful too for receiving a cranky reply after
4 days of waiting, with no time frame given for when you can grace us
with your genius. Nope, it doesn't work this way.

> As it is, I will not review this patch. Push it, do not push it, I do
> not care. Your responsibility, your blame.

I think he's totally fine with that. Better than some unfriendly person
blocking a patch.

> And stop behaving like a kid making a tantrum.

Applies to you too. He was just being slightly cheeky (in reply to a
cranky post), and then you freaked out and accused him that he'd
certainly set FFmpeg on fire if he were too impatient to wait for your
sage advice. (Wait how long? More than 4 days... a week? Weeks? Moths?)

Anyway, I think your reply means Paul is allowed to push his patch.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 08/25] fftools/ffplay: support only limited color range

2017-12-17 Thread wm4
On Sat, 16 Dec 2017 11:12:28 +0100
Paul B Mahol  wrote:

> Signed-off-by: Paul B Mahol 
> ---
>  fftools/ffplay.c | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/fftools/ffplay.c b/fftools/ffplay.c
> index 10a917194d..f023c81575 100644
> --- a/fftools/ffplay.c
> +++ b/fftools/ffplay.c
> @@ -1822,6 +1822,7 @@ fail:
>  static int configure_video_filters(AVFilterGraph *graph, VideoState *is, 
> const char *vfilters, AVFrame *frame)
>  {
>  enum AVPixelFormat pix_fmts[FF_ARRAY_ELEMS(sdl_texture_format_map)];
> +enum AVColorRange color_ranges[2] = { AVCOL_RANGE_MPEG, 
> AVCOL_RANGE_UNSPECIFIED };
>  char sws_flags_str[512] = "";
>  char buffersrc_args[256];
>  int ret;
> @@ -1876,7 +1877,10 @@ static int configure_video_filters(AVFilterGraph 
> *graph, VideoState *is, const c
>  if ((ret = av_opt_set_int_list(filt_out, "pix_fmts", pix_fmts,  
> AV_PIX_FMT_NONE, AV_OPT_SEARCH_CHILDREN)) < 0)
>  goto fail;
>  
> -last_filter = filt_out;
> +if ((ret = av_opt_set_int_list(filt_out, "color_ranges", color_ranges, 
> AVCOL_RANGE_UNSPECIFIED, AV_OPT_SEARCH_CHILDREN)) < 0)
> +goto fail;
> +
> + last_filter = filt_out;
>  
>  /* Note: this macro adds a filter before the lastly added filter, so the
>   * processing order of the filters is in reverse */

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


Re: [FFmpeg-devel] [PATCH 08/25] fftools/ffplay: support only limited color range

2017-12-17 Thread Nicolas George
Paul B Mahol (2017-12-16):
> Not really. This is just ffplay nuisance.

Marton and I do not think so. Your patches, your burden of the proof.
Rejected as is.

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH 2/2] avfilter/vf_aspect: change outlink sample aspect ratio instead of inlink

2017-12-17 Thread Nicolas George
Paul B Mahol (2017-12-16):
> What's wrong then your highness?

What makes you think it is acceptable to talk to people that way?

I would not tolerate that kind of address from my students, I would not
tolerate it from my kids either if I had any, I do not see why I should
tolerate it from a person I work with on my spare time.

You should be glad and thankful when people are willing to review your
patches, because it reduces the odds that you will cause a regression or
light up Coverity all over the place. Otherwise, the blame and
responsibility are all yours.

As it is, I will not review this patch. Push it, do not push it, I do
not care. Your responsibility, your blame.

And stop behaving like a kid making a tantrum.

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


Re: [FFmpeg-devel] Refund request for FFshirt merchandise

2017-12-17 Thread Stefano Sabatini
On date Tuesday 2017-11-21 18:50:44 +0100, Thilo Borgmann encoded:
> Hi,
> 

> here comes the refund request for getting us developer T-shirts and
> sending them around the world as well as getting a stock of T-shirts
> for future developers to come and for giveaways at conferences and
> to honored users:
> 
> 
> ItemNo  Cost
> Shirt Samples672,00€
> Shirts (Thomas) 19   228,00€
> Shirts (Lou)25   300,00€
> Shipping1885,69€
> 
> Total685,69€
> 
> See the corresponding thread for more details. Will send all the
> invoices to Stefano privately (at least I hope so this time).

Approved by me, pending approval from Michael Niedermayer.
-- 
FFmpeg = Friendly Freak Mournful Problematic Elastic Governor
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Refund request of travel costs for GSoC Summit 2017

2017-12-17 Thread Stefano Sabatini
On date Sunday 2017-12-17 12:11:15 +0100, Stefano Sabatini encoded:
> On date Tuesday 2017-11-21 19:15:33 +0100, Stefano Sabatini encoded:
> > On Sat, Nov 18, 2017 at 6:26 PM, Thilo Borgmann 
> > wrote:
> > 
> > > Hi,
> > >
> > > some time ago Carl Eugen and me went to the GSoC Summit. See review mail
> > > for details.
> > >
> > > Here comes the refund request for my flight. Costs were 478.82€ total,
> > > I'll send the invoice to Stefano privately as usual.
> > >
> > 
> > Approved by me, still missing approval from Michael.
> 
> @Michael: ping (although I don't think this should be subject to
> explicit approval, since it's implied by the contract between FFmpeg
> and GSOC).

BTW, I also suggest since we had a total of 2200 EUR from Google to
use the residual part to cover other accomodation and travel expenses.
Rationale: representing FFmpeg in such events is a very important and
strategic task for the project, it can be an exciting experience foar
the delegates but it also takes much time and effort, and would be
unfair to let the delegates spend their own monetary resources,
especially given that the host organization is covering the expenses.

Please, Thilo and Carl, update this thread with other travel/attendace
cost you had to cover.

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


Re: [FFmpeg-devel] Refund request of travel costs for GSoC Summit 2017

2017-12-17 Thread Stefano Sabatini
On date Tuesday 2017-11-21 19:15:33 +0100, Stefano Sabatini encoded:
> On Sat, Nov 18, 2017 at 6:26 PM, Thilo Borgmann 
> wrote:
> 
> > Hi,
> >
> > some time ago Carl Eugen and me went to the GSoC Summit. See review mail
> > for details.
> >
> > Here comes the refund request for my flight. Costs were 478.82€ total,
> > I'll send the invoice to Stefano privately as usual.
> >
> 
> Approved by me, still missing approval from Michael.

@Michael: ping (although I don't think this should be subject to
explicit approval, since it's implied by the contract between FFmpeg
and GSOC).
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 07/25] avfilter: negotiate color_range between filters

2017-12-17 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 fftools/ffmpeg.c   |  2 ++
 fftools/ffmpeg.h   |  1 +
 fftools/ffmpeg_filter.c| 57 +---
 fftools/ffmpeg_opt.c   |  2 ++
 libavcodec/utils.c | 11 +++
 libavfilter/avf_abitscope.c|  4 +++
 libavfilter/avf_ahistogram.c   |  4 +++
 libavfilter/avf_aphasemeter.c  |  4 +++
 libavfilter/avf_avectorscope.c |  4 +++
 libavfilter/avf_concat.c   | 12 ++-
 libavfilter/avf_showcqt.c  |  4 +++
 libavfilter/avf_showfreqs.c|  4 +++
 libavfilter/avf_showspectrum.c |  4 +++
 libavfilter/avf_showvolume.c   |  4 +++
 libavfilter/avf_showwaves.c|  4 +++
 libavfilter/avfilter.c |  9 +++--
 libavfilter/avfilter.h |  4 ++-
 libavfilter/avfiltergraph.c| 53 +
 libavfilter/buffersink.c   | 16 +
 libavfilter/buffersink.h   |  1 +
 libavfilter/buffersrc.c|  4 +++
 libavfilter/formats.c  | 75 +++---
 libavfilter/formats.h  | 31 +
 libavfilter/internal.h | 11 +++
 libavfilter/vf_format.c| 46 +-
 libavfilter/vf_noise.c |  6 +++-
 libavfilter/vf_scale.c | 17 --
 libavfilter/vsrc_testsrc.c | 15 +++--
 tests/fate/filter-video.mak|  2 +-
 tests/fate/pixlet.mak  |  2 +-
 30 files changed, 390 insertions(+), 23 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 6aff3366c5..64de55d9a5 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -3390,6 +3390,8 @@ static int init_output_stream_encode(OutputStream *ost)
 enc_ctx->bits_per_raw_sample = FFMIN(dec_ctx->bits_per_raw_sample,
  
av_pix_fmt_desc_get(enc_ctx->pix_fmt)->comp[0].depth);
 
+enc_ctx->color_range = 
av_buffersink_get_color_range(ost->filter->filter);
+
 enc_ctx->framerate = ost->frame_rate;
 
 ost->st->avg_frame_rate = ost->frame_rate;
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 4e73d59082..071f3651f8 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -271,6 +271,7 @@ typedef struct OutputFilter {
 
 /* desired output stream properties */
 int width, height;
+enum AVColorRange color_range;
 AVRational frame_rate;
 int format;
 int sample_rate;
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 877fd670e6..16ad79625b 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -89,6 +89,28 @@ enum AVPixelFormat choose_pixel_fmt(AVStream *st, 
AVCodecContext *enc_ctx, AVCod
 return target;
 }
 
+static enum AVColorRange choose_color_range(AVStream *st, AVCodecContext 
*enc_ctx, AVCodec *codec, enum AVColorRange target)
+{
+if (codec && codec->color_ranges) {
+const enum AVColorRange *p = codec->color_ranges;
+
+for (; *p != AVCOL_RANGE_UNSPECIFIED; p++) {
+if (*p == target)
+break;
+}
+if (*p == AVCOL_RANGE_UNSPECIFIED) {
+if (target != AVCOL_RANGE_UNSPECIFIED)
+av_log(NULL, AV_LOG_WARNING,
+   "Incompatible color range '%s' for codec '%s', 
auto-selecting color range '%s'\n",
+   av_color_range_name(target),
+   codec->name,
+   av_color_range_name(codec->color_ranges[0]));
+return codec->color_ranges[0];
+}
+}
+return target;
+}
+
 void choose_sample_fmt(AVStream *st, AVCodec *codec)
 {
 if (codec && codec->sample_fmts) {
@@ -127,7 +149,19 @@ static char *choose_pix_fmts(OutputFilter *ofilter)
 return av_strdup(av_get_pix_fmt_name(ost->enc_ctx->pix_fmt));
 }
 if (ost->enc_ctx->pix_fmt != AV_PIX_FMT_NONE) {
-return av_strdup(av_get_pix_fmt_name(choose_pixel_fmt(ost->st, 
ost->enc_ctx, ost->enc, ost->enc_ctx->pix_fmt)));
+AVIOContext *s = NULL;
+uint8_t *ret;
+int len;
+
+if (avio_open_dyn_buf() < 0)
+exit_program(1);
+
+avio_printf(s, "%s:%s", av_get_pix_fmt_name(choose_pixel_fmt(ost->st, 
ost->enc_ctx, ost->enc, ost->enc_ctx->pix_fmt)),
+
av_color_range_name(choose_color_range(ost->st, ost->enc_ctx, ost->enc, 
ost->enc_ctx->color_range)));
+
+len = avio_close_dyn_buf(s, );
+ret[len] = 0;
+return ret;
 } else if (ost->enc && ost->enc->pix_fmts) {
 const enum AVPixelFormat *p;
 AVIOContext *s = NULL;
@@ -144,7 +178,20 @@ static char *choose_pix_fmts(OutputFilter *ofilter)
 
 for (; *p != AV_PIX_FMT_NONE; p++) {
 const char *name = av_get_pix_fmt_name(*p);
-avio_printf(s, "%s|", name);
+avio_printf(s, "%s", name);
+if (*(p + 1) != AV_PIX_FMT_NONE)
+avio_printf(s, "|");
+else
+