FFmpeg
Data Structures | Macros | Functions | Variables
vulkan_decode.c File Reference
#include "libavutil/refstruct.h"
#include "vulkan_video.h"
#include "vulkan_decode.h"
#include "config_components.h"
#include "libavutil/avassert.h"
#include "libavutil/mem.h"
#include "libavutil/vulkan_loader.h"

Go to the source code of this file.

Data Structures

 

Macros

 

Functions

 
static const VkVideoProfileInfoKHR *  get_video_profile (FFVulkanDecodeShared *ctx, enum AVCodecID codec_id)
 
  Synchronize the contexts between 2 threads. More...
 
int  ff_vk_params_invalidate (AVCodecContext *avctx, int t, const uint8_t *b, uint32_t s)
  Removes current session parameters to recreate them. More...
 
 
 
int  ff_vk_decode_prepare_frame (FFVulkanDecodeContext *dec, AVFrame *pic, FFVulkanDecodePicture *vkpic, int is_current, int alloc_dpb)
  Prepare a frame, creates the image view, and sets up the dpb fields. More...
 
int  ff_vk_decode_prepare_frame_sdr (FFVulkanDecodeContext *dec, AVFrame *pic, FFVulkanDecodePicture *vkpic, int is_current, enum FFVkShaderRepFormat rep_fmt, int alloc_dpb)
  Software-defined decoder version of ff_vk_decode_prepare_frame. More...
 
int  ff_vk_decode_add_slice (AVCodecContext *avctx, FFVulkanDecodePicture *vp, const uint8_t *data, size_t size, int add_startcode, uint32_t *nb_slices, const uint32_t **offsets)
  Add slice data to frame. More...
 
  Flush decoder. More...
 
  Decode a frame. More...
 
  Free a frame and its state. More...
 
static void  free_common (AVRefStructOpaque unused, void *obj)
 
static int  vulkan_decode_bootstrap (AVCodecContext *avctx, AVBufferRef *frames_ref)
 
static VkResult  vulkan_setup_profile (AVCodecContext *avctx, FFVulkanDecodeProfileData *prof, AVVulkanDeviceContext *hwctx, FFVulkanFunctions *vk, const FFVulkanDecodeDescriptor *vk_desc, VkVideoDecodeH264CapabilitiesKHR *h264_caps, VkVideoDecodeH265CapabilitiesKHR *h265_caps, VkVideoDecodeAV1CapabilitiesKHR *av1_caps, VkVideoCapabilitiesKHR *caps, VkVideoDecodeCapabilitiesKHR *dec_caps, int cur_profile)
 
static int  vulkan_decode_get_profile (AVCodecContext *avctx, AVBufferRef *frames_ref, enum AVPixelFormat *pix_fmt, VkFormat *vk_fmt, FFVulkanDecodeProfileData *prof, int *dpb_dedicate)
 
static void  free_profile_data (AVHWFramesContext *hwfc)
 
int  ff_vk_frame_params (AVCodecContext *avctx, AVBufferRef *hw_frames_ctx)
  Initialize hw_frames_ctx with the parameters needed to decode the stream using the parameters from avctx. More...
 
static void  vk_decode_free_params (void *opaque, uint8_t *data)
 
int  ff_vk_decode_create_params (AVBufferRef **par_ref, void *logctx, FFVulkanDecodeShared *ctx, const VkVideoSessionParametersCreateInfoKHR *session_params_create)
  Create VkVideoSessionParametersKHR wrapped in an AVBufferRef. More...
 
  Free decoder. More...
 
 
  Initialize decoder. More...
 

Variables

static const FFVulkanDecodeDescriptordec_descs []
 

Macro Definition Documentation

DECODER_IS_SDR

#define DECODER_IS_SDR (   codec_id )
Value:

Definition at line 27 of file vulkan_decode.c.

Function Documentation

get_codecdesc()

static const FFVulkanDecodeDescriptor* get_codecdesc ( enum AVCodecID  codec_id )
static

Definition at line 91 of file vulkan_decode.c.

Referenced by ff_vk_decode_flush(), ff_vk_decode_init(), vulkan_decode_bootstrap(), and vulkan_decode_get_profile().

get_video_profile()

static const VkVideoProfileInfoKHR* get_video_profile ( FFVulkanDecodeSharedctx,
enum AVCodecID  codec_id 
)
static

Definition at line 100 of file vulkan_decode.c.

Referenced by ff_vk_decode_init().

ff_vk_update_thread_context()

int ff_vk_update_thread_context ( AVCodecContextdst,
const AVCodecContextsrc 
)

Synchronize the contexts between 2 threads.

Definition at line 127 of file vulkan_decode.c.

ff_vk_params_invalidate()

int ff_vk_params_invalidate ( AVCodecContextavctx,
int  t,
const uint8_t *  b,
uint32_t  s 
)

Removes current session parameters to recreate them.

Definition at line 145 of file vulkan_decode.c.

vk_get_dpb_pool()

static AVFrame* vk_get_dpb_pool ( FFVulkanDecodeSharedctx )
static

Definition at line 152 of file vulkan_decode.c.

Referenced by ff_vk_decode_init(), ff_vk_decode_prepare_frame(), and ff_vk_decode_prepare_frame_sdr().

init_frame()

static void init_frame ( FFVulkanDecodeContextdec,
FFVulkanDecodePicturevkpic 
)
static

Definition at line 166 of file vulkan_decode.c.

Referenced by ff_vk_decode_prepare_frame(), and ff_vk_decode_prepare_frame_sdr().

ff_vk_decode_prepare_frame()

int ff_vk_decode_prepare_frame ( FFVulkanDecodeContextdec,
AVFramepic,
int  is_current,
int  alloc_dpb 
)

Prepare a frame, creates the image view, and sets up the dpb fields.

Definition at line 183 of file vulkan_decode.c.

Referenced by vk_av1_fill_pict(), vk_h264_fill_pict(), vk_hevc_fill_pict(), and vk_vp9_fill_pict().

ff_vk_decode_prepare_frame_sdr()

int ff_vk_decode_prepare_frame_sdr ( FFVulkanDecodeContextdec,
AVFramepic,
int  is_current,
enum FFVkShaderRepFormat  rep_fmt,
int  alloc_dpb 
)

Software-defined decoder version of ff_vk_decode_prepare_frame.

Definition at line 240 of file vulkan_decode.c.

Referenced by vk_ffv1_start_frame(), vk_prores_raw_start_frame(), and vk_prores_start_frame().

ff_vk_decode_add_slice()

int ff_vk_decode_add_slice ( AVCodecContextavctx,
const uint8_t *  data,
size_t  size,
int  add_startcode,
uint32_t *  nb_slices,
const uint32_t **  offsets 
)

Add slice data to frame.

Definition at line 287 of file vulkan_decode.c.

Referenced by vk_av1_decode_slice(), vk_ffv1_decode_slice(), vk_h264_decode_slice(), vk_hevc_decode_slice(), vk_prores_decode_slice(), vk_prores_raw_decode_slice(), and vk_vp9_decode_slice().

ff_vk_decode_flush()

void ff_vk_decode_flush ( AVCodecContextavctx )

Flush decoder.

Definition at line 368 of file vulkan_decode.c.

Referenced by ff_vk_decode_init().

ff_vk_decode_frame()

int ff_vk_decode_frame ( AVCodecContextavctx,
AVFramepic,
AVFramerpic[],
FFVulkanDecodePicturervkp[] 
)

Decode a frame.

Definition at line 404 of file vulkan_decode.c.

Referenced by vk_av1_end_frame(), vk_h264_end_frame(), vk_hevc_end_frame(), and vk_vp9_end_frame().

ff_vk_decode_free_frame()

void ff_vk_decode_free_frame ( AVHWDeviceContextdev_ctx,
)

Free a frame and its state.

Definition at line 610 of file vulkan_decode.c.

Referenced by vk_av1_free_frame_priv(), vk_ffv1_free_frame_priv(), vk_h264_free_frame_priv(), vk_hevc_free_frame_priv(), vk_prores_free_frame_priv(), vk_prores_raw_free_frame_priv(), and vk_vp9_free_frame_priv().

free_common()

static void free_common ( AVRefStructOpaque  unused,
void *  obj 
)
static

Definition at line 643 of file vulkan_decode.c.

Referenced by vulkan_decode_bootstrap().

vulkan_decode_bootstrap()

static int vulkan_decode_bootstrap ( AVCodecContextavctx,
AVBufferRefframes_ref 
)
static

Definition at line 671 of file vulkan_decode.c.

Referenced by ff_vk_frame_params().

vulkan_setup_profile()

static VkResult vulkan_setup_profile ( AVCodecContextavctx,
const FFVulkanDecodeDescriptorvk_desc,
VkVideoDecodeH264CapabilitiesKHR *  h264_caps,
VkVideoDecodeH265CapabilitiesKHR *  h265_caps,
VkVideoDecodeAV1CapabilitiesKHR *  av1_caps,
VkVideoCapabilitiesKHR *  caps,
VkVideoDecodeCapabilitiesKHR *  dec_caps,
int  cur_profile 
)
static

Definition at line 712 of file vulkan_decode.c.

Referenced by vulkan_decode_get_profile().

vulkan_decode_get_profile()

static int vulkan_decode_get_profile ( AVCodecContextavctx,
AVBufferRefframes_ref,
enum AVPixelFormatpix_fmt,
VkFormatvk_fmt,
int *  dpb_dedicate 
)
static

Definition at line 800 of file vulkan_decode.c.

Referenced by ff_vk_frame_params().

free_profile_data()

static void free_profile_data ( AVHWFramesContexthwfc )
static

Definition at line 1077 of file vulkan_decode.c.

Referenced by ff_vk_frame_params().

ff_vk_frame_params()

int ff_vk_frame_params ( AVCodecContextavctx,
AVBufferRefhw_frames_ctx 
)

Initialize hw_frames_ctx with the parameters needed to decode the stream using the parameters from avctx.

NOTE: if avctx->internal->hwaccel_priv_data exists, will partially initialize the context.

Definition at line 1082 of file vulkan_decode.c.

vk_decode_free_params()

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

Definition at line 1160 of file vulkan_decode.c.

Referenced by ff_vk_decode_create_params().

ff_vk_decode_create_params()

int ff_vk_decode_create_params ( AVBufferRef **  par_ref,
void *  logctx,
const VkVideoSessionParametersCreateInfoKHR *  session_params_create 
)

Create VkVideoSessionParametersKHR wrapped in an AVBufferRef.

Definition at line 1170 of file vulkan_decode.c.

Referenced by vk_av1_create_params(), vk_h264_create_params(), and vk_hevc_create_params().

ff_vk_decode_uninit()

int ff_vk_decode_uninit ( AVCodecContextavctx )

Free decoder.

Definition at line 1199 of file vulkan_decode.c.

Referenced by ff_vk_decode_init().

create_empty_session_parameters()

static int create_empty_session_parameters ( AVCodecContextavctx,
)
static

Definition at line 1210 of file vulkan_decode.c.

Referenced by ff_vk_decode_init().

ff_vk_decode_init()

int ff_vk_decode_init ( AVCodecContextavctx )

Initialize decoder.

Definition at line 1251 of file vulkan_decode.c.

Referenced by vk_decode_ffv1_init(), vk_decode_prores_init(), and vk_decode_prores_raw_init().

Variable Documentation

dec_descs

const FFVulkanDecodeDescriptor* dec_descs[]
static
Initial value:
= {
}

Definition at line 54 of file vulkan_decode.c.

Referenced by get_codecdesc().

AV_CODEC_ID_PRORES_RAW
@ AV_CODEC_ID_PRORES_RAW
Definition: codec_id.h:333
codec_id
enum AVCodecID codec_id
Definition: vaapi_decode.c:410
AV_CODEC_ID_FFV1
@ AV_CODEC_ID_FFV1
Definition: codec_id.h:85
AV_CODEC_ID_PRORES
@ AV_CODEC_ID_PRORES
Definition: codec_id.h:200

Generated on Wed Nov 19 2025 19:23:51 for FFmpeg by   doxygen 1.8.17

AltStyle によって変換されたページ (->オリジナル) /