int ff_mpeg_ref_picture(MpegEncContext *s, Picture *dst, Picture *src)

{

    int ret;



    av_assert0(!dst->f.buf[0]);

    av_assert0(src->f.buf[0]);



    src->tf.f = &src->f;

    dst->tf.f = &dst->f;

    ret = ff_thread_ref_frame(&dst->tf, &src->tf);

    if (ret < 0)

        goto fail;



    ret = update_picture_tables(dst, src);

    if (ret < 0)

        goto fail;



    if (src->hwaccel_picture_private) {

        dst->hwaccel_priv_buf = av_buffer_ref(src->hwaccel_priv_buf);

        if (!dst->hwaccel_priv_buf)

            goto fail;

        dst->hwaccel_picture_private = dst->hwaccel_priv_buf->data;

    }



    dst->field_picture           = src->field_picture;

    dst->mb_var_sum              = src->mb_var_sum;

    dst->mc_mb_var_sum           = src->mc_mb_var_sum;

    dst->b_frame_score           = src->b_frame_score;

    dst->needs_realloc           = src->needs_realloc;

    dst->reference               = src->reference;

    dst->shared                  = src->shared;



    return 0;

fail:

    ff_mpeg_unref_picture(s, dst);

    return ret;

}

int ff_mpeg_ref_picture(MpegEncContext *s, Picture *dst, Picture *src)

{

    int ret;



    av_assert0(!dst->f.buf[0]);

    av_assert0(src->f.buf[0]);



    src->tf.f = &src->f;

    dst->tf.f = &dst->f;

    ret = ff_thread_ref_frame(&dst->tf, &src->tf);

    if (ret < 0)

        goto fail;



    ret = update_picture_tables(dst, src);

    if (ret < 0)

        goto fail;



    if (src->hwaccel_picture_private) {

        dst->hwaccel_priv_buf = av_buffer_ref(src->hwaccel_priv_buf);

        if (!dst->hwaccel_priv_buf)

            goto fail;

        dst->hwaccel_picture_private = dst->hwaccel_priv_buf->data;

    }



    dst->field_picture           = src->field_picture;

    dst->mb_var_sum              = src->mb_var_sum;

    dst->mc_mb_var_sum           = src->mc_mb_var_sum;

    dst->b_frame_score           = src->b_frame_score;

    dst->needs_realloc           = src->needs_realloc;

    dst->reference               = src->reference;

    dst->shared                  = src->shared;



    return 0;

fail:

    ff_mpeg_unref_picture(s, dst);

    return ret;

}

    av_assert0(!dst->f.buf[0]);     av_assert0(src->f.buf[0]);     src->tf.f = &src->f;     dst->tf.f = &dst->f;
int FUNC_0(MpegEncContext *VAR_0, Picture *VAR_1, Picture *VAR_2)

{

    int VAR_3;



    av_assert0(!VAR_1->f.buf[0]);

    av_assert0(VAR_2->f.buf[0]);



    VAR_2->tf.f = &VAR_2->f;

    VAR_1->tf.f = &VAR_1->f;

    VAR_3 = ff_thread_ref_frame(&VAR_1->tf, &VAR_2->tf);

    if (VAR_3 < 0)

        goto fail;



    VAR_3 = update_picture_tables(VAR_1, VAR_2);

    if (VAR_3 < 0)

        goto fail;



    if (VAR_2->hwaccel_picture_private) {

        VAR_1->hwaccel_priv_buf = av_buffer_ref(VAR_2->hwaccel_priv_buf);

        if (!VAR_1->hwaccel_priv_buf)

            goto fail;

        VAR_1->hwaccel_picture_private = VAR_1->hwaccel_priv_buf->data;

    }



    VAR_1->field_picture           = VAR_2->field_picture;

    VAR_1->mb_var_sum              = VAR_2->mb_var_sum;

    VAR_1->mc_mb_var_sum           = VAR_2->mc_mb_var_sum;

    VAR_1->b_frame_score           = VAR_2->b_frame_score;

    VAR_1->needs_realloc           = VAR_2->needs_realloc;

    VAR_1->reference               = VAR_2->reference;

    VAR_1->shared                  = VAR_2->shared;



    return 0;

fail:

    ff_mpeg_unref_picture(VAR_0, VAR_1);

    return VAR_3;

}

int FUNC_0(MpegEncContext *VAR_0, Picture *VAR_1, Picture *VAR_2)
{ int VAR_3; av_assert0(!VAR_1->f.buf[0]); av_assert0(VAR_2->f.buf[0]); VAR_2->tf.f = &VAR_2->f; VAR_1->tf.f = &VAR_1->f; VAR_3 = ff_thread_ref_frame(&VAR_1->tf, &VAR_2->tf); if (VAR_3 < 0)
goto fail; VAR_3 = update_picture_tables(VAR_1, VAR_2); if (VAR_3 < 0)
goto fail; if (VAR_2->hwaccel_picture_private) { VAR_1->hwaccel_priv_buf = av_buffer_ref(VAR_2->hwaccel_priv_buf); if (!VAR_1->hwaccel_priv_buf)
goto fail; VAR_1->hwaccel_picture_private = VAR_1->hwaccel_priv_buf->data; } VAR_1->field_picture           = VAR_2->field_picture; VAR_1->mb_var_sum              = VAR_2->mb_var_sum; VAR_1->mc_mb_var_sum           = VAR_2->mc_mb_var_sum; VAR_1->b_frame_score           = VAR_2->b_frame_score; VAR_1->needs_realloc           = VAR_2->needs_realloc; VAR_1->reference               = VAR_2->reference; VAR_1->shared                  = VAR_2->shared; return 0; fail:
ff_mpeg_unref_picture(VAR_0, VAR_1); return VAR_3; }