static int vp9_decode_update_thread_context(AVCodecContext *dst, const AVCodecContext *src)

{

    int i, res;

    VP9Context *s = dst->priv_data, *ssrc = src->priv_data;



    // FIXME scalability, size, etc.



    for (i = 0; i < 2; i++) {

        if (s->frames[i].tf.f->data[0])

            vp9_unref_frame(dst, &s->frames[i]);

        if (ssrc->frames[i].tf.f->data[0]) {

            if ((res = vp9_ref_frame(dst, &s->frames[i], &ssrc->frames[i])) < 0)

                return res;

        }

    }

    for (i = 0; i < 8; i++) {

        if (s->refs[i].f->data[0])

            ff_thread_release_buffer(dst, &s->refs[i]);

        if (ssrc->next_refs[i].f->data[0]) {

            if ((res = ff_thread_ref_frame(&s->refs[i], &ssrc->next_refs[i])) < 0)

                return res;

        }

    }



    s->invisible = ssrc->invisible;

    s->keyframe = ssrc->keyframe;

    s->uses_2pass = ssrc->uses_2pass;

    memcpy(&s->prob_ctx, &ssrc->prob_ctx, sizeof(s->prob_ctx));

    memcpy(&s->lf_delta, &ssrc->lf_delta, sizeof(s->lf_delta));

    if (ssrc->segmentation.enabled) {

        memcpy(&s->segmentation.feat, &ssrc->segmentation.feat,

               sizeof(s->segmentation.feat));

    }



    return 0;

}

static int vp9_decode_update_thread_context(AVCodecContext *dst, const AVCodecContext *src)

{

    int i, res;

    VP9Context *s = dst->priv_data, *ssrc = src->priv_data;



    



    for (i = 0; i < 2; i++) {

        if (s->frames[i].tf.f->data[0])

            vp9_unref_frame(dst, &s->frames[i]);

        if (ssrc->frames[i].tf.f->data[0]) {

            if ((res = vp9_ref_frame(dst, &s->frames[i], &ssrc->frames[i])) < 0)

                return res;

        }

    }

    for (i = 0; i < 8; i++) {

        if (s->refs[i].f->data[0])

            ff_thread_release_buffer(dst, &s->refs[i]);

        if (ssrc->next_refs[i].f->data[0]) {

            if ((res = ff_thread_ref_frame(&s->refs[i], &ssrc->next_refs[i])) < 0)

                return res;

        }

    }



    s->invisible = ssrc->invisible;

    s->keyframe = ssrc->keyframe;

    s->uses_2pass = ssrc->uses_2pass;

    memcpy(&s->prob_ctx, &ssrc->prob_ctx, sizeof(s->prob_ctx));

    memcpy(&s->lf_delta, &ssrc->lf_delta, sizeof(s->lf_delta));

    if (ssrc->segmentation.enabled) {

        memcpy(&s->segmentation.feat, &ssrc->segmentation.feat,

               sizeof(s->segmentation.feat));

    }



    return 0;

}

static int FUNC_0(AVCodecContext *VAR_0, const AVCodecContext *VAR_1)

{

    int VAR_2, VAR_3;

    VP9Context *s = VAR_0->priv_data, *ssrc = VAR_1->priv_data;



    



    for (VAR_2 = 0; VAR_2 < 2; VAR_2++) {

        if (s->frames[VAR_2].tf.f->data[0])

            vp9_unref_frame(VAR_0, &s->frames[VAR_2]);

        if (ssrc->frames[VAR_2].tf.f->data[0]) {

            if ((VAR_3 = vp9_ref_frame(VAR_0, &s->frames[VAR_2], &ssrc->frames[VAR_2])) < 0)

                return VAR_3;

        }

    }

    for (VAR_2 = 0; VAR_2 < 8; VAR_2++) {

        if (s->refs[VAR_2].f->data[0])

            ff_thread_release_buffer(VAR_0, &s->refs[VAR_2]);

        if (ssrc->next_refs[VAR_2].f->data[0]) {

            if ((VAR_3 = ff_thread_ref_frame(&s->refs[VAR_2], &ssrc->next_refs[VAR_2])) < 0)

                return VAR_3;

        }

    }



    s->invisible = ssrc->invisible;

    s->keyframe = ssrc->keyframe;

    s->uses_2pass = ssrc->uses_2pass;

    memcpy(&s->prob_ctx, &ssrc->prob_ctx, sizeof(s->prob_ctx));

    memcpy(&s->lf_delta, &ssrc->lf_delta, sizeof(s->lf_delta));

    if (ssrc->segmentation.enabled) {

        memcpy(&s->segmentation.feat, &ssrc->segmentation.feat,

               sizeof(s->segmentation.feat));

    }



    return 0;

}

static int FUNC_0(AVCodecContext *VAR_0, const AVCodecContext *VAR_1)
{ int VAR_2, VAR_3; VP9Context *s = VAR_0->priv_data, *ssrc = VAR_1->priv_data; for (VAR_2 = 0; VAR_2 < 2; VAR_2++) { if (s->frames[VAR_2].tf.f->data[0])
vp9_unref_frame(VAR_0, &s->frames[VAR_2]); if (ssrc->frames[VAR_2].tf.f->data[0]) { if ((VAR_3 = vp9_ref_frame(VAR_0, &s->frames[VAR_2], &ssrc->frames[VAR_2])) < 0)
return VAR_3; } } for (VAR_2 = 0; VAR_2 < 8; VAR_2++) { if (s->refs[VAR_2].f->data[0])
ff_thread_release_buffer(VAR_0, &s->refs[VAR_2]); if (ssrc->next_refs[VAR_2].f->data[0]) { if ((VAR_3 = ff_thread_ref_frame(&s->refs[VAR_2], &ssrc->next_refs[VAR_2])) < 0)
return VAR_3; } } s->invisible = ssrc->invisible; s->keyframe = ssrc->keyframe; s->uses_2pass = ssrc->uses_2pass; memcpy(&s->prob_ctx, &ssrc->prob_ctx, sizeof(s->prob_ctx)); memcpy(&s->lf_delta, &ssrc->lf_delta, sizeof(s->lf_delta)); if (ssrc->segmentation.enabled) { memcpy(&s->segmentation.feat, &ssrc->segmentation.feat,
sizeof(s->segmentation.feat)); } return 0; }