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

tonemap algorithms More...

#include <float.h>
#include <stdio.h>
#include "libavutil/csp.h"
#include "libavutil/imgutils.h"
#include "libavutil/internal.h"
#include "libavutil/intfloat.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "colorspace.h"
#include "filters.h"
#include "video.h"

Go to the source code of this file.

Data Structures

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

Macros

#define MIX(x, y, a)
 
#define OFFSET(x)
 
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
 

Enumerations

enum  TonemapAlgorithm {
  TONEMAP_NONE , TONEMAP_LINEAR , TONEMAP_GAMMA , TONEMAP_CLIP ,
  TONEMAP_REINHARD , TONEMAP_HABLE , TONEMAP_MOBIUS , TONEMAP_MAX
}
 

Functions

static av_cold int init (AVFilterContext *ctx)
 
static float hable (float in)
 
static float mobius (float in, float j, double peak)
 
static void tonemap (TonemapContext *s, AVFrame *out, const AVFrame *in, const AVPixFmtDescriptor *desc, int x, int y, double peak)
 
static int tonemap_slice (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int filter_frame (AVFilterLink *link, AVFrame *in)
 
 AVFILTER_DEFINE_CLASS (tonemap)
 

Variables

static const AVOption tonemap_options []
 
static const AVFilterPad tonemap_inputs []
 
const FFFilter ff_vf_tonemap
 

Detailed Description

tonemap algorithms

Definition in file vf_tonemap.c.

Macro Definition Documentation

◆ MIX

#define MIX ( x,
y,
a )
Value:
(x) * (1 - (a)) + (y) * (a)
int a

Definition at line 109 of file vf_tonemap.c.

Referenced by tonemap().

◆ OFFSET

#define OFFSET ( x)
Value:

Definition at line 283 of file vf_tonemap.c.

◆ FLAGS

Definition at line 284 of file vf_tonemap.c.

Enumeration Type Documentation

◆ TonemapAlgorithm

Enumerator
TONEMAP_NONE 
TONEMAP_LINEAR 
TONEMAP_GAMMA 
TONEMAP_CLIP 
TONEMAP_REINHARD 
TONEMAP_HABLE 
TONEMAP_MOBIUS 
TONEMAP_MAX 

Definition at line 42 of file vf_tonemap.c.

Function Documentation

◆ init()

static av_cold int init ( AVFilterContext * ctx)
static

Definition at line 65 of file vf_tonemap.c.

◆ hable()

static float hable ( float in)
static

Definition at line 90 of file vf_tonemap.c.

Referenced by tonemap().

◆ mobius()

static float mobius ( float in,
float j,
double peak )
static

Definition at line 96 of file vf_tonemap.c.

Referenced by tonemap().

◆ tonemap()

static void tonemap ( TonemapContext * s,
AVFrame * out,
const AVFrame * in,
const AVPixFmtDescriptor * desc,
int x,
int y,
double peak )
static

Definition at line 110 of file vf_tonemap.c.

Referenced by AVFILTER_DEFINE_CLASS(), and tonemap_slice().

◆ tonemap_slice()

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

Definition at line 181 of file vf_tonemap.c.

Referenced by filter_frame().

◆ filter_frame()

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

Definition at line 199 of file vf_tonemap.c.

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( tonemap )

Variable Documentation

◆ tonemap_options

const AVOption tonemap_options[]
static
Initial value:
= {
{ "tonemap", "tonemap algorithm selection", OFFSET(tonemap), AV_OPT_TYPE_INT, {.i64 = TONEMAP_NONE}, TONEMAP_NONE, TONEMAP_MAX - 1, FLAGS, .unit = "tonemap" },
{ "none", 0, 0, AV_OPT_TYPE_CONST, {.i64 = TONEMAP_NONE}, 0, 0, FLAGS, .unit = "tonemap" },
{ "linear", 0, 0, AV_OPT_TYPE_CONST, {.i64 = TONEMAP_LINEAR}, 0, 0, FLAGS, .unit = "tonemap" },
{ "gamma", 0, 0, AV_OPT_TYPE_CONST, {.i64 = TONEMAP_GAMMA}, 0, 0, FLAGS, .unit = "tonemap" },
{ "clip", 0, 0, AV_OPT_TYPE_CONST, {.i64 = TONEMAP_CLIP}, 0, 0, FLAGS, .unit = "tonemap" },
{ "reinhard", 0, 0, AV_OPT_TYPE_CONST, {.i64 = TONEMAP_REINHARD}, 0, 0, FLAGS, .unit = "tonemap" },
{ "hable", 0, 0, AV_OPT_TYPE_CONST, {.i64 = TONEMAP_HABLE}, 0, 0, FLAGS, .unit = "tonemap" },
{ "mobius", 0, 0, AV_OPT_TYPE_CONST, {.i64 = TONEMAP_MOBIUS}, 0, 0, FLAGS, .unit = "tonemap" },
{ "param", "tonemap parameter", OFFSET(param), AV_OPT_TYPE_DOUBLE, {.dbl = NAN}, DBL_MIN, DBL_MAX, FLAGS },
{ "desat", "desaturation strength", OFFSET(desat), AV_OPT_TYPE_DOUBLE, {.dbl = 2}, 0, DBL_MAX, FLAGS },
{ "peak", "signal peak override", OFFSET(peak), AV_OPT_TYPE_DOUBLE, {.dbl = 0}, 0, DBL_MAX, FLAGS },
{ NULL }
}
#define FLAGS
Definition cmdutils.c:598
#define NULL
Definition coverity.c:32
#define OFFSET(x)
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition opt.h:298
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
@ AV_OPT_TYPE_DOUBLE
Underlying C type is double.
Definition opt.h:266
#define NAN
@ TONEMAP_HABLE
Definition vf_tonemap.c:48
@ TONEMAP_LINEAR
Definition vf_tonemap.c:44
@ TONEMAP_MAX
Definition vf_tonemap.c:50
@ TONEMAP_MOBIUS
Definition vf_tonemap.c:49
@ TONEMAP_REINHARD
Definition vf_tonemap.c:47
@ TONEMAP_NONE
Definition vf_tonemap.c:43
@ TONEMAP_CLIP
Definition vf_tonemap.c:46
@ TONEMAP_GAMMA
Definition vf_tonemap.c:45
static void tonemap(TonemapContext *s, AVFrame *out, const AVFrame *in, const AVPixFmtDescriptor *desc, int x, int y, double peak)
Definition vf_tonemap.c:110

Definition at line 285 of file vf_tonemap.c.

◆ tonemap_inputs

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

Definition at line 302 of file vf_tonemap.c.

◆ ff_vf_tonemap

const FFFilter ff_vf_tonemap
Initial value:
= {
.p.name = "tonemap",
.p.description = NULL_IF_CONFIG_SMALL("Conversion to/from different dynamic ranges."),
.p.priv_class = &tonemap_class,
.init = init,
.priv_size = sizeof(TonemapContext),
}
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition avfilter.h:166
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_OUTPUTS(array)
Definition filters.h:265
#define FILTER_PIXFMTS(...)
Definition filters.h:250
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
#define AV_PIX_FMT_GBRPF32
Definition pixfmt.h:584
#define AV_PIX_FMT_GBRAPF32
Definition pixfmt.h:585
static const AVFilterPad tonemap_inputs[]
Definition vf_tonemap.c:302
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 310 of file vf_tonemap.c.