[FFmpeg-cvslog] avfilter/vf_blend: add hardmix mode
Paul B Mahol
git at videolan.org
Tue Jun 2 21:24:38 CEST 2015
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Tue Jun 2 19:12:45 2015 +0000| [3e04746ec335a2fe3839aab5f40ccd4528e279a0] | committer: Paul B Mahol
avfilter/vf_blend: add hardmix mode
Signed-off-by: Paul B Mahol <onemda at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3e04746ec335a2fe3839aab5f40ccd4528e279a0
---
doc/filters.texi | 1 +
libavfilter/vf_blend.c | 4 ++++
2 files changed, 5 insertions(+)
diff --git a/doc/filters.texi b/doc/filters.texi
index a799793..333244d 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
+ at item hardmix
@item lighten
@item multiply
@item negation
diff --git a/libavfilter/vf_blend.c b/libavfilter/vf_blend.c
index 33d3f28..8cfab08 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;
More information about the ffmpeg-cvslog
mailing list