Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Hardware & Software > Software players

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 13th May 2015, 18:00   #1  |  Link
bacondither
Registered User
 
Join Date: Oct 2013
Location: Sweden
Posts: 128
Adaptive sharpen - Image sharpening shader

It is an image enhancement shader written in HLSL that can be used by MPC-HC or MPDN and other software that can use pixel shaders. Github page

Version 2018-04-14
BSD 2-clause license

Download

Code:
Changelog:
2018-04-14 - Misc tweaks.

2017-12-30 - Cosmetic changes and minor improvements.

2017-11-01 - Small improvement for anti-ringing.
           - Tweaks and minor changes.

2017-04-11 - Use compression instead of clipping for nmax_scale & nmin_scale.
           - Tweaked saturation compensation.

2017-01-22 - Replaced the algorithm for saturation compensation.

2016-12-07 - Changed how saturation is compensated for when brightness is altered.
           - Misc tweaks.

2016-09-24 - Updated edge-detection weights, slightly better for high-frequency content.
           - Minor tweaks.

2016-07-10 - Replaced lerp used for overshoot compression with a weighted power mean, reduces some ringing.
           - Corrected minor error in the custom smoothstep function.
           - Slightly improved weighting for nmax & nmin.
           - Tweaked some parameters.

2016-01-12 - Faster sorting algorithm.

2016-01-07 - Fixed compiler warning X3571 and handle a possible divide by zero.

2015-12-09 - Use a concave sharpening kernel for higher center edge values.
           - For summation of pixels in the laplace kernel use a sRGB gamma approximation.

2015-11-17 - Improved low threshold for sharpening.
           - Linear light used for summation in the laplace kernel.
           - Fixed tanh overflow.

2015-09-23 - Limit low values for the "middle ring" of laplace weights.
           - Misc changes.

2015-08-19 - 2-pass algorithm.
           - Better overshoot control.
           - Reduced saturation loss on pixels made brighter.

2015-06-25 - Unrolls the sorting loop when compiled with ps 4.0+ (much better performance for ps 4.0+).
           - Added fix for MPDN (alpha channel is always set to one).
           - Style fixes.

2015-05-15 - No real change from the last version, just changed some stupid variable names and comments.

2015-04-05 - First release.

Installation instructions

The shader is tuned and designed for post resize.
Requires gamma light as input and a pixel shader of version 3 or higher.

Settings are stored in the second pass file.
curve_height is the main control for the sharpening strength.

The correct shader order are:
Pass one
Pass two

If the shader passes are added in the wrong order or the alpha channel is truncated, it will return a green screen.


It does what?

The shader tries to sharpen somewhat blurry edges the most, it avoids to sharpen near-flat areas and very sharp edges.
The outer weights of the laplace matrix is variable to mitigate ringing on relative sharp edges and to provide more sharpening on wider and blurrier edges.

The final stage is a soft limiter that confines overshoots based on local near min/max values.
Light overshoots are limited more due to it's worse appearance compared to dark undershoots in most cases.


Old Versions

Depreciated old one pass version:
Download - OLD - 2015-05-25

Last edited by bacondither; 16th April 2018 at 16:15.
bacondither is offline   Reply With Quote
 

Tags
adaptive sharpen, shader, sharpening

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 00:33.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.