static void vp8_decode_flush_impl(AVCodecContext *avctx,
                                  int prefer_delayed_free, int can_direct_free, int free_mem)
{
    VP8Context *s = avctx->priv_data;
    int i;

    if (!avctx->is_copy) {
        for (i = 0; i < 5; i++)
            if (s->frames[i].data[0])
                vp8_release_frame(s, &s->frames[i], prefer_delayed_free, can_direct_free);
    }
    memset(s->framep, 0, sizeof(s->framep));

    if (free_mem) {
        free_buffers(s);
        s->maps_are_invalid = 1;
    }
}