From 299b5d5dabf17d99e04d623ed323acf086f07e9d Mon Sep 17 00:00:00 2001 From: Steven Robertson Date: Sat, 11 Jun 2011 23:28:32 -0400 Subject: [PATCH] Fix filtering - or at least make it less broken --- cuburn/code/filtering.py | 10 ++++------ cuburn/render.py | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/cuburn/code/filtering.py b/cuburn/code/filtering.py index 1a8d73f..f1fddf1 100644 --- a/cuburn/code/filtering.py +++ b/cuburn/code/filtering.py @@ -22,8 +22,6 @@ void colorclip(float4 *pixbuf, float gamma, float vibrancy, float highpow, if (pix.w < linrange) { float frac = pix.w / linrange; alpha = (1.0f - frac) * pix.w * lingam + frac * alpha; - pixbuf[i] = make_float4(0, 0, 0, 0); - return; } float ls = vibrancy * alpha / pix.w; @@ -39,7 +37,7 @@ void colorclip(float4 *pixbuf, float gamma, float vibrancy, float highpow, pix.x *= newls; pix.y *= newls; pix.z *= newls; - maxc *= newls; + //maxc *= newls; TODO: check this // Reduce saturation (according to the HSV model) by proportionally // 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); if (alpha > 0.0f) { - pix.x = fminf(1.0f, pix.x * alpha); - pix.y = fminf(1.0f, pix.y * alpha); - pix.z = fminf(1.0f, pix.z * alpha); + pix.x = fminf(1.0f, pix.x); + pix.y = fminf(1.0f, pix.y); + pix.z = fminf(1.0f, pix.z); } else { pix.x = pix.y = pix.z = 0; // color pixel green; likewise, don't think this code can be reached diff --git a/cuburn/render.py b/cuburn/render.py index 498e773..5dc3f1a 100644 --- a/cuburn/render.py +++ b/cuburn/render.py @@ -319,8 +319,8 @@ class _AnimRenderer(object): vib = f(vib / n) hipow = f(cen_cp.highlight_power) lin = f(cen_cp.gam_lin_thresh) - lingam = f(math.pow(cen_cp.gam_lin_thresh, gam-1.0)) - print gam, lin, lingam, cen_cp.gamma + lingam = f(math.pow(cen_cp.gam_lin_thresh, gam-1.0)) if lin > 0 else 0 + print gam, vib, lin, lingam, cen_cp.gamma # TODO: get block size from colorclip class? It actually does not # depend on that being the case