if(pic->type == FF_BUFFER_TYPE_INTERNAL){ for(i=0; i<4; i++){ av_freep(&pic->base[i]); pic->data[i]= NULL; } av_freep(&pic->opaque); pic->type= 0; }else if(pic->type == FF_BUFFER_TYPE_SHARED){
if(pic->type == FF_BUFFER_TYPE_SHARED){
static void free_picture(MpegEncContext *s, Picture *pic){    int i;    if(pic->data[0] && pic->type!=FF_BUFFER_TYPE_SHARED){        s->avctx->release_buffer(s->avctx, (AVFrame*)pic);    }    av_freep(&pic->mb_var);    av_freep(&pic->mc_mb_var);    av_freep(&pic->mb_mean);    av_freep(&pic->mb_cmp_score);    av_freep(&pic->mbskip_table);    av_freep(&pic->qscale_table);    av_freep(&pic->mb_type_base);    pic->mb_type= NULL;    for(i=0; i<2; i++){        av_freep(&pic->motion_val[i]);        av_freep(&pic->ref_index[i]);    }    if(pic->type == FF_BUFFER_TYPE_INTERNAL){        for(i=0; i<4; i++){            av_freep(&pic->base[i]);            pic->data[i]= NULL;        }        av_freep(&pic->opaque);        pic->type= 0;    }else if(pic->type == FF_BUFFER_TYPE_SHARED){        for(i=0; i<4; i++){            pic->base[i]=            pic->data[i]= NULL;        }        pic->type= 0;            }}