1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

avfilter/vf_chromakey: fix diff scaling for chromahold filter

This commit is contained in:
Paul B Mahol 2021-08-20 07:23:18 +02:00
parent 8990c5869e
commit ed6ea4f9ca

View File

@ -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) {