Re: [FFmpeg-devel] [PATCH 1/1] cbs_h264: Fix handling of auxiliary pictures

2018-11-08 Thread Mark Thompson
On 07/11/18 03:47, Andreas Rheinhardt wrote:
> The earlier code used the most recent non-auxiliary slice to determine
> whether an auxiliary slice has the syntax of an IDR slice, even when
> the most recent slice was from a slice of a redundant frame. Now only
> slices of the primary coded picture are used, as the specifications
> mandate.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavcodec/cbs_h264_syntax_template.c | 16 +++-
>  1 file changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/libavcodec/cbs_h264_syntax_template.c 
> b/libavcodec/cbs_h264_syntax_template.c
> index dbf9ff1268..aaa4589f4d 100644
> --- a/libavcodec/cbs_h264_syntax_template.c
> +++ b/libavcodec/cbs_h264_syntax_template.c
> @@ -1190,11 +1190,10 @@ static int FUNC(slice_header)(CodedBitstreamContext 
> *ctx, RWContext *rw,
> "in the same access unit.\n");
>  return AVERROR_INVALIDDATA;
>  }
> -} else {
> -h264->last_slice_nal_unit_type =
> -current->nal_unit_header.nal_unit_type;
> -}
> -idr_pic_flag = h264->last_slice_nal_unit_type == H264_NAL_IDR_SLICE;
> +idr_pic_flag = h264->last_slice_nal_unit_type == H264_NAL_IDR_SLICE;
> +} else
> +idr_pic_flag = current->nal_unit_header.nal_unit_type == 
> H264_NAL_IDR_SLICE;
> +
>  
>  ue(first_mb_in_slice, 0, H264_MAX_MB_PIC_SIZE - 1);
>  ue(slice_type, 0, 9);
> @@ -1272,6 +1271,13 @@ static int FUNC(slice_header)(CodedBitstreamContext 
> *ctx, RWContext *rw,
>  
>  if (pps->redundant_pic_cnt_present_flag)
>  ue(redundant_pic_cnt, 0, 127);
> +else
> +infer(redundant_pic_cnt, 0);
> +
> +if (current->nal_unit_header.nal_unit_type != H264_NAL_AUXILIARY_SLICE
> +&& !current->redundant_pic_cnt)
> +h264->last_slice_nal_unit_type =
> +current->nal_unit_header.nal_unit_type;
>  
>  if (slice_type_b)
>  flag(direct_spatial_mv_pred_flag);
> 

Yep; LGTM, and applied.

Thanks!

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


[FFmpeg-devel] [PATCH 1/1] cbs_h264: Fix handling of auxiliary pictures

2018-11-06 Thread Andreas Rheinhardt
The earlier code used the most recent non-auxiliary slice to determine
whether an auxiliary slice has the syntax of an IDR slice, even when
the most recent slice was from a slice of a redundant frame. Now only
slices of the primary coded picture are used, as the specifications
mandate.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/cbs_h264_syntax_template.c | 16 +++-
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/libavcodec/cbs_h264_syntax_template.c 
b/libavcodec/cbs_h264_syntax_template.c
index dbf9ff1268..aaa4589f4d 100644
--- a/libavcodec/cbs_h264_syntax_template.c
+++ b/libavcodec/cbs_h264_syntax_template.c
@@ -1190,11 +1190,10 @@ static int FUNC(slice_header)(CodedBitstreamContext 
*ctx, RWContext *rw,
"in the same access unit.\n");
 return AVERROR_INVALIDDATA;
 }
-} else {
-h264->last_slice_nal_unit_type =
-current->nal_unit_header.nal_unit_type;
-}
-idr_pic_flag = h264->last_slice_nal_unit_type == H264_NAL_IDR_SLICE;
+idr_pic_flag = h264->last_slice_nal_unit_type == H264_NAL_IDR_SLICE;
+} else
+idr_pic_flag = current->nal_unit_header.nal_unit_type == 
H264_NAL_IDR_SLICE;
+
 
 ue(first_mb_in_slice, 0, H264_MAX_MB_PIC_SIZE - 1);
 ue(slice_type, 0, 9);
@@ -1272,6 +1271,13 @@ static int FUNC(slice_header)(CodedBitstreamContext 
*ctx, RWContext *rw,
 
 if (pps->redundant_pic_cnt_present_flag)
 ue(redundant_pic_cnt, 0, 127);
+else
+infer(redundant_pic_cnt, 0);
+
+if (current->nal_unit_header.nal_unit_type != H264_NAL_AUXILIARY_SLICE
+&& !current->redundant_pic_cnt)
+h264->last_slice_nal_unit_type =
+current->nal_unit_header.nal_unit_type;
 
 if (slice_type_b)
 flag(direct_spatial_mv_pred_flag);
-- 
2.19.0

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