Log in

View Full Version : Script fails to load


Ceppo
8th January 2021, 14:21
I have a filter that I want to run on each 8x8 block separately, so I made a script with a loop to do that. To filter the first vertical line it takes less than a second but if I filter the whole picture it fails to load (the window freezes and nothing happens) so either I'm doing wrong or I'm pushing avisynth limits. Which is it?


src = last
width = src.width()
height = src.height()

VS = src.Crop(0,0,-width+8,-height+8).Invert() #or any filter
for(h=16,height,8){
V = src.Crop(0,h-8,-width+8,-height+h).invert()
VS = StackVertical(VS,V)
}
for(w=16,width,8){
VS2 = src.Crop(w-8,0,-width+w,-height+8).Invert()
for(h=16,height,8){
V2 = src.Crop(w-8,h-8,-width+w,-height+h).invert()
VS2 = StackVertical(VS2,V2)
}
VS = StackHorizontal(VS,VS2)
}

VS

ChaosKing
8th January 2021, 14:52
It does work for me. Is your video res mod8? Or it just takes longer to process...

But I'm not sure the scripts works as intended. I added .subtitle("i") to every line, but the only i I see is in the top left corner...

Ceppo
8th January 2021, 14:59
It's 1920x1080. Now I tried reduceby2() and it does load but is uber slow and is kind of strange, I wonder why is it so slow maybe there is a better way to do it?

EDIT:
With subtitle("A",size=4,x=4) I get the intended result.

pinterf
8th January 2021, 15:38
Probably memory issues?
The For loop in Avisynth is just a scripting convenience for small repetitions. Imagine it as an unrolled loop.
The core of the second part of the script is effectively unrolled to 32400 instances (1920/8 x 1080/8).