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

Hardware accelerated common filters based on Intel Quick Sync Video VPP. More...

#include <float.h>
#include "config_components.h"
#include "libavutil/opt.h"
#include "libavutil/eval.h"
#include "libavutil/hwcontext.h"
#include "libavutil/hwcontext_qsv.h"
#include "libavutil/pixdesc.h"
#include "libavutil/mathematics.h"
#include "libavutil/mastering_display_metadata.h"
#include "formats.h"
#include "avfilter.h"
#include "filters.h"
#include "qsvvpp.h"
#include "transpose.h"

Go to the source code of this file.

Data Structures

struct  VPPContext
 

Macros

#define OFFSET(x)
 
#define FLAGS   (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM)
 
#define ENH_FILTERS_COUNT   (8)
 
#define PASS_EXPR(e, s)
 
#define CALC_EXPR(e, v, i, d)
 
#define STRING_OPTION(var_name, func_name, default_value)
 
#define INIT_MFX_EXTBUF(extbuf, id)
 
#define SET_MFX_PARAM_FIELD(extbuf, field, value)
 
#define DEFINE_QSV_FILTER(x, sn, ln, fmts)
 

Enumerations

enum  var_name {
  VAR_IW , VAR_IN_W , VAR_IH , VAR_IN_H ,
  VAR_OW , VAR_OUT_W , VAR_W , VAR_OH ,
  VAR_OUT_H , VAR_H , VAR_CW , VAR_CH ,
  VAR_CX , VAR_CY , VAR_A , VAR_DAR ,
  VAR_SAR , VAR_VARS_NB
}
 

Functions

static int eval_expr (AVFilterContext *ctx)
 
static av_cold int vpp_preinit (AVFilterContext *ctx)
 
static av_cold int vpp_init (AVFilterContext *ctx)
 
static int config_input (AVFilterLink *inlink)
 
static mfxStatus get_mfx_version (const AVFilterContext *ctx, mfxVersion *mfx_version)
 
static int vpp_set_frame_ext_params (AVFilterContext *ctx, const AVFrame *in, AVFrame *out, QSVVPPFrameParam *fp)
 
static int config_output (AVFilterLink *outlink)
 
static int activate (AVFilterContext *ctx)
 
static av_cold void vpp_uninit (AVFilterContext *ctx)
 

Variables

static const char *const var_names []
 
static const AVFilterPad vpp_inputs []
 
static const AVFilterPad vpp_outputs []
 

Detailed Description

Hardware accelerated common filters based on Intel Quick Sync Video VPP.

Definition in file vf_vpp_qsv.c.

Macro Definition Documentation

◆ OFFSET

#define OFFSET ( x)
Value:
offsetof(VPPContext, x)

Definition at line 43 of file vf_vpp_qsv.c.

◆ FLAGS

Definition at line 44 of file vf_vpp_qsv.c.

◆ ENH_FILTERS_COUNT

#define ENH_FILTERS_COUNT   (8)

Definition at line 47 of file vf_vpp_qsv.c.

Referenced by config_output().

◆ PASS_EXPR

#define PASS_EXPR ( e,
s )
Value:
{\
if (s) {\
ret = av_expr_parse(&e, s, var_names, NULL, NULL, NULL, NULL, 0, ctx); \
if (ret < 0) { \
av_log(ctx, AV_LOG_ERROR, "Error when passing '%s'.\n", s); \
goto release; \
} \
}\
}
#define s(width, name)
Definition cbs_vp9.c:198
#define NULL
Definition coverity.c:32
int av_expr_parse(AVExpr **expr, const char *s, const char *const *const_names, const char *const *func1_names, double(*const *funcs1)(void *, double), const char *const *func2_names, double(*const *funcs2)(void *, double, double), int log_offset, void *log_ctx)
Parse an expression.
Definition eval.c:735
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition log.h:210
static const char *const var_names[]
Definition noise.c:30
static AVFormatContext * ctx
Definition movenc.c:49

Referenced by eval_expr().

◆ CALC_EXPR

#define CALC_EXPR ( e,
v,
i,
d )
Value:
{\
if (e)\
i = v = av_expr_eval(e, var_values, NULL); \
else\
i = v = d;\
}
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
Definition eval.c:824

Referenced by eval_expr().

◆ STRING_OPTION

#define STRING_OPTION ( var_name,
func_name,
default_value )
Value:
do { \
if (vpp->var_name ## _str) { \
int var = av_ ## func_name ## _from_name(vpp->var_name ## _str); \
if (var < 0) { \
av_log(ctx, AV_LOG_ERROR, "Invalid %s.\n", #var_name); \
return AVERROR(EINVAL); \
} \
vpp->var_name = var; \
} else { \
vpp->var_name = default_value; \
} \
} while (0)
#define AVERROR(e)
Definition error.h:45
var_name
Definition noise.c:46

Referenced by vpp_init().

◆ INIT_MFX_EXTBUF

#define INIT_MFX_EXTBUF ( extbuf,
id )
Value:
do { \
memset(&vpp->extbuf, 0, sizeof(vpp->extbuf)); \
vpp->extbuf.Header.BufferId = id; \
vpp->extbuf.Header.BufferSz = sizeof(vpp->extbuf); \
param.ext_buf[param.num_ext_buf++] = (mfxExtBuffer*)&vpp->extbuf; \
} while (0)
enum AVCodecID id
Definition dts2pts.c:607

Referenced by config_output().

◆ SET_MFX_PARAM_FIELD

#define SET_MFX_PARAM_FIELD ( extbuf,
field,
value )
Value:
do { \
vpp->extbuf.field = value; \
} while (0)
double value
Definition eval.c:102

Referenced by config_output().

◆ DEFINE_QSV_FILTER

#define DEFINE_QSV_FILTER ( x,
sn,
ln,
fmts )
Value:
static const AVClass x##_class = { \
.class_name = #sn "_qsv", \
.item_name = av_default_item_name, \
.option = x##_options, \
.version = LIBAVUTIL_VERSION_INT, \
}; \
const FFFilter ff_vf_##sn##_qsv = { \
.p.name = #sn "_qsv", \
.p.description = NULL_IF_CONFIG_SMALL("Quick Sync Video " #ln), \
.p.priv_class = &x##_class, \
.p.flags = AVFILTER_FLAG_HWDEVICE, \
.preinit = x##_preinit, \
.init = vpp_init, \
.uninit = vpp_uninit, \
.priv_size = sizeof(VPPContext), \
FILTER_OUTPUTS(vpp_outputs), \
fmts, \
.activate = activate, \
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, \
};
#define AVFILTER_FLAG_HWDEVICE
The filter can create hardware frames using AVFilterContext.hw_device_ctx.
Definition avfilter.h:187
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 int activate(AVBitStreamFilterContext *ctx)
#define FILTER_INPUTS(array)
Definition filters.h:264
#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 NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
Describe the class of an AVClass context structure.
Definition log.h:76
static av_cold int vpp_init(AVFilterContext *ctx)
Definition vf_vpp_qsv.c:260
static const AVFilterPad vpp_inputs[]
Definition vf_vpp_qsv.c:811
static const AVFilterPad vpp_outputs[]
Definition vf_vpp_qsv.c:820
static av_cold void vpp_uninit(AVFilterContext *ctx)
Definition vf_vpp_qsv.c:806

Definition at line 828 of file vf_vpp_qsv.c.

Enumeration Type Documentation

◆ var_name

enum var_name
Enumerator
VAR_IW 
VAR_IN_W 
VAR_IH 
VAR_IN_H 
VAR_OW 
VAR_OUT_W 
VAR_W 
VAR_OH 
VAR_OUT_H 
VAR_H 
VAR_CW 
VAR_CH 
VAR_CX 
VAR_CY 
VAR_A 
VAR_DAR 
VAR_SAR 
VAR_VARS_NB 

Definition at line 141 of file vf_vpp_qsv.c.

Function Documentation

◆ eval_expr()

static int eval_expr ( AVFilterContext * ctx)
static

Definition at line 155 of file vf_vpp_qsv.c.

Referenced by config_input().

◆ vpp_preinit()

static av_cold int vpp_preinit ( AVFilterContext * ctx)
static

Definition at line 240 of file vf_vpp_qsv.c.

◆ vpp_init()

static av_cold int vpp_init ( AVFilterContext * ctx)
static

Definition at line 260 of file vf_vpp_qsv.c.

◆ config_input()

static int config_input ( AVFilterLink * inlink)
static

Definition at line 295 of file vf_vpp_qsv.c.

◆ get_mfx_version()

static mfxStatus get_mfx_version ( const AVFilterContext * ctx,
mfxVersion * mfx_version )
static

Definition at line 365 of file vf_vpp_qsv.c.

Referenced by config_output().

◆ vpp_set_frame_ext_params()

static int vpp_set_frame_ext_params ( AVFilterContext * ctx,
const AVFrame * in,
AVFrame * out,
QSVVPPFrameParam * fp )
static

Definition at line 391 of file vf_vpp_qsv.c.

Referenced by config_output().

◆ config_output()

static int config_output ( AVFilterLink * outlink)
static

Definition at line 525 of file vf_vpp_qsv.c.

◆ activate()

static int activate ( AVFilterContext * ctx)
static

Definition at line 729 of file vf_vpp_qsv.c.

◆ vpp_uninit()

static av_cold void vpp_uninit ( AVFilterContext * ctx)
static

Definition at line 806 of file vf_vpp_qsv.c.

Variable Documentation

◆ var_names

const char* const var_names[]
static
Initial value:
= {
"iw", "in_w",
"ih", "in_h",
"ow", "out_w", "w",
"oh", "out_h", "h",
"cw",
"ch",
"cx",
"cy",
"a", "dar",
"sar",
}

Definition at line 127 of file vf_vpp_qsv.c.

◆ vpp_inputs

const AVFilterPad vpp_inputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_input,
.get_buffer.video = ff_qsvvpp_get_video_buffer,
},
}
static int config_input(AVFilterLink *inlink)
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
AVFrame * ff_qsvvpp_get_video_buffer(AVFilterLink *inlink, int w, int h)
Definition qsvvpp.c:1141

Definition at line 811 of file vf_vpp_qsv.c.

◆ vpp_outputs

const AVFilterPad vpp_outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_output,
},
}
static int config_output(AVBitStreamFilterLink *outlink)

Definition at line 820 of file vf_vpp_qsv.c.