FFmpeg
Loading...
Searching...
No Matches
d3d12va_decode.c File Reference
#include <string.h>
#include <initguid.h>
#include "libavutil/common.h"
#include "libavutil/log.h"
#include "libavutil/mem.h"
#include "libavutil/time.h"
#include "libavutil/hwcontext_d3d12va_internal.h"
#include "libavutil/hwcontext_d3d12va.h"
#include "avcodec.h"
#include "decode.h"
#include "d3d12va_decode.h"
#include "dxva2_internal.h"

Go to the source code of this file.

Data Structures

struct  HelperObjects
 
struct  ReferenceFrame
 

Functions

static ID3D12Resource * get_reference_only_resource (AVCodecContext *avctx, ID3D12Resource *output_resource)
 
static void free_reference_only_resources (AVCodecContext *avctx)
 
static void prepare_reference_only_resources (AVCodecContext *avctx)
 
unsigned ff_d3d12va_get_surface_index (const AVCodecContext *avctx, D3D12VADecodeContext *ctx, const AVFrame *frame, int curr)
 
static int d3d12va_resize_bitstream_buffer (AVCodecContext *avctx, ID3D12Resource **ppBuffer, UINT64 bitstream_size)
 
static int d3d12va_get_valid_helper_objects (AVCodecContext *avctx, ID3D12CommandAllocator **ppAllocator, ID3D12Resource **ppBuffer, UINT64 bitstream_size)
 
static int d3d12va_discard_helper_objects (AVCodecContext *avctx, ID3D12CommandAllocator *pAllocator, ID3D12Resource *pBuffer, uint64_t fence_value)
 
static int d3d12va_fence_completion (AVD3D12VASyncContext *psync_ctx)
 
static void bufref_free_interface (void *opaque, uint8_t *data)
 
static AVBufferRefbufref_wrap_interface (IUnknown *iface)
 
static int d3d12va_sync_with_gpu (AVCodecContext *avctx)
 
static int d3d12va_create_decoder_heap (AVCodecContext *avctx)
 
static int d3d12va_create_decoder (AVCodecContext *avctx)
 
int ff_d3d12va_common_frame_params (AVCodecContext *avctx, AVBufferRef *hw_frames_ctx)
 d3d12va common frame params
 
av_cold int ff_d3d12va_decode_init (AVCodecContext *avctx)
 init D3D12VADecodeContext
 
av_cold int ff_d3d12va_decode_uninit (AVCodecContext *avctx)
 uninit D3D12VADecodeContext
 
static int d3d12va_update_reference_frames_state (AVCodecContext *avctx, D3D12_RESOURCE_BARRIER *barriers, ID3D12Resource *current_resource, int state_before, int state_end)
 
int ff_d3d12va_common_end_frame (AVCodecContext *avctx, AVFrame *frame, const void *pp, unsigned pp_size, const void *qm, unsigned qm_size, UINT64 bitstream_size, int(*update_input_arguments)(AVCodecContext *, D3D12_VIDEO_DECODE_INPUT_STREAM_ARGUMENTS *, ID3D12Resource *))
 d3d12va common end frame
 

Function Documentation

◆ get_reference_only_resource()

static ID3D12Resource * get_reference_only_resource ( AVCodecContext * avctx,
ID3D12Resource * output_resource )
static

Definition at line 49 of file d3d12va_decode.c.

Referenced by ff_d3d12va_common_end_frame().

◆ free_reference_only_resources()

static void free_reference_only_resources ( AVCodecContext * avctx)
static

Definition at line 113 of file d3d12va_decode.c.

Referenced by ff_d3d12va_decode_uninit().

◆ prepare_reference_only_resources()

static void prepare_reference_only_resources ( AVCodecContext * avctx)
static

Definition at line 129 of file d3d12va_decode.c.

Referenced by ff_d3d12va_common_end_frame().

◆ ff_d3d12va_get_surface_index()

unsigned ff_d3d12va_get_surface_index ( const AVCodecContext * avctx,
D3D12VADecodeContext * ctx,
const AVFrame * frame,
int curr )

Definition at line 149 of file d3d12va_decode.c.

Referenced by ff_dxva2_get_surface_index().

◆ d3d12va_resize_bitstream_buffer()

static int d3d12va_resize_bitstream_buffer ( AVCodecContext * avctx,
ID3D12Resource ** ppBuffer,
UINT64 bitstream_size )
static

Definition at line 186 of file d3d12va_decode.c.

Referenced by d3d12va_get_valid_helper_objects().

◆ d3d12va_get_valid_helper_objects()

static int d3d12va_get_valid_helper_objects ( AVCodecContext * avctx,
ID3D12CommandAllocator ** ppAllocator,
ID3D12Resource ** ppBuffer,
UINT64 bitstream_size )
static

Definition at line 231 of file d3d12va_decode.c.

Referenced by ff_d3d12va_common_end_frame(), and ff_d3d12va_decode_init().

◆ d3d12va_discard_helper_objects()

static int d3d12va_discard_helper_objects ( AVCodecContext * avctx,
ID3D12CommandAllocator * pAllocator,
ID3D12Resource * pBuffer,
uint64_t fence_value )
static

Definition at line 258 of file d3d12va_decode.c.

Referenced by ff_d3d12va_common_end_frame(), and ff_d3d12va_decode_init().

◆ d3d12va_fence_completion()

static int d3d12va_fence_completion ( AVD3D12VASyncContext * psync_ctx)
static

Definition at line 278 of file d3d12va_decode.c.

Referenced by d3d12va_sync_with_gpu(), and ff_d3d12va_common_end_frame().

◆ bufref_free_interface()

static void bufref_free_interface ( void * opaque,
uint8_t * data )
static

Definition at line 291 of file d3d12va_decode.c.

Referenced by bufref_wrap_interface(), and bufref_wrap_interface().

◆ bufref_wrap_interface()

static AVBufferRef * bufref_wrap_interface ( IUnknown * iface)
static

Definition at line 296 of file d3d12va_decode.c.

Referenced by d3d12va_create_decoder().

◆ d3d12va_sync_with_gpu()

static int d3d12va_sync_with_gpu ( AVCodecContext * avctx)
static

Definition at line 301 of file d3d12va_decode.c.

Referenced by ff_d3d12va_decode_init(), and ff_d3d12va_decode_uninit().

◆ d3d12va_create_decoder_heap()

static int d3d12va_create_decoder_heap ( AVCodecContext * avctx)
static

Definition at line 312 of file d3d12va_decode.c.

Referenced by ff_d3d12va_decode_init().

◆ d3d12va_create_decoder()

static int d3d12va_create_decoder ( AVCodecContext * avctx)
static

Definition at line 344 of file d3d12va_decode.c.

Referenced by ff_d3d12va_decode_init().

◆ ff_d3d12va_common_frame_params()

int ff_d3d12va_common_frame_params ( AVCodecContext * avctx,
AVBufferRef * hw_frames_ctx )

d3d12va common frame params

Returns
Error code (ret < 0 if failed)

Definition at line 404 of file d3d12va_decode.c.

◆ ff_d3d12va_decode_init()

av_cold int ff_d3d12va_decode_init ( AVCodecContext * avctx)

◆ ff_d3d12va_decode_uninit()

av_cold int ff_d3d12va_decode_uninit ( AVCodecContext * avctx)

uninit D3D12VADecodeContext

Returns
Error code (ret < 0 if failed)

Definition at line 508 of file d3d12va_decode.c.

Referenced by d3d12va_av1_decode_uninit(), and ff_d3d12va_decode_init().

◆ d3d12va_update_reference_frames_state()

static int d3d12va_update_reference_frames_state ( AVCodecContext * avctx,
D3D12_RESOURCE_BARRIER * barriers,
ID3D12Resource * current_resource,
int state_before,
int state_end )
inlinestatic

Definition at line 547 of file d3d12va_decode.c.

Referenced by ff_d3d12va_common_end_frame().

◆ ff_d3d12va_common_end_frame()

int ff_d3d12va_common_end_frame ( AVCodecContext * avctx,
AVFrame * frame,
const void * pp,
unsigned pp_size,
const void * qm,
unsigned qm_size,
UINT64 bitstream_size,
int(* update_input_arguments )(AVCodecContext *, D3D12_VIDEO_DECODE_INPUT_STREAM_ARGUMENTS *, ID3D12Resource *) )

d3d12va common end frame

Parameters
avctxcodec context
framecurrent output frame
pppicture parameters
pp_sizethe size of the picture parameters
qmquantization matrix
qm_sizethe size of the quantization matrix
bitstream_sizerequired compressed-bitstream upload-buffer capacity in bytes
callbackupdate decoder-specified input stream arguments
Returns
Error code (ret < 0 if failed)

Definition at line 571 of file d3d12va_decode.c.

Referenced by d3d12va_av1_end_frame(), d3d12va_h264_end_frame(), d3d12va_hevc_end_frame(), d3d12va_mpeg2_end_frame(), d3d12va_vc1_end_frame(), and d3d12va_vp9_end_frame().