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 Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 8th May 2020, 16:47   #1  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,177
waifu2x

Can we have a port of this?

https://github.com/nagadomi/waifu2x
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 8th May 2020, 19:12   #2  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,427
Quote:
Originally Posted by tormento View Post
Can we have a port of this?

https://github.com/nagadomi/waifu2x
There's already an AviSynth port (rather slow): https://github.com/sunnyone/Waifu2xAvisynth

Although not as extensive as VapourSynth's selection:
Reel.Deel is offline   Reply With Quote
Old 8th May 2020, 22:57   #3  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,177
Quote:
Originally Posted by Reel.Deel View Post
There's already an AviSynth port (rather slow)
It doesn't get advantage of GPU, I bet it's slow.
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 8th May 2020, 23:42   #4  |  Link
Sparktank
47.952fps@71.928Hz
 
Sparktank's Avatar
 
Join Date: Mar 2011
Posts: 942
Quote:
Originally Posted by tormento View Post
It doesn't get advantage of GPU, I bet it's slow.
I tried the AVS version once, and it crashed instantly.
Learn VS for this one.
__________________
Win10 (x64) build 19041
NVIDIA GeForce GTX 1060 3GB (GP106) 3071MB/GDDR5 | (r435_95-4)
NTSC | DVD: R1 | BD: A
AMD Ryzen 5 2600 @3.4GHz (6c/12th, I'm on AVX2 now!)
Sparktank is offline   Reply With Quote
Old 9th May 2020, 00:04   #5  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,697
Or try http://avisynth.nl/index.php/VapourSource
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database || https://github.com/avisynth-repository
ChaosKing is offline   Reply With Quote
Old 9th May 2020, 00:37   #6  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,532
if someone plan to port any, it's better to chose vulkan one, cuda is Monopoly to nvidia
__________________
See My Avisynth Stuff
real.finder is offline   Reply With Quote
Old 9th May 2020, 00:42   #7  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,532
Quote:
Originally Posted by Sparktank View Post
I tried the AVS version once, and it crashed instantly.
Learn VS for this one.
it was x86 only no x64, so indeed you get RAM limit crash
__________________
See My Avisynth Stuff
real.finder is offline   Reply With Quote
Old 9th May 2020, 07:53   #8  |  Link
Sparktank
47.952fps@71.928Hz
 
Sparktank's Avatar
 
Join Date: Mar 2011
Posts: 942
Quote:
Originally Posted by real.finder View Post
it was x86 only no x64, so indeed you get RAM limit crash
Now, I remember. Wow, that really takes me back when I used to use x86.

I'll give VapourSource a try.
__________________
Win10 (x64) build 19041
NVIDIA GeForce GTX 1060 3GB (GP106) 3071MB/GDDR5 | (r435_95-4)
NTSC | DVD: R1 | BD: A
AMD Ryzen 5 2600 @3.4GHz (6c/12th, I'm on AVX2 now!)
Sparktank is offline   Reply With Quote
Old 9th May 2020, 09:50   #9  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,177
Quote:
Originally Posted by real.finder View Post
if someone plan to port any, it's better to chose vulkan one, cuda is Monopoly to nvidia
Or, better, OpenCL.
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 9th May 2020, 09:55   #10  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,697
Vulkan is the future!
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database || https://github.com/avisynth-repository
ChaosKing is offline   Reply With Quote
Old 9th May 2020, 10:01   #11  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,532
better to make it like this



Code:
gpu: Controls the environment to use.

    0 = disable GPU
    1 = auto detect. It will run on the first available environment in the following order:
        CUDA
        Vulkan 
        AMD OpenCL
        FMA
        AVX
        Intel OpenCL
        SSE3
        OpenCV filter2D
    2 = force to use OpenCL
in https://github.com/HomeOfVapourSynth...h-Waifu2x-w2xc

OpenCL still has features since it run even on CPU only
__________________
See My Avisynth Stuff

Last edited by real.finder; 9th May 2020 at 10:23.
real.finder is offline   Reply With Quote
Old 9th May 2020, 23:07   #12  |  Link
ReinerSchweinlin
Registered User
 
Join Date: Oct 2001
Posts: 405
Lookup hybrid by Selur, he has Waifu2x already implemented (filter-vapoursynth-line...) Usage: Resize by factor 1,2 or 4 (1 for "cleanups"), then select waifu2x as the resizer in the mentioned "Line" tab..
ReinerSchweinlin is offline   Reply With Quote
Old 10th May 2020, 03:55   #13  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Metropolitan City of Milan, Italy
Posts: 2,205
Quote:
Originally Posted by Reel.Deel View Post
There's already an AviSynth port (rather slow): https://github.com/sunnyone/Waifu2xAvisynth
Rather slow? I wanted to make a screenshot comparison of a 720x480 NTSC DVD I ripped a while ago and I had on my HDD and it took 18 fucking minutes on my crappy i7 4c/8th 2.60GHz for one single frame.
In comparison, QTGMC is blazing fast xD

Quote:
Originally Posted by tormento View Post
It doesn't get advantage of GPU, I bet it's slow.
CPU only is a nightmare; 18 minutes for 1 single frame to go from 720x480 anamorphic to 1440x960 anamorphic on a 4c/8th. It can't be used...
GPU acceleration is a must.

Quote:
Originally Posted by Sparktank View Post
I tried the AVS version once, and it crashed instantly.
Well it didn't crash but it used 2 GB of RAM for itself and took a hell lot of time for 480p to 960p; I bet it will crash if I try higher resolutions...
(EDIT: it didn't crash for higher resolution)


Besides, it only supports y8, yv12, yv16, yv24 which means it's stuck on 8bit planar.


Anyway, lo and behold, this is the single anamorphic yv12 frame that took 18 minutes to encode:

Original:

Code:
DGDecode_MPEG2Source("\\VBOXSVR\Share_Windows_Linux\Production\RAW\417-423\421.d2v")


tfm(mode=1,pp=5,slow=2,micmatching=2) 
tdecimate()

Waifu2x:

Code:
Waifu2x(nr=0, scale=2, models="C:\Programmi\AviSynth\models")
NNEDI3:

Code:
nnedi3_rpow2(cshift="Spline64ResizeMT", rfactor=2, fwidth=1440, fheight=960, nsize=4, nns=4, qual=1, etype=0, pscrn=2,
csresize=true, mpeg2=true, threads_rs=0, logicalCores_rs=true, MaxPhysCore_rs=true, SetAffinity_rs=false, opt=3)
Bilinear:

Code:
BilinearResizeMT(1440, 960)
Bicubic:

Code:
BicubicResizeMT(1440, 960)
Lanczos:

Code:
LanczosResizeMT(1440, 960)
Spline64:

Code:
Spline64ResizeMT(1440, 960)

Screenshots:

Original:

NNEDI3:

Waifu2x:

Bilinear:

Bicubic:

Lanczos:

Spline64:

Point:


Link to Imgur: Link

Clearly Point is the worse.
My chart is (from best to worse):

NNEDI3 (with Spline Kernel)
Spline64Resize
LanczosResize
BicubicResize
BilinearResize
PointResize

NNEDI3: it's alright I guess.
Spline64: very sharp, but there's a bit of ringing around the lobe of the ear.
Lanczos: still sharp, but there's still ringing.
Bicubic: a bit blurry, ringing still there but less because of the blurriness.
Bilinear: bluerrier (is it even a word?) than Bicubic.
Point: total crap, as expected by nearest neighbor.

All the test completed in a matter of seconds; the only one who took 18 fucking minutes was Waifu2x and it didn't even use my CPU at 100%, it was sitting at 12% (with waifu2x internal denoise disabled) and 25% (with waifu2x internal denoise enabled). You know, after waiting 18 minutes staring at the task manager allocating RAM for 1 single frame I expected the upscaled image to be so much better than the one made by its competitor, but if you compare Waifu with NNEDI 8bit it doesn't really add anything to it other than making eyes a bit more white and make the forehead protector color look a little bit different... It still has plenty of ringing as well...
In other words, I would totally go for NNEDI with Spline as kernel instead of bothering with this waifu thing for three reasons: 1) NNEDI is way faster and gives similar results 2) it can work in 8bit or 16bit while waifu2x is limited to 8bit 3) it can be used for everything, not just anime


EDIT: For the records, I tried to go up to x8 and it took 1h and 47 minutes for 1 frame on my 4c/8th using it at 18%...

I mean, guys, is it really worth it...? I don't think so...

Last edited by FranceBB; 10th May 2020 at 04:12.
FranceBB is offline   Reply With Quote
Old 10th May 2020, 04:29   #14  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 4,979
Quote:
Originally Posted by FranceBB View Post

All the test completed in a matter of seconds; the only one who took 18 fucking minutes was Waifu2x and it didn't even use my CPU at 100%, it was sitting at 12% (with waifu2x internal denoise disabled) and 25% (with waifu2x internal denoise enabled). You know, after waiting 18 minutes staring at the task manager allocating RAM for 1 single frame I expected the upscaled image to be so much better than the one made by its competitor, but if you compare Waifu with NNEDI 8bit it doesn't really add anything to it other than making eyes a bit more white and make the forehead protector color look a little bit different... It still has plenty of ringing as well...
In other words, I would totally go for NNEDI with Spline as kernel instead of bothering with this waifu thing for three reasons: 1) NNEDI is way faster and gives similar results 2) it can work in 8bit or 16bit while waifu2x is limited to 8bit 3) it can be used for everything, not just anime


EDIT: For the records, I tried to go up to x8 and it took 1h and 47 minutes for 1 frame on my 4c/8th using it at 18%...

I mean, guys, is it really worth it...? I don't think so...
Agreed - not worth it for avs... But that's the old avs version. It's very slow (no optimizations), and has limited settings, uses older model - it was only a proof of concept. It looks nothing like modern implementations...

You need to use vapoursynth-caffe version, takes about 1 sec (depending on GPU), more settings, different models, works in 32bit, cleaner, better lines and less ringing. That's why people are asking for an avs port...
https://postimg.cc/KKbNwSnz
poisondeathray is offline   Reply With Quote
Old 10th May 2020, 05:32   #15  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,532
I just note there are another port of waifu2x optimized for video called dandere2x https://github.com/aka-katto/dandere2x
__________________
See My Avisynth Stuff
real.finder is offline   Reply With Quote
Old 10th May 2020, 10:14   #16  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,177
Quote:
Originally Posted by FranceBB View Post
GPU acceleration is a must.
That's what I would like to see in the close future, for every plugin that could benefit from GPU architecture.

I proprosed OpenCL because it's the easiest to program and port to CPU also, becoming "transparent" to users.
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 10th May 2020, 10:15   #17  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,177
Quote:
Originally Posted by real.finder View Post
better to make it like this
Code:
gpu: Controls the environment to use.
Agree but it would mean lot of work for programmers.

To me even OpenCL only is more than enough.
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 10th May 2020, 19:21   #18  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Metropolitan City of Milan, Italy
Posts: 2,205
Quote:
Originally Posted by poisondeathray View Post
Agreed - not worth it for avs... But that's the old avs version. It's very slow (no optimizations), and has limited settings, uses older model - it was only a proof of concept. It looks nothing like modern implementations...

You need to use vapoursynth-caffe version, takes about 1 sec (depending on GPU), more settings, different models, works in 32bit, cleaner, better lines and less ringing. That's why people are asking for an avs port...
https://postimg.cc/KKbNwSnz
I see...
Yes, the new implementation looks way better than the old implementation, it's sharp and it definitely has less ringing.
Now I understand why people want a modern version ported to AVS...

Quote:
Originally Posted by tormento View Post
That's what I would like to see in the close future, for every plugin that could benefit from GPU architecture.
Yes, that would definitely be welcomed. At work we have servers with NVIDIA Quadro GPUs that are currently not used other than for x264 OpenCL accelerated encoding, which is a total waste, honestly. I would love to see plugins supporting both CPU and GPU acceleration.

Quote:
Originally Posted by tormento View Post
To me even OpenCL only is more than enough.
Uhm... I would rather have a single plugin that can do both CPU and GPU and for which you can decide which one is gonna use or let it do automatically for you. This is to avoid having two separate version of plugins to maintain. Like, let's suppose you're in a world where everything is hardware accelerated with GPUs: you would have things like dfttest and dfttestGPU for instance and you would have to maintain both... it would be a nightmare for developers.
I like real.finder's idea; after all he's a *real* finder of ideas XD.

Quote:
Originally Posted by real.finder View Post
better to make it like this



Code:
gpu: Controls the environment to use.

    0 = disable GPU
    1 = auto detect. It will run on the first available environment in the following order:
        CUDA
        Vulkan 
        AMD OpenCL
        FMA
        AVX
        Intel OpenCL
        SSE3
        OpenCV filter2D
    2 = force to use OpenCL

That would be very good but it would be very hard and time-consuming to develop. Even something like having just the ability to either choose CPU only or GPU-acceleration, where the GPU acceleration can be whatever the developer chooses like CUDA or OpenCL etc
Let's be real, no one is going to re-implement a filter (that has already been written) with different GPU implementations.
I know that OpenCL can be used by GPUs from both NVIDIA and AMD and that it's impossible for AMD/ATI users to use CUDA plugins, however I have NVIDIA Quadro GPUs at work and NVIDIA RTX at home, so for me CUDA is fine; heck, it's even better than OpenCL in my case 'cause OpenCL runs slower on NVIDIA, so I'm happy with that (for instance the plugins developed by Donald Graft run just fine). On the other hand, I do understand why AMD/ATI users complain...

Last edited by FranceBB; 10th May 2020 at 19:27.
FranceBB is offline   Reply With Quote
Old 11th May 2020, 09:59   #19  |  Link
MeteorRain
結城有紀
 
Join Date: Dec 2003
Location: NJ; OR; Shanghai
Posts: 894
I don't think opencl on CPU is well supported. No?
__________________
Projects
x265 - Yuuki-Asuna-mod Download / GitHub
TS - ADTS AAC Splitter | LATM AAC Splitter | BS4K-ASS
Neo AviSynth+ filters - F3KDB | FFT3D | DFTTest | MiniDeen | Temporal Median
MeteorRain is offline   Reply With Quote
Old 11th May 2020, 11:01   #20  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
there're much more powerful neural net based models than waifu2x and nnedi3, take a look at ESRGAN and RCAN
feisty2 is offline   Reply With Quote
Reply

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 16:25.


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