FFmpeg
Data Structures | Macros | Functions | Variables
vf_maskedclamp.c File Reference
#include "libavutil/imgutils.h"
#include "libavutil/pixdesc.h"
#include "libavutil/opt.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "video.h"
#include "framesync.h"
#include "maskedclamp.h"

Go to the source code of this file.

Data Structures

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

Macros

#define OFFSET(x)   offsetof(MaskedClampContext, x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
 
#define MASKEDCLAMP(type, name)
 

Functions

 AVFILTER_DEFINE_CLASS (maskedclamp)
 
static int query_formats (AVFilterContext *ctx)
 
static int maskedclamp_slice (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int process_frame (FFFrameSync *fs)
 
static int config_input (AVFilterLink *inlink)
 
static int config_output (AVFilterLink *outlink)
 
static int activate (AVFilterContext *ctx)
 
static av_cold void uninit (AVFilterContext *ctx)
 

Variables

static const AVOption maskedclamp_options []
 
static const AVFilterPad maskedclamp_inputs []
 
static const AVFilterPad maskedclamp_outputs []
 
const AVFilter ff_vf_maskedclamp
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 31 of file vf_maskedclamp.c.

◆ FLAGS

Definition at line 32 of file vf_maskedclamp.c.

◆ MASKEDCLAMP

#define MASKEDCLAMP (   type,
  name 
)
Value:
static void maskedclamp##name(const uint8_t *bbsrc, uint8_t *ddst, \
const uint8_t *ddarksrc, const uint8_t *bbrightsrc, \
int w, int undershoot, int overshoot) \
{ \
const type *bsrc = (const type *)bbsrc; \
const type *darksrc = (const type *)ddarksrc; \
const type *brightsrc = (const type *)bbrightsrc; \
type *dst = (type *)ddst; \
for (int x = 0; x < w; x++) { \
dst[x] = FFMAX(bsrc[x], darksrc[x] - undershoot); \
dst[x] = FFMIN(dst[x], brightsrc[x] + overshoot); \
} \
}

Definition at line 170 of file vf_maskedclamp.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( maskedclamp  )

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 63 of file vf_maskedclamp.c.

◆ maskedclamp_slice()

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

Definition at line 90 of file vf_maskedclamp.c.

Referenced by process_frame().

◆ process_frame()

static int process_frame ( FFFrameSync fs)
static

Definition at line 132 of file vf_maskedclamp.c.

Referenced by config_output().

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 189 of file vf_maskedclamp.c.

◆ config_output()

static int config_output ( AVFilterLink outlink)
static

Definition at line 223 of file vf_maskedclamp.c.

◆ activate()

static int activate ( AVFilterContext ctx)
static

Definition at line 280 of file vf_maskedclamp.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 286 of file vf_maskedclamp.c.

Variable Documentation

◆ maskedclamp_options

const AVOption maskedclamp_options[]
static
Initial value:
= {
{ "undershoot", "set undershoot", OFFSET(undershoot), AV_OPT_TYPE_INT, {.i64=0}, 0, UINT16_MAX, FLAGS },
{ "overshoot", "set overshoot", OFFSET(overshoot), AV_OPT_TYPE_INT, {.i64=0}, 0, UINT16_MAX, FLAGS },
{ "planes", "set planes", OFFSET(planes), AV_OPT_TYPE_INT, {.i64=0xF}, 0, 0xF, FLAGS },
{ NULL }
}

Definition at line 54 of file vf_maskedclamp.c.

◆ maskedclamp_inputs

const AVFilterPad maskedclamp_inputs[]
static
Initial value:
= {
{
.name = "base",
.config_props = config_input,
},
{
.name = "dark",
},
{
.name = "bright",
},
{ NULL }
}

Definition at line 293 of file vf_maskedclamp.c.

◆ maskedclamp_outputs

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

Definition at line 310 of file vf_maskedclamp.c.

◆ ff_vf_maskedclamp

const AVFilter ff_vf_maskedclamp
Initial value:
= {
.name = "maskedclamp",
.description = NULL_IF_CONFIG_SMALL("Clamp first stream with second stream and third stream."),
.priv_size = sizeof(MaskedClampContext),
.priv_class = &maskedclamp_class,
}

Definition at line 319 of file vf_maskedclamp.c.

OFFSET
#define OFFSET(x)
Definition: vf_maskedclamp.c:31
name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
bsrc
RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT uint8_t const uint8_t const uint8_t * bsrc
Definition: input.c:399
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_maskedclamp.c:189
maskedclamp_inputs
static const AVFilterPad maskedclamp_inputs[]
Definition: vf_maskedclamp.c:293
w
uint8_t w
Definition: llviddspenc.c:39
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: vf_maskedclamp.c:63
activate
static int activate(AVFilterContext *ctx)
Definition: vf_maskedclamp.c:280
FLAGS
#define FLAGS
Definition: vf_maskedclamp.c:32
type
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
Definition: writing_filters.txt:86
maskedclamp_outputs
static const AVFilterPad maskedclamp_outputs[]
Definition: vf_maskedclamp.c:310
inputs
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
Definition: filter_design.txt:243
MaskedClampContext
Definition: vf_maskedclamp.c:38
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
NULL
#define NULL
Definition: coverity.c:32
for
for(j=16;j >0;--j)
Definition: h264pred_template.c:469
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
process_command
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
Definition: af_acrusher.c:336
FFMAX
#define FFMAX(a, b)
Definition: common.h:103
ff_filter_process_command
int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
Generic processing of user supplied commands that are set in the same way as the filter options.
Definition: avfilter.c:842
FFMIN
#define FFMIN(a, b)
Definition: common.h:105
config_output
static int config_output(AVFilterLink *outlink)
Definition: vf_maskedclamp.c:223
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
planes
static const struct @322 planes[]
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:117
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_maskedclamp.c:286
AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will have its filter_frame() c...
Definition: avfilter.h:134
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:561