FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
vf_libvmaf.c File Reference

Calculate the VMAF between two input videos. More...

#include <pthread.h>
#include <libvmaf.h>
#include "libavutil/avstring.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "drawutils.h"
#include "formats.h"
#include "framesync.h"
#include "internal.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  LIBVMAFContext
 

Macros

#define OFFSET(x)   offsetof(LIBVMAFContext, x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 
#define read_frame_fn(type, bits)
 

Functions

 FRAMESYNC_DEFINE_CLASS (libvmaf, LIBVMAFContext, fs)
 
 read_frame_fn (uint8_t, 8)
 
 read_frame_fn (uint16_t, 10)
 
static void compute_vmaf_score (LIBVMAFContext *s)
 
static voidcall_vmaf (void *ctx)
 
static int do_vmaf (FFFrameSync *fs)
 
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 activate (AVFilterContext *ctx)
 
static av_cold void uninit (AVFilterContext *ctx)
 

Variables

static const AVOption libvmaf_options []
 
static const AVFilterPad libvmaf_inputs []
 
static const AVFilterPad libvmaf_outputs []
 
AVFilter ff_vf_libvmaf
 

Detailed Description

Calculate the VMAF between two input videos.

Definition in file vf_libvmaf.c.

Macro Definition Documentation

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

Definition at line 67 of file vf_libvmaf.c.

Definition at line 68 of file vf_libvmaf.c.

#define read_frame_fn (   type,
  bits 
)

Definition at line 85 of file vf_libvmaf.c.

Function Documentation

FRAMESYNC_DEFINE_CLASS ( libvmaf  ,
LIBVMAFContext  ,
fs   
)
read_frame_fn ( uint8_t  ,
 
)
read_frame_fn ( uint16_t  ,
10   
)
static void compute_vmaf_score ( LIBVMAFContext s)
static

Definition at line 148 of file vf_libvmaf.c.

Referenced by call_vmaf().

static void* call_vmaf ( void ctx)
static

Definition at line 165 of file vf_libvmaf.c.

Referenced by config_input_ref().

static int do_vmaf ( FFFrameSync fs)
static

Definition at line 173 of file vf_libvmaf.c.

Referenced by init().

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 203 of file vf_libvmaf.c.

static int query_formats ( AVFilterContext ctx)
static

Definition at line 217 of file vf_libvmaf.c.

static int config_input_ref ( AVFilterLink inlink)
static

Definition at line 232 of file vf_libvmaf.c.

static int config_output ( AVFilterLink outlink)
static

Definition at line 262 of file vf_libvmaf.c.

static int activate ( AVFilterContext ctx)
static

Definition at line 283 of file vf_libvmaf.c.

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 289 of file vf_libvmaf.c.

Variable Documentation

const AVOption libvmaf_options[]
static
Initial value:
= {
{"model_path", "Set the model to be used for computing vmaf.", OFFSET(model_path), AV_OPT_TYPE_STRING, {.str="/usr/local/share/model/vmaf_v0.6.1.pkl"}, 0, 1, FLAGS},
{"log_path", "Set the file path to be used to store logs.", OFFSET(log_path), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 1, FLAGS},
{"log_fmt", "Set the format of the log (xml or json).", OFFSET(log_fmt), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 1, FLAGS},
{"enable_transform", "Enables transform for computing vmaf.", OFFSET(enable_transform), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS},
{"phone_model", "Invokes the phone model that will generate higher VMAF scores.", OFFSET(phone_model), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS},
{"psnr", "Enables computing psnr along with vmaf.", OFFSET(psnr), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS},
{"ssim", "Enables computing ssim along with vmaf.", OFFSET(ssim), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS},
{"ms_ssim", "Enables computing ms-ssim along with vmaf.", OFFSET(ms_ssim), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS},
{"pool", "Set the pool method to be used for computing vmaf.", OFFSET(pool), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 1, FLAGS},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static double psnr(double d)
Definition: ffmpeg.c:1354
#define OFFSET(x)
Definition: vf_libvmaf.c:67
#define FLAGS
Definition: vf_libvmaf.c:68

Definition at line 70 of file vf_libvmaf.c.

const AVFilterPad libvmaf_inputs[]
static
Initial value:
= {
{
.name = "main",
},{
.name = "reference",
.config_props = config_input_ref,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int config_input_ref(AVFilterLink *inlink)
Definition: vf_libvmaf.c:232

Definition at line 309 of file vf_libvmaf.c.

const AVFilterPad libvmaf_outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_output,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int config_output(AVFilterLink *outlink)
Definition: vf_libvmaf.c:262

Definition at line 321 of file vf_libvmaf.c.

AVFilter ff_vf_libvmaf
Initial value:
= {
.name = "libvmaf",
.description = NULL_IF_CONFIG_SMALL("Calculate the VMAF between two video streams."),
.preinit = libvmaf_framesync_preinit,
.init = init,
.uninit = uninit,
.query_formats = query_formats,
.activate = activate,
.priv_size = sizeof(LIBVMAFContext),
.priv_class = &libvmaf_class,
}
static int query_formats(AVFilterContext *ctx)
Definition: vf_libvmaf.c:217
static const AVFilterPad libvmaf_outputs[]
Definition: vf_libvmaf.c:321
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:179
static av_cold int init(AVFilterContext *ctx)
Definition: vf_libvmaf.c:203
static int activate(AVFilterContext *ctx)
Definition: vf_libvmaf.c:283
static const AVFilterPad outputs[]
Definition: af_afftfilt.c:389
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_libvmaf.c:289
static const AVFilterPad inputs[]
Definition: af_afftfilt.c:379
static const AVFilterPad libvmaf_inputs[]
Definition: vf_libvmaf.c:309

Definition at line 330 of file vf_libvmaf.c.