On Tue, 19 Feb 2013 12:59:04 +0100, Janne Grunau <[email protected]> wrote:
> On 2013-02-19 08:25:58 +0100, Anton Khirnov wrote:
> > ---
> >  libavcodec/ffv1.c    |    5 +----
> >  libavcodec/ffv1.h    |    2 ++
> >  libavcodec/ffv1dec.c |   47 +++++++++++++++++++++++------------------------
> >  3 files changed, 26 insertions(+), 28 deletions(-)
> > 
> > diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c
> > index 682d111..d67485f 100644
> > --- a/libavcodec/ffv1.c
> > +++ b/libavcodec/ffv1.c
> > @@ -267,10 +267,7 @@ av_cold int ffv1_close(AVCodecContext *avctx)
> >      FFV1Context *s = avctx->priv_data;
> >      int i, j;
> >  
> > -    if (avctx->codec->decode && s->picture.data[0])
> > -        avctx->release_buffer(avctx, &s->picture);
> > -    if (avctx->codec->decode && s->last_picture.data[0])
> > -        avctx->release_buffer(avctx, &s->last_picture);
> > +    av_frame_unref(&s->last_picture);
> >  
> >      for (j = 0; j < s->slice_count; j++) {
> >          FFV1Context *fs = s->slice_context[j];
> > diff --git a/libavcodec/ffv1.h b/libavcodec/ffv1.h
> > index 4752cea..43c9607 100644
> > --- a/libavcodec/ffv1.h
> > +++ b/libavcodec/ffv1.h
> > @@ -80,6 +80,8 @@ typedef struct FFV1Context {
> >      int flags;
> >      int picture_number;
> >      AVFrame picture, last_picture;
> > +
> > +    AVFrame *cur;
> >      int plane_count;
> >      int ac;     // 1 = range coder <-> 0 = golomb rice
> >      int ac_byte_count;      // number of bytes used for AC coding
> > diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
> > index 72f255c..8ef9869 100644
> > --- a/libavcodec/ffv1dec.c
> > +++ b/libavcodec/ffv1dec.c
> > @@ -317,16 +317,16 @@ static int decode_slice_header(FFV1Context *f, 
> > FFV1Context *fs)
> >  
> >      ps = get_symbol(c, state, 0);
> >      if (ps == 1) {
> > -        f->picture.interlaced_frame = 1;
> > -        f->picture.top_field_first  = 1;
> > +        f->cur->interlaced_frame = 1;
> > +        f->cur->top_field_first  = 1;
> >      } else if (ps == 2) {
> > -        f->picture.interlaced_frame = 1;
> > -        f->picture.top_field_first  = 0;
> > +        f->cur->interlaced_frame = 1;
> > +        f->cur->top_field_first  = 0;
> >      } else if (ps == 3) {
> > -        f->picture.interlaced_frame = 0;
> > +        f->cur->interlaced_frame = 0;
> >      }
> > -    f->picture.sample_aspect_ratio.num = get_symbol(c, state, 0);
> > -    f->picture.sample_aspect_ratio.den = get_symbol(c, state, 0);
> > +    f->cur->sample_aspect_ratio.num = get_symbol(c, state, 0);
> > +    f->cur->sample_aspect_ratio.den = get_symbol(c, state, 0);
> >  
> >      return 0;
> >  }
> > @@ -339,7 +339,7 @@ static int decode_slice(AVCodecContext *c, void *arg)
> >      const int ps = (av_pix_fmt_desc_get(c->pix_fmt)->flags & 
> > PIX_FMT_PLANAR)
> >                     ? (c->bits_per_raw_sample > 8) + 1
> >                     : 4;
> > -    AVFrame *const p = &f->picture;
> > +    AVFrame *const p = f->cur;
> >  
> >      if (f->version > 2) {
> >          if (decode_slice_header(f, fs) < 0) {
> > @@ -349,7 +349,7 @@ static int decode_slice(AVCodecContext *c, void *arg)
> >      }
> >      if ((ret = ffv1_init_slice_state(f, fs)) < 0)
> >          return ret;
> > -    if (f->picture.key_frame)
> > +    if (f->cur->key_frame)
> >          ffv1_clear_slice_state(f, fs);
> >      width  = fs->slice_width;
> >      height = fs->slice_height;
> > @@ -735,8 +735,8 @@ static int read_header(FFV1Context *f)
> >  
> >              fs->slice_x      /= f->num_h_slices;
> >              fs->slice_y      /= f->num_v_slices;
> > -            fs->slice_width  /= f->num_h_slices - fs->slice_x;
> > -            fs->slice_height /= f->num_v_slices - fs->slice_y;
> > +            fs->slice_width  = fs->slice_width  / f->num_h_slices - 
> > fs->slice_x;
> > +            fs->slice_height = fs->slice_height / f->num_v_slices - 
> > fs->slice_y;
> 
> unrelated, please fix separately
> 

Oops, I totally did not intend for this to be here.

I'll send it in a separate patch of course.

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

Reply via email to