Quantcast Avisynth: a Simple Way to Compare Two Scripts - digitalFAQ.com Forums [Archives]
  #1  
07-23-2005, 09:39 AM
Dialhot Dialhot is offline
Free Member
 
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
As I bother to user MovieStacker just for that, this is a little avs script aimed to compare the result of two other scripts.

Simply put the code of the scripts in the function script1 and function script2.
The example below compare the original source (script1 empty) and the result of the greyscale() command.

Note: you can resize or do whatever you want in the scripts but be carefull that both scripts must produce clips with same parameters (size, fps, colorspace)

Code:
source=Mpeg2Source(...)

left=source.script1()
right=source.script2()

width=left.width()/2
height=left.height()

left=crop(left,0,0,width,height)
right=crop(right,width,0,width,height)

StackHorizontal(left.subtitle("Script1"),right.subtitle("Script2"))

function script1(clip c) {
c
#----- ENTER CODE OF SCRIPT ONE HERE -----

#----- END OF CODE OF SCRIPT ONE-----
}

function script2(clip c) {
c
#----- ENTER CODE OF SCRIPT TWO HERE -----
Greyscale()
#----- END OF CODE OF SCRIPT TWO-----
}
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Site Staff / Ad Manager
 
Join Date: Dec 2002
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #2  
07-23-2005, 12:15 PM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
Nice!

And here also a nice compare function if you dont want to se a side by side but a "switching"-like comparison:

Code:
source=Mpeg2Source(...)
Interleave(script1(source).subtitle("Script1",10,20),script2(source).subtitle("Script2",10,20))


function script1(clip c) {
c
#----- ENTER CODE OF SCRIPT ONE HERE -----

#----- END OF CODE OF SCRIPT ONE-----
}

function script2(clip c) {
c
#----- ENTER CODE OF SCRIPT TWO HERE -----
Greyscale()
#----- END OF CODE OF SCRIPT TWO-----
}
Means: Do scroll to the Script1 frame you want to compare ... then step one frame forth. Now you see the Script2 version of the frame. Back n' Forth and Back'n forth gives you a nice comparing like in a "switching" way.

I do use this often when comparing encodings etc.
Reply With Quote
  #3  
07-23-2005, 02:34 PM
rds_correia rds_correia is offline
Free Member
 
Join Date: Apr 2003
Location: Chinese Democracy starts now!
Posts: 2,563
Thanks: 1
Thanked 0 Times in 0 Posts
Uau! this one should become a sticky guys
__________________
Rui
Reply With Quote
  #4  
07-27-2005, 12:55 PM
Zyphon Zyphon is offline
Free Member
 
Join Date: Oct 2003
Location: London, England (UK)
Posts: 1,035
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks guys for both methods this is a really useful script great work.
__________________
Regards.

Michael.
Reply With Quote
  #5  
09-13-2005, 08:37 AM
ginoboy ginoboy is offline
Free Member
 
Join Date: Apr 2004
Posts: 922
Thanks: 0
Thanked 0 Times in 0 Posts
very good!

thanks guys!
Reply With Quote
  #6  
10-23-2005, 05:21 AM
Prodater64 Prodater64 is offline
Free Member
 
Join Date: Mar 2003
Location: Palma de Mallorca - España
Posts: 2,925
Thanks: 0
Thanked 0 Times in 0 Posts
I know what is greyscale, but for what is it useful in those scripts?
Reply With Quote
  #7  
10-23-2005, 05:28 AM
digitall.doc digitall.doc is offline
Free Member
 
Join Date: Jul 2003
Location: Valencia (España)
Posts: 741
Thanks: 0
Thanked 0 Times in 0 Posts
Prodater,
I think it was just an example...
Between this lines
Code:
#----- ENTER CODE OF SCRIPT ONE HERE -----

#----- END OF CODE OF SCRIPT ONE-----
you have to put the filters of scripts (1 and 2) you want to compare.

Inc and Dialhot compared no filter against greyscale() as an example.
Reply With Quote
  #8  
10-23-2005, 08:06 AM
danpos danpos is offline
Free Member
 
Join Date: May 2004
Location: Rio de Janeiro - Brasil
Posts: 538
Thanks: 0
Thanked 0 Times in 0 Posts
Alternate

More instructions on own link.

Cya!
Reply With Quote
  #9  
10-23-2005, 09:17 AM
Prodater64 Prodater64 is offline
Free Member
 
Join Date: Mar 2003
Location: Palma de Mallorca - España
Posts: 2,925
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by danpos
Alternate

More instructions on own link.

Cya!
Thanks.
Reply With Quote
  #10  
11-21-2005, 04:55 PM
Prodater64 Prodater64 is offline
Free Member
 
Join Date: Mar 2003
Location: Palma de Mallorca - España
Posts: 2,925
Thanks: 0
Thanked 0 Times in 0 Posts
A simple but usefull add:

Code:
source=Mpeg2Source(...) 

left=source.script1() 
right=source.script2() 

width=left.width()/2 
height=left.height() 

left=crop(left,0,0,width,height).addborders(0,0,2,0,$0000FF).crop(2,0,-0,-0)
right=crop(right,width,0,width,height).addborders(2,0,0,0,$0000FF).crop(0,0,-2,-0)

StackHorizontal(left.subtitle("Script1"),right.subtitle("Script2")) 

function script1(clip c) { 
c 
#----- ENTER CODE OF SCRIPT ONE HERE ----- 

#----- END OF CODE OF SCRIPT ONE----- 
} 

function script2(clip c) { 
c 
#----- ENTER CODE OF SCRIPT TWO HERE ----- 
Greyscale() 
#----- END OF CODE OF SCRIPT TWO----- 
}
It adds a vertical blue (you can change the color) line separating both clips.
The script crop 2 pixels at right and left sides to compensate the addborder in the midle, but most times those sides are black overscan zones.
Reply With Quote
  #11  
11-21-2005, 05:14 PM
Dialhot Dialhot is offline
Free Member
 
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
Reply With Quote
  #12  
11-21-2005, 05:34 PM
Prodater64 Prodater64 is offline
Free Member
 
Join Date: Mar 2003
Location: Palma de Mallorca - España
Posts: 2,925
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Dialhot
Reply With Quote
  #13  
11-26-2005, 08:43 PM
Prodater64 Prodater64 is offline
Free Member
 
Join Date: Mar 2003
Location: Palma de Mallorca - España
Posts: 2,925
Thanks: 0
Thanked 0 Times in 0 Posts
Two more mods:

Compare left half of both scripts:

Code:
source=Mpeg2Source(...) 

left=source.script1() 
right=source.script2() 

width=left.width()/2 
height=left.height() 

left=crop(left,0,0,width,height).addborders(0,0,2,0,$0000FF).crop(2,0,-0,-0)
right=crop(right,0,0,width,height).addborders(2,0,0,0,$0000FF).crop(0,0,-2,-0)

StackHorizontal(left.subtitle("Script1"),right.subtitle("Script2")) 

function script1(clip c) { 
c 
#----- ENTER CODE OF SCRIPT ONE HERE ----- 

#----- END OF CODE OF SCRIPT ONE----- 
} 

function script2(clip c) { 
c 
#----- ENTER CODE OF SCRIPT TWO HERE ----- 
Greyscale() 
#----- END OF CODE OF SCRIPT TWO----- 
}
Compare right half of both scripts:

Code:
source=Mpeg2Source(...) 

left=source.script1() 
right=source.script2() 

width=left.width()/2 
height=left.height() 

left=crop(left,width,0,width,height).addborders(0,0,2,0,$0000FF).crop(2,0,-0,-0)
right=crop(right,width,0,width,height).addborders(2,0,0,0,$0000FF).crop(0,0,-2,-0)

StackHorizontal(left.subtitle("Script1"),right.subtitle("Script2")) 

function script1(clip c) { 
c 
#----- ENTER CODE OF SCRIPT ONE HERE ----- 

#----- END OF CODE OF SCRIPT ONE----- 
} 

function script2(clip c) { 
c 
#----- ENTER CODE OF SCRIPT TWO HERE ----- 
Greyscale() 
#----- END OF CODE OF SCRIPT TWO----- 
}
Does any body know how to do it (select one of three options L/R, L/L or R/R) with conditional switches (if mode == LR, if mode == LL, if mode == RR) in only one avs script.



Reply With Quote
  #14  
11-26-2005, 09:13 PM
Fluffbutt Fluffbutt is offline
Free Member
 
Join Date: Apr 2004
Posts: 189
Thanks: 0
Thanked 0 Times in 0 Posts
I've been playing, but I can't see a way.

Avisynth ConditionalFilter does not allow for a variable to be set
(psuedocode: set Type=left, then test Type for "left").

Is there a way to make an avisynth runtime function give a predefined result that won't change throughout the life of the script?

We may have to wait for 3.0

"..Improved parser: the parser will include the widely requested flow control structs (if then else, for, while). It will add two new types : frame and function..."
__________________
|
Meeow!
Reply With Quote
  #15  
11-27-2005, 01:03 AM
Prodater64 Prodater64 is offline
Free Member
 
Join Date: Mar 2003
Location: Palma de Mallorca - España
Posts: 2,925
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Fluffbutt
I've been playing, but I can't see a way.
I have it!!!

Code:
#############################################################################################

mode="LR" # "LR", "RR" or "LL"

#############################################################################################

source=Mpeg2source("")

left=source.script1()
right=source.script2()

width=left.width()/2
height=left.height()

left = (mode == "RR") ? crop(left,width,0,width,height).addborders(0,0,2,0,$0000FF).crop(2,0,-0,-0):crop(left,0,0,width,height).addborders(0,0,2,0,$0000FF).crop(2,0,-0,-0)
right = (mode == "LL") ? crop(right,0,0,width,height).addborders(2,0,0,0,$0000FF).crop(0,0,-2,-0):crop(right,width,0,width,height).addborders(2,0,0,0,$0000FF).crop(0,0,-2,-0)

StackHorizontal(left.subtitle("Script1"),right.subtitle("Script2")) 

function script1(clip c) { 
c 
#----- ENTER CODE OF SCRIPT ONE HERE ----- 

#----- END OF CODE OF SCRIPT ONE----- 
} 

function script2(clip c) { 
c 
#----- ENTER CODE OF SCRIPT TWO HERE ----- 
Greyscale() 
#----- END OF CODE OF SCRIPT TWO----- 
}
Reply With Quote
  #16  
11-30-2005, 05:10 AM
Fluffbutt Fluffbutt is offline
Free Member
 
Join Date: Apr 2004
Posts: 189
Thanks: 0
Thanked 0 Times in 0 Posts
Hahah, brilliant.. I tried to set a variable, but couldn't get it to react with the scripts.

I was trying a if..then...else type arrangement; yours is a masterpiece!
__________________
|
Meeow!
Reply With Quote
  #17  
12-01-2005, 05:26 AM
Prodater64 Prodater64 is offline
Free Member
 
Join Date: Mar 2003
Location: Palma de Mallorca - España
Posts: 2,925
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Fluffbutt
Hahah, brilliant.. I tried to set a variable, but couldn't get it to react with the scripts.

I was trying a if..then...else type arrangement; yours is a masterpiece!
Thanks.
It is, indeed, an if..then.
left = (mode == "RR") ? can be read as "if mode = "RR" then left = ...."
statement after "?" is the conditional statement.
statement after ":" is the "else" statement.
Reply With Quote
  #18  
12-03-2005, 04:12 AM
Fluffbutt Fluffbutt is offline
Free Member
 
Join Date: Apr 2004
Posts: 189
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Prodater64
It is, indeed, an if..then.
left = (mode == "RR") ? can be read as "if mode = "RR" then left = ...."
statement after "?" is the conditional statement.
statement after ":" is the "else" statement.
Good grief! And programmers call that 'structure'? LOL! It seems wierd to me that = and == both mean 'equals' ("if mode = "RR" then left = ....").

Oh well.. Thanks again..
__________________
|
Meeow!
Reply With Quote
  #19  
02-14-2009, 03:42 PM
tengo6dedos tengo6dedos is offline
Free Member
 
Join Date: Mar 2008
Location: Tierra del Fuego, Chile
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts
I do not know if someone will find it useful by now but I simply use:

Code:
DGDecode_Mpeg2Source(....)
a=last.
\      FFT3dfilter().
\      LanczosResize(x,y)  
#
#################
#
dfttest()
LanczosResize(x,y)
stackhorizontal(a,last)

top is for left screen n bottom if for right, *top filters must end with dot "." unless is the last one, same goes for the word "last"

saluts
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
compare different HDTVs and HD capture devices! nicksteel Video Capturing / Recording 31 11-21-2005 02:47 PM
Avisynth: Simple script to make a kdvd from divx cartoon? zagor Avisynth Scripting 1 12-06-2004 10:18 AM
MovieStacker: How does Movie Stacker compare to DIKO? Lumsmore Video Encoding and Conversion 10 10-04-2004 03:59 AM
FFMPEG: Using the same source to compare results (HDTV) Krassi Video Encoding and Conversion 34 02-19-2004 03:40 AM
AviSynth 2.05 filter Compare for debugging is interesting... black prince Avisynth Scripting 0 09-25-2002 08:57 PM

Thread Tools



 
All times are GMT -5. The time now is 08:41 AM  —  vBulletin © Jelsoft Enterprises Ltd