FFmpeg
Data Structures | Macros | Functions | Variables
vf_sr.c File Reference
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavformat/avio.h"
#include "libswscale/swscale.h"
#include "dnn_filter_common.h"

Go to the source code of this file.

Data Structures

struct  SRContext
 

Macros

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

Functions

 AVFILTER_DEFINE_CLASS (sr)
 
static av_cold int init (AVFilterContext *context)
 
static int query_formats (AVFilterContext *context)
 
static int config_output (AVFilterLink *outlink)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static av_cold void uninit (AVFilterContext *context)
 

Variables

static const AVOption sr_options []
 
static const AVFilterPad sr_inputs []
 
static const AVFilterPad sr_outputs []
 
const AVFilter ff_vf_sr
 

Detailed Description

Filter implementing image super-resolution using deep convolutional networks. https://arxiv.org/abs/1501.00092 https://arxiv.org/abs/1609.05158

Definition in file vf_sr.c.

Macro Definition Documentation

◆ OFFSET

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

Definition at line 46 of file vf_sr.c.

◆ FLAGS

Definition at line 47 of file vf_sr.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( sr  )

◆ init()

static av_cold int init ( AVFilterContext context)
static

Definition at line 63 of file vf_sr.c.

◆ query_formats()

static int query_formats ( AVFilterContext context)
static

Definition at line 69 of file vf_sr.c.

◆ config_output()

static int config_output ( AVFilterLink outlink)
static

Definition at line 85 of file vf_sr.c.

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 127 of file vf_sr.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext context)
static

Definition at line 169 of file vf_sr.c.

Variable Documentation

◆ sr_options

const AVOption sr_options[]
static
Initial value:
= {
{ "dnn_backend", "DNN backend used for model execution", OFFSET(dnnctx.backend_type), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, FLAGS, "backend" },
{ "native", "native backend flag", 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0, FLAGS, "backend" },
{ "scale_factor", "scale factor for SRCNN model", OFFSET(scale_factor), AV_OPT_TYPE_INT, { .i64 = 2 }, 2, 4, FLAGS },
{ "model", "path to model file specifying network architecture and its parameters", OFFSET(dnnctx.model_filename), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
{ "input", "input name of the model", OFFSET(dnnctx.model_inputname), AV_OPT_TYPE_STRING, { .str = "x" }, 0, 0, FLAGS },
{ "output", "output name of the model", OFFSET(dnnctx.model_outputname), AV_OPT_TYPE_STRING, { .str = "y" }, 0, 0, FLAGS },
{ NULL }
}

Definition at line 48 of file vf_sr.c.

◆ sr_inputs

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

Definition at line 178 of file vf_sr.c.

◆ sr_outputs

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

Definition at line 187 of file vf_sr.c.

◆ ff_vf_sr

const AVFilter ff_vf_sr
Initial value:
= {
.name = "sr",
.description = NULL_IF_CONFIG_SMALL("Apply DNN-based image super resolution to the input."),
.priv_size = sizeof(SRContext),
.init = init,
.priv_class = &sr_class,
}

Definition at line 196 of file vf_sr.c.

sr_outputs
static const AVFilterPad sr_outputs[]
Definition: vf_sr.c:187
SRContext
Definition: af_acrusher.c:35
uninit
static av_cold void uninit(AVFilterContext *context)
Definition: vf_sr.c:169
query_formats
static int query_formats(AVFilterContext *context)
Definition: vf_sr.c:69
inputs
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
Definition: filter_design.txt:243
init
static av_cold int init(AVFilterContext *context)
Definition: vf_sr.c:63
FLAGS
#define FLAGS
Definition: vf_sr.c:47
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
OFFSET
#define OFFSET(x)
Definition: vf_sr.c:46
NULL
#define NULL
Definition: coverity.c:32
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
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_sr.c:127
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
sr_inputs
static const AVFilterPad sr_inputs[]
Definition: vf_sr.c:178
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:229
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234
config_output
static int config_output(AVFilterLink *outlink)
Definition: vf_sr.c:85