Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 2nd July 2003, 20:31   #1  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,335
scriptclip problems

I was trying scriptclip (on some almost black frames), and got the following output:

# gives 43.66
clip = clip.Trim(0,-1)
ScriptClip(clip, "Subtitle(String(AverageLuma(clip)))")

# first frame: 43.656
# second frame: 43.395
# third frame: 43.405
clip = clip.Trim(0,-3)
ScriptClip(clip, "Subtitle(String(AverageLuma(clip)))")

# gives 0.00002
clip = clip.Trim(0,-1)
ScriptClip(clip, "Subtitle(String(YDifferenceFromPrevious))")

# first frame: 2.271
# second frame: 0.00002
# third frame: 2.137
clip = clip.Trim(0,-3)
ScriptClip(clip, "Subtitle(String(YDifferenceFromPrevious))")

There are two things which I don't understand:
1) Mustn't the order in the last example be 0.00002, 2.271, 2.137 instead of 2.271, 0.00002, 2.137.
2) Even then, I don't understand these values. I also added the calculation of averageluma. The difference between the first two frames, for example, is 43.656 - 43.395 = 0.261. Which is not approx. equal to 2.271?
Wilbert is offline   Reply With Quote
Old 3rd July 2003, 00:31   #2  |  Link
Cross
Registered User
 
Join Date: Apr 2003
Location: Italy
Posts: 15
I posted something very similar a few days ago.
http://forum.doom9.org/showthread.ph...threadid=50105

But no answer.

Bye

Cross
Cross is offline   Reply With Quote
Old 3rd July 2003, 12:52   #3  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
I'll try fiddling around with it to get some answers.
__________________
Regards, sh0dan // VoxPod
sh0dan is offline   Reply With Quote
Old 3rd July 2003, 21:24   #4  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,335
One more question, if you don't mind I'm trying to understand the "Quantified Motion Filter: adaptive motion filter for Avisynth", in the thread: http://forum.doom9.org/showthread.php?s=&threadid=56051

This script:

# first frame: 2.271
# second frame: 0.00002
# third frame: 2.137
# fourth frame: 2.252
clip = clip.Trim(0,-4)
ScriptClip(clip, "Subtitle(String(YDifferenceFromPrevious))")


gives exactly the same output as the following script:


clip = clip.Trim(0, -4)

function g(clip c)
{
global clip=c
c=ScriptClip(c, "debug()")
c=FrameEvaluate(c, "me")
c=FrameEvaluate(c, "global text=YDifferenceFromPrevious(clip)")
return c
}

function me()
{
global t=String(text)
}

function debug(clip c)
{
c = subtitle(c, t)
return c
}

g(clip)


The problem is that I don't understand what is happening here. If you look at the function "g" it appears that the script is executed backwards (instead of forwards, which is normally the case). Thus the globale variable "text" is obtained, and used by the function "me" [which is located above that line]. Then the "debug" function is applied [which is located above that line].

I know that AviSynth parses (or reads) from bottom to top, so I guess that has something to do with it. I just don't understand this, and I'm so confused
Wilbert is offline   Reply With Quote
Old 3rd July 2003, 22:15   #5  |  Link
HomiE FR
Registered User
 
Join Date: Jul 2002
Location: France
Posts: 140
Wilbert wrote:
Quote:
I just don't understand this, and I'm so confused.
And so I am!
If an explanation is possible, I'd like to hear/read it. Thanks sh0dan (I won't get bored by saying it again and again ).
HomiE FR is offline   Reply With Quote
Old 3rd July 2003, 22:25   #6  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
It because of how AviSynth works.

Scripts are parsed from top to bottom, but when a frame is requested the last filter is actually being invoked first, requesting frames upwards in the filter chain. For example:

AviSource("myfile.avi")
ColorYUV(analyze=true)
Histogram()

- When Vdub requests a frame, AviSynth requests the frame from Histogram.
- Histogram requests a frame from ColorYUV,
- ColorYUV from AviSource, which produces the frame, and delivers it to ColorYUV.

- ColorYUV processes the image and sends it on to Histogram, which returns it to Vdub.

So the filter chain basicly works backwards, which gives filter the possibility to request several frames from the source above.

Conditional filters need to evaluate scripts BEFORE they request frames from the filter above, because they need to know which filter to call.

I guess I owe it to you to write some decent explanation of this. Cond. filters are quite complex - and sometimes I am even surprised of the outcome.
__________________
Regards, sh0dan // VoxPod
sh0dan is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:48.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.