Range() v3.2 Now with rg()

This forum is for questions and discussion of all the aspects of handling and cleaning up your footage with Avisynth.
User avatar
Corran
Joined: Mon Oct 14, 2002 7:40 pm
Contact:
Org Profile

Re: Range() and Selective Filtering

Post by Corran » Wed Nov 03, 2010 6:39 pm

Phantasmagoriat wrote:I suppose the syntax is the same, but mine's still better :nose: because:
-The code is easier to read
-It doesn't use unnecessary if/then statements
-It has a default filter chain
-It will eventually have fadein/fadeout parameters
The if/then statements were necessary for avoiding issues when using trim() in certain situations. (though it looks like you've made some changes to address trim's issues in your script now so you probably know that...) But yeah, it could have been written better.

User avatar
Phantasmagoriat
Joined: Mon Feb 06, 2006 11:26 pm
Status: ☁SteamPunked≈☂
Contact:
Org Profile

Re: Range() v3.1 [Now with Clip Replacement and Presets!]

Post by Phantasmagoriat » Wed Nov 03, 2010 7:18 pm

Corran wrote:
Phantasmagoriat wrote:I suppose the syntax is the same, but mine's still better :nose: because:
-The code is easier to read
-It doesn't use unnecessary if/then statements
-It has a default filter chain
-It will eventually have fadein/fadeout parameters
The if/then statements were necessary for avoiding issues when using trim() in certain situations. (though it looks like you've made some changes to address trim's issues in your script now so you probably know that...) But yeah, it could have been written better.
lol, I guess I put my foot in my own mouth.
It actually required more if/then statements than you used to cover the really annoying special cases like:
sceneadjust(0,all-1, "invert()") # see what happens to the last frame
sceneadjust(0,0, "invert()") # splits the video in two
sceneadjust(1,all, "invert()") # misses the first frame

The special cases were such a pain, and I wouldn't be surprised if I missed any,
so I take that back. :beer:
Image
Org Profile | AMVGuide | Phan Picks! | THE424SHOW | YouTube | "Painkiller"

"Effort to Understand; Effort to be Understood; to See through Different Eyes."

User avatar
Phantasmagoriat
Joined: Mon Feb 06, 2006 11:26 pm
Status: ☁SteamPunked≈☂
Contact:
Org Profile

Re: Range() v3.2 Now with rg()

Post by Phantasmagoriat » Sun Nov 07, 2010 5:07 pm

Minor update:

Code: Select all

CHANGELOG:
v3.2 - Included rg() function with conveniently rearranged variables: rg( head,startframe,endframe,tail,mod )
Generally range() is used by specifying the startframe, endframe, modification, and some generic fadein/fadeout frames.
However, in some cases it would be more convenient to use all four frame positions *in sequencial order*
That is what rg() is for. It is literally the same as range() but with rearranged variables as shown above.
This is useful for adding effects, or when you need to be precise all the time. Here is an example of one of my recent uses:

Code: Select all

c0=as("UNCOMPRESSED.avi").yv().Levels(0, 1.00, 270, 0, 300)
c1=c0.Levels(0, 1.00, 290, 0, 300)
c2=c0.Levels(0, 1.00, 280, 0, 300)
c3=c0.Levels(0, 1.00, 270, 0, 300)
c4=c0.Levels(0, 1.00, 250, 0, 300)
credits = as("CREDITS_NEW.avi").yv()

c0
rg( 116, 138, 138, 182,c1)
rg( 182, 212, 212, 239,c1)
rg( 212, 260, 294, 356,last.Levels(0, 1.00, 260, 0, 300) )
rg( 322, 386, 394, 430,c2)
rg( 435, 445, 493, 537,c3)
rg( 547, 570, 756, 801,c4)
rg( 756, 801, 826, 826,last.Levels(0, 1.00, 270, 0, 300))
rg(1255,1274,1322,1366,c4)
rg(1408,1408,1772,1796,c3)
rg(1796,1811,1900,1960,c2)
rg(1960,2014,2014,2045,c2)
rg(2412,2469,2618,2657,c2)
rg(2657,2676,2726,2775,c2)
rg(2775,2799,2824,2851,c3)
rg(3715,3787,4169,4193,c2)
gradfun2db
trim(0,5443)++credits
In this case I wanted to make select scenes in my AMV glow a bit by boosting their luma. I knew exactly when I wanted the levels to start changing, so it would have been annoying and confusing to type something like the following for each segment:

Code: Select all

range(1811,1900,c2, head=1796, tail=1960)
Image
Org Profile | AMVGuide | Phan Picks! | THE424SHOW | YouTube | "Painkiller"

"Effort to Understand; Effort to be Understood; to See through Different Eyes."

Locked

Return to “AviSynth Help”