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 > VapourSynth

Reply
 
Thread Tools Search this Thread Display Modes
Old 10th June 2018, 21:31   #1  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 723
SmoothUV plugin and RainbowSmooth derainbow script

A spatial derainbow filter and a script that uses it, ported from the corresponding Avisynth plugin and script.

Hope it works.

https://github.com/dubhater/vapoursynth-smoothuv
__________________
Buy me a "coffee" and/or hire me to write code!
jackoneill is offline   Reply With Quote
Old 10th June 2018, 22:00   #2  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,009
Quote:
Radius. Must be between 1 and 5.
Larger values smooth more.
4 and especially 5 have a green overlay, is this normal? Tested on 1080p source.

Or just use this
Code:
clip = core.std.BlankClip(format=vs.YUV420P8)
clip = clip.smoothuv.SmoothUV(radius=5, threshold=90)

Thx for a new toy
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database || https://github.com/avisynth-repository

Last edited by ChaosKing; 10th June 2018 at 22:12.
ChaosKing is online now   Reply With Quote
Old 11th June 2018, 10:31   #3  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 723
I suspect 4 and 5 are broken in the Avisynth plugin as well (I didn't test it).
__________________
Buy me a "coffee" and/or hire me to write code!
jackoneill is offline   Reply With Quote
Old 11th June 2018, 11:11   #4  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,009
Just tried the avs version. Looks ok even with radius 7.
I used the dll from http://avisynth.nl/index.php/SmoothUV
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database || https://github.com/avisynth-repository

Last edited by ChaosKing; 11th June 2018 at 11:13.
ChaosKing is online now   Reply With Quote
Old 11th June 2018, 13:09   #5  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 723
That's weird. According to the source code, it should throw an error when radius is greater than 5.
__________________
Buy me a "coffee" and/or hire me to write code!
jackoneill is offline   Reply With Quote
Old 11th June 2018, 13:28   #6  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,009
The changelog says something different
Code:
v1.4.0       2003/09/02      - Fixed HQ mode for radius > 4
                             - Added radius 7
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database || https://github.com/avisynth-repository
ChaosKing is online now   Reply With Quote
Old 11th June 2018, 13:46   #7  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,009
Heres a small compare script. I didn't know that ffms2 could load web stuff
Code:
avsdll = r"D:\AvisynthRepository\AVSPLUS_x86\Avisynth.dll"

clip = core.ffms2.Source("https://www.animemusicvideos.org/guides/avtech31/images/avs/rainbow-orig.jpg").std.DuplicateFrames([0]*20)
clip = clip.resize.Bicubic(format=vs.YUV420P8, matrix_s="709")
r3 = clip.smoothuv.SmoothUV(radius=3)
r4 = clip.smoothuv.SmoothUV(radius=4)
r5 = clip.smoothuv.SmoothUV(radius=5)

avs3 = core.avsw.Eval(' SmoothUV(radius=3) ', clips=[clip], clip_names=["last"], avisynth=avsdll)
avs7 = core.avsw.Eval(' SmoothUV(radius=7) ', clips=[clip], clip_names=["last"], avisynth=avsdll)


crop=200
clip = core.std.StackHorizontal([	
	core.std.CropRel(clip, crop,crop,0,0).text.Text("source"),
	core.std.CropRel(r3, crop,crop,0,0).text.Text("radius 3"),
	core.std.CropRel(avs3, crop,crop,0,0).text.Text("Avisynth r3"),
	core.std.CropRel(r4, crop,crop,0,0).text.Text("radius 4"),
	core.std.CropRel(r5, crop,crop,0,0).text.Text("radius 5"),
	core.std.CropRel(avs7, crop,crop,0,0).text.Text("Avisynth r7"),
	
	])

clip.set_output()
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database || https://github.com/avisynth-repository
ChaosKing is online now   Reply With Quote
Old 11th June 2018, 16:29   #8  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 723
Looks like the source code is older than the DLL.
__________________
Buy me a "coffee" and/or hire me to write code!
jackoneill is offline   Reply With Quote
Old 14th June 2018, 20:56   #9  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,413
I'm trying to get retdec built and installed, maybe that'll provide a bit more insight into what the binary-only is doing.
__________________
There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order.
foxyshadis is offline   Reply With Quote
Old 15th June 2018, 12:06   #10  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 723
Quote:
Originally Posted by foxyshadis View Post
I'm trying to get retdec built and installed, maybe that'll provide a bit more insight into what the binary-only is doing.
retdec sounds interesting! I was able to disassemble the DLL in IDA Free, but to also decipher all the asm is a bit too much effort...
__________________
Buy me a "coffee" and/or hire me to write code!
jackoneill is offline   Reply With Quote
Old 8th July 2018, 20:55   #11  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 723
I figured out what's wrong when radius is 4 or 5. It calculates a sum which has to fit in 14 bits, so it can't be more than 16383. Radius 4 (9 * 9 * 255) is just too many pixels to fit.

This is easily fixed by using the pmulhuw instruction (introduced in SSE) instead of the pmulhw instruction (introduced in MMX).

https://github.com/dubhater/vapoursy...eleases/tag/v2

Code:
   * Fix bad output with radius 4 and 5 (especially 5).
   * Allow radius 6 and 7.
   * Better precision in the calculations.
__________________
Buy me a "coffee" and/or hire me to write code!
jackoneill is offline   Reply With Quote
Old 8th July 2018, 21:59   #12  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,009
Good job! I tested rad7 and the output is very similar to the avisynth version. I also noticed that smoothuv blurs the color red a bit or rather the black outlines.
But why is the mask parameter absent in r2? :P
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database || https://github.com/avisynth-repository
ChaosKing is online now   Reply With Quote
Old 9th July 2018, 11:40   #13  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 723
Quote:
Originally Posted by ChaosKing View Post
Good job! I tested rad7 and the output is very similar to the avisynth version. I also noticed that smoothuv blurs the color red a bit or rather the black outlines.
But why is the mask parameter absent in r2? :P
Maybe you're looking at SmoothUV's parameters instead of RainbowSmooth?
__________________
Buy me a "coffee" and/or hire me to write code!
jackoneill is offline   Reply With Quote
Old 9th July 2018, 12:00   #14  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,009
D'oh, you're right.
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database || https://github.com/avisynth-repository
ChaosKing is online now   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 01:11.


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