Fix filtering - or at least make it less broken

This commit is contained in:
Steven Robertson 2011-06-11 23:28:32 -04:00
parent 6b09e162a3
commit 299b5d5dab
2 changed files with 6 additions and 8 deletions

View File

@ -22,8 +22,6 @@ void colorclip(float4 *pixbuf, float gamma, float vibrancy, float highpow,
if (pix.w < linrange) { if (pix.w < linrange) {
float frac = pix.w / linrange; float frac = pix.w / linrange;
alpha = (1.0f - frac) * pix.w * lingam + frac * alpha; alpha = (1.0f - frac) * pix.w * lingam + frac * alpha;
pixbuf[i] = make_float4(0, 0, 0, 0);
return;
} }
float ls = vibrancy * alpha / pix.w; float ls = vibrancy * alpha / pix.w;
@ -39,7 +37,7 @@ void colorclip(float4 *pixbuf, float gamma, float vibrancy, float highpow,
pix.x *= newls; pix.x *= newls;
pix.y *= newls; pix.y *= newls;
pix.z *= newls; pix.z *= newls;
maxc *= newls; //maxc *= newls; TODO: check this
// Reduce saturation (according to the HSV model) by proportionally // Reduce saturation (according to the HSV model) by proportionally
// increasing the values of the other colors. // increasing the values of the other colors.
@ -65,9 +63,9 @@ void colorclip(float4 *pixbuf, float gamma, float vibrancy, float highpow,
pix.z += (1.0f - vibrancy) * powf(opix.z, gamma); pix.z += (1.0f - vibrancy) * powf(opix.z, gamma);
if (alpha > 0.0f) { if (alpha > 0.0f) {
pix.x = fminf(1.0f, pix.x * alpha); pix.x = fminf(1.0f, pix.x);
pix.y = fminf(1.0f, pix.y * alpha); pix.y = fminf(1.0f, pix.y);
pix.z = fminf(1.0f, pix.z * alpha); pix.z = fminf(1.0f, pix.z);
} else { } else {
pix.x = pix.y = pix.z = 0; pix.x = pix.y = pix.z = 0;
// color pixel green; likewise, don't think this code can be reached // color pixel green; likewise, don't think this code can be reached

View File

@ -319,8 +319,8 @@ class _AnimRenderer(object):
vib = f(vib / n) vib = f(vib / n)
hipow = f(cen_cp.highlight_power) hipow = f(cen_cp.highlight_power)
lin = f(cen_cp.gam_lin_thresh) lin = f(cen_cp.gam_lin_thresh)
lingam = f(math.pow(cen_cp.gam_lin_thresh, gam-1.0)) lingam = f(math.pow(cen_cp.gam_lin_thresh, gam-1.0)) if lin > 0 else 0
print gam, lin, lingam, cen_cp.gamma print gam, vib, lin, lingam, cen_cp.gamma
# TODO: get block size from colorclip class? It actually does not # TODO: get block size from colorclip class? It actually does not
# depend on that being the case # depend on that being the case