FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
vf_scale_npp.c File Reference
#include <nppi.h>
#include <stdio.h>
#include <string.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/parseutils.h"
#include "libavutil/eval.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "scale_eval.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  NPPScaleStageContext
 
struct  NPPScaleContext
 

Macros

#define CHECK_CU(x)   FF_CUDA_CHECK_DL(ctx, device_hwctx->internal->cuda_dl, x)
 
#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 }
 
enum  var_name {
  VAR_N, VAR_TB, VAR_PTS, VAR_DTS,
  VAR_NOPTS, VAR_STARTPTS, VAR_STARTDTS, VAR_DURATION,
  VAR_D, VAR_POS, VAR_SIZE, VAR_KEY,
  VAR_STATE, VAR_VARS_NB, VAR_N, VAR_TS,
  VAR_POS, VAR_PREV_INPTS, VAR_PREV_INDTS, VAR_PREV_OUTPTS,
  VAR_PREV_OUTDTS, VAR_PTS, VAR_DTS, VAR_STARTPTS,
  VAR_STARTDTS, VAR_TB, VAR_SR, VAR_NOPTS,
  VAR_VARS_NB, VAR_CH, VAR_N, VAR_NB_IN_CHANNELS,
  VAR_NB_OUT_CHANNELS, VAR_T, VAR_S, VAR_VARS_NB,
  VAR_W, VAR_H, VAR_CW, VAR_CH,
  VAR_HSUB, VAR_VSUB, VARS_NB, VAR_VALUE1,
  VAR_VALUE2, VAR_FRAMEVAL, VAR_USERVAL, VAR_VARS_NB,
  VAR_TB, VAR_PTS, VAR_START_PTS, VAR_PREV_PTS,
  VAR_PREV_SELECTED_PTS, VAR_T, VAR_START_T, VAR_PREV_T,
  VAR_PREV_SELECTED_T, VAR_PICT_TYPE, VAR_I, VAR_P,
  VAR_B, VAR_S, VAR_SI, VAR_SP,
  VAR_BI, VAR_PICT_TYPE_I, VAR_PICT_TYPE_P, VAR_PICT_TYPE_B,
  VAR_PICT_TYPE_S, VAR_PICT_TYPE_SI, VAR_PICT_TYPE_SP, VAR_PICT_TYPE_BI,
  VAR_INTERLACE_TYPE, VAR_INTERLACE_TYPE_P, VAR_INTERLACE_TYPE_T, VAR_INTERLACE_TYPE_B,
  VAR_CONSUMED_SAMPLES_N, VAR_SAMPLES_N, VAR_SAMPLE_RATE, VAR_N,
  VAR_SELECTED_N, VAR_PREV_SELECTED_N, VAR_KEY, VAR_POS,
  VAR_SCENE, VAR_CONCATDEC_SELECT, VAR_VARS_NB, VAR_N,
  VAR_T, VAR_POS, VAR_PTS, VAR_TS,
  VAR_TE, VAR_TI, VAR_VARS_NB, VAR_IN_W,
  VAR_IW, VAR_IN_H, VAR_IH, VAR_OUT_W,
  VAR_OW, VAR_OUT_H, VAR_OH, VAR_A,
  VAR_SAR, VAR_DAR, VAR_HSUB, VAR_VSUB,
  VAR_OHSUB, VAR_OVSUB, VARS_NB, VAR_FRAME_RATE,
  VAR_INTERLACED, VAR_N, VAR_NB_CONSUMED_SAMPLES, VAR_NB_SAMPLES,
  VAR_POS, VAR_PREV_INPTS, VAR_PREV_INT, VAR_PREV_OUTPTS,
  VAR_PREV_OUTT, VAR_PTS, VAR_SAMPLE_RATE, VAR_STARTPTS,
  VAR_STARTT, VAR_T, VAR_TB, VAR_RTCTIME,
  VAR_RTCSTART, VAR_S, VAR_SR, VAR_FR,
  VAR_VARS_NB, VAR_AVTB, VAR_INTB, VAR_SR,
  VAR_VARS_NB, VAR_W, VAR_H, VAR_A,
  VAR_DAR, VAR_SAR, VAR_HSUB, VAR_VSUB,
  VARS_NB, VAR_IN_W, VAR_IW, VAR_IN_H,
  VAR_IH, VAR_OUT_W, VAR_OW, VAR_OUT_H,
  VAR_OH, VAR_A, VAR_SAR, VAR_DAR,
  VAR_HSUB, VAR_VSUB, VAR_X, VAR_Y,
  VAR_N, VAR_POS, VAR_T, VAR_VARS_NB,
  VAR_X, VAR_Y, VAR_W, VAR_H,
  VAR_N, VAR_T, VAR_VARS_NB, VAR_DAR,
  VAR_HSUB, VAR_VSUB, VAR_IN_H, VAR_IH,
  VAR_IN_W, VAR_IW, VAR_SAR, VAR_X,
  VAR_Y, VAR_H, VAR_W, VAR_T,
  VAR_MAX, VARS_NB, VAR_DAR, VAR_HSUB,
  VAR_VSUB, VAR_LINE_H, VAR_LH, VAR_MAIN_H,
  VAR_h, VAR_H, VAR_MAIN_W, VAR_w,
  VAR_W, VAR_MAX_GLYPH_A, VAR_ASCENT, VAR_MAX_GLYPH_D,
  VAR_DESCENT, VAR_MAX_GLYPH_H, VAR_MAX_GLYPH_W, VAR_N,
  VAR_SAR, VAR_T, VAR_TEXT_H, VAR_TH,
  VAR_TEXT_W, VAR_TW, VAR_X, VAR_Y,
  VAR_PICT_TYPE, VAR_PKT_POS, VAR_PKT_DURATION, VAR_PKT_SIZE,
  VAR_VARS_NB, VAR_N, VAR_POS, VAR_R,
  VAR_T, VAR_NB, VAR_SOURCE_FPS, VAR_FPS_NTSC,
  VAR_FPS_PAL, VAR_FPS_FILM, VAR_FPS_NTSC_FILM, VARS_NB,
  VAR_N, VAR_PTS, VAR_R, VAR_T,
  VAR_TB, VAR_NB, VAR_W, VAR_H,
  VAR_VAL, VAR_MAXVAL, VAR_MINVAL, VAR_NEGVAL,
  VAR_CLIPVAL, VAR_VARS_NB, VAR_W, VAR_H,
  VAR_X, VAR_Y, VAR_BITDEPTHX, VAR_BITDEPTHY,
  VAR_VARS_NB, VAR_MAIN_W, VAR_MW, VAR_MAIN_H,
  VAR_MH, VAR_OVERLAY_W, VAR_OW, VAR_OVERLAY_H,
  VAR_OH, VAR_HSUB, VAR_VSUB, VAR_X,
  VAR_Y, VAR_N, VAR_POS, VAR_T,
  VAR_VARS_NB, VAR_MAIN_W, VAR_MW, VAR_MAIN_H,
  VAR_MH, VAR_OVERLAY_W, VAR_OW, VAR_OVERLAY_H,
  VAR_OH, VAR_X, VAR_Y, VAR_N,
  VAR_POS, VAR_T, VAR_VARS_NB, VAR_MAIN_iW,
  VAR_MW, VAR_MAIN_iH, VAR_MH, VAR_OVERLAY_iW,
  VAR_OVERLAY_iH, VAR_OVERLAY_X, VAR_OX, VAR_OVERLAY_Y,
  VAR_OY, VAR_OVERLAY_W, VAR_OW, VAR_OVERLAY_H,
  VAR_OH, VAR_VARS_NB, 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, 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, VARS_NB,
  VAR_W, VAR_H, VAR_VAL, VAR_YMIN,
  VAR_UMIN, VAR_VMIN, VAR_AMIN, VAR_YMAX,
  VAR_UMAX, VAR_VMAX, VAR_AMAX, VAR_VARS_NB,
  VAR_IN_W, VAR_IW, VAR_IN_H, VAR_IH,
  VAR_OUT_W, VAR_OW, VAR_OUT_H, VAR_OH,
  VAR_HSUB, VAR_VSUB, VAR_N, VAR_T,
  VAR_VARS_NB, VAR_IN_W, VAR_IW, VAR_IN_H,
  VAR_IH, VAR_OUT_W, VAR_OW, VAR_OUT_H,
  VAR_OH, VAR_A, VAR_SAR, VAR_DAR,
  VAR_HSUB, VAR_VSUB, VAR_OHSUB, VAR_OVSUB,
  VAR_N, VAR_T, VAR_POS, VAR_S2R_MAIN_W,
  VAR_S2R_MAIN_H, VAR_S2R_MAIN_A, VAR_S2R_MAIN_SAR, VAR_S2R_MAIN_DAR,
  VAR_S2R_MDAR, VAR_S2R_MAIN_HSUB, VAR_S2R_MAIN_VSUB, VAR_S2R_MAIN_N,
  VAR_S2R_MAIN_T, VAR_S2R_MAIN_POS, VARS_NB, VAR_IN_W,
  VAR_IW, VAR_IN_H, VAR_IH, VAR_OUT_W,
  VAR_OW, VAR_OUT_H, VAR_OH, VAR_A,
  VAR_SAR, VAR_DAR, VAR_N, VAR_T,
  VAR_POS, VAR_S2R_MAIN_W, VAR_S2R_MAIN_H, VAR_S2R_MAIN_A,
  VAR_S2R_MAIN_SAR, VAR_S2R_MAIN_DAR, VAR_S2R_MDAR, VAR_S2R_MAIN_N,
  VAR_S2R_MAIN_T, VAR_S2R_MAIN_POS, VARS_NB, VAR_PI,
  VAR_PHI, VAR_E, VAR_IN_W, VAR_IW,
  VAR_IN_H, VAR_IH, VAR_OUT_W, VAR_OW,
  VAR_OUT_H, VAR_OH, VAR_A, VAR_DAR,
  VAR_SAR, VARS_NB, VAR_W, VAR_H,
  VAR_N, VAR_PTS, VAR_R, VAR_T,
  VAR_TB, VAR_NB, VAR_iW, VAR_IN_W,
  VAR_iH, VAR_IN_H, VAR_oW, VAR_OUT_W,
  VAR_W, VAR_oH, VAR_OUT_H, VAR_H,
  CW, CH, CX, CY,
  VAR_VARS_NB, VAR_IN_W, VAR_IW, VAR_IN_H,
  VAR_IH, VAR_OUT_W, VAR_OW, VAR_OUT_H,
  VAR_OH, VAR_IN, VAR_ON, VAR_DURATION,
  VAR_PDURATION, VAR_IN_TIME, VAR_IT, VAR_TIME,
  VAR_OUT_TIME, VAR_OT, VAR_FRAME, VAR_ZOOM,
  VAR_PZOOM, VAR_X, VAR_PX, VAR_Y,
  VAR_PY, VAR_A, VAR_SAR, VAR_DAR,
  VAR_HSUB, VAR_VSUB, VARS_NB, VAR_IN_W,
  VAR_IW, VAR_IN_H, VAR_IH, VAR_OUT_W,
  VAR_OW, VAR_OUT_H, VAR_OH, VAR_A,
  VAR_SAR, VAR_DAR, VAR_HSUB, VAR_VSUB,
  VAR_OHSUB, VAR_OVSUB, VARS_NB, VAR_X,
  VAR_Y, VAR_W, VAR_H, VAR_TIME,
  VAR_SPEED, VAR_TEMPO, VAR_ORDER, VAR_PATTERN,
  VAR_ROW, VAR_VARS_NB
}
 
enum  EvalMode {
  EVAL_MODE_ONCE, EVAL_MODE_FRAME, EVAL_MODE_NB, EVAL_MODE_INIT,
  EVAL_MODE_FRAME, EVAL_MODE_NB, EVAL_MODE_INIT, EVAL_MODE_FRAME,
  EVAL_MODE_NB, EVAL_MODE_INIT, EVAL_MODE_FRAME, EVAL_MODE_NB,
  EVAL_MODE_INIT, EVAL_MODE_FRAME, EVAL_MODE_NB, EVAL_MODE_INIT,
  EVAL_MODE_FRAME, EVAL_MODE_NB, EVAL_MODE_INIT, EVAL_MODE_FRAME,
  EVAL_MODE_NB, EVAL_MODE_INIT, EVAL_MODE_FRAME, EVAL_MODE_NB,
  EVAL_MODE_INIT, EVAL_MODE_FRAME, EVAL_MODE_NB
}
 

Functions

static int config_props (AVFilterLink *outlink)
 
static int check_exprs (AVFilterContext *ctx)
 
static int nppscale_parse_expr (AVFilterContext *ctx, char *str_expr, AVExpr **pexpr_ptr, const char *var, const char *args)
 
static av_cold int nppscale_init (AVFilterContext *ctx)
 
static int nppscale_eval_dimensions (AVFilterContext *ctx)
 
static void nppscale_uninit (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 config_props_ref (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 (AVFilterLink *link, AVFrame *out, AVFrame *in)
 
static int nppscale_filter_frame (AVFilterLink *link, AVFrame *in)
 
static int nppscale_filter_frame_ref (AVFilterLink *link, AVFrame *in)
 
static int request_frame (AVFilterLink *outlink)
 
static int request_frame_ref (AVFilterLink *outlink)
 

Variables

static enum AVPixelFormat supported_formats []
 
static enum AVPixelFormat deinterleaved_formats [][2]
 
static const char *const var_names []
 
const AVFilter ff_vf_scale2ref_npp
 
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 []
 
const AVFilter ff_vf_scale_npp
 
static const AVFilterPad nppscale2ref_inputs []
 
static const AVFilterPad nppscale2ref_outputs []
 

Detailed Description

scale video filter

Definition in file vf_scale_npp.c.

Macro Definition Documentation

◆ CHECK_CU

#define CHECK_CU (   x)    FF_CUDA_CHECK_DL(ctx, device_hwctx->internal->cuda_dl, x)

Definition at line 43 of file vf_scale_npp.c.

◆ OFFSET

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

Definition at line 951 of file vf_scale_npp.c.

◆ FLAGS

Definition at line 952 of file vf_scale_npp.c.

Enumeration Type Documentation

◆ ScaleStage

enum ScaleStage
Enumerator
STAGE_DEINTERLEAVE 
STAGE_RESIZE 
STAGE_INTERLEAVE 
STAGE_NB 

Definition at line 56 of file vf_scale_npp.c.

◆ var_name

enum var_name
Enumerator
VAR_N 
VAR_TB 
VAR_PTS 
VAR_DTS 
VAR_NOPTS 
VAR_STARTPTS 
VAR_STARTDTS 
VAR_DURATION 
VAR_D 
VAR_POS 
VAR_SIZE 
VAR_KEY 
VAR_STATE 
VAR_VARS_NB 
VAR_N 
VAR_TS 
VAR_POS 
VAR_PREV_INPTS 
VAR_PREV_INDTS 
VAR_PRE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VAL_MODE_FRAME 
EVAL_MODE_NB 
EVAL_MODE_INIT 
EVAL_MODE_FRAME 
EVAL_MODE_NB 
EVAL_MODE_INIT 
EVAL_MODE_FRAME 
EVAL_MODE_NB 

Definition at line 121 of file vf_scale_npp.c.

Function Documentation

◆ config_props()

static int config_props ( AVFilterLink outlink)
static

Definition at line 625 of file vf_scale_npp.c.

Referenced by nppscale_parse_expr(), and nppscale_scale().

◆ check_exprs()

static int check_exprs ( AVFilterContext ctx)
static

Definition at line 171 of file vf_scale_npp.c.

Referenced by nppscale_parse_expr().

◆ nppscale_parse_expr()

static int nppscale_parse_expr ( AVFilterContext ctx,
char *  str_expr,
AVExpr **  pexpr_ptr,
const char *  var,
const char *  args 
)
static

Definition at line 227 of file vf_scale_npp.c.

Referenced by nppscale_init(), and nppscale_scale().

◆ nppscale_init()

static av_cold int nppscale_init ( AVFilterContext ctx)
static

Definition at line 283 of file vf_scale_npp.c.

◆ nppscale_eval_dimensions()

static int nppscale_eval_dimensions ( AVFilterContext ctx)
static

Definition at line 358 of file vf_scale_npp.c.

Referenced by config_props().

◆ nppscale_uninit()

static void nppscale_uninit ( AVFilterContext ctx)
static

Definition at line 419 of file vf_scale_npp.c.

◆ init_stage()

static int init_stage ( NPPScaleStageContext stage,
AVBufferRef device_ctx 
)
static

Definition at line 435 of file vf_scale_npp.c.

Referenced by init_processing_chain().

◆ format_is_supported()

static int format_is_supported ( enum AVPixelFormat  fmt)
static

Definition at line 494 of file vf_scale_npp.c.

Referenced by init_processing_chain().

◆ get_deinterleaved_format()

static enum AVPixelFormat get_deinterleaved_format ( enum AVPixelFormat  fmt)
static

Definition at line 504 of file vf_scale_npp.c.

Referenced by init_processing_chain().

◆ 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 518 of file vf_scale_npp.c.

Referenced by config_props().

◆ config_props_ref()

static int config_props_ref ( AVFilterLink outlink)
static

Definition at line 670 of file vf_scale_npp.c.

Referenced by nppscale_filter_frame_ref().

◆ nppscale_deinterleave()

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

Definition at line 686 of file vf_scale_npp.c.

◆ nppscale_resize()

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

Definition at line 710 of file vf_scale_npp.c.

◆ nppscale_interleave()

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

Definition at line 738 of file vf_scale_npp.c.

◆ nppscale_scale()

static int nppscale_scale ( AVFilterLink link,
AVFrame out,
AVFrame in 
)
static

Definition at line 770 of file vf_scale_npp.c.

Referenced by nppscale_filter_frame().

◆ nppscale_filter_frame()

static int nppscale_filter_frame ( AVFilterLink link,
AVFrame in 
)
static

Definition at line 866 of file vf_scale_npp.c.

◆ nppscale_filter_frame_ref()

static int nppscale_filter_frame_ref ( AVFilterLink link,
AVFrame in 
)
static

Definition at line 910 of file vf_scale_npp.c.

◆ request_frame()

static int request_frame ( AVFilterLink outlink)
static

Definition at line 941 of file vf_scale_npp.c.

◆ request_frame_ref()

static int request_frame_ref ( AVFilterLink outlink)
static

Definition at line 946 of file vf_scale_npp.c.

Variable Documentation

◆ supported_formats

enum AVPixelFormat supported_formats[]
static
Initial value:

Definition at line 45 of file vf_scale_npp.c.

Referenced by format_is_supported().

◆ deinterleaved_formats

enum AVPixelFormat deinterleaved_formats[][2]
static
Initial value:

Definition at line 52 of file vf_scale_npp.c.

Referenced by get_deinterleaved_format().

◆ var_names

const char* const var_names[]
static
Initial value:
= {
"in_w", "iw",
"in_h", "ih",
"out_w", "ow",
"out_h", "oh",
"a",
"sar",
"dar",
"n",
"t",
"pos",
"main_w",
"main_h",
"main_a",
"main_sar",
"main_dar", "mdar",
"main_n",
"main_t",
"main_pos",
}

Definition at line 77 of file vf_scale_npp.c.

Referenced by nppscale_parse_expr().

◆ ff_vf_scale2ref_npp

const AVFilter ff_vf_scale2ref_npp
Initial value:
= {
.name = "scale2ref_npp",
.description = NULL_IF_CONFIG_SMALL("NVIDIA Performance Primitives video "
"scaling and format conversion to the "
"given reference."),
.init = nppscale_init,
.uninit = nppscale_uninit,
.priv_size = sizeof(NPPScaleContext),
.priv_class = &nppscale_class,
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
}

Definition at line 167 of file vf_scale_npp.c.

Referenced by check_exprs(), config_props(), nppscale_eval_dimensions(), and nppscale_scale().

◆ nppscale_process

int(*const nppscale_process[])(AVFilterContext *ctx, NPPScaleStageContext *stage, AVFrame *out, AVFrame *in)
static

◆ options

const AVOption options[]
static
Initial value:
= {
{ "w", "Output video width", OFFSET(w_expr), AV_OPT_TYPE_STRING, .flags = FLAGS },
{ "h", "Output video height", OFFSET(h_expr), AV_OPT_TYPE_STRING, .flags = FLAGS },
{ "format", "Output pixel format", OFFSET(format_str), AV_OPT_TYPE_STRING, { .str = "same" }, .flags = FLAGS },
{ "s", "Output video size", OFFSET(size_str), AV_OPT_TYPE_STRING, { .str = NULL }, .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" },
{ "force_original_aspect_ratio", "decrease or increase w/h if necessary to keep the original AR", OFFSET(force_original_aspect_ratio), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 2, FLAGS, "force_oar" },
{ "disable", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 0 }, 0, 0, FLAGS, "force_oar" },
{ "decrease", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 1 }, 0, 0, FLAGS, "force_oar" },
{ "increase", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 2 }, 0, 0, FLAGS, "force_oar" },
{ "force_divisible_by", "enforce that the output resolution is divisible by a defined integer when force_original_aspect_ratio is used", OFFSET(force_divisible_by), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, 256, FLAGS },
{ "eval", "specify when to evaluate expressions", OFFSET(eval_mode), AV_OPT_TYPE_INT, { .i64 = EVAL_MODE_INIT }, 0, EVAL_MODE_NB-1, FLAGS, "eval" },
{ "init", "eval expressions once during initialization", 0, AV_OPT_TYPE_CONST, { .i64 = EVAL_MODE_INIT }, 0, 0, FLAGS, "eval" },
{ "frame", "eval expressions during initialization and per-frame", 0, AV_OPT_TYPE_CONST, { .i64 = EVAL_MODE_FRAME }, 0, 0, FLAGS, "eval" },
{ NULL },
}

Definition at line 953 of file vf_scale_npp.c.

◆ nppscale_class

const AVClass nppscale_class
static
Initial value:
= {
.class_name = "nppscale",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 979 of file vf_scale_npp.c.

◆ nppscale_inputs

const AVFilterPad nppscale_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = nppscale_filter_frame,
}
}

Definition at line 987 of file vf_scale_npp.c.

◆ nppscale_outputs

const AVFilterPad nppscale_outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_props,
}
}

Definition at line 995 of file vf_scale_npp.c.

◆ ff_vf_scale_npp

const 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,
.priv_size = sizeof(NPPScaleContext),
.priv_class = &nppscale_class,
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
}

Definition at line 1003 of file vf_scale_npp.c.

◆ nppscale2ref_inputs

const AVFilterPad nppscale2ref_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = nppscale_filter_frame,
},
{
.name = "ref",
.filter_frame = nppscale_filter_frame_ref,
}
}

Definition at line 1022 of file vf_scale_npp.c.

◆ nppscale2ref_outputs

const AVFilterPad nppscale2ref_outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_props,
.request_frame= request_frame,
},
{
.name = "ref",
.config_props = config_props_ref,
.request_frame= request_frame_ref,
}
}

Definition at line 1035 of file vf_scale_npp.c.

AV_PIX_FMT_CUDA
@ AV_PIX_FMT_CUDA
HW acceleration through CUDA.
Definition: pixfmt.h:225
nppscale_inputs
static const AVFilterPad nppscale_inputs[]
Definition: vf_scale_npp.c:987
nppscale2ref_inputs
static const AVFilterPad nppscale2ref_inputs[]
Definition: vf_scale_npp.c:1022
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:371
nppscale_class
static const AVClass nppscale_class
Definition: vf_scale_npp.c:979
STAGE_RESIZE
@ STAGE_RESIZE
Definition: vf_scale_npp.c:58
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:101
nppscale_uninit
static void nppscale_uninit(AVFilterContext *ctx)
Definition: vf_scale_npp.c:419
config_props
static int config_props(AVFilterLink *outlink)
Definition: vf_scale_npp.c:625
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:66
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:191
nppscale2ref_outputs
static const AVFilterPad nppscale2ref_outputs[]
Definition: vf_scale_npp.c:1035
request_frame_ref
static int request_frame_ref(AVFilterLink *outlink)
Definition: vf_scale_npp.c:946
NPPScaleContext
Definition: vf_scale_npp.c:127
FLAGS
#define FLAGS
Definition: vf_scale_npp.c:952
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
nppscale_interleave
static int nppscale_interleave(AVFilterContext *ctx, NPPScaleStageContext *stage, AVFrame *out, AVFrame *in)
Definition: vf_scale_npp.c:738
NULL
#define NULL
Definition: coverity.c:32
EVAL_MODE_INIT
@ EVAL_MODE_INIT
Definition: vf_scale_npp.c:122
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:235
request_frame
static int request_frame(AVFilterLink *outlink)
Definition: vf_scale_npp.c:941
AV_CLASS_CATEGORY_FILTER
@ AV_CLASS_CATEGORY_FILTER
Definition: log.h:36
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
OFFSET
#define OFFSET(x)
Definition: vf_scale_npp.c:951
nppscale_filter_frame_ref
static int nppscale_filter_frame_ref(AVFilterLink *link, AVFrame *in)
Definition: vf_scale_npp.c:910
nppscale_filter_frame
static int nppscale_filter_frame(AVFilterLink *link, AVFrame *in)
Definition: vf_scale_npp.c:866
nppscale_resize
static int nppscale_resize(AVFilterContext *ctx, NPPScaleStageContext *stage, AVFrame *out, AVFrame *in)
Definition: vf_scale_npp.c:710
FILTER_SINGLE_PIXFMT
#define FILTER_SINGLE_PIXFMT(pix_fmt_)
Definition: internal.h:181
EVAL_MODE_FRAME
@ EVAL_MODE_FRAME
Definition: vf_scale_npp.c:123
config_props_ref
static int config_props_ref(AVFilterLink *outlink)
Definition: vf_scale_npp.c:670
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:89
nppscale_init
static av_cold int nppscale_init(AVFilterContext *ctx)
Definition: vf_scale_npp.c:283
EVAL_MODE_NB
@ EVAL_MODE_NB
Definition: vf_scale_npp.c:124
STAGE_INTERLEAVE
@ STAGE_INTERLEAVE
Definition: vf_scale_npp.c:59
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:224
nppscale_outputs
static const AVFilterPad nppscale_outputs[]
Definition: vf_scale_npp.c:995
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:71
STAGE_DEINTERLEAVE
@ STAGE_DEINTERLEAVE
Definition: vf_scale_npp.c:57
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
options
static const AVOption options[]
Definition: vf_scale_npp.c:953
nppscale_deinterleave
static int nppscale_deinterleave(AVFilterContext *ctx, NPPScaleStageContext *stage, AVFrame *out, AVFrame *in)
Definition: vf_scale_npp.c:686
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:192
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:228
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:233