Thread: Avisynth+
View Single Post
Old 6th February 2019, 09:16   #4481  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,314
Quote:
Originally Posted by StainlessS View Post
EDIT: Or in full as here: (3 out of the 4 original lines look messed up to me)
Code:
//RGB:
      if constexpr(mode == LIGHTEN) {
        alpha = luma_ovr > (luma_src + thresh) ? alpha : 0;    // As original
      } else { // EDIT: DARKEN
        alpha = luma_ovr < (luma_src - thresh) ? alpha : 0
      }


//YUV:
      if constexpr (mode == LIGHTEN) {
        alpha_mask = ovr > (src + thresh) ? level : 0;
      }
      else { // EDIT: DARKEN
        alpha_mask = ovr < (src - thresh) ? level : 0;
      }
I spent too much time yesterday with not understanding what really happens and why my code produces different results than existing rgb version. I was thinking it over by a bottle of dark Staropramen and finally voted for this very same logic.

"Where overlay is brigher by threshold" =>
Where overlay is brigther by 10 =>
Where overlay > src + 10

and "Where overlay is darker by threshold" =>
Where overlay is darker by 10 =>
Where overlay < src - 10
pinterf is offline