summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/filters.texi2
-rw-r--r--libavfilter/blend.h2
-rw-r--r--libavfilter/vf_blend.c8
3 files changed, 12 insertions, 0 deletions
diff --git a/doc/filters.texi b/doc/filters.texi
index 616d69409d..344e14083c 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -4240,10 +4240,12 @@ Available values for component modes are:
@item difference128
@item divide
@item dodge
+@item freeze
@item exclusion
@item glow
@item hardlight
@item hardmix
+@item heat
@item lighten
@item linearlight
@item multiply
diff --git a/libavfilter/blend.h b/libavfilter/blend.h
index ccef13618e..f0712ff250 100644
--- a/libavfilter/blend.h
+++ b/libavfilter/blend.h
@@ -56,6 +56,8 @@ enum BlendMode {
BLEND_GLOW,
BLEND_ADDITION128,
BLEND_MULTIPLY128,
+ BLEND_HEAT,
+ BLEND_FREEZE,
BLEND_NB
};
diff --git a/libavfilter/vf_blend.c b/libavfilter/vf_blend.c
index ea63a20090..7125a1e707 100644
--- a/libavfilter/vf_blend.c
+++ b/libavfilter/vf_blend.c
@@ -76,9 +76,11 @@ typedef struct ThreadData {
{ "divide", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_DIVIDE}, 0, 0, FLAGS, "mode" },\
{ "dodge", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_DODGE}, 0, 0, FLAGS, "mode" },\
{ "exclusion", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_EXCLUSION}, 0, 0, FLAGS, "mode" },\
+ { "freeze", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_FREEZE}, 0, 0, FLAGS, "mode" },\
{ "glow", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_GLOW}, 0, 0, FLAGS, "mode" },\
{ "hardlight", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_HARDLIGHT}, 0, 0, FLAGS, "mode" },\
{ "hardmix", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_HARDMIX}, 0, 0, FLAGS, "mode" },\
+ { "heat", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_HEAT}, 0, 0, FLAGS, "mode" },\
{ "lighten", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_LIGHTEN}, 0, 0, FLAGS, "mode" },\
{ "linearlight","", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_LINEARLIGHT},0, 0, FLAGS, "mode" },\
{ "multiply", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_MULTIPLY}, 0, 0, FLAGS, "mode" },\
@@ -245,6 +247,8 @@ DEFINE_BLEND8(screen, SCREEN(1, A, B))
DEFINE_BLEND8(overlay, (A < 128) ? MULTIPLY(2, A, B) : SCREEN(2, A, B))
DEFINE_BLEND8(hardlight, (B < 128) ? MULTIPLY(2, B, A) : SCREEN(2, B, A))
DEFINE_BLEND8(hardmix, (A < (255 - B)) ? 0: 255)
+DEFINE_BLEND8(heat, (A == 0) ? 0 : 255 - FFMIN(((255 - B) * (255 - B)) / A, 255))
+DEFINE_BLEND8(freeze, (B == 0) ? 0 : 255 - FFMIN(((255 - A) * (255 - A)) / B, 255))
DEFINE_BLEND8(darken, FFMIN(A, B))
DEFINE_BLEND8(lighten, FFMAX(A, B))
DEFINE_BLEND8(divide, av_clip_uint8(B == 0 ? 255 : 255 * A / B))
@@ -285,6 +289,8 @@ DEFINE_BLEND16(screen, SCREEN(1, A, B))
DEFINE_BLEND16(overlay, (A < 32768) ? MULTIPLY(2, A, B) : SCREEN(2, A, B))
DEFINE_BLEND16(hardlight, (B < 32768) ? MULTIPLY(2, B, A) : SCREEN(2, B, A))
DEFINE_BLEND16(hardmix, (A < (65535 - B)) ? 0: 65535)
+DEFINE_BLEND16(heat, (A == 0) ? 0 : 65535 - FFMIN(((65535 - B) * (65535 - B)) / A, 65535))
+DEFINE_BLEND16(freeze, (B == 0) ? 0 : 65535 - FFMIN(((65535 - A) * (65535 - A)) / B, 65535))
DEFINE_BLEND16(darken, FFMIN(A, B))
DEFINE_BLEND16(lighten, FFMAX(A, B))
DEFINE_BLEND16(divide, av_clip_uint16(B == 0 ? 65535 : 65535 * A / B))
@@ -451,9 +457,11 @@ void ff_blend_init(FilterParams *param, int is_16bit)
case BLEND_DIVIDE: param->blend = is_16bit ? blend_divide_16bit : blend_divide_8bit; break;
case BLEND_DODGE: param->blend = is_16bit ? blend_dodge_16bit : blend_dodge_8bit; break;
case BLEND_EXCLUSION: param->blend = is_16bit ? blend_exclusion_16bit : blend_exclusion_8bit; break;
+ case BLEND_FREEZE: param->blend = is_16bit ? blend_freeze_16bit : blend_freeze_8bit; break;
case BLEND_GLOW: param->blend = is_16bit ? blend_glow_16bit : blend_glow_8bit; break;
case BLEND_HARDLIGHT: param->blend = is_16bit ? blend_hardlight_16bit : blend_hardlight_8bit; break;
case BLEND_HARDMIX: param->blend = is_16bit ? blend_hardmix_16bit : blend_hardmix_8bit; break;
+ case BLEND_HEAT: param->blend = is_16bit ? blend_heat_16bit : blend_heat_8bit; break;
case BLEND_LIGHTEN: param->blend = is_16bit ? blend_lighten_16bit : blend_lighten_8bit; break;
case BLEND_LINEARLIGHT:param->blend = is_16bit ? blend_linearlight_16bit: blend_linearlight_8bit;break;
case BLEND_MULTIPLY: param->blend = is_16bit ? blend_multiply_16bit : blend_multiply_8bit; break;