aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2015-06-02 19:12:45 +0000
committerPaul B Mahol <onemda@gmail.com>2015-06-02 19:12:45 +0000
commit3e04746ec335a2fe3839aab5f40ccd4528e279a0 (patch)
treeb7f2f15504f94a17577450551e720ab8d6e4c383
parent20cea0c7de870d2fee6036082f202b431f49e200 (diff)
downloadffmpeg-3e04746ec335a2fe3839aab5f40ccd4528e279a0.tar.gz
avfilter/vf_blend: add hardmix mode
Signed-off-by: Paul B Mahol <onemda@gmail.com>
-rw-r--r--doc/filters.texi1
-rw-r--r--libavfilter/vf_blend.c4
2 files changed, 5 insertions, 0 deletions
diff --git a/doc/filters.texi b/doc/filters.texi
index a79979360a..333244df3b 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -2749,6 +2749,7 @@ Available values for component modes are:
@item dodge
@item exclusion
@item hardlight
+@item hardmix
@item lighten
@item multiply
@item negation
diff --git a/libavfilter/vf_blend.c b/libavfilter/vf_blend.c
index 33d3f283d6..8cfab08797 100644
--- a/libavfilter/vf_blend.c
+++ b/libavfilter/vf_blend.c
@@ -59,6 +59,7 @@ enum BlendMode {
BLEND_SUBTRACT,
BLEND_VIVIDLIGHT,
BLEND_XOR,
+ BLEND_HARDMIX,
BLEND_NB
};
@@ -117,6 +118,7 @@ typedef struct {
{ "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" },\
{ "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" },\
{ "lighten", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_LIGHTEN}, 0, 0, FLAGS, "mode" },\
{ "multiply", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_MULTIPLY}, 0, 0, FLAGS, "mode" },\
{ "negation", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_NEGATION}, 0, 0, FLAGS, "mode" },\
@@ -201,6 +203,7 @@ DEFINE_BLEND(difference128, av_clip_uint8(128 + A - B))
DEFINE_BLEND(screen, SCREEN(1, A, B))
DEFINE_BLEND(overlay, (A < 128) ? MULTIPLY(2, A, B) : SCREEN(2, A, B))
DEFINE_BLEND(hardlight, (B < 128) ? MULTIPLY(2, B, A) : SCREEN(2, B, A))
+DEFINE_BLEND(hardmix, (A < (255 - B)) ? 0: 255)
DEFINE_BLEND(darken, FFMIN(A, B))
DEFINE_BLEND(lighten, FFMAX(A, B))
DEFINE_BLEND(divide, av_clip_uint8(((float)A / ((float)B) * 255)))
@@ -326,6 +329,7 @@ static av_cold int init(AVFilterContext *ctx)
case BLEND_DODGE: param->blend = blend_dodge; break;
case BLEND_EXCLUSION: param->blend = blend_exclusion; break;
case BLEND_HARDLIGHT: param->blend = blend_hardlight; break;
+ case BLEND_HARDMIX: param->blend = blend_hardmix; break;
case BLEND_LIGHTEN: param->blend = blend_lighten; break;
case BLEND_MULTIPLY: param->blend = blend_multiply; break;
case BLEND_NEGATION: param->blend = blend_negation; break;