On 2011-12-09 15:03:04 +0100, Kostya Shishkov wrote:
> On Fri, Dec 09, 2011 at 02:46:19PM +0100, Janne Grunau wrote:
>
> > diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
> > index 295a633..ea558e1 100644
> > --- a/libavcodec/rv34.c
> > +++ b/libavcodec/rv34.c
> > @@ -24,12 +24,16 @@
> >   * RV30/40 decoder common data
> >   */
> >  
> > +#include "libavutil/internal.h"
> > +
> >  #include "avcodec.h"
> >  #include "dsputil.h"
> >  #include "mpegvideo.h"
> >  #include "golomb.h"
> > +#include "internal.h"
> >  #include "mathops.h"
> >  #include "rectangle.h"
> > +#include "thread.h"
> >  
> >  #include "rv34vlc.h"
> >  #include "rv34data.h"
> > @@ -679,6 +683,14 @@ static inline void rv34_mc(RV34DecContext *r, const 
> > int block_type,
> >          if(uvmx == 6 && uvmy == 6)
> >              uvmx = uvmy = 4;
> >      }
> > +
> > +    if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME)) {
> > +        int offset = (yoff + my + 15)>>4;
> 
> give shift some space to breathe
> 
> > +        AVFrame *f = dir ? &s->next_picture_ptr->f : 
> > &s->last_picture_ptr->f;
> > +        /* wait for the current mb row to be finished */
> > +        ff_thread_await_progress(f, s->mb_y + offset + 1, 0);
> > +    }
> > +
> >      dxy = ly*4 + lx;
> >      srcY = dir ? s->next_picture_ptr->f.data[0] : 
> > s->last_picture_ptr->f.data[0];
> >      srcU = dir ? s->next_picture_ptr->f.data[1] : 
> > s->last_picture_ptr->f.data[1];
> > @@ -833,6 +845,10 @@ static int rv34_decode_mv(RV34DecContext *r, int 
> > block_type)
> >          }
> >      case RV34_MB_B_DIRECT:
> >          //surprisingly, it uses motion scheme from next reference frame
> > +        /* wait for the current mb row to be finished */
> > +        if (HAVE_THREADS && (s->avctx->active_thread_type & 
> > FF_THREAD_FRAME))
> > +       ff_thread_await_progress(&s->next_picture_ptr->f, s->mb_y + 1, 0);
> > +
> 
> weird indentation
> 
> >          next_bt = s->next_picture_ptr->f.mb_type[s->mb_x + s->mb_y * 
> > s->mb_stride];
> >          if(IS_INTRA(next_bt) || IS_SKIP(next_bt)){
> >              ZERO8x2(s->current_picture_ptr->f.motion_val[0][s->mb_x * 2 + 
> > s->mb_y * 2 * s->b8_stride], s->b8_stride);
> > @@ -1305,6 +1322,11 @@ static int rv34_decode_slice(RV34DecContext *r, int 
> > end, const uint8_t* buf, int
> >  
> >              if(r->loop_filter && s->mb_y >= 2)
> >                  r->loop_filter(r, s->mb_y - 2);
> > +
> > +            if (HAVE_THREADS && (s->avctx->active_thread_type & 
> > FF_THREAD_FRAME))
> > +                ff_thread_report_progress(&s->current_picture_ptr->f,
> > +                                          s->mb_y-2, 0);
> 
> give subtraction some space to breathe
> 
> > +
> >          }
> >          if(s->mb_x == s->resync_mb_x)
> >              s->first_slice_line=0;
> > @@ -1370,6 +1392,71 @@ av_cold int ff_rv34_decode_init(AVCodecContext 
> > *avctx)
> >      return 0;
> >  }
> >  
> > +int ff_rv34_decode_init_thread_copy(AVCodecContext *avctx)
> > +{
> > +    RV34DecContext *r = avctx->priv_data;
> > +
> > +    r->s.avctx = avctx;
> > +
> > +    if (avctx->internal->is_copy) {
> > +        FF_ALLOC_OR_GOTO(avctx, r->intra_types_hist, r->intra_types_stride 
> > *
> > +                         4 * 2 * sizeof(*r->intra_types_hist),       
> > err_mem1);
> > +        FF_ALLOC_OR_GOTO(avctx, r->mb_type,          r->s.mb_stride *
> > +                         r->s.mb_height * sizeof(*r->mb_type),       
> > err_mem2);
> > +        FF_ALLOC_OR_GOTO(avctx, r->cbp_luma,         r->s.mb_stride *
> > +                         r->s.mb_height * sizeof(*r->cbp_luma),      
> > err_mem3);
> > +        FF_ALLOC_OR_GOTO(avctx, r->cbp_chroma,       r->s.mb_stride *
> > +                         r->s.mb_height * sizeof(*r->cbp_chroma),    
> > err_mem4);
> > +        FF_ALLOC_OR_GOTO(avctx, r->deblock_coefs,    r->s.mb_stride *
> > +                         r->s.mb_height * sizeof(*r->deblock_coefs), 
> > err_mem5);
> > +
> > +        r->intra_types      = r->intra_types_hist + r->intra_types_stride 
> > * 4;
> > +        r->tmp_b_block_base = NULL;
> > +
> > +        memset(r->mb_type, 0,  r->s.mb_stride * r->s.mb_height *
> > +               sizeof(*r->mb_type));
> > +
> > +        MPV_common_init(&r->s);
> > +    }
> > +    return 0;
> > +err_mem5:
> > +    av_freep(&r->cbp_chroma);
> > +err_mem4:
> > +    av_freep(&r->cbp_luma);
> > +err_mem3:
> > +    av_freep(&r->mb_type);
> > +err_mem2:
> > +    av_freep(&r->intra_types_hist);
> > +    r->intra_types = NULL;
> > +err_mem1:
> > +    return AVERROR(ENOMEM);
> > +}
> > +
> > +int ff_rv34_decode_update_thread_context(AVCodecContext *dst, const 
> > AVCodecContext *src)
> > +{
> > +    RV34DecContext *r= dst->priv_data, *r1= src->priv_data;
> 
> this formatting is not for you, s/=/ =/g

all fixed locally

Janne

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

Reply via email to