Log in

View Full Version : REACTIVATED: Memory misaligment -> extreme slowdown???


Malcolm
26th May 2004, 10:22
Hi,
i have this strange behaviour of avisynth, that one of my scripts is significantly slower (3 fps instead of 20 fps) when i'm not using viewfields() + unviewfields() in it!! :eek:
Basically using viewfields() + unviewfields() should only slow down but never speed up avisynth! Also the result is the same in both cases.
This is the script (diff_3clips.avs). It compares 3 clips given as parameters and stacks them together with the results:
orig = orig.crop(left,top,width,height).viewfields()
clipA = clipA.crop(left,top,width,height).viewfields()
clipB = clipB.crop(left,top,width,height).viewfields()

d_clipA = subtract(orig, clipA).levels(127-diffRate,1,128+diffRate,0,255)
d_clipB = subtract(orig, clipB).levels(127-diffRate,1,128+diffRate,0,255)

diff_AB = subtract(clipA, clipB).levels(127-diffRate,1,128+diffRate,0,255)

stackhorizontal(clipA, clipB)
upper = stackhorizontal(orig, last).unviewfields()

stackhorizontal(d_clipA, d_clipB)
lower = stackhorizontal(diff_AB, last).unviewfields()

stackvertical(upper, lower)The usage of the script is like this:
orig = mpeg2source("test.d2v")
ClipA = mpeg2source("testA.d2v")
ClipB = mpeg2source("testB.d2v")

diffRate = 32
left = 120
top = 120
width = 336
height = 288

import("C:\avsfilter25\diff_3clips.avs")Is this one of these strange memory misalignment things??
Is this a serious performance-bug in avisynth?? :confused: :confused:

Here are 2 snapshots that shows the different speeds (click on the thumbnails):
http://img47.exs.cx/img47/9536/avisynth_diff3clips_viewfields-ON_crop.th.png (http://img47.exs.cx/my.php?loc=img47&image=avisynth_diff3clips_viewfields-ON_crop.png) http://img36.exs.cx/img36/829/avisynth_diff3clips_viewfields-OFF_crop.th.png (http://img36.exs.cx/my.php?loc=img36&image=avisynth_diff3clips_viewfields-OFF_crop.png)

Greetings,
Malcolm

scharfis_brain
26th May 2004, 10:42
easy to explain...

create a CPU time consupting script, like


avisource("blubb.avi")
pixiedust(limit=4)

Let's imagine a PC that runs that script with 10 fps.

now we change this script into:

avisource("blubb.avi")
pixiedust(limit=4)
separatefields()

separatefields() splits one frame into 2 frames with half height, which doubles the framerate. This will affect the rendering framerate, too.

Do never only look at the rendering framerate, more precise will be the overall rendering TIME.

I think the complete rendering time of both of your scripts won't differ that much.

Malcolm
26th May 2004, 10:49
i use unviewfields() at the end. so this can't be the reason. also the processing speed isn't half as much, but only 1/6th!

Greetings,
Malcolm

Si
26th May 2004, 21:42
Finally - I've achieved something no other filter writer has done :D

Sorry, But I've no idea whats going on.

Can you replicate the "problem" with a simpler script?

regards

Simon

Malcolm
21st July 2004, 10:10
I have reactivated this thread, because i could again confirm this behaviour of avisynth!

Could someone please test this script? I have a Athlon XP. Maybe this memory misalignment only happens with Athlons??

In both versions of the script (with or without (un)vievfields()) the memory consumption and CPU usage is the same.

Greetings,
Malcolm