Re: [libav-devel] [PATCH] h264_sei: handle stereoscopy frame sequential flags

2017-09-21 Thread wm4
On Thu, 21 Sep 2017 19:15:37 +0200
Vittorio Giovara  wrote:

> On Thu, Sep 21, 2017 at 5:40 PM, Steve Lhomme  wrote:
> 
> > On Thu, Sep 21, 2017 at 4:58 PM, Vittorio Giovara
> >  wrote:  
> > > On Thu, Sep 21, 2017 at 4:03 PM, Steve Lhomme  wrote:
> > >  
> > >> From: "Mohammed (Shaan) Huzaifa Danish" 
> > >>
> > >> ---
> > >> fix previous patch skipping the wrong amount of bits
> > >> ---
> > >>  libavcodec/h264_sei.c   | 6 --
> > >>  libavcodec/h264_sei.h   | 1 +
> > >>  libavcodec/h264_slice.c | 2 ++
> > >>  libavutil/stereo3d.h| 4 
> > >>  4 files changed, 11 insertions(+), 2 deletions(-)
> > >>
> > >> diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
> > >> index 03fca9017f..96ac427931 100644
> > >> --- a/libavcodec/h264_sei.c
> > >> +++ b/libavcodec/h264_sei.c
> > >> @@ -315,9 +315,11 @@ static int decode_frame_packing_arrangeme  
> > nt(H264SEIFramePacking  
> > >> *h,
> > >>  h->content_interpretation_type= get_bits(gb, 6);
> > >>
> > >>  // the following skips: spatial_flipping_flag,
> > >> frame0_flipped_flag,
> > >> -// field_views_flag, current_frame_is_frame0_flag,
> > >> +// field_views_flag
> > >> +skip_bits(gb, 3);
> > >> +h->current_frame_is_frame0_flag   = get_bits1(gb);
> > >>  // frame0_self_contained_flag, frame1_self_contained_flag
> > >> -skip_bits(gb, 6);
> > >> +skip_bits(gb, 2);
> > >>
> > >>  if (!h->quincunx_subsampling && h->arrangement_type != 5)
> > >>  skip_bits(gb, 16);  // frame[01]_grid_position_[xy]
> > >> diff --git a/libavcodec/h264_sei.h b/libavcodec/h264_sei.h
> > >> index f6ac6034da..c3a19dd831 100644
> > >> --- a/libavcodec/h264_sei.h
> > >> +++ b/libavcodec/h264_sei.h
> > >> @@ -108,6 +108,7 @@ typedef struct H264SEIFramePacking {
> > >>  int arrangement_type;
> > >>  int content_interpretation_type;
> > >>  int quincunx_subsampling;
> > >> +int current_frame_is_frame0_flag;
> > >>  } H264SEIFramePacking;
> > >>
> > >>  typedef struct H264SEIDisplayOrientation {
> > >> diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
> > >> index 5dd01d836e..f5b78bfe29 100644
> > >> --- a/libavcodec/h264_slice.c
> > >> +++ b/libavcodec/h264_slice.c
> > >> @@ -1112,6 +1112,8 @@ static int h264_export_frame_props(H264Context  
> > *h)  
> > >>
> > >>  if (fp->content_interpretation_type == 2)
> > >>  stereo->flags = AV_STEREO3D_FLAG_INVERT;
> > >> +if (fp->current_frame_is_frame0_flag)
> > >> +stereo->flags |= AV_STEREO3D_FLAG_FRAME0;
> > >>  }
> > >>
> > >>  if (h->sei.display_orientation.present &&
> > >> diff --git a/libavutil/stereo3d.h b/libavutil/stereo3d.h
> > >> index 0fa9f63a2c..4c8ab5c40a 100644
> > >> --- a/libavutil/stereo3d.h
> > >> +++ b/libavutil/stereo3d.h
> > >> @@ -146,6 +146,10 @@ enum AVStereo3DType {
> > >>   * Inverted views, Right/Bottom represents the left view.
> > >>   */
> > >>  #define AV_STEREO3D_FLAG_INVERT (1 << 0)
> > >> +/**
> > >> + * This frame is frame0 (left view), otherwise it's the right view.
> > >> + */
> > >> +#define AV_STEREO3D_FLAG_FRAME0 (1 << 1)
> > >>  
> > >
> > > Hey Steve,
> > > I would rather not expose a flag for something this specific (as it  
> > applies  
> > > to a single type only).
> > > The name is also peculiar, and confusing, the left view has always  
> > priority  
> > > so that should be the default variant (ie no flag).  
> >
> > If left is the default, how do you signal that it's the right eye ?
> >  
> 
> You can keep track of the decoded frames, if frame_num%2 == 1 it means
> you're on a right view.

What if one frame fails to decode due to corruption on the transport
layer, or so?
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] Webp support

2017-09-21 Thread Luca Barbato

On 25/07/2017 01:30, GT Wang wrote:

Hello dev,

libav not support webp right ?
In the future, libav will support this format ?


It is already supported since a while, the encoding requires libwebp though.

lu
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH] h264_sei: handle stereoscopy frame sequential flags

2017-09-21 Thread Vittorio Giovara
On Thu, Sep 21, 2017 at 5:40 PM, Steve Lhomme  wrote:

> On Thu, Sep 21, 2017 at 4:58 PM, Vittorio Giovara
>  wrote:
> > On Thu, Sep 21, 2017 at 4:03 PM, Steve Lhomme  wrote:
> >
> >> From: "Mohammed (Shaan) Huzaifa Danish" 
> >>
> >> ---
> >> fix previous patch skipping the wrong amount of bits
> >> ---
> >>  libavcodec/h264_sei.c   | 6 --
> >>  libavcodec/h264_sei.h   | 1 +
> >>  libavcodec/h264_slice.c | 2 ++
> >>  libavutil/stereo3d.h| 4 
> >>  4 files changed, 11 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
> >> index 03fca9017f..96ac427931 100644
> >> --- a/libavcodec/h264_sei.c
> >> +++ b/libavcodec/h264_sei.c
> >> @@ -315,9 +315,11 @@ static int decode_frame_packing_arrangeme
> nt(H264SEIFramePacking
> >> *h,
> >>  h->content_interpretation_type= get_bits(gb, 6);
> >>
> >>  // the following skips: spatial_flipping_flag,
> >> frame0_flipped_flag,
> >> -// field_views_flag, current_frame_is_frame0_flag,
> >> +// field_views_flag
> >> +skip_bits(gb, 3);
> >> +h->current_frame_is_frame0_flag   = get_bits1(gb);
> >>  // frame0_self_contained_flag, frame1_self_contained_flag
> >> -skip_bits(gb, 6);
> >> +skip_bits(gb, 2);
> >>
> >>  if (!h->quincunx_subsampling && h->arrangement_type != 5)
> >>  skip_bits(gb, 16);  // frame[01]_grid_position_[xy]
> >> diff --git a/libavcodec/h264_sei.h b/libavcodec/h264_sei.h
> >> index f6ac6034da..c3a19dd831 100644
> >> --- a/libavcodec/h264_sei.h
> >> +++ b/libavcodec/h264_sei.h
> >> @@ -108,6 +108,7 @@ typedef struct H264SEIFramePacking {
> >>  int arrangement_type;
> >>  int content_interpretation_type;
> >>  int quincunx_subsampling;
> >> +int current_frame_is_frame0_flag;
> >>  } H264SEIFramePacking;
> >>
> >>  typedef struct H264SEIDisplayOrientation {
> >> diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
> >> index 5dd01d836e..f5b78bfe29 100644
> >> --- a/libavcodec/h264_slice.c
> >> +++ b/libavcodec/h264_slice.c
> >> @@ -1112,6 +1112,8 @@ static int h264_export_frame_props(H264Context
> *h)
> >>
> >>  if (fp->content_interpretation_type == 2)
> >>  stereo->flags = AV_STEREO3D_FLAG_INVERT;
> >> +if (fp->current_frame_is_frame0_flag)
> >> +stereo->flags |= AV_STEREO3D_FLAG_FRAME0;
> >>  }
> >>
> >>  if (h->sei.display_orientation.present &&
> >> diff --git a/libavutil/stereo3d.h b/libavutil/stereo3d.h
> >> index 0fa9f63a2c..4c8ab5c40a 100644
> >> --- a/libavutil/stereo3d.h
> >> +++ b/libavutil/stereo3d.h
> >> @@ -146,6 +146,10 @@ enum AVStereo3DType {
> >>   * Inverted views, Right/Bottom represents the left view.
> >>   */
> >>  #define AV_STEREO3D_FLAG_INVERT (1 << 0)
> >> +/**
> >> + * This frame is frame0 (left view), otherwise it's the right view.
> >> + */
> >> +#define AV_STEREO3D_FLAG_FRAME0 (1 << 1)
> >>
> >
> > Hey Steve,
> > I would rather not expose a flag for something this specific (as it
> applies
> > to a single type only).
> > The name is also peculiar, and confusing, the left view has always
> priority
> > so that should be the default variant (ie no flag).
>
> If left is the default, how do you signal that it's the right eye ?
>

You can keep track of the decoded frames, if frame_num%2 == 1 it means
you're on a right view.


> Given in all other cases where this SEI is not present you don't know
> if you can assume it's there or not ?


if you want, given that the left view has priority, you could do something
like
if packing_type == 5
  if flag0 == 0
flags |= invert
  else
flags = 0


> The flag signals that this frame is the left eye and the one coming
> next is the right eye.
>

I'm not sure that's the best approach because this flag would be for a very
specific packing type only, and not generic (like the inverted one).

Do you have a sample available?
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [RFC][PATCH] lavf: Wrap _DEFAULT_SOURCE symbols

2017-09-21 Thread Vittorio Giovara
On Thu, Sep 21, 2017 at 6:35 PM, Diego Biurrun  wrote:

> On Thu, Sep 21, 2017 at 01:44:44PM +0200, Vittorio Giovara wrote:
> > Silence warnings such as:
> >
> >  libavformat/udp.c:27:9: warning: '_DEFAULT_SOURCE'
> >macro redefined [-Wmacro-redefined]
> >  #define _DEFAULT_SOURCE
> >  ^
> >  :4:9: note: previous definition is here
> >  #define _DEFAULT_SOURCE 1
> >  ^
> > ---
> > I'm not sure this is the right approach, since configure explicitly adds
> > add_${pfx}cppflags -D_DEFAULT_SOURCE
> > in my compiler flag...
> > Any better ideas?
>
> And why would it do that? What is your libc?
>

It's the latest clang toolchain available on macOS

Apple LLVM version 9.0.0 (clang-900.0.37)
Target: x86_64-apple-darwin16.7.0
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH] configure: cosmetics: Wrap a configure error string to the paragraph length

2017-09-21 Thread Vittorio Giovara
On Thu, Sep 21, 2017 at 6:34 PM, Diego Biurrun  wrote:

> On Thu, Sep 21, 2017 at 01:37:03PM +0200, Vittorio Giovara wrote:
> > --- a/configure
> > +++ b/configure
> > @@ -401,8 +401,8 @@ include the log this produces with your report.
> >  EOF
> >  else
> >  cat < > -Include the log file "$logfile" produced by configure as this will help
> > -solving the problem.
> > +Include the log file "$logfile" produced by configure as this
> > +will help solving the problem.
> >  EOF
>
> What paragraph length are you wrapping this to? It currently matches the
> length of the previous output lines quite well ...
>

I'm talking about the output lines on a 80chars console
This is how I see it: https://www.dropbox.com/s/qfpgk7i9qs3htwk/Screenshot%
202017-09-21%2019.05.15.png?dl=0
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 3/3] qsvenc: use 'else' on exclusive code

2017-09-21 Thread Diego Biurrun
On Thu, Sep 21, 2017 at 03:52:27PM +0200, Steve Lhomme wrote:
> ---
>  libavcodec/qsvenc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

What is "exclusive code"?

> --- a/libavcodec/qsvenc.c
> +++ b/libavcodec/qsvenc.c
> @@ -1122,7 +1122,7 @@ static int encode_frame(AVCodecContext *avctx, 
> QSVEncContext *q,
>  if (ret > 0)
>  ff_qsv_print_warning(avctx, ret, "Warning during encoding");
>  
> -if (ret < 0) {
> +else if (ret < 0) {
>  qsv_packet_release(_pkt);

This looks a tad confusing if you keep the empty line between the blocks.

Diego
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [RFC][PATCH] lavf: Wrap _DEFAULT_SOURCE symbols

2017-09-21 Thread Diego Biurrun
On Thu, Sep 21, 2017 at 01:44:44PM +0200, Vittorio Giovara wrote:
> Silence warnings such as:
> 
>  libavformat/udp.c:27:9: warning: '_DEFAULT_SOURCE'
>macro redefined [-Wmacro-redefined]
>  #define _DEFAULT_SOURCE
>  ^
>  :4:9: note: previous definition is here
>  #define _DEFAULT_SOURCE 1
>  ^
> ---
> I'm not sure this is the right approach, since configure explicitly adds
> add_${pfx}cppflags -D_DEFAULT_SOURCE
> in my compiler flag...
> Any better ideas?

And why would it do that? What is your libc?

Diego
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH] configure: cosmetics: Wrap a configure error string to the paragraph length

2017-09-21 Thread Diego Biurrun
On Thu, Sep 21, 2017 at 01:37:03PM +0200, Vittorio Giovara wrote:
> --- a/configure
> +++ b/configure
> @@ -401,8 +401,8 @@ include the log this produces with your report.
>  EOF
>  else
>  cat < -Include the log file "$logfile" produced by configure as this will help
> -solving the problem.
> +Include the log file "$logfile" produced by configure as this
> +will help solving the problem.
>  EOF

What paragraph length are you wrapping this to? It currently matches the
length of the previous output lines quite well ...

Diego
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 09/11] cbs: Add some read/write tests

2017-09-21 Thread Diego Biurrun
On Wed, Sep 20, 2017 at 09:03:40PM +0100, Mark Thompson wrote:
> On 20/09/17 19:48, Diego Biurrun wrote:
> > On Sun, Sep 10, 2017 at 12:09:13AM +0100, Mark Thompson wrote:
> >> --- /dev/null
> >> +++ b/tests/fate/cbs.mak
> >> @@ -0,0 +1,74 @@
> >> +
> >> +define FATE_CBS_TEST
> >> +# (codec, test_name, sample_file, output_format)
> >> +FATE_CBS_$(1) += fate-cbs-$(1)-$(2)
> >> +fate-cbs-$(1)-$(2): CMD = md5 -i $(TARGET_SAMPLES)/$(3) -c:v copy -bsf:v 
> >> $(1)_metadata -f $(4)
> >> +endef
> >> +
> >> +$(foreach N,$(FATE_CBS_H264_SAMPLES),$(eval $(call 
> >> FATE_CBS_TEST,h264,$(basename $(N)),h264-conformance/$(N),h264)))
> >> +
> >> +$(foreach N,$(FATE_CBS_HEVC_SAMPLES),$(eval $(call 
> >> FATE_CBS_TEST,hevc,$(basename $(N)),hevc-conformance/$(N),hevc)))
> > 
> > The 1st and 4th arguments are identical. If you wanted, you could get rid
> > of the prefix of the third argument by integrating it into CMD.
> 
> Further down the file there is also:
> 
> >> +$(foreach N,$(FATE_CBS_MPEG2_SAMPLES),$(eval $(call 
> >> FATE_CBS_TEST,mpeg2,$(basename $(N)),mpeg2/$(N),mpeg2video)))
> 
> which doesn't admit either of those changes.

Sorry, I misread. Probably because the mpeg2 tests used a different macro
previously I think. Whatever ...

LGTM then.

Diego
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH] h264_sei: handle stereoscopy frame sequential flags

2017-09-21 Thread Steve Lhomme
On Thu, Sep 21, 2017 at 4:58 PM, Vittorio Giovara
 wrote:
> On Thu, Sep 21, 2017 at 4:03 PM, Steve Lhomme  wrote:
>
>> From: "Mohammed (Shaan) Huzaifa Danish" 
>>
>> ---
>> fix previous patch skipping the wrong amount of bits
>> ---
>>  libavcodec/h264_sei.c   | 6 --
>>  libavcodec/h264_sei.h   | 1 +
>>  libavcodec/h264_slice.c | 2 ++
>>  libavutil/stereo3d.h| 4 
>>  4 files changed, 11 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
>> index 03fca9017f..96ac427931 100644
>> --- a/libavcodec/h264_sei.c
>> +++ b/libavcodec/h264_sei.c
>> @@ -315,9 +315,11 @@ static int 
>> decode_frame_packing_arrangement(H264SEIFramePacking
>> *h,
>>  h->content_interpretation_type= get_bits(gb, 6);
>>
>>  // the following skips: spatial_flipping_flag,
>> frame0_flipped_flag,
>> -// field_views_flag, current_frame_is_frame0_flag,
>> +// field_views_flag
>> +skip_bits(gb, 3);
>> +h->current_frame_is_frame0_flag   = get_bits1(gb);
>>  // frame0_self_contained_flag, frame1_self_contained_flag
>> -skip_bits(gb, 6);
>> +skip_bits(gb, 2);
>>
>>  if (!h->quincunx_subsampling && h->arrangement_type != 5)
>>  skip_bits(gb, 16);  // frame[01]_grid_position_[xy]
>> diff --git a/libavcodec/h264_sei.h b/libavcodec/h264_sei.h
>> index f6ac6034da..c3a19dd831 100644
>> --- a/libavcodec/h264_sei.h
>> +++ b/libavcodec/h264_sei.h
>> @@ -108,6 +108,7 @@ typedef struct H264SEIFramePacking {
>>  int arrangement_type;
>>  int content_interpretation_type;
>>  int quincunx_subsampling;
>> +int current_frame_is_frame0_flag;
>>  } H264SEIFramePacking;
>>
>>  typedef struct H264SEIDisplayOrientation {
>> diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
>> index 5dd01d836e..f5b78bfe29 100644
>> --- a/libavcodec/h264_slice.c
>> +++ b/libavcodec/h264_slice.c
>> @@ -1112,6 +1112,8 @@ static int h264_export_frame_props(H264Context *h)
>>
>>  if (fp->content_interpretation_type == 2)
>>  stereo->flags = AV_STEREO3D_FLAG_INVERT;
>> +if (fp->current_frame_is_frame0_flag)
>> +stereo->flags |= AV_STEREO3D_FLAG_FRAME0;
>>  }
>>
>>  if (h->sei.display_orientation.present &&
>> diff --git a/libavutil/stereo3d.h b/libavutil/stereo3d.h
>> index 0fa9f63a2c..4c8ab5c40a 100644
>> --- a/libavutil/stereo3d.h
>> +++ b/libavutil/stereo3d.h
>> @@ -146,6 +146,10 @@ enum AVStereo3DType {
>>   * Inverted views, Right/Bottom represents the left view.
>>   */
>>  #define AV_STEREO3D_FLAG_INVERT (1 << 0)
>> +/**
>> + * This frame is frame0 (left view), otherwise it's the right view.
>> + */
>> +#define AV_STEREO3D_FLAG_FRAME0 (1 << 1)
>>
>
> Hey Steve,
> I would rather not expose a flag for something this specific (as it applies
> to a single type only).
> The name is also peculiar, and confusing, the left view has always priority
> so that should be the default variant (ie no flag).

If left is the default, how do you signal that it's the right eye ?
Given in all other cases where this SEI is not present you don't know
if you can assume it's there or not ?
The flag signals that this frame is the left eye and the one coming
next is the right eye.

> All in all, what problem is this trying to solve?

Differentiate the left and right view for frame sequential 3D files.

> --
> Vittorio
> ___
> libav-devel mailing list
> libav-devel@libav.org
> https://lists.libav.org/mailman/listinfo/libav-devel
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] Webp support

2017-09-21 Thread GT Wang
Hello dev,

libav not support webp right ?

In the future, libav will support this format ?

Thanks.

-- 
GT Wang
Email:ili...@gmail.com
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] DNxHR Codec support

2017-09-21 Thread Ben Favre-Broady
Hi

I have been instructed to ask the LibAv team rather than at HandBrake; if
you could add DNxHR codec support to your software.

Sorry if this request has been done improperly it is my first request..

Thanks

Oliver Favre-Broady
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH] h264_sei: handle stereoscopy frame sequential flags

2017-09-21 Thread Vittorio Giovara
On Thu, Sep 21, 2017 at 4:03 PM, Steve Lhomme  wrote:

> From: "Mohammed (Shaan) Huzaifa Danish" 
>
> ---
> fix previous patch skipping the wrong amount of bits
> ---
>  libavcodec/h264_sei.c   | 6 --
>  libavcodec/h264_sei.h   | 1 +
>  libavcodec/h264_slice.c | 2 ++
>  libavutil/stereo3d.h| 4 
>  4 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
> index 03fca9017f..96ac427931 100644
> --- a/libavcodec/h264_sei.c
> +++ b/libavcodec/h264_sei.c
> @@ -315,9 +315,11 @@ static int 
> decode_frame_packing_arrangement(H264SEIFramePacking
> *h,
>  h->content_interpretation_type= get_bits(gb, 6);
>
>  // the following skips: spatial_flipping_flag,
> frame0_flipped_flag,
> -// field_views_flag, current_frame_is_frame0_flag,
> +// field_views_flag
> +skip_bits(gb, 3);
> +h->current_frame_is_frame0_flag   = get_bits1(gb);
>  // frame0_self_contained_flag, frame1_self_contained_flag
> -skip_bits(gb, 6);
> +skip_bits(gb, 2);
>
>  if (!h->quincunx_subsampling && h->arrangement_type != 5)
>  skip_bits(gb, 16);  // frame[01]_grid_position_[xy]
> diff --git a/libavcodec/h264_sei.h b/libavcodec/h264_sei.h
> index f6ac6034da..c3a19dd831 100644
> --- a/libavcodec/h264_sei.h
> +++ b/libavcodec/h264_sei.h
> @@ -108,6 +108,7 @@ typedef struct H264SEIFramePacking {
>  int arrangement_type;
>  int content_interpretation_type;
>  int quincunx_subsampling;
> +int current_frame_is_frame0_flag;
>  } H264SEIFramePacking;
>
>  typedef struct H264SEIDisplayOrientation {
> diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
> index 5dd01d836e..f5b78bfe29 100644
> --- a/libavcodec/h264_slice.c
> +++ b/libavcodec/h264_slice.c
> @@ -1112,6 +1112,8 @@ static int h264_export_frame_props(H264Context *h)
>
>  if (fp->content_interpretation_type == 2)
>  stereo->flags = AV_STEREO3D_FLAG_INVERT;
> +if (fp->current_frame_is_frame0_flag)
> +stereo->flags |= AV_STEREO3D_FLAG_FRAME0;
>  }
>
>  if (h->sei.display_orientation.present &&
> diff --git a/libavutil/stereo3d.h b/libavutil/stereo3d.h
> index 0fa9f63a2c..4c8ab5c40a 100644
> --- a/libavutil/stereo3d.h
> +++ b/libavutil/stereo3d.h
> @@ -146,6 +146,10 @@ enum AVStereo3DType {
>   * Inverted views, Right/Bottom represents the left view.
>   */
>  #define AV_STEREO3D_FLAG_INVERT (1 << 0)
> +/**
> + * This frame is frame0 (left view), otherwise it's the right view.
> + */
> +#define AV_STEREO3D_FLAG_FRAME0 (1 << 1)
>

Hey Steve,
I would rather not expose a flag for something this specific (as it applies
to a single type only).
The name is also peculiar, and confusing, the left view has always priority
so that should be the default variant (ie no flag).
All in all, what problem is this trying to solve?
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH] h264_sei: handle stereoscopy frame sequential flags

2017-09-21 Thread Steve Lhomme
From: "Mohammed (Shaan) Huzaifa Danish" 

---
fix previous patch skipping the wrong amount of bits
---
 libavcodec/h264_sei.c   | 6 --
 libavcodec/h264_sei.h   | 1 +
 libavcodec/h264_slice.c | 2 ++
 libavutil/stereo3d.h| 4 
 4 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index 03fca9017f..96ac427931 100644
--- a/libavcodec/h264_sei.c
+++ b/libavcodec/h264_sei.c
@@ -315,9 +315,11 @@ static int 
decode_frame_packing_arrangement(H264SEIFramePacking *h,
 h->content_interpretation_type= get_bits(gb, 6);
 
 // the following skips: spatial_flipping_flag, frame0_flipped_flag,
-// field_views_flag, current_frame_is_frame0_flag,
+// field_views_flag
+skip_bits(gb, 3);
+h->current_frame_is_frame0_flag   = get_bits1(gb);
 // frame0_self_contained_flag, frame1_self_contained_flag
-skip_bits(gb, 6);
+skip_bits(gb, 2);
 
 if (!h->quincunx_subsampling && h->arrangement_type != 5)
 skip_bits(gb, 16);  // frame[01]_grid_position_[xy]
diff --git a/libavcodec/h264_sei.h b/libavcodec/h264_sei.h
index f6ac6034da..c3a19dd831 100644
--- a/libavcodec/h264_sei.h
+++ b/libavcodec/h264_sei.h
@@ -108,6 +108,7 @@ typedef struct H264SEIFramePacking {
 int arrangement_type;
 int content_interpretation_type;
 int quincunx_subsampling;
+int current_frame_is_frame0_flag;
 } H264SEIFramePacking;
 
 typedef struct H264SEIDisplayOrientation {
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 5dd01d836e..f5b78bfe29 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1112,6 +1112,8 @@ static int h264_export_frame_props(H264Context *h)
 
 if (fp->content_interpretation_type == 2)
 stereo->flags = AV_STEREO3D_FLAG_INVERT;
+if (fp->current_frame_is_frame0_flag)
+stereo->flags |= AV_STEREO3D_FLAG_FRAME0;
 }
 
 if (h->sei.display_orientation.present &&
diff --git a/libavutil/stereo3d.h b/libavutil/stereo3d.h
index 0fa9f63a2c..4c8ab5c40a 100644
--- a/libavutil/stereo3d.h
+++ b/libavutil/stereo3d.h
@@ -146,6 +146,10 @@ enum AVStereo3DType {
  * Inverted views, Right/Bottom represents the left view.
  */
 #define AV_STEREO3D_FLAG_INVERT (1 << 0)
+/**
+ * This frame is frame0 (left view), otherwise it's the right view.
+ */
+#define AV_STEREO3D_FLAG_FRAME0 (1 << 1)
 
 /**
  * Stereo 3D type: this structure describes how two videos are packed
-- 
2.12.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH] h264_sei: handle stereoscopy frame sequential flags

2017-09-21 Thread Steve Lhomme
From: "Mohammed (Shaan) Huzaifa Danish" 

---
 libavcodec/h264_sei.c   | 4 +++-
 libavcodec/h264_sei.h   | 1 +
 libavcodec/h264_slice.c | 2 ++
 libavutil/stereo3d.h| 4 
 4 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index 03fca9017f..337270cb6e 100644
--- a/libavcodec/h264_sei.c
+++ b/libavcodec/h264_sei.c
@@ -315,7 +315,9 @@ static int 
decode_frame_packing_arrangement(H264SEIFramePacking *h,
 h->content_interpretation_type= get_bits(gb, 6);
 
 // the following skips: spatial_flipping_flag, frame0_flipped_flag,
-// field_views_flag, current_frame_is_frame0_flag,
+// field_views_flag
+skip_bits(gb, 3);
+h->current_frame_is_frame0_flag   = get_bits1(gb);
 // frame0_self_contained_flag, frame1_self_contained_flag
 skip_bits(gb, 6);
 
diff --git a/libavcodec/h264_sei.h b/libavcodec/h264_sei.h
index f6ac6034da..c3a19dd831 100644
--- a/libavcodec/h264_sei.h
+++ b/libavcodec/h264_sei.h
@@ -108,6 +108,7 @@ typedef struct H264SEIFramePacking {
 int arrangement_type;
 int content_interpretation_type;
 int quincunx_subsampling;
+int current_frame_is_frame0_flag;
 } H264SEIFramePacking;
 
 typedef struct H264SEIDisplayOrientation {
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 5dd01d836e..f5b78bfe29 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1112,6 +1112,8 @@ static int h264_export_frame_props(H264Context *h)
 
 if (fp->content_interpretation_type == 2)
 stereo->flags = AV_STEREO3D_FLAG_INVERT;
+if (fp->current_frame_is_frame0_flag)
+stereo->flags |= AV_STEREO3D_FLAG_FRAME0;
 }
 
 if (h->sei.display_orientation.present &&
diff --git a/libavutil/stereo3d.h b/libavutil/stereo3d.h
index 0fa9f63a2c..4c8ab5c40a 100644
--- a/libavutil/stereo3d.h
+++ b/libavutil/stereo3d.h
@@ -146,6 +146,10 @@ enum AVStereo3DType {
  * Inverted views, Right/Bottom represents the left view.
  */
 #define AV_STEREO3D_FLAG_INVERT (1 << 0)
+/**
+ * This frame is frame0 (left view), otherwise it's the right view.
+ */
+#define AV_STEREO3D_FLAG_FRAME0 (1 << 1)
 
 /**
  * Stereo 3D type: this structure describes how two videos are packed
-- 
2.12.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH 2/3] qsvenc: merge the output fifo elements into a structure

2017-09-21 Thread Steve Lhomme
This is cleaner to read and less error prone.
---
 libavcodec/qsvenc.c | 117 +---
 1 file changed, 56 insertions(+), 61 deletions(-)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 0c10fd45c9..0dd4b5288d 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -68,6 +68,13 @@ static const struct {
 #endif
 };
 
+struct QSVpacket
+{
+AVPacket new_pkt;
+mfxBitstream *bs;
+mfxSyncPoint *syncp;
+};
+
 static const char *print_profile(mfxU16 profile)
 {
 int i;
@@ -813,8 +820,7 @@ int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q)
 
 q->param.AsyncDepth = q->async_depth;
 
-q->async_fifo = av_fifo_alloc((1 + q->async_depth) *
-  (sizeof(AVPacket) + sizeof(mfxSyncPoint*) + 
sizeof(mfxBitstream*)));
+q->async_fifo = av_fifo_alloc((1 + q->async_depth) * sizeof(struct 
QSVpacket));
 if (!q->async_fifo)
 return AVERROR(ENOMEM);
 
@@ -1063,14 +1069,19 @@ static void print_interlace_msg(AVCodecContext *avctx, 
QSVEncContext *q)
 }
 }
 
+static void qsv_packet_release(struct QSVpacket *qsv_pkt)
+{
+av_packet_unref(_pkt->new_pkt);
+av_freep(qsv_pkt->bs);
+av_freep(qsv_pkt->syncp);
+}
+
 static int encode_frame(AVCodecContext *avctx, QSVEncContext *q,
 const AVFrame *frame)
 {
-AVPacket new_pkt = { 0 };
-mfxBitstream *bs;
+struct QSVpacket qsv_pkt = { 0 };
 
 mfxFrameSurface1 *surf = NULL;
-mfxSyncPoint *sync = NULL;
 mfxStatus ret;
 
 if (frame) {
@@ -1081,29 +1092,29 @@ static int encode_frame(AVCodecContext *avctx, 
QSVEncContext *q,
 }
 }
 
-ret = av_new_packet(_pkt, q->packet_size);
+ret = av_new_packet(_pkt.new_pkt, q->packet_size);
 if (ret < 0) {
 av_log(avctx, AV_LOG_ERROR, "Error allocating the output packet\n");
 return ret;
 }
 
-bs = av_mallocz(sizeof(*bs));
-if (!bs) {
-av_packet_unref(_pkt);
+qsv_pkt.bs = av_mallocz(sizeof(*qsv_pkt.bs));
+if (!qsv_pkt.bs) {
+av_packet_unref(_pkt.new_pkt);
 return AVERROR(ENOMEM);
 }
-bs->Data  = new_pkt.data;
-bs->MaxLength = new_pkt.size;
+qsv_pkt.bs->Data  = qsv_pkt.new_pkt.data;
+qsv_pkt.bs->MaxLength = qsv_pkt.new_pkt.size;
 
-sync = av_mallocz(sizeof(*sync));
-if (!sync) {
-av_freep();
-av_packet_unref(_pkt);
+qsv_pkt.syncp = av_mallocz(sizeof(*qsv_pkt.syncp));
+if (!qsv_pkt.syncp) {
+av_freep(_pkt.bs);
+av_packet_unref(_pkt.new_pkt);
 return AVERROR(ENOMEM);
 }
 
 do {
-ret = MFXVideoENCODE_EncodeFrameAsync(q->session, NULL, surf, bs, 
sync);
+ret = MFXVideoENCODE_EncodeFrameAsync(q->session, enc_ctrl, surf, 
qsv_pkt.bs, qsv_pkt.syncp);
 if (ret == MFX_WRN_DEVICE_BUSY)
 av_usleep(1);
 } while (ret == MFX_WRN_DEVICE_BUSY || ret == MFX_WRN_IN_EXECUTION);
@@ -1112,9 +1123,7 @@ static int encode_frame(AVCodecContext *avctx, 
QSVEncContext *q,
 ff_qsv_print_warning(avctx, ret, "Warning during encoding");
 
 if (ret < 0) {
-av_packet_unref(_pkt);
-av_freep();
-av_freep();
+qsv_packet_release(_pkt);
 return (ret == MFX_ERR_MORE_DATA) ?
0 : ff_qsv_print_error(avctx, ret, "Error during encoding");
 }
@@ -1122,14 +1131,10 @@ static int encode_frame(AVCodecContext *avctx, 
QSVEncContext *q,
 if (ret == MFX_WRN_INCOMPATIBLE_VIDEO_PARAM && frame->interlaced_frame)
 print_interlace_msg(avctx, q);
 
-if (*sync) {
-av_fifo_generic_write(q->async_fifo, _pkt, sizeof(new_pkt), NULL);
-av_fifo_generic_write(q->async_fifo, ,sizeof(sync),NULL);
-av_fifo_generic_write(q->async_fifo, ,  sizeof(bs),NULL);
+if (*qsv_pkt.syncp) {
+av_fifo_generic_write(q->async_fifo, _pkt, sizeof(qsv_pkt), NULL);
 } else {
-av_freep();
-av_packet_unref(_pkt);
-av_freep();
+qsv_packet_release(_pkt);
 }
 
 return 0;
@@ -1146,57 +1151,53 @@ int ff_qsv_encode(AVCodecContext *avctx, QSVEncContext 
*q,
 
 if (!av_fifo_space(q->async_fifo) ||
 (!frame && av_fifo_size(q->async_fifo))) {
-AVPacket new_pkt;
-mfxBitstream *bs;
-mfxSyncPoint *sync;
+struct QSVpacket qsv_pkt;
 
-av_fifo_generic_read(q->async_fifo, _pkt, sizeof(new_pkt), NULL);
-av_fifo_generic_read(q->async_fifo, ,sizeof(sync),NULL);
-av_fifo_generic_read(q->async_fifo, ,  sizeof(bs),  NULL);
+av_fifo_generic_read(q->async_fifo, _pkt, sizeof(qsv_pkt), NULL);
 
 do {
-ret = MFXVideoCORE_SyncOperation(q->session, *sync, 1000);
+ret = MFXVideoCORE_SyncOperation(q->session, *qsv_pkt.syncp, 1000);
 } while (ret == MFX_WRN_IN_EXECUTION);
 
-new_pkt.dts  = av_rescale_q(bs->DecodeTimeStamp, (AVRational){1, 
9}, 

[libav-devel] [PATCH 1/3] qsvenc: the return value is not any kind of int, it's a mfxStatus

2017-09-21 Thread Steve Lhomme
---
 libavcodec/qsvenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index c7e5947361..0c10fd45c9 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -1071,7 +1071,7 @@ static int encode_frame(AVCodecContext *avctx, 
QSVEncContext *q,
 
 mfxFrameSurface1 *surf = NULL;
 mfxSyncPoint *sync = NULL;
-int ret;
+mfxStatus ret;
 
 if (frame) {
 ret = submit_frame(q, frame, );
-- 
2.12.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH 3/3] qsvenc: use 'else' on exclusive code

2017-09-21 Thread Steve Lhomme
---
 libavcodec/qsvenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 0dd4b5288d..eee975c4cd 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -1122,7 +1122,7 @@ static int encode_frame(AVCodecContext *avctx, 
QSVEncContext *q,
 if (ret > 0)
 ff_qsv_print_warning(avctx, ret, "Warning during encoding");
 
-if (ret < 0) {
+else if (ret < 0) {
 qsv_packet_release(_pkt);
 return (ret == MFX_ERR_MORE_DATA) ?
0 : ff_qsv_print_error(avctx, ret, "Error during encoding");
-- 
2.12.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH] cbs_h2645: Initialize a structure before use

2017-09-21 Thread Vittorio Giovara
---
This is to silence this warning (which, admittedly, could also be ignored)

cbs_h2645.c:1007:58: warning: variable 'sps_ext' is uninitialized when used 
here [-Wuninitialized]
err = cbs_h264_write_sps_extension(ctx, pbc, sps_ext);
^~~
cbs_h2645.c:1005:41: note: initialize the variable 'sps_ext' to silence this 
warning
H264RawSPSExtension *sps_ext;
^
= NULL

 libavcodec/cbs_h2645.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c
index 50a227da78..6fe138188a 100644
--- a/libavcodec/cbs_h2645.c
+++ b/libavcodec/cbs_h2645.c
@@ -1002,7 +1002,7 @@ static int cbs_h264_write_nal_unit(CodedBitstreamContext 
*ctx,
 
 case H264_NAL_SPS_EXT:
 {
-H264RawSPSExtension *sps_ext;
+H264RawSPSExtension *sps_ext = NULL;
 
 err = cbs_h264_write_sps_extension(ctx, pbc, sps_ext);
 if (err < 0)
-- 
2.14.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [RFC][PATCH] lavf: Wrap _DEFAULT_SOURCE symbols

2017-09-21 Thread Vittorio Giovara
Silence warnings such as:

 libavformat/udp.c:27:9: warning: '_DEFAULT_SOURCE'
   macro redefined [-Wmacro-redefined]
 #define _DEFAULT_SOURCE
 ^
 :4:9: note: previous definition is here
 #define _DEFAULT_SOURCE 1
 ^
---
I'm not sure this is the right approach, since configure explicitly adds
add_${pfx}cppflags -D_DEFAULT_SOURCE
in my compiler flag...
Any better ideas?
Vittorio

 libavformat/os_support.c | 2 ++
 libavformat/udp.c| 2 ++
 libswscale/utils.c   | 2 ++
 3 files changed, 6 insertions(+)

diff --git a/libavformat/os_support.c b/libavformat/os_support.c
index c125dbe9ba..79be31dd82 100644
--- a/libavformat/os_support.c
+++ b/libavformat/os_support.c
@@ -21,7 +21,9 @@
  */
 
 /* needed by inet_aton() */
+#ifndef _DEFAULT_SOURCE
 #define _DEFAULT_SOURCE
+#endif
 #define _SVID_SOURCE
 
 #include "config.h"
diff --git a/libavformat/udp.c b/libavformat/udp.c
index a29eb1bd33..0994f4f198 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -24,7 +24,9 @@
  * UDP protocol
  */
 
+#ifndef _DEFAULT_SOURCE
 #define _DEFAULT_SOURCE
+#endif
 #define _BSD_SOURCE /* Needed for using struct ip_mreq with recent glibc */
 
 #include "avformat.h"
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 786774f241..07c336eef5 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -20,7 +20,9 @@
 
 #include "config.h"
 
+#ifndef _DEFAULT_SOURCE
 #define _DEFAULT_SOURCE
+#endif
 #define _SVID_SOURCE // needed for MAP_ANONYMOUS
 #include 
 #include 
-- 
2.14.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH] configure: cosmetics: Wrap a configure error string to the paragraph length

2017-09-21 Thread Vittorio Giovara
---
 configure | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index a3cfe37680..8e588ac104 100755
--- a/configure
+++ b/configure
@@ -401,8 +401,8 @@ include the log this produces with your report.
 EOF
 else
 cat 

Re: [libav-devel] [PATCH] pixdesc: Add API to map color property name to enum value

2017-09-21 Thread Vittorio Giovara
On Wed, Sep 20, 2017 at 8:15 PM, Vittorio Giovara <
vittorio.giov...@gmail.com> wrote:

>
>
> On Wed, Sep 20, 2017 at 8:10 PM, wm4  wrote:
>
>> On Wed, 20 Sep 2017 13:33:13 +0200
>> Vittorio Giovara  wrote:
>>
>> > Signed-off-by: Vittorio Giovara 
>> > ---
>> > TODO: version bump, APIdoc entry.
>> > Vittorio
>> >
>>
>> Suggestion: create a table with int/string pairs, and a shared lookup
>> function, so that you don't need to recreate the boilerplate over and
>> over?
>>
>
> I thought of that, but since these are tables that get updated relatively
> often, I didn't want to duplicate the amount of edits needed every time a
> new value is added.
> --
> Vittorio
>

As mentioned on IRC, there seems to be a preference for EINVAL instead of
ENOSYS.
Editing the patch, and queueing soon.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel