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

2017-10-03 Thread Vittorio Giovara
On Tue, Oct 3, 2017 at 9:19 AM, Steve Lhomme  wrote:

> On Thu, Sep 21, 2017 at 7:15 PM, 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.
> >
> >
> >> 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).
>
> What's the status on this ? Weren't you going to submit a patch to set
> a flag for that mode only ? Should I submit it ?


I forgot about it, I'll send it right away.
-- 
Vittorio
___
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-10-03 Thread Steve Lhomme
On Thu, Sep 21, 2017 at 7:15 PM, 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.
>
>
>> 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).

What's the status on this ? Weren't you going to submit a patch to set
a flag for that mode only ? Should I submit it ?

> Do you have a sample available?
> --
> 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

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

2017-09-24 Thread Steve Lhomme
On Thu, Sep 21, 2017 at 7:15 PM, 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.
>
>
>> 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?

Yes, I don't think that's what is used in MVC but it seemed to be a
popular feature in the Playstation world at some point.
Some links to samples can be found here:
http://forum.doom9.org/archive/index.php/t-170863.html

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

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] [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] [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

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