Log in

View Full Version : CAS - Contrast Adaptive Sharpening


HolyWu
19th June 2020, 14:48
https://github.com/HomeOfVapourSynthEvolution/VapourSynth-CAS

ChaosKing
19th June 2020, 16:50
:thanks:

Is it a new implementation of CAS?

Seems very fast but also happily sharpens artifacts :)

HolyWu
20th June 2020, 01:11
Is it a new implementation of CAS?

Seems very fast but also happily sharpens artifacts :)

I think the implementation is kinda the same as the official one. What's your parameter and the result? It should look ok for small sharpness value.

ChaosKing
20th June 2020, 11:37
I used higher values sharpen=0.8 / 1.0
I like the sharpness. Even with high values it produces only minimal oversharpening effects.

CAS(0.8)
https://i.imgur.com/lfXctDT.jpg

Look at the hair ( Don't use zoom in your Browser. Set it to 100% )
https://i.imgur.com/SeVnPSE.jpg

p.s. I saw on github that you're adding cas to LSFmod. Will test it later.

Boulder
25th June 2020, 08:23
This looks quite interesting indeed :) Would it be possible to have an Avisynth+ version as well?

masterkivat
30th June 2020, 13:40
I really liked this filter, the tests I made gave pretty good results, thank you for this, HolyWu! :thanks::D

HolyWu
5th July 2020, 15:20
Update r2:

Default to process only luma plane for non-RGB formats.
Change default sharpness to 0.5.

ChaosKing
5th August 2020, 14:16
This looks quite interesting indeed :) Would it be possible to have an Avisynth+ version as well?

Avisynth port is rdy https://github.com/Asd-g/AviSynth-CAS

Boulder
5th August 2020, 15:02
Avisynth port is rdy https://github.com/Asd-g/AviSynth-CAS

Thanks for the heads up :)

And also a big thank you to HolyWu for the original version :thanks:

feisty2
5th August 2020, 15:03
you could also make arbitrary filtering contrast adaptive, your own custom sharpening kernels or some other filters, it's basically

# assume clp is an fp32 clip
clpmax = core.std.Maximum(clp)
clpmin = core.std.Minimum(clp)
contrast = core.std.Expr([clpmax, clpmin], "x y - {eps} +".format(eps=1e-8)) # avoid division by zero

flt = core.xxx.Filter(clp) # some filtering here

adaptive_dif = core.std.Expr([flt, clp, contrast], "x y - z / {strength} *".format(strength=0.05))
clp = core.std.MergeDiff(clp, adaptive_dif)


it's not the exact same algorithm but you get the main idea

EDIT:
this one is closer to the original algorithm, its still not the exact same tho.

# assume clp is an fp32 clip
clpmax = core.std.Maximum(clp)
clpmin = core.std.Minimum(clp)
maxneg = core.std.Expr(clpmax, "1 x -")
clpmin = core.std.Expr([clpmin, maxneg], "x y min")
contrast = core.std.Expr([clpmin, clpmax], "x y / 0 max 1 min sqrt")

flt = core.xxx.Filter(clp) # some filtering here

adaptive_dif = core.std.Expr([flt, clp, contrast], "x y - z * {strength} *".format(strength=4.0))
clp = core.std.MergeDiff(clp, adaptive_dif)

Selur
14th November 2020, 23:54
btw. just wanted to note that I really like this filter. :)
Thanks

sixthofmay
18th November 2020, 07:35
Can anyone share the binary for Avisynth 2.6 32bit? I prefer 32bit versions (with XP 32bit support) if possible. I searched the web but only found a binary for Vapoursynth (which I've not used before).

If not possible, how do I create a binary? What developent platform was this created on? I'm a developer but mainly Delphi and Lazarus. It looks like MS Visual Studio. How would I begin?

ChaosKing
18th November 2020, 08:28
I don't know about xp support but here is an avisynth version https://github.com/Asd-g/AviSynth-CAS/releases/tag/1.0.1

sixthofmay
18th November 2020, 09:33
Thank you! I installed the 32bit version from the link you posted. It tests good in XP SP3 32bit, Windows7 Pro SP1 64bit, and Windows 10 Pro 64bit. I'm using Avisynth 2.6 32 bit.

I'm checking if CAS can reduce or eliminate the Warpsharping on a video I'm working on.