static int vp9_alloc_frame(AVCodecContext *ctx, VP9Frame *f)

{

    VP9Context *s = ctx->priv_data;

    int ret, sz;



    if ((ret = ff_thread_get_buffer(ctx, &f->tf, AV_GET_BUFFER_FLAG_REF)) < 0)

        return ret;

    sz = 64 * s->sb_cols * s->sb_rows;

    if (!(f->extradata = av_buffer_allocz(sz * (1 + sizeof(struct VP9mvrefPair))))) {

        ff_thread_release_buffer(ctx, &f->tf);

        return AVERROR(ENOMEM);

    }



    f->segmentation_map = f->extradata->data;

    f->mv = (struct VP9mvrefPair *) (f->extradata->data + sz);



    // retain segmentation map if it doesn't update

    if (s->segmentation.enabled && !s->segmentation.update_map &&

        !s->keyframe && !s->intraonly) {

        memcpy(f->segmentation_map, s->frames[LAST_FRAME].segmentation_map, sz);

    }



    return 0;

}

static int vp9_alloc_frame(AVCodecContext *ctx, VP9Frame *f)

{

    VP9Context *s = ctx->priv_data;

    int ret, sz;



    if ((ret = ff_thread_get_buffer(ctx, &f->tf, AV_GET_BUFFER_FLAG_REF)) < 0)

        return ret;

    sz = 64 * s->sb_cols * s->sb_rows;

    if (!(f->extradata = av_buffer_allocz(sz * (1 + sizeof(struct VP9mvrefPair))))) {

        ff_thread_release_buffer(ctx, &f->tf);

        return AVERROR(ENOMEM);

    }



    f->segmentation_map = f->extradata->data;

    f->mv = (struct VP9mvrefPair *) (f->extradata->data + sz);



    

    if (s->segmentation.enabled && !s->segmentation.update_map &&

        !s->keyframe && !s->intraonly) {

        memcpy(f->segmentation_map, s->frames[LAST_FRAME].segmentation_map, sz);

    }



    return 0;

}

        !s->keyframe && !s->intraonly) {
static int FUNC_0(AVCodecContext *VAR_0, VP9Frame *VAR_1)

{

    VP9Context *s = VAR_0->priv_data;

    int VAR_2, VAR_3;



    if ((VAR_2 = ff_thread_get_buffer(VAR_0, &VAR_1->tf, AV_GET_BUFFER_FLAG_REF)) < 0)

        return VAR_2;

    VAR_3 = 64 * s->sb_cols * s->sb_rows;

    if (!(VAR_1->extradata = av_buffer_allocz(VAR_3 * (1 + sizeof(struct VP9mvrefPair))))) {

        ff_thread_release_buffer(VAR_0, &VAR_1->tf);

        return AVERROR(ENOMEM);

    }



    VAR_1->segmentation_map = VAR_1->extradata->data;

    VAR_1->mv = (struct VP9mvrefPair *) (VAR_1->extradata->data + VAR_3);



    

    if (s->segmentation.enabled && !s->segmentation.update_map &&

        !s->keyframe && !s->intraonly) {

        memcpy(VAR_1->segmentation_map, s->frames[LAST_FRAME].segmentation_map, VAR_3);

    }



    return 0;

}

static int FUNC_0(AVCodecContext *VAR_0, VP9Frame *VAR_1)
{ VP9Context *s = VAR_0->priv_data; int VAR_2, VAR_3; if ((VAR_2 = ff_thread_get_buffer(VAR_0, &VAR_1->tf, AV_GET_BUFFER_FLAG_REF)) < 0)
return VAR_2; VAR_3 = 64 * s->sb_cols * s->sb_rows; if (!(VAR_1->extradata = av_buffer_allocz(VAR_3 * (1 + sizeof(struct VP9mvrefPair))))) { ff_thread_release_buffer(VAR_0, &VAR_1->tf); return AVERROR(ENOMEM); } VAR_1->segmentation_map = VAR_1->extradata->data; VAR_1->mv = (struct VP9mvrefPair *) (VAR_1->extradata->data + VAR_3); if (s->segmentation.enabled && !s->segmentation.update_map &&
!s->keyframe && !s->intraonly) { memcpy(VAR_1->segmentation_map, s->frames[LAST_FRAME].segmentation_map, VAR_3); } return 0; }