FFmpeg
Data Structures | Macros | Functions | Variables
vf_vmafmotion.c File Reference
#include "libavutil/file_open.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "video.h"
#include "vmaf_motion.h"

Go to the source code of this file.

Data Structures

struct  VMAFMotionContext
 

Macros

#define BIT_SHIFT   15
 
#define OFFSET(x)   offsetof(VMAFMotionContext, x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 
#define conv_y_fn(type, bits)
 

Functions

 AVFILTER_DEFINE_CLASS (vmafmotion)
 
static uint64_t image_sad (const uint16_t *img1, const uint16_t *img2, int w, int h, ptrdiff_t _img1_stride, ptrdiff_t _img2_stride)
 
static void convolution_x (const uint16_t *filter, int filt_w, const uint16_t *src, uint16_t *dst, int w, int h, ptrdiff_t _src_stride, ptrdiff_t _dst_stride)
 
 conv_y_fn (uint8_t, 8)
 
double ff_vmafmotion_process (VMAFMotionData *s, AVFrame *ref)
 
static void set_meta (AVDictionary **metadata, const char *key, float d)
 
static void do_vmafmotion (AVFilterContext *ctx, AVFrame *ref)
 
int ff_vmafmotion_init (VMAFMotionData *s, int w, int h, enum AVPixelFormat fmt)
 
static int query_formats (AVFilterContext *ctx)
 
static int config_input_ref (AVFilterLink *inlink)
 
double ff_vmafmotion_uninit (VMAFMotionData *s)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *ref)
 
static av_cold int init (AVFilterContext *ctx)
 
static av_cold void uninit (AVFilterContext *ctx)
 

Variables

static const float FILTER_5 [5]
 
static const AVOption vmafmotion_options []
 
static const AVFilterPad vmafmotion_inputs []
 
const AVFilter ff_vf_vmafmotion
 

Detailed Description

Calculate VMAF Motion score.

Definition in file vf_vmafmotion.c.

Macro Definition Documentation

◆ BIT_SHIFT

#define BIT_SHIFT   15

Definition at line 37 of file vf_vmafmotion.c.

◆ OFFSET

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

Definition at line 54 of file vf_vmafmotion.c.

◆ FLAGS

Definition at line 55 of file vf_vmafmotion.c.

◆ conv_y_fn

#define conv_y_fn (   type,
  bits 
)

Definition at line 130 of file vf_vmafmotion.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( vmafmotion  )

◆ image_sad()

static uint64_t image_sad ( const uint16_t *  img1,
const uint16_t *  img2,
int  w,
int  h,
ptrdiff_t  _img1_stride,
ptrdiff_t  _img2_stride 
)
static

Definition at line 64 of file vf_vmafmotion.c.

Referenced by conv_y_fn().

◆ convolution_x()

static void convolution_x ( const uint16_t *  filter,
int  filt_w,
const uint16_t *  src,
uint16_t *  dst,
int  w,
int  h,
ptrdiff_t  _src_stride,
ptrdiff_t  _dst_stride 
)
static

Definition at line 83 of file vf_vmafmotion.c.

Referenced by conv_y_fn().

◆ conv_y_fn()

conv_y_fn ( uint8_t  ,
 
)

Definition at line 182 of file vf_vmafmotion.c.

◆ ff_vmafmotion_process()

double ff_vmafmotion_process ( VMAFMotionData s,
AVFrame ref 
)

Definition at line 191 of file vf_vmafmotion.c.

Referenced by do_vmafmotion().

◆ set_meta()

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

Definition at line 216 of file vf_vmafmotion.c.

Referenced by do_vmafmotion().

◆ do_vmafmotion()

static void do_vmafmotion ( AVFilterContext ctx,
AVFrame ref 
)
static

Definition at line 223 of file vf_vmafmotion.c.

Referenced by filter_frame().

◆ ff_vmafmotion_init()

int ff_vmafmotion_init ( VMAFMotionData s,
int  w,
int  h,
enum AVPixelFormat  fmt 
)

Definition at line 237 of file vf_vmafmotion.c.

Referenced by config_input_ref().

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 267 of file vf_vmafmotion.c.

◆ config_input_ref()

static int config_input_ref ( AVFilterLink inlink)
static

Definition at line 285 of file vf_vmafmotion.c.

◆ ff_vmafmotion_uninit()

double ff_vmafmotion_uninit ( VMAFMotionData s)

Definition at line 294 of file vf_vmafmotion.c.

Referenced by uninit().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame ref 
)
static

Definition at line 303 of file vf_vmafmotion.c.

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 310 of file vf_vmafmotion.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 333 of file vf_vmafmotion.c.

Variable Documentation

◆ FILTER_5

const float FILTER_5[5]
static
Initial value:
= {
0.054488685,
0.244201342,
0.402619947,
0.244201342,
0.054488685
}

Definition at line 39 of file vf_vmafmotion.c.

Referenced by ff_vmafmotion_init().

◆ vmafmotion_options

const AVOption vmafmotion_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 },
{ NULL }
}

Definition at line 57 of file vf_vmafmotion.c.

◆ vmafmotion_inputs

const AVFilterPad vmafmotion_inputs[]
static
Initial value:
= {
{
.name = "reference",
.filter_frame = filter_frame,
.config_props = config_input_ref,
},
}

Definition at line 346 of file vf_vmafmotion.c.

◆ ff_vf_vmafmotion

const AVFilter ff_vf_vmafmotion
Initial value:
= {
.name = "vmafmotion",
.description = NULL_IF_CONFIG_SMALL("Calculate the VMAF Motion score."),
.init = init,
.uninit = uninit,
.priv_size = sizeof(VMAFMotionContext),
.priv_class = &vmafmotion_class,
}

Definition at line 355 of file vf_vmafmotion.c.

OFFSET
#define OFFSET(x)
Definition: vf_vmafmotion.c:54
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: internal.h:159
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *ref)
Definition: vf_vmafmotion.c:303
config_input_ref
static int config_input_ref(AVFilterLink *inlink)
Definition: vf_vmafmotion.c:285
ff_video_default_filterpad
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
Definition: video.c:37
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:182
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:94
init
static av_cold int init(AVFilterContext *ctx)
Definition: vf_vmafmotion.c:310
VMAFMotionContext
Definition: vf_vmafmotion.c:47
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: vf_vmafmotion.c:267
AVFILTER_FLAG_METADATA_ONLY
#define AVFILTER_FLAG_METADATA_ONLY
The filter is a "metadata" filter - it does not modify the frame data in any way.
Definition: avfilter.h:133
vmafmotion_inputs
static const AVFilterPad vmafmotion_inputs[]
Definition: vf_vmafmotion.c:346
FLAGS
#define FLAGS
Definition: vf_vmafmotion.c:55
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:183
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_vmafmotion.c:333
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:474
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:239