FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
vf_scale_npp.c File Reference

scale video filter More...

#include <nppi.h>
#include <stdio.h>
#include <string.h>
#include "libavutil/avstring.h"
#include "libavutil/common.h"
#include "libavutil/hwcontext.h"
#include "libavutil/hwcontext_cuda_internal.h"
#include "libavutil/internal.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "scale.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  NPPScaleStageContext
 
struct  NPPScaleContext
 

Macros

#define OFFSET(x)   offsetof(NPPScaleContext, x)
 
#define FLAGS   (AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM)
 

Enumerations

enum  ScaleStage { STAGE_DEINTERLEAVE, STAGE_RESIZE, STAGE_INTERLEAVE, STAGE_NB }
 

Functions

static int nppscale_init (AVFilterContext *ctx)
 
static void nppscale_uninit (AVFilterContext *ctx)
 
static int nppscale_query_formats (AVFilterContext *ctx)
 
static int init_stage (NPPScaleStageContext *stage, AVBufferRef *device_ctx)
 
static int format_is_supported (enum AVPixelFormat fmt)
 
static enum AVPixelFormat get_deinterleaved_format (enum AVPixelFormat fmt)
 
static int init_processing_chain (AVFilterContext *ctx, int in_width, int in_height, int out_width, int out_height)
 
static int nppscale_config_props (AVFilterLink *outlink)
 
static int nppscale_deinterleave (AVFilterContext *ctx, NPPScaleStageContext *stage, AVFrame *out, AVFrame *in)
 
static int nppscale_resize (AVFilterContext *ctx, NPPScaleStageContext *stage, AVFrame *out, AVFrame *in)
 
static int nppscale_interleave (AVFilterContext *ctx, NPPScaleStageContext *stage, AVFrame *out, AVFrame *in)
 
static int nppscale_scale (AVFilterContext *ctx, AVFrame *out, AVFrame *in)
 
static int nppscale_filter_frame (AVFilterLink *link, AVFrame *in)
 

Variables

static enum AVPixelFormat supported_formats []
 
static enum AVPixelFormat deinterleaved_formats [][2]
 
static int(*const nppscale_process [])(AVFilterContext *ctx, NPPScaleStageContext *stage, AVFrame *out, AVFrame *in)
 
static const AVOption options []
 
static const AVClass nppscale_class
 
static const AVFilterPad nppscale_inputs []
 
static const AVFilterPad nppscale_outputs []
 
AVFilter ff_vf_scale_npp
 

Detailed Description

scale video filter

Definition in file vf_scale_npp.c.

Macro Definition Documentation

#define OFFSET (   x)    offsetof(NPPScaleContext, x)

Definition at line 539 of file vf_scale_npp.c.

Definition at line 540 of file vf_scale_npp.c.

Enumeration Type Documentation

enum ScaleStage
Enumerator
STAGE_DEINTERLEAVE 
STAGE_RESIZE 
STAGE_INTERLEAVE 
STAGE_NB 

Definition at line 52 of file vf_scale_npp.c.

Function Documentation

static int nppscale_init ( AVFilterContext ctx)
static

Definition at line 101 of file vf_scale_npp.c.

static void nppscale_uninit ( AVFilterContext ctx)
static

Definition at line 128 of file vf_scale_npp.c.

static int nppscale_query_formats ( AVFilterContext ctx)
static

Definition at line 140 of file vf_scale_npp.c.

static int init_stage ( NPPScaleStageContext stage,
AVBufferRef device_ctx 
)
static

Definition at line 150 of file vf_scale_npp.c.

Referenced by init_processing_chain().

static int format_is_supported ( enum AVPixelFormat  fmt)
static

Definition at line 202 of file vf_scale_npp.c.

Referenced by init_processing_chain().

static enum AVPixelFormat get_deinterleaved_format ( enum AVPixelFormat  fmt)
static

Definition at line 212 of file vf_scale_npp.c.

Referenced by init_processing_chain().

static int init_processing_chain ( AVFilterContext ctx,
int  in_width,
int  in_height,
int  out_width,
int  out_height 
)
static

Definition at line 226 of file vf_scale_npp.c.

Referenced by nppscale_config_props().

static int nppscale_config_props ( AVFilterLink outlink)
static

Definition at line 333 of file vf_scale_npp.c.

static int nppscale_deinterleave ( AVFilterContext ctx,
NPPScaleStageContext stage,
AVFrame out,
AVFrame in 
)
static

Definition at line 374 of file vf_scale_npp.c.

static int nppscale_resize ( AVFilterContext ctx,
NPPScaleStageContext stage,
AVFrame out,
AVFrame in 
)
static

Definition at line 398 of file vf_scale_npp.c.

static int nppscale_interleave ( AVFilterContext ctx,
NPPScaleStageContext stage,
AVFrame out,
AVFrame in 
)
static

Definition at line 426 of file vf_scale_npp.c.

static int nppscale_scale ( AVFilterContext ctx,
AVFrame out,
AVFrame in 
)
static

Definition at line 458 of file vf_scale_npp.c.

Referenced by nppscale_filter_frame().

static int nppscale_filter_frame ( AVFilterLink link,
AVFrame in 
)
static

Definition at line 492 of file vf_scale_npp.c.

Variable Documentation

enum AVPixelFormat supported_formats[]
static
Initial value:
= {
}
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:71
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
Definition: pixfmt.h:89
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66

Definition at line 42 of file vf_scale_npp.c.

Referenced by format_is_supported().

enum AVPixelFormat deinterleaved_formats[][2]
static
Initial value:
= {
}
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
Definition: pixfmt.h:89
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66

Definition at line 48 of file vf_scale_npp.c.

Referenced by get_deinterleaved_format().

int(*const nppscale_process[])(AVFilterContext *ctx, NPPScaleStageContext *stage, AVFrame *out, AVFrame *in)
static
Initial value:
= {
}
static int nppscale_resize(AVFilterContext *ctx, NPPScaleStageContext *stage, AVFrame *out, AVFrame *in)
Definition: vf_scale_npp.c:398
static int nppscale_deinterleave(AVFilterContext *ctx, NPPScaleStageContext *stage, AVFrame *out, AVFrame *in)
Definition: vf_scale_npp.c:374
static int nppscale_interleave(AVFilterContext *ctx, NPPScaleStageContext *stage, AVFrame *out, AVFrame *in)
Definition: vf_scale_npp.c:426

Definition at line 451 of file vf_scale_npp.c.

Referenced by nppscale_scale().

const AVOption options[]
static
Initial value:
= {
{ "w", "Output video width", OFFSET(w_expr), AV_OPT_TYPE_STRING, { .str = "iw" }, .flags = FLAGS },
{ "h", "Output video height", OFFSET(h_expr), AV_OPT_TYPE_STRING, { .str = "ih" }, .flags = FLAGS },
{ "format", "Output pixel format", OFFSET(format_str), AV_OPT_TYPE_STRING, { .str = "same" }, .flags = FLAGS },
{ "interp_algo", "Interpolation algorithm used for resizing", OFFSET(interp_algo), AV_OPT_TYPE_INT, { .i64 = NPPI_INTER_CUBIC }, 0, INT_MAX, FLAGS, "interp_algo" },
{ "nn", "nearest neighbour", 0, AV_OPT_TYPE_CONST, { .i64 = NPPI_INTER_NN }, 0, 0, FLAGS, "interp_algo" },
{ "linear", "linear", 0, AV_OPT_TYPE_CONST, { .i64 = NPPI_INTER_LINEAR }, 0, 0, FLAGS, "interp_algo" },
{ "cubic", "cubic", 0, AV_OPT_TYPE_CONST, { .i64 = NPPI_INTER_CUBIC }, 0, 0, FLAGS, "interp_algo" },
{ "cubic2p_bspline", "2-parameter cubic (B=1, C=0)", 0, AV_OPT_TYPE_CONST, { .i64 = NPPI_INTER_CUBIC2P_BSPLINE }, 0, 0, FLAGS, "interp_algo" },
{ "cubic2p_catmullrom", "2-parameter cubic (B=0, C=1/2)", 0, AV_OPT_TYPE_CONST, { .i64 = NPPI_INTER_CUBIC2P_CATMULLROM }, 0, 0, FLAGS, "interp_algo" },
{ "cubic2p_b05c03", "2-parameter cubic (B=1/2, C=3/10)", 0, AV_OPT_TYPE_CONST, { .i64 = NPPI_INTER_CUBIC2P_B05C03 }, 0, 0, FLAGS, "interp_algo" },
{ "super", "supersampling", 0, AV_OPT_TYPE_CONST, { .i64 = NPPI_INTER_SUPER }, 0, 0, FLAGS, "interp_algo" },
{ "lanczos", "Lanczos", 0, AV_OPT_TYPE_CONST, { .i64 = NPPI_INTER_LANCZOS }, 0, 0, FLAGS, "interp_algo" },
{ NULL },
}
#define NULL
Definition: coverity.c:32
#define OFFSET(x)
Definition: vf_scale_npp.c:539
#define FLAGS
Definition: vf_scale_npp.c:540

Definition at line 541 of file vf_scale_npp.c.

const AVClass nppscale_class
static
Initial value:
= {
.class_name = "nppscale",
.item_name = av_default_item_name,
.option = options,
}
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:191
static const AVOption options[]
Definition: vf_scale_npp.c:541

Definition at line 558 of file vf_scale_npp.c.

const AVFilterPad nppscale_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = nppscale_filter_frame,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int nppscale_filter_frame(AVFilterLink *link, AVFrame *in)
Definition: vf_scale_npp.c:492

Definition at line 565 of file vf_scale_npp.c.

const AVFilterPad nppscale_outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = nppscale_config_props,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int nppscale_config_props(AVFilterLink *outlink)
Definition: vf_scale_npp.c:333

Definition at line 574 of file vf_scale_npp.c.

AVFilter ff_vf_scale_npp
Initial value:
= {
.name = "scale_npp",
.description = NULL_IF_CONFIG_SMALL("NVIDIA Performance Primitives video "
"scaling and format conversion"),
.init = nppscale_init,
.uninit = nppscale_uninit,
.query_formats = nppscale_query_formats,
.priv_size = sizeof(NPPScaleContext),
.priv_class = &nppscale_class,
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
}
#define FF_FILTER_FLAG_HWFRAME_AWARE
The filter is aware of hardware frames, and any hardware frame context should not be automatically pr...
Definition: internal.h:385
static const AVFilterPad nppscale_inputs[]
Definition: vf_scale_npp.c:565
static void nppscale_uninit(AVFilterContext *ctx)
Definition: vf_scale_npp.c:128
static int nppscale_init(AVFilterContext *ctx)
Definition: vf_scale_npp.c:101
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
static const AVClass nppscale_class
Definition: vf_scale_npp.c:558
static const AVFilterPad inputs[]
Definition: af_acontrast.c:193
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
static int nppscale_query_formats(AVFilterContext *ctx)
Definition: vf_scale_npp.c:140
static const AVFilterPad nppscale_outputs[]
Definition: vf_scale_npp.c:574

Definition at line 583 of file vf_scale_npp.c.