23#include "config_components.h"
35 DXVA_PicParams_H264
pp;
44 unsigned position,
unsigned size)
46 memset(slice, 0,
sizeof(*slice));
47 slice->BSNALunitDataLocation = position;
48 slice->SliceBytesInBuffer =
size;
49 slice->wBadSliceChopping = 0;
99 ctx_pic->
pp.wBitFields &= ~(1 << 15);
104#define START_CODE 65536
105#define START_CODE_SIZE 3
113 uint8_t *mapped_data, *mapped_ptr;
114 DXVA_Slice_H264_Short *slice;
115 D3D12_VIDEO_DECODE_FRAME_ARGUMENT *args;
117 if (FAILED(ID3D12Resource_Map(
buffer, 0,
NULL, (
void **)&mapped_data))) {
122 mapped_ptr = mapped_data;
127 position = slice->BSNALunitDataLocation;
128 size = slice->SliceBytesInBuffer;
131 slice->BSNALunitDataLocation = mapped_ptr - mapped_data;
142 input_args->CompressedBitstream = (D3D12_VIDEO_DECODE_COMPRESSED_BITSTREAM){
145 .Size = mapped_ptr - mapped_data,
148 args = &input_args->FrameArguments[input_args->NumFrameArguments++];
149 args->Type = D3D12_VIDEO_DECODE_ARGUMENT_TYPE_SLICE_CONTROL;
150 args->Size =
sizeof(DXVA_Slice_H264_Short) * ctx_pic->
slice_count;
163 uint64_t bitstream_size;
172 &ctx_pic->
pp,
sizeof(ctx_pic->
pp),
173 &ctx_pic->
qm,
sizeof(ctx_pic->
qm),
185 DXVA_PicParams_H264 pp;
187 ctx->cfg.DecodeProfile = D3D12_VIDEO_DECODE_PROFILE_H264;
194#if CONFIG_H264_D3D12VA_HWACCEL
196 .p.name =
"h264_d3d12va",
static AVFormatContext * ctx
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
#define i(width, name, range_min, range_max)
static int update_input_arguments(AVCodecContext *avctx, D3D12_VIDEO_DECODE_INPUT_STREAM_ARGUMENTS *input_args, ID3D12Resource *buffer)
av_cold int ff_d3d12va_decode_init(AVCodecContext *avctx)
init D3D12VADecodeContext
int ff_d3d12va_common_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx)
d3d12va common frame params
int ff_d3d12va_common_end_frame(AVCodecContext *avctx, AVFrame *frame, const void *pp, unsigned pp_size, const void *qm, unsigned qm_size, UINT64 bitstream_size, int(*update_input_arguments)(AVCodecContext *, D3D12_VIDEO_DECODE_INPUT_STREAM_ARGUMENTS *, ID3D12Resource *))
d3d12va common end frame
av_cold int ff_d3d12va_decode_uninit(AVCodecContext *avctx)
uninit D3D12VADecodeContext
#define D3D12VA_DECODE_CONTEXT(avctx)
static int d3d12va_h264_end_frame(AVCodecContext *avctx)
static int d3d12va_h264_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
static int update_input_arguments(AVCodecContext *avctx, D3D12_VIDEO_DECODE_INPUT_STREAM_ARGUMENTS *input_args, ID3D12Resource *buffer)
static void fill_slice_short(DXVA_Slice_H264_Short *slice, unsigned position, unsigned size)
static int d3d12va_h264_start_frame(AVCodecContext *avctx, av_unused const AVBufferRef *buffer_ref, av_unused const uint8_t *buffer, av_unused uint32_t size)
static av_cold int d3d12va_h264_decode_init(AVCodecContext *avctx)
void ff_dxva2_h264_fill_scaling_lists(const AVCodecContext *avctx, AVDXVAContext *ctx, DXVA_Qmatrix_H264 *qm)
void ff_dxva2_h264_fill_picture_parameters(const AVCodecContext *avctx, AVDXVAContext *ctx, DXVA_PicParams_H264 *pp)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
@ AV_PICTURE_TYPE_I
Intra.
@ AV_PICTURE_TYPE_SI
Switching Intra.
H.264 parameter set handling.
H.264 / AVC / MPEG-4 part10 codec.
const struct FFHWAccel ff_h264_d3d12va_hwaccel
void ff_h264_draw_horiz_band(const H264Context *h, H264SliceContext *sl, int y, int height)
@ AV_PIX_FMT_D3D12
Hardware surfaces for Direct3D 12.
#define FF_ARRAY_ELEMS(a)
A reference to a data buffer.
main external API structure.
This structure is used to provide the necessary configurations and data to the FFmpeg Direct3D 12 HWA...
const uint8_t * bitstream
DXVA_Slice_H264_Short slice_short[MAX_SLICES]
void * hwaccel_picture_private
RefStruct reference for hardware accelerator private data.