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. |
14th January 2018, 20:06 | #1 | Link |
Professional Code Monkey
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,581
|
FFT3DFilter - The Portening
Some people asked for fft3dfilter builds so I improved the existing port a bit. Now supports 8-16 bit integer and float formats. Also cleaned up the code quite a bit (something started by VFR-maniac in the initial port). The only difference in arguments is that plane was changed to planes and now works like the plane selection usually does in VS filters.
Fixed/improved stuff (relative to original VS version): 8-16 bit and float support Piles of memory leaks fixed if there's an error on creation, for example invalid arguments would cause this a lot Fixed beyond array bounds memory access Improved internal cache to better handle not completely linear access Known issues: In really rare conditions the default for the bw and bh arguments that depend on whether one or many planes are processed can get confused pshow and pfactor related things are completely untested Test3
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet Last edited by Myrsloik; 17th January 2018 at 21:16. |
15th January 2018, 19:23 | #3 | Link |
Registered User
Join Date: Jan 2016
Posts: 98
|
I made some visual inspection of results of the filter using vsedit. I tested different bit-depths: 8,10,16 bits and chroma sub-samplings: 444, 422, 420
I got the expected results for different values supplied to the parameters (separately and combined): sigma, sigma2, sigma3, sigma4, dehalo and sharpen several instances of the filter in the same script - no problem!: I remember avisynth-MT (SEt's avisynth mod) crashing because of this. Didn't test for speed yet, but tried ncpu=2, without problems. I remember this crashed avisynth-MT (SEt's avisynth mod). Is ncpu still relevant? Usage Suggestions:
|
15th January 2018, 19:49 | #4 | Link | |
Professional Code Monkey
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,581
|
Quote:
You can still use ncpu but you probably shouldn't. At least not unless fft3dfilter is the single thing bottlenecking your whole script... The default argument changes I have no idea about, I'll do them if more people agree.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet |
|
16th January 2018, 16:20 | #6 | Link |
Professional Code Monkey
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,581
|
I actually thought about scaling of arguments but doing so would actually be counter-intuitive for anyone who understands the underlying concepts. So I don't like that idea.
I updated the download link so now the planes argument works like it should. The part I'm not sure about working now is pshow and pfactor. It just seems odd to me but not sure what the original does. I'll leave it for you to investigate... Note that text printing only looks correct in 8 bit, mangled in 16bit and derp in float. It's a known issue. I'm also curious about speed comparisons with pinterf's version. Does all that asm really help?
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet |
16th January 2018, 16:40 | #7 | Link | |
Registered User
Join Date: Jan 2014
Posts: 2,322
|
Quote:
Code:
// bt=0 // x64 C -> simd: 10.24 -> 11.41 fps // x86 C -> simd: 8.38 -> 9.86 fps ApplyKalman_SSE2_simd // bt=2, degrid=0, pfactor=0 // SSE2 x64 C -> simd: 11.37 -> 13.26 fps ApplyWiener3D2_SSE_simd |
|
17th January 2018, 21:18 | #8 | Link |
Professional Code Monkey
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,581
|
Test3 (link in first post)
Now the info printing works properly and did a bit more code cleanup. 4re updated the build system too. I really need some pshow and pfactor testing and then this thing is done. I guess...
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet |
18th January 2018, 19:39 | #9 | Link | |
Registered User
Join Date: Jan 2016
Posts: 98
|
Quote:
Other than that, pshow and pfactor seem to work as intended (very similar to the old avisynth version 2.1.1, and newer v2.4)
Last edited by VS_Fan; 18th January 2018 at 22:17. |
|
18th January 2018, 21:22 | #10 | Link |
Registered User
Join Date: Jan 2016
Posts: 98
|
I can process every plane individually using different sigmas with a new instance of the filter for every plane.
So I tested both avisynth versions: 2.1.1 and 2.4. This led me to understand a problem present in every version of the fft3dfilter, v2.1.1 and 2.4 for avisynth and your test #3 for vapoursynth: Chroma subsampling affects size and position of the pattern block on chroma planes. Px and py parameters need to be different. The only way you get the same size and position for the pattern block on all the planes is when there’s no chroma subsampling: 4:4:4 So, if your video uses chroma subsampling, to use fft3dfilter with the “noise pattern method” (pshow, pfactor et al) working correctly in any version of the filter, you need to process every plane individually, taking care of the different px and py values. Additionally, by processing the planes individually, you can use different sigma(s) values for each plane! |
18th January 2018, 21:28 | #11 | Link | |
Professional Code Monkey
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,581
|
Quote:
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet |
|
18th January 2018, 22:13 | #12 | Link |
Registered User
Join Date: Jan 2016
Posts: 98
|
Questions remaining:
Last edited by VS_Fan; 18th January 2018 at 22:16. |
18th January 2018, 22:32 | #13 | Link | |
Professional Code Monkey
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,581
|
Quote:
Yes, it only uses the block in pframe. I guess pshow shows the current frame block's sigma to make determining the pframe argument faster. It almost feels lile the sigma and pframe stuff would do better split out as a separate function. Somehow. Not sure.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet |
|
19th January 2018, 13:12 | #14 | Link |
Registered User
Join Date: Jun 2015
Posts: 33
|
Hello, I'm having troubles compiling this one, any idea about the reason? Here's the original issue https://github.com/4re/vapoursynth-portage/issues/71, by the way.
Here's the build log Code:
meson --buildtype plain --libdir lib64 --localstatedir /var/lib --prefix /usr --sysconfdir /etc --wrap-mode nodownload /tmp/portage/media-plugins/vapoursynth-fft3dfilter-0.20180118/work/vapoursynth-fft3dfilter-0.20180118 /tmp/portage/media-plugins/vapoursynth-fft3dfilter-0.20180118/work/vapoursynth-fft3dfilter-0.20180118-build The Meson build system Version: 0.43.0 Source dir: /tmp/portage/media-plugins/vapoursynth-fft3dfilter-0.20180118/work/vapoursynth-fft3dfilter-0.20180118 Build dir: /tmp/portage/media-plugins/vapoursynth-fft3dfilter-0.20180118/work/vapoursynth-fft3dfilter-0.20180118-build Build type: native build Project name: FFT3DFilter Native C++ compiler: x86_64-pc-linux-gnu-g++ (gcc 6.4.0) Appending CXXFLAGS from environment: '-O3 -march=native -pipe' Appending LDFLAGS from environment: '-Wl,-O1 -Wl,--as-needed' Build machine cpu family: x86_64 Build machine cpu: x86_64 Found pkg-config: /usr/bin/x86_64-pc-linux-gnu-pkg-config (0.29.2) Native dependency vapoursynth found: YES 42 Native dependency fftw3f_threads found: YES 3.3.6-pl2 Build targets in project: 1 Found ninja-1.8.2 at /usr/bin/ninja >>> Source configured. >>> Compiling source in /tmp/portage/media-plugins/vapoursynth-fft3dfilter-0.20180118/work/vapoursynth-fft3dfilter-0.20180118 ... ninja -v -j8 -l8 -C /tmp/portage/media-plugins/vapoursynth-fft3dfilter-0.20180118/work/vapoursynth-fft3dfilter-0.20180118-build ninja: Entering directory `/tmp/portage/media-plugins/vapoursynth-fft3dfilter-0.20180118/work/vapoursynth-fft3dfilter-0.20180118-build' [1/4] x86_64-pc-linux-gnu-g++ -Ifft3dfilter@sha -I. -I../vapoursynth-fft3dfilter-0.20180118 -I/usr/include/vapoursynth -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -std=c++1z -O3 -march=native -fPIC -MMD -MQ 'fft3dfilter@sha/Plugin.cpp.o' -MF 'fft3dfilter@sha/Plugin.cpp.o.d' -o 'fft3dfilter@sha/Plugin.cpp.o' -c ../vapoursynth-fft3dfilter-0.20180118/Plugin.cpp [2/4] x86_64-pc-linux-gnu-g++ -Ifft3dfilter@sha -I. -I../vapoursynth-fft3dfilter-0.20180118 -I/usr/include/vapoursynth -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -std=c++1z -O3 -march=native -fPIC -MMD -MQ 'fft3dfilter@sha/FFT3DFilter.cpp.o' -MF 'fft3dfilter@sha/FFT3DFilter.cpp.o.d' -o 'fft3dfilter@sha/FFT3DFilter.cpp.o' -c ../vapoursynth-fft3dfilter-0.20180118/FFT3DFilter.cpp FAILED: fft3dfilter@sha/FFT3DFilter.cpp.o x86_64-pc-linux-gnu-g++ -Ifft3dfilter@sha -I. -I../vapoursynth-fft3dfilter-0.20180118 -I/usr/include/vapoursynth -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -std=c++1z -O3 -march=native -fPIC -MMD -MQ 'fft3dfilter@sha/FFT3DFilter.cpp.o' -MF 'fft3dfilter@sha/FFT3DFilter.cpp.o.d' -o 'fft3dfilter@sha/FFT3DFilter.cpp.o' -c ../vapoursynth-fft3dfilter-0.20180118/FFT3DFilter.cpp ../vapoursynth-fft3dfilter-0.20180118/FFT3DFilter.cpp: In member function ‘void FFT3DFilter::DecodeOverlapPlane(const float*, float, T*, int, int, int)’: ../vapoursynth-fft3dfilter-0.20180118/FFT3DFilter.cpp:880:20: error: expected ‘(’ before ‘constexpr’ if constexpr (std::is_integral<T>::value) ^~~~~~~~~ ../vapoursynth-fft3dfilter-0.20180118/FFT3DFilter.cpp:882:17: error: ‘else’ without a previous ‘if’ else ^~~~ ../vapoursynth-fft3dfilter-0.20180118/FFT3DFilter.cpp:891:24: error: expected ‘(’ before ‘constexpr’ if constexpr (std::is_integral<T>::value) ^~~~~~~~~ ../vapoursynth-fft3dfilter-0.20180118/FFT3DFilter.cpp:893:21: error: ‘else’ without a previous ‘if’ else ^~~~ ../vapoursynth-fft3dfilter-0.20180118/FFT3DFilter.cpp:900:24: error: expected ‘(’ before ‘constexpr’ if constexpr (std::is_integral<T>::value) ^~~~~~~~~ ../vapoursynth-fft3dfilter-0.20180118/FFT3DFilter.cpp:902:21: error: ‘else’ without a previous ‘if’ else ^~~~ ../vapoursynth-fft3dfilter-0.20180118/FFT3DFilter.cpp:910:20: error: expected ‘(’ before ‘constexpr’ if constexpr (std::is_integral<T>::value) ^~~~~~~~~ ../vapoursynth-fft3dfilter-0.20180118/FFT3DFilter.cpp:912:17: error: ‘else’ without a previous ‘if’ else ^~~~ ../vapoursynth-fft3dfilter-0.20180118/FFT3DFilter.cpp:933:20: error: expected ‘(’ before ‘constexpr’ if constexpr (std::is_integral<T>::value) ^~~~~~~~~ ../vapoursynth-fft3dfilter-0.20180118/FFT3DFilter.cpp:935:17: error: ‘else’ without a previous ‘if’ else ^~~~ ../vapoursynth-fft3dfilter-0.20180118/FFT3DFilter.cpp:944:24: error: expected ‘(’ before ‘constexpr’ if constexpr (std::is_integral<T>::value) ^~~~~~~~~ ../vapoursynth-fft3dfilter-0.20180118/FFT3DFilter.cpp:947:21: error: ‘else’ without a previous ‘if’ else ^~~~ ../vapoursynth-fft3dfilter-0.20180118/FFT3DFilter.cpp:955:24: error: expected ‘(’ before ‘constexpr’ if constexpr (std::is_integral<T>::value) ^~~~~~~~~ ../vapoursynth-fft3dfilter-0.20180118/FFT3DFilter.cpp:957:21: error: ‘else’ without a previous ‘if’ else ^~~~ ../vapoursynth-fft3dfilter-0.20180118/FFT3DFilter.cpp:965:20: error: expected ‘(’ before ‘constexpr’ if constexpr (std::is_integral<T>::value) ^~~~~~~~~ ../vapoursynth-fft3dfilter-0.20180118/FFT3DFilter.cpp:967:17: error: ‘else’ without a previous ‘if’ else ^~~~ ../vapoursynth-fft3dfilter-0.20180118/FFT3DFilter.cpp:981:20: error: expected ‘(’ before ‘constexpr’ if constexpr (std::is_integral<T>::value) ^~~~~~~~~ ../vapoursynth-fft3dfilter-0.20180118/FFT3DFilter.cpp:983:17: error: ‘else’ without a previous ‘if’ else ^~~~ ../vapoursynth-fft3dfilter-0.20180118/FFT3DFilter.cpp:992:24: error: expected ‘(’ before ‘constexpr’ if constexpr (std::is_integral<T>::value) ^~~~~~~~~ ../vapoursynth-fft3dfilter-0.20180118/FFT3DFilter.cpp:994:21: error: ‘else’ without a previous ‘if’ else ^~~~ ../vapoursynth-fft3dfilter-0.20180118/FFT3DFilter.cpp:1001:24: error: expected ‘(’ before ‘constexpr’ if constexpr (std::is_integral<T>::value) ^~~~~~~~~ ../vapoursynth-fft3dfilter-0.20180118/FFT3DFilter.cpp:1003:21: error: ‘else’ without a previous ‘if’ else ^~~~ ../vapoursynth-fft3dfilter-0.20180118/FFT3DFilter.cpp:1011:20: error: expected ‘(’ before ‘constexpr’ if constexpr (std::is_integral<T>::value) ^~~~~~~~~ ../vapoursynth-fft3dfilter-0.20180118/FFT3DFilter.cpp:1013:17: error: ‘else’ without a previous ‘if’ else ^~~~ ../vapoursynth-fft3dfilter-0.20180118/FFT3DFilter.cpp:1030:20: error: expected ‘(’ before ‘constexpr’ if constexpr (std::is_integral<T>::value) ^~~~~~~~~ ../vapoursynth-fft3dfilter-0.20180118/FFT3DFilter.cpp:1032:17: error: ‘else’ without a previous ‘if’ else ^~~~ ../vapoursynth-fft3dfilter-0.20180118/FFT3DFilter.cpp:1041:24: error: expected ‘(’ before ‘constexpr’ if constexpr (std::is_integral<T>::value) ^~~~~~~~~ ../vapoursynth-fft3dfilter-0.20180118/FFT3DFilter.cpp:1043:21: error: ‘else’ without a previous ‘if’ else ^~~~ ../vapoursynth-fft3dfilter-0.20180118/FFT3DFilter.cpp:1050:24: error: expected ‘(’ before ‘constexpr’ if constexpr (std::is_integral<T>::value) ^~~~~~~~~ ../vapoursynth-fft3dfilter-0.20180118/FFT3DFilter.cpp:1052:21: error: ‘else’ without a previous ‘if’ else ^~~~ ../vapoursynth-fft3dfilter-0.20180118/FFT3DFilter.cpp:1060:20: error: expected ‘(’ before ‘constexpr’ if constexpr (std::is_integral<T>::value) ^~~~~~~~~ ../vapoursynth-fft3dfilter-0.20180118/FFT3DFilter.cpp:1062:17: error: ‘else’ without a previous ‘if’ else ^~~~ [3/4] x86_64-pc-linux-gnu-g++ -Ifft3dfilter@sha -I. -I../vapoursynth-fft3dfilter-0.20180118 -I/usr/include/vapoursynth -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -std=c++1z -O3 -march=native -fPIC -MMD -MQ 'fft3dfilter@sha/fft3dfilter_c.cpp.o' -MF 'fft3dfilter@sha/fft3dfilter_c.cpp.o.d' -o 'fft3dfilter@sha/fft3dfilter_c.cpp.o' -c ../vapoursynth-fft3dfilter-0.20180118/fft3dfilter_c.cpp ninja: build stopped: subcommand failed. Last edited by Q3CPMA; 19th January 2018 at 13:20. Reason: more info |
19th January 2018, 13:14 | #15 | Link |
Professional Code Monkey
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,581
|
Your compiler only pretends to know c++17. It's too old gcc.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet |
21st January 2018, 13:49 | #17 | Link |
Professional Code Monkey
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,581
|
I've added the only improvements I can think of and what I currently consider to be bugs. Would be nice if someone helped with updating the documentation too. I'll only do the enhancement marked items if there's demand for it.
https://github.com/myrsloik/VapourSy...DFilter/issues
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet |
18th February 2018, 00:00 | #18 | Link |
Registered User
Join Date: Sep 2006
Posts: 1,657
|
I'm trying to apply the filter on an png image, and it turned the image into large pixels.
Code:
img = core.imwrif.Read(r'001.png') img = core.fft3dfilter.FFT3DFilter(img, sigma=1) Last edited by lansing; 18th February 2018 at 00:09. |
18th February 2018, 13:08 | #19 | Link |
Registered User
Join Date: Oct 2001
Location: Germany
Posts: 7,423
|
@lansing: works fine here when loading an image sequence:
Code:
# Imports import vapoursynth as vs core = vs.get_core() import ctypes # Loading Support Files Dllref = ctypes.windll.LoadLibrary("G:/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll") # Loading Plugins core.std.LoadPlugin(path="G:/Hybrid/64bit/vsfilters/DenoiseFilter/FFT3DFilter/vsfft3dfilter.dll") core.std.LoadPlugin(path="G:/Hybrid/64bit/vsfilters/SourceFilter/Imagemagick/libimwri.dll") # Loading H:\sequence\ED-360-png\%05d.png using vsImageReader clip = core.imwri.Read("H:/sequence/ED-360-png/%05d.png", firstnum=1) clip = core.std.Trim(clip=clip, length=15691) # making sure frame rate is set to 25 clip = core.std.AssumeFPS(clip, fpsnum=25, fpsden=1) # Making sure input color range is set to PC (full) range. clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=0) # denoising using FFT3DFilter clip = core.fft3dfilter.FFT3DFilter(clip=clip, sigma=1.00) # adjusting output color from: RGB24 to YUV420P10 for x265Model (i420) clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="470bg") # Output clip.set_output() Code:
# Imports import vapoursynth as vs core = vs.get_core() import ctypes # Loading Support Files Dllref = ctypes.windll.LoadLibrary("G:/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll") # Loading Plugins core.std.LoadPlugin(path="G:/Hybrid/64bit/vsfilters/DenoiseFilter/FFT3DFilter/vsfft3dfilter.dll") core.std.LoadPlugin(path="G:/Hybrid/64bit/vsfilters/SourceFilter/Imagemagick/libimwri.dll") # Loading H:\sequence\ED-360-png\%05d.png using vsImageReader clip = core.imwri.Read("H:/sequence/ED-360-png/00001.png", firstnum=1) # denoising using FFT3DFilter clip = core.fft3dfilter.FFT3DFilter(clip=clip, sigma=1.00) # adjusting output color from: RGB24 to YUV420P10 for x265Model (i420) clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="470bg") # Output clip.set_output() Ps.: I use the portable version which is why I need to load the libraries manually. |
18th February 2018, 15:28 | #20 | Link |
Professional Code Monkey
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,581
|
You don't need to load it manually. Just put it all in the plugins64 subdir.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet |
Thread Tools | Search this Thread |
Display Modes | |
|
|