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.

Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 25th November 2012, 00:33   #21  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,406
From here:http://forum.doom9.org/showthread.ph...30#post1298430

Quote:
Originally Posted by tritical View Post
What processor and version of Avisynth are you using? If you run debugview when loading the script nnedi2 should output a line like:

nnedi2: auto-detected opt setting = %d

what value does it give? It works correctly on my laptop that only has sse2.

EDIT: It looks like Avisynth's GetCPUFlags() function is off by 1 bit when checking ecx for SSSE3/SSE4.1/SSE4.2. For SSSE3 on intel cpus it is actually checking the Thermal Monitor 2 bit, which happens to be 1 on my Q6600 and 0 on my laptop so it ends up working correctly here . I'll just make auto-detection only go up to SSE3, the one SSSE3 routine didn't really make any difference speedwise.

EDIT2: Actually, it doesn't crash on my laptop because I had an old version of Avisynth on it that didn't check beyond SSE3 support.
@David, Can you just verify that you are using Avisynth.h v3 (just incase the problem was in old header).

EDIT: FYI, Info() gives a little CPU info.

EDIT: Just installed vs2010. If you set "Project Properties/Code Generation/Runtime Library" to "Multi-threaded (/MT )"
avoids the requirement for "Msvcr100.dll".
Did timing test on my 3GHz 2 dual core on this source filter GetFrame(): http://forum.doom9.org/showthread.ph...70#post1602470
Got about 40FPS on both VS6 and TK3, and only 26FPS on vc2010 (about same on vs2008). Dont have VS2005 installed
at present but might expect about 45FPS from that).
__________________
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; 25th November 2012 at 21:52.
StainlessS is offline   Reply With Quote
Old 26th November 2012, 17:38   #22  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,820
Quote:
@David, Can you just verify that you are using Avisynth.h v3 (just incase the problem was in old header).
It says v2.5 at the top of the file...

Quote:
Originally Posted by Wilbert View Post
Sorry, i still get the same error.
I've updated it, hopefully this time with no SSE instructions (although this time I left the DLL name as quad.dll)

David
wonkey_monkey is offline   Reply With Quote
Old 26th November 2012, 17:54   #23  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,406
David, latest v3 should have this at top of file, after GPL

Code:
#ifndef __AVISYNTH_H__
#define __AVISYNTH_H__

enum { AVISYNTH_INTERFACE_VERSION = 3 };
__________________
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 ???
StainlessS is offline   Reply With Quote
Old 26th November 2012, 18:37   #24  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,820
Quote:
Originally Posted by StainlessS View Post
David, latest v3 should have this at top of file, after GPL
Oh! Then yes.

David
wonkey_monkey is offline   Reply With Quote
Old 26th November 2012, 19:48   #25  |  Link
Wilbert
Super Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,375
Quote:
I've updated it, hopefully this time with no SSE instructions (although this time I left the DLL name as quad.dll)
Thanks, it seems to work! Could anyone of your post some examples of what it should look like?
Wilbert is offline   Reply With Quote
Old 26th November 2012, 20:45   #26  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,406
Here the example given already by martin53

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)
""")
Trim(0,562).KillAudio().ConvertToYV12()
http://www.mediafire.com/?hyz3tlpii3mlqed

Really quite nice EDIT: 1.42 MB, 18 seconds mp4

I guess that you've done that already yourself, but perhaps for others that want to know what it can do.

Well done to both David and martin53. I used the non SSE version just to check it out.

EDIT: Now all we need is a Flying Tardis disappearing down an xyremap vortex
__________________
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; 26th November 2012 at 21:09.
StainlessS is offline   Reply With Quote
Old 20th December 2012, 16:19   #27  |  Link
martin53
Registered User
 
Join Date: Mar 2007
Posts: 408
Since that little script found such an echo, and david made a nice suggestion to me about how to profit from the alpha layer too, I updated the script a bit.
Note the background gradient, the starfield and how the color bars partially obscure it.

Btw did you ever wonder if frames have a front and a back side?

Code:
function stars(clip c, int r) {
    c.Overlay(x=rand(c.width),y=rand(c.height),BlankClip(c,width=1,height=1,color=$030301*rand(85)))
    (r==0)? last : stars(r-1)
    Trim(0,-1).Loop(c.Framecount, 0, 0)
}
width=1080
height=720
length=100000
Tcolor=$000040
Bcolor=$000018
StackVertical(BlankClip(length=length,width=2,height=1,color=TColor,pixel_type="RGB32"),BlankClip(length=length,width=2,height=1,color=BColor)).BilinearResize(width,2*height,src_top=0,src_height=2).Crop(0,height/2,0,-height/2).Stars(width*height/3072)

#BlankClip(length=length,FPS=25,width=640,height=480,color=$000018,pixel_type="RGB32")
ScriptClip("""
    c=last
    t=0.061*current_frame
    t3=0.127*current_frame
    t2=-0.9
    a=exp(-3.0+3.0*cos(t/pi))
    t1x=0.4*cos(t3)
    t1dx=1.0+0.2*sin(t2)
    t1y=0.4*cos(t2)
    t1dy=1.0+0.2*sin(t3)
    c1x=0.5+a*cos(t)
    c1y=0.5+a*sin(t)
    cb=Colorbars(width=width,height=height,pixel_type="rgb32")
    cos(t2)*cos(t3)>=0? cb.Subtitle(string(current_frame)+"\nFlying Colorbars",text_color=$d0c000,lsp=0,align=5,size=60) : cb
    ResetMask
    quad(0.5+t1x*t1dx,0.5+t1y*t1dy, 0.5-t1x*t1dx,0.5+t1y/t1dy, 0.5-t1x/t1dx,0.5-t1y/t1dy, 0.5+t1x/t1dx,0.5-t1y*t1dy, normal=true)
    quad(c1x,c1y, 1.0-c1y,c1x, 1.0-c1x,1.0-c1y, c1y,1.0-c1x, normal=true)
    Overlay(c,last,mask=last.ShowAlpha)
""")
martin53 is offline   Reply With Quote
Old 20th December 2012, 17:53   #28  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,820
Quote:
Avisynth open failure:
Resize: Source image too small for this resize method. Width=1. Support=1
Might be a 2.58 thing?
wonkey_monkey is offline   Reply With Quote
Old 18th February 2013, 08:16   #29  |  Link
vampiredom
Registered User
 
Join Date: Aug 2008
Posts: 233
Hi, I am not sure if this is by design or not but I have noticed a behavior that is counter-intuitive to me.

Code:
BlankClip(width=75,height=75, color=$ffffff)
AddBorders(25,25,25,25, color=$000000)
quad(0.5, 0,     1.0, 0.0,    1.0,1.0,     0,1.0,   normal=true)
Only the float value in blue has been shifted from the rectangular values. However, you can see that the right edge of the box now skews slightly and the entire image has shifted upward.

I would have assumed that only the top-left corner would have been affected by the transform. Am I missing something?

Last edited by vampiredom; 18th February 2013 at 08:57.
vampiredom is offline   Reply With Quote
Old 18th February 2013, 09:55   #30  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,820
Quote:
Originally Posted by vampiredom View Post
I would have assumed that only the top-left corner would have been affected by the transform. Am I missing something?
Yes

It emulates a 3D transform. If you draw a box and connect the diagonals, then push the top left corner of the box in, the point where the diagonals cross will shift up and right.

David
wonkey_monkey is offline   Reply With Quote
Old 18th February 2013, 10:21   #31  |  Link
vampiredom
Registered User
 
Join Date: Aug 2008
Posts: 233
Yeah, I figured it was something like that! It's unfortunate for my purpose, however, as I need to control each corner of the box independently.
vampiredom is offline   Reply With Quote
Old 18th February 2013, 13:16   #32  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,820
xyremap can probably do it, but you'd have to work out the correct expressions for yourself.

David
wonkey_monkey is offline   Reply With Quote
Old 19th February 2013, 03:11   #33  |  Link
vampiredom
Registered User
 
Join Date: Aug 2008
Posts: 233
Thanks!
vampiredom is offline   Reply With Quote
Old 20th February 2013, 13:51   #34  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,820
Code:
function corners(clip in, float x0,float y0, float x1,float y1, float x2,float y2, float x3,float y3) {
  return in.xyremap(x="x "+string(x0)+" 1 b - 1 a - * * - "+string(x1)+" 1 b - a * * + "+string(x2)+" b a * * + "+string(x3)+" b 1 a - * * -",\
                    y="y "+string(y0)+" 1 b - 1 a - * * - "+string(y1)+" 1 b - a * * - "+string(y2)+" b a * * + "+string(y3)+" b 1 a - * * +")
}
corners takes an input clip and four pairs of variables, each of which determines how far inward each of the four corners comes in towards the center (starting at the top left corner and working clockwise).

Caveat: due to xyremap's backwards mapping you will get curvature of the image sides, but it may go unnoticed for small shifts.

I may recompile xyremap later as I think I can squeeze some more accuracy out of the interpolator.

David

Last edited by wonkey_monkey; 20th February 2013 at 13:53.
wonkey_monkey is offline   Reply With Quote
Old 21st February 2013, 08:42   #35  |  Link
vampiredom
Registered User
 
Join Date: Aug 2008
Posts: 233
Cool. I will try that out. Thank you very much!
vampiredom is offline   Reply With Quote
Old 26th February 2013, 17:54   #36  |  Link
martin53
Registered User
 
Join Date: Mar 2007
Posts: 408
Quote:
Originally Posted by davidhorman View Post
Might be a 2.58 thing?
Sorry I only noticed your reply a minute ago. Yes I use 2.60 - did you check with smaller width/height constants, e.g. 640*480?
martin53 is offline   Reply With Quote
Old 12th May 2016, 15:44   #37  |  Link
Forensic
Registered User
 
Join Date: Apr 2008
Location: California, USA
Posts: 127
#davidhorman
Your Quad (11/01/2012 version) is undergoing peer review by the scientific community. The QUAD call is with the coordinates plus "invert=true, normal=true". Can you help me explain the reduction of only the Vertical clarity with the skew test detailed at (http://VideoCleaner.com/SquareTest.pdf)? NOTE: All Quad coordinates are 1/100th, and thus between 0.0 and 1.0, of the slider values listed in that PDF.
Thank you in advance.
Forensic is offline   Reply With Quote
Old 12th May 2016, 19:45   #38  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,820
Quote:
Your Quad (11/01/2012 version) is undergoing peer review by the scientific community.
Umm, okay. Not sure why... do I get a certificate if it passes?

Quote:
Can you help me explain the reduction of only the Vertical clarity with the skew test detailed at (http://VideoCleaner.com/SquareTest.pdf)?
It's hard to tell exactly what problem is being looked at. I'm generally against relating such issues through the medium of PDF since the images will be scaled on view, and there's no indication of the correct scale to use to get a 1:1 mapping to my screen. Plus adding the grid behind the image confuses things.

I assume it's the broken-ness of the vertical edges. I just did a skew and an inverse skew in Photoshop and I got the same imperfect remapping of vertical lines. It's not possible to perfectly retrieve the original image if you're doing resampling.

Paint's skew feature doesn't do any resampling, so its result is much coarser than quad's. But it has the "advantage" that you can undo it perfectly.
__________________
My AviSynth filters / I'm the Doctor

Last edited by wonkey_monkey; 12th May 2016 at 23:02.
wonkey_monkey is offline   Reply With Quote
Old 14th May 2016, 21:39   #39  |  Link
Forensic
Registered User
 
Join Date: Apr 2008
Location: California, USA
Posts: 127
Actually, there can be a certificate or award from the forensic/scientific community. Would you be willing to release the source code?
In your testing, without the grids, do you also find that the vertical perspective blurs more than the horizontal?
Forensic is offline   Reply With Quote
Old 14th May 2016, 22:40   #40  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,820
Quote:
Originally Posted by Forensic View Post
Actually, there can be a certificate or award from the forensic/scientific community.
Well, that'd be more than I got for discovering a supernova...

But quad is hardly worthy of an accolade. It was cobbled together out of some matlab code I found on some website and some pixel interpolation code. There's really nothing innovative to it.

Quote:
In your testing, without the grids, do you also find that the vertical perspective blurs more than the horizontal?
Yes, because there's no vertical (horizontal lines are made of vertical detail) resampling. It's the same as if you resized it horizontally only. Vertical lines would be blurred, horizontal lines would be unchanged.
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey 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 05:00.


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