23#include "config_components.h"
33#define MAX_SLICES 1024
34#define INVALID_REF 0xffff
37 DXVA_PictureParameters
pp;
101 D3D12_VIDEO_DECODE_FRAME_ARGUMENT *args = &input_args->FrameArguments[input_args->NumFrameArguments++];
103 const unsigned mb_count =
s->mb_width * (
s->mb_height >> v->
field_mode);
104 uint8_t *mapped_data, *mapped_ptr;
105 UINT bitstream_size =
ctx->bitstream_size;
107 static const uint8_t
start_code[] = { 0, 0, 1, 0x0d };
109 if (FAILED(ID3D12Resource_Map(
buffer, 0,
NULL, (
void **)&mapped_data))) {
114 mapped_ptr = mapped_data;
116 DXVA_SliceInfo *slice = &ctx_pic->
slices[
i];
117 unsigned position = slice->dwSliceDataLocation;
118 unsigned size = slice->dwSliceBitsInBuffer / 8;
126 slice->dwSliceDataLocation = mapped_ptr - mapped_data;
128 slice->wNumberMBsInSlice = slice[1].wNumberMBsInSlice - slice[0].wNumberMBsInSlice;
130 slice->wNumberMBsInSlice = mb_count - slice[0].wNumberMBsInSlice;
135 mapped_ptr[3] = 0x0c;
137 mapped_ptr[3] = 0x0b;
141 slice->dwSliceBitsInBuffer +=
sizeof(
start_code) * 8;
146 bitstream_size -=
size;
151 args->Type = D3D12_VIDEO_DECODE_ARGUMENT_TYPE_SLICE_CONTROL;
152 args->Size =
sizeof(DXVA_SliceInfo) * ctx_pic->
slice_count;
153 args->pData = ctx_pic->
slices;
155 input_args->CompressedBitstream = (D3D12_VIDEO_DECODE_COMPRESSED_BITSTREAM){
158 .Size = mapped_ptr - mapped_data,
173 &ctx_pic->
pp,
sizeof(ctx_pic->
pp),
182 ctx->cfg.DecodeProfile = D3D12_VIDEO_DECODE_PROFILE_VC1_D2010;
184 ctx->max_num_ref = 3;
188 ctx->cfg.DecodeProfile = D3D12_VIDEO_DECODE_PROFILE_VC1;
195#if CONFIG_WMV3_D3D12VA_HWACCEL
197 .p.name =
"wmv3_d3d12va",
212#if CONFIG_VC1_D3D12VA_HWACCEL
214 .p.name =
"vc1_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
av_cold int ff_d3d12va_decode_uninit(AVCodecContext *avctx)
uninit D3D12VADecodeContext
int ff_d3d12va_common_end_frame(AVCodecContext *avctx, AVFrame *frame, const void *pp, unsigned pp_size, const void *qm, unsigned qm_size, int(*update_input_arguments)(AVCodecContext *, D3D12_VIDEO_DECODE_INPUT_STREAM_ARGUMENTS *, ID3D12Resource *))
d3d12va common end frame
#define D3D12VA_DECODE_CONTEXT(avctx)
static int d3d12va_vc1_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 av_cold int d3d12va_vc1_decode_init(AVCodecContext *avctx)
static int d3d12va_vc1_end_frame(AVCodecContext *avctx)
static int d3d12va_vc1_start_frame(AVCodecContext *avctx, av_unused const AVBufferRef *buffer_ref, av_unused const uint8_t *buffer, av_unused uint32_t size)
void ff_dxva2_vc1_fill_picture_parameters(AVCodecContext *avctx, AVDXVAContext *ctx, DXVA_PictureParameters *pp)
void ff_dxva2_vc1_fill_slice(AVCodecContext *avctx, DXVA_SliceInfo *slice, unsigned position, unsigned size)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const struct FFHWAccel ff_vc1_d3d12va_hwaccel
const struct FFHWAccel ff_wmv3_d3d12va_hwaccel
mpegvideo decoder header.
@ AV_PIX_FMT_D3D12
Hardware surfaces for Direct3D 12.
A reference to a data buffer.
main external API structure.
const uint8_t * bitstream
DXVA_SliceInfo slices[MAX_SLICES]
DXVA_PictureParameters pp
This structure is used to provide the necessary configurations and data to the FFmpeg Direct3D 12 HWA...
void * hwaccel_picture_private
RefStruct reference for hardware accelerator private data.
MPVPicture * ptr
RefStruct reference.
MPVWorkPicture cur_pic
copy of the current picture structure.
int field_mode
1 for interlaced field pictures