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 22nd November 2014, 11:53   #1  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 733
vcfreq a plugin for vapoursynth

vcfreq is a plugin for vapoursynth. It operates in frequency domain to filter out certain types of regular noises. A large range of cascading filters can be specified.
The functions available in this plugin are
Code:
1.F1Quiver
2.F2Quiver
Full description of this plugin is at vcfreq
This plugin requires a fftw3f.3.dll to be present in path. Currently works in windows only.
Comments, suggestions are welcome
__________________
mohan
my plugins are now hosted here
vcmohan is offline   Reply With Quote
Old 17th February 2016, 13:55   #2  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: Los Angeles, California
Posts: 2,130
is there some memory leak in the plugin?
the plugin consumed almost all 16GB of the RAM of my computer as the processing went on and then terminated by the OS...
__________________
If I got new ideas, will post here: https://github.com/IFeelBloated
feisty2 is offline   Reply With Quote
Old 18th February 2016, 10:18   #3  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: Los Angeles, California
Posts: 2,130
@vcmohan
I tried to fix the memory leak but...
can't even compile the untouched source code, there're like.. errors everywhere...
some tips to make it work plz?
__________________
If I got new ideas, will post here: https://github.com/IFeelBloated
feisty2 is offline   Reply With Quote
Old 18th February 2016, 11:30   #4  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 733
Sorry for that. Is it that all functions in it have memory leak or did you try a particular one. If so can you give the script used?
Offhand I can see one possible problem. vcfreq assumes the number of cpus to be the number of threads active. This is communicated to the fftw3 dll.
__________________
mohan
my plugins are now hosted here
vcmohan is offline   Reply With Quote
Old 18th February 2016, 12:05   #5  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: Los Angeles, California
Posts: 2,130
I've only used vcfreq.Sharp so far cuz I need to perform a deconvolution..
the script's just
Code:
core.vcfreq.Sharp (clip, line=0, wn=0.99, x=1, y=1, fr=25, scale=0.0059)
vspipe kept consuming RAM right from the very first frame and crashed around frame 2800 on a GrayS 720x576 vid as there was no more RAM left..
__________________
If I got new ideas, will post here: https://github.com/IFeelBloated
feisty2 is offline   Reply With Quote
Old 19th February 2016, 12:36   #6  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 733
I have uploaded the corrected version of vcfreq plugin. Please check if it is working ok. These were compiled on 201m community visual studio compiler.
__________________
mohan
my plugins are now hosted here
vcmohan is offline   Reply With Quote
Old 19th February 2016, 14:15   #7  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: Los Angeles, California
Posts: 2,130

the new version works!
__________________
If I got new ideas, will post here: https://github.com/IFeelBloated
feisty2 is offline   Reply With Quote
Old 19th February 2016, 16:27   #8  |  Link
sl1pkn07
Pajas Mentales...
 
Join Date: Dec 2004
Location: Spanishtán
Posts: 448
any chance for can be builded on linux?

greetings
__________________
[AUR] Vapoursynth Stuff

Last edited by sl1pkn07; 20th February 2016 at 12:09.
sl1pkn07 is offline   Reply With Quote
Old 17th August 2016, 18:52   #9  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 2,000
Here's my modified source and x64 dll that should be compilable on linux if you have a float fftw3 lying around. I didn't test it though. Report your findings and so on. Just done as a 30 min code stabbing session while eating dinner.

Changes:
Removes the loadlibrary loading of fftw3 and instead uses the official fftw3.h
Replaced all homegrown pi constants with the more accurate M_PI
Removed all unused variables where it was obvious no use was ever intended
Fixed an extreme number of type conversion warnings, some of them by making sure all calculations stay in float precision

And can someone check this piece of code?
Code:
void pointNotchFilter2D( float * freqFilter, int* spec, int ht, int wd)
{
	// point centered notch filter
	float xf = spec[2] * wd / (NYQUIST);

	float yf = spec[3] * ht / (NYQUIST );

	int degree = 2 * spec[4];

	// calculate notch radial sqr
	float d0sq = sqrt (xf*xf + yf*yf);
	d0sq = (ht * ht + wd * wd)/ 4;
It looks very suspect. Like it should be multiplied or divided or something instead of the first value assigned to d0sq just being discarded.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet

Last edited by Myrsloik; 9th April 2018 at 13:17. Reason: Updated link
Myrsloik is offline   Reply With Quote
Old 17th August 2016, 19:25   #10  |  Link
sl1pkn07
Pajas Mentales...
 
Join Date: Dec 2004
Location: Spanishtán
Posts: 448
with GCC:
Code:
In file included from vcfreq.cpp:66:0:
FQSharphelper.cpp: In function 'void getRealInput(float*, const finc*, int, int, int, int, int, int, bool)':
FQSharphelper.cpp:251:30: error: too many arguments to function 'int getSign(int)'
     data1[ w] = getSign( h, w) * fptr1[w];
                              ^
FQSharphelper.cpp:217:5: note: declared here
 int getSign(int i)
     ^
FQSharphelper.cpp: In function 'void getRealOutput(float*, finc*, int, int, int, int, int, bool, finc, finc)':
FQSharphelper.cpp:319:39: error: too many arguments to function 'int getSign(int)'
     int val = data1[ w] * getSign(h, w);
                                       ^
FQSharphelper.cpp:217:5: note: declared here
 int getSign(int i)
     ^
FQSharphelper.cpp: In instantiation of 'void getRealInput(float*, const finc*, int, int, int, int, int, int, bool) [with finc = unsigned char]':
FQBlur.cpp:254:78:   required from here
FQSharphelper.cpp:251:24: error: too many arguments to function 'int getSign(int)'
     data1[ w] = getSign( h, w) * fptr1[w];
                        ^
FQSharphelper.cpp:217:5: note: declared here
 int getSign(int i)
     ^
FQSharphelper.cpp: In instantiation of 'void getRealOutput(float*, finc*, int, int, int, int, int, bool, finc, finc) [with finc = unsigned char]':
FQBlur.cpp:267:51:   required from here
FQSharphelper.cpp:319:34: error: too many arguments to function 'int getSign(int)'
     int val = data1[ w] * getSign(h, w);
                                  ^
FQSharphelper.cpp:217:5: note: declared here
 int getSign(int i)
     ^
FQSharphelper.cpp: In instantiation of 'void getRealInput(float*, const finc*, int, int, int, int, int, int, bool) [with finc = short unsigned int]':
FQBlur.cpp:278:80:   required from here
FQSharphelper.cpp:251:24: error: too many arguments to function 'int getSign(int)'
     data1[ w] = getSign( h, w) * fptr1[w];
                        ^
FQSharphelper.cpp:217:5: note: declared here
 int getSign(int i)
     ^
FQSharphelper.cpp: In instantiation of 'void getRealOutput(float*, finc*, int, int, int, int, int, bool, finc, finc) [with finc = short unsigned int]':
FQBlur.cpp:291:51:   required from here
FQSharphelper.cpp:319:34: error: too many arguments to function 'int getSign(int)'
     int val = data1[ w] * getSign(h, w);
                                  ^
FQSharphelper.cpp:217:5: note: declared here
 int getSign(int i)
     ^
FQSharphelper.cpp: In instantiation of 'void getRealInput(float*, const finc*, int, int, int, int, int, int, bool) [with finc = float]':
FQBlur.cpp:302:80:   required from here
FQSharphelper.cpp:251:24: error: too many arguments to function 'int getSign(int)'
     data1[ w] = getSign( h, w) * fptr1[w];
                        ^
FQSharphelper.cpp:217:5: note: declared here
 int getSign(int i)
     ^
FQSharphelper.cpp: In instantiation of 'void getRealOutput(float*, finc*, int, int, int, int, int, bool, finc, finc) [with finc = float]':
FQBlur.cpp:316:51:   required from here
FQSharphelper.cpp:319:34: error: too many arguments to function 'int getSign(int)'
     int val = data1[ w] * getSign(h, w);
                                  ^
FQSharphelper.cpp:217:5: note: declared here
 int getSign(int i)
     ^
make: *** [Makefile:2: all] Error 1
with clang
Code:
In file included from vcfreq.cpp:66:
./FQSharphelper.cpp:251:17: error: no matching function for call to 'getSign'
                                data1[ w] = getSign( h, w) * fptr1[w];
                                            ^~~~~~~
./FQSharphelper.cpp:217:5: note: candidate function not viable: requires single argument 'i', but 2 arguments were provided
int getSign(int i)
    ^
./FQSharphelper.cpp:319:27: error: no matching function for call to 'getSign'
                                int val = data1[ w] * getSign(h, w);
                                                      ^~~~~~~
./FQSharphelper.cpp:217:5: note: candidate function not viable: requires single argument 'i', but 2 arguments were provided
int getSign(int i)
    ^
2 errors generated.
make: *** [Makefile:2: all] Error 1
note: #include "FQSharpHelper.cpp" -> #include "FQSharphelper.cpp" in vcfreq.cpp (case sensitive)
__________________
[AUR] Vapoursynth Stuff
sl1pkn07 is offline   Reply With Quote
Old 17th August 2016, 19:38   #11  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 2,000
I think I've fixed that now. Redownload and try again. I think the other overload was declared too late or something.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 17th August 2016, 19:45   #12  |  Link
sl1pkn07
Pajas Mentales...
 
Join Date: Dec 2004
Location: Spanishtán
Posts: 448
done.

now build ok in linux ^o^
__________________
[AUR] Vapoursynth Stuff
sl1pkn07 is offline   Reply With Quote
Old 19th August 2016, 12:50   #13  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 733
Quote:
Originally Posted by Myrsloik View Post
And can someone check this piece of code?
Code:
void pointNotchFilter2D( float * freqFilter, int* spec, int ht, int wd)
{
	// point centered notch filter
	float xf = spec[2] * wd / (NYQUIST);

	float yf = spec[3] * ht / (NYQUIST );

	int degree = 2 * spec[4];

	// calculate notch radial sqr
	float d0sq = sqrt (xf*xf + yf*yf);
	d0sq = (ht * ht + wd * wd)/ 4;
It looks very suspect. Like it should be multiplied or divided or something instead of the first value assigned to d0sq just being discarded.
Thanks for pointing out problematic code. Sorry when I uploaded the revised dll in May I missed to upload the updated source. I have done that now. Yes instead of the included lte file
the official fftw3 header can be used, but I found it to be so difficult to understand started using Fizik's lte version with suitable modifications.
As regards numerous warnings, yes I am guilty and lazy. Thankful for correcting.
__________________
mohan
my plugins are now hosted here
vcmohan is offline   Reply With Quote
Old 19th August 2016, 15:17   #14  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,087
Quote:
yes I am guilty and lazy
As are we all, we are all here a consortium of individuals all at common purpose.
Sometimes we dont make mistakes, sometimes we do, but, every time we advance
and take from what we have learnt, thank you VC Mohan, you really are pretty good, when
not making mistakes, and that is what really counts

EDIT: Big Kiss vc, XXX.

EDIT: I picture myself as the one on the left, and you being the girly one on the right (with the blue hair, whats with that?)
I think your character is way too aggressive, I feel maybe that I'm being abused, please control yourself.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 19th August 2016 at 15:46.
StainlessS is offline   Reply With Quote
Old 7th March 2017, 10:51   #15  |  Link
KingLir
Registered User
 
Join Date: Jan 2017
Posts: 143
Quote:
Originally Posted by Myrsloik View Post
Here's my modified source and x64 dll

Changes:
Removes the loadlibrary loading of fftw3 and instead uses the official fftw3.h
Replaced all homegrown pi constants with the more accurate M_PI
Removed all unused variables where it was obvious no use was ever intended
Fixed an extreme number of type conversion warnings, some of them by making sure all calculations stay in float precision
Thanks! This builds OK also on macOS with the following:

Code:
gcc -c -fPIC  ${CFLAGS} ${CPPFLAGS} -I. $(pkg-config --cflags vapoursynth) -o main.o vcfreq.cpp
g++ -dynamiclib -undefined suppress -flat_namespace *.o -o libvcfreq.dylib
KingLir is offline   Reply With Quote
Old 16th December 2017, 20:13   #16  |  Link
sl1pkn07
Pajas Mentales...
 
Join Date: Dec 2004
Location: Spanishtán
Posts: 448
the link is down @mirsloik
__________________
[AUR] Vapoursynth Stuff
sl1pkn07 is offline   Reply With Quote
Old 8th April 2018, 05:04   #17  |  Link
Chthon
Registered User
 
Join Date: Dec 2012
Posts: 6
Please kindly repost the fixed-for-linux source code.
Chthon is offline   Reply With Quote
Old 9th April 2018, 01:03   #18  |  Link
Are_
Registered User
 
Join Date: Jun 2012
Location: Ibiza, Spain
Posts: 279
https://www.dropbox.com/s/fyid7xne75....08.17.tar.bz2
Are_ is offline   Reply With Quote
Old 9th April 2018, 13:07   #19  |  Link
Chthon
Registered User
 
Join Date: Dec 2012
Posts: 6
Thank you Are_ .

Edit: A few notes for anyone else trying to compile:

1. Looking at the newer source on the official page, it looks likes vc's fix for the issue pointed out in post #9 is to comment out both lines. This seems fine, since the variable is unused anyway.

2. It looks like there's another bug. The for loop at the bottom of Factorize.cpp is missing its {}s. I *think* the closing brace should go on line 52 (???).

3. libfftw3f_threads is a dependency (at least for the fixed version). If you don't link it at compile time, core.vcfreq.Sharp() will crash with an undefined symbol error for fftwf_init_threads.

4. I was able to compile with
Code:
g++ -Wall -shared -fPIC -I. -L/usr/local/lib/vsplugins/lib -lfftw3f_threads -o libvcfreq.so vcfreq.cpp
after copying the vapoursynth headers into the working directory.
(My libfftw3f_threads.so is in usr/local/lib/vsplugins/lib; adjust accordingly.)

Last edited by Chthon; 9th April 2018 at 15:46.
Chthon is offline   Reply With Quote
Old 9th April 2018, 13:19   #20  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 2,000
I updated my old and broken dropbox link. Not sure if I really want to fork the project since I'd have basically no time to maintain it anyway. Would be a shame if the changes were lost tough...
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik 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 02:13.


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