Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2020-05-16 20:45:53 +0300
committerPaul B Mahol <onemda@gmail.com>2020-05-19 21:10:34 +0300
commit8b0575d7638f40730c020ada41a573fff715c1a7 (patch)
tree6adff0a3fce00dd5c68f99f08e2f8e83878b786c /libavfilter/vf_colorkey.c
parentf63939dedb898dd711860c530287ede55b6d88d7 (diff)
avfilter/vf_colorkey: fix formula for calculation of difference
Also fixes colorhold filtering.
Diffstat (limited to 'libavfilter/vf_colorkey.c')
-rw-r--r--libavfilter/vf_colorkey.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavfilter/vf_colorkey.c b/libavfilter/vf_colorkey.c
index 7af426a61e..0ac847c633 100644
--- a/libavfilter/vf_colorkey.c
+++ b/libavfilter/vf_colorkey.c
@@ -45,7 +45,7 @@ static uint8_t do_colorkey_pixel(ColorkeyContext *ctx, uint8_t r, uint8_t g, uin
int dg = (int)g - ctx->colorkey_rgba[1];
int db = (int)b - ctx->colorkey_rgba[2];
- double diff = sqrt((dr * dr + dg * dg + db * db) / (255.0 * 255.0));
+ double diff = sqrt((dr * dr + dg * dg + db * db) / (255.0 * 255.0 * 3.0));
if (ctx->blend > 0.0001) {
return av_clipd((diff - ctx->similarity) / ctx->blend, 0.0, 1.0) * 255.0;