digitalFAQ.com Forums [Archives]

digitalFAQ.com Forums [Archives] (http://www.digitalfaq.com/archives/)
-   Avisynth Scripting (http://www.digitalfaq.com/archives/avisynth/)
-   -   Avisynth: New MA script Version? (http://www.digitalfaq.com/archives/avisynth/6801-avisynth-ma-script.html)

incredible 11-21-2003 05:33 AM

Avisynth: New MA script Version?
 
Just a question Kwag, ...

Quote:

Originally Posted by Kwag
Now both filters are active at all times, and work inversely proportional to the activity.

If Unfilter(xxxx) now is active all the times .... shouldn't we delete at least
MergeLuma(blur(0.1)) ... to avoid double blurring on static scenes

Even if nf results as 1*2 in my experiences performing a unfilter(-2,-2) does break a little the edges?!


Just a thought.

Edit, ... ok I know Kwag want to avoid Kick-over's using the "both all time" activity. But if TemporalSoften performs all the time ... this on the other hand will slow down the performance?!

Boulder 11-21-2003 05:36 AM

That could also bring a nice speedup, I've noticed that blurring luma and chroma can be quite slow sometimes.

incredible 11-21-2003 05:47 AM

My recommendation would be ... like Kwag did, a nf based Unfiltering active all the time to avoid "blur-kick-overs", BUT Temporalsoften based on a threshold ... this gives the same viewable quality and on the other hand on high nf based scenes it won't slow down the performance

digitall.doc 11-21-2003 06:00 AM

OK, nice, I suppose this will give the film a smoother aspect, with no filters kicking in and out.
Just a doubt: when nf is above 5, the TemporalSoften radius value will be 0, isn't it?. Does this mean that TemporalSoften will be inactive above nf=5, or will it be functioning but doing nothing, or even with a radius of 0 still has an effect?.
Yes, I know, newby question. :roll:

Dialhot 11-21-2003 06:04 AM

One little thing about the script : the two last values of temporal soften aren't very clever if we look at the documantation :
Quote:

TemporalSoften(clip, int radius, int luma_threshold, int chroma_threshold, int "scenechange", int "mode")

* An optional mode=2 parameter: It has a new and better way of blending frame and provides better quality. It is also much faster. Requires ISSE. mode=1 is default operation, and works as always.
* An optional scenechange=n parameter: Using this parameter will avoid blending across scene changes. 'n' defines the maximum average pixel change between frames. Good values for 'n' are between 5 and 30. Requires ISSE.

[Good initial values: TemporalSoften(4,4,8,15,2)]

kwag 11-21-2003 06:17 AM

Re: New MA script Vers.
 
Quote:

Originally Posted by incredible
If Unfilter(xxxx) now is active all the times .... shouldn't we delete at least
MergeLuma(blur(0.1)) ... to avoid double blurring on static scenes

Yes. Go ahead and delete it. I'll update the script later today. It's not needed anymore.

-kwag

kwag 11-21-2003 06:19 AM

Quote:

Originally Posted by Dialhot
One little thing about the script : the two last values of temporal soften aren't very clever if we look at the documantation

Thanks Phil.
I guess the 1, 1 are stray values from previous versions of the filter :roll:
I'll run a couple of tests, and adjust that. Or go ahead and make a test, and let me know :)

-kwag

incredible 11-21-2003 06:23 AM

Quote:

Originally Posted by DialHot
[Good initial values: TemporalSoften(4,4,8,15,2)]

Good hint Dialhot.

Thats why I also changed in the past the mode in the TempSoften of the MA routine in my cases to "2" :wink:

kwag 11-21-2003 06:27 AM

I just remembered something :!:
I (some people, and me too) HAD problems with parameters other than 1,1 :!: :!: :!:
They were specifically set to those values, because of weird artifacts during scene changes.
This was a while ago, so I have to make some tests. Somewhere in the forum it was documented. So I wouldn't mess with the last two parameters of TemporalSoften.

-kwag

digitall.doc 11-21-2003 06:47 AM

I feel so small between you all...
Please, someone to answer my silly question: radius value of 0 makes the filter not switch on, and if not, what's the effect of a radius of 0?. Maybe the answer is obvius, or in the dcumentation, but I think I didn't read that.

incredible 11-21-2003 07:09 AM

@ Kwag

I just found this....
Could an older AVS (like 2.5) be the reason for your failed outputs using other than 1,1 in TemporalSoften?

Quote:

Changes to 2.51 Released
.....
- Fixed some compiler optimization errors with temporalsoften....
....
- Hopefully fixed jumping frame bugs in temporalsoften.
Reference: http://cultact-server.novi.dk/kpo/avisynth/avs_cvs.html

I don't know now if in > 2.51 more bug-fixes have been done in case of TemporalSoften. But Ill search in the earlier AVS Vers. Changes.

@ Digitall.doc

Code:

.... TemporalSoften( fmin( round(2/nf), 6), round(1/nf) , round(3/nf) , 1, 1) ....
Refering to MAs internal calculations it seems that there won't be a result of exact 0 refering to the Radius settings of TemporalSoften...!?

Kwag/Dialhot .... do I see this right???

digitall.doc 11-21-2003 07:56 AM

Thanx incredible:
Quote:

Code:
.... TemporalSoften( fmin( round(2/nf), 6), round(1/nf) , round(3/nf) , 1, 1) ....


Refering to MAs internal calculations it seems that there won't be a result of exact 0 refering to the Radius settings of TemporalSoften...!?
Looking again at it I think with nf above 5, 2/nf is less than 0.4, and round(2/nf) will be 0, isn't it?. And, what will be the effect of a radius of 0?.

With reference to last MA script, I did some fast tests. Notice that the film is an analog videocamera capture, so I also use filters CNR2, viewfields and unviewfields. But I use these filters in all script tests:
Script Size (kb) Encoding time
MA TempSoften (x,x,x,1,1) 40866 7:26
MA TempSoften (x,x,x,0,2) 40868 7:39
new MA with MergeLuma 40854 8:05
new MA w/o MergeLuma 41367 7:32

Twp things else: the film is 2:07 min long, and created with TMPGEnc, as MPEG2, 528x576 size, CQ60
...not bad the new MA, and not that slow without mergeluma. I'll make later visual comparison (but I'm really the worst doing that) :lol:

kwag 11-21-2003 07:57 AM

Quote:

Originally Posted by incredible
@ Kwag

I just found this....
Could an older AVS (like 2.5) be the reason for your failed outputs using other than 1,1 in TemporalSoften?

Quote:

Changes to 2.51 Released
.....
- Fixed some compiler optimization errors with temporalsoften....
....
- Hopefully fixed jumping frame bugs in temporalsoften.

YEAH :mrgreen:
Thanks incredible :D
That confirms the bug we found a LOOOONG time ago :cool:
So feel free to change the last numbers. I'll update the script later.

-kwag

kwag 11-21-2003 08:00 AM

Here's what the new MA script does:
http://www.kvcd.net/new-ma.mpg
Sample is 720x480, CQ=63.48, to fit on one CD just like that :D
I used MIN=300, MAX=2000.

-kwag

Dialhot 11-21-2003 08:54 AM

Hugh... the result is AWFULL on my 21" PC monitor.

Look at the first scene, the "brown object" on the left bottom corner : it shrines from every edges ! And the surface is everything but uniform. Is that normal ?

Next, the girl switching some buttons in the cockpit of the spaceship : mosquitoes everywhere around her arms and shirt.

What the hell is that ? Okay the resolution is big, but I don't think is really a good thing to show as example :-)

incredible 11-21-2003 09:21 AM

BTW....
Especially to JellyGoose (and maybe some others)

If you also set at the beginning of the MA script a ml=x Variable as multiplicator instead of *2 in the unfilter part as I did in a -more blurring on action scenes MA mod - for testing (where I btw never go above 3 and only on selected movies) ---- kick that out! Cause in the new Release of MA where Unfilter() performs constant, no matter which nf results ... this would cause an unwanted! Over-Blur on static scenes! 8O

kwag 11-21-2003 09:27 AM

Quote:

Originally Posted by Dialhot

What the hell is that ? Okay the resolution is big, but I don't think is really a good thing to show as example :-)

That's exactly the point :!:
It's 720x480, on one CD-R.
At 528x480, it's probably mosquitoless and totally blockless :)
But I wanted to stress the sample, as usual :cool:

-kwag

kwag 11-21-2003 09:31 AM

Quote:

Originally Posted by incredible
Cause in the new Release of MA where Unfilter() performs constant, no matter which nf results ... this would cause an unwanted! Over-Blur on static scenes! 8O

Yes I know, and that's why I mentioned earlier that the parameters have to be tweaked. However, as it is right now, it's not that bad if you use high resolutions. But probably for 352x it will look too blurred.
So the multiplying and dividing values here must be optimized.
Code:

ScriptClip(" nf = YDifferenceToNext()" +chr(13)+ "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)  ")
Something to play with later :lol:

-kwag

incredible 11-21-2003 09:55 AM

Estas equivocado Kwag ;-),

these caution-lines in my posting above did refer to a modified version of MA where I had defined a ml variable as a multiplicator at the beginning!
And as I know that JellyGoose tested this too, I wanted to give him a hint.

example (but dangerous on many movies with static and detailed things in foreground and in the SAME scene fast (luma) changes in background!):
##############
nf=0
ml=3
...
ScriptClip(" nf = YDifferenceToNext()" +chr(13)+ "unfilter( -(fmin(round(nf)*ml, 100)), -(fmin(round(nf)*ml, 100)) ).TemporalSoften(fmin( round(2/nf), 6), round(1/nf) , round(3/nf) , 1, 1)* ")
##############

:)

digitall.doc 11-21-2003 10:23 AM

Hey incredible:
for tweaking purposes, and on that films you may want raise or lower the multiplier, you could use:
Code:

nf=0
ml=2.3
...
ScriptClip(" nf = YDifferenceToNext()" +chr(13)+ "unfilter( -(fmin(round(nf*ml), 100)), -(fmin(round(nf*ml), 100)) ).TemporalSoften(fmin( round(2/nf), 6), round(1/nf) , round(3/nf) , 1, 1)  ")

This way you don't need to make a big step between 2 and 3.

jorel 11-21-2003 11:24 AM

hy all !

in Mon Oct 27, 2003 i post some tests and was waiting (but no one came)
your coments.....please,see what i got using and removing some filters!
(was needed more than a week to do this tests)

http://www.kvcd.net/forum/viewtopic.php?t=7095

if you do some tests(chapters or samples) maybe help to find better results for use in the optimal scripts!

:!:

audioslave 11-21-2003 07:13 PM

So, should we change the last parameters for TemporalSoften to 2,2 instead of 1,1 as it is now? :roll: And what's the difference between the two (2,2 and 1,1)?

incredible 11-21-2003 07:15 PM

@Kwag

I just did a small mod. on the new MA (as metioned in my first 2nd post in here)....
So it performs a permanent Unfiltering like already done in Kwag's new vers. but TempSoften will only perform on static scenes. Just for testing ...
Until now I didn't compared the final size output and Speed on full encoding tests. But a little Sampler based encoding test gave me these results:

- Old MA Script: 12409 Kbyte - 00:03:24

- New MA Script: 12042 Kbyte - 00:03:41

- The modified new MA Script below: 12136 kbyte - 00:03:29
(more filesize but sharper image cause of deleted Merge.. Lines.



Code:

## Main section and static filters ###
nf=0
#
Mpeg2Source("xxxxxxxxxxxxx.d2v")
#
Limiter()
asharp(1, 4)
GripCrop(xxx,yyy)
GripSize(resizer="BicubicResize")
STMedianFilter(3, 3, 1, 1 )
#
#
## Linear Motion Adaptive Filtering ##
#
## Permanent active Unfiltering
## Threshold based Temporasoftening only on static scenes
#
Ts = (Width<=352) ? 4 : (Width<=480) ? 3 : 2
#
ScriptClip("nf = YDifferenceToNext()" +chr(13)+
\"unfilter( -(fmin(round(nf)*2, 100)), -(fmin(round(nf)*2, 100)))"+
\"nf <= Ts ? TemporalSoften(round(2/nf), round(1/nf) , round(3/nf) , 15, 2): Undot()")
#
## Adding Borders & Letterboxing
#
GripBorders()
LetterBox(0,0,16,16) 
Limiter()
#
#
## Functions ###
#
function fmin( int f1, int f2) {
  return ( f1<f2 ) ? f1 : f2
}

Maybe in this case it would be better to rise the "Ts" Values a bit so TempSoften also will handle scenes which are a bit "more than static"??!

Kwag, I recognised this evening the following: ...Why did you perform in the past and in your script now the fmin function on Tempsoften ... as in my opinion 2/nf never will result in more than 2!

TemporalSoften( fmin( round(2/nf), 6) .....

so the Threshold-"int f2" in the function set to a threshold value by 6 will never be reached?! Maybe on the other hand I'm really confused cause its already late ????

And whats about the comment of Digitall.doc?
That a rounded 2/5 could result as 0 radius on tempsoften??

Could this help?
Code:

....
...
...
TemporalSoften( fmax( round(2/nf), 1)......
.......

And therefore also adding below the script another function like this which will keep the radius at least at 1??
Code:

function fmax( int f1, int f2) {
  return ( f1<f2 ) ? f2 : f1
}

Well in a case if I would rise the threshold which refers to the start of tempsoften to 5!

And thats also Digitall.doc what I see now when typing these lines!
As the threshold was set to not more than 4 in the old version this means
a max nf of 4 and therefore 2/nf as send as the radius value to tempsoften would be round(0.5)! And a rounded 0.5 will result in 1,.... so the Radius will at least set to 1.

:)

PS: @ Audioslave

TemporalSoften(int clip, int radius, int luma_threshold, int chroma_threshold [, int scenechange] [, int mode])

Quote:

Originally Posted by Avisynth.org
int scenechange = Using this parameter will avoid blending across scene changes. 'n' defines the maximum average pixel change between frames. Good values for 'n' are between 5 and 30. Requires ISSE

int mode = An optional mode=2 parameter: It has a new and better way of blending frame and provides better quality. It is also much faster. mode=1 is default operation, and works as always.

And as we are using AVS in a version >= 2.51 its useful to switch to mode 2

audioslave 11-21-2003 07:36 PM

@Incredible

Hi there!
I will try your modified script with my nemesis :evil: - The Matrix Reloaded. You know I've been having difficulties with fitting this movie on one CD-R. Hopefully I will have better luck with this new script. :wink: Will get back with my results!

incredible 11-21-2003 07:59 PM

Audioslave ...

Well ...

Quote:

Old MA Script: 12409 Kbyte - 00:03:24

- New MA Script: 12042 Kbyte - 00:03:41

- The modified new MA Script below: 12136 kbyte - 00:03:29
As you see this won't end up in a real compression peak,
so I think there should be other opportunities which could give you your desired results?

BUT look closer... Kwags new MA version gives you more compression! But on the other hand a softer image (if still the "merge...." lines are added).

audioslave 11-21-2003 08:09 PM

Yes, hopefully there is options to gain more compression but I'm lost. I don't know what to use (or where or how...). :cry: I really want to squeeze this movie onto one 80 min disc!

kwag 11-21-2003 08:22 PM

Quote:

Originally Posted by incredible
@Kwag
So it performs a permanent Unfiltering like already done in Kwag's new vers. but TempSoften will only perform on static scenes.

This is exactly what I want to avoid 8O
The ON/OFF switching of filters :!:

-kwag

incredible 11-21-2003 08:23 PM

I thought you want to avoid blur kick-ins?? 8O

kwag 11-21-2003 08:24 PM

Quote:

Originally Posted by incredible
I thought you want to avoid these blur kick-ins?? 8O

Please read this :arrow: http://www.kvcd.net/forum/viewtopic....ght=hysteresis

That case was caused by FFdshow, but I've seen the behaviour happen on some wierd "almost still" scenes with some solid moving objects. It can happen :!:

-kwag

incredible 11-21-2003 08:33 PM

Quote:

Originally Posted by Kwag
UNLESS, that specific scene is right at the border of the treshold of the MA script filter switching point, and you are seeing a fast oscilation between TemporalSmoother and unfilter kicking in and out at a very high speed. The best analogy to this is "Histheresis" effect:

I see Kwag but as I can't download his sample I assume he got problems with oscillating "blur kick ins", ... do I see this right??

And thats why I left the unfiltering untouched ....
Or did "his" problem result by edgy Threshold-Tempsoften oscillation?

kwag 11-21-2003 08:37 PM

Quote:

Originally Posted by incredible

Kwag, I recognised this evening the following: ...Why did you perform in the past and in your script now the fmin function on Tempsoften ... as in my opinion 2/nf never will result in more than 2!

NO :!:
nf can go down to ~.2, so 1/.2 = 5 :!:
Quote:


And whats about the comment of Digitall.doc?
That a rounded 2/5 could result as 0 radius on tempsoften??
So :?:
That's exactly what I want :!:
If the value of radius results as zero, it means that it's a high action scene, and I don't want TemporalSoften to work :!:
So radius will be zero and so will the strength values. Thus rendering the temporal filter useless on action scenes, which is the exact effect I want, but WITHOUT turning the filter off :!:

-kwag

kwag 11-21-2003 08:41 PM

Quote:

Originally Posted by incredible
I see Kwag but as I can't download his sample I assume he got problems with oscillating "blur kick ins", ... do I see this right??

No. It's not related to scene changes. It's related to "Hysteresis" effect, where it can cause fast oscillations on a specific point of a movie, by the quick "turning on/turning off" filters on that boundary. It's very rare, but it can happen.

-kwag

audioslave 11-21-2003 08:50 PM

@kwag

Good ev'nin'!
Sorry to barge in like this but I was wondering about the TempSoft parameters. Do you have a suggestion for a new line or should I use the line incredible posted?:
Quote:

TemporalSoften(round(2/nf), round(1/nf), round(3/nf), 15, 2)
Just curious... :wink:

EDIT: Or maybe just change the last two parameters in the new MA script (1, 1) to 15, 2? I'm clueless...

incredible 11-21-2003 08:52 PM

Quote:

Originally Posted by kwag
Quote:

Originally Posted by incredible

Kwag, I recognised this evening the following: ...Why did you perform in the past and in your script now the fmin function on Tempsoften ... as in my opinion 2/nf never will result in more than 2!

NO :!:
nf can go down to ~.2, so 1/.2 = 5 :!:

As I said, maybe I'm/was confused at these hours, therefore: :banghead:
Quote:

Quote:


And whats about the comment of Digitall.doc?
That a rounded 2/5 could result as 0 radius on tempsoften??
So :?:
That's exactly what I want :!:
If the value of radius results as zero, it means that it's a high action scene, and I don't want TemporalSoften to work :!:
Sorry misunderstanding this was refered to the old script where the filter on/off's based on thresholds.
Quote:

So radius will be zero and so will the strength values. Thus rendering the temporal filter useless on action scenes, which is the exact effect I want, but WITHOUT turning the filter off :!:

-kwag
Everything clear! Trash the mod. script above! I think I have to get some sleep ;-)

@Audioslave

NO!

Dont use the tempsoften line without the fmin call!!! As you can see the explanation why in here ---- I thought wrong! Shure nf can go below 1 as I already knew ... Im an idiot *lol*!!
Use the one kwag used but with mode set to 2

Edit: As I see now you edited it in your post too.

audioslave 11-21-2003 08:56 PM

Oki-dokie :D :!:

kwag 11-21-2003 08:59 PM

Quote:

Originally Posted by incredible
Everything clear! Trash the mod. script above! I think I have to get some sleep ;-)

Drink a cold beer so you can feel the "temporal" effect, and then drink a second beer and you'll see how you go "linear" to bed. Then your "ratio" will be set to "zero", until you wake up :mrgreen:
Happy dreams ;)

-kwag

incredible 11-21-2003 09:01 PM

Right!... but anyhow ... this try and error is where everything is based on :lol:
Now Ill really dream motion adaptive ... and I hope not oscillating! ;-)

good night!

audioslave 11-21-2003 09:02 PM

@kwag

No offence, but I think you've forgotten to include the "nf=0" in the latest optimal script post... :roll:

kwag 11-21-2003 09:16 PM

Quote:

Originally Posted by audioslave
@kwag

No offence, but I think you've forgotten to include the "nf=0" in the latest optimal script post... :roll:

Not needed.
The value of nf will be assigned on the first instance of "ScriptClip(" nf = YDifferenceToNext()"...... ;)

-kwag

audioslave 11-21-2003 09:19 PM

OK, sorry. My mistake. :oops: Damn, I really must learn this programming business! Didn't mean to step on your toes... :wink:


All times are GMT -5. The time now is 02:48 PM  —  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.