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.