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 > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 30th July 2021, 12:14   #141  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,080
Quote:
Originally Posted by Dogway View Post
I also wanted to port GrapeSmooth but closed source it seems.

I'm also still porting Adaptive Sharpen, I came to a little halt so may ask later for some help.
Ask Asd-g for port from Vapoursynth
kedautinh12 is offline   Reply With Quote
Old 30th July 2021, 12:21   #142  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,583
Quote:
Originally Posted by kedautinh12 View Post
Ask Asd-g for port from Vapoursynth
Adaptive Sharpen vs link? I didn't find it, they say that Adaptive Sharpen is better than CAS
__________________
See My Avisynth Stuff
real.finder is offline   Reply With Quote
Old 30th July 2021, 12:29   #143  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,338
Quote:
Originally Posted by real.finder View Post
woow, great, source is much more readable. Besides I got my algos wrong, I think I borked them at last minute trying to fix a stupid issue before uploading.

I'm porting this Adaptive Sharpen. Currently I'm stuck at local minima and maxima.

Since I cannot do recursion in Expr I deployed a small script to determine what the string ends being, but it "crashes" (endless loop?). I'm looking into porting this version first, optimize, then port this further optimized version, and if possible adapt it to turn it into Adaptive Contrasharpen. Also I don't like how they want to sharpen in linear or sigmoid gamma, sharpen should be performed in gamma light.


Reference.
Code:
luma0 = "luma0 "   luma12 = "luma12 "
luma1 = "luma1 "   luma13 = "luma13 "
luma2 = "luma2 "   luma14 = "luma14 "
luma3 = "luma3 "   luma15 = "luma15 "
luma4 = "luma4 "   luma16 = "luma16 "
luma5 = "luma5 "   luma17 = "luma17 "
luma6 = "luma6 "   luma18 = "luma18 "
luma7 = "luma7 "   luma19 = "luma19 "
luma8 = "luma8 "   luma20 = "luma20 "
luma9 = "luma9 "   luma21 = "luma21 "
luma10 = "luma10 "  luma22 = "luma22 "
luma11 = "luma11 "  luma23 = "luma23 "
                   luma24 = "luma24 "
 for (i = 0, 2, 1)
    {
        temp=""

        for (j = 0, 23-i, 2)
        {
            jp = j+1
            temp = Eval(Format("luma{j}"))
            Eval(Format(""" luma{j}  = + string(luma{j}) + string(luma{jp}) + " min " """))
            Eval(Format(""" luma{jp} = + string(temp)    + string(luma{jp}) + " max " """))
        }
        

        for (jj = 24-i, i+1, -2)
        {
            temp = Eval(Format("luma{i}"))
            Eval(Format(""" luma{i}  = + string(luma{i}) + string(luma{jj}) + " min " """))
            Eval(Format(""" luma{jj} = + string(temp)    + string(luma{jj}) + " max " """))

            jl = 24-i
            js = jj-1
            temp = Eval(Format("luma{jl}"))
            Eval(Format(""" luma{jl} = + string(luma{jl}) + string(luma{js}) + " max " """))
            Eval(Format(""" luma{js} = + string(temp)     + string(luma{js}) + " min " """))
        }
}
        
subtitle(last,luma1,size=10)

CAS is unsharp mask based as many other sharpeners, they mainly differ on how to avoid ringing, Adaptive Sharpen is another sharpening flavour. At some point I will try to compare all of them and do some evaluation. There's also Smart Sharp, qUINT sharp, NLM Sharp, there are some interesting *.mp4 guy sharpeners as well and I don't forget Plum by feisty2.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread

Last edited by Dogway; 30th July 2021 at 12:42.
Dogway is offline   Reply With Quote
Old 30th July 2021, 12:32   #144  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,080
Quote:
Originally Posted by real.finder View Post
Adaptive Sharpen vs link? I didn't find it, they say that Adaptive Sharpen is better than CAS
Sr, i think it's Vapoursynth filter
kedautinh12 is offline   Reply With Quote
Old 30th July 2021, 12:42   #145  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,583
Dogway, maybe it's better to make it a plugin? you can make it only with C/C++ code and then asked another person to add optimized asm code for speed up if you can't do asm codes
__________________
See My Avisynth Stuff

Last edited by real.finder; 30th July 2021 at 12:45.
real.finder is offline   Reply With Quote
Old 30th July 2021, 13:14   #146  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,338
Updated DeGrainMedian modes. Actually it wasn't my fault, I really have to go through hoops to make the algos work with the variables bugs.

Yes, plugin should be really easy for people into C, mostly 1:1 port. I'm also doing this for learning though (ex mods) and library, while mix mods are speed oriented. I'm not sure if after 6 years nobody tackled Adaptive Sharpen, it might be lack of interest or maybe hard to implement, I don't know. In any case if you want to go HD or UHD sharpening you might need to apply high sigma blurs which are only fast on frequency domain, I doubt scaling down, blur (kawase?) then up is faster than that.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 30th July 2021, 13:35   #147  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,583
feisty2 said that new c++ is easy like scripting, maybe you can try use last c++ with GCC and C api of avs/avs+
__________________
See My Avisynth Stuff
real.finder is offline   Reply With Quote
Old 30th July 2021, 13:43   #148  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,338
Yes, I have that in the back of my mind. GCC is lightweight, anyway I don't think writing asm is easy.
Actually I just wanted to make a few filters ExTools and TransformsPack and get going since I have an VR I bought 2 months ago and still haven't barely opened (need to install Win10/11, blabla, sloth).
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 31st July 2021, 12:17   #149  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,439
Quote:
Originally Posted by real.finder View Post
remove UV with ConvertToY/ConvertToY8 after source call and you are safe and you should get more speed as well
My script:

SetMemoryMax()
SetFilterMTMode("DEFAULT_MT_MODE", 2)
LoadPlugin("D:\Eseguibili\Media\DGDecNV\DGDecodeNV.dll")
DGSource("F:\In\1_44 Harvey\harvey.dgi",ct=0,cb=0,cl=232,cr=232)
ConvertToY()
SMDegrain (tr=4, thSAD=400, trymany=true, refinemotion=true, contrasharp=false, PreFilter=4, truemotion=true, plane=0, chroma=false)
Prefetch(6)

Error:

Script error: syntax error
(D:/Programmi/Media/AviSynth+/plugins64/ExTools-4.5b~Dogway.avsi, line 1246, column 0)
(F:\In\1_44 Harvey\harvey_Y16.avs, line 3)
(F:\In\1_44 Harvey\harvey_Y16_temp\harvey_Y16_source.avs, line 1)


ExTools4.5b is buggish. With 4.4 it works ok.

P.S: How can I get the equivalent of color 16 bit on 4:0:0? 8 bit is enough for greyscale?
__________________
@turment on Telegram

Last edited by tormento; 31st July 2021 at 12:30.
tormento is offline   Reply With Quote
Old 1st August 2021, 00:19   #150  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,338
Thanks, updated, it was a stupid typo.

You can improve denoising with HBD.
Code:
ConvertToY()
Convertbits(16)
By the way, the above iterator sample was as expected a sorting algo, so good to know another tool for the toolbox. The error dialog was for subtitle(), instead I wrote out the output to a file. Now Adaptive Sharpen is in debug phase.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 1st August 2021, 15:10   #151  |  Link
Arx1meD
Registered User
 
Arx1meD's Avatar
 
Join Date: Feb 2021
Posts: 120
Quote:
Originally Posted by Dogway View Post
I also want to post a list of all the median filters I could find. They happen to be much more than I thought, so I'm not including them all, although people can help out if interested to make a good library, despite some of them protected under a paywall or not possible with Expr expressions (recursions, etc)
From all of them the ones I'm interested most are: IDBA, TSND, RAA, ADKI, and AUTMF.

Convolution algorithms:
# RAA - Removal of salt and pepper an Adaptive Approach
There is a ModPlus plugin and it includes a SaltPepper filter. It can be found here (also source code) - ModPlus.
I donít know how useful it will be for you.
Arx1meD is offline   Reply With Quote
Old 1st August 2021, 15:30   #152  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,080
ManyPlus have ModPlus with new updated
http://www.avisynth.nl/users/vcmohan.../manyPlus.html
kedautinh12 is offline   Reply With Quote
Old 2nd August 2021, 11:24   #153  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,338
Finished the port of Adaptive Sharpen (phew!)

It's very slow though, I thought that processing in 8-bit would make it somewhat production ready speed, but no, it's slower. Maybe when/if we get LUT calculations in Expr though.
There are already some optimization tricks to make it faster so the next step would only be to port the optimized HLSL from igv.
For the time being use it in 8 or 32-bit. Haven't tested in other depths.
Eventually I want to create a sharpeners pack with FineSharp, SeeSaw, etc and try to find a good candidate for Contrasharp replacement in SMDegrain.


I checked the SaltPepper filter and depending on mode it matches "undot" or "median". There's also the feedback argument but I can check it out later with the feedback plugin from wonkey_monkey.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 2nd August 2021, 11:35   #154  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,080
Real.Finder was added feedback to stab3
https://github.com/realfinder/AVS-St...Pack.avsi#L423
kedautinh12 is offline   Reply With Quote
Old 4th August 2021, 12:11   #155  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,338
Updated Adaptive Sharpen to fix the last bugs and last optimizations. It runs now at 11.40fps on my system with Prefetch(8). I will now try to port CAS, SeeSaw and other sharpeners for a Sharpeners Pack.
If any it made me appreciate more LSFmod and its quality, specially when paired with supersampling.

Also updated SMDegrain with latest changes, that is, the contrasharpening function was fixed to either use spatial or temporal limiting. Also some values for HD were tuned. Should be faster now.
Besides that BM3D prefiltering has been added. Resizing down kernel was changed to bilinear for UHD, and a threads var was fixed when empty.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 4th August 2021, 12:16   #156  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,080
Thanks, but CAS have avisynth filter, why you still want port it??
kedautinh12 is offline   Reply With Quote
Old 4th August 2021, 12:23   #157  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,338
Yes, that's true, forgot about it. If it's too complex I pass otherwise I may add it to the library.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 4th August 2021, 13:06   #158  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,080
Seesaw have avisynth script
https://github.com/realfinder/AVS-St...up/seesaw.avsi
kedautinh12 is offline   Reply With Quote
Old 4th August 2021, 22:54   #159  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,338
Quote:
Originally Posted by wonkey_monkey View Post
I'll update my online tool at some point as it now inserts automatic pixel references (when it can) and also has a variable-ised output option.
wonkey_monkey: Is the variable reference output option included in the tool? It's not showing in any of my browsers, it could come very handy for these long sorting networks.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 5th August 2021, 04:00   #160  |  Link
Julek
Registered User
 
Julek's Avatar
 
Join Date: Dec 2020
Posts: 80
I wonder if it would be possible to do something like OpenCV Adaptive Thresholding with Expr(), it would be useful for mask
Julek is offline   Reply With Quote
Reply

Tags
avisynth, dogway, filters, hbd, packs

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 03:11.


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