FFmpeg
Data Structures | Macros | Functions | Variables
vf_sr.c File Reference
#include "avfilter.h"
#include "internal.h"
#include "video.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.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_DNN_DEFINE_CLASS (sr)
 
static av_cold int init (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 enum AVPixelFormat pixel_formats []
 
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 45 of file vf_sr.c.

◆ FLAGS

Definition at line 46 of file vf_sr.c.

Function Documentation

◆ AVFILTER_DNN_DEFINE_CLASS()

AVFILTER_DNN_DEFINE_CLASS ( sr  )

◆ init()

static av_cold int init ( AVFilterContext context)
static

Definition at line 58 of file vf_sr.c.

◆ config_output()

static int config_output ( AVFilterLink outlink)
static

Definition at line 70 of file vf_sr.c.

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 112 of file vf_sr.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext context)
static

Definition at line 163 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 = 1 }, 0, 1, FLAGS, .unit = "backend" },
{ "scale_factor", "scale factor for SRCNN model", OFFSET(scale_factor), AV_OPT_TYPE_INT, { .i64 = 2 }, 2, 4, FLAGS },
{ NULL }
}

Definition at line 47 of file vf_sr.c.

◆ pixel_formats

enum AVPixelFormat pixel_formats[]
static

◆ sr_inputs

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

Definition at line 172 of file vf_sr.c.

◆ sr_outputs

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

Definition at line 180 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 188 of file vf_sr.c.

sr_outputs
static const AVFilterPad sr_outputs[]
Definition: vf_sr.c:180
FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: internal.h:162
preinit
static av_cold int preinit(AVFilterContext *ctx)
Definition: af_aresample.c:49
SRContext
Definition: af_acrusher.c:36
uninit
static av_cold void uninit(AVFilterContext *context)
Definition: vf_sr.c:163
ff_dnn_filter_init_child_class
int ff_dnn_filter_init_child_class(AVFilterContext *filter)
Definition: dnn_filter_common.c:61
init
static av_cold int init(AVFilterContext *context)
Definition: vf_sr.c:58
FLAGS
#define FLAGS
Definition: vf_sr.c:46
pixel_formats
static enum AVPixelFormat pixel_formats[]
Definition: vf_sr.c:64
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:73
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:182
OFFSET
#define OFFSET(x)
Definition: vf_sr.c:45
NULL
#define NULL
Definition: coverity.c:32
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:81
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
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_sr.c:112
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:245
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:78
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:77
sr_inputs
static const AVFilterPad sr_inputs[]
Definition: vf_sr.c:172
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:183
AV_PIX_FMT_YUV411P
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:80
AV_PIX_FMT_YUV410P
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:79
config_output
static int config_output(AVFilterLink *outlink)
Definition: vf_sr.c:70