FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
vf_ssim.c File Reference
#include "libavutil/avstring.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "dualinput.h"
#include "drawutils.h"
#include "formats.h"
#include "internal.h"
#include "ssim.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  SSIMContext
 

Macros

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

Functions

 AVFILTER_DEFINE_CLASS (ssim)
 
static void set_meta (AVDictionary **metadata, const char *key, char comp, float d)
 
static void ssim_4x4xn (const uint8_t *main, ptrdiff_t main_stride, const uint8_t *ref, ptrdiff_t ref_stride, int(*sums)[4], int width)
 
static float ssim_end1 (int s1, int s2, int ss, int s12)
 
static float ssim_endn (const int(*sum0)[4], const int(*sum1)[4], int width)
 
static float ssim_plane (SSIMDSPContext *dsp, uint8_t *main, int main_stride, uint8_t *ref, int ref_stride, int width, int height, void *temp)
 
static double ssim_db (double ssim, double weight)
 
static AVFramedo_ssim (AVFilterContext *ctx, AVFrame *main, const AVFrame *ref)
 
static av_cold int init (AVFilterContext *ctx)
 
static int query_formats (AVFilterContext *ctx)
 
static int config_input_ref (AVFilterLink *inlink)
 
static int config_output (AVFilterLink *outlink)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *buf)
 
static int request_frame (AVFilterLink *outlink)
 
static av_cold void uninit (AVFilterContext *ctx)
 

Variables

static const AVOption ssim_options []
 
static const AVFilterPad ssim_inputs []
 
static const AVFilterPad ssim_outputs []
 
AVFilter ff_vf_ssim
 

Macro Definition Documentation

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

Definition at line 66 of file vf_ssim.c.

Definition at line 67 of file vf_ssim.c.

Function Documentation

AVFILTER_DEFINE_CLASS ( ssim  )
static void set_meta ( AVDictionary **  metadata,
const char *  key,
char  comp,
float  d 
)
static

Definition at line 77 of file vf_ssim.c.

Referenced by do_ssim().

static void ssim_4x4xn ( const uint8_t main,
ptrdiff_t  main_stride,
const uint8_t ref,
ptrdiff_t  ref_stride,
int(*)  sums[4],
int  width 
)
static

Definition at line 90 of file vf_ssim.c.

Referenced by config_input_ref().

static float ssim_end1 ( int  s1,
int  s2,
int  ss,
int  s12 
)
static

Definition at line 121 of file vf_ssim.c.

Referenced by ssim_endn().

static float ssim_endn ( const int(*)  sum0[4],
const int(*)  sum1[4],
int  width 
)
static

Definition at line 137 of file vf_ssim.c.

Referenced by config_input_ref().

static float ssim_plane ( SSIMDSPContext dsp,
uint8_t main,
int  main_stride,
uint8_t ref,
int  ref_stride,
int  width,
int  height,
void temp 
)
static

Definition at line 150 of file vf_ssim.c.

Referenced by do_ssim().

static double ssim_db ( double  ssim,
double  weight 
)
static

Definition at line 177 of file vf_ssim.c.

Referenced by do_ssim(), and uninit().

static AVFrame* do_ssim ( AVFilterContext ctx,
AVFrame main,
const AVFrame ref 
)
static

Definition at line 182 of file vf_ssim.c.

Referenced by init().

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 222 of file vf_ssim.c.

static int query_formats ( AVFilterContext ctx)
static

Definition at line 248 of file vf_ssim.c.

static int config_input_ref ( AVFilterLink inlink)
static

Definition at line 266 of file vf_ssim.c.

static int config_output ( AVFilterLink outlink)
static

Definition at line 312 of file vf_ssim.c.

static int filter_frame ( AVFilterLink inlink,
AVFrame buf 
)
static

Definition at line 331 of file vf_ssim.c.

static int request_frame ( AVFilterLink outlink)
static

Definition at line 337 of file vf_ssim.c.

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 343 of file vf_ssim.c.

Variable Documentation

const AVOption ssim_options[]
static
Initial value:
= {
{"stats_file", "Set file where to store per-frame difference information", OFFSET(stats_file_str), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
{"f", "Set file where to store per-frame difference information", OFFSET(stats_file_str), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
{ NULL }
}
#define NULL
Definition: coverity.c:32
#define FLAGS
Definition: vf_ssim.c:67
#define OFFSET(x)
Definition: vf_ssim.c:66

Definition at line 69 of file vf_ssim.c.

const AVFilterPad ssim_inputs[]
static
Initial value:
= {
{
.name = "main",
.filter_frame = filter_frame,
},{
.name = "reference",
.filter_frame = filter_frame,
.config_props = config_input_ref,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
Definition: vf_ssim.c:331
static int config_input_ref(AVFilterLink *inlink)
Definition: vf_ssim.c:266

Definition at line 368 of file vf_ssim.c.

const AVFilterPad ssim_outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_output,
.request_frame = request_frame,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int request_frame(AVFilterLink *outlink)
Definition: vf_ssim.c:337
static int config_output(AVFilterLink *outlink)
Definition: vf_ssim.c:312

Definition at line 382 of file vf_ssim.c.

AVFilter ff_vf_ssim
Initial value:
= {
.name = "ssim",
.description = NULL_IF_CONFIG_SMALL("Calculate the SSIM between two video streams."),
.init = init,
.uninit = uninit,
.query_formats = query_formats,
.priv_size = sizeof(SSIMContext),
.priv_class = &ssim_class,
}
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_ssim.c:343
static av_cold int init(AVFilterContext *ctx)
Definition: vf_ssim.c:222
static const AVFilterPad ssim_inputs[]
Definition: vf_ssim.c:368
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:176
static const AVFilterPad outputs[]
Definition: af_afftfilt.c:386
static const AVFilterPad inputs[]
Definition: af_afftfilt.c:376
static const AVFilterPad ssim_outputs[]
Definition: vf_ssim.c:382
static int query_formats(AVFilterContext *ctx)
Definition: vf_ssim.c:248

Definition at line 392 of file vf_ssim.c.