static int dxva2_h264_decode_slice(AVCodecContext *avctx,

                                   const uint8_t *buffer,

                                   uint32_t size)

{

    const H264Context *h = avctx->priv_data;

    struct dxva_context *ctx = avctx->hwaccel_context;

    const Picture *current_picture = h->cur_pic_ptr;

    struct dxva2_picture_context *ctx_pic = current_picture->hwaccel_picture_private;

    unsigned position;



    if (ctx_pic->slice_count >= MAX_SLICES)

        return -1;



    if (!ctx_pic->bitstream)

        ctx_pic->bitstream = buffer;

    ctx_pic->bitstream_size += size;



    position = buffer - ctx_pic->bitstream;

    if (is_slice_short(ctx))

        fill_slice_short(&ctx_pic->slice_short[ctx_pic->slice_count],

                         position, size);

    else

        fill_slice_long(avctx, &ctx_pic->slice_long[ctx_pic->slice_count],

                        position, size);

    ctx_pic->slice_count++;



    if (h->slice_type != AV_PICTURE_TYPE_I && h->slice_type != AV_PICTURE_TYPE_SI)

        ctx_pic->pp.wBitFields &= ~(1 << 15); /* Set IntraPicFlag to 0 */

    return 0;

}

static int dxva2_h264_decode_slice(AVCodecContext *avctx,

                                   const uint8_t *buffer,

                                   uint32_t size)

{

    const H264Context *h = avctx->priv_data;

    struct dxva_context *ctx = avctx->hwaccel_context;

    const Picture *current_picture = h->cur_pic_ptr;

    struct dxva2_picture_context *ctx_pic = current_picture->hwaccel_picture_private;

    unsigned position;



    if (ctx_pic->slice_count >= MAX_SLICES)

        return -1;



    if (!ctx_pic->bitstream)

        ctx_pic->bitstream = buffer;

    ctx_pic->bitstream_size += size;



    position = buffer - ctx_pic->bitstream;

    if (is_slice_short(ctx))

        fill_slice_short(&ctx_pic->slice_short[ctx_pic->slice_count],

                         position, size);

    else

        fill_slice_long(avctx, &ctx_pic->slice_long[ctx_pic->slice_count],

                        position, size);

    ctx_pic->slice_count++;



    if (h->slice_type != AV_PICTURE_TYPE_I && h->slice_type != AV_PICTURE_TYPE_SI)

        ctx_pic->pp.wBitFields &= ~(1 << 15); 

    return 0;

}

static int FUNC_0(AVCodecContext *VAR_0,

                                   const uint8_t *VAR_1,

                                   uint32_t VAR_2)

{

    const H264Context *VAR_3 = VAR_0->priv_data;

    struct dxva_context *VAR_4 = VAR_0->hwaccel_context;

    const Picture *VAR_5 = VAR_3->cur_pic_ptr;

    struct dxva2_picture_context *VAR_6 = VAR_5->hwaccel_picture_private;

    unsigned VAR_7;



    if (VAR_6->slice_count >= MAX_SLICES)

        return -1;



    if (!VAR_6->bitstream)

        VAR_6->bitstream = VAR_1;

    VAR_6->bitstream_size += VAR_2;



    VAR_7 = VAR_1 - VAR_6->bitstream;

    if (is_slice_short(VAR_4))

        fill_slice_short(&VAR_6->slice_short[VAR_6->slice_count],

                         VAR_7, VAR_2);

    else

        fill_slice_long(VAR_0, &VAR_6->slice_long[VAR_6->slice_count],

                        VAR_7, VAR_2);

    VAR_6->slice_count++;



    if (VAR_3->slice_type != AV_PICTURE_TYPE_I && VAR_3->slice_type != AV_PICTURE_TYPE_SI)

        VAR_6->pp.wBitFields &= ~(1 << 15); 

    return 0;

}

static int FUNC_0(AVCodecContext *VAR_0,
const uint8_t *VAR_1,
uint32_t VAR_2)
{ const H264Context *VAR_3 = VAR_0->priv_data; struct dxva_context *VAR_4 = VAR_0->hwaccel_context; const Picture *VAR_5 = VAR_3->cur_pic_ptr; struct dxva2_picture_context *VAR_6 = VAR_5->hwaccel_picture_private; unsigned VAR_7; if (VAR_6->slice_count >= MAX_SLICES)
return -1; if (!VAR_6->bitstream)
VAR_6->bitstream = VAR_1; VAR_6->bitstream_size += VAR_2; VAR_7 = VAR_1 - VAR_6->bitstream; if (is_slice_short(VAR_4))
fill_slice_short(&VAR_6->slice_short[VAR_6->slice_count],
VAR_7, VAR_2); else
fill_slice_long(VAR_0, &VAR_6->slice_long[VAR_6->slice_count],
VAR_7, VAR_2); VAR_6->slice_count++; if (VAR_3->slice_type != AV_PICTURE_TYPE_I && VAR_3->slice_type != AV_PICTURE_TYPE_SI)
VAR_6->pp.wBitFields &= ~(1 << 15); return 0; }