38DEFINE_GUID(ff_DXVA2_ModeMPEG2_VLD, 0xee27417f, 0x5e28,0x4e65,0xbe,0xea,0x1d,0x26,0xb5,0x08,0xad,0xc9);
39DEFINE_GUID(ff_DXVA2_ModeMPEG2and1_VLD, 0x86695f12, 0x340e,0x4f04,0x9f,0xd3,0x92,0x53,0xdd,0x32,0x74,0x60);
40DEFINE_GUID(ff_DXVA2_ModeH264_E, 0x1b81be68, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
41DEFINE_GUID(ff_DXVA2_ModeH264_F, 0x1b81be69, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
42DEFINE_GUID(ff_DXVADDI_Intel_ModeH264_E, 0x604F8E68, 0x4951,0x4C54,0x88,0xFE,0xAB,0xD2,0x5C,0x15,0xB3,0xD6);
43DEFINE_GUID(ff_DXVA2_ModeVC1_D, 0x1b81beA3, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
44DEFINE_GUID(ff_DXVA2_ModeVC1_D2010, 0x1b81beA4, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
45DEFINE_GUID(ff_DXVA2_ModeHEVC_VLD_Main, 0x5b11d51b, 0x2f4c,0x4452,0xbc,0xc3,0x09,0xf2,0xa1,0x16,0x0c,0xc0);
46DEFINE_GUID(ff_DXVA2_ModeHEVC_VLD_Main10,0x107af0e0, 0xef1a,0x4d19,0xab,0xa8,0x67,0xa1,0x63,0x07,0x3d,0x13);
47DEFINE_GUID(ff_DXVA2_ModeVP9_VLD_Profile0,0x463707f8,0xa1d0,0x4585,0x87,0x6d,0x83,0xaa,0x6d,0x60,0xb8,0x9e);
48DEFINE_GUID(ff_DXVA2_ModeVP9_VLD_10bit_Profile2,0xa4c749ef,0x6ecf,0x48aa,0x84,0x48,0x50,0xa7,0xa1,0x16,0x5f,0xf7);
49DEFINE_GUID(ff_DXVA2_ModeAV1_VLD_Profile0,0xb8be4ccb,0xcf53,0x46ba,0x8d,0x59,0xd6,0xb8,0xa6,0xda,0x5d,0x2a);
50DEFINE_GUID(ff_DXVA2_ModeAV1_VLD_Profile1,0x6936ff0f,0x45b1,0x4163,0x9c,0xc1,0x64,0x6e,0xf6,0x94,0x61,0x08);
51DEFINE_GUID(ff_DXVA2_ModeAV1_VLD_Profile2,0x0c5f2aa1,0xe541,0x4089,0xbb,0x7b,0x98,0x11,0x0a,0x19,0xd7,0xc8);
52DEFINE_GUID(ff_DXVA2_ModeAV1_VLD_12bit_Profile2,0x17127009,0xa00f,0x4ce1,0x99,0x4e,0xbf,0x40,0x81,0xf6,0xf3,0xf0);
53DEFINE_GUID(ff_DXVA2_ModeAV1_VLD_12bit_Profile2_420,0x2d80bed6,0x9cac,0x4835,0x9e,0x91,0x32,0x7b,0xbc,0x4f,0x9e,0xe8);
54DEFINE_GUID(ff_DXVA2_NoEncrypt, 0x1b81beD0, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
55DEFINE_GUID(ff_GUID_NULL, 0x00000000, 0x0000,0x0000,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00);
56DEFINE_GUID(ff_IID_IDirectXVideoDecoderService, 0xfc51a551,0xd5e7,0x11d9,0xaf,0x55,0x00,0x05,0x4e,0x43,0xff,0x02);
124 const void *cfg_list,
128 unsigned i, best_score = 0;
131 for (
i = 0;
i < cfg_count;
i++) {
133 UINT ConfigBitstreamRaw = 0;
134 GUID guidConfigBitstreamEncryption;
138 D3D11_VIDEO_DECODER_CONFIG *
cfg = &((D3D11_VIDEO_DECODER_CONFIG *)cfg_list)[
i];
139 ConfigBitstreamRaw =
cfg->ConfigBitstreamRaw;
140 guidConfigBitstreamEncryption =
cfg->guidConfigBitstreamEncryption;
145 DXVA2_ConfigPictureDecode *
cfg = &((DXVA2_ConfigPictureDecode *)cfg_list)[
i];
146 ConfigBitstreamRaw =
cfg->ConfigBitstreamRaw;
147 guidConfigBitstreamEncryption =
cfg->guidConfigBitstreamEncryption;
151 if (ConfigBitstreamRaw == 1)
157 if (IsEqualGUID(&guidConfigBitstreamEncryption, &ff_DXVA2_NoEncrypt))
159 if (score > best_score) {
174static int d3d11va_validate_output(
void *service, GUID guid,
const void *surface_format)
178 hr = ID3D11VideoDevice_CheckVideoDecoderFormat((ID3D11VideoDevice *)service,
180 *(DXGI_FORMAT *)surface_format,
187static int dxva2_validate_output(
void *decoder_service, GUID guid,
const void *surface_format)
191 unsigned j, target_count;
192 D3DFORMAT *target_list;
193 hr = IDirectXVideoDecoderService_GetDecoderRenderTargets((IDirectXVideoDecoderService *)decoder_service, &guid, &target_count, &target_list);
195 for (j = 0; j < target_count; j++) {
196 const D3DFORMAT
format = target_list[j];
197 if (
format == *(D3DFORMAT *)surface_format) {
202 CoTaskMemFree(target_list);
229 unsigned guid_count,
const GUID *guid_list)
236 for (
i = 0;
i < guid_count;
i++) {
237 const GUID *guid = &guid_list[
i];
240 "{%8.8x-%4.4x-%4.4x-%2.2x%2.2x-%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x}",
241 (
unsigned) guid->Data1, guid->Data2, guid->Data3,
242 guid->Data4[0], guid->Data4[1],
243 guid->Data4[2], guid->Data4[3],
244 guid->Data4[4], guid->Data4[5],
245 guid->Data4[6], guid->Data4[7]);
253 if (d3d11va_validate_output(service, *guid, &
format))
261 MKTAG(
'P',
'0',
'1',
'0')};
264 if (dxva2_validate_output(service, *guid, &
formats[
i]))
274 unsigned guid_count,
const GUID *guid_list, GUID *decoder_guid)
281 *decoder_guid = ff_GUID_NULL;
288 for (j = 0; j < guid_count; j++) {
289 if (IsEqualGUID(
mode->guid, &guid_list[j]))
297 validate = d3d11va_validate_output(service, *
mode->guid, surface_format);
301 validate = dxva2_validate_output(service, *
mode->guid, surface_format);
304 *decoder_guid = *
mode->guid;
309 if (IsEqualGUID(decoder_guid, &ff_GUID_NULL)) {
314 if (IsEqualGUID(decoder_guid, &ff_DXVADDI_Intel_ModeH264_E))
322 IUnknown_Release((IUnknown *)opaque);
332static int dxva2_get_decoder_configuration(
AVCodecContext *avctx,
const GUID *device_guid,
333 const DXVA2_VideoDesc *
desc,
334 DXVA2_ConfigPictureDecode *config)
338 DXVA2_ConfigPictureDecode *cfg_list;
342 hr = IDirectXVideoDecoderService_GetDecoderConfigurations(sctx->dxva2_service, device_guid,
desc,
NULL, &cfg_count, &cfg_list);
351 CoTaskMemFree(cfg_list);
360 default:
return D3DFMT_UNKNOWN;
373 D3DFORMAT surface_format = dxva2_map_sw_to_hw_format(frames_ctx->sw_format);
374 DXVA2_VideoDesc
desc = { 0 };
375 DXVA2_ConfigPictureDecode
config;
378 HANDLE device_handle;
380 hr = IDirect3DDeviceManager9_OpenDeviceHandle(device_hwctx->
devmgr,
387 hr = IDirect3DDeviceManager9_GetVideoService(device_hwctx->
devmgr, device_handle,
388 &ff_IID_IDirectXVideoDecoderService,
389 (
void **)&sctx->dxva2_service);
390 IDirect3DDeviceManager9_CloseDeviceHandle(device_hwctx->
devmgr, device_handle);
396 hr = IDirectXVideoDecoderService_GetDecoderDeviceGuids(sctx->dxva2_service, &guid_count, &guid_list);
403 guid_count, guid_list, &device_guid);
404 CoTaskMemFree(guid_list);
411 desc.Format = surface_format;
413 ret = dxva2_get_decoder_configuration(avctx, &device_guid, &
desc, &config);
418 hr = IDirectXVideoDecoderService_CreateVideoDecoder(sctx->dxva2_service, &device_guid,
426 sctx->dxva2_config =
config;
441static int d3d11va_get_decoder_configuration(
AVCodecContext *avctx,
442 ID3D11VideoDevice *video_device,
443 const D3D11_VIDEO_DECODER_DESC *
desc,
444 D3D11_VIDEO_DECODER_CONFIG *config)
446 unsigned cfg_count = 0;
447 D3D11_VIDEO_DECODER_CONFIG *cfg_list =
NULL;
451 hr = ID3D11VideoDevice_GetVideoDecoderConfigCount(video_device,
desc, &cfg_count);
457 cfg_list =
av_malloc_array(cfg_count,
sizeof(D3D11_VIDEO_DECODER_CONFIG));
458 if (cfg_list ==
NULL)
460 for (
i = 0;
i < cfg_count;
i++) {
461 hr = ID3D11VideoDevice_GetVideoDecoderConfig(video_device,
desc,
i, &cfg_list[
i]);
463 av_log(avctx,
AV_LOG_ERROR,
"Unable to retrieve decoder configurations. (hr=0x%lX)\n", hr);
492 default:
return DXGI_FORMAT_UNKNOWN;
500 unsigned guid_count,
i;
502 D3D11_VIDEO_DECODER_DESC
desc = { 0 };
503 D3D11_VIDEO_DECODER_CONFIG
config;
507 DXGI_FORMAT surface_format = d3d11va_map_sw_to_hw_format(frames_ctx->sw_format);
508 D3D11_TEXTURE2D_DESC texdesc;
516 ID3D11Texture2D_GetDesc(frames_hwctx->
texture, &texdesc);
518 guid_count = ID3D11VideoDevice_GetVideoDecoderProfileCount(device_hwctx->
video_device);
520 if (guid_list ==
NULL || guid_count == 0) {
525 for (
i = 0;
i < guid_count;
i++) {
526 hr = ID3D11VideoDevice_GetVideoDecoderProfile(device_hwctx->
video_device,
i, &guid_list[
i]);
535 guid_count, guid_list, &decoder_guid);
542 desc.OutputFormat = surface_format;
543 desc.Guid = decoder_guid;
545 ret = d3d11va_get_decoder_configuration(avctx, device_hwctx->
video_device, &
desc, &config);
549 sctx->d3d11_views =
av_calloc(texdesc.ArraySize,
sizeof(sctx->d3d11_views[0]));
550 if (!sctx->d3d11_views)
552 sctx->nb_d3d11_views = texdesc.ArraySize;
554 for (
i = 0;
i < sctx->nb_d3d11_views;
i++) {
555 D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC viewDesc = {
556 .DecodeProfile = decoder_guid,
557 .ViewDimension = D3D11_VDOV_DIMENSION_TEXTURE2D,
562 hr = ID3D11VideoDevice_CreateVideoDecoderOutputView(device_hwctx->
video_device,
563 (ID3D11Resource*) frames_hwctx->
texture,
565 (ID3D11VideoDecoderOutputView**) &sctx->d3d11_views[
i]);
572 hr = ID3D11VideoDevice_CreateVideoDecoder(device_hwctx->
video_device, &
desc,
573 &config, &sctx->d3d11_decoder);
579 sctx->d3d11_config =
config;
580 sctx->d3d11_texture = frames_hwctx->
texture;
628 int surface_alignment, num_surfaces;
641 surface_alignment = 32;
645 surface_alignment = 128;
647 surface_alignment = 16;
680 frames_hwctx->
surface_type = DXVA2_VideoDecoderRenderTarget;
688 frames_hwctx->
BindFlags |= D3D11_BIND_DECODER | D3D11_BIND_SHADER_RESOURCE;
729 ret = d3d11va_create_decoder(avctx);
734 d3d11_ctx->
decoder = sctx->d3d11_decoder;
736 d3d11_ctx->
cfg = &sctx->d3d11_config;
738 d3d11_ctx->
surface = sctx->d3d11_views;
750 ret = dxva2_create_decoder(avctx);
755 dxva_ctx->
decoder = sctx->dxva2_decoder;
756 dxva_ctx->
cfg = &sctx->dxva2_config;
778 for (
i = 0;
i < sctx->nb_d3d11_views;
i++) {
779 if (sctx->d3d11_views[
i])
780 ID3D11VideoDecoderOutputView_Release(sctx->d3d11_views[
i]);
786 if (sctx->dxva2_service)
787 IDirectXVideoDecoderService_Release(sctx->dxva2_service);
800 sctx->d3d11_texture != (ID3D11Texture2D *)
frame->data[0]) {
804 return sctx->d3d11_views[
index];
807 return frame->data[3];
823 return (intptr_t)
frame->data[1];
825 D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC viewDesc;
826 ID3D11VideoDecoderOutputView_GetDesc((ID3D11VideoDecoderOutputView*)
surface, &viewDesc);
827 return viewDesc.Texture2D.ArraySlice;
847 void *dxva_data =
NULL;
857 &dxva_size, &dxva_data);
862 &dxva_data, &dxva_size);
869 if (dxva_data &&
size <= dxva_size) {
874 D3D11_VIDEO_DECODER_BUFFER_DESC *dsc11 = dsc;
875 memset(dsc11, 0,
sizeof(*dsc11));
876 dsc11->BufferType =
type;
877 dsc11->DataSize =
size;
878 dsc11->NumMBsInBuffer = mb_count;
883 DXVA2_DecodeBufferDesc *dsc2 = dsc;
884 memset(dsc2, 0,
sizeof(*dsc2));
885 dsc2->CompressedBufferType =
type;
886 dsc2->DataSize =
size;
887 dsc2->NumMBsInBuffer = mb_count;
907 "Failed to release buffer type %u: 0x%x\n",
931 const void *pp,
unsigned pp_size,
932 const void *qm,
unsigned qm_size,
938 unsigned buffer_count = 0;
940 D3D11_VIDEO_DECODER_BUFFER_DESC buffer11[4];
943 DXVA2_DecodeBufferDesc buffer2[4];
946 int result, runs = 0;
971 if (hr != E_PENDING || ++runs > 50)
985 buffer = &buffer11[buffer_count];
986 type = D3D11_VIDEO_DECODER_BUFFER_PICTURE_PARAMETERS;
991 buffer = &buffer2[buffer_count];
992 type = DXVA2_PictureParametersBufferType;
1000 "Failed to add picture parameter buffer\n");
1008 buffer = &buffer11[buffer_count];
1009 type = D3D11_VIDEO_DECODER_BUFFER_INVERSE_QUANTIZATION_MATRIX;
1014 buffer = &buffer2[buffer_count];
1015 type = DXVA2_InverseQuantizationMatrixBufferType;
1023 "Failed to add inverse quantization matrix buffer\n");
1031 buffer = &buffer11[buffer_count + 0];
1032 buffer_slice = &buffer11[buffer_count + 1];
1037 buffer = &buffer2[buffer_count + 0];
1038 buffer_slice = &buffer2[buffer_count + 1];
1042 result = commit_bs_si(avctx,
1047 "Failed to add bitstream or slice control buffer\n");
1054 av_assert0(buffer_count == 1 + (qm_size > 0) + 2);
1060 buffer_count, buffer11);
1064 DXVA2_DecodeExecuteParams exec = {
1065 .NumCompBuffers = buffer_count,
1066 .pCompressedBuffers = buffer2,
1067 .pExtensionData =
NULL,
static const char *const format[]
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.
Libavcodec external API header.
#define i(width, name, range_min, range_max)
common internal and external API header
unsigned ff_d3d12va_get_surface_index(const AVCodecContext *avctx, D3D12VADecodeContext *ctx, const AVFrame *frame, int curr)
static void bufref_free_interface(void *opaque, uint8_t *data)
int ff_decode_get_hw_frames_ctx(AVCodecContext *avctx, enum AVHWDeviceType dev_type)
Make sure avctx.hw_frames_ctx is set.
#define AV_PROFILE_MPEG2_MAIN
#define AV_PROFILE_AV1_HIGH
#define AV_PROFILE_H264_MAIN
#define AV_PROFILE_UNKNOWN
#define AV_PROFILE_HEVC_MAIN
#define AV_PROFILE_HEVC_MAIN_10
#define AV_PROFILE_H264_HIGH
#define AV_PROFILE_H264_CONSTRAINED_BASELINE
#define AV_PROFILE_AV1_MAIN
#define AV_PROFILE_AV1_PROFESSIONAL
#define AV_PROFILE_MPEG2_SIMPLE
static enum AVPixelFormat pix_fmt
static const dxva_mode dxva_modes[]
int ff_dxva2_is_d3d11(const AVCodecContext *avctx)
static const int prof_hevc_main[]
unsigned ff_dxva2_get_surface_index(const AVCodecContext *avctx, AVDXVAContext *ctx, const AVFrame *frame, int curr)
static const int prof_vp9_profile0[]
static const int prof_av1_profile2[]
static void ff_dxva2_unlock(AVCodecContext *avctx)
static int frame_add_buf(AVFrame *frame, AVBufferRef *ref)
unsigned * ff_dxva2_get_report_id(const AVCodecContext *avctx, AVDXVAContext *ctx)
static const int prof_hevc_main10[]
static void ff_dxva2_lock(AVCodecContext *avctx)
static void * get_surface(const AVCodecContext *avctx, const AVFrame *frame)
int ff_dxva2_decode_init(AVCodecContext *avctx)
static AVBufferRef * bufref_wrap_interface(IUnknown *iface)
int ff_dxva2_commit_buffer(AVCodecContext *avctx, AVDXVAContext *ctx, DECODER_BUFFER_DESC *dsc, unsigned type, const void *data, unsigned size, unsigned mb_count)
static int dxva_get_decoder_configuration(AVCodecContext *avctx, const void *cfg_list, unsigned cfg_count)
int ff_dxva2_decode_uninit(AVCodecContext *avctx)
int ff_dxva2_common_end_frame(AVCodecContext *avctx, AVFrame *frame, const void *pp, unsigned pp_size, const void *qm, unsigned qm_size, int(*commit_bs_si)(AVCodecContext *, DECODER_BUFFER_DESC *bs, DECODER_BUFFER_DESC *slice))
static const int prof_mpeg2_main[]
int ff_dxva2_common_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx)
static const int prof_av1_profile1[]
static int dxva_get_decoder_guid(AVCodecContext *avctx, void *service, void *surface_format, unsigned guid_count, const GUID *guid_list, GUID *decoder_guid)
static const int prof_h264_high[]
static void dxva_list_guids_debug(AVCodecContext *avctx, void *service, unsigned guid_count, const GUID *guid_list)
static const int prof_vp9_profile2[]
static int dxva_check_codec_compatibility(AVCodecContext *avctx, const dxva_mode *mode)
static const int prof_av1_profile0[]
static void bufref_free_interface(void *opaque, uint8_t *data)
DEFINE_GUID(ff_DXVA2_ModeMPEG2_VLD, 0xee27417f, 0x5e28, 0x4e65, 0xbe, 0xea, 0x1d, 0x26, 0xb5, 0x08, 0xad, 0xc9)
#define DXVA_CONTEXT(avctx)
#define DXVA_SHARED_CONTEXT(avctx)
#define DXVA_CONTEXT_COUNT(avctx, ctx)
#define DXVA2_CONTEXT(ctx)
#define FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO
Work around for DXVA2/Direct3D11 and old Intel GPUs with ClearVideo interface.
#define D3D11VA_CONTEXT(ctx)
static CheckasmConfig cfg
#define AV_NUM_DATA_POINTERS
AVCodecID
Identify the syntax and semantics of the bitstream.
@ AV_CODEC_ID_MPEG2VIDEO
preferred ID for MPEG-1/2 video decoding
#define AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH
Hardware acceleration should still be attempted for decoding when the codec profile does not match th...
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
AVBufferRef * av_buffer_ref(const AVBufferRef *buf)
Create a new reference to an AVBuffer.
AVBufferRef * av_buffer_create(uint8_t *data, size_t size, void(*free)(void *opaque, uint8_t *data), void *opaque, int flags)
Create an AVBuffer from an existing array.
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_VERBOSE
Detailed information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
@ AV_HWDEVICE_TYPE_D3D11VA
static const chunk_decoder decoder[8]
#define MKTAG(a, b, c, d)
void * av_calloc(size_t nmemb, size_t size)
Memory handling functions.
#define AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P10
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_NV12
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_VUYX
packed VUYX 4:4:4:4, 32bpp, Variant of VUYA where alpha channel is left undefined
@ AV_PIX_FMT_D3D12
Hardware surfaces for Direct3D 12.
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
@ AV_PIX_FMT_DXVA2_VLD
HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer.
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
@ AV_PIX_FMT_D3D11
Hardware surfaces for Direct3D11.
@ AV_PIX_FMT_D3D11VA_VLD
HW decoding through Direct3D11 via old API, Picture.data[3] contains a ID3D11VideoDecoderOutputView p...
@ AV_PIX_FMT_YUYV422
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
#define AV_PIX_FMT_YUV444P10
static int is_supported(enum AVCodecID id)
#define FF_ARRAY_ELEMS(a)
A reference to a data buffer.
uint8_t * data
The data buffer.
main external API structure.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int hwaccel_flags
Bit set of AV_HWACCEL_FLAG_* flags, which affect hardware accelerated decoding (if active).
enum AVPixelFormat sw_pix_fmt
Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx.
AVBufferRef * hw_frames_ctx
A reference to the AVHWFramesContext describing the input (for encoding) or output (decoding) frames.
const struct AVHWAccel * hwaccel
Hardware accelerator in use.
void * hwaccel_context
Legacy hardware accelerator context.
int coded_width
Bitstream width / height, may be different from width/height e.g.
This structure is used to provides the necessary configurations and data to the Direct3D11 FFmpeg HWA...
D3D11_VIDEO_DECODER_CONFIG * cfg
D3D11 configuration used to create the decoder.
ID3D11VideoContext * video_context
D3D11 VideoContext.
ID3D11VideoDecoderOutputView ** surface
The array of Direct3D surfaces used to create the decoder.
unsigned surface_count
The number of surface in the surface array.
ID3D11VideoDecoder * decoder
D3D11 decoder object.
HANDLE context_mutex
Mutex to access video_context.
uint64_t workaround
A bit field configuring the workarounds needed for using the decoder.
This struct is allocated as AVHWDeviceContext.hwctx.
void(* lock)(void *lock_ctx)
Callbacks for locking.
void(* unlock)(void *lock_ctx)
ID3D11VideoContext * video_context
If unset, this will be set from the device_context field on init.
ID3D11VideoDevice * video_device
If unset, this will be set from the device field on init.
This struct is allocated as AVHWFramesContext.hwctx.
ID3D11Texture2D * texture
The canonical texture used for pool allocation.
UINT BindFlags
D3D11_TEXTURE2D_DESC.BindFlags used for texture creation.
This struct is allocated as AVHWDeviceContext.hwctx.
IDirect3DDeviceManager9 * devmgr
This struct is allocated as AVHWFramesContext.hwctx.
IDirect3DSurface9 ** surfaces
The surface pool.
DWORD surface_type
The surface type (e.g.
This structure describes decoded (raw) audio or video data.
enum AVPixelFormat pix_fmt
Supported pixel format.
This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e.
void * hwctx
The format-specific data, allocated and freed by libavutil along with this context.
enum AVHWDeviceType type
This field identifies the underlying API used for hardware access.
This struct describes a set or pool of "hardware" frames (i.e.
enum AVPixelFormat format
The pixel format identifying the underlying HW surface type.
void * hwctx
The format-specific data, allocated and freed automatically along with this context.
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames.
int initial_pool_size
Initial size of the frame pool.
int width
The allocated dimensions of the frames in this pool.
AVHWDeviceContext * device_ctx
The parent AVHWDeviceContext.
This structure is used to provide the necessary configurations and data to the FFmpeg Direct3D 12 HWA...
AVHWDeviceContext * device_ctx
enum AVPixelFormat pix_fmt
AVBufferRef * decoder_ref
This structure is used to provides the necessary configurations and data to the DXVA2 FFmpeg HWAccel ...
IDirectXVideoDecoder * decoder
DXVA2 decoder object.
uint64_t workaround
A bit field configuring the workarounds needed for using the decoder.
LPDIRECT3DSURFACE9 * surface
The array of Direct3D surfaces used to create the decoder.
unsigned surface_count
The number of surface in the surface array.
const DXVA2_ConfigPictureDecode * cfg
DXVA2 configuration used to create the decoder.
unsigned report_id
Private to the FFmpeg AVHWAccel implementation.
#define av_malloc_array(a, b)
static int ref[MAX_W *MAX_W]
int av_usleep(unsigned usec)
Sleep for a period of time.