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
 
#define SUM_LEN(w)   (((w) >> 2) + 3)
 
#define PF(suf)   AV_PIX_FMT_YUV420##suf, AV_PIX_FMT_YUV422##suf, AV_PIX_FMT_YUV444##suf, AV_PIX_FMT_GBR##suf
 

Functions

 AVFILTER_DEFINE_CLASS (ssim)
 
static void set_meta (AVDictionary **metadata, const char *key, char comp, float d)
 
static void ssim_4x4xn_16bit (const uint8_t *main8, ptrdiff_t main_stride, const uint8_t *ref8, ptrdiff_t ref_stride, int64_t(*sums)[4], int width)
 
static void ssim_4x4xn_8bit (const uint8_t *main, ptrdiff_t main_stride, const uint8_t *ref, ptrdiff_t ref_stride, int(*sums)[4], int width)
 
static float ssim_end1x (int64_t s1, int64_t s2, int64_t ss, int64_t s12, int max)
 
static float ssim_end1 (int s1, int s2, int ss, int s12)
 
static float ssim_endn_16bit (const int64_t(*sum0)[4], const int64_t(*sum1)[4], int width, int max)
 
static float ssim_endn_8bit (const int(*sum0)[4], const int(*sum1)[4], int width)
 
static float ssim_plane_16bit (SSIMDSPContext *dsp, uint8_t *main, int main_stride, uint8_t *ref, int ref_stride, int width, int height, void *temp, int max)
 
static float ssim_plane (SSIMDSPContext *dsp, uint8_t *main, int main_stride, uint8_t *ref, int ref_stride, int width, int height, void *temp, int max)
 
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 72 of file vf_ssim.c.

Definition at line 73 of file vf_ssim.c.

#define SUM_LEN (   w)    (((w) >> 2) + 3)

Definition at line 222 of file vf_ssim.c.

Referenced by config_input_ref(), ssim_plane(), and ssim_plane_16bit().

#define PF (   suf)    AV_PIX_FMT_YUV420##suf, AV_PIX_FMT_YUV422##suf, AV_PIX_FMT_YUV444##suf, AV_PIX_FMT_GBR##suf

Referenced by query_formats().

Function Documentation

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

Definition at line 83 of file vf_ssim.c.

Referenced by do_ssim().

static void ssim_4x4xn_16bit ( const uint8_t main8,
ptrdiff_t  main_stride,
const uint8_t ref8,
ptrdiff_t  ref_stride,
int64_t(*)  sums[4],
int  width 
)
static

Definition at line 96 of file vf_ssim.c.

Referenced by ssim_plane_16bit().

static void ssim_4x4xn_8bit ( 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 132 of file vf_ssim.c.

Referenced by config_input_ref().

static float ssim_end1x ( int64_t  s1,
int64_t  s2,
int64_t  ss,
int64_t  s12,
int  max 
)
static

Definition at line 163 of file vf_ssim.c.

Referenced by ssim_endn_16bit().

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

Definition at line 179 of file vf_ssim.c.

Referenced by ssim_endn_8bit().

static float ssim_endn_16bit ( const int64_t(*)  sum0[4],
const int64_t(*)  sum1[4],
int  width,
int  max 
)
static

Definition at line 195 of file vf_ssim.c.

Referenced by ssim_plane_16bit().

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

Definition at line 209 of file vf_ssim.c.

Referenced by config_input_ref().

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

Definition at line 224 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,
int  max 
)
static

Definition at line 252 of file vf_ssim.c.

Referenced by config_input_ref().

static double ssim_db ( double  ssim,
double  weight 
)
static

Definition at line 280 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 285 of file vf_ssim.c.

Referenced by init().

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 326 of file vf_ssim.c.

static int query_formats ( AVFilterContext ctx)
static

Definition at line 352 of file vf_ssim.c.

static int config_input_ref ( AVFilterLink inlink)
static

Definition at line 373 of file vf_ssim.c.

static int config_output ( AVFilterLink outlink)
static

Definition at line 421 of file vf_ssim.c.

static int filter_frame ( AVFilterLink inlink,
AVFrame buf 
)
static

Definition at line 440 of file vf_ssim.c.

static int request_frame ( AVFilterLink outlink)
static

Definition at line 446 of file vf_ssim.c.

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 452 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:73
#define OFFSET(x)
Definition: vf_ssim.c:72

Definition at line 75 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:440
static int config_input_ref(AVFilterLink *inlink)
Definition: vf_ssim.c:373

Definition at line 477 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:446
static int config_output(AVFilterLink *outlink)
Definition: vf_ssim.c:421

Definition at line 491 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:452
static av_cold int init(AVFilterContext *ctx)
Definition: vf_ssim.c:326
static const AVFilterPad ssim_inputs[]
Definition: vf_ssim.c:477
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:179
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:491
static int query_formats(AVFilterContext *ctx)
Definition: vf_ssim.c:352

Definition at line 501 of file vf_ssim.c.