From 9049902b4f2f415b7311ab101b771917abc7944b Mon Sep 17 00:00:00 2001 From: Steven Robertson Date: Thu, 27 Oct 2011 08:51:40 -0400 Subject: [PATCH] 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. --- cuburn/code/filtering.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cuburn/code/filtering.py b/cuburn/code/filtering.py index 2da5cab..b191c33 100644 --- a/cuburn/code/filtering.py +++ b/cuburn/code/filtering.py @@ -156,6 +156,13 @@ void density_est(float4 *pixbuf, float4 *outbuf, float den; read_pix(in, den); + float *dens = reinterpret_cast(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) { float ls = k1 * logf(1.0f + in.w * k2) / in.w; in.x *= ls;