/* Destroys the private context for the encoder. All buffers are freed, and the Xvid encoder context is destroyed. */
static av_cold int xvid_encode_close(AVCodecContext *avctx)
/* Destroys the private context for the encoder. All buffers are freed, and the Xvid encoder context is destroyed. */
static av_cold int xvid_encode_close(AVCodecContext *avctx)
{
        av_free(x->twopassbuffer);
        av_free(x->old_twopassbuffer);
    }
    if( x->twopassfile != NULL )
        av_free(x->twopassfile);
    if( x->intra_matrix != NULL )
        av_free(x->intra_matrix);
    if( x->inter_matrix != NULL )
        av_free(x->inter_matrix);
    return 0;
}