int ff_vaapi_render_picture(FFVAContext *vactx, VASurfaceID surface)

{

    VABufferID va_buffers[3];

    unsigned int n_va_buffers = 0;



    if (!vactx->pic_param_buf_id)

        return 0;



    vaUnmapBuffer(vactx->display, vactx->pic_param_buf_id);

    va_buffers[n_va_buffers++] = vactx->pic_param_buf_id;



    if (vactx->iq_matrix_buf_id) {

        vaUnmapBuffer(vactx->display, vactx->iq_matrix_buf_id);

        va_buffers[n_va_buffers++] = vactx->iq_matrix_buf_id;

    }



    if (vactx->bitplane_buf_id) {

        vaUnmapBuffer(vactx->display, vactx->bitplane_buf_id);

        va_buffers[n_va_buffers++] = vactx->bitplane_buf_id;

    }



    if (vaBeginPicture(vactx->display, vactx->context_id,

                       surface) != VA_STATUS_SUCCESS)

        return -1;



    if (vaRenderPicture(vactx->display, vactx->context_id,

                        va_buffers, n_va_buffers) != VA_STATUS_SUCCESS)

        return -1;



    if (vaRenderPicture(vactx->display, vactx->context_id,

                        vactx->slice_buf_ids,

                        vactx->n_slice_buf_ids) != VA_STATUS_SUCCESS)

        return -1;



    if (vaEndPicture(vactx->display, vactx->context_id) != VA_STATUS_SUCCESS)

        return -1;



    return 0;

}

int ff_vaapi_render_picture(FFVAContext *vactx, VASurfaceID surface)

{

    VABufferID va_buffers[3];

    unsigned int n_va_buffers = 0;



    if (!vactx->pic_param_buf_id)

        return 0;



    vaUnmapBuffer(vactx->display, vactx->pic_param_buf_id);

    va_buffers[n_va_buffers++] = vactx->pic_param_buf_id;



    if (vactx->iq_matrix_buf_id) {

        vaUnmapBuffer(vactx->display, vactx->iq_matrix_buf_id);

        va_buffers[n_va_buffers++] = vactx->iq_matrix_buf_id;

    }



    if (vactx->bitplane_buf_id) {

        vaUnmapBuffer(vactx->display, vactx->bitplane_buf_id);

        va_buffers[n_va_buffers++] = vactx->bitplane_buf_id;

    }



    if (vaBeginPicture(vactx->display, vactx->context_id,

                       surface) != VA_STATUS_SUCCESS)

        return -1;



    if (vaRenderPicture(vactx->display, vactx->context_id,

                        va_buffers, n_va_buffers) != VA_STATUS_SUCCESS)

        return -1;



    if (vaRenderPicture(vactx->display, vactx->context_id,

                        vactx->slice_buf_ids,

                        vactx->n_slice_buf_ids) != VA_STATUS_SUCCESS)

        return -1;



    if (vaEndPicture(vactx->display, vactx->context_id) != VA_STATUS_SUCCESS)

        return -1;



    return 0;

}

int FUNC_0(FFVAContext *VAR_0, VASurfaceID VAR_1)

{

    VABufferID va_buffers[3];

    unsigned int VAR_2 = 0;



    if (!VAR_0->pic_param_buf_id)

        return 0;



    vaUnmapBuffer(VAR_0->display, VAR_0->pic_param_buf_id);

    va_buffers[VAR_2++] = VAR_0->pic_param_buf_id;



    if (VAR_0->iq_matrix_buf_id) {

        vaUnmapBuffer(VAR_0->display, VAR_0->iq_matrix_buf_id);

        va_buffers[VAR_2++] = VAR_0->iq_matrix_buf_id;

    }



    if (VAR_0->bitplane_buf_id) {

        vaUnmapBuffer(VAR_0->display, VAR_0->bitplane_buf_id);

        va_buffers[VAR_2++] = VAR_0->bitplane_buf_id;

    }



    if (vaBeginPicture(VAR_0->display, VAR_0->context_id,

                       VAR_1) != VA_STATUS_SUCCESS)

        return -1;



    if (vaRenderPicture(VAR_0->display, VAR_0->context_id,

                        va_buffers, VAR_2) != VA_STATUS_SUCCESS)

        return -1;



    if (vaRenderPicture(VAR_0->display, VAR_0->context_id,

                        VAR_0->slice_buf_ids,

                        VAR_0->n_slice_buf_ids) != VA_STATUS_SUCCESS)

        return -1;



    if (vaEndPicture(VAR_0->display, VAR_0->context_id) != VA_STATUS_SUCCESS)

        return -1;



    return 0;

}

int FUNC_0(FFVAContext *VAR_0, VASurfaceID VAR_1)
{ VABufferID va_buffers[3]; unsigned int VAR_2 = 0; if (!VAR_0->pic_param_buf_id)
return 0; vaUnmapBuffer(VAR_0->display, VAR_0->pic_param_buf_id); va_buffers[VAR_2++] = VAR_0->pic_param_buf_id; if (VAR_0->iq_matrix_buf_id) { vaUnmapBuffer(VAR_0->display, VAR_0->iq_matrix_buf_id); va_buffers[VAR_2++] = VAR_0->iq_matrix_buf_id; } if (VAR_0->bitplane_buf_id) { vaUnmapBuffer(VAR_0->display, VAR_0->bitplane_buf_id); va_buffers[VAR_2++] = VAR_0->bitplane_buf_id; } if (vaBeginPicture(VAR_0->display, VAR_0->context_id,
VAR_1) != VA_STATUS_SUCCESS)
return -1; if (vaRenderPicture(VAR_0->display, VAR_0->context_id,
va_buffers, VAR_2) != VA_STATUS_SUCCESS)
return -1; if (vaRenderPicture(VAR_0->display, VAR_0->context_id,
VAR_0->slice_buf_ids,
VAR_0->n_slice_buf_ids) != VA_STATUS_SUCCESS)
return -1; if (vaEndPicture(VAR_0->display, VAR_0->context_id) != VA_STATUS_SUCCESS)
return -1; return 0; }