View Full Version : Adaptive sharpen - Image sharpening shader
bacondither
13th May 2015, 18:00
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 (https://github.com/bacondither/Adaptive-sharpen)
Version 2018-04-14
BSD 2-clause license
Download (https://github.com/bacondither/Adaptive-sharpen/archive/2018-04-14.zip)
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 (https://u.teknik.io/aCpSO7.zip)
toniash
14th May 2015, 07:52
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. It's tuned and designed for post resize and wants gamma light as input.
I will probably rewrite this post soon and add more information!
Meanwhile i hope it works for you :)
BSD 2-clause license
Requires pixel shader version 3.0
Version 2015-04-05
Download (http://www.filedropper.com/adaptivesharpen-2015-04-05)
Very good! :thanks:
What is gamma light?
Zachs
14th May 2015, 13:06
Think of Gamma light is the default mode in a render chain. So long as you don't add the ConvertToLinearLight.hlsl file which converts gamma light to linear light, you'll be in gamma light mode.
KhR0N1K
18th May 2015, 05:44
awesome work man was waiting for something like this for a long time. it looks amazing. i was testing the FineSharp and LumaSharpen through madVR but i like the way this one looks a lot better.
thanks :D
foxyshadis
18th May 2015, 10:04
Testing in MPDN, the image immediately becomes much darker. Is this expected? For some reason, the same thing happens with FineSharp.
Intel 4600, win8.1.
Testing in MPDN, the image immediately becomes much darker. Is this expected? For some reason, the same thing happens with FineSharp.
Intel 4600, win8.1.
works fine for me. even if work used as a pre resize shader.
KhR0N1K
18th May 2015, 10:16
Testing in MPDN, the image immediately becomes much darker. Is this expected? For some reason, the same thing happens with FineSharp.
Intel 4600, win8.1.
i noticed this happening when saving screens to compare using MPC-BE. but seemed fine when viewing in the player itself or using PrtScrn instead of Save Image. could be a completely different issue though.
RainyDog
20th May 2015, 12:50
Thanks for this bacondither. Tried it last night and liked what I saw.
I'd been using Lumasharpen pre and post resize with reduced clamp as I could never get it to my liking when used in post only. But I found Adaptive Sharpen to be much more effective post only so it might be just what I've been looking for.
Seemed much too aggressive when used as a pre resize sharpener though, but I suppose you mention that it has been tuned for post resize.
bacondither
11th June 2015, 03:47
Very good! :thanks:
awesome work man was waiting for something like this for a long time. it looks amazing. i was testing the FineSharp and LumaSharpen through madVR but i like the way this one looks a lot better.
thanks :D
Thanks for this bacondither. Tried it last night and liked what I saw.
I'd been using Lumasharpen pre and post resize with reduced clamp as I could never get it to my liking when used in post only. But I found Adaptive Sharpen to be much more effective post only so it might be just what I've been looking for.
Seemed much too aggressive when used as a pre resize sharpener though, but I suppose you mention that it has been tuned for post resize.
Thanks :)
Testing in MPDN, the image immediately becomes much darker. Is this expected? For some reason, the same thing happens with FineSharp.
Intel 4600, win8.1.
For me it works fine in MPDN.
Olivier C.
16th June 2015, 02:56
Hi,
Is there an equivalent of Masktools for GPU ?
Something like mt_merge (merge two layers according to a mask) for example ?
The actual formula is y = ((256 - m) * x1 + m * x2 + 128) / 256 ) where, for a given pixel :
y is the result (merge)
m is the mask value (from 0 to 255)
x1 is the first layer to merge
x2 is the second layer to merge
I am trying to port some avisynth scripts to shaders (GPU) but i am not an expert of .hlsl
Thanks
Olivier
vivan
16th June 2015, 03:42
It should work just like that, except everything is done in floating point ([0..1] range).
So
(1.0 - m) * x1 + m * x2 + 0.5
or it's equal
lerp (x1, x2, m) + 0.5
madshi
16th June 2015, 18:44
Some caution, though: I think AviSynth scripts usually run in YCbCr, so Y has a range from 16-235. In contrast to that, usually custom pixel shaders are executed in PC levels. So AviSynth 16 should map to floating point 0.0, and AviSynth 235 should map to floating point 1.0. Won't matter for some AviSynth scripts, but it will probably affect some.
Olivier C.
16th June 2015, 19:00
It should work just like that, except everything is done in floating point ([0..1] range).
So
(1.0 - m) * x1 + m * x2 + 0.5
or it's equal
lerp (x1, x2, m) + 0.5
Thanks vivan
Olivier C.
16th June 2015, 19:01
Some caution, though: I think AviSynth scripts usually run in YCbCr, so Y has a range from 16-235. In contrast to that, usually custom pixel shaders are executed in PC levels. So AviSynth 16 should map to floating point 0.0, and AviSynth 235 should map to floating point 1.0. Won't matter for some AviSynth scripts, but it will probably affect some.
Good point Mathias, thanks !
madshi
28th June 2015, 22:46
FYI, I've implemented this in the latest madVR build now, so users can directly play with it, instead of having to setup custom pixel shaders. Thanks for making this available under BSD license!
KhR0N1K
7th July 2015, 02:28
this may sound like a dumb question but do i have to have the options "don't use linear light for dithering" and "don't use linear light for smooth motion frame blending" in the madVR options under the "trade quality for performance" tab?
or do these not interfere with the gamma light for the Adaptive Sharpen shader?
also the same question for the "scale in linear light" options for upscaling and downscaling in madVR?
madshi
7th July 2015, 07:46
These options are totally unrelated to Adaptive Sharpen. The trade quality options should better be unchecked, unless you need them to be checked for performance reasons. For upscaling linear light is not recommended. For downscaling it's a matter of taste.
KhR0N1K
7th July 2015, 18:43
These options are totally unrelated to Adaptive Sharpen. The trade quality options should better be unchecked, unless you need them to be checked for performance reasons. For upscaling linear light is not recommended. For downscaling it's a matter of taste.
ok will do madshi. thanks a lot for the response. i will do what you said and leave them unchecked. and keep the scaling ones off as well.
foozoor
11th July 2015, 02:44
Could you make an opengl (glsl) version ?
It would be great for mpv-player users.
bacondither
16th July 2015, 16:28
Could you make an opengl (glsl) version ?
It would be great for mpv-player users.
I'm working on improving it now, perhaps in the future i will write a glsl version of it.
KhR0N1K
17th July 2015, 05:15
thanks for the experimentals man. i check back here everyday to see if there is improvements :). it is great already however lol.
Edit: the new experimental actually does look better btw. lol. amazing.
aufkrawall
18th July 2015, 20:25
Thanks for your efforts, bacondither. AdaptiveSharpen really looks fantastic post-resize with NNEDI3.
burfadel
24th July 2015, 22:29
Love this sharpening filter, it works wonders :). I'm using the experimental version. For anyone deciding to try it out, check back occasionally to the first post, as there may be a new experimental version.
KhR0N1K
29th July 2015, 21:30
Love this sharpening filter, it works wonders :). I'm using the experimental version. For anyone deciding to try it out, check back occasionally to the first post, as there may be a new experimental version.
exactly i check back every day lol
burfadel
11th August 2015, 11:24
I wonder if after a bit more tweaking whether it is found to be suitable to be added to MPDN as a sharpening option?
aufkrawall
11th August 2015, 14:19
You can already use it as a render script image processor and with conditionals, you can exactly define when to use it or not.
burfadel
11th August 2015, 15:48
I know, just thought it would be easier for people to set up and be aware of :)
aufkrawall
11th August 2015, 16:29
Yeah, true.
But dunno if this has priority, as SweetFX with Lumasharpen is already bundled with render scripts, but has to be used with image processor though.
bacondither
21st August 2015, 16:40
New version released! :) The previously experimental two pass version is now the stable one.
The experimental version section is removed and replaced with a old versions section.
Now i'm off out in the nice weather!
burfadel
21st August 2015, 20:01
Nice! I notice there is a very slight difference in the formula of the second pass between the 28 July version and the latest. Just thought I'd mention that since people may assume that you meant the 28 July version is the same when you said 'The previously experimental two pass version is now the stable one.'
Thanks, it works wonderfully! :)
KhR0N1K
22nd August 2015, 07:29
New version released! :) The previously experimental two pass version is now the stable one.
The experimental version section is removed and replaced with a old versions section.
Now i'm off out in the nice weather!
awesome man looks and works great thanks for all your hard work.
lanzorg
22nd August 2015, 07:51
I'm working on improving it now, perhaps in the future i will write a glsl version of it.
That would be really wonderful! :)
foozoor
23rd August 2015, 06:58
That would be really wonderful! :)
I hope he will hear our vow and that he will realise it. ;)
burfadel
14th September 2015, 19:21
Wow, missed there is a new September test build!
Thanks :)!
burfadel
23rd September 2015, 04:58
Download - EXPERIMENTAL - 2015-09-19 (https://u.teknik.io/k0pyMu.zip)
Thanks, as always :)!
bacondither
23rd September 2015, 19:31
New version 2015-09-23 released.
Tried optimizing some, it went faster for AMDs old VLIW gpus but slower for newer GCN. So that did not make it to this version.
The bilateral blur from the experimental version did better sometimes and worse other times. But the difference was so minimal and it was slower. So it's not included now.
aufkrawall
23rd September 2015, 19:38
Thanks for letting us know, interesting to read.
madshi
23rd September 2015, 20:00
@bacondither, can you double check AdaptiveSharpen with this test image?
http://madshi.net/FineSharpTest3.png
Last time I checked, AdaptiveSharpen makes this image brighter. Which is what most sharpeners do, so it's not surprising. But ideally, that should not happen. Maybe you can work on that? E.g. by using linear light in some parts of your algorithm? Or maybe by running a second pass which "repairs" modified brightness?
Thanks!
KhR0N1K
24th September 2015, 15:50
great work and progress bacon looking great and loving the constant upgrades
aufkrawall
29th September 2015, 17:09
@bacondither, can you double check AdaptiveSharpen with this test image?
http://madshi.net/FineSharpTest3.png
Last time I checked, AdaptiveSharpen makes this image brighter.
Yes, that's still the case with the current version. Would be great if this could be improved.
lanzorg
20th October 2015, 15:27
New version 2015-09-23 released.
Tried optimizing some, it went faster for AMDs old VLIW gpus but slower for newer GCN. So that did not make it to this version.
The bilateral blur from the experimental version did better sometimes and worse other times. But the difference was so minimal and it was slower. So it's not included now.
Could you port this version to glsl?
ts1
26th October 2015, 18:28
glsl version here (https://gist.github.com/bjin/e22e96861669e897cf65)
This shader also requires floating point processing apparently.
vood007
26th October 2015, 19:26
Here is glsl version of this shader:
Pass 1
...
This shader also requires floating point processing apparently.
Thanks for this. May i request a glsl version of the old one pass version too? Its linked in the first posting.
ts1
26th October 2015, 22:01
glsl version of Adaptive Sharpen (https://gist.github.com/igv/8a77e4eb8276753b54bb94c1c50c317e)
vood007
27th October 2015, 05:00
vood007
// Copyright (c) 2015, bacondither
// All rights reserved.
...
Thanks again. Works fine under Linux with MPV.
bacondither
29th October 2015, 15:33
@bacondither, can you double check AdaptiveSharpen with this test image?
http://madshi.net/FineSharpTest3.png
Last time I checked, AdaptiveSharpen makes this image brighter. Which is what most sharpeners do, so it's not surprising. But ideally, that should not happen. Maybe you can work on that? E.g. by using linear light in some parts of your algorithm? Or maybe by running a second pass which "repairs" modified brightness?
Thanks!
I agree that in some situations local contrast can be increased too much, but sometimes it should get brighter.
For example, if you blur the example image with a gaussian filter or a median filter it gets darker, "unblurring" it then should then make it look brighter.
But the original example image is pretty sharp already, increasing the local contrast/acutance a lot does not look that good in that example.
I have not found a satisfactory solution yet that does not compromise other situations. Sometime in the future i'm going to try testing a third "repair" pass.
I'm pretty sure i'll get some other ideas while in the shower or something... :)
glsl version here (https://gist.github.com/bjin/e22e96861669e897cf65)
This shader also requires floating point processing apparently.
Just had a quick look, i can't understand why is the inputs into tanh(x) is clamped to -+20. That could lead to some screwy results.
burfadel
29th October 2015, 15:38
oooh new test version, thanks :)
ts1
29th October 2015, 16:08
That is not my port but one of mpv's developers. We made ports in the same day :)
bacondither
29th October 2015, 16:23
That is not my port but one of mpv's developers. We made ports in the same day :)
Ah, okay.
I don't have MPV ready for testing now, but did some tests on it a while ago on ubuntu. Could not get some script for switching display frequencies to work as i wanted.
ts1
29th October 2015, 16:39
Windows builds (https://mpv.srsfckn.biz/) available also. Just create "portable_config" folder next to mpv.exe with your shaders and mpv.conf with content something like:
vo=opengl-hq:fbo-format=rgba16f:post-shaders="~~/adaptive-sharpen-pass1.glsl,~~/adaptive-sharpen-pass2.glsl"
madshi
29th October 2015, 17:31
For example, if you blur the example image with a gaussian filter or a median filter it gets darker
Does it, though, when doing the blurring in linear light? Which is how blurring should ideally be done.
bacondither
30th October 2015, 01:35
Does it, though, when doing the blurring in linear light? Which is how blurring should ideally be done.
Yes, forgot that my image editor did blurring in gamma light. Blurred it in linear light and the apparent brightness was then about the same as the original.
Did some tests and saw that doing the summation of the negative laplace vales in "fast" linear light did reduce the brightening effect.
Have not seen any negative effects of doing it that way yet.
Added it to the current experimental version.
Experimental - 2015-10-29 (https://u.teknik.io/qy20mv.zip)
madshi
30th October 2015, 03:19
Great, thanks - any progress is welcome! :)
One other thing that I've noticed when comparing FineSharp with AdaptiveSharpen: They have a quite different look. FineSharp somehow makes lines (at least dark lines) appear thinner, while AdaptiveSharpen seems to have a certain tendency to make dark lines fatter. Personally, I like the look of thinner lines. Is that something that could maybe be improved in AdaptiveSharpen?
aufkrawall
30th October 2015, 21:02
Added it to the current experimental version.
Experimental - 2015-10-29 (https://u.teknik.io/qy20mv.zip)
Amazing, image brightness pretty much doesn't increase and it still looks as good as usual otherwise. :eek:
Yes, line thickening is noticeable, especially with cartoons. This can look nice with low strength after soft scaling algorithms, but with higher strength it gets a bit too obvious.
jewshawn2
6th November 2015, 02:19
I can't seem to get any of the new 2 pass shaders to work with potplayer. However, the early single pass shader works fine.
I use the "Shader Stacker" but no matter what I do I end up with a green screen. But MPC-HC works perfectly fine.
I would much appreciate it if someone else can someone verify?
toniash
6th November 2015, 09:05
I can't seem to get any of the new 2 pass shaders to work with potplayer. However, the early single pass shader works fine.
I use the "Shader Stacker" but no matter what I do I end up with a green screen. But MPC-HC works perfectly fine.
I would much appreciate it if someone else can someone verify?
In "trade quality for performance" you must UNTICK:
store custom pixel shader in 16 bit ...
use 10bit chroma ...
use 10bit image ...
run custom pixel shaders in video levels ...
hope it helps
CruNcher
6th November 2015, 11:47
Not sure which version is used inside of MPC-BE currently but it does a great job at relatively low shader costs (~10% above the simpler ones) :)
Very impressive results even on rather complex textures but shimmering in high frequency skylines for example still seems to be a big problem at least in the version used inside of MPC-BE.
I use it as a very decent post resize pass solution, which works out for most different compressed MPEG content just great without oversharpen it to much that it feels odd :)
http://i2.sendpic.org/t/3o/3oTpr1c09evN2V1MOXGr3fjtgzi.jpg (http://sendpic.org/view/2/i/55YOJaWChqs3D0KhddFfZEcsXUS.png)http://i2.sendpic.org/t/jl/jlZrMEjPKEbu7nW7xSogt5DcDyH.jpg (http://sendpic.org/view/2/i/j275irS8d6x0ZJRLIaChyt7SFCj.png)http://i1.sendpic.org/t/ph/phnAbVgg8co6HZvj0JiqhKQyem1.jpg (http://sendpic.org/view/1/i/gAB6i4sTRsa8nsVUA03YzGxQY1E.png)
http://i1.sendpic.org/t/95/95kgfqSdffARoOB8FIdoI7qOnhN.jpg (http://sendpic.org/view/1/i/fg1FNBcoQ0RMWjShlUrMc8fbt9B.png)http://i1.sendpic.org/t/g8/g879123LMHEmFsi2oQDCVasEBrn.jpg (http://sendpic.org/view/1/i/2K9hM9OiEJm3t5ute2FXGJY456k.png)http://i2.sendpic.org/t/wO/wO6vOXUZk61HI3XUyU6temyzK3a.jpg (http://sendpic.org/view/2/i/lesT6jOkdWdxIz4k8hmE6G3eUci.png)
http://i1.sendpic.org/t/jY/jYhDRiiQvkE318QNrfnpNXhecuk.jpg (http://sendpic.org/view/1/i/1xnoy2RuMfIldutcu1KPNWu0Lwy.png)http://i1.sendpic.org/t/jx/jxtnRthm3Ob6Fu1k3VP09FCVHf8.jpg (http://sendpic.org/view/1/i/kjPKP0Cvc9vL5vAGCIut9EJmxwr.png)http://i2.sendpic.org/t/aF/aFivjJWFLatrylVIPGpHr0y9Hp9.jpg (http://sendpic.org/view/2/i/8MlbPHAfN3JplvfiK5hfJYlJZmE.png)
http://i2.sendpic.org/t/mw/mwJUh9jvmcRQI02GwidZYKDVBlO.jpg (http://sendpic.org/view/2/i/aRdDz1T4yik8sEUywXZleXvH6Hm.png)http://i2.sendpic.org/t/yq/yqXV82LwbSAWDovpF8MQJkAIS3J.jpg (http://sendpic.org/view/2/i/1BS3XxubBZQlL8vQbkEZjKkXWTq.png)http://i2.sendpic.org/t/u0/u0L7mZYXh8UICgLfgVJ4wythyXC.jpg (http://sendpic.org/view/2/i/9DzsxLo2f2T9FZQLQwXcG9H96aK.png)
bacondither
6th November 2015, 16:08
I can't seem to get any of the new 2 pass shaders to work with potplayer. However, the early single pass shader works fine.
I use the "Shader Stacker" but no matter what I do I end up with a green screen. But MPC-HC works perfectly fine.
If you use madvr as renderer you could also try unticking the "lose BTB and WTW if it improves performance"
Not sure which version is used inside of MPC-BE currently
I think it uses the old one-pass 2015-06-25 one.
I could backport some things to the old one pass version and make it better for a very small performance cost.
bacondither
6th November 2015, 16:13
The new 2015-11-05 experimental should be a little bit faster then the 2015-10-29 one. ~1% to 2%.
vood007
6th November 2015, 18:24
I could backport some things to the old one pass version and make it better for a very small performance cost.
This would be awesome! I still use the older 1-pass version because it allows me to stay at the lowest power-state of my GFX.
Popwax
6th November 2015, 21:26
I tried the GLSL port with MPV, but the result is looking weird, could anyone post a sample screenshot (before and after sharpening) of the HLSL shader, so that I can make a comparison?
bacondither
7th November 2015, 01:08
Some test images, used the 2015-11-05 shader with default settings.
Blurred test image (http://screenshotcomparison.com/comparison/149622)
AVS HD 709 - Blu-ray & MP4 Calibration, Sharpness & Overscan (http://screenshotcomparison.com/comparison/149624)
Ghost in the shell (http://screenshotcomparison.com/comparison/149626)
Popwax
7th November 2015, 11:41
Some test images, used the 2015-11-05 shader with default settings.
Blurred test image (http://screenshotcomparison.com/comparison/149622)
AVS HD 709 - Blu-ray & MP4 Calibration, Sharpness & Overscan (http://screenshotcomparison.com/comparison/149624)
Ghost in the shell (http://screenshotcomparison.com/comparison/149626)
The GLSL port doesn't produce the exact same sharpened image. It widen the edge sigificantly for the first test image, doesn't change anything visiblely for the second one. There are also slight differences for the third test image. Is this due to version different (GLSL port is based on 2015-09 I believe)I? What's the possible cause which can lead to widen edge in the first test image?
ts1
7th November 2015, 12:28
Here is mine comparison (this is without scaling):
http://screenshotcomparison.com/comparison/149655
Popwax
7th November 2015, 13:20
Here is mine comparison (this is without scaling):
http://screenshotcomparison.com/comparison/149655
Actually what I want to compare are the sharpened images of GLSL and HLSL shader, since I notice distortion of the GLSL shader for noisy images.
bacondither: Could you post more test images for video with heavy film grains?
ts1
7th November 2015, 14:04
Yeah, output result is different. MPC-HC vs MPV:
http://screenshotcomparison.com/comparison/149670
ts1
7th November 2015, 15:05
This is only with opengl-hq preset (sigmoid-upscaling in particular). With opengl result is identical.
vood007
7th November 2015, 15:31
There is some sort of overshot in the glsl (one-pass) version. Upper is HLSL, lower GLSL.
http://thumbnails113.imagebam.com/44542/5d2888445416062.jpg (http://www.imagebam.com/image/5d2888445416062)
ts1
7th November 2015, 15:41
vood007
Try updated glsl 1 pass shader.
vood007
7th November 2015, 16:19
vood007
Try updated glsl 1 pass shader.
Yep looks fine now, thanks!
Popwax
7th November 2015, 17:59
This is only with opengl-hq preset (sigmoid-upscaling in particular). With opengl result is identical.
Oh, that make sense. With "sigmoid-upscaling" option the shader is applied on linear RGB, but the original shader explicitly stated to require gamma light.
EDIT: I can confirm that with "sigmoid-upscaling" disabled, the GLSL shader can produce exactly same sharpened image.
XMonarchY
13th November 2015, 23:37
Is there any chance the latest experimental AdaptiveSharpen (11/5/2015) will get an update soon to work properly with DirectX 11? I mainly use AdaptiveSharpen in games through ReShade and right now it says that this latest AdaptiveSharpen does not work as intended in DirectX 11. Does it create some odd artifacts in DirectX 11 or slow down performance too much?
bacondither
14th November 2015, 00:40
Is there any chance the latest experimental AdaptiveSharpen (11/5/2015) will get an update soon to work properly with DirectX 11? I mainly use AdaptiveSharpen in games through ReShade and right now it says that this latest AdaptiveSharpen does not work as intended in DirectX 11. Does it create some odd artifacts in DirectX 11 or slow down performance too much?
Hmm.... does it complain about "warning X3081: potentially unintended use of a comma expression in a variable initializer"?
If so, i have already fixed it. It did not result in any errors just the compiler complaining.
CruNcher
15th November 2015, 14:13
if i look @ the GPU usage even that small amount 10% hit is huge for games resources.
JPulowski
15th November 2015, 19:28
Hmm.... does it complain about "warning X3081: potentially unintended use of a comma expression in a variable initializer"?
If so, i have already fixed it. It did not result in any errors just the compiler complaining.No, the compiler does not give any errors. In DX11, white dot artifacts occur around very thin or very bright surfaces (e.g. stars in the sky, in-game text etc.). Will upload a screenshot when I am available. Not sure what is the problem exactly, ReShade's transcompiler might be the culprit but I don't think that is the case unless there are very tricky shader model specific instructions. Lowering the strength of the shader removes some of the artifacts, but it doesn't make any sense since in DX9 the shader works as it should.
Edit: Here it is, notice the black dots around text and stars:
https://i.imgur.com/9lmTylj.png
bacondither
18th November 2015, 19:28
No, the compiler does not give any errors. In DX11, white dot artifacts occur around very thin or very bright surfaces (e.g. stars in the sky, in-game text etc.). Will upload a screenshot when I am available. Not sure what is the problem exactly, ReShade's transcompiler might be the culprit but I don't think that is the case unless there are very tricky shader model specific instructions. Lowering the strength of the shader removes some of the artifacts, but it doesn't make any sense since in DX9 the shader works as it should.
Tested reshade with adaptive sharpen on some dx11 samples.
Found that the problem was with the tanh function that overflowed and resulted in a NaN in dx11 and a 0 in dx9.
It was not really visible in dx9 because it would return 0 when often it should be limited to a very small value near 0.
Modified the AdaptiveSharpen.h so it should work fine now.
Fixed AdaptiveSharpen.h (https://u.teknik.io/r2ASRR.zip)
bacondither
18th November 2015, 19:36
New stable version 2015-11-17 and experimental version 2015-11-17-E.
JPulowski
19th November 2015, 07:33
Tested reshade with adaptive sharpen on some dx11 samples.
Found that the problem was with the tanh function that overflowed and resulted in a NaN in dx11 and a 0 in dx9.
It was not really visible in dx9 because it would return 0 when often it should be limited to a very small value near 0.
Modified the AdaptiveSharpen.h so it should work fine now.
Fixed AdaptiveSharpen.h (https://u.teknik.io/r2ASRR.zip)Thanks, I have also uploaded the fix to ReShade's repository.
Would you mind telling me which part of the code have you modified? Or did you completely fix it, so there is no need to apply a hotfix after the code has been ported?
bacondither
19th November 2015, 11:19
Thanks, I have also uploaded the fix to ReShade's repository.
Would you mind telling me which part of the code have you modified? Or did you completely fix it, so there is no need to apply a hotfix after the code has been ported?
Updated everything to version 2015-11-17. The code that fixed the overflow can be found at line 61 and 243-244 in the new AdaptiveSharpen.h.
Diff for AdaptiveSharpen.h (https://www.diffchecker.com/q9m0ezvb)
aufkrawall
19th November 2015, 20:39
I should have looked at the image in unscaled size to judge brightness, sorry.
Don't want to sound like a broken record, but maybe you could still do something regarding brightness?
It still gets noticeably brighter with a strength of 0.5.
off:
http://abload.de/thumb/offeak8l.png (http://abload.de/image.php?img=offeak8l.png)
0.5:
http://abload.de/thumb/0.5n8k5p.png (http://abload.de/image.php?img=0.5n8k5p.png)
bacondither
7th December 2015, 08:54
Don't want to sound like a broken record, but maybe you could still do something regarding brightness?
Tuning it to one scenario would make it pretty crappy in other places, i have currently no idea to "solve" it with an algorithm that would work in shaders or be fast.
But the latest version 2015-12-04-E should be somewhat better at fine details in most cases. Uploaded a comparison of 2015-11-17E and 2015-12-04E (http://screenshotcomparison.com/comparison/153261) with all settings at default.
I also experimented some with sharpening that test image in raw therapee with RL deconvolution, that made the image alot more brighter!
aufkrawall
7th December 2015, 14:12
This is a very nice progress, thanks a lot!
I think this can be very helpful in games, e.g. when strong sharpen is needed to fight temporal AA blur. May be a bit expensive in realtime, but should be great for screenshots.
JPulowski
9th December 2015, 17:47
In games, AdaptiveSharpen requires quite a bit of performance. In my GPU it utilizes 15 - 20% of extra computing power. In movies where the framerate is between 23.976 - 30.0 fps, the performance drop does not make a huge difference. But in recent video games, every bit of performance is important. bacondither, do you have any ideas about possible optimizations? Currently the shader uses an additional RGBA16F texture for storing the alpha value of the first pass. This is a bit too much just for one floating point value. I might use R16F or encode the value as RGBA8 and decode it in the second pass afterwards, depending on which method is faster. Other than that, it is now my favorite shader for sharpening. It really goes well with the video games.
We also have a GitHub repo (https://github.com/crosire/reshade-shaders). You are welcome to modify the code as you see fit. :)
ts1
12th December 2015, 11:17
I've ported some things from 2-pass shaders.
Edit: fixed a bug
foozoor
13th December 2015, 20:50
I've ported some things from 2-pass shaders.
Edit: fixed a bug
Where can we download it? Can I use it in mpv?
Thanks I love this sharpener but I think 1.0 is too much as default value.
Edit: I found it inside the mpv wiki... :rolleyes:
https://gist.github.com/bjin/152a2f8bdf87d83261ac
ts1
14th December 2015, 14:47
foozoor
1-pass version is not so strong, try it, it's on a 3rd page.
foozoor
17th December 2015, 22:23
foozoor
1-pass version is not so strong, try it, it's on a 3rd page.
Thank you, really nice. :)
Is there something between lumasharpen and adaptive sharpen for mpv?
Because my gpu can‘t handle adaptive sharpen with some video files.
Could you port finesharp or lsfmod as mpv shader?
ts1
17th December 2015, 23:00
Sorry, but no.
Use it as prescale then maybe.
lanzorg
17th December 2015, 23:10
foozoor
1-pass version is not so strong, try it, it's on a 3rd page.
Should I turn `linear-scaling` and `sigmoid-upscaling` off like the 2-passes shader?
ts1
17th December 2015, 23:14
lanzorg
Yes
bacondither
18th December 2015, 11:54
Do you have any ideas about possible optimizations?
Sure, did a pull request on reshade-shaders now. Up to 45% speedup on rendering times for the shader (3.2ms to 2.2ms) at 1080p on my 7790. :p
aufkrawall
19th December 2015, 14:24
With a 980, I can note a gain. However, it's not large.
No ReShade shaders: 96fps
AS old: 81fps
AS new: 83fps
bacondither
19th December 2015, 14:41
With a 980, I can note a gain. However, it's not large.
At least that's 18% faster rendering times for the shader.
Did you have have "fast_ops = 1" in JPulowski.cfg?
I did my test on a DX11 target application.
aufkrawall
19th December 2015, 15:08
Yep, had it at 1 and tested DX11.
With a higher resolution, the results don't get wider:
42 vs 41 fps :)
ts1
19th December 2015, 20:21
I've made my port compatible with linear-scaling/sigmoid-upscaling. Also much less distortions now (if any).
lanzorg
22nd December 2015, 03:37
I've made my port compatible with linear-scaling/sigmoid-upscaling. Also much less distortions now (if any).
Thanks! :D
darkasylum666
28th December 2015, 06:11
// Copyright (c) 2015, bacondither
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer
// in this position and unchanged.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Adaptive sharpen - version 2015-06-25 - (requires ps >= 3.0)
// Tuned for use post resize, EXPECTS FULL RANGE GAMMA LIGHT
#pragma optionNV (unroll all)
#define curve_height 1.0 // Main sharpening strength, POSITIVE VALUE ONLY!
// 0.3 <-> 1.5 is a reasonable range of values
#define video_level_out false // True to preserve BTB & WTW (minor summation error)
// Normally it should be set to false
// Defined values under this row are "optimal" DO NOT CHANGE IF YOU DO NOT KNOW WHAT YOU ARE DOING!
#define curveslope (curve_height*0.7) // Sharpening curve slope, edge region
#define D_overshoot 0.001 // Max dark overshoot before max compression
#define D_comp_ratio 0.250 // Max compression ratio, dark overshoot (1/0.25=4x)
#define L_overshoot 0.003 // Max light overshoot before max compression
#define L_comp_ratio 0.167 // Max compression ratio, light overshoot (1/0.167=6x)
#define max_scale_lim 0.1 // Abs change before max compression (1/10=±10%)
// Saturation loss reduction
#define minim_satloss ( (c[0].rgb*(CtL(c[0].rgb + sharpdiff)/c0_Y) + (c[0].rgb + sharpdiff))/2 )
// Soft limit
#define soft_lim(v,s) ( ((exp(2*min(abs(v), s*16)/s) - 1)/(exp(2*min(abs(v), s*16)/s) + 1))*s )
// Get destination pixel values
#define get(x,y) ( texture(tex, pos + vec2(x*px, y*py)) )
#define sat(input) ( vec3(clamp((input).xyz, 0.0, 1.0) ) )
// Colour to luma
#define CtL(RGB) ( pow(dot(vec3(0.256, 0.651, 0.093), clamp((RGB).rgb, 0.0, 1.0)), 1.2) )
// Center pixel diff
#define mdiff(a,b,c,d,e,f,g) ( abs(luma[g]-luma[a]) + abs(luma[g]-luma[b]) \
+ abs(luma[g]-luma[c]) + abs(luma[g]-luma[d]) \
+ 0.5*(abs(luma[g]-luma[e]) + abs(luma[g]-luma[f])) )
vec4 sample(sampler2D tex, vec2 pos, vec2 tex_size) {
// Pixel "width"
float px = 1.0 / tex_size[0];
float py = 1.0 / tex_size[1];
vec4 orig = texture(tex, pos);
// Get points and saturate out of range values (BTB & WTW)
// [ c22 ]
// [ c24, c9, c23 ]
// [ c21, c1, c2, c3, c18 ]
// [ c19, c10, c4, c0, c5, c11, c16 ]
// [ c20, c6, c7, c8, c17 ]
// [ c15, c12, c14 ]
// [ c13 ]
vec3 c[25] = vec3[](sat( orig), get(-1,-1), get( 0,-1), get( 1,-1), get(-1, 0),
get( 1, 0), get(-1, 1), get( 0, 1), get( 1, 1), get( 0,-2),
get(-2, 0), get( 2, 0), get( 0, 2), get( 0, 3), get( 1, 2),
get(-1, 2), get( 3, 0), get( 2, 1), get( 2,-1), get(-3, 0),
get(-2, 1), get(-2,-1), get( 0,-3), get( 1,-2), get(-1,-2));
// Blur, gauss 3x3
vec3 blur = (2*(c[2]+c[4]+c[5]+c[7]) + (c[1]+c[3]+c[6]+c[8]) + 4*c[0])/16;
float blur_Y = (blur.r*(1.0/3.0) + blur.g*(1.0/3.0) + blur.b*(1.0/3.0));
// Contrast compression, center = 0.5, scaled to 1/3
float c_comp = clamp(0.266666681f + 0.9*pow(2, (-7.4*blur_Y)), 0.0, 1.0);
// Edge detection
// Matrix, relative weights
// [ 1 ]
// [ 4, 4, 4 ]
// [ 1, 4, 4, 4, 1 ]
// [ 4, 4, 4 ]
// [ 1 ]
float edge = length( abs(blur-c[0]) + abs(blur-c[1]) + abs(blur-c[2]) + abs(blur-c[3])
+ abs(blur-c[4]) + abs(blur-c[5]) + abs(blur-c[6]) + abs(blur-c[7]) + abs(blur-c[8])
+ 0.25*(abs(blur-c[9]) + abs(blur-c[10]) + abs(blur-c[11]) + abs(blur-c[12])) );
// Edge detect contrast compression, center = 0.5
edge *= c_comp;
// RGB to luma
float c0_Y = CtL(c[0]);
float luma[25] = float[](c0_Y, CtL(c[1]), CtL(c[2]), CtL(c[3]), CtL(c[4]), CtL(c[5]), CtL(c[6]),
CtL(c[7]), CtL(c[8]), CtL(c[9]), CtL(c[10]), CtL(c[11]), CtL(c[12]),
CtL(c[13]), CtL(c[14]), CtL(c[15]), CtL(c[16]), CtL(c[17]), CtL(c[18]),
CtL(c[19]), CtL(c[20]), CtL(c[21]), CtL(c[22]), CtL(c[23]), CtL(c[24]));
// Precalculated default squared kernel weights
vec3 w1 = vec3(0.5, 1.0, 1.41421356237); // 0.25, 1.0, 2.0
vec3 w2 = vec3(0.86602540378, 1.0, 0.5477225575); // 0.75, 1.0, 0.3
// Transition to a smaller sharpening kernel if the center edge val is above thr
vec3 dW = pow(mix( w1, w2, smoothstep( 0.3, 0.6, edge)), vec3(2.0));
// Partial laplacian outer pixel weighting
float mdiff_c0 = 0.02 + 3*( abs(luma[0]-luma[2]) + abs(luma[0]-luma[4])
+ abs(luma[0]-luma[5]) + abs(luma[0]-luma[7])
+ 0.25*(abs(luma[0]-luma[1]) + abs(luma[0]-luma[3])
+abs(luma[0]-luma[6]) + abs(luma[0]-luma[8])) );
float weights[12] = float[]( ( dW.x ), ( dW.x ), ( dW.x ), ( dW.x ), // c2, // c4, // c5, // c7
( min(mdiff_c0/mdiff(24, 21, 2, 4, 9, 10, 1), dW.y) ), // c1
( min(mdiff_c0/mdiff(23, 18, 5, 2, 9, 11, 3), dW.y) ), // c3
( min(mdiff_c0/mdiff(4, 20, 15, 7, 10, 12, 6), dW.y) ), // c6
( min(mdiff_c0/mdiff(5, 7, 17, 14, 12, 11, 8), dW.y) ), // c8
( min(mdiff_c0/mdiff(2, 24, 23, 22, 1, 3, 9), dW.z) ), // c9
( min(mdiff_c0/mdiff(20, 19, 21, 4, 1, 6, 10), dW.z) ), // c10
( min(mdiff_c0/mdiff(17, 5, 18, 16, 3, 8, 11), dW.z) ), // c11
( min(mdiff_c0/mdiff(13, 15, 7, 14, 6, 8, 12), dW.z) ) ); // c12
weights[4] = (max(max((weights[8] + weights[9])/4, weights[4]), 0.25) + weights[4])/2;
weights[5] = (max(max((weights[8] + weights[10])/4, weights[5]), 0.25) + weights[5])/2;
weights[6] = (max(max((weights[9] + weights[11])/4, weights[6]), 0.25) + weights[6])/2;
weights[7] = (max(max((weights[10] + weights[11])/4, weights[7]), 0.25) + weights[7])/2;
// Calculate the negative part of the laplace kernel
float weightsum = 0;
float neg_laplace = 0;
int order[12] = int[]( 2, 4, 5, 7, 1, 3, 6, 8, 9, 10, 11, 12 );
for (int pix = 0; pix < 12; ++pix)
{
neg_laplace += luma[order[pix]] *(weights[pix]);
weightsum += weights[pix];
}
// Compute sharpening magnitude function, x = edge mag, y = laplace operator mag
float sharpen_val = 0.01 + (curve_height/(curveslope*pow(edge, 3.5) + 0.5))
- (curve_height/(8192*pow((edge*2.4), 4.5) + 0.5));
// Calculate sharpening diff and scale
float sharpdiff = (c0_Y - (neg_laplace/weightsum))*(sharpen_val*0.8);
// Calculate local near min & max, partial cocktail sort (No branching!)
for (int i = 0; i < 3; ++i)
{
for (int i1 = 1+i; i1 < 25-i; ++i1)
{
float temp = luma[i1-1];
luma[i1-1] = min(luma[i1-1], luma[i1]);
luma[i1] = max(temp, luma[i1]);
}
for (int i2 = 23-i; i2 > i; --i2)
{
float temp = luma[i2-1];
luma[i2-1] = min(luma[i2-1], luma[i2]);
luma[i2] = max(temp, luma[i2]);
}
}
float nmax = max(((luma[22] + luma[23]*2 + luma[24])/4), c0_Y);
float nmin = min(((luma[0] + luma[1]*2 + luma[2])/4), c0_Y);
// Calculate tanh scale factor, pos/neg
float nmax_scale = min(((nmax - c0_Y) + L_overshoot), max_scale_lim);
float nmin_scale = min(((c0_Y - nmin) + D_overshoot), max_scale_lim);
// Soft limit sharpening with tanh, lerp to control maximum compression
sharpdiff = mix( (soft_lim(max(sharpdiff, 0), nmax_scale)), max(sharpdiff, 0), L_comp_ratio )
+ mix( -(soft_lim(min(sharpdiff, 0), nmin_scale)), min(sharpdiff, 0), D_comp_ratio );
if (video_level_out == true)
{
if (sharpdiff > 0) { return vec4( orig.rgb + (minim_satloss - c[0].rgb), 1.0 ); }
else { return vec4( (orig.rgb + sharpdiff), 1.0 ); }
}
// Normal path
if (sharpdiff > 0) { return vec4( minim_satloss, 1.0 ); }
else { return vec4( (c[0].rgb + sharpdiff), 1.0 ); }
}
how to convert this to hlsl as 2 pass filter doesn't work for me on mpc.
BRM
6th January 2016, 16:56
I've made my port compatible with linear-scaling/sigmoid-upscaling. Also much less distortions now (if any).
Both turned off, mpv spits this out whenever I run it with the 1-pass filter in page 3 (2-pass gist version is unusable now for some reason, slows everything down to a crawl and is overly intense).
[vo/opengl] fragment shader compile log (status=0):
[vo/opengl] 0:96(15): error: type error in array constructor: expected: vec3, found vec4
[vo/opengl]
[vo/opengl] shader link log (status=0): error: linking with uncompiled shader
[vo/opengl] after rendering: OpenGL error INVALID_OPERATION.
[vo/opengl] after rendering: OpenGL error INVALID_OPERATION.
[fpsadjust] Setting speed to 1
AV: 00:00:00 / 00:06:29 (0%) A-V: 0.022 DS: 2.500/0 Cache: 9s+30MB
[vo/opengl] after rendering: OpenGL error INVALID_OPERATION.
[vo/opengl] after rendering: OpenGL error INVALID_OPERATION.
[vo/opengl] after rendering: OpenGL error INVALID_OPERATION.
[vo/opengl] after rendering: OpenGL error INVALID_OPERATION.
AV: 00:00:00 / 00:06:29 (0%) A-V: 0.006 DS: 2.250/0 Cache: 9s+40MB
[vo/opengl] after creating framebuffer texture: OpenGL error INVALID_OPERATION.
AV: 00:00:00 / 00:06:29 (0%) A-V: 0.005 DS: 2.200/0 Cache: 9s+47MB
[vo/opengl] after creating framebuffer texture: OpenGL error INVALID_OPERATION.
AV: 00:00:00 / 00:06:29 (0%) A-V: 0.005 DS: 2.167/0 Cache: 9s+53MB
[vo/opengl] after creating framebuffer texture: OpenGL error INVALID_OPERATION.
AV: 00:00:00 / 00:06:29 (0%) A-V: 0.003 DS: 2.286/0 Cache: 9s+58MB
[vo/opengl] after creating framebuffer texture: OpenGL error INVALID_OPERATION.
AV: 00:00:00 / 00:06:29 (0%) A-V: 0.001 DS: 2.250/0 Cache: 9s+67MB
[vo/opengl] after creating framebuffer texture: OpenGL error INVALID_OPERATION.
AV: 00:00:02 / 00:06:29 (0%) A-V: -0.005 DS: 2.389/0 Cache: 9s+302MB
ts1
6th January 2016, 18:22
Post whole log.
Try updated.
BRM
8th January 2016, 22:16
Post whole log.
Try updated.
Too strong and slows down video playback a LOT (literally cannot run at more than 3fps, using a gigabyte 280x with the radeon git driver).
The rest of the log contained the shader and that's it.
ts1
8th January 2016, 22:34
It's a pretty lightweight shader. Something wrong with your GPU drivers/setup. I tried it on Linux and it works fine with proprietary nVidia drivers, but with nouveau it's also not usable, very slow.
There is parameter to control sharpening strength.
BRM
9th January 2016, 10:23
It's a pretty lightweight shader. Something wrong with your GPU drivers/setup. I tried it on Linux and it works fine with proprietary nVidia drivers, but with nouveau it's also not usable, very slow.
There is parameter to control sharpening strength.
I know, I get similar results with the 2-pass shader.
As for my setup, it's radeon-git, xorg.conf and xorg.conf.d/20-radeon.conf are as follows: http://pastebin.com/raw/aE3e21Bn
Section "Device"
Identifier "radeonVGA"
Driver "radeon"
Option "AccelMethod" "Glamor" # See compatibility on features page
Option "DRI3" "on" # Compatibility not very well documented, remove it if it fails
Option "EnablePageFlip" "On"
EndSection
ts1
9th January 2016, 11:02
Can't help you with this, I never used Radeon and I use Linux (Sabayon, Gentoo based) from flash drive, it already includes proprietary drivers and mpv.
XMonarchY
13th January 2016, 23:01
How would I go about integrating your latest version downloads into ReShade? ReShade uses either .fx files or .h files. I assume I can just rename TWO-PASS .hlsl file to .h or .fx file because the content is identical, isn't it? When I open the file with WordPad, it shows identical info. I assume ReShade uses the TWO-PASS file because ATM it uses a 12KB file, which is closer to TWO-PASS 11KB then to ONE-PASS 4KB file.
aufkrawall
14th January 2016, 01:42
You have to port the HLSL shader to ReShade shading language.
bacondither or JPulowski will do it soon:
https://github.com/crosire/reshade-shaders/issues/8
BRM
19th January 2016, 18:41
Can't help you with this, I never used Radeon and I use Linux (Sabayon, Gentoo based) from flash drive, it already includes proprietary drivers and mpv.
New 1 pass shader causes a segfault.
LLVM triggered Diagnostic Handler: SIInstrInfo::storeRegToStackSlot - Can't spill VGPR!
[1] 9181 segmentation fault mpv https://www.youtube.com/watch\?v\=yqynPcFEL3U
ts1
19th January 2016, 19:47
Are you sure this is shader's fault? Is there any errors from a shader compiler?
I will test it with mesa later.
Edit: works with mesa, slow but without errors.
LLVM triggered Diagnostic Handler: SIInstrInfo::storeRegToStackSlot - Can't spill VGPR!
Seems like it's a LLVM's bug https://bugs.freedesktop.org/show_bug.cgi?id=75276#c50. Do you use latest LLVM 3.7?
BRM
27th January 2016, 01:18
Seems like it's a LLVM's bug https://bugs.freedesktop.org/show_bug.cgi?id=75276#c50. Do you use latest LLVM 3.7?
Yes, that one is super slow but works, and you were right, it was caused by using LLVM 3.5.
ts1
2nd February 2016, 15:40
nevermind
ts1
16th February 2016, 14:27
bacondither
I removed my previous comment, but there is still a problem in minim_satloss, there are cases when c0_Y==0.
Ok, this is only in glsl so.
foozoor
16th February 2016, 23:10
Thanks for the update ts1. ;)
XMonarchY
9th March 2016, 04:02
Could someone provide some images that compare LumaSharpen, AdaptiveSharpen, FineSharp, and or Crispen Edges using similar settings?
I usually apply a little bit of AdaptiveSharpen (0.1-0.15) and a little bit of LumaSharpen (0.50 - strength, 0.030 - clamp) in films and games, but I'd like to reduce ringing, noise, artifacts, overshoot, and other side-effects. What should I be using them - both AdaptiveSharpen and LumaSharpen OR just one of them? Which one?
bacondither
12th July 2016, 18:54
New version released! :cool:
bacondither
I removed my previous comment, but there is still a problem in minim_satloss, there are cases when c0_Y==0.
Ok, this is only in glsl so.
That's strange, i have done a glsl port of my own for testing so i could poke around with it in mpv a bit.
toniash
12th July 2016, 21:50
A guy (igv) ported and improved this shader for the mpv hook system:
https://gist.github.com/igv/8a77e4eb8276753b54bb94c1c50c317e
I don't really know what he improved but it looks amazingly on my sister's laptop with a weak intel hd3000 iGPU. The two-passes version is too intensive!
(From Madvr thread)
bob88
8th December 2016, 12:27
Hello,
I'm using latest version MPC-HC x64 1.7.10
I added the shaders in post-resize in the described order but I still get a green screen.
Could somebody please tell me how to fix it?
Thank you!
bacondither
8th December 2016, 14:08
Could somebody please tell me how to fix it?
Thank you!
If you are using madVR as video renderer untick "lose BTB and WTW if it improves performance" and "run custom pixel shaders in video levels instead of PC levels".
The settings can be found in madVR settings, rendering->trade quality for performance.
bob88
8th December 2016, 15:12
I am using the default 'enhanced video renderer (custom presenter)'
madVR is listed as unavailable, I guess it has to be installed additionally. Should I be using that? Is it better?
bacondither
8th December 2016, 15:30
Ok you are using EVR.
Go to View-> Renderer Settings -> Presentation and enable "Full floating point point processing" or "Half floating point point processing", then restart MPC-HC.
Hmm i should probably add this to the installation instructions.
BetA13
8th December 2016, 18:48
Ok you are using EVR.
Go to View-> Renderer Settings -> Presentation and enable "Full floating point point processing" or "Half floating point point processing", then restart MPC-HC.
Hmm i should probably add this to the installation instructions.
ha, and i was wondering why it didnt work in my normal MPCHC test player but did work with madvr etc..
Thanks for the tip with the "Full floating point point processing"
Just wondering, what does this function do anyway?
"Full floating point point processing", "Half floating point point processing"
Have a nice evening bacondither and thanks for teh lesson haha..
bob88
8th December 2016, 19:28
Ok you are using EVR.
Go to View-> Renderer Settings -> Presentation and enable "Full floating point point processing" or "Half floating point point processing", then restart MPC-HC.
Hmm i should probably add this to the installation instructions.
Enabling full or half floating point processing just results in completely black screen regardless of shaders.
shaolin95
25th December 2016, 04:49
A guy (igv) ported and improved this shader for the mpv hook system:
https://gist.github.com/igv/8a77e4eb8276753b54bb94c1c50c317e
I don't really know what he improved but it looks amazingly on my sister's laptop with a weak intel hd3000 iGPU. The two-passes version is too intensive!
(From Madvr thread)
Where do you place this file to work with mpv (SMPlayer)? I have been using it with MPC-HC but wanted to try mpv as it seems to be better for SVP.
Thanks
toniash
25th December 2016, 08:56
Where do you place this file to work with mpv (SMPlayer)? I have been using it with MPC-HC but wanted to try mpv as it seems to be better for SVP.
Thanks
vo=opengl-hq:backend=angle:scale=ewa_lanczossharp:cscale=ewa_lanczossoft:interpolation:tscale=mitchell:tscale-clamp:temporal-dither:user-shaders="~~/shaders/adaptive-sharpen.glsl"
shaolin95
25th December 2016, 17:20
vo=opengl-hq:backend=angle:scale=ewa_lanczossharp:cscale=ewa_lanczossoft:interpolation:tscale=mitchell:tscale-clamp:temporal-dither:user-shaders="~~/shaders/adaptive-sharpen.glsl"
Sorry for the dumb question but is my first time using mpv.
Will I add in the same section I add this line for SVP "--input-ipc-server=mpvpipe" as shown on this guide?
https://www.svp-team.com/wiki/SVP:SMPlayer
toniash
27th December 2016, 18:21
Sorry for the dumb question but is my first time using mpv.
Will I add in the same section I add this line for SVP "--input-ipc-server=mpvpipe" as shown on this guide?
https://www.svp-team.com/wiki/SVP:SMPlayer
yes:):)
shaolin95
27th December 2016, 18:32
yes:):)
I must be doing something wrong cause I just get an error. I was dropping the script file in the root directory of the mpv64 folder (inside of the SVP folder).
Is that what I am doing wrong? :)
toniash
27th December 2016, 20:00
I must be doing something wrong cause I just get an error. I was dropping the script file in the root directory of the mpv64 folder (inside of the SVP folder).
Is that what I am doing wrong? :)
Then I think you need "user-shaders="~~/adaptive-sharpen.glsl"
Good luck!
toniash
30th December 2016, 09:08
Then I think you need "user-shaders="~~/adaptive-sharpen.glsl"
Good luck!
Did it work?:confused:
shaolin95
30th December 2016, 14:47
Did it work?:confused:
I didn't get an error but I do not see any effect on the screen so is not working :(
Thanks though, I just didn't want to keep bugging you. :)
toniash
30th December 2016, 15:51
I didn't get an error but I do not see any effect on the screen so is not working :(
Thanks though, I just didn't want to keep bugging you. :)
#define curve_height .96
// Main sharpening strength, POSITIVE VALUE ONLY! // 0.3 <-> 1.5 is a reasonable range of values
what value do you use?
shaolin95
30th December 2016, 16:29
#define curve_height .96
// Main sharpening strength, POSITIVE VALUE ONLY! // 0.3 <-> 1.5 is a reasonable range of values
what value do you use?
I didn't change it at all just let the script untouched. I'm just not sure I'm putting the file in the right folder maybe.
I will take some screenshots of my config and post.
Thanks!
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.