Quoting Janne Grunau (2016-05-22 20:54:52)
> On 2016-05-16 10:25:51 +0200, Anton Khirnov wrote:
> > That function is currently very long and entangles bitstream parsing and
> > decoder configuration. This makes the code much harder to read than
> > necessary.
> > 
> > Begin splitting the code that configures the decoder state based on the
> > slice header information from the parsing of the slice header.
> > ---
> >  libavcodec/h264_slice.c | 43 +++++++++++++++++++++++++++----------------
> >  1 file changed, 27 insertions(+), 16 deletions(-)
> > 
> > diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
> > index 7031ee2..404e333 100644
> > --- a/libavcodec/h264_slice.c
> > +++ b/libavcodec/h264_slice.c
> > @@ -901,22 +901,14 @@ static int h264_slice_header_init(H264Context *h)
> >      return 0;
> >  }
> >  
> > -/**
> > - * Decode a slice header.
> > - * This will (re)initialize the decoder and call h264_frame_start() as 
> > needed.
> > - *
> > - * @param h h264context
> > - *
> > - * @return 0 if okay, <0 if an error occurred
> > - */
> > -int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl)
> > +static int h264_slice_header_parse(H264Context *h, H264SliceContext *sl)
> 
> h264_parse_slice_header() would match the naming scheme of the existing 
> functions. I don't care much either way.

I prefer proper little endian namespacing, so I'd rather rename
decode_slice_header eventually.

> 
> > @@ -1519,14 +1530,14 @@ int ff_h264_decode_slice_header(H264Context *h, 
> > H264SliceContext *sl)
> >  
> >      if (h->avctx->debug & FF_DEBUG_PICT_INFO) {
> >          av_log(h->avctx, AV_LOG_DEBUG,
> > -               "slice:%d %s mb:%d %c%s%s pps:%u frame:%d poc:%d/%d 
> > ref:%d/%d qp:%d loop:%d:%d:%d weight:%d%s %s\n",
> > +               "slice:%d %s mb:%d %c%s%s frame:%d poc:%d/%d ref:%d/%d 
> > qp:%d loop:%d:%d:%d weight:%d%s %s\n",
> >                 sl->slice_num,
> >                 (h->picture_structure == PICT_FRAME ? "F" : 
> > h->picture_structure == PICT_TOP_FIELD ? "T" : "B"),
> > -               first_mb_in_slice,
> > +               sl->mb_y * h->mb_width + sl->mb_x,
> >                 av_get_picture_type_char(sl->slice_type),
> >                 sl->slice_type_fixed ? " fix" : "",
> >                 h->nal_unit_type == NAL_IDR_SLICE ? " IDR" : "",
> > -               pps_id, h->poc.frame_num,
> > +               h->poc.frame_num,
> 
> I was going to suggest to use the pps_id from the PPS but I noticed that 
> we don't save the PPS Id in the pps. just adding it for this debug 
> message is a little questionable though.

It will also be used in later patches.

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to