PDA

View Full Version : Avisynth slowdown due to memory misalignment(?)


Malcolm
27th July 2004, 13:58
Hi,
in some (reproducable) cases, avisynth is slowed down by a factor of 4-6! This happens in certain scripts when NOT using viewfields() + unviewfields().
Is this a serious performance-bug in avisynth?? :confused: :confused: Maybe memory misalignment?
The following script runs at 20 fps when using viewfields() + unviewfields(). It runs at only 3 fps when not using viewfields() + unviewfields()! :eek:

The script compares 3 clips given as parameters and displays the results stacked horizontally:
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")

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)

I have already posted this topic, but no one has responded. i guess my explanation wasn't so clear (and also some (too) quick answers leaded to some false explanations... :) )

Greetings,
Malcolm