Re: [FFmpeg-devel] [PATCH]lavc/put_bits: Remove usage of BITSTREAM_WRITER_LE.

2017-08-22 Thread Paul B Mahol
On 8/21/17, Carl Eugen Hoyos  wrote:
> Hi!
>
> Attached patch tries to slightly simplify and clean up the usage of
> put_bits* in libavcodec: put_bits_le() functions exist for the
> little-endian G.726 encoder, so the define makes less sense now.
>
> Fate passes here, please review, Carl Eugen
>

Unacceptable patch. Do not commit.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]lavc/put_bits: Remove usage of BITSTREAM_WRITER_LE.

2017-08-22 Thread Ronald S. Bultje
Hi,

On Mon, Aug 21, 2017 at 11:16 AM, Carl Eugen Hoyos 
wrote:

> Hi!
>
> Attached patch tries to slightly simplify and clean up the usage of
> put_bits* in libavcodec: put_bits_le() functions exist for the
> little-endian G.726 encoder, so the define makes less sense now.
>
> Fate passes here, please review, Carl Eugen


I have to agree with Paul here, I can't say I'm a big fan of this...

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


[FFmpeg-devel] [PATCH 1/2] ffprobe: Fix null pointer dereference with color primaries

2017-08-22 Thread Michael Niedermayer
Found-by: AD-lab of venustech
Signed-off-by: Michael Niedermayer 
---
 ffprobe.c | 20 
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/ffprobe.c b/ffprobe.c
index 50d7c1a777..d4bdd9c099 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -1925,6 +1925,16 @@ static void print_pkt_side_data(WriterContext *w,
 writer_print_section_footer(w);
 }
 
+static void print_primaries(WriterContext *w, enum AVColorPrimaries 
color_primaries)
+{
+const char *val = av_color_primaries_name(color_primaries);
+if (!val || color_primaries == AVCOL_PRI_UNSPECIFIED) {
+print_str_opt("color_primaries", "unknown");
+} else {
+print_str("color_primaries", val);
+}
+}
+
 static void clear_log(int need_lock)
 {
 int i;
@@ -2116,10 +2126,7 @@ static void show_frame(WriterContext *w, AVFrame *frame, 
AVStream *stream,
 else
 print_str_opt("color_space", 
av_color_space_name(frame->colorspace));
 
-if (frame->color_primaries != AVCOL_PRI_UNSPECIFIED)
-print_str("color_primaries", 
av_color_primaries_name(frame->color_primaries));
-else
-print_str_opt("color_primaries", 
av_color_primaries_name(frame->color_primaries));
+print_primaries(w, frame->color_primaries);
 
 if (frame->color_trc != AVCOL_TRC_UNSPECIFIED)
 print_str("color_transfer", 
av_color_transfer_name(frame->color_trc));
@@ -2516,10 +2523,7 @@ static int show_stream(WriterContext *w, AVFormatContext 
*fmt_ctx, int stream_id
 else
 print_str_opt("color_transfer", 
av_color_transfer_name(par->color_trc));
 
-if (par->color_primaries != AVCOL_PRI_UNSPECIFIED)
-print_str("color_primaries", 
av_color_primaries_name(par->color_primaries));
-else
-print_str_opt("color_primaries", 
av_color_primaries_name(par->color_primaries));
+print_primaries(w, par->color_primaries);
 
 if (par->chroma_location != AVCHROMA_LOC_UNSPECIFIED)
 print_str("chroma_location", 
av_chroma_location_name(par->chroma_location));
-- 
2.14.1

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


[FFmpeg-devel] [PATCH 2/2] ffprobe: Fix NULL pointer handling in color parameter printing

2017-08-22 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 ffprobe.c | 88 +++
 1 file changed, 49 insertions(+), 39 deletions(-)

diff --git a/ffprobe.c b/ffprobe.c
index d4bdd9c099..ba10563b9d 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -1925,6 +1925,26 @@ static void print_pkt_side_data(WriterContext *w,
 writer_print_section_footer(w);
 }
 
+static void print_color_range(WriterContext *w, enum AVColorRange color_range, 
const char *fallback)
+{
+const char *val = av_color_range_name(color_range);
+if (!val || color_range == AVCOL_RANGE_UNSPECIFIED) {
+print_str_opt("color_range", fallback);
+} else {
+print_str("color_range", val);
+}
+}
+
+static void print_color_space(WriterContext *w, enum AVColorSpace color_space)
+{
+const char *val = av_color_space_name(color_space);
+if (!val || color_space == AVCOL_SPC_UNSPECIFIED) {
+print_str_opt("color_space", "unknown");
+} else {
+print_str("color_space", val);
+}
+}
+
 static void print_primaries(WriterContext *w, enum AVColorPrimaries 
color_primaries)
 {
 const char *val = av_color_primaries_name(color_primaries);
@@ -1935,6 +1955,27 @@ static void print_primaries(WriterContext *w, enum 
AVColorPrimaries color_primar
 }
 }
 
+static void print_color_trc(WriterContext *w, enum 
AVColorTransferCharacteristic color_trc)
+{
+const char *val = av_color_transfer_name(color_trc);
+if (!val || color_trc == AVCOL_TRC_UNSPECIFIED) {
+print_str_opt("color_transfer", "unknown");
+} else {
+print_str("color_transfer", val);
+}
+}
+
+static void print_chroma_location(WriterContext *w, enum AVChromaLocation 
chroma_location)
+{
+const char *val = av_chroma_location_name(chroma_location);
+if (!val || chroma_location == AVCHROMA_LOC_UNSPECIFIED) {
+print_str_opt("chroma_location", "unspecified");
+} else {
+print_str("chroma_location", val);
+}
+}
+
+
 static void clear_log(int need_lock)
 {
 int i;
@@ -2116,27 +2157,11 @@ static void show_frame(WriterContext *w, AVFrame 
*frame, AVStream *stream,
 print_int("top_field_first",frame->top_field_first);
 print_int("repeat_pict",frame->repeat_pict);
 
-if (frame->color_range != AVCOL_RANGE_UNSPECIFIED)
-print_str("color_range", av_color_range_name(frame->color_range));
-else
-print_str_opt("color_range", 
av_color_range_name(frame->color_range));
-
-if (frame->colorspace != AVCOL_SPC_UNSPECIFIED)
-print_str("color_space", av_color_space_name(frame->colorspace));
-else
-print_str_opt("color_space", 
av_color_space_name(frame->colorspace));
-
+print_color_range(w, frame->color_range, "unknown");
+print_color_space(w, frame->colorspace);
 print_primaries(w, frame->color_primaries);
-
-if (frame->color_trc != AVCOL_TRC_UNSPECIFIED)
-print_str("color_transfer", 
av_color_transfer_name(frame->color_trc));
-else
-print_str_opt("color_transfer", 
av_color_transfer_name(frame->color_trc));
-
-if (frame->chroma_location != AVCHROMA_LOC_UNSPECIFIED)
-print_str("chroma_location", 
av_chroma_location_name(frame->chroma_location));
-else
-print_str_opt("chroma_location", 
av_chroma_location_name(frame->chroma_location));
+print_color_trc(w, frame->color_trc);
+print_chroma_location(w, frame->chroma_location);
 break;
 
 case AVMEDIA_TYPE_AUDIO:
@@ -2508,27 +2533,12 @@ static int show_stream(WriterContext *w, 
AVFormatContext *fmt_ctx, int stream_id
 if (s) print_str("pix_fmt", s);
 else   print_str_opt("pix_fmt", "unknown");
 print_int("level",   par->level);
-if (par->color_range != AVCOL_RANGE_UNSPECIFIED)
-print_str("color_range", 
av_color_range_name(par->color_range));
-else
-print_str_opt("color_range", "N/A");
-
-if (par->color_space != AVCOL_SPC_UNSPECIFIED)
-print_str("color_space", av_color_space_name(par->color_space));
-else
-print_str_opt("color_space", 
av_color_space_name(par->color_space));
-
-if (par->color_trc != AVCOL_TRC_UNSPECIFIED)
-print_str("color_transfer", 
av_color_transfer_name(par->color_trc));
-else
-print_str_opt("color_transfer", 
av_color_transfer_name(par->color_trc));
 
+print_color_range(w, par->color_range, "N/A");
+print_color_space(w, par->color_space);
+print_color_trc(w, par->color_trc);
 print_primaries(w, par->color_primaries);
-
-if (par->chroma_location != AVCHROMA_LOC_UNSPECIFIED)
-print_str("chroma_location", 
av_chroma_location_name(par->chroma_location));
-else
-print_str_opt("chroma_location", 
av_chroma_location_name(par->chroma_location));
+  

Re: [FFmpeg-devel] [PATCH 1/2] ffprobe: Fix null pointer dereference with color primaries

2017-08-22 Thread James Almer
On 8/22/2017 2:01 PM, James Almer wrote:
> On 8/22/2017 1:34 PM, Michael Niedermayer wrote:
>> Found-by: AD-lab of venustech
>> Signed-off-by: Michael Niedermayer 
>> ---
>>  ffprobe.c | 20 
>>  1 file changed, 12 insertions(+), 8 deletions(-)
>>
>> diff --git a/ffprobe.c b/ffprobe.c
>> index 50d7c1a777..d4bdd9c099 100644
>> --- a/ffprobe.c
>> +++ b/ffprobe.c
>> @@ -1925,6 +1925,16 @@ static void print_pkt_side_data(WriterContext *w,
>>  writer_print_section_footer(w);
>>  }
>>  
>> +static void print_primaries(WriterContext *w, enum AVColorPrimaries 
>> color_primaries)
>> +{
>> +const char *val = av_color_primaries_name(color_primaries);
>> +if (!val || color_primaries == AVCOL_PRI_UNSPECIFIED) {
>> +print_str_opt("color_primaries", "unknown");
>> +} else {
>> +print_str("color_primaries", val);
>> +}
>> +}
>> +
>>  static void clear_log(int need_lock)
>>  {
>>  int i;
>> @@ -2116,10 +2126,7 @@ static void show_frame(WriterContext *w, AVFrame 
>> *frame, AVStream *stream,
>>  else
>>  print_str_opt("color_space", 
>> av_color_space_name(frame->colorspace));
>>  
>> -if (frame->color_primaries != AVCOL_PRI_UNSPECIFIED)
>> -print_str("color_primaries", 
>> av_color_primaries_name(frame->color_primaries));
>> -else
>> -print_str_opt("color_primaries", 
>> av_color_primaries_name(frame->color_primaries));
>> +print_primaries(w, frame->color_primaries);
>>  
>>  if (frame->color_trc != AVCOL_TRC_UNSPECIFIED)
>>  print_str("color_transfer", 
>> av_color_transfer_name(frame->color_trc));
>> @@ -2516,10 +2523,7 @@ static int show_stream(WriterContext *w, 
>> AVFormatContext *fmt_ctx, int stream_id
>>  else
>>  print_str_opt("color_transfer", 
>> av_color_transfer_name(par->color_trc));
>>  
>> -if (par->color_primaries != AVCOL_PRI_UNSPECIFIED)
>> -print_str("color_primaries", 
>> av_color_primaries_name(par->color_primaries));
>> -else
>> -print_str_opt("color_primaries", 
>> av_color_primaries_name(par->color_primaries));
>> +print_primaries(w, par->color_primaries);
> 
> Shouldn't the same be done for the other properties?
> av_color_transfer_name(), av_color_space_name(),
> av_chroma_location_name(), av_color_range_name(), all may also return
> NULL on invalid values.

Nevermind. I again didn't look at the entire patchset before commenting.

> 
>>  
>>  if (par->chroma_location != AVCHROMA_LOC_UNSPECIFIED)
>>  print_str("chroma_location", 
>> av_chroma_location_name(par->chroma_location));
>>

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


Re: [FFmpeg-devel] [PATCH 1/2] ffprobe: Fix null pointer dereference with color primaries

2017-08-22 Thread James Almer
On 8/22/2017 1:34 PM, Michael Niedermayer wrote:
> Found-by: AD-lab of venustech
> Signed-off-by: Michael Niedermayer 
> ---
>  ffprobe.c | 20 
>  1 file changed, 12 insertions(+), 8 deletions(-)
> 
> diff --git a/ffprobe.c b/ffprobe.c
> index 50d7c1a777..d4bdd9c099 100644
> --- a/ffprobe.c
> +++ b/ffprobe.c
> @@ -1925,6 +1925,16 @@ static void print_pkt_side_data(WriterContext *w,
>  writer_print_section_footer(w);
>  }
>  
> +static void print_primaries(WriterContext *w, enum AVColorPrimaries 
> color_primaries)
> +{
> +const char *val = av_color_primaries_name(color_primaries);
> +if (!val || color_primaries == AVCOL_PRI_UNSPECIFIED) {
> +print_str_opt("color_primaries", "unknown");
> +} else {
> +print_str("color_primaries", val);
> +}
> +}
> +
>  static void clear_log(int need_lock)
>  {
>  int i;
> @@ -2116,10 +2126,7 @@ static void show_frame(WriterContext *w, AVFrame 
> *frame, AVStream *stream,
>  else
>  print_str_opt("color_space", 
> av_color_space_name(frame->colorspace));
>  
> -if (frame->color_primaries != AVCOL_PRI_UNSPECIFIED)
> -print_str("color_primaries", 
> av_color_primaries_name(frame->color_primaries));
> -else
> -print_str_opt("color_primaries", 
> av_color_primaries_name(frame->color_primaries));
> +print_primaries(w, frame->color_primaries);
>  
>  if (frame->color_trc != AVCOL_TRC_UNSPECIFIED)
>  print_str("color_transfer", 
> av_color_transfer_name(frame->color_trc));
> @@ -2516,10 +2523,7 @@ static int show_stream(WriterContext *w, 
> AVFormatContext *fmt_ctx, int stream_id
>  else
>  print_str_opt("color_transfer", 
> av_color_transfer_name(par->color_trc));
>  
> -if (par->color_primaries != AVCOL_PRI_UNSPECIFIED)
> -print_str("color_primaries", 
> av_color_primaries_name(par->color_primaries));
> -else
> -print_str_opt("color_primaries", 
> av_color_primaries_name(par->color_primaries));
> +print_primaries(w, par->color_primaries);

Shouldn't the same be done for the other properties?
av_color_transfer_name(), av_color_space_name(),
av_chroma_location_name(), av_color_range_name(), all may also return
NULL on invalid values.

>  
>  if (par->chroma_location != AVCHROMA_LOC_UNSPECIFIED)
>  print_str("chroma_location", 
> av_chroma_location_name(par->chroma_location));
> 
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Fix signed integer overflows

2017-08-22 Thread Vitaly Buka
What else can I do yo make it accepted?

On Sun, Aug 20, 2017 at 11:56 AM, Vitaly Buka  wrote:

> Signed integer overflow is undefined behavior.
> Detected with clang and -fsanitize=signed-integer-overflow
>
> Signed-off-by: Vitaly Buka 
> ---
>  libavcodec/utils.c| 2 +-
>  libavformat/aviobuf.c | 2 ++
>  libavformat/mov.c | 2 +-
>  3 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index 1336e921c9..1b8ad1d200 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -971,7 +971,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
>  }
>
>  if (!avctx->rc_initial_buffer_occupancy)
> -avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size *
> 3 / 4;
> +avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size *
> 3LL / 4;
>
>  if (avctx->ticks_per_frame && avctx->time_base.num &&
>  avctx->ticks_per_frame > INT_MAX / avctx->time_base.num) {
> diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
> index 7f4e740a33..ec21fc7d38 100644
> --- a/libavformat/aviobuf.c
> +++ b/libavformat/aviobuf.c
> @@ -259,6 +259,8 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int
> whence)
>  offset1 = pos + (s->buf_ptr - s->buffer);
>  if (offset == 0)
>  return offset1;
> +if (offset > INT64_MAX - offset1)
> +return AVERROR(EINVAL);
>  offset += offset1;
>  }
>  if (offset < 0)
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 522ce60c2d..a14c9f182b 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -5572,7 +5572,7 @@ static int mov_read_default(MOVContext *c,
> AVIOContext *pb, MOVAtom atom)
>
>  if (atom.size < 0)
>  atom.size = INT64_MAX;
> -while (total_size + 8 <= atom.size && !avio_feof(pb)) {
> +while (total_size <= atom.size - 8 && !avio_feof(pb)) {
>  int (*parse)(MOVContext*, AVIOContext*, MOVAtom) = NULL;
>  a.size = atom.size;
>  a.type=0;
> --
> 2.14.1.480.gb18f417b89-goog
>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Fix signed integer overflows

2017-08-22 Thread Paul B Mahol
On 8/22/17, Vitaly Buka  wrote:
> What else can I do yo make it accepted?

Ping it after month or two?

>
> On Sun, Aug 20, 2017 at 11:56 AM, Vitaly Buka  wrote:
>
>> Signed integer overflow is undefined behavior.
>> Detected with clang and -fsanitize=signed-integer-overflow
>>
>> Signed-off-by: Vitaly Buka 
>> ---
>>  libavcodec/utils.c| 2 +-
>>  libavformat/aviobuf.c | 2 ++
>>  libavformat/mov.c | 2 +-
>>  3 files changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
>> index 1336e921c9..1b8ad1d200 100644
>> --- a/libavcodec/utils.c
>> +++ b/libavcodec/utils.c
>> @@ -971,7 +971,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
>>  }
>>
>>  if (!avctx->rc_initial_buffer_occupancy)
>> -avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size *
>> 3 / 4;
>> +avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size *
>> 3LL / 4;
>>
>>  if (avctx->ticks_per_frame && avctx->time_base.num &&
>>  avctx->ticks_per_frame > INT_MAX / avctx->time_base.num) {
>> diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
>> index 7f4e740a33..ec21fc7d38 100644
>> --- a/libavformat/aviobuf.c
>> +++ b/libavformat/aviobuf.c
>> @@ -259,6 +259,8 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int
>> whence)
>>  offset1 = pos + (s->buf_ptr - s->buffer);
>>  if (offset == 0)
>>  return offset1;
>> +if (offset > INT64_MAX - offset1)
>> +return AVERROR(EINVAL);
>>  offset += offset1;
>>  }
>>  if (offset < 0)
>> diff --git a/libavformat/mov.c b/libavformat/mov.c
>> index 522ce60c2d..a14c9f182b 100644
>> --- a/libavformat/mov.c
>> +++ b/libavformat/mov.c
>> @@ -5572,7 +5572,7 @@ static int mov_read_default(MOVContext *c,
>> AVIOContext *pb, MOVAtom atom)
>>
>>  if (atom.size < 0)
>>  atom.size = INT64_MAX;
>> -while (total_size + 8 <= atom.size && !avio_feof(pb)) {
>> +while (total_size <= atom.size - 8 && !avio_feof(pb)) {
>>  int (*parse)(MOVContext*, AVIOContext*, MOVAtom) = NULL;
>>  a.size = atom.size;
>>  a.type=0;
>> --
>> 2.14.1.480.gb18f417b89-goog
>>
>>
> ___
> 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] Fix signed integer overflows

2017-08-22 Thread James Almer
On 8/22/2017 2:30 PM, Paul B Mahol wrote:
> On 8/22/17, Vitaly Buka  wrote:
>> What else can I do yo make it accepted?
> 
> Ping it after month or two?

A week is enough wait to justify a ping. A month is overkill.

> 
>>
>> On Sun, Aug 20, 2017 at 11:56 AM, Vitaly Buka  wrote:
>>
>>> Signed integer overflow is undefined behavior.
>>> Detected with clang and -fsanitize=signed-integer-overflow
>>>
>>> Signed-off-by: Vitaly Buka 
>>> ---
>>>  libavcodec/utils.c| 2 +-
>>>  libavformat/aviobuf.c | 2 ++
>>>  libavformat/mov.c | 2 +-
>>>  3 files changed, 4 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
>>> index 1336e921c9..1b8ad1d200 100644
>>> --- a/libavcodec/utils.c
>>> +++ b/libavcodec/utils.c
>>> @@ -971,7 +971,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
>>>  }
>>>
>>>  if (!avctx->rc_initial_buffer_occupancy)
>>> -avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size *
>>> 3 / 4;
>>> +avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size *
>>> 3LL / 4;
>>>
>>>  if (avctx->ticks_per_frame && avctx->time_base.num &&
>>>  avctx->ticks_per_frame > INT_MAX / avctx->time_base.num) {
>>> diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
>>> index 7f4e740a33..ec21fc7d38 100644
>>> --- a/libavformat/aviobuf.c
>>> +++ b/libavformat/aviobuf.c
>>> @@ -259,6 +259,8 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int
>>> whence)
>>>  offset1 = pos + (s->buf_ptr - s->buffer);
>>>  if (offset == 0)
>>>  return offset1;
>>> +if (offset > INT64_MAX - offset1)
>>> +return AVERROR(EINVAL);
>>>  offset += offset1;
>>>  }
>>>  if (offset < 0)
>>> diff --git a/libavformat/mov.c b/libavformat/mov.c
>>> index 522ce60c2d..a14c9f182b 100644
>>> --- a/libavformat/mov.c
>>> +++ b/libavformat/mov.c
>>> @@ -5572,7 +5572,7 @@ static int mov_read_default(MOVContext *c,
>>> AVIOContext *pb, MOVAtom atom)
>>>
>>>  if (atom.size < 0)
>>>  atom.size = INT64_MAX;
>>> -while (total_size + 8 <= atom.size && !avio_feof(pb)) {
>>> +while (total_size <= atom.size - 8 && !avio_feof(pb)) {
>>>  int (*parse)(MOVContext*, AVIOContext*, MOVAtom) = NULL;
>>>  a.size = atom.size;
>>>  a.type=0;
>>> --
>>> 2.14.1.480.gb18f417b89-goog
>>>
>>>
>> ___
>> 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
> 

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


Re: [FFmpeg-devel] [PATCH] Implement NewTek NDI support

2017-08-22 Thread Marton Balint


On Fri, 18 Aug 2017, Maksym Veremeyenko wrote:

[...]

Thanks for all the fixes. Is it ok to apply this version, or we are still 
waiting for some V3 SDK stuff?


One more thing I noticed testing, maybe you can take a look: rgba and rgb0 
format is not working (I used the V1 SDK), only audio frames are received, 
but no apparent error is shown. On the other hand, bgr0 and bgra formats 
do work. If you can't fix it then rgba and rgb0 formats should be removed 
from the supported formats. Also please make the docs in sync with the 
format support changes, I think it now only mentions uyvy422.


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


[FFmpeg-devel] [PATCH] avfilter/af_firequalizer: add min_phase option

2017-08-22 Thread Muhammad Faiz
Signed-off-by: Muhammad Faiz 
---
 doc/filters.texi  |   3 +
 libavfilter/af_firequalizer.c | 147 +-
 2 files changed, 147 insertions(+), 3 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 3b5a38fc9f..bd88665c89 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -2667,6 +2667,9 @@ Default is linlog.
 @item fft2
 Enable 2-channel convolution using complex FFT. This improves speed 
significantly.
 Default is disabled.
+
+@item min_phase
+Enable minimum phase impulse response. Default is disabled.
 @end table
 
 @subsection Examples
diff --git a/libavfilter/af_firequalizer.c b/libavfilter/af_firequalizer.c
index 7741057a65..8348e7558b 100644
--- a/libavfilter/af_firequalizer.c
+++ b/libavfilter/af_firequalizer.c
@@ -70,13 +70,17 @@ typedef struct FIREqualizerContext {
 RDFTContext   *rdft;
 RDFTContext   *irdft;
 FFTContext*fft_ctx;
+RDFTContext   *cepstrum_rdft;
+RDFTContext   *cepstrum_irdft;
 int   analysis_rdft_len;
 int   rdft_len;
+int   cepstrum_len;
 
 float *analysis_buf;
 float *dump_buf;
 float *kernel_tmp_buf;
 float *kernel_buf;
+float *cepstrum_buf;
 float *conv_buf;
 OverlapIndex  *conv_idx;
 int   fir_len;
@@ -99,6 +103,7 @@ typedef struct FIREqualizerContext {
 char  *dumpfile;
 int   dumpscale;
 int   fft2;
+int   min_phase;
 
 int   nb_gain_entry;
 int   gain_entry_err;
@@ -135,6 +140,7 @@ static const AVOption firequalizer_options[] = {
 { "dumpfile", "set dump file", OFFSET(dumpfile), AV_OPT_TYPE_STRING, { 
.str = NULL }, 0, 0, FLAGS },
 { "dumpscale", "set dump scale", OFFSET(dumpscale), AV_OPT_TYPE_INT, { 
.i64 = SCALE_LINLOG }, 0, NB_SCALE-1, FLAGS, "scale" },
 { "fft2", "set 2-channels fft", OFFSET(fft2), AV_OPT_TYPE_BOOL, { .i64 = 0 
}, 0, 1, FLAGS },
+{ "min_phase", "set minimum phase mode", OFFSET(min_phase), 
AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
 { NULL }
 };
 
@@ -147,13 +153,18 @@ static void common_uninit(FIREqualizerContext *s)
 av_rdft_end(s->rdft);
 av_rdft_end(s->irdft);
 av_fft_end(s->fft_ctx);
+av_rdft_end(s->cepstrum_rdft);
+av_rdft_end(s->cepstrum_irdft);
 s->analysis_rdft = s->analysis_irdft = s->rdft = s->irdft = NULL;
 s->fft_ctx = NULL;
+s->cepstrum_rdft = NULL;
+s->cepstrum_irdft = NULL;
 
 av_freep(&s->analysis_buf);
 av_freep(&s->dump_buf);
 av_freep(&s->kernel_tmp_buf);
 av_freep(&s->kernel_buf);
+av_freep(&s->cepstrum_buf);
 av_freep(&s->conv_buf);
 av_freep(&s->conv_idx);
 }
@@ -235,6 +246,46 @@ static void fast_convolute(FIREqualizerContext 
*av_restrict s, const float *av_r
 }
 }
 
+static void fast_convolute_nonlinear(FIREqualizerContext *av_restrict s, const 
float *av_restrict kernel_buf,
+ float *av_restrict conv_buf, OverlapIndex 
*av_restrict idx,
+ float *av_restrict data, int nsamples)
+{
+if (nsamples <= s->nsamples_max) {
+float *buf = conv_buf + idx->buf_idx * s->rdft_len;
+float *obuf = conv_buf + !idx->buf_idx * s->rdft_len + 
idx->overlap_idx;
+int k;
+
+memcpy(buf, data, nsamples * sizeof(*data));
+memset(buf + nsamples, 0, (s->rdft_len - nsamples) * sizeof(*data));
+av_rdft_calc(s->rdft, buf);
+
+buf[0] *= kernel_buf[0];
+buf[1] *= kernel_buf[1];
+for (k = 2; k < s->rdft_len; k += 2) {
+float re, im;
+re = buf[k] * kernel_buf[k] - buf[k+1] * kernel_buf[k+1];
+im = buf[k] * kernel_buf[k+1] + buf[k+1] * kernel_buf[k];
+buf[k] = re;
+buf[k+1] = im;
+}
+
+av_rdft_calc(s->irdft, buf);
+for (k = 0; k < s->rdft_len - idx->overlap_idx; k++)
+buf[k] += obuf[k];
+memcpy(data, buf, nsamples * sizeof(*data));
+idx->buf_idx = !idx->buf_idx;
+idx->overlap_idx = nsamples;
+} else {
+while (nsamples > s->nsamples_max * 2) {
+fast_convolute_nonlinear(s, kernel_buf, conv_buf, idx, data, 
s->nsamples_max);
+data += s->nsamples_max;
+nsamples -= s->nsamples_max;
+}
+fast_convolute_nonlinear(s, kernel_buf, conv_buf, idx, data, 
nsamples/2);
+fast_convolute_nonlinear(s, kernel_buf, conv_buf, idx, data + 
nsamples/2, nsamples - nsamples/2);
+}
+}
+
 static void fast_convolute2(FIREqualizerContext *av_restrict s, const float 
*av_restrict kernel_buf, FFTComplex *av_restrict conv_buf,
 OverlapIndex *av_restrict idx, float *av_restrict 
data0, float *av_restrict data1, int nsamples)
 {
@@ -310,22 +361,32 @@ static void dump_fir(AVFilterContext *ctx, FILE *fp, int 
ch)
 double delay = s->zero_phase ? 0.0 : (doubl

Re: [FFmpeg-devel] [PATCH 1/2] avcodec/aacdec_template: Fix running cleanup in decode_ics_info()

2017-08-22 Thread Michael Niedermayer
On Mon, Aug 21, 2017 at 03:23:09PM -0700, Alex Converse wrote:
> On Sun, Aug 20, 2017 at 5:15 PM, Michael Niedermayer
>  wrote:
> >
> > Fixes: out of array read
> > Fixes: 2873/clusterfuzz-testcase-minimized-5924145713905664
> >
> > Found-by: continuous fuzzing process 
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/aacdec_template.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
> > index a539f74e6f..e7fa27e8db 100644
> > --- a/libavcodec/aacdec_template.c
> > +++ b/libavcodec/aacdec_template.c
> > @@ -1332,7 +1332,7 @@ static int decode_ics_info(AACContext *ac, 
> > IndividualChannelStream *ics,
> >  ics->tns_max_bands =  ff_tns_max_bands_512[sampling_index];
> >  }
> >  if (!ics->num_swb || !ics->swb_offset)
> > -return AVERROR_BUG;
> > +goto fail;
> >  } else {
> >  ics->swb_offset=ff_swb_offset_1024[sampling_index];
> >  ics->num_swb   =   ff_aac_num_swb_1024[sampling_index];
> 
> okay
> 
> > @@ -1356,7 +1356,7 @@ static int decode_ics_info(AACContext *ac, 
> > IndividualChannelStream *ics,
> >  if (aot == AOT_ER_AAC_LD) {
> >  av_log(ac->avctx, AV_LOG_ERROR,
> > "LTP in ER AAC LD not yet implemented.\n");
> > -return AVERROR_PATCHWELCOME;
> > +goto fail;
> >  }
> >  if ((ics->ltp.present = get_bits(gb, 1)))
> >  decode_ltp(&ics->ltp, gb, ics->max_sfb);
> 
> I'm not sure if it matters to anyone, but this is a missing decoder
> feature and returning AVERROR_INVALIDDATA is semantically wrong.

ill apply with the unchanged error codes

thx

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

If you think the mosad wants you dead since a long time then you are either
wrong or dead since a long time.


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


[FFmpeg-devel] [PATCH] configure: Fix DEF file post-processing with LTO enabled.

2017-08-22 Thread Kacper Michajłow
With LTO enabled exported symbol entry looks like:
av_audio_convert @3 DATA

In order to maintain valid format we need to strip everything after @.

This patch fixes linking libraries compiled with MinGW toolchain with LTO 
enabled.

Signed-off-by: Kacper Michajłow 
---
 configure | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 7201941c36..3ed7b72cf4 100755
--- a/configure
+++ b/configure
@@ -4919,12 +4919,12 @@ case $target_os in
 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
 dlltool="${cross_prefix}dlltool"
 if check_cmd lib.exe -list; then
-SLIB_EXTRA_CMD=-'sed -e "s/ @[^ ]*//" $$(@:$(SLIBSUF)=.orig.def) > 
$$(@:$(SLIBSUF)=.def); lib.exe -nologo -machine:$(LIBTARGET) 
-def:$$(@:$(SLIBSUF)=.def) -out:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
+SLIB_EXTRA_CMD=-'sed -e "s/ @[^\r\n]*//" 
$$(@:$(SLIBSUF)=.orig.def) > $$(@:$(SLIBSUF)=.def); lib.exe -nologo 
-machine:$(LIBTARGET) -def:$$(@:$(SLIBSUF)=.def) 
-out:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
 if enabled x86_64; then
 LIBTARGET=x64
 fi
 elif check_cmd $dlltool --version; then
-SLIB_EXTRA_CMD=-'sed -e "s/ @[^ ]*//" $$(@:$(SLIBSUF)=.orig.def) > 
$$(@:$(SLIBSUF)=.def); $(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l 
$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)'
+SLIB_EXTRA_CMD=-'sed -e "s/ @[^\r\n]*//" 
$$(@:$(SLIBSUF)=.orig.def) > $$(@:$(SLIBSUF)=.def); $(DLLTOOL) -m $(LIBTARGET) 
-d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D 
$(SLIBNAME_WITH_MAJOR)'
 fi
 SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
 SLIB_INSTALL_LINKS=
-- 
2.13.3.windows.1.13.gaf0c2223da

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


[FFmpeg-devel] (no subject)

2017-08-22 Thread Rodrigo Severo
Hi,


My company does some video recording and internal streaming.

Our current solution (on Ubuntu 16.10 servers) uses ffmpeg and
ffserver (versions 3.0.7). It works great.

Unfortunately, on Ubuntu 17.04, it stopped working. I believe the
problems I'm facing are related to the deprecation of ffserver. On
Ubuntu 17.04 the ffmpeg/ffserver available is version 3.2.4.

I would like to know if there is any developer(s) interested in
assuming a paid job to maintain ffserver making it compatible with
present and future ffmpeg versions (most important part) and
eventually implementing new features.

Are any of you interested?

Please contact me privately if interested so we can further detail
what should be done.


Regards,

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


Re: [FFmpeg-devel] [PATCH] Implement NewTek NDI support

2017-08-22 Thread Maksym Veremeyenko

22.08.2017 21:06, Marton Balint пише:


On Fri, 18 Aug 2017, Maksym Veremeyenko wrote:

[...]

Thanks for all the fixes. Is it ok to apply this version, or we are 
still waiting for some V3 SDK stuff?


i received updated v3 SDK with a fixed issues i noticed, but i will ask 
about next release date



One more thing I noticed testing, maybe you can take a look: rgba and 
rgb0 format is not working (I used the V1 SDK), only audio frames are 
received, but no apparent error is shown. On the other hand, bgr0 and 
bgra formats do work. If you can't fix it then rgba and rgb0 formats 
should be removed from the supported formats. Also please make the docs 
in sync with the format support changes, I think it now only mentions 
uyvy422.

i think it is related to:

+/* Create receiver description */
+recv_create_desc.color_format = NDIlib_recv_color_format_e_UYVY_RGBA;
+recv_create_desc.bandwidth = NDIlib_recv_bandwidth_highest;
+recv_create_desc.allow_video_fields = ctx->allow_video_fields;

i will try to check against v1 and v3 SDK...

--
Maksym Veremeyenko

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


Re: [FFmpeg-devel] [PATCH 1/1] libavdevice/decklink: configurablity to set max queue size

2017-08-22 Thread Marton Balint


On Fri, 18 Aug 2017, Patagar, Ravindra wrote:


Hi Marton,

Thanks for the review.
Please find the updated patch attached.


Thanks, applied.

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


Re: [FFmpeg-devel] [PATCH 2/2] fate: add test vector aac-al04sf_48

2017-08-22 Thread Michael Niedermayer
On Mon, Aug 21, 2017 at 04:22:15PM -0700, Alex Converse wrote:
> ---
>  tests/fate/aac.mak | 4 
>  1 file changed, 4 insertions(+)

where can i find the files to test & upload to fate samples ?

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] [PATCH]lavc/put_bits: Remove usage of BITSTREAM_WRITER_LE.

2017-08-22 Thread Ivan Kalvachev
On 8/22/17, Ronald S. Bultje  wrote:
> Hi,
>
> On Mon, Aug 21, 2017 at 11:16 AM, Carl Eugen Hoyos 
> wrote:
>
>> Hi!
>>
>> Attached patch tries to slightly simplify and clean up the usage of
>> put_bits* in libavcodec: put_bits_le() functions exist for the
>> little-endian G.726 encoder, so the define makes less sense now.
>>
>> Fate passes here, please review, Carl Eugen
>
>
> I have to agree with Paul here, I can't say I'm a big fan of this...

People,
As developers you are required
not only to give ultimate final verdicts,
but also give (nice technical) reasoning for them.


Here is my list of pro and cons:

- If it ain't broken, don't change it.
+ Bytesteam already uses explicit _le/be and it looks good.

+ Makes the code more clear. It is obvious that the given encoder
writes BE stream. Something that could easily be missed with the
single define.
- The type of bitstream however is not really important for the codec
working. Aka, there is no confusing, because no codec writes BE and LE
at the same time.(yet)

+ Removes messy defines that obfuscate put_bits code, by separating
the big and little ending code.
- Duplicates put_bits.h code. It would probably make reworking harder,
as changes have to be synced in 2 places.

While the last negative point is most important to me,
there is a workaround for it.
The new bitstream functions could be created by a template.

This however would make the code use more messy defines,
that also negates the last positive point.


Well, maybe other developers have better points.
Let's see them.

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


Re: [FFmpeg-devel] [PATCH] avcodec/vp9: Add tile threading support

2017-08-22 Thread Ronald S. Bultje
Hi,

overall pretty good. Nice performance improvement. We typically note
performance improvement as a/b-1, not 1-b/a, so if runtime with 2 threads
is 6 seconds and with 1 thread is 10 seconds, the improvement is not
1-6/10=0.4=40%, but rather 10/6-1=0.67=67%.

On Tue, Aug 22, 2017 at 7:59 PM, Ilia Valiakhmetov 
wrote:

> +void ff_thread_await_progress3(AVCodecContext *avctx, int field, int
> thread, int shift)
> +{
> +SliceThreadContext *p  = avctx->internal->thread_ctx;
> +int *entries  = p->entries;
> +
> +pthread_mutex_lock(&p->progress_mutex[thread]);
> +while ((entries[field]) != shift){
> +pthread_cond_wait(&p->progress_cond[thread],
> &p->progress_mutex[thread]);
> +}
> +pthread_mutex_unlock(&p->progress_mutex[thread]);
> +}


Hm... I think at this level (per-row processing), atomic integers are
better. See how report_progress and await_progress are implemented in
pthread_frame.c, and then implement something like that custom for vp9.c
only (i.e. probably located inside Vp9TileData). I don't think it needs to
be in generic code since it's unlikely to be reused in other codecs...

Most changes to vp9*.[ch] look good. I'll do a closer review tomorrow to
make sure I didn't miss anything.

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


Re: [FFmpeg-devel] [PATCH] Fix signed integer overflows

2017-08-22 Thread Michael Niedermayer
On Sun, Aug 20, 2017 at 11:56:47AM -0700, Vitaly Buka wrote:
> Signed integer overflow is undefined behavior.
> Detected with clang and -fsanitize=signed-integer-overflow
> 
> Signed-off-by: Vitaly Buka 
> ---
>  libavcodec/utils.c| 2 +-
>  libavformat/aviobuf.c | 2 ++
>  libavformat/mov.c | 2 +-
>  3 files changed, 4 insertions(+), 2 deletions(-)

split and applied

thx

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

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato


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] fate: add test vector aac-al04sf_48

2017-08-22 Thread Alex Converse
On Tue, Aug 22, 2017 at 3:23 PM, Michael Niedermayer
 wrote:
> On Mon, Aug 21, 2017 at 04:22:15PM -0700, Alex Converse wrote:
>> ---
>>  tests/fate/aac.mak | 4 
>>  1 file changed, 4 insertions(+)
>
> where can i find the files to test & upload to fate samples ?
>

The files are part of the official conformance suite and can be found at:
ftp://mpaudconf:adif2...@ftp.iis.fhg.de/mpeg4audio-conformance/compressedMp4/al04sf_48.mp4
and
ftp://mpaudconf:adif2...@ftp.iis.fhg.de/mpeg4audio-conformance/referencesWav/al04sf_48.wav
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avcodec/vorbisenc: Improve documentation

2017-08-22 Thread Tyler Jones
Signed-off-by: Tyler Jones 
---
This patch applies cleanly onto "[PATCH 6/6] avcodec/vorbisenc: Add support
for mono streams".

 libavcodec/vorbis_enc_data.h | 20 ++--
 libavcodec/vorbisenc.c   | 43 +--
 libavcodec/vorbisenc.h   | 20 ++--
 3 files changed, 53 insertions(+), 30 deletions(-)

diff --git a/libavcodec/vorbis_enc_data.h b/libavcodec/vorbis_enc_data.h
index 32750da803..cf94700350 100644
--- a/libavcodec/vorbis_enc_data.h
+++ b/libavcodec/vorbis_enc_data.h
@@ -27,14 +27,14 @@
 #define RES_MAX_CLASSIF 10
 
 typedef const struct {
-int dim;
-int len;
-int real_len;
-const uint8_t *clens;
-int lookup;
-float min;
-float delta;
-const uint8_t *quant;
+int dim;  ///< The number of elements per coded vector
+int len;  ///< The number of filled entries in the book
+int real_len; ///< The expected number of entries, padded with 0 
if len < real_len
+const uint8_t *clens; ///< List of codeword lengths in bits
+int lookup;   ///< Flag if vector lookup is available with this 
book
+float min;///< The minimum value encoded by this book
+float delta;  ///< The distance between encoded points
+const uint8_t *quant; ///< Pointer to a (entries)^(1/dim) column map if 
lookup is set
 } codebook_setup;
 
 typedef const struct {
@@ -817,8 +817,8 @@ static codebook_setup res_mono_config[] = {
 };
 
 static const struct {
-int dim;
-int subclass;
+int dim;///< Dimensions of the class master book
+int subclass;   ///< Integer log base 2 of the number of subclass books
 int masterbook;
 const int nbooks[4];
 } floor_classes[2][5] = {
diff --git a/libavcodec/vorbisenc.c b/libavcodec/vorbisenc.c
index f4af2f4071..78b41b2b49 100644
--- a/libavcodec/vorbisenc.c
+++ b/libavcodec/vorbisenc.c
@@ -414,7 +414,7 @@ static void put_codebook_header(PutBitContext *pb, 
vorbis_enc_codebook *cb)
 int i;
 int ordered = 0;
 
-put_bits(pb, 24, 0x564342); //magic
+put_bits(pb, 24, 0x564342); // Signal the start of a codebook
 put_bits(pb, 16, cb->ndimensions);
 put_bits(pb, 24, cb->nentries);
 
@@ -520,6 +520,7 @@ static void put_residue_header(PutBitContext *pb, 
vorbis_enc_residue *rc,
 put_bits(pb, 6, rc->classifications - 1);
 put_bits(pb, 8, book_offset + rc->classbook);
 
+/* We must specify which partition classes are used in each pass */
 for (i = 0; i < rc->classifications; i++) {
 int j, tmp = 0;
 for (j = 0; j < 8; j++)
@@ -540,6 +541,13 @@ static void put_residue_header(PutBitContext *pb, 
vorbis_enc_residue *rc,
 }
 }
 
+/**
+ * Output necessary information for all primary headers.
+ *
+ * @see   Vorbis I spec "4.2. Header decode and decode setup"
+ * @param out Empty buffer on input, encoded headers on output
+ * @returnNumber of bits written to the buffer or error value
+ */
 static int put_main_header(vorbis_enc_context *venc, uint8_t **out)
 {
 int i;
@@ -552,15 +560,15 @@ static int put_main_header(vorbis_enc_context *venc, 
uint8_t **out)
 
 // identification header
 init_put_bits(&pb, p, buffer_len);
-put_bits(&pb, 8, 1); //magic
+put_bits(&pb, 8, 1); // Signal an ID header
 for (i = 0; "vorbis"[i]; i++)
 put_bits(&pb, 8, "vorbis"[i]);
 put_bits32(&pb, 0); // version
 put_bits(&pb,  8, venc->channels);
 put_bits32(&pb, venc->sample_rate);
-put_bits32(&pb, 0); // bitrate
-put_bits32(&pb, 0); // bitrate
-put_bits32(&pb, 0); // bitrate
+put_bits32(&pb, 0); // Maximum bitrate
+put_bits32(&pb, 0); // Nominal bitrate
+put_bits32(&pb, 0); // Minimum bitrate
 put_bits(&pb,  4, venc->log2_blocksize[0]);
 put_bits(&pb,  4, venc->log2_blocksize[1]);
 put_bits(&pb,  1, 1); // framing
@@ -572,11 +580,11 @@ static int put_main_header(vorbis_enc_context *venc, 
uint8_t **out)
 
 // comment header
 init_put_bits(&pb, p, buffer_len);
-put_bits(&pb, 8, 3); //magic
+put_bits(&pb, 8, 3); // Signal a comment header
 for (i = 0; "vorbis"[i]; i++)
 put_bits(&pb, 8, "vorbis"[i]);
 put_bits32(&pb, 0); // vendor length TODO
-put_bits32(&pb, 0); // amount of comments
+put_bits32(&pb, 0); // amount of comments TODO
 put_bits(&pb,  1, 1); // framing
 
 flush_put_bits(&pb);
@@ -586,7 +594,7 @@ static int put_main_header(vorbis_enc_context *venc, 
uint8_t **out)
 
 // setup header
 init_put_bits(&pb, p, buffer_len);
-put_bits(&pb, 8, 5); //magic
+put_bits(&pb, 8, 5); // Signal a setup header
 for (i = 0; "vorbis"[i]; i++)
 put_bits(&pb, 8, "vorbis"[i]);
 
@@ -623,7 +631,7 @@ static int put_main_header(vorbis_enc_context *venc, 
uint8_t **out)
 if (mc->submaps > 1)
 put_bits(&pb, 4, mc->submaps - 1);
 
-put_bits(&pb, 1, !!mc->coupling_steps);
+put_bits(&pb, 1, !!m

Re: [FFmpeg-devel] [PATCH] Implement NewTek NDI support

2017-08-22 Thread Maksym Veremeyenko

22.08.2017 23:14, Maksym Veremeyenko пише:
[...]
One more thing I noticed testing, maybe you can take a look: rgba and 
rgb0 format is not working (I used the V1 SDK), only audio frames are 
received, but no apparent error is shown. On the other hand, bgr0 and 
bgra formats do work. If you can't fix it then rgba and rgb0 formats 
should be removed from the supported formats. Also please make the 
docs in sync with the format support changes, I think it now only 
mentions uyvy422.

i think it is related to:

+    /* Create receiver description */
+    recv_create_desc.color_format = NDIlib_recv_color_format_e_UYVY_RGBA;
+    recv_create_desc.bandwidth = NDIlib_recv_bandwidth_highest;
+    recv_create_desc.allow_video_fields = ctx->allow_video_fields;

i will try to check against v1 and v3 SDK...



it is not related to code above. it seems a bug in v1.

not working with v1:

ffmpeg -loop 1 -r 25 -i /usr/local/src/NDI/NDI.Image.png -vf 
"format=pix_fmts=bgr0" -f libndi_newtek -y png_bgr0
ffmpeg -loop 1 -r 25 -i /usr/local/src/NDI/NDI.Image.png -vf 
"format=pix_fmts=bgra" -f libndi_newtek -y png_bgra
ffmpeg -f lavfi -i "testsrc=size=1920x1080:rate=25" -vf 
"format=pix_fmts=rgb0" -f libndi_newtek -y testsrc_rgb0
ffmpeg -f lavfi -i "testsrc=size=1920x1080:rate=25" -vf 
"format=pix_fmts=rgba" -f libndi_newtek -y testsrc_rgba


--
Maksym Veremeyenko

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