FFmpeg
Macros | Functions | Variables
vf_sr_amf.c File Reference
#include <stdio.h>
#include <string.h>
#include "libavutil/avassert.h"
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/time.h"
#include "libavutil/hwcontext.h"
#include "libavutil/hwcontext_amf.h"
#include "libavutil/hwcontext_amf_internal.h"
#include "AMF/components/HQScaler.h"
#include "AMF/components/ColorSpace.h"
#include "vf_amf_common.h"
#include "avfilter.h"
#include "avfilter_internal.h"
#include "formats.h"
#include "video.h"

Go to the source code of this file.

Macros

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

Functions

static int amf_filter_query_formats (AVFilterContext *avctx)
 
static int amf_filter_config_output (AVFilterLink *outlink)
 
 AVFILTER_DEFINE_CLASS (sr_amf)
 

Variables

static const AVOption sr_amf_options []
 
static const AVFilterPad amf_filter_inputs []
 
static const AVFilterPad amf_filter_outputs []
 
FFFilter ff_vf_sr_amf
 

Detailed Description

Super resolution video filter with AMF hardware acceleration

Definition in file vf_sr_amf.c.

Macro Definition Documentation

◆ OFFSET

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

Definition at line 131 of file vf_sr_amf.c.

◆ FLAGS

Definition at line 132 of file vf_sr_amf.c.

Function Documentation

◆ amf_filter_query_formats()

static int amf_filter_query_formats ( AVFilterContext avctx)
static

Definition at line 55 of file vf_sr_amf.c.

◆ amf_filter_config_output()

static int amf_filter_config_output ( AVFilterLink outlink)
static

Definition at line 83 of file vf_sr_amf.c.

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( sr_amf  )

Variable Documentation

◆ sr_amf_options

const AVOption sr_amf_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 },
{ "sharpness", "Sharpness", OFFSET(sharpness), AV_OPT_TYPE_FLOAT, { .dbl = -1 }, -1, 2., FLAGS, "sharpness" },
{ "keep-ratio", "Keep aspect ratio", OFFSET(keep_ratio), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS, "keep_ration" },
{ "fill", "Fill", OFFSET(fill), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS, "fill" },
{ "algorithm", "Scaling algorithm", OFFSET(algorithm), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, AMF_HQ_SCALER_ALGORITHM_VIDEOSR1_1, FLAGS, "algorithm" },
{ "bilinear", "Bilinear", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_HQ_SCALER_ALGORITHM_BILINEAR }, 0, 0, FLAGS, "algorithm" },
{ "bicubic", "Bicubic", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_HQ_SCALER_ALGORITHM_BICUBIC }, 0, 0, FLAGS, "algorithm" },
{ "sr1-0", "Video SR1.0", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_HQ_SCALER_ALGORITHM_VIDEOSR1_0 }, 0, 0, FLAGS, "algorithm" },
{ "point", "Point", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_HQ_SCALER_ALGORITHM_POINT }, 0, 0, FLAGS, "algorithm" },
{ "sr1-1", "Video SR1.1", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_HQ_SCALER_ALGORITHM_VIDEOSR1_1 }, 0, 0, FLAGS, "algorithm" },
{ NULL },
}

Definition at line 133 of file vf_sr_amf.c.

◆ amf_filter_inputs

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

Definition at line 155 of file vf_sr_amf.c.

◆ amf_filter_outputs

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

Definition at line 163 of file vf_sr_amf.c.

◆ ff_vf_sr_amf

FFFilter ff_vf_sr_amf
Initial value:
= {
.p.name = "sr_amf",
.p.description = NULL_IF_CONFIG_SMALL("AMF HQ video upscaling"),
.p.priv_class = &sr_amf_class,
.priv_size = sizeof(AMFFilterContext),
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
}

Definition at line 171 of file vf_sr_amf.c.

amf_filter_config_output
static int amf_filter_config_output(AVFilterLink *outlink)
Definition: vf_sr_amf.c:83
FLAGS
#define FLAGS
Definition: vf_sr_amf.c:132
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: filters.h:262
OFFSET
#define OFFSET(x)
Definition: vf_sr_amf.c:131
AV_PIX_FMT_AMF_SURFACE
@ AV_PIX_FMT_AMF_SURFACE
HW acceleration through AMF.
Definition: pixfmt.h:477
amf_filter_inputs
static const AVFilterPad amf_filter_inputs[]
Definition: vf_sr_amf.c:155
amf_filter_query_formats
static int amf_filter_query_formats(AVFilterContext *avctx)
Definition: vf_sr_amf.c:55
AMFFilterContext
Definition: vf_amf_common.h:28
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: filters.h:263
NULL
#define NULL
Definition: coverity.c:32
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: filters.h:206
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:368
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:94
AVFILTER_FLAG_HWDEVICE
#define AVFILTER_FLAG_HWDEVICE
The filter can create hardware frames using AVFilterContext.hw_device_ctx.
Definition: avfilter.h:171
amf_filter_filter_frame
int amf_filter_filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_amf_common.c:74
amf_filter_uninit
void amf_filter_uninit(AVFilterContext *avctx)
Definition: vf_amf_common.c:58
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
Definition: opt.h:271
uninit
static void uninit(AVBSFContext *ctx)
Definition: pcm_rechunk.c:68
amf_filter_init
int amf_filter_init(AVFilterContext *avctx)
Definition: vf_amf_common.c:41
amf_filter_outputs
static const AVFilterPad amf_filter_outputs[]
Definition: vf_sr_amf.c:163
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition: opt.h:327
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition: opt.h:276
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299
FILTER_SINGLE_PIXFMT
#define FILTER_SINGLE_PIXFMT(pix_fmt_)
Definition: filters.h:252
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: filters.h:236