FFmpeg
Data Structures | Macros | Functions | Variables
vf_framerate.c File Reference
#include "libavutil/avassert.h"
#include "libavutil/imgutils.h"
#include "libavutil/internal.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "video.h"
#include "filters.h"
#include "framerate.h"
#include "scene_sad.h"

Go to the source code of this file.

Data Structures

struct  ThreadData
 Used for passing data between threads. More...
 

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
 
#define BLEND_FRAME_FUNC(nbits)
 

Functions

 AVFILTER_DEFINE_CLASS (framerate)
 
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)
 
void ff_framerate_init (FrameRateContext *s)
 
static int config_input (AVFilterLink *inlink)
 
static int activate (AVFilterContext *ctx)
 
static int config_output (AVFilterLink *outlink)
 

Variables

static const AVOption framerate_options []
 
static enum AVPixelFormat pix_fmts []
 
static const AVFilterPad framerate_inputs []
 
static const AVFilterPad framerate_outputs []
 
const 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.

◆ 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.

◆ BLEND_FRAME_FUNC

#define BLEND_FRAME_FUNC (   nbits)
Value:
static void blend_frames##nbits##_c(BLEND_FUNC_PARAMS) \
{ \
int line, pixel; \
uint##nbits##_t *dstw = (uint##nbits##_t *)dst; \
uint##nbits##_t *src1w = (uint##nbits##_t *)src1; \
uint##nbits##_t *src2w = (uint##nbits##_t *)src2; \
int bytes = nbits / 8; \
width /= bytes; \
src1_linesize /= bytes; \
src2_linesize /= bytes; \
dst_linesize /= bytes; \
for (line = 0; line < height; line++) { \
for (pixel = 0; pixel < width; pixel++) \
dstw[pixel] = ((src1w[pixel] * factor1) + \
(src2w[pixel] * factor2) + half) \
>> BLEND_FACTOR_DEPTH(nbits); \
src1w += src1_linesize; \
src2w += src2_linesize; \
dstw += dst_linesize; \
} \
}

Definition at line 231 of file vf_framerate.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( framerate  )

◆ get_scene_score()

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

Definition at line 64 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 92 of file vf_framerate.c.

Referenced by blend_frames().

◆ blend_frames()

static int blend_frames ( AVFilterContext ctx,
int  interpolate 
)
static

Definition at line 118 of file vf_framerate.c.

Referenced by process_work_frame().

◆ process_work_frame()

static int process_work_frame ( AVFilterContext ctx)
static

Definition at line 154 of file vf_framerate.c.

Referenced by activate().

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 204 of file vf_framerate.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 211 of file vf_framerate.c.

◆ ff_framerate_init()

void ff_framerate_init ( FrameRateContext s)

Definition at line 256 of file vf_framerate.c.

Referenced by config_input().

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 270 of file vf_framerate.c.

◆ activate()

static int activate ( AVFilterContext ctx)
static

Definition at line 296 of file vf_framerate.c.

◆ config_output()

static int config_output ( AVFilterLink outlink)
static

Definition at line 373 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, 100., V|F },
{"flags", "set flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64=1}, 0, INT_MAX, V|F, .unit = "flags" },
{"scene_change_detect", "enable scene change detection", 0, AV_OPT_TYPE_CONST, {.i64=FRAMERATE_FLAG_SCD}, INT_MIN, INT_MAX, V|F, .unit = "flags" },
{"scd", "enable scene change detection", 0, AV_OPT_TYPE_CONST, {.i64=FRAMERATE_FLAG_SCD}, INT_MIN, INT_MAX, V|F, .unit = "flags" },
{NULL}
}

Definition at line 48 of file vf_framerate.c.

◆ pix_fmts

enum AVPixelFormat pix_fmts[]
static

◆ framerate_inputs

const AVFilterPad framerate_inputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_input,
},
}

Definition at line 419 of file vf_framerate.c.

◆ framerate_outputs

const AVFilterPad framerate_outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_output,
},
}

Definition at line 427 of file vf_framerate.c.

◆ ff_vf_framerate

const 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,
.activate = activate,
}

Definition at line 435 of file vf_framerate.c.

FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: filters.h:242
AV_OPT_TYPE_VIDEO_RATE
@ AV_OPT_TYPE_VIDEO_RATE
Underlying C type is AVRational.
Definition: opt.h:315
src1
const pixel * src1
Definition: h264pred_template.c:421
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: filters.h:262
FrameRateContext
Definition: framerate.h:35
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:502
half
static uint8_t half(int a, int b)
Definition: mobiclip.c:539
activate
static int activate(AVFilterContext *ctx)
Definition: vf_framerate.c:296
AV_PIX_FMT_YUV440P
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:106
FRAMERATE_FLAG_SCD
#define FRAMERATE_FLAG_SCD
Definition: vf_framerate.c:46
AV_PIX_FMT_YUV422P9
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:500
BLEND_FACTOR_DEPTH
#define BLEND_FACTOR_DEPTH(n)
Definition: framerate.h:31
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:505
AV_PIX_FMT_YUVJ411P
@ AV_PIX_FMT_YUVJ411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
Definition: pixfmt.h:283
AV_PIX_FMT_YUVJ422P
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition: pixfmt.h:86
blend_frames
static int blend_frames(AVFilterContext *ctx, int interpolate)
Definition: vf_framerate.c:118
AV_OPT_TYPE_DOUBLE
@ AV_OPT_TYPE_DOUBLE
Underlying C type is double.
Definition: opt.h:267
AV_PIX_FMT_YUV420P9
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:499
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:73
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: filters.h:263
AV_PIX_FMT_YUVJ444P
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:87
NULL
#define NULL
Definition: coverity.c:32
pixel
uint8_t pixel
Definition: tiny_ssim.c:41
AV_PIX_FMT_YUVJ420P
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition: pixfmt.h:85
AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:503
BLEND_FUNC_PARAMS
#define BLEND_FUNC_PARAMS
Definition: framerate.h:25
init
static av_cold int init(AVFilterContext *ctx)
Definition: vf_framerate.c:204
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: vf_framerate.c:218
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
height
#define height
Definition: dsp.h:85
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:83
AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:507
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:509
F
#define F
Definition: vf_framerate.c:45
line
Definition: graph2dot.c:48
framerate_outputs
static const AVFilterPad framerate_outputs[]
Definition: vf_framerate.c:427
src2
const pixel * src2
Definition: h264pred_template.c:422
AV_PIX_FMT_YUVJ440P
@ AV_PIX_FMT_YUVJ440P
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
Definition: pixfmt.h:107
AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:501
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_framerate.c:270
AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:506
V
#define V
Definition: vf_framerate.c:44
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
framerate_inputs
static const AVFilterPad framerate_inputs[]
Definition: vf_framerate.c:419
OFFSET
#define OFFSET(x)
Definition: vf_framerate.c:43
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:78
AVFILTER_FLAG_SLICE_THREADS
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition: avfilter.h:152
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:77
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_framerate.c:211
AV_PIX_FMT_YUV411P
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:80
AV_OPT_TYPE_FLAGS
@ AV_OPT_TYPE_FLAGS
Underlying C type is unsigned int.
Definition: opt.h:255
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:482
AV_PIX_FMT_YUV410P
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:79
width
#define width
Definition: dsp.h:85
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299
config_output
static int config_output(AVFilterLink *outlink)
Definition: vf_framerate.c:373
line
The official guide to swscale for confused that consecutive non overlapping rectangles of slice_bottom special converter These generally are unscaled converters of common like for each output line the vertical scaler pulls lines from a ring buffer When the ring buffer does not contain the wanted line
Definition: swscale.txt:40