FFmpeg
Data Structures | Macros | Typedefs | Functions
dxva2_internal.h File Reference
#include "config.h"
#include "config_components.h"
#include <objbase.h>
#include "libavutil/hwcontext.h"
#include "avcodec.h"
#include "internal.h"

Go to the source code of this file.

Data Structures

union  AVDXVAContext
 
struct  FFDXVASharedContext
 

Macros

#define COBJMACROS
 
#define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG   1
 Work around for DXVA2/Direct3D11 and old UVD/UVD+ ATI video cards. More...
 
#define FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO   2
 Work around for DXVA2/Direct3D11 and old Intel GPUs with ClearVideo interface. More...
 
#define DXVA2_VAR(ctx, var)   0
 
#define D3D11VA_VAR(ctx, var)   0
 
#define DXVA_SHARED_CONTEXT(avctx)   ((FFDXVASharedContext *)((avctx)->internal->hwaccel_priv_data))
 
#define DXVA_CONTEXT(avctx)   (AVDXVAContext *)((avctx)->hwaccel_context ? (avctx)->hwaccel_context : (&(DXVA_SHARED_CONTEXT(avctx)->ctx)))
 
#define D3D11VA_CONTEXT(ctx)   (&ctx->d3d11va)
 
#define DXVA2_CONTEXT(ctx)   (&ctx->dxva2)
 
#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)))
 
#define DXVA_CONTEXT_REPORT_ID(avctx, ctx)   (*ff_dxva2_get_report_id(avctx, ctx))
 
#define DXVA_CONTEXT_WORKAROUND(avctx, ctx)   DXVA2_CONTEXT_VAR(avctx, ctx, workaround)
 
#define DXVA_CONTEXT_COUNT(avctx, ctx)   DXVA2_CONTEXT_VAR(avctx, ctx, surface_count)
 
#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)))
 
#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)))
 
#define DXVA_CONTEXT_CFG_BITSTREAM(avctx, ctx)   DXVA2_CONTEXT_VAR(avctx, ctx, cfg->ConfigBitstreamRaw)
 
#define DXVA_CONTEXT_CFG_INTRARESID(avctx, ctx)   DXVA2_CONTEXT_VAR(avctx, ctx, cfg->ConfigIntraResidUnsigned)
 
#define DXVA_CONTEXT_CFG_RESIDACCEL(avctx, ctx)   DXVA2_CONTEXT_VAR(avctx, ctx, cfg->ConfigResidDiffAccelerator)
 
#define DXVA_CONTEXT_VALID(avctx, ctx)
 

Typedefs

typedef void DECODER_BUFFER_DESC
 

Functions

unsigned ff_dxva2_get_surface_index (const AVCodecContext *avctx, AVDXVAContext *, const AVFrame *frame, int curr)
 
int ff_dxva2_commit_buffer (AVCodecContext *, AVDXVAContext *, DECODER_BUFFER_DESC *, unsigned type, const void *data, unsigned size, unsigned mb_count)
 
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))
 
int ff_dxva2_decode_init (AVCodecContext *avctx)
 
int ff_dxva2_decode_uninit (AVCodecContext *avctx)
 
int ff_dxva2_common_frame_params (AVCodecContext *avctx, AVBufferRef *hw_frames_ctx)
 
int ff_dxva2_is_d3d11 (const AVCodecContext *avctx)
 
unsigned * ff_dxva2_get_report_id (const AVCodecContext *avctx, AVDXVAContext *ctx)
 
void ff_dxva2_h264_fill_picture_parameters (const AVCodecContext *avctx, AVDXVAContext *ctx, DXVA_PicParams_H264 *pp)
 
void ff_dxva2_h264_fill_scaling_lists (const AVCodecContext *avctx, AVDXVAContext *ctx, DXVA_Qmatrix_H264 *qm)
 
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_vp9_fill_picture_parameters (const AVCodecContext *avctx, AVDXVAContext *ctx, DXVA_PicParams_VP9 *pp)
 
void ff_dxva2_mpeg2_fill_picture_parameters (AVCodecContext *avctx, AVDXVAContext *ctx, DXVA_PictureParameters *pp)
 
void ff_dxva2_mpeg2_fill_quantization_matrices (AVCodecContext *avctx, AVDXVAContext *ctx, DXVA_QmatrixData *qm)
 
void ff_dxva2_mpeg2_fill_slice (AVCodecContext *avctx, DXVA_SliceInfo *slice, unsigned position, const uint8_t *buffer, unsigned 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)
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 26 of file dxva2_internal.h.

◆ FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG

#define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG   1

Work around for DXVA2/Direct3D11 and old UVD/UVD+ ATI video cards.

Definition at line 34 of file dxva2_internal.h.

◆ FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO

#define FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO   2

Work around for DXVA2/Direct3D11 and old Intel GPUs with ClearVideo interface.

Definition at line 35 of file dxva2_internal.h.

◆ DXVA2_VAR

#define DXVA2_VAR (   ctx,
  var 
)    0

Definition at line 42 of file dxva2_internal.h.

◆ D3D11VA_VAR

#define D3D11VA_VAR (   ctx,
  var 
)    0

Definition at line 50 of file dxva2_internal.h.

◆ DXVA_SHARED_CONTEXT

#define DXVA_SHARED_CONTEXT (   avctx)    ((FFDXVASharedContext *)((avctx)->internal->hwaccel_priv_data))

Definition at line 116 of file dxva2_internal.h.

◆ DXVA_CONTEXT

#define DXVA_CONTEXT (   avctx)    (AVDXVAContext *)((avctx)->hwaccel_context ? (avctx)->hwaccel_context : (&(DXVA_SHARED_CONTEXT(avctx)->ctx)))

Definition at line 118 of file dxva2_internal.h.

◆ D3D11VA_CONTEXT

#define D3D11VA_CONTEXT (   ctx)    (&ctx->d3d11va)

Definition at line 120 of file dxva2_internal.h.

◆ DXVA2_CONTEXT

#define DXVA2_CONTEXT (   ctx)    (&ctx->dxva2)

Definition at line 121 of file dxva2_internal.h.

◆ DXVA2_CONTEXT_VAR

#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)))

Definition at line 123 of file dxva2_internal.h.

◆ DXVA_CONTEXT_REPORT_ID

#define DXVA_CONTEXT_REPORT_ID (   avctx,
  ctx 
)    (*ff_dxva2_get_report_id(avctx, ctx))

Definition at line 125 of file dxva2_internal.h.

◆ DXVA_CONTEXT_WORKAROUND

#define DXVA_CONTEXT_WORKAROUND (   avctx,
  ctx 
)    DXVA2_CONTEXT_VAR(avctx, ctx, workaround)

Definition at line 126 of file dxva2_internal.h.

◆ DXVA_CONTEXT_COUNT

#define DXVA_CONTEXT_COUNT (   avctx,
  ctx 
)    DXVA2_CONTEXT_VAR(avctx, ctx, surface_count)

Definition at line 127 of file dxva2_internal.h.

◆ DXVA_CONTEXT_DECODER

#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)))

Definition at line 128 of file dxva2_internal.h.

◆ DXVA_CONTEXT_CFG

#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)))

Definition at line 129 of file dxva2_internal.h.

◆ DXVA_CONTEXT_CFG_BITSTREAM

#define DXVA_CONTEXT_CFG_BITSTREAM (   avctx,
  ctx 
)    DXVA2_CONTEXT_VAR(avctx, ctx, cfg->ConfigBitstreamRaw)

Definition at line 130 of file dxva2_internal.h.

◆ DXVA_CONTEXT_CFG_INTRARESID

#define DXVA_CONTEXT_CFG_INTRARESID (   avctx,
  ctx 
)    DXVA2_CONTEXT_VAR(avctx, ctx, cfg->ConfigIntraResidUnsigned)

Definition at line 131 of file dxva2_internal.h.

◆ DXVA_CONTEXT_CFG_RESIDACCEL

#define DXVA_CONTEXT_CFG_RESIDACCEL (   avctx,
  ctx 
)    DXVA2_CONTEXT_VAR(avctx, ctx, cfg->ConfigResidDiffAccelerator)

Definition at line 132 of file dxva2_internal.h.

◆ DXVA_CONTEXT_VALID

#define DXVA_CONTEXT_VALID (   avctx,
  ctx 
)
Value:
(DXVA_CONTEXT_DECODER(avctx, ctx) && \
DXVA_CONTEXT_CFG(avctx, ctx) && \
(ff_dxva2_is_d3d11(avctx) || DXVA2_VAR(ctx, surface_count)))

Definition at line 133 of file dxva2_internal.h.

Typedef Documentation

◆ DECODER_BUFFER_DESC

typedef void DECODER_BUFFER_DESC

Definition at line 72 of file dxva2_internal.h.

Function Documentation

◆ ff_dxva2_get_surface_index()

unsigned ff_dxva2_get_surface_index ( const AVCodecContext avctx,
AVDXVAContext ,
const AVFrame frame,
int  curr 
)

◆ ff_dxva2_commit_buffer()

int ff_dxva2_commit_buffer ( AVCodecContext ,
AVDXVAContext ,
DECODER_BUFFER_DESC ,
unsigned  type,
const void *  data,
unsigned  size,
unsigned  mb_count 
)

Definition at line 802 of file dxva2.c.

Referenced by commit_bitstream_and_slice_buffer(), and ff_dxva2_common_end_frame().

◆ ff_dxva2_common_end_frame()

int ff_dxva2_common_end_frame ( AVCodecContext ,
AVFrame ,
const void *  pp,
unsigned  pp_size,
const void *  qm,
unsigned  qm_size,
int(*)(AVCodecContext *, DECODER_BUFFER_DESC *bs, DECODER_BUFFER_DESC *slice)  commit_bs_si 
)

◆ ff_dxva2_decode_init()

int ff_dxva2_decode_init ( AVCodecContext avctx)

Definition at line 655 of file dxva2.c.

◆ ff_dxva2_decode_uninit()

int ff_dxva2_decode_uninit ( AVCodecContext avctx)

Definition at line 730 of file dxva2.c.

Referenced by dxva2_av1_uninit(), and ff_dxva2_decode_init().

◆ ff_dxva2_common_frame_params()

int ff_dxva2_common_frame_params ( AVCodecContext avctx,
AVBufferRef hw_frames_ctx 
)

Definition at line 592 of file dxva2.c.

◆ ff_dxva2_is_d3d11()

int ff_dxva2_is_d3d11 ( const AVCodecContext avctx)

◆ ff_dxva2_get_report_id()

unsigned* ff_dxva2_get_report_id ( const AVCodecContext avctx,
AVDXVAContext ctx 
)

Definition at line 1065 of file dxva2.c.

◆ ff_dxva2_h264_fill_picture_parameters()

void ff_dxva2_h264_fill_picture_parameters ( const AVCodecContext avctx,
AVDXVAContext ctx,
DXVA_PicParams_H264 *  pp 
)

Definition at line 51 of file dxva2_h264.c.

Referenced by d3d12va_h264_start_frame(), and dxva2_h264_start_frame().

◆ ff_dxva2_h264_fill_scaling_lists()

void ff_dxva2_h264_fill_scaling_lists ( const AVCodecContext avctx,
AVDXVAContext ctx,
DXVA_Qmatrix_H264 *  qm 
)

Definition at line 168 of file dxva2_h264.c.

Referenced by d3d12va_h264_start_frame(), and dxva2_h264_start_frame().

◆ ff_dxva2_hevc_fill_picture_parameters()

void ff_dxva2_hevc_fill_picture_parameters ( const AVCodecContext avctx,
AVDXVAContext ctx,
DXVA_PicParams_HEVC *  pp 
)

Definition at line 60 of file dxva2_hevc.c.

Referenced by d3d12va_hevc_start_frame(), and dxva2_hevc_start_frame().

◆ ff_dxva2_hevc_fill_scaling_lists()

void ff_dxva2_hevc_fill_scaling_lists ( const AVCodecContext avctx,
AVDXVAContext ctx,
DXVA_Qmatrix_HEVC *  qm 
)

Definition at line 204 of file dxva2_hevc.c.

Referenced by d3d12va_hevc_start_frame(), and dxva2_hevc_start_frame().

◆ ff_dxva2_vp9_fill_picture_parameters()

int ff_dxva2_vp9_fill_picture_parameters ( const AVCodecContext avctx,
AVDXVAContext ctx,
DXVA_PicParams_VP9 *  pp 
)

Definition at line 46 of file dxva2_vp9.c.

Referenced by d3d12va_vp9_start_frame(), and dxva2_vp9_start_frame().

◆ ff_dxva2_mpeg2_fill_picture_parameters()

void ff_dxva2_mpeg2_fill_picture_parameters ( AVCodecContext avctx,
AVDXVAContext ctx,
DXVA_PictureParameters *  pp 
)

Definition at line 43 of file dxva2_mpeg2.c.

Referenced by d3d12va_mpeg2_start_frame(), and dxva2_mpeg2_start_frame().

◆ ff_dxva2_mpeg2_fill_quantization_matrices()

void ff_dxva2_mpeg2_fill_quantization_matrices ( AVCodecContext avctx,
AVDXVAContext ctx,
DXVA_QmatrixData *  qm 
)

Definition at line 109 of file dxva2_mpeg2.c.

Referenced by d3d12va_mpeg2_start_frame(), and dxva2_mpeg2_start_frame().

◆ ff_dxva2_mpeg2_fill_slice()

void ff_dxva2_mpeg2_fill_slice ( AVCodecContext avctx,
DXVA_SliceInfo *  slice,
unsigned  position,
const uint8_t *  buffer,
unsigned  size 
)

Definition at line 126 of file dxva2_mpeg2.c.

Referenced by d3d12va_mpeg2_decode_slice(), and dxva2_mpeg2_decode_slice().

◆ ff_dxva2_vc1_fill_picture_parameters()

void ff_dxva2_vc1_fill_picture_parameters ( AVCodecContext avctx,
AVDXVAContext ctx,
DXVA_PictureParameters *  pp 
)

Definition at line 43 of file dxva2_vc1.c.

Referenced by d3d12va_vc1_start_frame(), and dxva2_vc1_start_frame().

◆ ff_dxva2_vc1_fill_slice()

void ff_dxva2_vc1_fill_slice ( AVCodecContext avctx,
DXVA_SliceInfo *  slice,
unsigned  position,
unsigned  size 
)

Definition at line 167 of file dxva2_vc1.c.

Referenced by d3d12va_vc1_decode_slice(), and dxva2_vc1_decode_slice().

DXVA2_VAR
#define DXVA2_VAR(ctx, var)
Definition: dxva2_internal.h:42
ctx
AVFormatContext * ctx
Definition: movenc.c:48
DXVA_CONTEXT_DECODER
#define DXVA_CONTEXT_DECODER(avctx, ctx)
Definition: dxva2_internal.h:128
ff_dxva2_is_d3d11
int ff_dxva2_is_d3d11(const AVCodecContext *avctx)
Definition: dxva2.c:1056