FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Functions | Variables
dxva2.c File Reference
#include <assert.h>
#include <string.h>
#include <initguid.h>
#include "libavutil/common.h"
#include "libavutil/log.h"
#include "libavutil/time.h"
#include "avcodec.h"
#include "decode.h"
#include "dxva2_internal.h"

Go to the source code of this file.

Data Structures

struct  dxva_mode
 

Functions

 DEFINE_GUID (ff_DXVA2_ModeMPEG2_VLD, 0xee27417f, 0x5e28, 0x4e65, 0xbe, 0xea, 0x1d, 0x26, 0xb5, 0x08, 0xad, 0xc9)
 
 DEFINE_GUID (ff_DXVA2_ModeMPEG2and1_VLD, 0x86695f12, 0x340e, 0x4f04, 0x9f, 0xd3, 0x92, 0x53, 0xdd, 0x32, 0x74, 0x60)
 
 DEFINE_GUID (ff_DXVA2_ModeH264_E, 0x1b81be68, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5)
 
 DEFINE_GUID (ff_DXVA2_ModeH264_F, 0x1b81be69, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5)
 
 DEFINE_GUID (ff_DXVADDI_Intel_ModeH264_E, 0x604F8E68, 0x4951, 0x4C54, 0x88, 0xFE, 0xAB, 0xD2, 0x5C, 0x15, 0xB3, 0xD6)
 
 DEFINE_GUID (ff_DXVA2_ModeVC1_D, 0x1b81beA3, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5)
 
 DEFINE_GUID (ff_DXVA2_ModeVC1_D2010, 0x1b81beA4, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5)
 
 DEFINE_GUID (ff_DXVA2_ModeHEVC_VLD_Main, 0x5b11d51b, 0x2f4c, 0x4452, 0xbc, 0xc3, 0x09, 0xf2, 0xa1, 0x16, 0x0c, 0xc0)
 
 DEFINE_GUID (ff_DXVA2_ModeHEVC_VLD_Main10, 0x107af0e0, 0xef1a, 0x4d19, 0xab, 0xa8, 0x67, 0xa1, 0x63, 0x07, 0x3d, 0x13)
 
 DEFINE_GUID (ff_DXVA2_ModeVP9_VLD_Profile0, 0x463707f8, 0xa1d0, 0x4585, 0x87, 0x6d, 0x83, 0xaa, 0x6d, 0x60, 0xb8, 0x9e)
 
 DEFINE_GUID (ff_DXVA2_NoEncrypt, 0x1b81beD0, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5)
 
 DEFINE_GUID (ff_GUID_NULL, 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)
 
 DEFINE_GUID (ff_IID_IDirectXVideoDecoderService, 0xfc51a551, 0xd5e7, 0x11d9, 0xaf, 0x55, 0x00, 0x05, 0x4e, 0x43, 0xff, 0x02)
 
static int dxva_get_decoder_configuration (AVCodecContext *avctx, const void *cfg_list, unsigned cfg_count)
 
static int dxva_check_codec_compatibility (AVCodecContext *avctx, const dxva_mode *mode)
 
static void dxva_list_guids_debug (AVCodecContext *avctx, void *service, unsigned guid_count, const GUID *guid_list)
 
static int dxva_get_decoder_guid (AVCodecContext *avctx, void *service, void *surface_format, unsigned guid_count, const GUID *guid_list, GUID *decoder_guid)
 
static void bufref_free_interface (void *opaque, uint8_t *data)
 
static AVBufferRefbufref_wrap_interface (IUnknown *iface)
 
static void ff_dxva2_lock (AVCodecContext *avctx)
 
static void ff_dxva2_unlock (AVCodecContext *avctx)
 
int ff_dxva2_common_frame_params (AVCodecContext *avctx, AVBufferRef *hw_frames_ctx)
 
int ff_dxva2_decode_init (AVCodecContext *avctx)
 
int ff_dxva2_decode_uninit (AVCodecContext *avctx)
 
static voidget_surface (const AVCodecContext *avctx, const AVFrame *frame)
 
unsigned ff_dxva2_get_surface_index (const AVCodecContext *avctx, const AVDXVAContext *ctx, const AVFrame *frame)
 
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 frame_add_buf (AVFrame *frame, AVBufferRef *ref)
 
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))
 
int ff_dxva2_is_d3d11 (const AVCodecContext *avctx)
 

Variables

static const int prof_mpeg2_main []
 
static const int prof_h264_high []
 
static const int prof_hevc_main []
 
static const int prof_hevc_main10 []
 
static const dxva_mode dxva_modes []
 

Function Documentation

DEFINE_GUID ( ff_DXVA2_ModeMPEG2_VLD  ,
0xee27417f  ,
0x5e28  ,
0x4e65  ,
0xbe  ,
0xea  ,
0x1d  ,
0x26  ,
0xb5  ,
0x08  ,
0xad  ,
0xc9   
)
DEFINE_GUID ( ff_DXVA2_ModeMPEG2and1_VLD  ,
0x86695f12  ,
0x340e  ,
0x4f04  ,
0x9f  ,
0xd3  ,
0x92  ,
0x53  ,
0xdd  ,
0x32  ,
0x74  ,
0x60   
)
DEFINE_GUID ( ff_DXVA2_ModeH264_E  ,
0x1b81be68  ,
0xa0c7  ,
0x11d3  ,
0xb9  ,
0x84  ,
0x00  ,
0xc0  ,
0x4f  ,
0x2e  ,
0x73  ,
0xc5   
)
DEFINE_GUID ( ff_DXVA2_ModeH264_F  ,
0x1b81be69  ,
0xa0c7  ,
0x11d3  ,
0xb9  ,
0x84  ,
0x00  ,
0xc0  ,
0x4f  ,
0x2e  ,
0x73  ,
0xc5   
)
DEFINE_GUID ( ff_DXVADDI_Intel_ModeH264_E  ,
0x604F8E68  ,
0x4951  ,
0x4C54  ,
0x88  ,
0xFE  ,
0xAB  ,
0xD2  ,
0x5C  ,
0x15  ,
0xB3  ,
0xD6   
)
DEFINE_GUID ( ff_DXVA2_ModeVC1_D  ,
0x1b81beA3  ,
0xa0c7  ,
0x11d3  ,
0xb9  ,
0x84  ,
0x00  ,
0xc0  ,
0x4f  ,
0x2e  ,
0x73  ,
0xc5   
)
DEFINE_GUID ( ff_DXVA2_ModeVC1_D2010  ,
0x1b81beA4  ,
0xa0c7  ,
0x11d3  ,
0xb9  ,
0x84  ,
0x00  ,
0xc0  ,
0x4f  ,
0x2e  ,
0x73  ,
0xc5   
)
DEFINE_GUID ( ff_DXVA2_ModeHEVC_VLD_Main  ,
0x5b11d51b  ,
0x2f4c  ,
0x4452  ,
0xbc  ,
0xc3  ,
0x09  ,
0xf2  ,
0xa1  ,
0x16  ,
0x0c  ,
0xc0   
)
DEFINE_GUID ( ff_DXVA2_ModeHEVC_VLD_Main10  ,
0x107af0e0  ,
0xef1a  ,
0x4d19  ,
0xab  ,
0xa8  ,
0x67  ,
0xa1  ,
0x63  ,
0x07  ,
0x3d  ,
0x13   
)
DEFINE_GUID ( ff_DXVA2_ModeVP9_VLD_Profile0  ,
0x463707f8  ,
0xa1d0  ,
0x4585  ,
0x87  ,
0x6d  ,
0x83  ,
0xaa  ,
0x6d  ,
0x60  ,
0xb8  ,
0x9e   
)
DEFINE_GUID ( ff_DXVA2_NoEncrypt  ,
0x1b81beD0  ,
0xa0c7  ,
0x11d3  ,
0xb9  ,
0x84  ,
0x00  ,
0xc0  ,
0x4f  ,
0x2e  ,
0x73  ,
0xc5   
)
DEFINE_GUID ( ff_GUID_NULL  ,
0x00000000  ,
0x0000  ,
0x0000  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00   
)
DEFINE_GUID ( ff_IID_IDirectXVideoDecoderService  ,
0xfc51a551  ,
0xd5e7  ,
0x11d9  ,
0xaf  ,
0x55  ,
0x00  ,
0x05  ,
0x4e  ,
0x43  ,
0xff  ,
0x02   
)
static int dxva_get_decoder_configuration ( AVCodecContext avctx,
const void cfg_list,
unsigned  cfg_count 
)
static

Definition at line 98 of file dxva2.c.

static int dxva_check_codec_compatibility ( AVCodecContext avctx,
const dxva_mode mode 
)
static

Definition at line 183 of file dxva2.c.

Referenced by dxva_get_decoder_guid().

static void dxva_list_guids_debug ( AVCodecContext avctx,
void service,
unsigned  guid_count,
const GUID guid_list 
)
static

Definition at line 203 of file dxva2.c.

Referenced by dxva_get_decoder_guid().

static int dxva_get_decoder_guid ( AVCodecContext avctx,
void service,
void surface_format,
unsigned  guid_count,
const GUID guid_list,
GUID decoder_guid 
)
static

Definition at line 248 of file dxva2.c.

static void bufref_free_interface ( void opaque,
uint8_t data 
)
static

Definition at line 295 of file dxva2.c.

Referenced by bufref_wrap_interface().

static AVBufferRef* bufref_wrap_interface ( IUnknown *  iface)
static

Definition at line 300 of file dxva2.c.

static void ff_dxva2_lock ( AVCodecContext avctx)
static

Definition at line 548 of file dxva2.c.

Referenced by ff_dxva2_common_end_frame(), and ff_dxva2_decode_init().

static void ff_dxva2_unlock ( AVCodecContext avctx)
static

Definition at line 564 of file dxva2.c.

Referenced by ff_dxva2_common_end_frame(), and ff_dxva2_decode_init().

int ff_dxva2_common_frame_params ( AVCodecContext avctx,
AVBufferRef hw_frames_ctx 
)

Definition at line 580 of file dxva2.c.

int ff_dxva2_decode_init ( AVCodecContext avctx)

Definition at line 647 of file dxva2.c.

int ff_dxva2_decode_uninit ( AVCodecContext avctx)

Definition at line 722 of file dxva2.c.

Referenced by ff_dxva2_decode_init().

static void* get_surface ( const AVCodecContext avctx,
const AVFrame frame 
)
static

Definition at line 745 of file dxva2.c.

Referenced by ff_dxva2_common_end_frame(), and ff_dxva2_get_surface_index().

unsigned ff_dxva2_get_surface_index ( const AVCodecContext avctx,
const AVDXVAContext ctx,
const AVFrame frame 
)

Definition at line 762 of file dxva2.c.

Referenced by fill_picture_parameters(), and fill_slice_long().

int ff_dxva2_commit_buffer ( AVCodecContext avctx,
AVDXVAContext ctx,
DECODER_BUFFER_DESC dsc,
unsigned  type,
const void data,
unsigned  size,
unsigned  mb_count 
)

Definition at line 789 of file dxva2.c.

Referenced by commit_bitstream_and_slice_buffer(), and ff_dxva2_common_end_frame().

static int frame_add_buf ( AVFrame frame,
AVBufferRef ref 
)
static

Definition at line 862 of file dxva2.c.

Referenced by ff_dxva2_common_end_frame().

int ff_dxva2_common_end_frame ( AVCodecContext avctx,
AVFrame frame,
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 
)
int ff_dxva2_is_d3d11 ( const AVCodecContext avctx)

Variable Documentation

const int prof_mpeg2_main[]
static
Initial value:
#define FF_PROFILE_MPEG2_MAIN
Definition: avcodec.h:2839
#define FF_PROFILE_UNKNOWN
Definition: avcodec.h:2807
#define FF_PROFILE_MPEG2_SIMPLE
Definition: avcodec.h:2840

Definition at line 59 of file dxva2.c.

const int prof_h264_high[]
static
Initial value:
#define FF_PROFILE_H264_MAIN
Definition: avcodec.h:2847
#define FF_PROFILE_H264_HIGH
Definition: avcodec.h:2849
#define FF_PROFILE_UNKNOWN
Definition: avcodec.h:2807
#define FF_PROFILE_H264_CONSTRAINED_BASELINE
Definition: avcodec.h:2846

Definition at line 62 of file dxva2.c.

const int prof_hevc_main[]
static
Initial value:
#define FF_PROFILE_HEVC_MAIN
Definition: avcodec.h:2894
#define FF_PROFILE_UNKNOWN
Definition: avcodec.h:2807

Definition at line 66 of file dxva2.c.

const int prof_hevc_main10[]
static
Initial value:
#define FF_PROFILE_HEVC_MAIN_10
Definition: avcodec.h:2895
#define FF_PROFILE_UNKNOWN
Definition: avcodec.h:2807

Definition at line 68 of file dxva2.c.

const dxva_mode dxva_modes[]
static
Initial value:
= {
{ &ff_DXVA2_ModeMPEG2_VLD, AV_CODEC_ID_MPEG2VIDEO, prof_mpeg2_main },
{ &ff_DXVA2_ModeMPEG2and1_VLD, AV_CODEC_ID_MPEG2VIDEO, prof_mpeg2_main },
{ &ff_DXVA2_ModeH264_F, AV_CODEC_ID_H264, prof_h264_high },
{ &ff_DXVA2_ModeH264_E, AV_CODEC_ID_H264, prof_h264_high },
{ &ff_DXVADDI_Intel_ModeH264_E, AV_CODEC_ID_H264, prof_h264_high },
{ &ff_DXVA2_ModeVC1_D2010, AV_CODEC_ID_VC1 },
{ &ff_DXVA2_ModeVC1_D2010, AV_CODEC_ID_WMV3 },
{ &ff_DXVA2_ModeVC1_D, AV_CODEC_ID_VC1 },
{ &ff_DXVA2_ModeVC1_D, AV_CODEC_ID_WMV3 },
{ &ff_DXVA2_ModeHEVC_VLD_Main10, AV_CODEC_ID_HEVC, prof_hevc_main10 },
{ &ff_DXVA2_ModeHEVC_VLD_Main, AV_CODEC_ID_HEVC, prof_hevc_main },
{ &ff_DXVA2_ModeVP9_VLD_Profile0,AV_CODEC_ID_VP9 },
{ NULL, 0 },
}
#define NULL
Definition: coverity.c:32
static const int prof_hevc_main10[]
Definition: dxva2.c:68
preferred ID for MPEG-1/2 video decoding
Definition: avcodec.h:219
static const int prof_h264_high[]
Definition: dxva2.c:62
static const int prof_mpeg2_main[]
Definition: dxva2.c:59
static const int prof_hevc_main[]
Definition: dxva2.c:66

Definition at line 71 of file dxva2.c.