Sorry everyone, I've been out of commission for a long while and
completely missed that discussion earlier on.

Thanks a lot Andraz for reminding me :-)

And yeah, I don't know what I was thinking... when I wrote that....
The lines should read:
       as = (s - sat - min_s) / (min_s * 2);
       av = (s - min_v ) / (min_v * 2) ;
       avm = 1 / 2 + (v - max_v_out ) / (max_v_out *2);

And here's the patch (I modified another line for consistency)

I did a quick test and it looks obviously better.
Let me know how that works out for you !
  Jerome

--- plugins/chromakey-hsv/chromakey.C.orig      2006-04-10
09:39:12.970449639 -0400
+++ plugins/chromakey-hsv/chromakey.C   2006-04-10 09:40:33.673753816 -0400
@@ -634,7 +634,7 @@
              else if (s - sat >= min_s_in)
                as = 0;
              else if ((out_slope != 0) && (s - sat > min_s))
-               as = (s - sat - min_s / min_s) / 2;
+               as = as = (s - sat - min_s) / (min_s * 2);
              else if (s - sat > min_s_out)
                as = 1 / 2 + (s - sat - min_s_out) / (min_s_out * 2);
              else
@@ -649,7 +649,7 @@
              else if (v >= min_v_in)
                av = 0;
              else if ((out_slope != 0) && (v > min_v))
-               av = (s - min_v / min_v) / 2;
+               av = (s - min_v ) / (min_v * 2) ;
              else if (v > min_v_out)
                av = 1 / 2 + (v - min_v_out) / (min_v_out * 2);
              else
@@ -664,9 +664,9 @@
              else if (v <= max_v_in)
                avm = 0;
              else if ((out_slope != 0) && (v < max_v))
-               avm = (s - max_v / max_v) / 2;
+               avm = (s - max_v) / ( max_v * 2);
              else if (v < max_v_out)
-               avm = 1 / 2 + (v - max_v_out / max_v_out) / 2;
+               avm = 1 / 2 + (v - max_v_out ) / (max_v_out *2);
              else
                has_match = false;
            }


Graham Evans wrote:
> Heroine Virtual Ltd. wrote:
>
>> chromakey.C has a number of lines like:
>>
>>        as = (s - sat - min_s / min_s) / 2;
>>
>> Did you mean
>>
> I'm not sure where the fellow is that encoded that plug-in but their
> seemed be a problem with the plug-in where zero did not equal zero. 
> This was with the spill compensation level.  If you set this to zero
> you still have spill compensation.  You  can only totally eliminate
> the effect by pushing the spill threshold up.
>
> A maths error of the kind you mention seems a likely cause.
>
> Graham
>
>>    as = (s - sat - 1.0) / 2;
>>
>> or
>>
>>    as = (s - (sat - min_s) / min_s) / 2;
>>
>> or
>>
>>   as = ((s - sat - min_s) / min_s) / 2;
>>
>> These probably need parentheses to do the intended effect. Other
>> problem lines are:
>>
>>        av = (s - min_v / min_v) / 2;
>>        avm = 1 / 2 + (v - max_v_out / max_v_out) / 2;
>>
>>


_______________________________________________
Cinelerra mailing list
[email protected]
https://init.linpro.no/mailman/skolelinux.no/listinfo/cinelerra

Reply via email to