FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
vf_lensfun.c File Reference
#include <float.h>
#include <math.h>
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
#include "libswscale/swscale.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.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)   offsetof(LensfunContext, x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 

Enumerations

enum  Mode {
  MODE_4k75 = 0, MODE_5k15, MODE_5k9, MODE_6k7,
  MODE_7k4, MODE_7k95, MODE_10k2, MODE_12k2,
  MODE_DTX, N_MODES, NO_DATA = 15, MODE_6k60 = 0,
  MODE_8k85, MODE_12k65, MODE_14k25, MODE_15k85,
  MODE_18k25, MODE_19k85, MODE_23k05, MODE_23k85,
  MODE_SID, SP_LOST = 14, NO_DATA, 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 []
 
static const AVFilterPad lensfun_outputs []
 
const AVFilter 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 41 of file vf_lensfun.c.

◆ OFFSET

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

Definition at line 94 of file vf_lensfun.c.

◆ FLAGS

Definition at line 95 of file vf_lensfun.c.

Enumeration Type Documentation

◆ Mode

enum Mode
Enumerator
MODE_4k75 

4.75 kbit/s

MODE_5k15 

5.15 kbit/s

MODE_5k9 

5.90 kbit/s

MODE_6k7 

6.70 kbit/s

MODE_7k4 

7.40 kbit/s

MODE_7k95 

7.95 kbit/s

MODE_10k2 

10.2 kbit/s

MODE_12k2 

12.2 kbit/s

MODE_DTX 

silent frame

N_MODES 

number of modes

NO_DATA 

no transmission

MODE_6k60 

6.60 kbit/s

MODE_8k85 

8.85 kbit/s

MODE_12k65 

12.65 kbit/s

MODE_14k25 

14.25 kbit/s

MODE_15k85 

15.85 kbit/s

MODE_18k25 

18.25 kbit/s

MODE_19k85 

19.85 kbit/s

MODE_23k05 

23.05 kbit/s

MODE_23k85 

23.85 kbit/s

MODE_SID 

comfort noise frame

SP_LOST 

speech lost

NO_DATA 

no transmission

VIGNETTING 
GEOMETRY_DISTORTION 
SUBPIXEL_DISTORTION 

Definition at line 43 of file vf_lensfun.c.

◆ InterpolationType

Enumerator
NEAREST 
LINEAR 
LANCZOS 

Definition at line 49 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 131 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_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 494 of file vf_lensfun.c.

Variable Documentation

◆ lensfun_options

const AVOption lensfun_options[]
static

Definition at line 96 of file vf_lensfun.c.

◆ lensfun_inputs

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

Definition at line 508 of file vf_lensfun.c.

◆ lensfun_outputs

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

Definition at line 517 of file vf_lensfun.c.

◆ ff_vf_lensfun

const AVFilter ff_vf_lensfun
Initial value:
= {
.name = "lensfun",
.description = NULL_IF_CONFIG_SMALL("Apply correction to an image based on info derived from the lensfun database."),
.priv_size = sizeof(LensfunContext),
.init = init,
.priv_class = &lensfun_class,
}

Definition at line 524 of file vf_lensfun.c.

LensfunContext
Definition: vf_lensfun.c:74
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_lensfun.c:494
lensfun_inputs
static const AVFilterPad lensfun_inputs[]
Definition: vf_lensfun.c:508
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:191
lensfun_outputs
static const AVFilterPad lensfun_outputs[]
Definition: vf_lensfun.c:517
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_lensfun.c:436
AV_PIX_FMT_RGB24
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:68
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:117
config_props
static int config_props(AVFilterLink *inlink)
Definition: vf_lensfun.c:207
AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
#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:146
FILTER_SINGLE_PIXFMT
#define FILTER_SINGLE_PIXFMT(pix_fmt_)
Definition: internal.h:181
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:121
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:192
init
static av_cold int init(AVFilterContext *ctx)
Definition: vf_lensfun.c:131