History

avfilter/vf_blend: add harmonic mode

Paul B Mahol committed 5 years ago

Commit df163481 parent 8ebcff94 files · +5 −0Browse files

Showing the changes to libavfilter (3 of 4 files). Show all

Unified · Split

3 files
  1. libavfilter/blend.h +1 −0
  2. libavfilter/blend_modes.c +1 −0
  3. libavfilter/vf_blend.c +2 −0
libavfilter/blend.h+1−0
@@ -61,6 +61,7 @@ enum BlendMode { · 60 unmodified lines
6161 BLEND_EXTREMITY,
6262 BLEND_SOFTDIFFERENCE,
6363 BLEND_GEOMETRIC,
64+ BLEND_HARMONIC,
6465 BLEND_NB
6566 };
6667
libavfilter/blend_modes.c+1−0
@@ -144,3 +144,4 @@ fn(vividlight, (A < HALF) ? BURN(2 * A, B) : DODGE(2 * (A - HALF), B)) · 143 unmodified lines
144144 fn(linearlight,CLIP((B < HALF) ? B + 2 * A - MAX : B + 2 * (A - HALF)))
145145 fn(softdifference,CLIP((A > B) ? (B == MAX) ? 0 : (A - B) * MAX / (MAX - B) : (B == 0) ? 0 : (B - A) * MAX / B))
146146 fn(geometric, GEOMETRIC(A, B))
147+fn(harmonic, A == 0 && B == 0 ? 0 : 2LL * A * B / (A + B))
libavfilter/vf_blend.c+2−0
@@ -133,6 +133,7 @@ static const AVOption blend_options[] = { · 132 unmodified lines
133133 { "xor", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_XOR}, 0, 0, FLAGS, "mode" },
134134 { "softdifference","", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_SOFTDIFFERENCE}, 0, 0, FLAGS, "mode" },
135135 { "geometric", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_GEOMETRIC}, 0, 0, FLAGS, "mode" },
136+ { "harmonic", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_HARMONIC}, 0, 0, FLAGS, "mode" },
136137 { "c0_expr", "set color component #0 expression", OFFSET(params[0].expr_str), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
137138 { "c1_expr", "set color component #1 expression", OFFSET(params[1].expr_str), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
138139 { "c2_expr", "set color component #2 expression", OFFSET(params[2].expr_str), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
@@ -398,6 +399,7 @@ static av_cold void init_blend_func_##depth##_##nbits##bit(FilterParams *param) · 259 unmodified lines
398399 case BLEND_XOR: param->blend = blend_xor_##depth##bit; break; \
399400 case BLEND_SOFTDIFFERENCE:param->blend = blend_softdifference_##depth##bit; break;\
400401 case BLEND_GEOMETRIC: param->blend = blend_geometric_##depth##bit; break; \
402+ case BLEND_HARMONIC: param->blend = blend_harmonic_##depth##bit; break; \
401403 } \
402404 }
403405 DEFINE_INIT_BLEND_FUNC(8, 8)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t