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

{

    Vp3DecodeContext *s = dst->priv_data, *s1 = src->priv_data;

    int qps_changed = 0, i, err;



#define copy_fields(to, from, start_field, end_field) memcpy(&to->start_field, &from->start_field, (char*)&to->end_field - (char*)&to->start_field)



    if (!s1->current_frame.data[0]

        ||s->width != s1->width

        ||s->height!= s1->height) {

        if (s != s1)

            copy_fields(s, s1, golden_frame, current_frame);

        return -1;

    }



    if (s != s1) {

        // init tables if the first frame hasn't been decoded

        if (!s->current_frame.data[0]) {

            int y_fragment_count, c_fragment_count;

            s->avctx = dst;

            err = allocate_tables(dst);

            if (err)

                return err;

            y_fragment_count = s->fragment_width[0] * s->fragment_height[0];

            c_fragment_count = s->fragment_width[1] * s->fragment_height[1];

            memcpy(s->motion_val[0], s1->motion_val[0], y_fragment_count * sizeof(*s->motion_val[0]));

            memcpy(s->motion_val[1], s1->motion_val[1], c_fragment_count * sizeof(*s->motion_val[1]));

        }



        // copy previous frame data

        copy_fields(s, s1, golden_frame, dsp);



        // copy qscale data if necessary

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

            if (s->qps[i] != s1->qps[1]) {

                qps_changed = 1;

                memcpy(&s->qmat[i], &s1->qmat[i], sizeof(s->qmat[i]));

            }

        }



        if (s->qps[0] != s1->qps[0])

            memcpy(&s->bounding_values_array, &s1->bounding_values_array, sizeof(s->bounding_values_array));



        if (qps_changed)

            copy_fields(s, s1, qps, superblock_count);

#undef copy_fields

    }



    update_frames(dst);



    return 0;

}

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

{

    Vp3DecodeContext *s = dst->priv_data, *s1 = src->priv_data;

    int qps_changed = 0, i, err;



#define copy_fields(to, from, start_field, end_field) memcpy(&to->start_field, &from->start_field, (char*)&to->end_field - (char*)&to->start_field)



    if (!s1->current_frame.data[0]

        ||s->width != s1->width

        ||s->height!= s1->height) {

        if (s != s1)

            copy_fields(s, s1, golden_frame, current_frame);

        return -1;

    }



    if (s != s1) {

        

        if (!s->current_frame.data[0]) {

            int y_fragment_count, c_fragment_count;

            s->avctx = dst;

            err = allocate_tables(dst);

            if (err)

                return err;

            y_fragment_count = s->fragment_width[0] * s->fragment_height[0];

            c_fragment_count = s->fragment_width[1] * s->fragment_height[1];

            memcpy(s->motion_val[0], s1->motion_val[0], y_fragment_count * sizeof(*s->motion_val[0]));

            memcpy(s->motion_val[1], s1->motion_val[1], c_fragment_count * sizeof(*s->motion_val[1]));

        }



        

        copy_fields(s, s1, golden_frame, dsp);



        

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

            if (s->qps[i] != s1->qps[1]) {

                qps_changed = 1;

                memcpy(&s->qmat[i], &s1->qmat[i], sizeof(s->qmat[i]));

            }

        }



        if (s->qps[0] != s1->qps[0])

            memcpy(&s->bounding_values_array, &s1->bounding_values_array, sizeof(s->bounding_values_array));



        if (qps_changed)

            copy_fields(s, s1, qps, superblock_count);

#undef copy_fields

    }



    update_frames(dst);



    return 0;

}

            copy_fields(s, s1, golden_frame, current_frame);
static int FUNC_0(AVCodecContext *VAR_0, const AVCodecContext *VAR_1)

{

    Vp3DecodeContext *s = VAR_0->priv_data, *s1 = VAR_1->priv_data;

    int VAR_2 = 0, VAR_3, VAR_4;



#define copy_fields(to, from, start_field, end_field) memcpy(&to->start_field, &from->start_field, (char*)&to->end_field - (char*)&to->start_field)



    if (!s1->current_frame.data[0]

        ||s->width != s1->width

        ||s->height!= s1->height) {

        if (s != s1)

            copy_fields(s, s1, golden_frame, current_frame);

        return -1;

    }



    if (s != s1) {

        

        if (!s->current_frame.data[0]) {

            int VAR_5, VAR_6;

            s->avctx = VAR_0;

            VAR_4 = allocate_tables(VAR_0);

            if (VAR_4)

                return VAR_4;

            VAR_5 = s->fragment_width[0] * s->fragment_height[0];

            VAR_6 = s->fragment_width[1] * s->fragment_height[1];

            memcpy(s->motion_val[0], s1->motion_val[0], VAR_5 * sizeof(*s->motion_val[0]));

            memcpy(s->motion_val[1], s1->motion_val[1], VAR_6 * sizeof(*s->motion_val[1]));

        }



        

        copy_fields(s, s1, golden_frame, dsp);



        

        for (VAR_3 = 0; VAR_3 < 3; VAR_3++) {

            if (s->qps[VAR_3] != s1->qps[1]) {

                VAR_2 = 1;

                memcpy(&s->qmat[VAR_3], &s1->qmat[VAR_3], sizeof(s->qmat[VAR_3]));

            }

        }



        if (s->qps[0] != s1->qps[0])

            memcpy(&s->bounding_values_array, &s1->bounding_values_array, sizeof(s->bounding_values_array));



        if (VAR_2)

            copy_fields(s, s1, qps, superblock_count);

#undef copy_fields

    }



    update_frames(VAR_0);



    return 0;

}

static int FUNC_0(AVCodecContext *VAR_0, const AVCodecContext *VAR_1)
{ Vp3DecodeContext *s = VAR_0->priv_data, *s1 = VAR_1->priv_data; int VAR_2 = 0, VAR_3, VAR_4; #define copy_fields(to, from, start_field, end_field) memcpy(&to->start_field, &from->start_field, (char*)&to->end_field - (char*)&to->start_field)
if (!s1->current_frame.data[0]
||s->width != s1->width
||s->height!= s1->height) { if (s != s1)
copy_fields(s, s1, golden_frame, current_frame); return -1; } if (s != s1) { if (!s->current_frame.data[0]) { int VAR_5, VAR_6; s->avctx = VAR_0; VAR_4 = allocate_tables(VAR_0); if (VAR_4)
return VAR_4; VAR_5 = s->fragment_width[0] * s->fragment_height[0]; VAR_6 = s->fragment_width[1] * s->fragment_height[1]; memcpy(s->motion_val[0], s1->motion_val[0], VAR_5 * sizeof(*s->motion_val[0])); memcpy(s->motion_val[1], s1->motion_val[1], VAR_6 * sizeof(*s->motion_val[1])); } copy_fields(s, s1, golden_frame, dsp); for (VAR_3 = 0; VAR_3 < 3; VAR_3++) { if (s->qps[VAR_3] != s1->qps[1]) { VAR_2 = 1; memcpy(&s->qmat[VAR_3], &s1->qmat[VAR_3], sizeof(s->qmat[VAR_3])); } } if (s->qps[0] != s1->qps[0])
memcpy(&s->bounding_values_array, &s1->bounding_values_array, sizeof(s->bounding_values_array)); if (VAR_2)
copy_fields(s, s1, qps, superblock_count); #undef copy_fields
} update_frames(VAR_0); return 0; }