41 #define OFFSET(x) offsetof(VPPContext, x)
42 #define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM)
45 #define ENH_FILTERS_COUNT (7)
46 #define QSV_HAVE_ROTATION QSV_VERSION_ATLEAST(1, 17)
47 #define QSV_HAVE_MIRRORING QSV_VERSION_ATLEAST(1, 19)
99 {
"deinterlace",
"deinterlace mode: 0=off, 1=bob, 2=advanced",
OFFSET(deinterlace),
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, MFX_DEINTERLACING_ADVANCED, .flags =
FLAGS,
"deinterlace" },
100 {
"bob",
"Bob deinterlace mode.", 0,
AV_OPT_TYPE_CONST, { .i64 = MFX_DEINTERLACING_BOB }, .flags =
FLAGS,
"deinterlace" },
101 {
"advanced",
"Advanced deinterlace mode. ", 0,
AV_OPT_TYPE_CONST, { .i64 = MFX_DEINTERLACING_ADVANCED }, .flags =
FLAGS,
"deinterlace" },
161 #define PASS_EXPR(e, s) {\
162 ret = av_expr_parse(&e, s, var_names, NULL, NULL, NULL, NULL, 0, ctx); \
164 av_log(ctx, AV_LOG_ERROR, "Error when passing '%s'.\n", s);\
168 #define CALC_EXPR(e, v, i) {\
169 i = v = av_expr_eval(e, var_values, NULL); \
313 in_format = inlink->
format;
335 MFX_DEINTERLACING_BOB : MFX_DEINTERLACING_ADVANCED;
341 memset(&vpp->
frc_conf, 0,
sizeof(mfxExtVPPFrameRateConversion));
342 vpp->
frc_conf.Header.BufferId = MFX_EXTBUFF_VPP_FRAME_RATE_CONVERSION;
343 vpp->
frc_conf.Header.BufferSz =
sizeof(mfxExtVPPFrameRateConversion);
344 vpp->
frc_conf.Algorithm = MFX_FRCALGM_DISTRIBUTED_TIMESTAMP;
350 memset(&vpp->
denoise_conf, 0,
sizeof(mfxExtVPPDenoise));
351 vpp->
denoise_conf.Header.BufferId = MFX_EXTBUFF_VPP_DENOISE;
352 vpp->
denoise_conf.Header.BufferSz =
sizeof(mfxExtVPPDenoise);
359 memset(&vpp->
detail_conf, 0,
sizeof(mfxExtVPPDetail));
360 vpp->
detail_conf.Header.BufferId = MFX_EXTBUFF_VPP_DETAIL;
361 vpp->
detail_conf.Header.BufferSz =
sizeof(mfxExtVPPDetail);
368 memset(&vpp->
procamp_conf, 0,
sizeof(mfxExtVPPProcAmp));
369 vpp->
procamp_conf.Header.BufferId = MFX_EXTBUFF_VPP_PROCAMP;
370 vpp->
procamp_conf.Header.BufferSz =
sizeof(mfxExtVPPProcAmp);
380 #ifdef QSV_HAVE_ROTATION
383 vpp->
rotate = MFX_ANGLE_270;
384 vpp->
hflip = MFX_MIRRORING_HORIZONTAL;
387 vpp->
rotate = MFX_ANGLE_90;
388 vpp->
hflip = MFX_MIRRORING_DISABLED;
391 vpp->
rotate = MFX_ANGLE_270;
392 vpp->
hflip = MFX_MIRRORING_DISABLED;
395 vpp->
rotate = MFX_ANGLE_90;
396 vpp->
hflip = MFX_MIRRORING_HORIZONTAL;
399 vpp->
rotate = MFX_ANGLE_180;
400 vpp->
hflip = MFX_MIRRORING_DISABLED;
403 vpp->
rotate = MFX_ANGLE_0;
404 vpp->
hflip = MFX_MIRRORING_HORIZONTAL;
407 vpp->
rotate = MFX_ANGLE_180;
408 vpp->
hflip = MFX_MIRRORING_HORIZONTAL;
416 "not supported with this MSDK version.\n");
422 #ifdef QSV_HAVE_ROTATION
424 vpp->
rotation_conf.Header.BufferId = MFX_EXTBUFF_VPP_ROTATION;
425 vpp->
rotation_conf.Header.BufferSz =
sizeof(mfxExtVPPRotation);
428 if (MFX_ANGLE_90 == vpp->
rotate || MFX_ANGLE_270 == vpp->
rotate) {
430 FFSWAP(
int, outlink->
w, outlink->
h);
437 "not supported with this MSDK version.\n");
443 #ifdef QSV_HAVE_MIRRORING
452 "not supported with this MSDK version.\n");
459 inlink->
w != outlink->
w || inlink->
h != outlink->
h || in_format != vpp->
out_format)
508 &
ctx->inputs[0]->outcfg.formats);
512 &
ctx->outputs[0]->incfg.formats);
static const AVFilterPad inputs[]
static const AVFilterPad outputs[]
simple assert() macros that are a bit more flexible than ISO C assert().
Libavcodec external API header.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Main libavfilter public API header.
static av_cold int init(AVCodecContext *avctx)
#define FFSWAP(type, a, b)
static av_cold int uninit(AVCodecContext *avctx)
void av_expr_free(AVExpr *e)
Free a parsed expression previously created with av_expr_parse().
simple arithmetic expression evaluator
AVBufferRef * av_buffer_ref(AVBufferRef *buf)
Create a new reference to an AVBuffer.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_VERBOSE
Detailed information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_default_item_name(void *ptr)
Return the context name.
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
#define AV_NOPTS_VALUE
Undefined timestamp value.
#define LIBAVUTIL_VERSION_INT
#define FF_FILTER_FLAG_HWFRAME_AWARE
The filter is aware of hardware frames, and any hardware frame context should not be automatically pr...
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
enum AVPixelFormat av_get_pix_fmt(const char *name)
Return the pixel format corresponding to name.
AVPixelFormat
Pixel format.
@ 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...
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_YUYV422
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
@ AV_PIX_FMT_QSV
HW acceleration through QSV, data[3] contains a pointer to the mfxFrameSurface1 structure.
int ff_qsvvpp_create(AVFilterContext *avctx, QSVVPPContext **vpp, QSVVPPParam *param)
int ff_qsvvpp_free(QSVVPPContext **vpp)
int ff_qsvvpp_filter_frame(QSVVPPContext *s, AVFilterLink *inlink, AVFrame *picref)
Intel Quick Sync Video VPP base function.
uint8_t * data
The data buffer.
Describe the class of an AVClass context structure.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
void * priv
private data for use by the filter
A link between two filters.
int w
agreed upon image width
int h
agreed upon image height
AVFilterContext * src
source filter
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link.
AVBufferRef * hw_frames_ctx
For hwaccel pixel formats, this should be a reference to the AVHWFramesContext describing the frames.
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable; if left to 0/0,...
AVFilterContext * dst
dest filter
int format
agreed upon media format
A filter pad used for either input or output.
const char * name
Pad name.
const char * name
Filter name.
This structure describes decoded (raw) audio or video data.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
This struct describes a set or pool of "hardware" frames (i.e.
Rational number (pair of numerator and denominator).
int(* filter_frame)(AVFilterLink *outlink, AVFrame *frame)
enum AVPixelFormat out_sw_format
mfxExtVPPRotation rotation_conf
mfxExtVPPDeinterlacing deinterlace_conf
enum AVPixelFormat out_format
Output sw format.
mfxExtVPPFrameRateConversion frc_conf
mfxExtVPPProcAmp procamp_conf
mfxExtVPPDenoise denoise_conf
mfxExtVPPMirroring mirroring_conf
mfxExtVPPDetail detail_conf
static enum AVPixelFormat in_pix_fmts[]
static enum AVPixelFormat out_pix_fmts[]
static av_cold int vpp_init(AVFilterContext *ctx)
static const AVOption options[]
static int query_formats(AVFilterContext *ctx)
static int config_input(AVFilterLink *inlink)
static const AVFilterPad vpp_inputs[]
static const AVFilterPad vpp_outputs[]
static av_cold void vpp_uninit(AVFilterContext *ctx)
static int eval_expr(AVFilterContext *ctx)
static const char *const var_names[]
static int config_output(AVFilterLink *outlink)
#define ENH_FILTERS_COUNT
static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
static const AVClass vpp_class
#define CALC_EXPR(e, v, i)