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 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 int cuda_frames_init (AVHWFramesContext *ctx)
 
static int cuda_get_buffer (AVHWFramesContext *ctx, 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

static enum AVPixelFormat supported_formats []
 
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 60 of file hwcontext_cuda.c.

Function Documentation

◆ cuda_frames_get_constraints()

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

Definition at line 62 of file hwcontext_cuda.c.

◆ cuda_buffer_free()

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

Definition at line 87 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 103 of file hwcontext_cuda.c.

Referenced by cuda_frames_init().

◆ cuda_frames_init()

static int cuda_frames_init ( AVHWFramesContext ctx)
static

Definition at line 134 of file hwcontext_cuda.c.

◆ cuda_get_buffer()

static int cuda_get_buffer ( AVHWFramesContext ctx,
AVFrame frame 
)
static

Definition at line 182 of file hwcontext_cuda.c.

◆ cuda_transfer_get_formats()

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

Definition at line 211 of file hwcontext_cuda.c.

◆ cuda_transfer_data()

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

Definition at line 229 of file hwcontext_cuda.c.

◆ cuda_device_uninit()

static void cuda_device_uninit ( AVHWDeviceContext device_ctx)
static

Definition at line 289 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 311 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 333 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 388 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 425 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 465 of file hwcontext_cuda.c.

Variable Documentation

◆ supported_formats

enum AVPixelFormat supported_formats[]
static

◆ 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_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, AV_PIX_FMT_NONE },
}

Definition at line 563 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:465
cuda_transfer_get_formats
static int cuda_transfer_get_formats(AVHWFramesContext *ctx, enum AVHWFrameTransferDirection dir, enum AVPixelFormat **formats)
Definition: hwcontext_cuda.c:211
AV_PIX_FMT_BGR32
#define AV_PIX_FMT_BGR32
Definition: pixfmt.h:477
CUDAFramesContext
Definition: hwcontext_cuda.c:33
AV_HWDEVICE_TYPE_CUDA
@ AV_HWDEVICE_TYPE_CUDA
Definition: hwcontext.h:30
AV_PIX_FMT_YUVA420P
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:108
AV_PIX_FMT_YUV444P16
#define AV_PIX_FMT_YUV444P16
Definition: pixfmt.h:515
AV_PIX_FMT_0BGR32
#define AV_PIX_FMT_0BGR32
Definition: pixfmt.h:480
cuda_device_init
static int cuda_device_init(AVHWDeviceContext *ctx)
Definition: hwcontext_cuda.c:311
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:73
cuda_transfer_data
static int cuda_transfer_data(AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *src)
Definition: hwcontext_cuda.c:229
AV_PIX_FMT_RGB32
#define AV_PIX_FMT_RGB32
Definition: pixfmt.h:475
cuda_device_uninit
static void cuda_device_uninit(AVHWDeviceContext *device_ctx)
Definition: hwcontext_cuda.c:289
AV_PIX_FMT_P016
#define AV_PIX_FMT_P016
Definition: pixfmt.h:554
AV_PIX_FMT_NV12
@ AV_PIX_FMT_NV12
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
Definition: pixfmt.h:96
AV_PIX_FMT_0RGB32
#define AV_PIX_FMT_0RGB32
Definition: pixfmt.h:479
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:425
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:78
cuda_get_buffer
static int cuda_get_buffer(AVHWFramesContext *ctx, AVFrame *frame)
Definition: hwcontext_cuda.c:182
AV_PIX_FMT_P010
#define AV_PIX_FMT_P010
Definition: pixfmt.h:552
CUDADeviceContext
Definition: hwcontext_cuda.c:38
cuda_frames_get_constraints
static int cuda_frames_get_constraints(AVHWDeviceContext *ctx, const void *hwconfig, AVHWFramesConstraints *constraints)
Definition: hwcontext_cuda.c:62
cuda_frames_init
static int cuda_frames_init(AVHWFramesContext *ctx)
Definition: hwcontext_cuda.c:134