av_freep(&s->field_mv_table); av_freep(&s->field_select_table);
void MPV_common_end(MpegEncContext *s){    int i;    av_freep(&s->parse_context.buffer);    s->parse_context.buffer_size=0;    av_freep(&s->mb_type);    av_freep(&s->p_mv_table_base);    av_freep(&s->b_forw_mv_table_base);    av_freep(&s->b_back_mv_table_base);    av_freep(&s->b_bidir_forw_mv_table_base);    av_freep(&s->b_bidir_back_mv_table_base);    av_freep(&s->b_direct_mv_table_base);    s->p_mv_table= NULL;    s->b_forw_mv_table= NULL;    s->b_back_mv_table= NULL;    s->b_bidir_forw_mv_table= NULL;    s->b_bidir_back_mv_table= NULL;    s->b_direct_mv_table= NULL;        av_freep(&s->dc_val[0]);    av_freep(&s->ac_val[0]);    av_freep(&s->coded_block);    av_freep(&s->mbintra_table);    av_freep(&s->cbp_table);    av_freep(&s->pred_dir_table);    av_freep(&s->me.scratchpad);    av_freep(&s->me.map);    av_freep(&s->me.score_map);        av_freep(&s->mbskip_table);    av_freep(&s->prev_pict_types);    av_freep(&s->bitstream_buffer);    av_freep(&s->tex_pb_buffer);    av_freep(&s->pb2_buffer);    av_freep(&s->allocated_edge_emu_buffer); s->edge_emu_buffer= NULL;    av_freep(&s->field_mv_table);    av_freep(&s->field_select_table);    av_freep(&s->avctx->stats_out);    av_freep(&s->ac_stats);    av_freep(&s->error_status_table);    av_freep(&s->mb_index2xy);    av_freep(&s->lambda_table);    av_freep(&s->q_intra_matrix);    av_freep(&s->q_inter_matrix);    av_freep(&s->q_intra_matrix16);    av_freep(&s->q_inter_matrix16);    av_freep(&s->blocks);    av_freep(&s->input_picture);    av_freep(&s->reordered_input_picture);    av_freep(&s->dct_error_sum);    av_freep(&s->dct_offset);    if(s->picture){        for(i=0; i<MAX_PICTURE_COUNT; i++){            free_picture(s, &s->picture[i]);        }    }    av_freep(&s->picture);    avcodec_default_free_buffers(s->avctx);    s->context_initialized = 0;    s->last_picture_ptr=    s->next_picture_ptr=    s->current_picture_ptr= NULL;    for(i=0; i<3; i++)        if (s->visualization_buffer[i])            av_free(s->visualization_buffer[i]);}