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 4th September 2017, 07:45   #21  |  Link
stax76
staxrip & mpv.net
 
Join Date: Jun 2002
Posts: 5,248
Thanks, I need automatic loading though for my use case, anything else is suboptimal, now it does xcopy the files to the sys dir which in my opinion is bad practice. I can make a request at pinterf's FFT3DFilter github tracker asking if FFT3DFilter could load the DLLs if they are located in the same dir then FFT3DFilter.
__________________
I have a dream by Martin Luther King
one hundred years later...
We can never be satisfied...
With this faith...
Let freedom ring...
stax76 is offline   Reply With Quote
Old 4th September 2017, 08:02   #22  |  Link
Groucho2004
 
Join Date: Mar 2006
Posts: 3,926
Quote:
Originally Posted by stax76 View Post
I can make a request at pinterf's FFT3DFilter github tracker asking if FFT3DFilter could load the DLLs if they are located in the same dir then FFT3DFilter.
Not a bad idea. This is pretty easy - Get the full path to fft3dfilter with GetCurrentDirectory() and use a loadlibrary() call with the full path in addition to just "LoadLibrary("libfftw3f-3.dll")".

Last edited by Groucho2004; 4th September 2017 at 08:16.
Groucho2004 is offline   Reply With Quote
Old 4th September 2017, 12:25   #23  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 1,876
Quote:
Originally Posted by Groucho2004 View Post
Not a bad idea. This is pretty easy - Get the full path to fft3dfilter with GetCurrentDirectory() and use a loadlibrary() call with the full path in addition to just "LoadLibrary("libfftw3f-3.dll")".
The proper solution is to use LoadLibraryEx() and altered search paths.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is online now   Reply With Quote
Old 4th September 2017, 12:42   #24  |  Link
Groucho2004
 
Join Date: Mar 2006
Posts: 3,926
Quote:
Originally Posted by Myrsloik View Post
The proper solution is to use LoadLibraryEx() and altered search paths.
Sure. I just have some vague memory about a problem with the LOAD_WITH_ALTERED_SEARCH_PATH flag and WinXP but this goes way back and possibly applied to WinXP pre-SP3.
Groucho2004 is offline   Reply With Quote
Old 4th September 2017, 16:51   #25  |  Link
TheFluff
Excessively jovial fellow
 
Join Date: Jun 2004
Location: rude
Posts: 1,050
Quote:
Originally Posted by stax76 View Post
Thanks, I need automatic loading though for my use case, anything else is suboptimal, now it does xcopy the files to the sys dir which in my opinion is bad practice. I can make a request at pinterf's FFT3DFilter github tracker asking if FFT3DFilter could load the DLLs if they are located in the same dir then FFT3DFilter.
Fix the underlying problem instead. Avs+ actually already does a half-hearted attempt at fixing the issue (plugins depending on other DLL's not finding their dependencies) by temporarily setting the process-wide DLL search directory to the folder it is loading the plugin from, when it does the actual loading. That doesn't help in this case though because FFT3DFilter doesn't actually load its dependency when the DLL itself is loaded, it loads it every time the filter is instantiated (which is really weird and I don't understand why). That's the core issue.

Replacing the Avs+ LoadLibrary call with LoadLibraryEx using LOAD_WITH_ALTERED_SEARCH_PATH might fix the problem without the silly process-wide loading directory juggling if the search order stuff persists for the loaded DLL after LoadLibrary returns, but I have no idea if that is the case. I think I would expect that it doesn't, but I haven't found a satisfactory answer. For whatever reason, VS went with LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR instead.

Quote:
Originally Posted by Groucho2004 View Post
Not a bad idea. This is pretty easy - Get the full path to fft3dfilter with GetCurrentDirectory() and use a loadlibrary() call with the full path in addition to just "LoadLibrary("libfftw3f-3.dll")".
There's nothing that says the current directory is the plugins folder. You can actually get a DLL's own path though using some other mildly exotic win32 API gymnastics (I resorted to it in assrender once upon a time) but it's silly. Don't do that, fix the loading side instead.

Last edited by TheFluff; 4th September 2017 at 16:58.
TheFluff is offline   Reply With Quote
Old 4th September 2017, 17:04   #26  |  Link
Groucho2004
 
Join Date: Mar 2006
Posts: 3,926
Quote:
Originally Posted by TheFluff View Post
There's nothing that says the current directory is the plugins folder.
You're right, brain fart.

This would work to get the fully qualified path to the plugin when called from the plugin (I assume that's what you meant by "You can actually get a DLL's own path though using some other mildly exotic win32 API gymnastics"):

Code:
HMODULE GetCurrentModule()
{
 HMODULE hModule = NULL;
 GetModuleHandleEx(
  GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
  (LPCTSTR)GetCurrentModule,
  &hModule);

 return hModule;
}

HMODULE hm = GetCurrentModule();
char szPath[MAX_PATH + 1];
GetModuleFileName(hm, szPath, MAX_PATH);
Note: No error handling whatsoever in this code ;-)

Last edited by Groucho2004; 4th September 2017 at 17:55.
Groucho2004 is offline   Reply With Quote
Old 4th September 2017, 17:10   #27  |  Link
stax76
staxrip & mpv.net
 
Join Date: Jun 2002
Posts: 5,248
@TheFluff

Not only staxrip loads avs but also the encoders, it might be possible to configure the encoder process, setting working dir or path variable but this would be a great ugly mess I believe, doesn't feel right, I would even consider to examine it.
__________________
I have a dream by Martin Luther King
one hundred years later...
We can never be satisfied...
With this faith...
Let freedom ring...
stax76 is offline   Reply With Quote
Old 4th September 2017, 23:18   #28  |  Link
TheFluff
Excessively jovial fellow
 
Join Date: Jun 2004
Location: rude
Posts: 1,050
Quote:
Originally Posted by Groucho2004 View Post
You're right, brain fart.

This would work to get the fully qualified path to the plugin when called from the plugin (I assume that's what you meant by "You can actually get a DLL's own path though using some other mildly exotic win32 API gymnastics"):
Yes that is what I meant and that looks like it could work. When I did it I added a DllMain entry point (Avisynth plugins don't normally have one because it's not needed, but if it exists it'll get called) for the sole purpose of getting the system to pass me a HINSTANCE (= HMODULE) referring to the DLL itself as its first parameter, which I then passed directly to GetModuleFileName. Whatever works. There are probably more clever ways to do it.

Quote:
Originally Posted by stax76 View Post
@TheFluff

Not only staxrip loads avs but also the encoders, it might be possible to configure the encoder process, setting working dir or path variable but this would be a great ugly mess I believe, doesn't feel right, I would even consider to examine it.
Yes that's what I'm saying, it should be fixed in Avisynth itself. No point in trying to work around it on the client side.
TheFluff is offline   Reply With Quote
Old 5th September 2017, 13:40   #29  |  Link
Groucho2004
 
Join Date: Mar 2006
Posts: 3,926
Quote:
Originally Posted by TheFluff View Post
Yes that is what I meant and that looks like it could work.
It does work, I tested it.

Quote:
Originally Posted by TheFluff View Post
it should be fixed in Avisynth itself. No point in trying to work around it on the client side.
Yes, that makes sense.
Groucho2004 is offline   Reply With Quote
Old 2nd July 2018, 15:27   #30  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 1,042
New build
Download FFT3DFilter 2.5

Code:
Change log
FFT3DFilter v2.5 (20180702)
  - 32bit Float YUV: Chroma center to 0.0 instead of 0.5, to match new Avisynth+ r2728-

FFT3DFilter v2.4 (20170608)
  - some inline asm (not all) ported to simd intrisics, helps speedup x64 mode, but some of them faster also on x86.
  - intrinsics bt=0 
  - intrinsics bt=2, degrid=0, pfactor=0
  - intrinsics bt=3 sharpen=0/1 dehalo=0/1
  - intrinsics bt=3
  - Adaptive MT settings for Avisynth+: MT_SERIALIZED for bt==0 (temporal), MT_MULTI_INSTANCE for others
  - Copy Alpha plane if exists
  - reentrancy checks against bad multithreading usage
    Note: for properly operating in MT_SERIALIZED mode in Avisynth MT, please use Avs+ r2504 or better.

FFT3DFilter v2.3 (20170221)
  - apply current avs+ headers
  - 10-16 bits and 32 bit float colorspace support in AVS+
  - Planar RGB support
  - look for libfftw3f-3.dll first, then fftw3.dll
  - inline asm ignored on x64 builds
  - pre-check: if plane to process for greyscale is U and/or V return original clip
  - auto register MT mode for avs+: MT_SERIALIZED

Previous versions by Fizick and martin53
pinterf is offline   Reply With Quote
Old 2nd July 2018, 23:37   #31  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Germany
Posts: 420
Thank you for this update as well. ^_^
FranceBB is offline   Reply With Quote
Old 5th July 2018, 12:26   #32  |  Link
Zetti
Registered User
 
Join Date: Dec 2015
Location: Denmark
Posts: 149
Quote:
sharpen - sharpening strength (default=0 - not sharpen)
good values about 0.3 to 1.0 (negative values results in reverse effect)
Is value 1.0 the highest or can it be set higher??
Zetti is offline   Reply With Quote
Old 5th July 2018, 12:36   #33  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 6,074
Quote:
Originally Posted by Zetti View Post
Is value 1.0 the highest or can it be set higher??
Perhaps you could try that yourself, and tell us all the result {In ordinary Sharpen(), 1.0 is [I think] the max}.

EDIT: You dont need to bother Pinterf with questions that you could easily verify yourself,
P's time is way more valuable than yours
__________________
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; 5th July 2018 at 12:40.
StainlessS is offline   Reply With Quote
Old 5th July 2018, 13:14   #34  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,312
Quote:
Originally Posted by StainlessS View Post
Perhaps you could try that yourself, and tell us all the result {In ordinary Sharpen(), 1.0 is [I think] the max}.

EDIT: You dont need to bother Pinterf with questions that you could easily verify yourself,
P's time is way more valuable than yours
Please don't tell people what they are allowed to ask or not.
Wilbert is offline   Reply With Quote
Old 26th September 2018, 05:14   #35  |  Link
Kurogane
Registered User
 
Join Date: Jul 2011
Posts: 16
In the end how to load libfftw3f-3.dll?

How to install LoadDll?
Kurogane is offline   Reply With Quote
Old 8th November 2018, 17:56   #36  |  Link
Zetti
Registered User
 
Join Date: Dec 2015
Location: Denmark
Posts: 149
A posible problem with fft3dfilter and fftw lib:

https://forum.doom9.org/showthread.p...44#post1856944
Zetti is offline   Reply With Quote
Old 8th November 2018, 18:21   #37  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 1,042
Perhaps alignment problems. Plus I would check if vzeroupper is properly issued before returning, it won't crash but is performance penalty when returning to an sse2 world. I'll check it.
pinterf is offline   Reply With Quote
Old 8th November 2018, 18:33   #38  |  Link
Groucho2004
 
Join Date: Mar 2006
Posts: 3,926
Quote:
Originally Posted by Zetti View Post
A posible problem with fft3dfilter and fftw lib:

https://forum.doom9.org/showthread.p...44#post1856944
I built FFTW with GCC 8.2 and it works fine with fft3dfilter. There are a number of guidelines here about building fftw with MingW (gcc).

For example:
Quote:
--with-incoming-stack-boundary=2: compile FFTW assuming a 4-byte alignment. On win32, some versions of gcc assume that the stack is 16-byte aligned, but code compiled with other compilers may only guarantee a 4-byte alignment, resulting in mysterious segfaults.

Last edited by Groucho2004; 8th November 2018 at 18:52.
Groucho2004 is offline   Reply With Quote
Old 8th November 2018, 18:40   #39  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 1,042
Checked, no problem on fft3dfilter side, allocations use fftw's own malloc, so this is o.k. Fftw is also checking the alignment and won't use simd code if the alignment is not sufficient.
pinterf is offline   Reply With Quote
Old 17th November 2018, 11:14   #40  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 989
@pinterf would you try to resurrect a new version of FFT3DGPU?
__________________
@turment on Telegram
tormento 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 12:34.


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