X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fplugins%2Fbluebanana%2Fbluebananacolor.c;h=cb64f97996145e94e42cd9dabc5b24ddf28115bf;hb=a19a685a46ddc630010788707d9e5b9d2342af46;hp=357518aee8216155a953abded8cff5eece219a47;hpb=b77dbd97d927405c86a2a8ca0dd927bca3c70175;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/plugins/bluebanana/bluebananacolor.c b/cinelerra-5.1/plugins/bluebanana/bluebananacolor.c index 357518ae..cb64f979 100644 --- a/cinelerra-5.1/plugins/bluebanana/bluebananacolor.c +++ b/cinelerra-5.1/plugins/bluebanana/bluebananacolor.c @@ -226,11 +226,16 @@ static inline void RGB_to_rgb8(float *R, float *G, float *B, float *S, float F, } static inline void Aal_to_alp8(float *S, float F, unsigned char *row, int w, int bpp){ - F = 1.f - F; - while(w--){ - float a = (1 - *S*F)*255.f +.5f; - row[3] = CLAMP(a,0,255); - row+=bpp; ++S; + if(S){ + while(w--){ + float a = *S*F*255.f +.5f; + row[3] = CLAMP(a,0,255); + row+=bpp; ++S; + } + }else{ + float a = F*255.f +.5f; + unsigned char s = CLAMP(a,0,255); + while(w--){ row[3] = s; row+=bpp; } } } @@ -275,11 +280,11 @@ static inline void RGB_to_rgbF(float *R, float *G, float *B, float *S, float F, } static inline void Aal_to_alpF(float *S, float F, float *row, int w, int bpp){ - F = 1.f - F; - while(w--){ - float a = 1.f - *S*F; - row[3] = a; - row+=bpp; + if(S){ + while(w--){ row[3] = *S++ * F; row+=bpp; } + }else{ + float a = F; + while(w--){ row[3] = a; row+=bpp; } } } @@ -393,6 +398,10 @@ static inline void HSpV_to_RGB(float H, float Sp, float V, float &R, float &G, f static inline void HSpV_correct_RGB(float H, float Sp, float &V, float &R, float &G, float &B){ float vp = Sp<0.f?0.f:(fabs(V)+HSpV_SATURATION_BIAS)*Sp*HSpV_SATURATION_ISCALE; +#define R_TO_Y (Kr) +#define G_TO_Y (Kg) +#define B_TO_Y (Kb) + int i = (int)H; switch(i){ default: