FFmpeg
Macros
blend_modes.c File Reference
#include "libavutil/common.h"
#include "libavutil/intfloat.h"
#include "avfilter.h"
#include "internal.h"
#include "video.h"
#include "blend.h"

Go to the source code of this file.

Macros

#define PIXEL   uint16_t
 
#define MAX   ((1 << DEPTH) - 1)
 
#define HALF   (1 << (DEPTH - 1))
 
#define CLIP(x)   ((int)av_clip_uintp2(x, DEPTH))
 
#define MULTIPLY(x, a, b)   ((x) * (((a) * (b)) / MAX))
 
#define SCREEN(x, a, b)   (MAX - (x) * ((MAX - (a)) * (MAX - (b)) / MAX))
 
#define BURN(a, b)   (((a) == 0) ? (a) : FFMAX(0, MAX - ((MAX - (b)) << DEPTH) / (a)))
 
#define DODGE(a, b)   (((a) == MAX) ? (a) : FFMIN(MAX, (((b) << DEPTH) / (MAX - (a)))))
 
#define GEOMETRIC(a, b)   (lrintf(sqrtf((unsigned)A * B)))
 
#define INT2FLOAT(x)   (x)
 
#define FLOAT2INT(x)   (x)
 
#define MDIV   (0.125f * (1 << DEPTH))
 
#define LRINTF(x)   lrintf(x)
 
#define A   top[j]
 
#define B   bottom[j]
 
#define fn2(a, b)   blend_##a##_##b##bit
 
#define fn1(name, depth)   fn2(name, depth)
 
#define fn0(name)   fn1(name, DEPTH)
 
#define fn(NAME, EXPR)
 

Macro Definition Documentation

◆ PIXEL

#define PIXEL   uint16_t

Definition at line 44 of file blend_modes.c.

◆ MAX

#define MAX   ((1 << DEPTH) - 1)

Definition at line 45 of file blend_modes.c.

◆ HALF

#define HALF   (1 << (DEPTH - 1))

Definition at line 46 of file blend_modes.c.

◆ CLIP

#define CLIP (   x)    ((int)av_clip_uintp2(x, DEPTH))

Definition at line 47 of file blend_modes.c.

◆ MULTIPLY

#define MULTIPLY (   x,
  a,
  b 
)    ((x) * (((a) * (b)) / MAX))

Definition at line 61 of file blend_modes.c.

◆ SCREEN

#define SCREEN (   x,
  a,
  b 
)    (MAX - (x) * ((MAX - (a)) * (MAX - (b)) / MAX))

Definition at line 62 of file blend_modes.c.

◆ BURN

#define BURN (   a,
  b 
)    (((a) == 0) ? (a) : FFMAX(0, MAX - ((MAX - (b)) << DEPTH) / (a)))

Definition at line 63 of file blend_modes.c.

◆ DODGE

#define DODGE (   a,
  b 
)    (((a) == MAX) ? (a) : FFMIN(MAX, (((b) << DEPTH) / (MAX - (a)))))

Definition at line 64 of file blend_modes.c.

◆ GEOMETRIC

#define GEOMETRIC (   a,
  b 
)    (lrintf(sqrtf((unsigned)A * B)))

Definition at line 65 of file blend_modes.c.

◆ INT2FLOAT

#define INT2FLOAT (   x)    (x)

Definition at line 66 of file blend_modes.c.

◆ FLOAT2INT

#define FLOAT2INT (   x)    (x)

Definition at line 67 of file blend_modes.c.

◆ MDIV

#define MDIV   (0.125f * (1 << DEPTH))

Definition at line 68 of file blend_modes.c.

◆ LRINTF

#define LRINTF (   x)    lrintf(x)

Definition at line 69 of file blend_modes.c.

◆ A

#define A   top[j]

Definition at line 82 of file blend_modes.c.

◆ B

#define B   bottom[j]

Definition at line 83 of file blend_modes.c.

◆ fn2

#define fn2 (   a,
  b 
)    blend_##a##_##b##bit

Definition at line 85 of file blend_modes.c.

◆ fn1

#define fn1 (   name,
  depth 
)    fn2(name, depth)

Definition at line 86 of file blend_modes.c.

◆ fn0

#define fn0 (   name)    fn1(name, DEPTH)

Definition at line 87 of file blend_modes.c.

◆ fn

#define fn (   NAME,
  EXPR 
)
Value:
static void fn0(NAME)(const uint8_t *_top, ptrdiff_t top_linesize, \
const uint8_t *_bottom, ptrdiff_t bottom_linesize, \
uint8_t *_dst, ptrdiff_t dst_linesize, \
ptrdiff_t width, ptrdiff_t height, \
FilterParams *param, double *values, int starty) \
{ \
const PIXEL *top = (const PIXEL *)_top; \
const PIXEL *bottom = (const PIXEL *)_bottom; \
PIXEL *dst = (PIXEL *)_dst; \
const float opacity = param->opacity; \
\
dst_linesize /= sizeof(PIXEL); \
top_linesize /= sizeof(PIXEL); \
bottom_linesize /= sizeof(PIXEL); \
for (int i = 0; i < height; i++) { \
for (int j = 0; j < width; j++) { \
dst[j] = top[j] + ((EXPR)-top[j]) * opacity; \
} \
dst += dst_linesize; \
top += top_linesize; \
bottom += bottom_linesize; \
} \
}

Definition at line 89 of file blend_modes.c.

width
#define width
for
for(k=2;k<=8;++k)
Definition: h264pred_template.c:425
height
#define height
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
PIXEL
#define PIXEL
Definition: blend_modes.c:44
values
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 the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return values
Definition: filter_design.txt:263
fn0
#define fn0(name)
Definition: blend_modes.c:87