Add a crap gradient detect to make DE less bad.

Use the vertical and horizontal gradients to "detect" when a pixel is
part of an edge that has been softened by grid-shift AA, and avoid
blurring it further. This causes occasional 1px artifacts in stills, but
fixes the truly grotesque DE bleed-out for a net win. A better edge
detector is still needed.
This commit is contained in:
Steven Robertson 2011-10-27 08:51:40 -04:00
parent 7c84c6a7a9
commit 9049902b4f

View File

@ -156,6 +156,13 @@ void density_est(float4 *pixbuf, float4 *outbuf,
float den; float den;
read_pix(in, den); read_pix(in, den);
float *dens = reinterpret_cast<float*>(pixbuf);
float top = dens[(idx-{{info.acc_stride}})*4+3],
bottom = dens[(idx+{{info.acc_stride}})*4+3];
den = fmaxf(den, fabsf(top-bottom));
float left = dens[idx*4-1], right = dens[idx*4+7];
den = fmaxf(den, fabsf(left-right));
if (in.w > 0 && den > 0) { if (in.w > 0 && den > 0) {
float ls = k1 * logf(1.0f + in.w * k2) / in.w; float ls = k1 * logf(1.0f + in.w * k2) / in.w;
in.x *= ls; in.x *= ls;