View Full Version : vcm a new plugin with many functions
zorr
18th September 2021, 00:07
The documentation for these two filters (F1QClean and F1QLimit) are revised. Please check now.
Still testing these but it's already clear that the latest version gives different results, was that intentional?
Also a small documentation error, minimum allowed span seems to be 3 and not 5. :)
vcmohan
20th September 2021, 14:09
Still testing these but it's already clear that the latest version gives different results, was that intentional? Different in what way? If you run F1Quiver test prior and after to applying these filters you will notice the the changes in freq spectra. If the results are not as expected please inform me. I am forgetting things and do not recall what other changes I might have made.
Also a small documentation error, minimum allowed span seems to be 3 and not 5. :) I will correct it next upload. Thanks for pointing out. I was debating whether to use 3 or 5 as minimum.
zorr
25th September 2021, 18:30
If you run F1Quiver test prior and after to applying these filters you will notice the the changes in freq spectra.
Thanks, is there a way to only show the test display (test=1) without any processing? That would be needed to show before and after differences of F1QLimit. Argument filter is compulsory and cannot be an empty array, also I wasn't able to find a combination of filter settings which don't do any changes.
vcmohan
27th September 2021, 13:50
I probably did not understand clearly. One can compare the unprocessed input and processed output by using StackHorizontal(input, output) If I remember correct in F1Quiver test in test mode custom filter 0,100,512,100 should not do any filtering.
zorr
27th September 2021, 22:36
I probably did not understand clearly. One can compare the unprocessed input and processed output by using StackHorizontal(input, output) If I remember correct in F1Quiver test in test mode custom filter 0,100,512,100 should not do any filtering.
You understood correctly, I needed the filter settings which don't touch the output. However your example doesn't work, there's an error message "F1Quiver: degree the sharpness value of filter pair should be 1 to 12 only". I tried changing the last parameter (the sharpness) to 1 and 12 but the resulting filter does changes in both cases.
By the way I'm testing if there are any changes with
video2 = core.vcm.F1Quiver(video, filter=[0,100,512,1], test=0)
diff = core.std.MakeDiff(video, video2, planes=0)
diff = core.std.Expr(clips=[diff], expr=f"x 128 = 0 255 ?")
diff.set_output()
which will display white where video2 is not identical to video and black where it is.
vcmohan
29th September 2021, 13:56
try with
video2 = core.vcm.F1Quiver(video, filter=[10,100,50,100], test=0, custom = 1)
It will propagate values back and forward. Essentially there should be no filtering. However as all values are converted into floating point and back there can be round off errors and should be minor.
zorr
2nd October 2021, 22:29
try with
video2 = core.vcm.F1Quiver(video, filter=[10,100,50,100], test=0, custom = 1)
Thanks, it works.
So I made a comparison of F1QLimit versions, the settings used were
core.vcm.F1QLimit(video, limit=80, span=7, freqs=[29])
Below you can see the original frame, F1QLimit dated 2021-05-31 and the latest version dated 2021-09-13. It looks like they manipulate the same frequencies but the older version has a much stronger effect.
https://i.postimg.cc/2SCjh66Z/f1quiver-comparison.gif
MysteryX
3rd October 2021, 01:04
Just ran some benchmark on my script.
Script evaluation done in 10.57 seconds
Output 30 frames in 29.24 seconds (1.03 fps)
Filtername Filter mode Time (%) Time (s)
Median parallel 504.36 147.47
Analyse parallel 48.44 14.16
Analyse parallel 47.72 13.95
Analyse parallel 47.69 13.94
Analyse parallel 47.49 13.88
Analyse parallel 46.58 13.62
Analyse parallel 45.95 13.44
KNLMeansCL parreq 43.67 12.77
I'm not happy. vcm.Median is a prefilter to a prefilter to a prefilter, before doing MDegrain analysis. What would be a MUCH faster alternative? Plain Convolution matrix?
Edit: this actually gives me better results than Median
std.Convolution(matrix=[1, 2, 1, 2, 4, 2, 1, 2, 1])
vcmohan
4th October 2021, 13:47
Just ran some benchmark on my script.
Filtername Filter mode Time (%) Time (s)
Median parallel 504.36 147.47
I'm not happy. vcm.Median is a prefilter to a prefilter to a prefilter, before doing MDegrain analysis. What would be a MUCH faster alternative?
[/code]
As mentioned in the description of vcm.Median
starting value of grid is 3 i.e. 3x3 pixels.
Compute max, min and median of the grid
1. if median is more than minimum and less than maximium:-
if the grid center value is greater than minimum and less than maximum,the value is not changed
Otherwise center value of grid is replaced by median.
2 else:-
if grid size is less than maxgrid, it is increased to next step and process repeated.
Otherwise center value is unchanged.
As per theory
Quote "Ordinary median filters perform well as long as the spatial density of impulsive noise is small. Adaptive Median filter can handle impulsive noise having larger probability. An additional benefit is this seeks to preserve detail while smoothing non impulse noise something that the traditional median filter does not do.
The algorithm described has three purposes.
1.To remove salt and pepper (impulse) noise.
2.To smooth other noise which may not be impulsive
3.To reduce distortion such as excessive thinning or thickening of object boundaries.
" unquote
It will be slow depending on the type and intensity of noise present.
I will look into the code again and see if I can improve speed.
MysteryX
4th October 2021, 16:31
Thanks, it helps to know what it's supposed to do to put it at the right place.
With 4K/5K videos, I actually have that problem where the noise is only removed locally (stabilized) but larger visible grain patterns are very hard to address.
You could test with this short 5K clip (https://drive.google.com/file/d/1SL-n7pzLZShcg0D9sCYsGrMntKh7J3J3/view?usp=sharing)
Here's another one with more severe noise (https://drive.google.com/file/d/1vo1ntJlTqWG2uhxiXqOsvqikIgEgJzHF/view?usp=sharing)
With Median at the start of the denoising on the first clip, I'm seeing a slight improvement with Median(maxgrid=9)... but not really with maxgrid=5. Could be useful if it wasn't such a performance pit.
vcmohan
5th October 2021, 14:02
I am using the C++ algorithm in place std:sort to get median. May be I need to use an assembly version? I am not at all conversant with assembler coding, though I started my coding career in 1970 with an assembler on a 16 bit machine. The 9X9 grid size limit was set arbitrarily. I can increase if required, but the performance will further deteriorate, I am afraid.
MysteryX
5th October 2021, 16:23
I am using the C++ algorithm in place std:sort to get median. May be I need to use an assembly version? I am not at all conversant with assembler coding, though I started my coding career in 1970 with an assembler on a 16 bit machine. The 9X9 grid size limit was set arbitrarily. I can increase if required, but the performance will further deteriorate, I am afraid.
Same -- I can write code in C++, but can't do assembly version.
Video processing without assembly optimization, however, can't scale at all. It needs to process packs of 32 values with a single command to scale up. Not sure if all tasks can be optimized in such a way.
Assembly takes a long time to learn. The best is to have someone proficient with assembly to look at it.
There are 3 types of coders in the community
1. Scripters (who know how to use and match all the filters)
2. Coders (who can write C++ plugins)
3. Assembly guys (who can write assembly)
Both of us are #2... very few #3 out there.
MysteryX
5th October 2021, 17:14
I tried it on 5K clip with various grid sizes. With maxgrid=9, there's a definite softening of large-scale noise without noticeable degradation of image clarity. Not much with grid 7 or 5.
Could you give me a version with the limit removed so that I can test what level gives optimal results? In case performance gets optimized.
Performance-wise, simple Median runs at 4fps with maxgrix=5 and 2.9fps with maxgrid=9. Bad, but not huge difference.
Yomiko
5th October 2021, 23:16
There are constant-time median filters fyr
https://github.com/HomeOfVapourSynthEvolution/VapourSynth-CTMF
https://github.com/4re/vapoursynth-cmedian
MysteryX
6th October 2021, 02:39
There are constant-time median filters fyr
https://github.com/HomeOfVapourSynthEvolution/VapourSynth-CTMF
https://github.com/4re/vapoursynth-cmedian
This gives a very strong blur effect. Not the same thing at all.
Running Median(maxgrid=9) before the denoising chain does give a very tiny improvement overall -- just not worth the performance cost. I wonder if maxgrid of 11 or 13 would give more improvement.
vcmohan
6th October 2021, 14:10
The best is to have someone proficient with assembly to look at it.
When I started coding in C++ for avisynth 2.5 years back, I was encouraged to post my source code with the idea that some kind soul may improve performance by changes as well as catch bugs. Users of course catch bugs, but thats it.
MysteryX
6th October 2021, 19:27
Ya. My experience with Open Source, nobody touches anything of it either. But one kind soul did go through some of my code to add some assembly optimization.
sl1pkn07
7th October 2021, 16:00
the hope never lose
https://github.com/AmusementClub/vcm
this guys include linux support :D
greetings
vcmohan
8th October 2021, 14:02
Thanks for the link. Never knew that this was happening.
MysteryX
8th October 2021, 15:14
He could have done a pull request; or you can merge back his changes manually.
btw if you had Avisynth plugins before, why aren't you developing your new plugins to be compatible in both VapourSynth and Avisynth? It's not harder to make it cross-platform compatible. In fact it helps with clearer separation between engine-management and actual processing code.
vcmohan
11th October 2021, 14:11
He could have done a pull request; or you can merge back his changes manually.
btw if you had Avisynth plugins before, why aren't you developing your new plugins to be compatible in both VapourSynth and Avisynth? It's not harder to make it cross-platform compatible. In fact it helps with clearer separation between engine-management and actual processing code. Is this for me ?
In avisynth, I need to code specially for compat formats. The 'new' call is allowed. Also I need not specially free unused frames. In error messages I can format. All this makes difference apart from various other calls. I usually code for avisynth+, debug using ThrowError and then recode for vapoursynth. Many times I get new ideas during conversion and go back and forth. Its a bit drudgery to remember all calls and requirements of each platform but possibly worth it. I do not want to use too many compiler instructions #if and #endif to keep my sanity. Otherwise vapoursynth I beleive, can load avisynth plugins direct. I like some aspects in each of the platforms.
MysteryX
11th October 2021, 15:09
Look at the way I did it here. (https://github.com/mysteryx93/FrameRateConverter/tree/master/Src) I created a "Environments" folder that I can copy/paste into new project that handles all these discrepancies. Common folder contains shared code logic. Then the Avisynth and VapourSynth code branches are very simple.
vcmohan
12th October 2021, 14:44
I am not using GITHUB. When I first tried to register for it it wanted two stage identification for which it appears I need to install some other app. Microsoft app , as I understood, once I install it will require for every other authentication like my bank or gmail, wants to do two stage authentification. I am putoff by this.
You are using some unix app diff to add or remove some lines in the common code folder. As I am on windows 10 I do not have that facility.
This is what I understood. Please correct me if I am wrong.
MysteryX
12th October 2021, 17:14
Dunno what you're talking about... I'm using Visual Studio in Windows 10, and don't have 2-factor authentication on GitHub.
ChaosKing
12th October 2021, 18:11
I am not using GITHUB. When I first tried to register for it it wanted two stage identification for which it appears I need to install some other app. Microsoft app , as I understood, once I install it will require for every other authentication like my bank or gmail, wants to do two stage authentification. I am putoff by this.
You are using some unix app diff to add or remove some lines in the common code folder. As I am on windows 10 I do not have that facility.
This is what I understood. Please correct me if I am wrong.
You don't need a Microsoft app for that. 2 factor auth is optional.
Winmerge is great tool on windows for file diffs.
Best git gui is GitKraken in my opinion (diff included). It's free for open source repos.
MysteryX
12th October 2021, 20:22
I use TortoiseGit and do everything from Explorer without needing to open an app (mostly pull or commit & push, occasional history).
I'll give GitKraken a try.
vcmohan
13th October 2021, 13:56
OK. Thanks. I will try after a few days as right now I am doing something else. I tried a different method to get median in place of c++ sort. But it turned out 3 times slower. So I gave that up.
DJATOM
13th October 2021, 14:41
I'm also using TortoiseGit for some quick stuff, otherwise git CLI or Sourcetree.
vcmohan
1st November 2021, 13:45
I have rewritten deBarrel function.Now it has 2 methods of correction and fast execution. Fish Eye function has also been redone for efficiency and for all formats of input.
vcmohan
6th November 2021, 08:30
@MysteryX was disappointed at the slow speed of my median function. I have now (I think) speeded it somewhat. As I changed some methods may please check new verion of vcm plugin and check for speed as well as quality. The max grid can be up to 11 now.
If it is satisfactory, I will retain it and release new code else I will revert back to older version.
sl1pkn07
13th December 2021, 18:02
Hi. accordig by this, new version have missing sources
https://github.com/AmusementClub/vcm/issues/1
greetings
vcmohan
15th December 2021, 12:30
Sorry for missing files. I have uploaded the two missing files as part of vcm_src. compressed file on to my plugin page. I hope this will be used to update the github
ChaosKing
15th December 2021, 12:55
Thx.
Btw this here is a 1:1 copy of your zip archive (so that vsrepo has a stable download link :D) https://github.com/Vapoursynth-Plugins-Gitify/vcm
And this repo has some patches (mostly for linux I think) https://github.com/AmusementClub/vcm
ChaosKing
9th January 2022, 12:58
Seems like Circles.cpp is missing in vcm_source.7z
../vcm.cpp:82:10: fatal error: Circles.cpp: No such file or directory
82 | #include "Circles.cpp"
| ^~~~~~~~~~~~~
vcmohan
10th January 2022, 13:07
Thanks for pointing out. Uploaded new src zip file.
ChaosKing
14th January 2022, 10:50
Compilation seems still not possible:
https://github.com/AmusementClub/vcm/issues/1#issuecomment-1012727843
- Circles.cpp: missing definition of BGR8_YUV (this is the sole usage of the identifier)
- Fisheye.cpp, FisheyePart.cpp, moveDeBarrel.cpp: missing definitions of setInterpolationScheme and bestOfNineIndex
- FourFoldSymmetricMarking.h: calls to LaQuantile provides 7 arguments, the only known implementation in interpolationMethods.h only requires 6.
- Missing definition for f2qsharpCreate, f2qsharpCreate, and f2qcorrCreate. (likely missing source file?)
vcmohan
14th January 2022, 13:20
Strange. On my PC I am able to compile with same set of files. I have once again uploaded the src zip file to be safe. Are you sure that you are not using older vcm.cpp file?
ChaosKing
14th January 2022, 16:20
I think I made an error, I replaced all files but have not deleted any of the removed files.
ChaosKing
6th February 2022, 21:03
There are still problems with the source files. For example where is the function definition for bestOfNineIndex() located?
Fisheye.cpp, FisheyePart.cpp and moveDeBarrel.cpp are calling this function but I can't find it in the source zip.
Is this the correct link for the source? http://www.avisynth.nl/users/vcmohan/vcm/vcm_src.7z
vcmohan
9th February 2022, 12:24
Its in the InterpolationMethods.h. I find the updated src zip file was having the old version of this. I updated it now. Sorry, it seems I am giving you endless problems. The way I organized the file structure on my computer probably is not optimum.
ChaosKing
9th February 2022, 13:33
We are getting closer 2/4 fixed (I hope) :D
- Circles.cpp: missing definition of BGR8_YUV (this is the sole usage of the identifier)
- [x] Fisheye.cpp, FisheyePart.cpp, moveDeBarrel.cpp: missing definitions of setInterpolationScheme and bestOfNineIndex
- [x] FourFoldSymmetricMarking.h: calls to LaQuantile provides 7 arguments, the only known implementation in interpolationMethods.h only requires 6.
- Missing definition for f2qsharpCreate, f2qsharpCreate, and f2qcorrCreate. (likely missing source file?)
Could you check also for BGR8_YUV() and f2qsharpCreate, f2qsharpCreate, and f2qcorrCreate
vcmohan
10th February 2022, 13:15
Hopefully all issues resolve in this new upload. Many thanks for your patience.
ChaosKing
11th February 2022, 09:30
Thank you for the update, but I still have some work for you :D
LaQuantile function defined in https://github.com/Vapoursynth-Plugins-Gitify/vcm/blob/3c99e8736092d8dea440114d8e8b3f66562bb9d2/interpolationMethods.h#L56
requires 7 parameters,
but some callers only pass 6 arguments: https://github.com/Vapoursynth-Plugins-Gitify/vcm/blob/3c99e8736092d8dea440114d8e8b3f66562bb9d2/FisheyePart.cpp#L331
https://github.com/Vapoursynth-Plugins-Gitify/vcm/blob/3c99e8736092d8dea440114d8e8b3f66562bb9d2/vcm.cpp#L137
references undefined function f2qblurCreate.
vcmohan
11th February 2022, 12:51
May be the new update done today will solve the problems. I found two files were old and needed new versions. Hopeful now.
ChaosKing
10th March 2022, 11:37
Just wanted to report that it compiles again! :thanks:
https://github.com/AmusementClub/vcm/actions
vcmohan
10th March 2022, 12:56
thanks. relieved.
Julek
30th March 2022, 15:58
I'm having problems with Amp:
https://github.com/AmusementClub/vcm/issues/3
vcmohan
31st March 2022, 13:54
Thanks for pointing out. The bug was caused by a typo. Please check the uploaded newer version.
Efenstor
11th May 2023, 15:43
@vcmohan: Thank you so much for supporting these plugins, after all these years! They are truly irreplaceable and can do magic in the right hands.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.