static int dvvideo_decode_frame(AVCodecContext *avctx, 

                                 void *data, int *data_size,

                                 uint8_t *buf, int buf_size)

{

    DVVideoContext *s = avctx->priv_data;

  

    /* special case for last picture */

    if(buf_size==0)

        return 0;

    

    s->sys = dv_frame_profile(buf);

    if (!s->sys || buf_size < s->sys->frame_size)

        return -1; /* NOTE: we only accept several full frames */



    if(s->picture.data[0])

        avctx->release_buffer(avctx, &s->picture);

    

    s->picture.reference = 0;

    avctx->pix_fmt = s->sys->pix_fmt;

    avctx->width = s->sys->width;

    avctx->height = s->sys->height;

    if(avctx->get_buffer(avctx, &s->picture) < 0) {

        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");

        return -1;

    }

    s->picture.interlaced_frame = 1;

    s->picture.top_field_first = 0;



    s->buf = buf;

    avctx->execute(avctx, dv_decode_mt, (void**)&dv_anchor[0], NULL, 

	           s->sys->difseg_size * 27);

    

    emms_c();



    /* return image */

    *data_size = sizeof(AVFrame);

    *(AVFrame*)data= s->picture;

    

    return s->sys->frame_size;

}

static int dvvideo_decode_frame(AVCodecContext *avctx, 

                                 void *data, int *data_size,

                                 uint8_t *buf, int buf_size)

{

    DVVideoContext *s = avctx->priv_data;

  

    

    if(buf_size==0)

        return 0;

    

    s->sys = dv_frame_profile(buf);

    if (!s->sys || buf_size < s->sys->frame_size)

        return -1; 



    if(s->picture.data[0])

        avctx->release_buffer(avctx, &s->picture);

    

    s->picture.reference = 0;

    avctx->pix_fmt = s->sys->pix_fmt;

    avctx->width = s->sys->width;

    avctx->height = s->sys->height;

    if(avctx->get_buffer(avctx, &s->picture) < 0) {

        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");

        return -1;

    }

    s->picture.interlaced_frame = 1;

    s->picture.top_field_first = 0;



    s->buf = buf;

    avctx->execute(avctx, dv_decode_mt, (void**)&dv_anchor[0], NULL, 

	           s->sys->difseg_size * 27);

    

    emms_c();



    

    *data_size = sizeof(AVFrame);

    *(AVFrame*)data= s->picture;

    

    return s->sys->frame_size;

}

static int FUNC_0(AVCodecContext *VAR_0, 

                                 void *VAR_1, int *VAR_2,

                                 uint8_t *VAR_3, int VAR_4)

{

    DVVideoContext *s = VAR_0->priv_data;

  

    

    if(VAR_4==0)

        return 0;

    

    s->sys = dv_frame_profile(VAR_3);

    if (!s->sys || VAR_4 < s->sys->frame_size)

        return -1; 



    if(s->picture.VAR_1[0])

        VAR_0->release_buffer(VAR_0, &s->picture);

    

    s->picture.reference = 0;

    VAR_0->pix_fmt = s->sys->pix_fmt;

    VAR_0->width = s->sys->width;

    VAR_0->height = s->sys->height;

    if(VAR_0->get_buffer(VAR_0, &s->picture) < 0) {

        av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed\n");

        return -1;

    }

    s->picture.interlaced_frame = 1;

    s->picture.top_field_first = 0;



    s->VAR_3 = VAR_3;

    VAR_0->execute(VAR_0, dv_decode_mt, (void**)&dv_anchor[0], NULL, 

	           s->sys->difseg_size * 27);

    

    emms_c();



    

    *VAR_2 = sizeof(AVFrame);

    *(AVFrame*)VAR_1= s->picture;

    

    return s->sys->frame_size;

}

static int FUNC_0(AVCodecContext *VAR_0,
void *VAR_1, int *VAR_2,
uint8_t *VAR_3, int VAR_4)
{ DVVideoContext *s = VAR_0->priv_data; if(VAR_4==0)
return 0; s->sys = dv_frame_profile(VAR_3); if (!s->sys || VAR_4 < s->sys->frame_size)
return -1; if(s->picture.VAR_1[0])
VAR_0->release_buffer(VAR_0, &s->picture); s->picture.reference = 0; VAR_0->pix_fmt = s->sys->pix_fmt; VAR_0->width = s->sys->width; VAR_0->height = s->sys->height; if(VAR_0->get_buffer(VAR_0, &s->picture) < 0) { av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } s->picture.interlaced_frame = 1; s->picture.top_field_first = 0; s->VAR_3 = VAR_3; VAR_0->execute(VAR_0, dv_decode_mt, (void**)&dv_anchor[0], NULL,
s->sys->difseg_size * 27); emms_c(); *VAR_2 = sizeof(AVFrame); *(AVFrame*)VAR_1= s->picture; return s->sys->frame_size; }