static void free_duplicate_context(MpegEncContext *s){

    if(s==NULL) return;



    av_freep(&s->allocated_edge_emu_buffer); s->edge_emu_buffer= NULL;

    av_freep(&s->me.scratchpad);

    s->me.temp=

    s->rd_scratchpad=

    s->b_scratchpad=

    s->obmc_scratchpad= NULL;



    av_freep(&s->dct_error_sum);

    av_freep(&s->me.map);

    av_freep(&s->me.score_map);

    av_freep(&s->blocks);

    av_freep(&s->ac_val_base);

    s->block= NULL;

}
