FFmpeg
Loading...
Searching...
No Matches
vf_lensfun.c File Reference

Lensfun filter, applies lens correction with parameters from the lensfun database. More...

#include <float.h>
#include <math.h>
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "avfilter.h"
#include "filters.h"
#include "video.h"
#include <lensfun.h>

Go to the source code of this file.

Data Structures

struct  VignettingThreadData
 
struct  DistortionCorrectionThreadData
 
struct  LensfunContext
 

Macros

#define LANCZOS_RESOLUTION   256
 
#define OFFSET(x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 

Enumerations

enum  Mode { VIGNETTING = 0x1 , GEOMETRY_DISTORTION = 0x2 , SUBPIXEL_DISTORTION = 0x4 }
 
enum  InterpolationType { NEAREST , LINEAR , LANCZOS }
 

Functions

 AVFILTER_DEFINE_CLASS (lensfun)
 
static av_cold int init (AVFilterContext *ctx)
 
static float lanczos_kernel (float x)
 
static int config_props (AVFilterLink *inlink)
 
static int vignetting_filter_slice (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static float square (float x)
 
static int distortion_correction_filter_slice (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static av_cold void uninit (AVFilterContext *ctx)
 

Variables

static const AVOption lensfun_options []
 
static const AVFilterPad lensfun_inputs []
 
const FFFilter ff_vf_lensfun
 

Detailed Description

Lensfun filter, applies lens correction with parameters from the lensfun database.

See also
https://lensfun.sourceforge.net/

Definition in file vf_lensfun.c.

Macro Definition Documentation

◆ LANCZOS_RESOLUTION

#define LANCZOS_RESOLUTION   256

Definition at line 39 of file vf_lensfun.c.

Referenced by config_props(), and distortion_correction_filter_slice().

◆ OFFSET

#define OFFSET ( x)
Value:

Definition at line 92 of file vf_lensfun.c.

◆ FLAGS

Definition at line 93 of file vf_lensfun.c.

Enumeration Type Documentation

◆ Mode

enum Mode
Enumerator
VIGNETTING 
GEOMETRY_DISTORTION 
SUBPIXEL_DISTORTION 

Definition at line 41 of file vf_lensfun.c.

◆ InterpolationType

Enumerator
NEAREST 
LINEAR 
LANCZOS 

Definition at line 47 of file vf_lensfun.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( lensfun )

◆ init()

static av_cold int init ( AVFilterContext * ctx)
static

Definition at line 130 of file vf_lensfun.c.

◆ lanczos_kernel()

static float lanczos_kernel ( float x)
static

Definition at line 196 of file vf_lensfun.c.

Referenced by config_output(), and config_props().

◆ config_props()

static int config_props ( AVFilterLink * inlink)
static

Definition at line 207 of file vf_lensfun.c.

◆ vignetting_filter_slice()

static int vignetting_filter_slice ( AVFilterContext * ctx,
void * arg,
int jobnr,
int nb_jobs )
static

Definition at line 284 of file vf_lensfun.c.

Referenced by filter_frame().

◆ square()

static float square ( float x)
static

Definition at line 302 of file vf_lensfun.c.

Referenced by distortion_correction_filter_slice().

◆ distortion_correction_filter_slice()

static int distortion_correction_filter_slice ( AVFilterContext * ctx,
void * arg,
int jobnr,
int nb_jobs )
static

Definition at line 307 of file vf_lensfun.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink * inlink,
AVFrame * in )
static

Definition at line 436 of file vf_lensfun.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext * ctx)
static

Definition at line 499 of file vf_lensfun.c.

Variable Documentation

◆ lensfun_options

const AVOption lensfun_options[]
static

Definition at line 94 of file vf_lensfun.c.

◆ lensfun_inputs

const AVFilterPad lensfun_inputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_props,
.filter_frame = filter_frame,
},
}
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
Definition dolby_e.c:1067
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
static int config_props(AVBitStreamFilterLink *link)
Definition source.c:181

Definition at line 513 of file vf_lensfun.c.

◆ ff_vf_lensfun

const FFFilter ff_vf_lensfun
Initial value:
= {
.p.name = "lensfun",
.p.description = NULL_IF_CONFIG_SMALL("Apply correction to an image based on info derived from the lensfun database."),
.p.priv_class = &lensfun_class,
.priv_size = sizeof(LensfunContext),
.init = init,
}
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
Definition avfilter.h:196
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition avfilter.h:166
static av_cold void uninit(AVBitStreamFilterContext *ctx)
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_OUTPUTS(array)
Definition filters.h:265
#define FILTER_SINGLE_PIXFMT(pix_fmt_)
Definition filters.h:254
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition pixfmt.h:75
static const AVFilterPad lensfun_inputs[]
Definition vf_lensfun.c:513
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

Definition at line 522 of file vf_lensfun.c.