digitalFAQ.com Forums [Archives]

digitalFAQ.com Forums [Archives] (http://www.digitalfaq.com/archives/)
-   Avisynth Scripting (http://www.digitalfaq.com/archives/avisynth/)
-   -   Avisynth: Changes for MA script for 528x480/576 resolution? (http://www.digitalfaq.com/archives/avisynth/4381-avisynth-changes-ma.html)

audioslave 07-07-2003 05:59 PM

Avisynth: Changes for MA script for 528x480/576 resolution?
 
Hi kwag and all,
From what I understand the MA script is optimized for resolutions from 528x480/576 and up? What changes do I have to make to the script if I plan encodes at 352x240/288 or 480x480/576? Maybe a stupid question... :roll:

kwag 07-07-2003 06:03 PM

Hi audioslave,

The only change needed should be the value for switching between blurring and Temporal filtering.
Look at the line: ScriptClip("nf = YDifferenceToNext()"+chr(13)+ "nf >= 2 ? \
And change the >= 2 to >=4
That should basically take care of 352x240(288).
For 480x, I think that a value of 3 should be pretty close to ideal.
Give it a try ;)

-kwag

audioslave 07-07-2003 06:09 PM

@kwag,
Thank you for your fast reply as always! What parameter am I tampering with if I'm changing the value you described? I mean, what does it do?

kwag 07-07-2003 06:14 PM

The value you are tampering with is the value to compare the returned value from the function "YDifferenceToNext()".
The less activity, the lower the value and vice versa. So it's really a "treshold" trigger point to switch between the blurring line "unfilter( -(fmin(round(nf)*2, 100)), -(fmin(round(nf)*2, 100)) )" and the Temporal line "TemporalSoften( fmin( round(2/nf), 6), round(1/nf) , round(3/nf) ,1, 1)" :)

-kwag

audioslave 07-07-2003 06:21 PM

Thanks again! I was just curious. So what will happen if I use the value for 528x480/576 if I'm encoding 352x240/288 for example?

kwag 07-07-2003 08:12 PM

Quote:

Originally Posted by audioslave
Thanks again! I was just curious. So what will happen if I use the value for 528x480/576 if I'm encoding 352x240/288 for example?

The value returned by "YDifferenceToNext()" will be different for different resolutions, so you'll be switching filters at non-optimal activity values. You can easily see the value of "nf" variable (the treshold variable) if you insert this line at the end of your script:
Code:

ScriptClip("Subtitle(String(nf),1,30)")
This way you can tune the treshold point by loading your script in Vdub, and sliding to different parts of your movie. Try it ;)

-kwag

vico1 07-08-2003 12:37 AM

So for fine tuning using a 1/2 DVD Rez, (352x480 ntsc) a value of >=3 or 4 sounds
about right, depending on the movie?


*******************************
The Devil`s always.....in the Details!

Fiz 07-08-2003 08:13 AM

Kwag,

Is it possible to use a formula to derive this threshold based on the width of the clip?

I have tried the following code and it assigns the threshold based on the current width of the clip.

Code:

DifferenceThreshold = (Width<=352) ? 4 : (Width<=480) ? 3 : 2

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

The reason I do "<=" is that the overscan parameter of GripCrop will reduce the width so it may be less than 352 etc until GripBorders runs. I used your example (below) to view the value:

Code:

ScriptClip("Subtitle(String(DifferenceThreshold),1,30)")
and I can see the value changing for each resolution I choose. This way the script can be automated further or do you think this would impact performance?

Cheers,

Fiz.

kwag 07-08-2003 10:28 AM

Quote:

Originally Posted by Fiz
Kwag,

Is it possible to use a formula to derive this threshold based on the width of the clip?

Yes ;)
Quote:


I have tried the following code and it assigns the threshold based on the current width of the clip.

Code:

DifferenceThreshold = (Width<=352) ? 4 : (Width<=480) ? 3 : 2

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

The reason I do "<=" is that the overscan parameter of GripCrop will reduce the width so it may be less than 352 etc until GripBorders runs. I used your example (below) to view the value:
That's's correct, and it must be done that way to consider overscan blocks :)
Quote:


Code:

ScriptClip("Subtitle(String(DifferenceThreshold),1,30)")
and I can see the value changing for each resolution I choose. This way the script can be automated further or do you think this would impact performance?

Cheers,

Fiz.
Hi Fiz,

You just reminded me of what I did a long time ago to automate Blockbuster noise levels, depending on resolution :mrgreen:
Your lines are perfect, and just made it to the current script ;)
I'm updating it right now :!:

Thanks,
-kwag

Fiz 07-08-2003 10:53 AM

Quote:

Originally Posted by kwag
Your lines are perfect, and just made it to the current script
I'm updating it right now

Cool :D

kwag 07-08-2003 10:59 AM

Hi Fiz,

Script posted :!:
I only changed the variable name "DifferenceThreshold" to "SwitchThreshold", because it seemed more appropiate for the description ;)
I just tried it on a one minute clip, and there are no speed penalties with or without the changes :)
Probably because it's just comparing constants :cool:

-kwag

Fiz 07-08-2003 11:12 AM

Thanks kwag, being the novice I am I've learnt so much from this forum, not to mention the high quality encodes I'm churning out these days! I'm just glad to be part of it! :wink:

TLTw 07-28-2003 05:29 PM

Code:

DifferenceThreshold = (Width<=352) ? 4 : (Width<=480) ? 3 : 2
if i understand that right if its <=352 it assigns a 4 if <=480 a 3 and all else is assigned a 2 ?

kwag 07-28-2003 05:41 PM

Quote:

Originally Posted by TLTw
if i understand that right if its <=352 it assigns a 4 if <=480 a 3 and all else is assigned a 2 ?

Yep :)

-kwag

DKruskie 07-28-2003 07:12 PM

I have been using the current MA script with 352x240 resolution since it came out and it looks great on my tv. I didnt know I had to change any values for 352x240 :?



David

kwag 07-28-2003 08:40 PM

Hi DKruskie,

You should use the line above, because it does make a difference :!:
Check the curent script page, and update you script :)

-kwag

DKruskie 07-28-2003 10:06 PM

I updated my script..do I need to change any values for 352x240 or are they already set?


David

kwag 07-28-2003 10:22 PM

Quote:

Originally Posted by DKruskie
I updated my script..do I need to change any values for 352x240 or are they already set?


David

They are automatically set :)

-kwag

DKruskie 07-28-2003 10:26 PM

Cool, thanks Kwag :D



David

TLTw 07-28-2003 10:35 PM

Thanks Kwag,

I just took a(brief) look through the avisynth manual its more than just frameserving its a language in its own right. 8O


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

Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.