[FFmpeg-cvslog] avfilter/vf_chromakey: fix diff scaling for chromahold filter
Paul B Mahol
git at videolan.org
Fri Aug 20 08:25:34 EEST 2021
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Fri Aug 20 07:23:18 2021 +0200| [ed6ea4f9ca2e40222efc111d203423b27691a1f1] | committer: Paul B Mahol
avfilter/vf_chromakey: fix diff scaling for chromahold filter
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ed6ea4f9ca2e40222efc111d203423b27691a1f1
---
libavfilter/vf_chromakey.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavfilter/vf_chromakey.c b/libavfilter/vf_chromakey.c
index 185b3980bc..42a494697c 100644
--- a/libavfilter/vf_chromakey.c
+++ b/libavfilter/vf_chromakey.c
@@ -197,7 +197,7 @@ static int do_chromahold_slice(AVFilterContext *avctx, void *arg, int jobnr, int
du = u - ctx->chromakey_uv[0];
dv = v - ctx->chromakey_uv[1];
- diff = sqrt((du * du + dv * dv) / (255.0 * 255.0));
+ diff = sqrt((du * du + dv * dv) / (255.0 * 255.0 * 2.0));
alpha = diff > ctx->similarity;
if (ctx->blend > 0.0001) {
@@ -236,7 +236,7 @@ static int do_chromahold16_slice(AVFilterContext *avctx, void *arg, int jobnr, i
du = u - ctx->chromakey_uv[0];
dv = v - ctx->chromakey_uv[1];
- diff = sqrt((du * du + dv * dv) / (max * max));
+ diff = sqrt((du * du + dv * dv) / (max * max * 2.0));
alpha = diff > ctx->similarity;
if (ctx->blend > 0.0001) {
More information about the ffmpeg-cvslog
mailing list