FFmpeg
Loading...
Searching...
No Matches
vf_bilateral_cuda.c File Reference
#include <float.h>
#include <stdio.h>
#include "libavutil/common.h"
#include "libavutil/hwcontext.h"
#include "libavutil/hwcontext_cuda_internal.h"
#include "libavutil/cuda_check.h"
#include "libavutil/internal.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "filters.h"
#include "video.h"
#include "cuda/load_helper.h"

Go to the source code of this file.

Data Structures

struct  CUDABilateralContext
 

Macros

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

Functions

static av_cold void cudabilateral_uninit (AVFilterContext *ctx)
 
static int format_is_supported (enum AVPixelFormat fmt)
 
static av_cold void set_format_info (AVFilterContext *ctx, enum AVPixelFormat format)
 
static av_cold int init_processing_chain (AVFilterContext *ctx, int width, int height)
 
static av_cold int cuda_bilateral_load_functions (AVFilterContext *ctx)
 
static av_cold int cuda_bilateral_config_props (AVFilterLink *outlink)
 
static int call_cuda_kernel (AVFilterContext *ctx, CUfunction func, CUtexObject src_tex[3], AVFrame *out_frame, int width, int height, int pitch, int width_uv, int height_uv, int pitch_uv, int window_size, float sigmaS, float sigmaR)
 
static int cuda_bilateral_process_internal (AVFilterContext *ctx, AVFrame *out, AVFrame *in)
 
static int cuda_bilateral_filter_frame (AVFilterLink *link, AVFrame *in)
 

Variables

static enum AVPixelFormat supported_formats []
 
static const AVOption options []
 
static const AVClass cuda_bilateral_class
 
static const AVFilterPad cuda_bilateral_inputs []
 
static const AVFilterPad cuda_bilateral_outputs []
 
const FFFilter ff_vf_bilateral_cuda
 

Macro Definition Documentation

◆ DIV_UP

#define DIV_UP ( a,
b )

◆ BLOCKX

◆ BLOCKY

◆ CHECK_CU

#define CHECK_CU ( x)
Value:
FF_CUDA_CHECK_DL(ctx, s->hwctx->internal->cuda_dl, x)
#define s(width, name)
Definition cbs_vp9.c:198
#define FF_CUDA_CHECK_DL(avclass, cudl, x)
Convenience wrapper for ff_cuda_check when dynamically loading cuda symbols.
Definition cuda_check.h:65
static AVFormatContext * ctx
Definition movenc.c:49

Definition at line 48 of file vf_bilateral_cuda.c.

Referenced by call_cuda_kernel(), cuda_bilateral_filter_frame(), cuda_bilateral_load_functions(), cuda_bilateral_process_internal(), and cudabilateral_uninit().

◆ OFFSET

#define OFFSET ( x)
Value:

Definition at line 341 of file vf_bilateral_cuda.c.

◆ FLAGS

Definition at line 342 of file vf_bilateral_cuda.c.

Function Documentation

◆ cudabilateral_uninit()

static av_cold void cudabilateral_uninit ( AVFilterContext * ctx)
static

Definition at line 70 of file vf_bilateral_cuda.c.

◆ format_is_supported()

static int format_is_supported ( enum AVPixelFormat fmt)
static

Definition at line 85 of file vf_bilateral_cuda.c.

Referenced by init_processing_chain().

◆ set_format_info()

static av_cold void set_format_info ( AVFilterContext * ctx,
enum AVPixelFormat format )
static

Definition at line 95 of file vf_bilateral_cuda.c.

Referenced by init_processing_chain().

◆ init_processing_chain()

static av_cold int init_processing_chain ( AVFilterContext * ctx,
int width,
int height )
static

Definition at line 114 of file vf_bilateral_cuda.c.

Referenced by cuda_bilateral_config_props().

◆ cuda_bilateral_load_functions()

static av_cold int cuda_bilateral_load_functions ( AVFilterContext * ctx)
static

Definition at line 141 of file vf_bilateral_cuda.c.

Referenced by cuda_bilateral_config_props().

◆ cuda_bilateral_config_props()

static av_cold int cuda_bilateral_config_props ( AVFilterLink * outlink)
static

Definition at line 178 of file vf_bilateral_cuda.c.

◆ call_cuda_kernel()

static int call_cuda_kernel ( AVFilterContext * ctx,
CUfunction func,
CUtexObject src_tex[3],
AVFrame * out_frame,
int width,
int height,
int pitch,
int width_uv,
int height_uv,
int pitch_uv,
int window_size,
float sigmaS,
float sigmaR )
static

Definition at line 210 of file vf_bilateral_cuda.c.

Referenced by cuda_bilateral_process_internal().

◆ cuda_bilateral_process_internal()

static int cuda_bilateral_process_internal ( AVFilterContext * ctx,
AVFrame * out,
AVFrame * in )
static

Definition at line 241 of file vf_bilateral_cuda.c.

Referenced by cuda_bilateral_filter_frame().

◆ cuda_bilateral_filter_frame()

static int cuda_bilateral_filter_frame ( AVFilterLink * link,
AVFrame * in )
static

Definition at line 300 of file vf_bilateral_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_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition pixfmt.h:78

Definition at line 38 of file vf_bilateral_cuda.c.

Referenced by amf_frames_get_constraints(), amf_frames_init(), cuda_pad_config_props(), d3d11va_frames_get_constraints(), d3d11va_frames_init(), d3d12va_frames_get_constraints(), d3d12va_frames_init(), dxva2_init_pool(), format_is_supported(), format_is_supported(), format_is_supported(), format_is_supported(), format_is_supported(), format_is_supported(), format_is_supported(), get_format_name(), is_format_supported(), vt_frames_get_constraints(), and vt_frames_init().

◆ options

const AVOption options[]
static
Initial value:
= {
{ "sigmaS", "set spatial sigma", OFFSET(sigmaS), AV_OPT_TYPE_FLOAT, {.dbl=0.1}, 0.1, 512, FLAGS },
{ "sigmaR", "set range sigma", OFFSET(sigmaR), AV_OPT_TYPE_FLOAT, {.dbl=0.1}, 0.1, 512, FLAGS },
{ "window_size", "set neighbours window_size", OFFSET(window_size), AV_OPT_TYPE_INT, {.i64=1}, 1, 255, FLAGS },
{ NULL }
}
#define FLAGS
Definition cmdutils.c:598
#define NULL
Definition coverity.c:32
#define OFFSET(x)
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
Definition opt.h:270

Definition at line 343 of file vf_bilateral_cuda.c.

◆ cuda_bilateral_class

const AVClass cuda_bilateral_class
static
Initial value:
= {
.class_name = "cudabilateral",
.item_name = av_default_item_name,
.option = 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

Definition at line 350 of file vf_bilateral_cuda.c.

◆ cuda_bilateral_inputs

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

Definition at line 357 of file vf_bilateral_cuda.c.

◆ cuda_bilateral_outputs

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

Definition at line 365 of file vf_bilateral_cuda.c.

◆ ff_vf_bilateral_cuda

const FFFilter ff_vf_bilateral_cuda
Initial value:
= {
.p.name = "bilateral_cuda",
.p.description = NULL_IF_CONFIG_SMALL("GPU accelerated bilateral filter"),
.p.priv_class = &cuda_bilateral_class,
.priv_size = sizeof(CUDABilateralContext),
.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 AVFilterPad cuda_bilateral_outputs[]
static const AVClass cuda_bilateral_class
static av_cold void cudabilateral_uninit(AVFilterContext *ctx)
static const AVFilterPad cuda_bilateral_inputs[]

Definition at line 373 of file vf_bilateral_cuda.c.