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.

 Register FAQ Calendar Search Today's Posts Mark Forums Read

 24th September 2012, 14:18 #1  |  Link wonkey_monkey Formerly davidh*****     Join Date: Jan 2004 Posts: 2,174 quad - quadrilateral transform (split from New Utils thread due to bug report) 2019-01-14: quad is now superseded by warp Download: quad.zip Last update: 2012-09-30 - ~10% speed increase, bicubic interpolation Last update: 2012-10-02 - another ~10% speed increase Last update: 2012-10-05 - 100% speed increase! Last update: 2012-11-01 - output levels bugfix quad is a quadrilateral transformation filter similar to vcmohan's reform, although (so far) quad doesn't crash and does a true quadrilateral transformation. It uses bicubic interpolation (can be switched off for speed purposes) and is multi-threaded. Minimum parameter requirements are 4 x,y pairs defining the corners of the target quadrilateral. The source quadrilateral can also be specified, if required. No source, sorry - it makes use of too many half-written libraries scattered around my hard drive. Code: ```quad ==== An Avisynth plugin to perform quadrilateral transformations. Usage ===== quad(clip, tx0,ty0, tx1,tx1, tx2,ty2, tx3,ty3, [sx0,sy0, sx1,sy1, tx2,ty2, tx3,ty3, bool invert, bool normal, bool draft]) Parameters: ----------- tx0,ty0-tx3,ty3: the four corners of the target quadrilateral. sx0,sy0-sx3,sy3: the four corners of the source quadrilateral (default: clip's corners, clockwise from top left) invert: invert the transformation (transpose t and s) normal: specify that the coordinates are normalised to the range 0-1. draft: don't use spline16 interpolation``` Last edited by wonkey_monkey; 14th January 2019 at 20:43. Reason: updated version
25th September 2012, 17:59   #2  |  Link
martin53
Registered User

Join Date: Mar 2007
Posts: 404
Quote:
 Originally Posted by davidhorman Can you post a screenshot?
ColorBars()

...Uh., funny. There was the black area inside AvsPmod's preview, but the jpg is stored with a correct picture. I'll try on to catch the picture.

EDIT
I made screenshots now. Looks like 'the thread responsible for the upmost quarter of the image is not finished when the frame is forwarded'. Maybe the thread continues to write afterwards, and then issues the illegal access?
Attached Images

Last edited by martin53; 25th September 2012 at 18:11.

 25th September 2012, 19:03 #3  |  Link wonkey_monkey Formerly davidh*****     Join Date: Jan 2004 Posts: 2,174 Strange that the thread for the top strip - which is the first thread to be created - is so far behind, although you were right that the code was failing to wait for that thread (it waited for all the others). Also strange that the edge is slanted like that. I've updated the DLL (download link as at top of thread) which also includes some very slight speed improvements, though I don't know whether that will fix your scriptclip problem. David
 25th September 2012, 22:59 #4  |  Link martin53 Registered User   Join Date: Mar 2007 Posts: 404 David, I think you solved it! Looks very promising: Code: ```ColorBars() Subtitle("Flying Colorbars()",text_color=\$d0c000,align=5,size=40) ScriptClip(""" c=last t=0.061*current_frame t2=0.127*current_frame a=0.501+0.5*sin(t/pi) t1x=-0.2*cos(t2) t1y=0.5-0.5*cos(t2) t2x=1.0+0.2*cos(t2) t2y=0.5-0.5*cos(t2) t3x=1.0+0.2*cos(t2) t3y=0.5+0.5*cos(t2) t4x=-0.2*cos(t2) t4y=0.5+0.5*cos(t2) c1x=0.5+a*cos(t) c1y=0.5+a*sin(t) c2x=0.5-a*sin(t) c2y=0.5+a*cos(t) c3x=0.5-a*cos(t) c3y=0.5-a*sin(t) c4x=0.5+a*sin(t) c4y=0.5-a*cos(t) c.quad(t1x,t1y, t2x,t2y, t3x,t3y, t4x,t4y, normal=true) quad(c1x,c1y, c2x,c2y, c3x,c3y, c4x,c4y, normal=true) """)``` I only once suffered a crash when I had a=0.5+0.5*sin(t/pi), i.e. a can get ==0 - and it's a hard test to set all coordinates identical! Not realistic, I think it is perfect the way it is. Thanks that you took the time to put this together. I feel that this kind of transform really fills a gap and that now, people can create cool new animations that were impossible till now. Please add the short description file to the new dll for the future downloaders. If you don't mind, you might add the types (float...) of the parameters, and maybe a bit more precise, which ones are optional.
 30th September 2012, 19:13 #5  |  Link wonkey_monkey Formerly davidh*****     Join Date: Jan 2004 Posts: 2,174 Updated with ~10% speed increase and now using bicubic interpolation (I may make this switchable in future, sorry if you liked spline16!) David
 5th October 2012, 18:05 #6  |  Link wonkey_monkey Formerly davidh*****     Join Date: Jan 2004 Posts: 2,174 http://horman.net/quad.zip Updated again - now twice as fast as the last version David
 9th October 2012, 13:20 #7  |  Link StainlessS HeartlessS Usurer     Join Date: Dec 2009 Location: Over the rainbow Posts: 9,244 David, a version number or date on your zips might be good, the one in New Plugins is still the old one (with the same name). EDIT: Suggest remove zip from New Plugins and point link here. __________________ 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; 9th October 2012 at 13:24.
 11th October 2012, 12:16 #8  |  Link vcmohan Registered User   Join Date: Jul 2003 Location: India Posts: 829 I am testing using the script given in a post above. While the earlier version of Quad was running at least through some frames prior to crashing, the latest version (oct 5) virtualdub does not start and gives a message "An instruction not supported by the CPU was executed in module 'quad'." My cpu is AMD two core 5000+ x2 and running windows xp. Is there a problem? __________________ mohan my plugins are now hosted here
11th October 2012, 12:33   #9  |  Link
wonkey_monkey
Formerly davidh*****

Join Date: Jan 2004
Posts: 2,174
Quote:
 Is there a problem?
Definitely. I'd guess it's down to the SSE instructions I've used - I thought I wasn't using anything beyond regular SSE3 (and only one instruction beyond SSE2, HADDPS) but I must be wrong. I'll check my code later and add some fallback code, although I'll have to ask you to test it as I don't have any other CPUs to test it on.

David

 11th October 2012, 17:40 #10  |  Link wonkey_monkey Formerly davidh*****     Join Date: Jan 2004 Posts: 2,174 Could you give this DLL a try? quad(amd).zip I inadvertently used an SSSE3 instruction, which isn't supported by the X2. This alternative DLL replaces it with pure <=SSE3 instructions, with only a minor performance hit. David
 11th October 2012, 22:26 #11  |  Link IanB Avisynth Developer   Join Date: Jan 2003 Location: Melbourne, Australia Posts: 3,173 The polite thing to do is code Code: `if (!(env->GetCPUFlags() & CPUF_SSSE3)) env->ThrowError("Help, I need the SSSE3 instruction set");` it's very poor form to just HCF (Halt and Catch Fire)
12th October 2012, 13:10   #12  |  Link
vcmohan
Registered User

Join Date: Jul 2003
Location: India
Posts: 829
Quote:
 Originally Posted by davidhorman Could you give this DLL a try? David
I tried and with Martin53 script above it was executing witout any crash. Thank you.
I however noted that the color strips at the edges were narrower than those inside. There is enough space on the screen to display them fully or at least lot wider. This must be true for the regular version also. It appears the edges are truncated.
__________________
mohan
my plugins are now hosted here

12th October 2012, 13:59   #13  |  Link
wonkey_monkey
Formerly davidh*****

Join Date: Jan 2004
Posts: 2,174
Quote:
 I however noted that the color strips at the edges were narrower than those inside. There is enough space on the screen to display them fully or at least lot wider. This must be true for the regular version also. It appears the edges are truncated.
I think (if I understand the problem correctly) that's because Martin's funky script applies quad twice. The first call to quad, depending on the point in the animation, sometimes expands the image outside the frame, so when the second quad is applied, it's already cropped.

David

 1st November 2012, 19:06 #14  |  Link wonkey_monkey Formerly davidh*****     Join Date: Jan 2004 Posts: 2,174 Hi all, quad.dll has been updated to fix a bug which was causing RGBA values to be up to +2 above what they should have been - sorry about that! David
 11th November 2012, 17:32 #15  |  Link martin53 Registered User   Join Date: Mar 2007 Posts: 404 You can see it work here now, thanks again david.
 24th November 2012, 17:27 #16  |  Link Wilbert Moderator   Join Date: Nov 2001 Location: Netherlands Posts: 6,341 I was trying to use FSubstitute, but i'm running into trouble with this plugin. It simply won't load it (error: unable to load ...quad.dll, error=0x7e ...). I have an old athlon where sse(2), SSSE3 is not supported (only mmx and isse). Perhaps this is the problem read the posts above. Could you support mmx for me too (and release the sources)? Many thanks ...
 24th November 2012, 19:30 #17  |  Link StainlessS HeartlessS Usurer     Join Date: Dec 2009 Location: Over the rainbow Posts: 9,244 VS6 Dependency Walker shows quad.dll as needing "Msvcr100.dll" from Microsoft Visual C++ 2010 Redistributable Package 32 bit http://www.microsoft.com/download/en...s.aspx?id=5555 64 bit http://www.microsoft.com/download/en....aspx?id=14632 EDIT: Error 0x7e, missing module. Probably not even getting to the point where CPU could be an issue. __________________ 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; 24th November 2012 at 19:42.
24th November 2012, 20:56   #18  |  Link
Wilbert
Moderator

Join Date: Nov 2001
Location: Netherlands
Posts: 6,341
Quote:
 VS6 Dependency Walker shows quad.dll as needing "Msvcr100.dll" from Microsoft Visual C++ 2010 Redistributable Package
Thx, i installed it. But i get now an other warning:
Evaluate: System exception - Illegal Instruction

24th November 2012, 23:10   #19  |  Link
wonkey_monkey
Formerly davidh*****

Join Date: Jan 2004
Posts: 2,174
Hi Wilbert,

Sorry you've had trouble. I've tried to use Ian's suggestion:

Code:
`if (!(env->GetCPUFlags() & CPUF_SSSE3)) env->ThrowError("Help, I need the SSSE3 instruction set");`
but it didn't work - perhaps it's an Avisynth 2.6 thing, while I've stuck with 2.58.

This may work for you: http://horman.net/quad-no-sse.zip

It's about half the speed of the SSE version, but since that doesn't work for you at all it shouldn't be a problem

Quote:
 (and release the sources)?
Ah, sorry, I'm still reluctant to do so. The library I'm using is a tangle of inter-connected files and under constant revision/being messed about with, so I'd rather not release it until/unless I tidy it up a lot (my Avisynth filters only using a small subset of it).

David

25th November 2012, 00:07   #20  |  Link
Wilbert
Moderator

Join Date: Nov 2001
Location: Netherlands
Posts: 6,341
Quote:
 This may work for you: http://horman.net/quad-no-sse.zip It's about half the speed of the SSE version, but since that doesn't work for you at all it shouldn't be a problem
Sorry, i still get the same error.