summaryrefslogtreecommitdiff
path: root/libavfilter/vf_blend.c
diff options
context:
space:
mode:
authorTimothy Gu <timothygu99@gmail.com>2016-02-13 23:42:45 +0000
committerTimothy Gu <timothygu99@gmail.com>2016-02-14 08:57:07 -0800
commitee281b884e2d401f7c3b3ce95849211748ca2b53 (patch)
treec067e1b87cd4d5d1310b923fc798e0d6bbabda6d /libavfilter/vf_blend.c
parentba25936df589c62b097f799ed751973ebeac42b2 (diff)
vf_blend: Use memcpy when opacity is 0
For xor mode, 1.8x faster on Haswell.
Diffstat (limited to 'libavfilter/vf_blend.c')
-rw-r--r--libavfilter/vf_blend.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavfilter/vf_blend.c b/libavfilter/vf_blend.c
index c24013dcbb..599084f04d 100644
--- a/libavfilter/vf_blend.c
+++ b/libavfilter/vf_blend.c
@@ -130,6 +130,7 @@ static void blend_copy ## src(const uint8_t *top, ptrdiff_t top_linesize, \
}
COPY(top)
+COPY(bottom)
#undef COPY
@@ -512,6 +513,7 @@ static int config_output(AVFilterLink *outlink)
case BLEND_MULTIPLY128:param->blend = is_16bit ? blend_multiply128_16bit: blend_multiply128_8bit;break;
case BLEND_NEGATION: param->blend = is_16bit ? blend_negation_16bit : blend_negation_8bit; break;
case BLEND_NORMAL: param->blend = param->opacity == 1 ? blend_copytop :
+ param->opacity == 0 ? blend_copybottom :
is_16bit ? blend_normal_16bit : blend_normal_8bit; break;
case BLEND_OR: param->blend = is_16bit ? blend_or_16bit : blend_or_8bit; break;
case BLEND_OVERLAY: param->blend = is_16bit ? blend_overlay_16bit : blend_overlay_8bit; break;
@@ -528,6 +530,10 @@ static int config_output(AVFilterLink *outlink)
if (ARCH_X86)
ff_blend_init_x86(param, is_16bit);
+ if (param->opacity == 0 && param->mode != BLEND_NORMAL) {
+ param->blend = blend_copytop;
+ }
+
if (s->all_expr && !param->expr_str) {
param->expr_str = av_strdup(s->all_expr);
if (!param->expr_str)