FFmpeg
Loading...
Searching...
No Matches
vf_pad_cuda.c File Reference

CUDA video padding filter. More...

Go to the source code of this file.

Data Structures

struct  CUDAPadContext
 

Macros

#define CHECK_CU(x)
 
#define DIV_UP(a, b)
 
#define BLOCK_X   32
 
#define BLOCK_Y   16
 
#define OFFSET(x)
 
#define FLAGS   (AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
 

Enumerations

enum  {
  VAR_IN_W , VAR_IW , VAR_IN_H , VAR_IH ,
  VAR_OUT_W , VAR_OW , VAR_OUT_H , VAR_OH ,
  VAR_X , VAR_Y , VAR_A , VAR_SAR ,
  VAR_DAR , VAR_HSUB , VAR_VSUB , VARS_NB
}
 
enum  EvalMode { EVAL_MODE_INIT , EVAL_MODE_FRAME , EVAL_MODE_NB }
 

Functions

static int eval_expr (AVFilterContext *ctx)
 
static int cuda_pad_alloc_out_frames_ctx (AVFilterContext *ctx, AVBufferRef **out_frames_ctx, const int width, const int height)
 
static av_cold int cuda_pad_init (AVFilterContext *ctx)
 
static av_cold void cuda_pad_uninit (AVFilterContext *ctx)
 
static av_cold int cuda_pad_load_functions (AVFilterContext *ctx)
 
static int cuda_pad_config_props (AVFilterLink *outlink)
 
static int cuda_pad_pad (AVFilterContext *ctx, AVFrame *out, const AVFrame *in)
 
static int cuda_pad_filter_frame (AVFilterLink *inlink, AVFrame *in)
 

Variables

static enum AVPixelFormat supported_formats []
 
static const char *const var_names []
 
static const AVOption cuda_pad_options []
 
static const AVClass cuda_pad_class
 
static const AVFilterPad cuda_pad_inputs []
 
static const AVFilterPad cuda_pad_outputs []
 
const FFFilter ff_vf_pad_cuda
 

Detailed Description

CUDA video padding filter.

Definition in file vf_pad_cuda.c.

Macro Definition Documentation

◆ CHECK_CU

#define CHECK_CU ( x)
Value:
FF_CUDA_CHECK_DL(ctx, device_hwctx->internal->cuda_dl, x)
static AVFormatContext * ctx
#define FF_CUDA_CHECK_DL(avclass, cudl, x)
Convenience wrapper for ff_cuda_check when dynamically loading cuda symbols.
Definition cuda_check.h:65

Definition at line 41 of file vf_pad_cuda.c.

Referenced by cuda_pad_filter_frame(), cuda_pad_load_functions(), cuda_pad_pad(), and cuda_pad_uninit().

◆ DIV_UP

#define DIV_UP ( a,
b )
Value:
( ((a) + (b) - 1) / (b) )
int a
#define b
Definition input.c:43

Definition at line 42 of file vf_pad_cuda.c.

Referenced by cuda_pad_pad().

◆ BLOCK_X

#define BLOCK_X   32

Definition at line 43 of file vf_pad_cuda.c.

◆ BLOCK_Y

#define BLOCK_Y   16

Definition at line 44 of file vf_pad_cuda.c.

◆ OFFSET

#define OFFSET ( x)
Value:

Definition at line 584 of file vf_pad_cuda.c.

◆ FLAGS

Definition at line 585 of file vf_pad_cuda.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
VAR_IN_W 
VAR_IW 
VAR_IN_H 
VAR_IH 
VAR_OUT_W 
VAR_OW 
VAR_OUT_H 
VAR_OH 
VAR_X 
VAR_Y 
VAR_A 
VAR_SAR 
VAR_DAR 
VAR_HSUB 
VAR_VSUB 
VARS_NB 

Definition at line 97 of file vf_pad_cuda.c.

◆ EvalMode

enum EvalMode
Enumerator
EVAL_MODE_INIT 
EVAL_MODE_FRAME 
EVAL_MODE_NB 

Definition at line 116 of file vf_pad_cuda.c.

Function Documentation

◆ eval_expr()

static int eval_expr ( AVFilterContext * ctx)
static

Definition at line 122 of file vf_pad_cuda.c.

Referenced by cuda_pad_config_props(), and cuda_pad_filter_frame().

◆ cuda_pad_alloc_out_frames_ctx()

static int cuda_pad_alloc_out_frames_ctx ( AVFilterContext * ctx,
AVBufferRef ** out_frames_ctx,
const int width,
const int height )
static

Definition at line 239 of file vf_pad_cuda.c.

Referenced by cuda_pad_config_props(), and cuda_pad_filter_frame().

◆ cuda_pad_init()

static av_cold int cuda_pad_init ( AVFilterContext * ctx)
static

Definition at line 268 of file vf_pad_cuda.c.

◆ cuda_pad_uninit()

static av_cold void cuda_pad_uninit ( AVFilterContext * ctx)
static

Definition at line 278 of file vf_pad_cuda.c.

◆ cuda_pad_load_functions()

static av_cold int cuda_pad_load_functions ( AVFilterContext * ctx)
static

Definition at line 297 of file vf_pad_cuda.c.

Referenced by cuda_pad_config_props().

◆ cuda_pad_config_props()

static int cuda_pad_config_props ( AVFilterLink * outlink)
static

Definition at line 336 of file vf_pad_cuda.c.

◆ cuda_pad_pad()

static int cuda_pad_pad ( AVFilterContext * ctx,
AVFrame * out,
const AVFrame * in )
static

Definition at line 403 of file vf_pad_cuda.c.

Referenced by cuda_pad_filter_frame().

◆ cuda_pad_filter_frame()

static int cuda_pad_filter_frame ( AVFilterLink * inlink,
AVFrame * in )
static

Definition at line 479 of file vf_pad_cuda.c.

Variable Documentation

◆ supported_formats

enum AVPixelFormat supported_formats[]
static
Initial value:
= {
}
@ 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_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition pixfmt.h:73
@ 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_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition pixfmt.h:78
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition pixfmt.h:174

Definition at line 46 of file vf_pad_cuda.c.

◆ var_names

const char* const var_names[]
static
Initial value:
= {
"in_w", "iw",
"in_h", "ih",
"out_w", "ow",
"out_h", "oh",
"x",
"y",
"a",
"sar",
"dar",
"hsub",
"vsub",
}
#define NULL
Definition coverity.c:32

Definition at line 82 of file vf_pad_cuda.c.

◆ cuda_pad_options

const AVOption cuda_pad_options[]
static
Initial value:
= {
{ "width", "set the pad area width expression", OFFSET(w_expr), AV_OPT_TYPE_STRING, {.str = "iw"}, 0, 0, FLAGS },
{ "w", "set the pad area width expression", OFFSET(w_expr), AV_OPT_TYPE_STRING, {.str = "iw"}, 0, 0, FLAGS },
{ "height", "set the pad area height expression", OFFSET(h_expr), AV_OPT_TYPE_STRING, {.str = "ih"}, 0, 0, FLAGS },
{ "h", "set the pad area height expression", OFFSET(h_expr), AV_OPT_TYPE_STRING, {.str = "ih"}, 0, 0, FLAGS },
{ "x", "set the x offset expression for the input image position", OFFSET(x_expr), AV_OPT_TYPE_STRING, {.str = "0"}, 0, 0, FLAGS },
{ "y", "set the y offset expression for the input image position", OFFSET(y_expr), AV_OPT_TYPE_STRING, {.str = "0"}, 0, 0, FLAGS },
{ "color", "set the color of the padded area border", OFFSET(rgba_color), AV_OPT_TYPE_COLOR, {.str = "black"}, .flags = FLAGS },
{ "eval", "specify when to evaluate expressions", OFFSET(eval_mode), AV_OPT_TYPE_INT, {.i64 = EVAL_MODE_INIT}, 0, EVAL_MODE_NB-1, FLAGS, .unit = "eval" },
{ "init", "eval expressions once during initialization", 0, AV_OPT_TYPE_CONST, {.i64=EVAL_MODE_INIT}, .flags = FLAGS, .unit = "eval" },
{ "frame", "eval expressions during initialization and per-frame", 0, AV_OPT_TYPE_CONST, {.i64=EVAL_MODE_FRAME}, .flags = FLAGS, .unit = "eval" },
{ "aspect", "pad to fit an aspect instead of a resolution", OFFSET(aspect), AV_OPT_TYPE_RATIONAL, {.dbl = 0}, 0, DBL_MAX, FLAGS },
{ NULL }
}
@ EVAL_MODE_NB
Definition af_volume.h:42
@ EVAL_MODE_FRAME
Definition af_volume.h:41
#define FLAGS
Definition cmdutils.c:598
#define OFFSET(x)
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition opt.h:298
@ AV_OPT_TYPE_RATIONAL
Underlying C type is AVRational.
Definition opt.h:279
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition opt.h:275
@ AV_OPT_TYPE_COLOR
Underlying C type is uint8_t[4].
Definition opt.h:322
@ EVAL_MODE_INIT
Definition vf_fftfilt.c:41

Definition at line 587 of file vf_pad_cuda.c.

◆ cuda_pad_class

const AVClass cuda_pad_class
static
Initial value:
= {
.class_name = "pad_cuda",
.item_name = av_default_item_name,
.option = cuda_pad_options,
}
const char * av_default_item_name(void *ptr)
Return the context name.
Definition log.c:241
#define LIBAVUTIL_VERSION_INT
Definition version.h:85
static const AVOption cuda_pad_options[]

Definition at line 602 of file vf_pad_cuda.c.

◆ cuda_pad_inputs

const AVFilterPad cuda_pad_inputs[]
static
Initial value:
= {{
.name = "default",
.filter_frame = cuda_pad_filter_frame
}}
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
static int cuda_pad_filter_frame(AVFilterLink *inlink, AVFrame *in)

Definition at line 609 of file vf_pad_cuda.c.

◆ cuda_pad_outputs

const AVFilterPad cuda_pad_outputs[]
static
Initial value:
= {{
.name = "default",
.config_props = cuda_pad_config_props,
}}
static int cuda_pad_config_props(AVFilterLink *outlink)

Definition at line 615 of file vf_pad_cuda.c.

◆ ff_vf_pad_cuda

const FFFilter ff_vf_pad_cuda
Initial value:
= {
.p.name = "pad_cuda",
.p.description = NULL_IF_CONFIG_SMALL("CUDA-based GPU padding filter"),
.init = cuda_pad_init,
.uninit = cuda_pad_uninit,
.p.priv_class = &cuda_pad_class,
.priv_size = sizeof(CUDAPadContext),
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
}
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_OUTPUTS(array)
Definition filters.h:265
#define FF_FILTER_FLAG_HWFRAME_AWARE
The filter is aware of hardware frames, and any hardware frame context should not be automatically pr...
Definition filters.h:208
#define FILTER_SINGLE_PIXFMT(pix_fmt_)
Definition filters.h:254
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
@ AV_PIX_FMT_CUDA
HW acceleration through CUDA.
Definition pixfmt.h:260
static const AVClass cuda_pad_class
static const AVFilterPad cuda_pad_inputs[]
static av_cold int cuda_pad_init(AVFilterContext *ctx)
static const AVFilterPad cuda_pad_outputs[]
static av_cold void cuda_pad_uninit(AVFilterContext *ctx)

Definition at line 621 of file vf_pad_cuda.c.