23#ifndef AVCODEC_DXVA2_INTERNAL_H
24#define AVCODEC_DXVA2_INTERNAL_H
29#include "config_components.h"
34#define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1
35#define FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO 2
40#define DXVA2_VAR(ctx, var) ctx->dxva2.var
42#define DXVA2_VAR(ctx, var) 0
48#define D3D11VA_VAR(ctx, var) ctx->d3d11va.var
50#define D3D11VA_VAR(ctx, var) 0
61#define WINAPI_FAMILY WINAPI_FAMILY_DESKTOP_APP
62#undef _CRT_BUILD_DESKTOP_APP
63#define _CRT_BUILD_DESKTOP_APP 0
98 ID3D11VideoDecoder *d3d11_decoder;
99 D3D11_VIDEO_DECODER_CONFIG d3d11_config;
100 ID3D11VideoDecoderOutputView **d3d11_views;
102 ID3D11Texture2D *d3d11_texture;
106 IDirectXVideoDecoder *dxva2_decoder;
107 IDirectXVideoDecoderService *dxva2_service;
108 DXVA2_ConfigPictureDecode dxva2_config;
116#define DXVA_SHARED_CONTEXT(avctx) ((FFDXVASharedContext *)((avctx)->internal->hwaccel_priv_data))
118#define DXVA_CONTEXT(avctx) (AVDXVAContext *)((avctx)->hwaccel_context ? (avctx)->hwaccel_context : (&(DXVA_SHARED_CONTEXT(avctx)->ctx)))
120#define D3D11VA_CONTEXT(ctx) (&ctx->d3d11va)
121#define DXVA2_CONTEXT(ctx) (&ctx->dxva2)
123#define DXVA2_CONTEXT_VAR(avctx, ctx, var) (avctx->pix_fmt == AV_PIX_FMT_D3D12 ? 0 : (ff_dxva2_is_d3d11(avctx) ? D3D11VA_VAR(ctx, var) : DXVA2_VAR(ctx, var)))
125#define DXVA_CONTEXT_REPORT_ID(avctx, ctx) (*ff_dxva2_get_report_id(avctx, ctx))
126#define DXVA_CONTEXT_WORKAROUND(avctx, ctx) DXVA2_CONTEXT_VAR(avctx, ctx, workaround)
127#define DXVA_CONTEXT_COUNT(avctx, ctx) DXVA2_CONTEXT_VAR(avctx, ctx, surface_count)
128#define DXVA_CONTEXT_DECODER(avctx, ctx) (avctx->pix_fmt == AV_PIX_FMT_D3D12 ? 0 : (ff_dxva2_is_d3d11(avctx) ? (void *)D3D11VA_VAR(ctx, decoder) : (void *)DXVA2_VAR(ctx, decoder)))
129#define DXVA_CONTEXT_CFG(avctx, ctx) (avctx->pix_fmt == AV_PIX_FMT_D3D12 ? 0 : (ff_dxva2_is_d3d11(avctx) ? (void *)D3D11VA_VAR(ctx, cfg) : (void *)DXVA2_VAR(ctx, cfg)))
130#define DXVA_CONTEXT_CFG_BITSTREAM(avctx, ctx) DXVA2_CONTEXT_VAR(avctx, ctx, cfg->ConfigBitstreamRaw)
131#define DXVA_CONTEXT_CFG_INTRARESID(avctx, ctx) DXVA2_CONTEXT_VAR(avctx, ctx, cfg->ConfigIntraResidUnsigned)
132#define DXVA_CONTEXT_CFG_RESIDACCEL(avctx, ctx) DXVA2_CONTEXT_VAR(avctx, ctx, cfg->ConfigResidDiffAccelerator)
133#define DXVA_CONTEXT_VALID(avctx, ctx) (DXVA_CONTEXT_DECODER(avctx, ctx) && \
134 DXVA_CONTEXT_CFG(avctx, ctx) && \
135 (ff_dxva2_is_d3d11(avctx) || DXVA2_VAR(ctx, surface_count)))
153 const void *pp,
unsigned pp_size,
154 const void *qm,
unsigned qm_size,
174#if CONFIG_HEVC_D3D12VA_HWACCEL || CONFIG_HEVC_D3D11VA_HWACCEL || CONFIG_HEVC_D3D11VA2_HWACCEL || CONFIG_HEVC_DXVA2_HWACCEL
180#if CONFIG_VP9_D3D12VA_HWACCEL || CONFIG_VP9_D3D11VA_HWACCEL || CONFIG_VP9_D3D11VA2_HWACCEL || CONFIG_VP9_DXVA2_HWACCEL
184#if CONFIG_AV1_D3D12VA_HWACCEL || CONFIG_AV1_D3D11VA_HWACCEL || CONFIG_AV1_D3D11VA2_HWACCEL || CONFIG_AV1_DXVA2_HWACCEL
static AVFormatContext * ctx
Libavcodec external API header.
Public libavcodec D3D11VA header.
unsigned ff_d3d12va_get_surface_index(const AVCodecContext *avctx, D3D12VADecodeContext *ctx, const AVFrame *frame, int curr)
Public libavcodec DXVA2 header.
int ff_dxva2_av1_fill_picture_parameters(const AVCodecContext *avctx, AVDXVAContext *ctx, DXVA_PicParams_AV1 *pp)
void ff_dxva2_hevc_fill_picture_parameters(const AVCodecContext *avctx, AVDXVAContext *ctx, DXVA_PicParams_HEVC *pp)
void ff_dxva2_hevc_fill_scaling_lists(const AVCodecContext *avctx, AVDXVAContext *ctx, DXVA_Qmatrix_HEVC *qm)
int ff_dxva2_is_d3d11(const AVCodecContext *avctx)
void ff_dxva2_h264_fill_scaling_lists(const AVCodecContext *avctx, AVDXVAContext *ctx, DXVA_Qmatrix_H264 *qm)
int ff_dxva2_common_end_frame(AVCodecContext *, AVFrame *, 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))
void ff_dxva2_mpeg2_fill_quantization_matrices(AVCodecContext *avctx, AVDXVAContext *ctx, DXVA_QmatrixData *qm)
unsigned * ff_dxva2_get_report_id(const AVCodecContext *avctx, AVDXVAContext *ctx)
int ff_dxva2_decode_init(AVCodecContext *avctx)
void ff_dxva2_mpeg2_fill_picture_parameters(AVCodecContext *avctx, AVDXVAContext *ctx, DXVA_PictureParameters *pp)
void ff_dxva2_h264_fill_picture_parameters(const AVCodecContext *avctx, AVDXVAContext *ctx, DXVA_PicParams_H264 *pp)
int ff_dxva2_decode_uninit(AVCodecContext *avctx)
unsigned ff_dxva2_get_surface_index(const AVCodecContext *avctx, AVDXVAContext *, const AVFrame *frame, int curr)
void ff_dxva2_mpeg2_fill_slice(AVCodecContext *avctx, DXVA_SliceInfo *slice, unsigned position, const uint8_t *buffer, unsigned size)
int ff_dxva2_common_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx)
int ff_dxva2_commit_buffer(AVCodecContext *, AVDXVAContext *, DECODER_BUFFER_DESC *, unsigned type, const void *data, unsigned size, unsigned mb_count)
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)
int ff_dxva2_vp9_fill_picture_parameters(const AVCodecContext *avctx, AVDXVAContext *ctx, DXVA_PicParams_VP9 *pp)
An API-specific header for AV_HWDEVICE_TYPE_D3D11VA.
An API-specific header for AV_HWDEVICE_TYPE_DXVA2.
common internal api header.
AVPixelFormat
Pixel format.
A reference to a data buffer.
main external API structure.
This structure is used to provides the necessary configurations and data to the Direct3D11 FFmpeg HWA...
This structure describes decoded (raw) audio or video data.
This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e.
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 ...