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

Go to the source code of this file.

Data Structures

struct  thumb_frame
 
struct  ThumbnailCudaContext
 

Macros

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

Functions

 AVFILTER_DEFINE_CLASS (thumbnail_cuda)
 
static av_cold int init (AVFilterContext *ctx)
 
static double frame_sum_square_err (const int *hist, const double *median)
 Compute Sum-square deviation to estimate "closeness".
 
static AVFrameget_best_frame (AVFilterContext *ctx)
 
static int thumbnail_kernel (AVFilterContext *ctx, CUfunction func, int channels, int *histogram, uint8_t *src_dptr, int src_width, int src_height, int src_pitch, int pixel_size)
 
static int thumbnail (AVFilterContext *ctx, int *histogram, AVFrame *in)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *frame)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static int request_frame (AVFilterLink *link)
 
static int format_is_supported (enum AVPixelFormat fmt)
 
static int config_props (AVFilterLink *inlink)
 

Variables

static enum AVPixelFormat supported_formats []
 
static const AVOption thumbnail_cuda_options []
 
static const AVFilterPad thumbnail_cuda_inputs []
 
static const AVFilterPad thumbnail_cuda_outputs []
 
const FFFilter ff_vf_thumbnail_cuda
 

Macro Definition Documentation

◆ CHECK_CU

#define CHECK_CU ( x)
Value:
FF_CUDA_CHECK_DL(ctx, s->hwctx->internal->cuda_dl, x)
static AVFormatContext * ctx
#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

Definition at line 35 of file vf_thumbnail_cuda.c.

Referenced by config_props(), filter_frame(), thumbnail_kernel(), and uninit().

◆ HIST_SIZE

#define HIST_SIZE   (3*256)

Definition at line 37 of file vf_thumbnail_cuda.c.

◆ DIV_UP

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

Definition at line 38 of file vf_thumbnail_cuda.c.

Referenced by thumbnail_kernel().

◆ BLOCKX

#define BLOCKX   32

Definition at line 39 of file vf_thumbnail_cuda.c.

◆ BLOCKY

#define BLOCKY   16

Definition at line 40 of file vf_thumbnail_cuda.c.

◆ OFFSET

#define OFFSET ( x)
Value:

Definition at line 81 of file vf_thumbnail_cuda.c.

◆ FLAGS

Definition at line 82 of file vf_thumbnail_cuda.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( thumbnail_cuda )

◆ init()

static av_cold int init ( AVFilterContext * ctx)
static

Definition at line 91 of file vf_thumbnail_cuda.c.

◆ frame_sum_square_err()

static double frame_sum_square_err ( const int * hist,
const double * median )
static

Compute Sum-square deviation to estimate "closeness".

Parameters
histcolor distribution histogram
medianaverage color distribution histogram
Returns
sum of squared errors

Definition at line 111 of file vf_thumbnail_cuda.c.

Referenced by get_best_frame().

◆ get_best_frame()

static AVFrame * get_best_frame ( AVFilterContext * ctx)
static

Definition at line 123 of file vf_thumbnail_cuda.c.

Referenced by filter_frame(), and request_frame().

◆ thumbnail_kernel()

static int thumbnail_kernel ( AVFilterContext * ctx,
CUfunction func,
int channels,
int * histogram,
uint8_t * src_dptr,
int src_width,
int src_height,
int src_pitch,
int pixel_size )
static

Definition at line 163 of file vf_thumbnail_cuda.c.

Referenced by thumbnail().

◆ thumbnail()

static int thumbnail ( AVFilterContext * ctx,
int * histogram,
AVFrame * in )
static

Definition at line 203 of file vf_thumbnail_cuda.c.

Referenced by AVFILTER_DEFINE_CLASS(), and filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink * inlink,
AVFrame * frame )
static

Definition at line 256 of file vf_thumbnail_cuda.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext * ctx)
static

Definition at line 313 of file vf_thumbnail_cuda.c.

◆ request_frame()

static int request_frame ( AVFilterLink * link)
static

Definition at line 338 of file vf_thumbnail_cuda.c.

◆ format_is_supported()

static int format_is_supported ( enum AVPixelFormat fmt)
static

Definition at line 355 of file vf_thumbnail_cuda.c.

Referenced by config_props().

◆ config_props()

static int config_props ( AVFilterLink * inlink)
static

Definition at line 365 of file vf_thumbnail_cuda.c.

Variable Documentation

◆ supported_formats

enum AVPixelFormat supported_formats[]
static
Initial value:
= {
}
#define AV_PIX_FMT_P012
Definition pixfmt.h:609
#define AV_PIX_FMT_P010
Definition pixfmt.h:608
#define AV_PIX_FMT_P016
Definition pixfmt.h:610
#define AV_PIX_FMT_YUV444P12MSB
Definition pixfmt.h:561
@ 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
#define AV_PIX_FMT_YUV444P16
Definition pixfmt.h:558
#define AV_PIX_FMT_YUV444P10MSB
Definition pixfmt.h:560

Definition at line 42 of file vf_thumbnail_cuda.c.

◆ thumbnail_cuda_options

const AVOption thumbnail_cuda_options[]
static
Initial value:
= {
{ "n", "set the frames batch size", OFFSET(n_frames), AV_OPT_TYPE_INT, {.i64=100}, 2, INT_MAX, 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

Definition at line 84 of file vf_thumbnail_cuda.c.

◆ thumbnail_cuda_inputs

const AVFilterPad thumbnail_cuda_inputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_props,
.filter_frame = filter_frame,
},
}
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
Definition dolby_e.c:1067
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
static int config_props(AVBitStreamFilterLink *link)
Definition source.c:181

Definition at line 429 of file vf_thumbnail_cuda.c.

◆ thumbnail_cuda_outputs

const AVFilterPad thumbnail_cuda_outputs[]
static
Initial value:
= {
{
.name = "default",
.request_frame = request_frame,
},
}
static int request_frame(AVFilterLink *outlink)
Definition af_aecho.c:272

Definition at line 438 of file vf_thumbnail_cuda.c.

◆ ff_vf_thumbnail_cuda

const FFFilter ff_vf_thumbnail_cuda
Initial value:
= {
.p.name = "thumbnail_cuda",
.p.description = NULL_IF_CONFIG_SMALL("Select the most representative frame in a given sequence of consecutive frames using CUDA."),
.p.priv_class = &thumbnail_cuda_class,
.priv_size = sizeof(ThumbnailCudaContext),
.init = init,
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
}
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
static av_cold void uninit(AVBitStreamFilterContext *ctx)
#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 thumbnail_cuda_outputs[]
static const AVFilterPad thumbnail_cuda_inputs[]

Definition at line 446 of file vf_thumbnail_cuda.c.