FFmpeg
Data Structures | Macros | Functions | Variables
hwcontext_cuda.c File Reference
#include "buffer.h"
#include "common.h"
#include "hwcontext.h"
#include "hwcontext_internal.h"
#include "hwcontext_cuda_internal.h"
#include "cuda_check.h"
#include "mem.h"
#include "pixdesc.h"
#include "pixfmt.h"
#include "imgutils.h"

Go to the source code of this file.

Data Structures

struct  CUDAFramesContext
 
struct  CUDADeviceContext
 

Macros

#define CHECK_CU(x)   FF_CUDA_CHECK_DL(device_ctx, cu, x)
 

Functions

static CUarray_format cuda_array_format_for_pix_fmt (enum AVPixelFormat fmt)
 
static int cuda_frames_get_constraints (AVHWDeviceContext *ctx, const void *hwconfig, AVHWFramesConstraints *constraints)
 
static void cuda_buffer_free (void *opaque, uint8_t *data)
 
static AVBufferRefcuda_pool_alloc (void *opaque, size_t size)
 
static void cuda_frames_uninit (AVHWFramesContext *ctx)
 
static int cuda_frames_init (AVHWFramesContext *ctx)
 
static int cuda_get_buffer (AVHWFramesContext *ctx, AVFrame *frame)
 
static enum AVPixelFormat cuda_frame_hw_format (const AVFrame *frame)
 
static int cuda_transfer_get_formats (AVHWFramesContext *ctx, enum AVHWFrameTransferDirection dir, enum AVPixelFormat **formats)
 
static int cuda_transfer_data (AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *src)
 
static void cuda_device_uninit (AVHWDeviceContext *device_ctx)
 
static int cuda_device_init (AVHWDeviceContext *ctx)
 
static int cuda_context_init (AVHWDeviceContext *device_ctx, int flags)
 
static int cuda_flags_from_opts (AVHWDeviceContext *device_ctx, AVDictionary *opts, int *flags)
 
static int cuda_device_create (AVHWDeviceContext *device_ctx, const char *device, AVDictionary *opts, int flags)
 
static int cuda_device_derive (AVHWDeviceContext *device_ctx, AVHWDeviceContext *src_ctx, AVDictionary *opts, int flags)
 

Variables

const HWContextType ff_hwcontext_type_cuda
 

Macro Definition Documentation

◆ CHECK_CU

#define CHECK_CU (   x)    FF_CUDA_CHECK_DL(device_ctx, cu, x)

Definition at line 49 of file hwcontext_cuda.c.

Function Documentation

◆ cuda_array_format_for_pix_fmt()

static CUarray_format cuda_array_format_for_pix_fmt ( enum AVPixelFormat  fmt)
static

Definition at line 222 of file hwcontext_cuda.c.

Referenced by cuda_frames_get_constraints(), and cuda_frames_init().

◆ cuda_frames_get_constraints()

static int cuda_frames_get_constraints ( AVHWDeviceContext ctx,
const void *  hwconfig,
AVHWFramesConstraints constraints 
)
static

Definition at line 53 of file hwcontext_cuda.c.

◆ cuda_buffer_free()

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

Definition at line 110 of file hwcontext_cuda.c.

Referenced by cuda_pool_alloc().

◆ cuda_pool_alloc()

static AVBufferRef* cuda_pool_alloc ( void *  opaque,
size_t  size 
)
static

Definition at line 132 of file hwcontext_cuda.c.

Referenced by cuda_frames_init().

◆ cuda_frames_uninit()

static void cuda_frames_uninit ( AVHWFramesContext ctx)
static

Definition at line 199 of file hwcontext_cuda.c.

Referenced by cuda_frames_init().

◆ cuda_frames_init()

static int cuda_frames_init ( AVHWFramesContext ctx)
static

Definition at line 269 of file hwcontext_cuda.c.

◆ cuda_get_buffer()

static int cuda_get_buffer ( AVHWFramesContext ctx,
AVFrame frame 
)
static

Definition at line 398 of file hwcontext_cuda.c.

◆ cuda_frame_hw_format()

static enum AVPixelFormat cuda_frame_hw_format ( const AVFrame frame)
static

Definition at line 498 of file hwcontext_cuda.c.

Referenced by cuda_transfer_data().

◆ cuda_transfer_get_formats()

static int cuda_transfer_get_formats ( AVHWFramesContext ctx,
enum AVHWFrameTransferDirection  dir,
enum AVPixelFormat **  formats 
)
static

Definition at line 505 of file hwcontext_cuda.c.

◆ cuda_transfer_data()

static int cuda_transfer_data ( AVHWFramesContext ctx,
AVFrame dst,
const AVFrame src 
)
static

Definition at line 523 of file hwcontext_cuda.c.

◆ cuda_device_uninit()

static void cuda_device_uninit ( AVHWDeviceContext device_ctx)
static

Definition at line 657 of file hwcontext_cuda.c.

Referenced by cuda_device_create(), cuda_device_derive(), and cuda_device_init().

◆ cuda_device_init()

static int cuda_device_init ( AVHWDeviceContext ctx)
static

Definition at line 679 of file hwcontext_cuda.c.

Referenced by cuda_device_create(), and cuda_device_derive().

◆ cuda_context_init()

static int cuda_context_init ( AVHWDeviceContext device_ctx,
int  flags 
)
static

Definition at line 701 of file hwcontext_cuda.c.

Referenced by cuda_device_create(), and cuda_device_derive().

◆ cuda_flags_from_opts()

static int cuda_flags_from_opts ( AVHWDeviceContext device_ctx,
AVDictionary opts,
int *  flags 
)
static

Definition at line 756 of file hwcontext_cuda.c.

Referenced by cuda_device_create(), and cuda_device_derive().

◆ cuda_device_create()

static int cuda_device_create ( AVHWDeviceContext device_ctx,
const char *  device,
AVDictionary opts,
int  flags 
)
static

Definition at line 793 of file hwcontext_cuda.c.

◆ cuda_device_derive()

static int cuda_device_derive ( AVHWDeviceContext device_ctx,
AVHWDeviceContext src_ctx,
AVDictionary opts,
int  flags 
)
static

Definition at line 833 of file hwcontext_cuda.c.

Variable Documentation

◆ ff_hwcontext_type_cuda

const HWContextType ff_hwcontext_type_cuda
Initial value:
= {
.name = "CUDA",
.device_hwctx_size = sizeof(CUDADeviceContext),
.frames_hwctx_size = sizeof(CUDAFramesContext),
.device_create = cuda_device_create,
.device_derive = cuda_device_derive,
.device_init = cuda_device_init,
.device_uninit = cuda_device_uninit,
.frames_get_constraints = cuda_frames_get_constraints,
.frames_init = cuda_frames_init,
.frames_uninit = cuda_frames_uninit,
.frames_get_buffer = cuda_get_buffer,
.transfer_get_formats = cuda_transfer_get_formats,
.transfer_data_to = cuda_transfer_data,
.transfer_data_from = cuda_transfer_data,
.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_CUDA,
}

Definition at line 932 of file hwcontext_cuda.c.

AV_PIX_FMT_CUDA
@ AV_PIX_FMT_CUDA
HW acceleration through CUDA.
Definition: pixfmt.h:260
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
cuda_device_derive
static int cuda_device_derive(AVHWDeviceContext *device_ctx, AVHWDeviceContext *src_ctx, AVDictionary *opts, int flags)
Definition: hwcontext_cuda.c:833
cuda_transfer_get_formats
static int cuda_transfer_get_formats(AVHWFramesContext *ctx, enum AVHWFrameTransferDirection dir, enum AVPixelFormat **formats)
Definition: hwcontext_cuda.c:505
CUDAFramesContext
Definition: hwcontext_cuda.c:33
AV_HWDEVICE_TYPE_CUDA
@ AV_HWDEVICE_TYPE_CUDA
Definition: hwcontext.h:30
cuda_device_init
static int cuda_device_init(AVHWDeviceContext *ctx)
Definition: hwcontext_cuda.c:679
cuda_transfer_data
static int cuda_transfer_data(AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *src)
Definition: hwcontext_cuda.c:523
cuda_device_uninit
static void cuda_device_uninit(AVHWDeviceContext *device_ctx)
Definition: hwcontext_cuda.c:657
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
cuda_device_create
static int cuda_device_create(AVHWDeviceContext *device_ctx, const char *device, AVDictionary *opts, int flags)
Definition: hwcontext_cuda.c:793
cuda_get_buffer
static int cuda_get_buffer(AVHWFramesContext *ctx, AVFrame *frame)
Definition: hwcontext_cuda.c:398
CUDADeviceContext
Definition: hwcontext_cuda.c:42
cuda_frames_get_constraints
static int cuda_frames_get_constraints(AVHWDeviceContext *ctx, const void *hwconfig, AVHWFramesConstraints *constraints)
Definition: hwcontext_cuda.c:53
cuda_frames_init
static int cuda_frames_init(AVHWFramesContext *ctx)
Definition: hwcontext_cuda.c:269
cuda_frames_uninit
static void cuda_frames_uninit(AVHWFramesContext *ctx)
Definition: hwcontext_cuda.c:199