Re: [libav-devel] [PATCH] lavc/qsvenc: set HRD buffer size

2017-11-28 Thread Mark Thompson
On 01/12/17 20:04, Zhong Li wrote:
> Hypothetical Reference Decoding (HRD) model assumes that data flows into a
> buffer of the fixed size BufferSizeInKB with a constant bitrate.
> BufferSizeInKB represents the maximum possible size of any compressed frames.
> 
> Signed-off-by: Zhong Li 
> ---
>  libavcodec/qsvenc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
> index 9db9eb3..cdddfd9 100644
> --- a/libavcodec/qsvenc.c
> +++ b/libavcodec/qsvenc.c
> @@ -437,7 +437,7 @@ static int init_video_param(AVCodecContext *avctx, 
> QSVEncContext *q)
>  q->param.mfx.NumSlice   = avctx->slices;
>  q->param.mfx.NumRefFrame= FFMAX(0, avctx->refs);
>  q->param.mfx.EncodedOrder   = 0;
> -q->param.mfx.BufferSizeInKB = 0;
> +q->param.mfx.BufferSizeInKB = (avctx->rc_buffer_size > 0) ? 
> avctx->rc_buffer_size / 8000 : 0;
>  
>  desc = av_pix_fmt_desc_get(sw_format);
>  if (!desc)
> 

The Intel documentation says "BufferSizeInKB represents the maximum possible 
size of any compressed frames.".  Is that just confused?  Some of the 
surrounding text does suggest that it's the right thing.

Probably fine, but are you sure it should be set when in non-bitrate-targetted 
modes?  (The related HRD parameter InitialDelayInKB is set further down in 
CBR/VBR modes only.)

- Mark


Aside:  Please try to avoid sending messages from the future, it's confusing 
when things are sorted by time.  (You probably have the clock set wrong on a 
machine used for git send-email.)
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH] stereo3d: Support view type for frame sequence type

2017-11-28 Thread Luca Barbato

On 03/10/2017 15:41, Vittorio Giovara wrote:

On Tue, Oct 3, 2017 at 9:29 AM, wm4  wrote:


On Tue,  3 Oct 2017 09:26:39 -0400
Vittorio Giovara  wrote:


Implement detection in h264 and hevc and insertion in framepack filter.

Signed-off-by: Vittorio Giovara 
---
  doc/APIchanges |  3 +++
  libavcodec/h264_sei.c  |  7 ---
  libavcodec/h264_sei.h  |  1 +
  libavcodec/h264_slice.c|  7 +++
  libavcodec/hevc_sei.c  |  9 +
  libavcodec/hevc_sei.h  |  1 +
  libavcodec/hevcdec.c   |  7 +++
  libavfilter/vf_framepack.c |  2 ++
  libavutil/stereo3d.h   | 24 
  libavutil/version.h|  2 +-
  10 files changed, 55 insertions(+), 8 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index fa27007f44..b518b6307f 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil: 2017-03-23

  API changes, most recent first:

+2017-xx-xx - xxx - lavu 56.7.0 - stereo3d.h
+  Add view field to AVStereo3D structure and AVStereo3DView enum.
+
  2017-xx-xx - xxx - lavu 56.6.0 - pixdesc.h
Add av_color_range_from_name(), av_color_primaries_from_name(),
av_color_transfer_from_name(), av_color_space_from_name(), and
diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index 03fca9017f..da5d33c36c 100644
--- a/libavcodec/h264_sei.c
+++ b/libavcodec/h264_sei.c
@@ -314,10 +314,11 @@ static int 
decode_frame_packing_arrangement(H264SEIFramePacking

*h,

  h->quincunx_subsampling   = get_bits1(gb);
  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,
+// spatial_flipping_flag, frame0_flipped_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..1b968ebd50 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1112,6 +1112,13 @@ static int h264_export_frame_props(H264Context

*h)


  if (fp->content_interpretation_type == 2)
  stereo->flags = AV_STEREO3D_FLAG_INVERT;
+
+if (fp->arrangement_type == 5) {
+if (fp->current_frame_is_frame0_flag)
+stereo->view = AV_STEREO3D_VIEW_LEFT;
+else
+stereo->view = AV_STEREO3D_VIEW_RIGHT;
+}
  }

  if (h->sei.display_orientation.present &&
diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
index 0a5d4440bf..2bf170601d 100644
--- a/libavcodec/hevc_sei.c
+++ b/libavcodec/hevc_sei.c
@@ -57,10 +57,11 @@ static int 
decode_nal_sei_frame_packing_arrangement(HEVCSEIFramePacking

*s, GetB

  s->quincunx_subsampling   = get_bits1(gb);
  s->content_interpretation_type= get_bits(gb, 6);

-// the following skips spatial_flipping_flag frame0_flipped_flag
-// field_views_flag current_frame_is_frame0_flag
-// frame0_self_contained_flag frame1_self_contained_flag
-skip_bits(gb, 6);
+// spatial_flipping_flag, frame0_flipped_flag, field_views_flag
+skip_bits(gb, 3);
+s->current_frame_is_frame0_flag = get_bits1(gb);
+// frame0_self_contained_flag, frame1_self_contained_flag
+skip_bits(gb, 2);

  if (!s->quincunx_subsampling && s->arrangement_type != 5)
  skip_bits(gb, 16);  // frame[01]_grid_position_[xy]
diff --git a/libavcodec/hevc_sei.h b/libavcodec/hevc_sei.h
index e4aeac1fbe..8d4f5df69f 100644
--- a/libavcodec/hevc_sei.h
+++ b/libavcodec/hevc_sei.h
@@ -67,6 +67,7 @@ typedef struct HEVCSEIFramePacking {
  int arrangement_type;
  int content_interpretation_type;
  int quincunx_subsampling;
+int current_frame_is_frame0_flag;
  } HEVCSEIFramePacking;

  typedef struct HEVCSEIDisplayOrientation {
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index a1619cf4bd..f1d1c77497 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -2397,6 +2397,13 @@ static int set_side_data(HEVCContext *s)

  if (s->sei.frame_packing.content_interpretation_type == 2)
  

Re: [libav-devel] [PATCH] lavc/qsvenc: set HRD buffer size

2017-11-28 Thread Luca Barbato

On 01/12/2017 21:04, Zhong Li wrote:

Hypothetical Reference Decoding (HRD) model assumes that data flows into a
buffer of the fixed size BufferSizeInKB with a constant bitrate.
BufferSizeInKB represents the maximum possible size of any compressed frames.

Signed-off-by: Zhong Li 
---
  libavcodec/qsvenc.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 9db9eb3..cdddfd9 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -437,7 +437,7 @@ static int init_video_param(AVCodecContext *avctx, 
QSVEncContext *q)
  q->param.mfx.NumSlice   = avctx->slices;
  q->param.mfx.NumRefFrame= FFMAX(0, avctx->refs);
  q->param.mfx.EncodedOrder   = 0;
-q->param.mfx.BufferSizeInKB = 0;
+q->param.mfx.BufferSizeInKB = (avctx->rc_buffer_size > 0) ? 
avctx->rc_buffer_size / 8000 : 0;
  
  desc = av_pix_fmt_desc_get(sw_format);

  if (!desc)



Sounds good to me.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel