static int alloc_frame_buffer(MpegEncContext *s, Picture *pic)

{

    int r;



    if (s->avctx->hwaccel) {

        assert(!pic->f.hwaccel_picture_private);

        if (s->avctx->hwaccel->priv_data_size) {

            pic->f.hwaccel_picture_private = av_mallocz(s->avctx->hwaccel->priv_data_size);

            if (!pic->f.hwaccel_picture_private) {

                av_log(s->avctx, AV_LOG_ERROR, "alloc_frame_buffer() failed (hwaccel private data allocation)\n");

                return -1;

            }

        }

    }



    if (s->codec_id != AV_CODEC_ID_WMV3IMAGE &&

        s->codec_id != AV_CODEC_ID_VC1IMAGE  &&

        s->codec_id != AV_CODEC_ID_MSS2)

        r = ff_thread_get_buffer(s->avctx, &pic->f);

    else

        r = avcodec_default_get_buffer(s->avctx, &pic->f);



    if (r < 0 || !pic->f.type || !pic->f.data[0]) {

        av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (%d %d %p)\n",

               r, pic->f.type, pic->f.data[0]);

        av_freep(&pic->f.hwaccel_picture_private);

        return -1;

    }



    if (s->linesize && (s->linesize   != pic->f.linesize[0] ||

                        s->uvlinesize != pic->f.linesize[1])) {

        av_log(s->avctx, AV_LOG_ERROR,

               "get_buffer() failed (stride changed)\n");

        free_frame_buffer(s, pic);

        return -1;

    }



    if (pic->f.linesize[1] != pic->f.linesize[2]) {

        av_log(s->avctx, AV_LOG_ERROR,

               "get_buffer() failed (uv stride mismatch)\n");

        free_frame_buffer(s, pic);

        return -1;

    }



    return 0;

}

static int alloc_frame_buffer(MpegEncContext *s, Picture *pic)

{

    int r;



    if (s->avctx->hwaccel) {

        assert(!pic->f.hwaccel_picture_private);

        if (s->avctx->hwaccel->priv_data_size) {

            pic->f.hwaccel_picture_private = av_mallocz(s->avctx->hwaccel->priv_data_size);

            if (!pic->f.hwaccel_picture_private) {

                av_log(s->avctx, AV_LOG_ERROR, "alloc_frame_buffer() failed (hwaccel private data allocation)\n");

                return -1;

            }

        }

    }



    if (s->codec_id != AV_CODEC_ID_WMV3IMAGE &&

        s->codec_id != AV_CODEC_ID_VC1IMAGE  &&

        s->codec_id != AV_CODEC_ID_MSS2)

        r = ff_thread_get_buffer(s->avctx, &pic->f);

    else

        r = avcodec_default_get_buffer(s->avctx, &pic->f);



    if (r < 0 || !pic->f.type || !pic->f.data[0]) {

        av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (%d %d %p)\n",

               r, pic->f.type, pic->f.data[0]);

        av_freep(&pic->f.hwaccel_picture_private);

        return -1;

    }



    if (s->linesize && (s->linesize   != pic->f.linesize[0] ||

                        s->uvlinesize != pic->f.linesize[1])) {

        av_log(s->avctx, AV_LOG_ERROR,

               "get_buffer() failed (stride changed)\n");

        free_frame_buffer(s, pic);

        return -1;

    }



    if (pic->f.linesize[1] != pic->f.linesize[2]) {

        av_log(s->avctx, AV_LOG_ERROR,

               "get_buffer() failed (uv stride mismatch)\n");

        free_frame_buffer(s, pic);

        return -1;

    }



    return 0;

}

    int r;
static int FUNC_0(MpegEncContext *VAR_0, Picture *VAR_1)

{

    int VAR_2;



    if (VAR_0->avctx->hwaccel) {

        assert(!VAR_1->f.hwaccel_picture_private);

        if (VAR_0->avctx->hwaccel->priv_data_size) {

            VAR_1->f.hwaccel_picture_private = av_mallocz(VAR_0->avctx->hwaccel->priv_data_size);

            if (!VAR_1->f.hwaccel_picture_private) {

                av_log(VAR_0->avctx, AV_LOG_ERROR, "FUNC_0() failed (hwaccel private data allocation)\n");

                return -1;

            }

        }

    }



    if (VAR_0->codec_id != AV_CODEC_ID_WMV3IMAGE &&

        VAR_0->codec_id != AV_CODEC_ID_VC1IMAGE  &&

        VAR_0->codec_id != AV_CODEC_ID_MSS2)

        VAR_2 = ff_thread_get_buffer(VAR_0->avctx, &VAR_1->f);

    else

        VAR_2 = avcodec_default_get_buffer(VAR_0->avctx, &VAR_1->f);



    if (VAR_2 < 0 || !VAR_1->f.type || !VAR_1->f.data[0]) {

        av_log(VAR_0->avctx, AV_LOG_ERROR, "get_buffer() failed (%d %d %p)\n",

               VAR_2, VAR_1->f.type, VAR_1->f.data[0]);

        av_freep(&VAR_1->f.hwaccel_picture_private);

        return -1;

    }



    if (VAR_0->linesize && (VAR_0->linesize   != VAR_1->f.linesize[0] ||

                        VAR_0->uvlinesize != VAR_1->f.linesize[1])) {

        av_log(VAR_0->avctx, AV_LOG_ERROR,

               "get_buffer() failed (stride changed)\n");

        free_frame_buffer(VAR_0, VAR_1);

        return -1;

    }



    if (VAR_1->f.linesize[1] != VAR_1->f.linesize[2]) {

        av_log(VAR_0->avctx, AV_LOG_ERROR,

               "get_buffer() failed (uv stride mismatch)\n");

        free_frame_buffer(VAR_0, VAR_1);

        return -1;

    }



    return 0;

}

static int FUNC_0(MpegEncContext *VAR_0, Picture *VAR_1)
{ int VAR_2; if (VAR_0->avctx->hwaccel) { assert(!VAR_1->f.hwaccel_picture_private); if (VAR_0->avctx->hwaccel->priv_data_size) { VAR_1->f.hwaccel_picture_private = av_mallocz(VAR_0->avctx->hwaccel->priv_data_size); if (!VAR_1->f.hwaccel_picture_private) { av_log(VAR_0->avctx, AV_LOG_ERROR, "FUNC_0() failed (hwaccel private data allocation)\n"); return -1; } } } if (VAR_0->codec_id != AV_CODEC_ID_WMV3IMAGE &&
VAR_0->codec_id != AV_CODEC_ID_VC1IMAGE  &&
VAR_0->codec_id != AV_CODEC_ID_MSS2)
VAR_2 = ff_thread_get_buffer(VAR_0->avctx, &VAR_1->f); else
VAR_2 = avcodec_default_get_buffer(VAR_0->avctx, &VAR_1->f); if (VAR_2 < 0 || !VAR_1->f.type || !VAR_1->f.data[0]) { av_log(VAR_0->avctx, AV_LOG_ERROR, "get_buffer() failed (%d %d %p)\n",
VAR_2, VAR_1->f.type, VAR_1->f.data[0]); av_freep(&VAR_1->f.hwaccel_picture_private); return -1; } if (VAR_0->linesize && (VAR_0->linesize   != VAR_1->f.linesize[0] ||
VAR_0->uvlinesize != VAR_1->f.linesize[1])) { av_log(VAR_0->avctx, AV_LOG_ERROR,
"get_buffer() failed (stride changed)\n"); free_frame_buffer(VAR_0, VAR_1); return -1; } if (VAR_1->f.linesize[1] != VAR_1->f.linesize[2]) { av_log(VAR_0->avctx, AV_LOG_ERROR,
"get_buffer() failed (uv stride mismatch)\n"); free_frame_buffer(VAR_0, VAR_1); return -1; } return 0; }