Quoting Vittorio Giovara (2015-02-07 00:26:43)
> On Thu, Jan 29, 2015 at 3:48 PM, Anton Khirnov <an...@khirnov.net> wrote:
> > There is no need to store a whole H264Picture, with a full AVFrame
> > embedded in it. This should allow getting rid of the embedded AVFrame
> > later.
> 
> \o/
> 
> > ---
> >  libavcodec/h264.h         | 15 +++++++--
> >  libavcodec/h264_direct.c  | 70 ++++++++++++++++++++++-------------------
> >  libavcodec/h264_mb.c      | 42 ++++++++++++-------------
> >  libavcodec/h264_picture.c |  4 +--
> >  libavcodec/h264_refs.c    | 80 
> > +++++++++++++++++++++++++++--------------------
> >  libavcodec/h264_slice.c   |  6 ++--
> >  6 files changed, 122 insertions(+), 95 deletions(-)
> >
> > diff --git a/libavcodec/h264.h b/libavcodec/h264.h
> > index bc17244..c1ebfc9 100644
> > --- a/libavcodec/h264.h
> > +++ b/libavcodec/h264.h
> > @@ -296,6 +296,17 @@ typedef struct H264Picture {
> >      int recovered;          ///< picture at IDR or recovery point + 
> > recovery count
> >  } H264Picture;
> >
> > +typedef struct H264Ref {
> > +    uint8_t *data[3];
> > +    int linesize[3];
> > +
> > +    int reference;
> > +    int poc;
> > +    int pic_id;
> > +
> > +    H264Picture *parent;
> > +} H264Ref;
> 
> Are you sure about the data pointer size?
> Maybe it should have it at least on a separate define so that it could
> be expanded in the future if needed.

What for? H.264 is pretty much fixed and being replaced with HEVC
anyway, so the number of planes is unlikely to ever change. And in this
struct we actually do care about the size somewhat.

> 
> >  typedef struct H264SliceContext {
> >      struct H264Context *h264;
> >      GetBitContext gb;
> > @@ -393,7 +404,7 @@ typedef struct H264SliceContext {
> >       */
> >      unsigned int ref_count[2];          ///< counts frames or fields, 
> > depending on current mb mode
> >      unsigned int list_count;
> > -    H264Picture ref_list[2][48];        /**< 0..15: frame refs, 16..47: 
> > mbaff field refs.
> > +    H264Ref ref_list[2][48];        /**< 0..15: frame refs, 16..47: mbaff 
> > field refs.
> >                                           *   Reordered version of 
> > default_ref_list
> >                                           *   according to picture 
> > reordering in slice header */
> >      int ref2frm[MAX_SLICES][2][64];     ///< reference to frame number 
> > lists, used in the loop filter, the first 2 are for -2,-1
> 
> > diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c
> > index 04cfa9e..60499ab 100644
> > --- a/libavcodec/h264_refs.c
> > +++ b/libavcodec/h264_refs.c
> > @@ -43,23 +43,34 @@ do {\
> >  } while (0)
> >
> >
> > -static void pic_as_field(H264Picture *pic, const int parity){
> > +static void pic_as_field(H264Ref *pic, const int parity)
> > +{
> >      int i;
> > -    for (i = 0; i < 4; ++i) {
> > +    for (i = 0; i < FF_ARRAY_ELEMS(pic->data); ++i) {
> >          if (parity == PICT_BOTTOM_FIELD)
> > -            pic->f.data[i] += pic->f.linesize[i];
> > +            pic->data[i]   += pic->linesize[i];
> >          pic->reference      = parity;
> > -        pic->f.linesize[i] *= 2;
> > +        pic->linesize[i] *= 2;
> >      }
> > -    pic->poc= pic->field_poc[parity == PICT_BOTTOM_FIELD];
> > +    pic->poc = pic->parent->field_poc[parity == PICT_BOTTOM_FIELD];
> > +}
> > +
> > +static void ref_from_h264pic(H264Ref *dst, H264Picture *src)
> > +{
> > +    memcpy(dst->data,     src->f.data,     sizeof(dst->data));
> > +    memcpy(dst->linesize, src->f.linesize, sizeof(dst->linesize));
> > +    dst->reference = src->reference;
> > +    dst->poc       = src->poc;
> > +    dst->pic_id    = src->pic_id;
> > +    dst->parent = src;
> >  }
> 
> This effectively replaces the COPY_PICTURE abomination, so feel free
> to kill it as well while at it.

Right, I intended to but forgot.

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to