Quantcast Avisynth: Little Optimizations in Optimal Script - digitalFAQ.com Forums [Archives]
  #1  
07-01-2003, 05:09 AM
Dialhot Dialhot is offline
Free Member
 
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
Hello guys,

The optimal script does a really good job, but it can do it a little faster

ORIGINAL
Code:
MaxTreshold = 1.50
nf =  0 # Current frame.

Mpeg2Source("Your_D2V_Source_Here")

undot()
Limiter()
asharp(2, 4)
GripCrop(Your_GripCrop_Parameters_Here)
GripSize(resizer="BicubicResize")
STMedianFilter(8, 32, 0, 0 )
MergeChroma(blur(MaxTreshold))
MergeLuma(blur(0.2))

ScriptClip("nf = YDifferenceToNext()"+chr(13)+ "nf > 2 ? \
unfilter( -(fmin(round((nf/0.5)), 100)), -(fmin(round((nf/0.5)), 100)) ) : \
TemporalSoften(4, round(1/nf) , round(3/nf) ,0, 2) ") 

GripBorders()
#LetterBox( Your_Values_Here ) # Depends on situation. Use MovieStacker!
Limiter()

function fmin(float f1, float f2) {
  return (f1<f2) ? f1 : f2
}
OPTIMIZED
Code:
nf =  0 # Current frame.

Mpeg2Source("Your_D2V_Source_Here")

undot()
Limiter()
asharp(2, 4)
GripCrop(Your_GripCrop_Parameters_Here)
GripSize(resizer="BicubicResize")
STMedianFilter(8, 32, 0, 0 )
MergeChroma(blur(1.50))
MergeLuma(blur(0.2))

ScriptClip("nf = round(YDifferenceToNext())"+chr(13)+ "nf > 2 ? \
unfilter( -(fmin(nf*2, 100)), -(fmin(nf*2, 100)) ) : \
TemporalSoften(4, round(1/nf) , round(3/nf) ,0, 2) ") 

GripBorders()
#LetterBox( Your_Values_Here ) # Depends on situation. Use MovieStacker!
Limiter()

function fmin(int f1, int f2) {
  return (f1<f2) ? f1 : f2
}
1/ "nf*2" is equivalent to "nf/0.5" but is faster as we use only int
2/ fmin is called only with int values so why declare f1 and f2 as float ?

My tests on a 5 min video : 31'28s for encoding with the "original" script, 31'04s with the new one

I also made test with temporalcleaner insteed of temporalsoften, and is A LOT faster : 20'27s for encoding the same video.
(sample size was quite the same)

I used this parameters :
Code:
temporalcleaner(fmin(3+nf,7),fmin(8+nf,15))
I'm opened to suggestion on the visual result obtained with this filter [/code]
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-01-2003, 06:45 AM
Jellygoose Jellygoose is offline
Free Member
 
Join Date: Jun 2002
Location: Germany
Posts: 1,288
Thanks: 0
Thanked 0 Times in 0 Posts
Can you post the full script made with TemporalCleaner please? I'd like to test it against the current optimal script!
__________________
j3llyG0053
Reply With Quote
  #3  
07-01-2003, 07:06 AM
Dialhot Dialhot is offline
Free Member
 
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Jellygoose
Can you post the full script made with TemporalCleaner please? I'd like to test it against the current optimal script!
Code:
nf =  0 # Current frame.

Mpeg2Source("Your_D2V_Source_Here")

undot()
Limiter()
asharp(2, 4)
GripCrop(Your_GripCrop_Parameters_Here)
GripSize(resizer="BicubicResize")
STMedianFilter(8, 32, 0, 0 )
MergeChroma(blur(1.50))
MergeLuma(blur(0.2))

ScriptClip("nf = round(YDifferenceToNext())"+chr(13)+ "nf > 2 ? \
unfilter( -(fmin(nf*2, 100)), -(fmin(nf*2, 100)) ) : \
temporalcleaner(fmin(3+nf,7),fmin(8+nf,15)) ")

GripBorders()
#LetterBox( Your_Values_Here ) # Depends on situation. Use MovieStacker!
Limiter()

function fmin(int f1, int f2) {
  return (f1<f2) ? f1 : f2
}
Reply With Quote
  #4  
07-01-2003, 09:10 AM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Hi Dialhot,

Thanks for the update
Yep, you sure got that right
I'm updating the script now with your changes:
Code:
ScriptClip("nf = round(YDifferenceToNext())"+chr(13)+ "nf > 2 ? \ 
unfilter( -(fmin(nf*2, 100)), -(fmin(nf*2, 100)) ) : \ 
TemporalSoften(4, round(1/nf) , round(3/nf) ,0, 2) ")
But I'll hold back on the temporalcleaner until I make more tests to see if prediction is not changed, and also if it does weird interactions like the problems I had before with the mergeluma, etc., when they were set with adaptive (dinamic) values.

-kwag
Reply With Quote
  #5  
07-01-2003, 10:41 AM
audi2honda audi2honda is offline
Free Member
 
Join Date: Jun 2003
Location: Orange County, CA
Posts: 291
Thanks: 0
Thanked 0 Times in 0 Posts
Kwag I noticed you didn't change the functions to integer instead of float like in dialhots example. In the sticky you only changed the adaptive portion. Did you mean to do this?
Reply With Quote
  #6  
07-01-2003, 11:18 AM
jorel jorel is offline
Invalid Email / Banned / Spammer
 
Join Date: Aug 2002
Location: Brasil - MG - third stone from the sun
Posts: 5,570
Thanks: 0
Thanked 0 Times in 0 Posts
audi2honda my friend,
Kwag is testing the news like me.

i trust in Phil and Kwag too,
he only do tests cos he want to show the best for us all.
he will post precise results

Reply With Quote
  #7  
07-01-2003, 11:33 AM
ovg64 ovg64 is offline
Free Member
 
Join Date: Jan 2003
Location: Puerto Rico
Posts: 423
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ovg64
Quote:
Originally Posted by audi2honda
Kwag I noticed you didn't change the functions to integer instead of float like in dialhots example. In the sticky you only changed the adaptive portion. Did you mean to do this?
Yes I see it to but not in the sticky: Latest Script
Reply With Quote
  #8  
07-01-2003, 11:37 AM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by audi2honda
Kwag I noticed you didn't change the functions to integer instead of float like in dialhots example. In the sticky you only changed the adaptive portion. Did you mean to do this?
No, I forgot
Doing it now

Thanks and thanks ovg64 for the PM too
-kwag
Reply With Quote
  #9  
07-01-2003, 12:26 PM
audioslave audioslave is offline
Free Member
 
Join Date: Mar 2003
Location: Sweden
Posts: 725
Thanks: 0
Thanked 0 Times in 0 Posts
WOW!
I tested to run a full prediction just to see the speed improvement. AMAZING! The prediction used to take about 7 minutes for this movie (I Spy) and with this new optimization it only takes 3.5 minutes!!! I couldn't believe my eyes!
__________________
AudioSlave
Reply With Quote
  #10  
07-01-2003, 12:31 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Yep, there's a BIG difference in speed between floating point to integer math

To Dialhot:
Have a beer

-kwag
Reply With Quote
  #11  
07-01-2003, 12:37 PM
jorel jorel is offline
Invalid Email / Banned / Spammer
 
Join Date: Aug 2002
Location: Brasil - MG - third stone from the sun
Posts: 5,570
Thanks: 0
Thanked 0 Times in 0 Posts


yeah, jet script!


editing:
predictions..

old script:
Tries : 6
Total Time For Predicition: 00:04:04

new script:
Tries : 7
Total Time For Predicition: 00:03:49

one more "try" and with less total time.
Reply With Quote
  #12  
07-01-2003, 01:21 PM
audi2honda audi2honda is offline
Free Member
 
Join Date: Jun 2003
Location: Orange County, CA
Posts: 291
Thanks: 0
Thanked 0 Times in 0 Posts
I'm only about 15 minutes into a new encode, but according to the time counter in TMPGEnc my encode has gone from 3 hours to 2:15 with the latest integer changes

And the remaining time clock is decreasing faster then real time.
Reply With Quote
  #13  
07-01-2003, 01:38 PM
ovg64 ovg64 is offline
Free Member
 
Join Date: Jan 2003
Location: Puerto Rico
Posts: 423
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ovg64
Yes encoding right now n have 2hrs.50 min. to the goal,
looks like we may have to raise the max speed limit again
Reply With Quote
  #14  
07-01-2003, 02:55 PM
plautzer plautzer is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 99
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to plautzer
how is that possible??
Ok, I got a 1,4 ghz amd, but it takes at least 10 hr to encode muvie!!
Do u think that tuning could help me out??

Plautzer
Reply With Quote
  #15  
07-01-2003, 03:38 PM
audi2honda audi2honda is offline
Free Member
 
Join Date: Jun 2003
Location: Orange County, CA
Posts: 291
Thanks: 0
Thanked 0 Times in 0 Posts
Well my encode just finished and this was using a 70% film 30% NTSC video hybrid source with telecide and decimate. I used 48 frame samples and 2 samples per minute which slowed down prediction a lot, but with this hybrid source I thought it might help.

Well the results are in With the latest Optimal script today with the int variables I got 100% accuracy on my prediciton that when muxed came to exactly 795MB

Oh and not to mention it ran blazingly fast

Plautzer. my times are for a P4 2.8ghz machine with ddr266.

I also have a 1.8ghz machine at home that takes about 5 hours. Yours should be faster. Is it a P4?
Reply With Quote
  #16  
07-01-2003, 04:10 PM
ovg64 ovg64 is offline
Free Member
 
Join Date: Jan 2003
Location: Puerto Rico
Posts: 423
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ovg64
Quote:
Originally Posted by plautzer
how is that possible??
Ok, I got a 1,4 ghz amd, but it takes at least 10 hr to encode muvie!!
Do u think that tuning could help me out??

Plautzer
Well my Deal here is an Athlon xp which gets up to 1.46Gigs with out clocking it, this encode when finish is going to be 4hrs. 6min. long... , Monsters Inc. 93 min Toon.
Reply With Quote
  #17  
07-01-2003, 04:10 PM
plautzer plautzer is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 99
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to plautzer
I got a AMD athlon 1600 xp+!!
I guess a gotta upgrade it soon!!
I encode it on 2 cds, i guess it take that double es as long!!

plautzer
Reply With Quote
  #18  
07-01-2003, 04:11 PM
ARAGORN ARAGORN is offline
Free Member
 
Join Date: Oct 2002
Posts: 50
Thanks: 0
Thanked 0 Times in 0 Posts
Hi

There's no difference for me in speed

I've got an athlon 2400, 512M0 DRR and windows xp

Kwag, what's the problem here

I'm using pal

Another question: when i encode with tok the dc component precision is set to 9 in tmpgenc. I'm using your settins tab for tok. Should not be 8?

ARAGORN
Reply With Quote
  #19  
07-01-2003, 04:14 PM
audi2honda audi2honda is offline
Free Member
 
Join Date: Jun 2003
Location: Orange County, CA
Posts: 291
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by plautzer
I got a AMD athlon 1600 xp+!!
I guess a gotta upgrade it soon!!
I encode it on 2 cds, i guess it take that double es as long!!

plautzer
The number of CDs shouldn't have much of an impact on encoding time.
Reply With Quote
  #20  
07-01-2003, 04:14 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by ARAGORN

Another question: when i encode with tok the dc component precision is set to 9 in tmpgenc. I'm using your settins tab for tok. Should not be 8?
If you are encoding MPEG-1, it's always 8 bits. The DC component will be shadowed.

-kwag
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
Avisynth: Optimal Script? Shibblet Avisynth Scripting 29 01-05-2005 04:57 AM
Avisynth: Difference between MA script and optimal script? mistermickster Avisynth Scripting 2 08-01-2003 09:36 AM
Avisynth: New optimal script for AVS 2.52 Dialhot Avisynth Scripting 3 06-14-2003 12:17 PM
Avisynth: Optimal Script for D2S? telemike Avisynth Scripting 3 06-11-2003 08:33 AM
Avisynth: Optimal Script Help Bigswaffo Avisynth Scripting 7 05-29-2003 04:17 PM

Thread Tools



 
All times are GMT -5. The time now is 12:11 AM  —  vBulletin Jelsoft Enterprises Ltd