FFmpeg  4.0
Data Structures | Macros | Functions | Variables
vf_framerate.c File Reference

filter for upsampling or downsampling a progressive source More...

#include "libavutil/avassert.h"
#include "libavutil/imgutils.h"
#include "libavutil/internal.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/pixelutils.h"
#include "avfilter.h"
#include "internal.h"
#include "video.h"
#include "framerate.h"

Go to the source code of this file.

Data Structures

struct  ThreadData
 

Macros

#define DEBUG
 
#define OFFSET(x)   offsetof(FrameRateContext, x)
 
#define V   AV_OPT_FLAG_VIDEO_PARAM
 
#define F   AV_OPT_FLAG_FILTERING_PARAM
 
#define FRAMERATE_FLAG_SCD   01
 

Functions

 AVFILTER_DEFINE_CLASS (framerate)
 
static av_always_inline int64_t sad_8x8_16 (const uint16_t *src1, ptrdiff_t stride1, const uint16_t *src2, ptrdiff_t stride2)
 
static int64_t scene_sad16 (FrameRateContext *s, const uint16_t *p1, int p1_linesize, const uint16_t *p2, int p2_linesize, const int width, const int height)
 
static int64_t scene_sad8 (FrameRateContext *s, uint8_t *p1, int p1_linesize, uint8_t *p2, int p2_linesize, const int width, const int height)
 
static double get_scene_score (AVFilterContext *ctx, AVFrame *crnt, AVFrame *next)
 
static int filter_slice (AVFilterContext *ctx, void *arg, int job, int nb_jobs)
 
static int blend_frames (AVFilterContext *ctx, int interpolate)
 
static int process_work_frame (AVFilterContext *ctx)
 
static av_cold int init (AVFilterContext *ctx)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static int query_formats (AVFilterContext *ctx)
 
static void blend_frames_c (BLEND_FUNC_PARAMS)
 
static void blend_frames16_c (BLEND_FUNC_PARAMS)
 
void ff_framerate_init (FrameRateContext *s)
 
static int config_input (AVFilterLink *inlink)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *inpicref)
 
static int config_output (AVFilterLink *outlink)
 
static int request_frame (AVFilterLink *outlink)
 

Variables

static const AVOption framerate_options []
 
static const AVFilterPad framerate_inputs []
 
static const AVFilterPad framerate_outputs []
 
AVFilter ff_vf_framerate
 

Detailed Description

filter for upsampling or downsampling a progressive source

Definition in file vf_framerate.c.

Macro Definition Documentation

◆ DEBUG

#define DEBUG

Definition at line 29 of file vf_framerate.c.

Referenced by audio_decode_frame().

◆ OFFSET

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

Definition at line 43 of file vf_framerate.c.

◆ V

#define V   AV_OPT_FLAG_VIDEO_PARAM

Definition at line 44 of file vf_framerate.c.

◆ F

Definition at line 45 of file vf_framerate.c.

◆ FRAMERATE_FLAG_SCD

#define FRAMERATE_FLAG_SCD   01

Definition at line 46 of file vf_framerate.c.

Referenced by blend_frames().

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( framerate  )

◆ sad_8x8_16()

static av_always_inline int64_t sad_8x8_16 ( const uint16_t *  src1,
ptrdiff_t  stride1,
const uint16_t *  src2,
ptrdiff_t  stride2 
)
static

Definition at line 64 of file vf_framerate.c.

Referenced by scene_sad16().

◆ scene_sad16()

static int64_t scene_sad16 ( FrameRateContext s,
const uint16_t *  p1,
int  p1_linesize,
const uint16_t *  p2,
int  p2_linesize,
const int  width,
const int  height 
)
static

Definition at line 79 of file vf_framerate.c.

Referenced by get_scene_score().

◆ scene_sad8()

static int64_t scene_sad8 ( FrameRateContext s,
uint8_t p1,
int  p1_linesize,
uint8_t p2,
int  p2_linesize,
const int  width,
const int  height 
)
static

Definition at line 94 of file vf_framerate.c.

Referenced by get_scene_score().

◆ get_scene_score()

static double get_scene_score ( AVFilterContext ctx,
AVFrame crnt,
AVFrame next 
)
static

Definition at line 110 of file vf_framerate.c.

Referenced by blend_frames().

◆ filter_slice()

static int filter_slice ( AVFilterContext ctx,
void arg,
int  job,
int  nb_jobs 
)
static

Definition at line 142 of file vf_framerate.c.

Referenced by blend_frames().

◆ blend_frames()

static int blend_frames ( AVFilterContext ctx,
int  interpolate 
)
static

Definition at line 175 of file vf_framerate.c.

Referenced by process_work_frame().

◆ process_work_frame()

static int process_work_frame ( AVFilterContext ctx)
static

Definition at line 210 of file vf_framerate.c.

Referenced by filter_frame(), and request_frame().

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 258 of file vf_framerate.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 265 of file vf_framerate.c.

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 272 of file vf_framerate.c.

◆ blend_frames_c()

static void blend_frames_c ( BLEND_FUNC_PARAMS  )
static

Definition at line 293 of file vf_framerate.c.

Referenced by ff_framerate_init().

◆ blend_frames16_c()

static void blend_frames16_c ( BLEND_FUNC_PARAMS  )
static

Definition at line 305 of file vf_framerate.c.

Referenced by ff_framerate_init().

◆ ff_framerate_init()

void ff_framerate_init ( FrameRateContext s)

Definition at line 324 of file vf_framerate.c.

Referenced by config_input().

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 337 of file vf_framerate.c.

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame inpicref 
)
static

Definition at line 363 of file vf_framerate.c.

◆ config_output()

static int config_output ( AVFilterLink outlink)
static

Definition at line 412 of file vf_framerate.c.

◆ request_frame()

static int request_frame ( AVFilterLink outlink)
static

Definition at line 457 of file vf_framerate.c.

Variable Documentation

◆ framerate_options

const AVOption framerate_options[]
static
Initial value:
= {
{"fps", "required output frames per second rate", OFFSET(dest_frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str="50"}, 0, INT_MAX, V|F },
{"interp_start", "point to start linear interpolation", OFFSET(interp_start), AV_OPT_TYPE_INT, {.i64=15}, 0, 255, V|F },
{"interp_end", "point to end linear interpolation", OFFSET(interp_end), AV_OPT_TYPE_INT, {.i64=240}, 0, 255, V|F },
{"scene", "scene change level", OFFSET(scene_score), AV_OPT_TYPE_DOUBLE, {.dbl=8.2}, 0, INT_MAX, V|F },
{"flags", "set flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64=1}, 0, INT_MAX, V|F, "flags" },
{"scene_change_detect", "enable scene change detection", 0, AV_OPT_TYPE_CONST, {.i64=FRAMERATE_FLAG_SCD}, INT_MIN, INT_MAX, V|F, "flags" },
{"scd", "enable scene change detection", 0, AV_OPT_TYPE_CONST, {.i64=FRAMERATE_FLAG_SCD}, INT_MIN, INT_MAX, V|F, "flags" },
{NULL}
}
#define NULL
Definition: coverity.c:32
static int flags
Definition: log.c:55
#define FRAMERATE_FLAG_SCD
Definition: vf_framerate.c:46
offset must point to AVRational
Definition: opt.h:236
#define F
Definition: vf_framerate.c:45
#define V
Definition: vf_framerate.c:44
#define OFFSET(x)
Definition: vf_framerate.c:43

Definition at line 48 of file vf_framerate.c.

◆ framerate_inputs

const AVFilterPad framerate_inputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_input,
.filter_frame = filter_frame,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
Definition: vf_framerate.c:363
static int config_input(AVFilterLink *inlink)
Definition: vf_framerate.c:337

Definition at line 478 of file vf_framerate.c.

◆ framerate_outputs

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

Definition at line 488 of file vf_framerate.c.

◆ ff_vf_framerate

AVFilter ff_vf_framerate
Initial value:
= {
.name = "framerate",
.description = NULL_IF_CONFIG_SMALL("Upsamples or downsamples progressive source between specified frame rates."),
.priv_size = sizeof(FrameRateContext),
.priv_class = &framerate_class,
.init = init,
}
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_framerate.c:265
static int flags
Definition: log.c:55
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition: avfilter.h:116
static const AVFilterPad inputs[]
Definition: af_acontrast.c:193
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
static const AVFilterPad framerate_outputs[]
Definition: vf_framerate.c:488
static int query_formats(AVFilterContext *ctx)
Definition: vf_framerate.c:272
static av_cold int init(AVFilterContext *ctx)
Definition: vf_framerate.c:258
static const AVFilterPad framerate_inputs[]
Definition: vf_framerate.c:478

Definition at line 498 of file vf_framerate.c.