Log in

View Full Version : AVISynth minideen() x64 request


Pages : [1] 2

SaurusX
27th June 2019, 20:26
In order to use my preferred derainbowing method, using DFMDerainbow, I need an x64 version of deen(). A version of deen that only involves the "a2d" method used in DFMDerainbow was ported to VapourSynth and called minideen.

https://github.com/dubhater/vapoursynth-minideen

Is it too much to ask that this minideen be ported to AVISynth as a 64-bit filter? I'm sure it would be appreciated by others as well.

MeteorRain
8th July 2019, 02:55
Please try and let me know.

MiniDeen(radius=1, thrY=10, thrUV=12, y=3 or 2 or 1, u=3 or 2 or 1, v=3 or 2 or 1)

Source code: https://github.com/HomeOfAviSynthPlusEvolution/MiniDeen

SaurusX
9th July 2019, 03:28
This works great! Thanks so much for going through the trouble. It seems to work just slightly better than DFMDerainbow with the original deen() if that makes sense.

I plugged minideen into the DFMDerainbow script by replacing the deen calls with minideen like so:


fixed_u=org_u.FluxSmoothST(17,14).FluxSmoothT(17).Deen("a2d",4,14,14).Blur(1.0)
fixed_v=org_v.FluxSmoothST(17,14).FluxSmoothT(17).Deen("a2d",4,14,14).Blur(1.0)


fixed_u=org_u.FluxSmoothST(17,14).FluxSmoothT(17).minideen(4,14,14).Blur(1.0)
fixed_v=org_v.FluxSmoothST(17,14).FluxSmoothT(17).minideen(4,14,14).Blur(1.0)

And now, I use DFMDerainbow with the masked and motion compensated routine from the MVTools guide like so:
prerb = last
derbmask = last.tedgemask(threshY=7).mt_deflate()
prefiltered = last.FFT3Dfilter(sigma=1.5,bw=16,bh=16,bt=3,ow=8,oh=8,plane=0)
derbsuperfilt = MSuper(prefiltered) # all levels for MAnalyse
derbsuper = MSuper(levels=1) # one level is enough for MCompensate
derbbackward_vectors = MAnalyse(derbsuperfilt, truemotion = true, isb = true, chroma=false)
derbforward_vectors = MAnalyse(derbsuperfilt, truemotion = true, isb = false, chroma=false)
# use not-prefiltered (super) clip for motion compensation
derbforward_compensation = MCompensate(derbsuper, derbforward_vectors)
derbbackward_compensation = MCompensate(derbsuper, derbbackward_vectors)
# create interleaved 3 frames sequences
interleave(derbforward_compensation,last,derbbackward_compensation)
dfmderainbow(maskthresh=8)
selectevery(3,1) # return filtered central (not-compensated) frames only
mt_merge(prerb,last, derbmask,luma=true)

And here are the results:

Routine without DFMDeRainbow and instead using old Derainbow(), notice the hand.
http://i.ibb.co/v1F6NFr/2-Derainbow.png

Rotuine with DFMDerainbow and x86 deen()
http://i.ibb.co/Jy6JVBb/2-x86-DFMDerainbow.png

Routine with DFMDerainbow and new x64 minideen(). The same!
http://i.ibb.co/qyWQCJV/2-x64-DFMDerainbow.png

And here's another comparison with a closeup:

Original raw (https://i.ibb.co/BCW4bMm/1-Orig.png)
x86 deen() (https://i.ibb.co/4PvkWDw/1-x86.png)
x64 minideen() (https://i.ibb.co/qrF2csk/1-x64.png)

MeteorRain
9th July 2019, 03:44
You are very welcome.
The source code was very easy to work with, so it didn't take me long.
I'll organize the source code and put it onto GitHub soon.

MeteorRain
9th July 2019, 04:08
On the other hand, You can use u=1, v=1 to skip processing the UV plane.
Or make use of plane processing and combine some operations, if possible.

SaurusX
10th July 2019, 19:46
On the other hand, You can use u=1, v=1 to skip processing the UV plane.
Or make use of plane processing and combine some operations, if possible.

I'm looking at this from the position of derainbowing. Don't we need to process chroma to handle the chroma cross-talk of the rainbows? And I don't know what you mean in your second statement. But anything to make DFMDerainbow more efficient or more effective would be welcome.

MeteorRain
10th July 2019, 20:48
fixed_u=org_u.FluxSmoothST(17,14).FluxSmoothT(17).minideen(4,14,14).Blur(1.0)
fixed_v=org_v.FluxSmoothST(17,14).FluxSmoothT(17).minideen(4,14,14).Blur(1.0)

You see, u and v were extracted from origin, so they only have Y channel valid.
By saying minideen(4,14,14) which implies processing all planes (including valid Y, garbage U, garbage V), you are wasting your precious time.

What I was saying, is either adding u=1, v=1 to skip processing the garbage UV plane, or,
maybe check if you can modify the whole DFMDerainbow script to process 3 channels in one shot.

I didn't look deep into it, so just my 2 cents.

SaurusX
10th July 2019, 21:13
What I was saying, is either adding u=1, v=1 to skip processing the garbage UV plane, or,
maybe check if you can modify the whole DFMDerainbow script to process 3 channels in one shot.

I didn't look deep into it, so just my 2 cents.

Ah! Reading the DFMDerainbow script I do see that fixed_u and fixed_v only have valid Y planes, so processing all three in minideen() is a waste of time. I'll add the u=1 and v=1 parameters to the call.

ChaosKing
12th July 2019, 08:35
@MeteorRain will you also make a release on https://github.com/HomeOfAviSynthPlusEvolution/MiniDeen ?
Delogohd and lsmash can now be installes via avsrepo. Would like to add MiniDeen as well ;-)

MeteorRain
12th July 2019, 16:31
You got it.

Also your signature links are wrong.

StvG
16th July 2019, 19:56
There is error "only 8..16 bit integer clips with constant format are supported." when color space is I420.

Edit: For example: ffvideosource(8-bit.video)
minideen()

MeteorRain
27th August 2019, 06:55
*Dead link removed*

Support I420 and also RGBPxx color format. Let me know how it works, and I'll make a tagged release if you are happy.

real.finder
27th August 2019, 18:25
original deen can work with 0-255 why minideen can't?
https://i.imgur.com/GRr8Oud.png

edit: and in avs 2.6 (test with SEt mt one) minideen(2, 5 , 2, 3, 1, 1) (https://i.imgur.com/xXtw5f0.png)

it's important since I add it in DeHaloHmod https://forum.doom9.org/showthread.php?p=1883288#post1883288

real.finder
5th September 2019, 15:22
ok, Found this and know why, https://forum.doom9.org/showthread.php?p=1846298#post1846298 (but don't know why it's say 2 (https://i.imgur.com/GRr8Oud.png) not 1 maybe because the video is yv12?)

maybe you can make it silently change u and v from 3 to 2 if it 0 (and ignore the Threshold if u and v not 3)

and still we have the avs 2.6 problem https://i.imgur.com/xXtw5f0.png

jackoneill
8th September 2019, 12:54
original deen can work with 0-255 why minideen can't?
https://i.imgur.com/GRr8Oud.png

edit: and in avs 2.6 (test with SEt mt one) minideen(2, 5 , 2, 3, 1, 1) (https://i.imgur.com/xXtw5f0.png)

it's important since I add it in DeHaloHmod https://forum.doom9.org/showthread.php?p=1883288#post1883288

A threshold of 1 would result in an average calculated only from identical pixels, for example (10 + 10 + 10 + 10) / 4 = 10. The result is no change to the image. A threshold of 0 would result in an average calculated only from one single pixel, for example 10 / 1 = 10. Again, the result is no change to the image.

MeteorRain
8th September 2019, 23:56
# 5 = Avisynth 2.6.0 (SEt's multi-threaded build)
loadplugin("Release_r2\x86\minideen.dll")
colorbars()
converttoyv12
minideen(2, 5, 2, 3, 1, 1)
info
Gives me pretty correct result. Do you have other precondition to reproduce this behavior?

https://i.loli.net/2019/09/09/kY7NjbdqiysSf1O.png

real.finder
9th September 2019, 00:18
# 5 = Avisynth 2.6.0 (SEt's multi-threaded build)
loadplugin("Release_r2\x86\minideen.dll")
colorbars()
converttoyv12
minideen(2, 5, 2, 3, 1, 1)
info
Gives me pretty correct result. Do you have other precondition to reproduce this behavior?

https://i.loli.net/2019/09/09/kY7NjbdqiysSf1O.png

# 5 = Avisynth 2.6.0 (SEt's multi-threaded build)
loadplugin("Release_r2\x86\minideen.dll")
colorbars()
converttoyv12
Spline36Resize(880,496) #or any resizer
minideen(2, 5, 2, 3, 1, 1)
info

or just colorbars(880,496) without any resizer

real.finder
9th September 2019, 00:27
A threshold of 1 would result in an average calculated only from identical pixels, for example (10 + 10 + 10 + 10) / 4 = 10. The result is no change to the image. A threshold of 0 would result in an average calculated only from one single pixel, for example 10 / 1 = 10. Again, the result is no change to the image.

thanks for reply

then in this case isn't better to silently change u and v or even Y from 3 to 2 if the threshold is 0 or 1? and ignore the Threshold if u and v or even Y is not 3

MeteorRain
9th September 2019, 02:02
As I expected, memory alignment issue.

I can do threshold 0 1.

MeteorRain
9th September 2019, 02:57
*Dead link removed* Please test and let me know.

Also r4 that changes SIMD logic a little bit.

real.finder
9th September 2019, 06:28
https://down.7086.in/AviSynthPlus%20Filters/MiniDeen_r3.zip Please test and let me know.

Also r4 that changes SIMD logic a little bit.

r4? https://down.7086.in/AviSynthPlus%20Filters/MiniDeen_r4.zip

both seems ok with above code but they are not work with set minideen(2, 2, 5, 2, 1, 1) luma copy

and the Threshold 0 or 1 change even u=1 or v=1 to 2!

Threshold should be ignored if the y, u or v not 3

jackoneill
9th September 2019, 18:15
thanks for reply

then in this case isn't better to silently change u and v or even Y from 3 to 2 if the threshold is 0 or 1? and ignore the Threshold if u and v or even Y is not 3

Personally, I don't think it should silently do nothing when it's supposed to be doing something, but I don't even go here, so ¯\_(ツ)_/¯

MeteorRain
10th September 2019, 16:37
Please re-download r4 and see if it works as you expecting.

real.finder
10th September 2019, 16:56
Please re-download r4 and see if it works as you expecting.

Threshold 0 or 1 cases seems ok now :thanks:

but luma copy still give https://i.imgur.com/xXtw5f0.png with 880 by 496 resolution in avs 2.6 minideen(2, 5, 5, 2, 1, 1)

MeteorRain
10th September 2019, 18:18
Ah I typo'd a parameter. Please forgive me as I'm lazy switching AVS versions (I use AVS+ daily so can't really keep 2.6 for long).

Please re-download r4 and try.

real.finder
10th September 2019, 18:58
Ah I typo'd a parameter. Please forgive me as I'm lazy switching AVS versions (I use AVS+ daily so can't really keep 2.6 for long).

Please re-download r4 and try.

this time seems fixed :thanks:


and about avs 2.6 switching. in mpp you can switch anytime easily and temporarily just by select the dll of avs by "### dll: path"

and that can be done in another tools/programs like avspmod

MeteorRain
10th September 2019, 19:44
If everyone's happy, I'm gonna release both (fixed) versions to GitHub very soon.

MeteorRain
12th September 2019, 01:37
Fixed r3 and last working r4 have been released on GitHub.

real.finder
7th March 2020, 05:54
since float clip didn't support, isn't better to show error screen instead of show wrong output when use it with float clip?

sl1pkn07
7th March 2020, 16:00
Hi

if update the avisynth headers from avsynthplus repo, and apply this patch


diff --git a/minideen_engine.hpp b/minideen_engine.hpp
index a9266f4..bb7339f 100644
--- a/minideen_engine.hpp
+++ b/minideen_engine.hpp
@@ -4,7 +4,7 @@
#include <cstring>

#if defined (MINIDEEN_X86)
-#include <intrin.h>
+#include <x86intrin.h>
#endif

// The largest is 15x15, but the center pixel gets added three times.
diff --git a/wrapper/avs_filter.hpp b/wrapper/avs_filter.hpp
index 4ac61ba..8cd0fd5 100644
--- a/wrapper/avs_filter.hpp
+++ b/wrapper/avs_filter.hpp
@@ -78,7 +78,7 @@ public:
_env = env;
return get(n);
}
- void __stdcall GetAudio(void* buf, __int64 start, __int64 count, IScriptEnvironment* env) { child->GetAudio(buf, start, count, env); }
+ void __stdcall GetAudio(void* buf, int64_t start, int64_t count, IScriptEnvironment* env) { child->GetAudio(buf, start, count, env); }
const VideoInfo& __stdcall GetVideoInfo() { return child->GetVideoInfo(); }
bool __stdcall GetParity(int n) { return child->GetParity(n); }
int __stdcall SetCacheHints(int cachehints, int frame_range) { return 0; } ;


is possible build this plugin in dual interface (vapoursyh/avisynth) in linux (gcc)

any can check it if the changes is correct?

greetings

MeteorRain
7th March 2020, 21:36
I'm planning on working out avs+ on Debian. That'll include avs+, x265 and a few plugins. Stay tuned.

MeteorRain
9th March 2020, 08:05
Both issues should be resolved with r5.

stax76
9th March 2020, 14:22
I would like to request dual interface on Windows.

sl1pkn07
9th March 2020, 14:50
should be working on windows

stax76
9th March 2020, 18:53
I tried r4 yesterday, vs did not work.

sl1pkn07
9th March 2020, 20:49
seems each version change the namespace


name: Spatial convolution with thresholds
namespace: minideenr5
identifier: com.nodame.minideen
MiniDeen(clip:clip; radius:int[]:opt; threshold:int[]:opt; planes:int[]:opt)

stax76
9th March 2020, 21:08
Then I would like to request compatibility and documentation.

sl1pkn07
9th March 2020, 21:20
you can use the VS documentation from dubhater site https://github.com/dubhater/vapoursynth-minideen/blob/master/readme.rst

but yes. seems need aded/adapter in the HomeOfAviSynthPlusEvolution/MiniDeen repo, or remove the

PLUGIN_VERSION in
https://github.com/HomeOfAviSynthPlusEvolution/MiniDeen/blob/master/vs_interface.cpp#L184

EDIT:

click for open (https://i.ibb.co/NYB312Y/Screenshot-20200309-212402.png)

MeteorRain
9th March 2020, 21:57
That was not an intended behavior. Will remove the version.

Check r6.

stax76
9th March 2020, 22:32
Awesome, thanks!

StvG
18th April 2020, 10:19
You renamed MiniDeen() to neo_MiniDeen() in r7? Could you keep MiniDeen() too?
There is output difference between MiniDeen() r6 and neo_MiniDeen() r7. Is it expected?

MeteorRain
21st April 2020, 09:19
Now I put both function names in it. Try r8.
I have changed VapourSynth namespace to neo_minideen since functionality starts to differ from the original VapourSynth plugin. For AVS the name change shouldn't be necessary.

MiniDeen should produce bit identical result. I added opt option and you can give me a reproducible parameter combination if you notice any difference.

StvG
21st April 2020, 12:57
Thanks for the update.
opt=1/2/3 has identical output but r8 output is still different than r6 output.
ColorBars(pixel_type="yuv420p16")
LoadPlugin(".\MiniDeen_r6\clang-x64\MiniDeen.dll")
a=Minideen()
LoadPlugin(".\neo-minideen_r8\clang-x64\neo-minideen.dll")
minideen()
Compare(a,"yuv")

MeteorRain
23rd April 2020, 01:27
Unlike VapourSynth-MiniDeen, this filter returns binary identical result between SIMD and C routine.

The original minideen SSE2 was non-identical to its C implementation. I always use C code as its reference implementation.

Original SSE2 used inaccurate reciprocal for integer division. I used a more accurate one.

StvG
23rd April 2020, 19:20
I've missed that info.

real.finder
14th May 2020, 12:20
seems last update of minideen has bug

minideen(4,thry=14,thruv=14)

with any motion will case chroma out of sync with luma

real.finder
20th May 2020, 14:30
also why it's not work with Greyscale? like Y8 input

MeteorRain
29th May 2020, 21:44
Please try r9 which fixed a typo. I had a quick test with Y8 input, seems working?

real.finder
30th May 2020, 15:53
both seems work now, thanks

romangal
4th June 2020, 02:19
Thanks. Works very nice! I like this filter.
Just asking: Is it possible to add some temporal filtering just adding "a3d" mode only(no need in my opinion to implement c and w) because of original Deen has this function and this one is still beeing Minideen. Thank you anyway!