int ff_qsv_decode_init(AVCodecContext *avctx, QSVContext *q, mfxSession session)

{

    mfxVideoParam param = { { 0 } };

    int ret;



    q->async_fifo = av_fifo_alloc((1 + q->async_depth) *

                                  (sizeof(mfxSyncPoint) + sizeof(QSVFrame*)));

    if (!q->async_fifo)

        return AVERROR(ENOMEM);



    ret = qsv_init_session(avctx, q, session);

    if (ret < 0) {

        av_log(avctx, AV_LOG_ERROR, "Error initializing an MFX session\n");

        return ret;

    }





    ret = ff_qsv_codec_id_to_mfx(avctx->codec_id);

    if (ret < 0)

        return ret;



    param.mfx.CodecId      = ret;

    param.mfx.CodecProfile = avctx->profile;

    param.mfx.CodecLevel   = avctx->level;



    param.mfx.FrameInfo.BitDepthLuma   = 8;

    param.mfx.FrameInfo.BitDepthChroma = 8;

    param.mfx.FrameInfo.Shift          = 0;

    param.mfx.FrameInfo.FourCC         = MFX_FOURCC_NV12;

    param.mfx.FrameInfo.Width          = avctx->coded_width;

    param.mfx.FrameInfo.Height         = avctx->coded_height;

    param.mfx.FrameInfo.ChromaFormat   = MFX_CHROMAFORMAT_YUV420;



    param.IOPattern   = q->iopattern;

    param.AsyncDepth  = q->async_depth;

    param.ExtParam    = q->ext_buffers;

    param.NumExtParam = q->nb_ext_buffers;



    ret = MFXVideoDECODE_Init(q->session, &param);

    if (ret < 0) {

        av_log(avctx, AV_LOG_ERROR, "Error initializing the MFX video decoder\n");

        return ff_qsv_error(ret);

    }



    return 0;

}

int ff_qsv_decode_init(AVCodecContext *avctx, QSVContext *q, mfxSession session)

{

    mfxVideoParam param = { { 0 } };

    int ret;



    q->async_fifo = av_fifo_alloc((1 + q->async_depth) *

                                  (sizeof(mfxSyncPoint) + sizeof(QSVFrame*)));

    if (!q->async_fifo)

        return AVERROR(ENOMEM);



    ret = qsv_init_session(avctx, q, session);

    if (ret < 0) {

        av_log(avctx, AV_LOG_ERROR, "Error initializing an MFX session\n");

        return ret;

    }





    ret = ff_qsv_codec_id_to_mfx(avctx->codec_id);

    if (ret < 0)

        return ret;



    param.mfx.CodecId      = ret;

    param.mfx.CodecProfile = avctx->profile;

    param.mfx.CodecLevel   = avctx->level;



    param.mfx.FrameInfo.BitDepthLuma   = 8;

    param.mfx.FrameInfo.BitDepthChroma = 8;

    param.mfx.FrameInfo.Shift          = 0;

    param.mfx.FrameInfo.FourCC         = MFX_FOURCC_NV12;

    param.mfx.FrameInfo.Width          = avctx->coded_width;

    param.mfx.FrameInfo.Height         = avctx->coded_height;

    param.mfx.FrameInfo.ChromaFormat   = MFX_CHROMAFORMAT_YUV420;



    param.IOPattern   = q->iopattern;

    param.AsyncDepth  = q->async_depth;

    param.ExtParam    = q->ext_buffers;

    param.NumExtParam = q->nb_ext_buffers;



    ret = MFXVideoDECODE_Init(q->session, &param);

    if (ret < 0) {

        av_log(avctx, AV_LOG_ERROR, "Error initializing the MFX video decoder\n");

        return ff_qsv_error(ret);

    }



    return 0;

}

    q->async_fifo = av_fifo_alloc((1 + q->async_depth) *                                   (sizeof(mfxSyncPoint) + sizeof(QSVFrame*)));     if (!q->async_fifo)         return AVERROR(ENOMEM);
int FUNC_0(AVCodecContext *VAR_0, QSVContext *VAR_1, mfxSession VAR_2)

{

    mfxVideoParam param = { { 0 } };

    int VAR_3;



    VAR_1->async_fifo = av_fifo_alloc((1 + VAR_1->async_depth) *

                                  (sizeof(mfxSyncPoint) + sizeof(QSVFrame*)));

    if (!VAR_1->async_fifo)

        return AVERROR(ENOMEM);



    VAR_3 = qsv_init_session(VAR_0, VAR_1, VAR_2);

    if (VAR_3 < 0) {

        av_log(VAR_0, AV_LOG_ERROR, "Error initializing an MFX VAR_2\n");

        return VAR_3;

    }





    VAR_3 = ff_qsv_codec_id_to_mfx(VAR_0->codec_id);

    if (VAR_3 < 0)

        return VAR_3;



    param.mfx.CodecId      = VAR_3;

    param.mfx.CodecProfile = VAR_0->profile;

    param.mfx.CodecLevel   = VAR_0->level;



    param.mfx.FrameInfo.BitDepthLuma   = 8;

    param.mfx.FrameInfo.BitDepthChroma = 8;

    param.mfx.FrameInfo.Shift          = 0;

    param.mfx.FrameInfo.FourCC         = MFX_FOURCC_NV12;

    param.mfx.FrameInfo.Width          = VAR_0->coded_width;

    param.mfx.FrameInfo.Height         = VAR_0->coded_height;

    param.mfx.FrameInfo.ChromaFormat   = MFX_CHROMAFORMAT_YUV420;



    param.IOPattern   = VAR_1->iopattern;

    param.AsyncDepth  = VAR_1->async_depth;

    param.ExtParam    = VAR_1->ext_buffers;

    param.NumExtParam = VAR_1->nb_ext_buffers;



    VAR_3 = MFXVideoDECODE_Init(VAR_1->VAR_2, &param);

    if (VAR_3 < 0) {

        av_log(VAR_0, AV_LOG_ERROR, "Error initializing the MFX video decoder\n");

        return ff_qsv_error(VAR_3);

    }



    return 0;

}

int FUNC_0(AVCodecContext *VAR_0, QSVContext *VAR_1, mfxSession VAR_2)
{ mfxVideoParam param = { { 0 } }; int VAR_3; VAR_1->async_fifo = av_fifo_alloc((1 + VAR_1->async_depth) *
(sizeof(mfxSyncPoint) + sizeof(QSVFrame*))); if (!VAR_1->async_fifo)
return AVERROR(ENOMEM); VAR_3 = qsv_init_session(VAR_0, VAR_1, VAR_2); if (VAR_3 < 0) { av_log(VAR_0, AV_LOG_ERROR, "Error initializing an MFX VAR_2\n"); return VAR_3; } VAR_3 = ff_qsv_codec_id_to_mfx(VAR_0->codec_id); if (VAR_3 < 0)
return VAR_3; param.mfx.CodecId      = VAR_3; param.mfx.CodecProfile = VAR_0->profile; param.mfx.CodecLevel   = VAR_0->level; param.mfx.FrameInfo.BitDepthLuma   = 8; param.mfx.FrameInfo.BitDepthChroma = 8; param.mfx.FrameInfo.Shift          = 0; param.mfx.FrameInfo.FourCC         = MFX_FOURCC_NV12; param.mfx.FrameInfo.Width          = VAR_0->coded_width; param.mfx.FrameInfo.Height         = VAR_0->coded_height; param.mfx.FrameInfo.ChromaFormat   = MFX_CHROMAFORMAT_YUV420; param.IOPattern   = VAR_1->iopattern; param.AsyncDepth  = VAR_1->async_depth; param.ExtParam    = VAR_1->ext_buffers; param.NumExtParam = VAR_1->nb_ext_buffers; VAR_3 = MFXVideoDECODE_Init(VAR_1->VAR_2, &param); if (VAR_3 < 0) { av_log(VAR_0, AV_LOG_ERROR, "Error initializing the MFX video decoder\n"); return ff_qsv_error(VAR_3); } return 0; }