At this stage I can only recommend NOT to use VapourSynth.nim. It is too slow 
(not because of nim, but I cannot find out why).

Testing the convolution filter in Python:
    
    
    import vapoursynth as vs
    core = vs.get_core()
    core.std.SetMaxCPU('none')
    clip = core.std.BlankClip(format=vs.GRAYS, length=100000, fpsnum=24000, 
fpsden=1001, keep=True)
    clip = core.std.Convolution(clip, matrix=[1,2,1,2,4,2,1,2,1])
    clip.set_output()
    
    Run

So I get:
    
    
    $ vspipe test.vpy /dev/null
    Output 100000 frames in 26.73 seconds (3740.91 fps)

My version:
    
    
    import ../vapoursynth
    import options
    BlankClip( format=pfGrayS.int.some,
               width=640.some,
               height=480.some,
               length=100000.some,
               fpsnum=24000.some,
               fpsden=1001.some, 
keep=1.some).Convolution(@[1.0,2.0,1.0,2.0,4.0,2.0,1.0,2.0,1.0]).Null
    
    Run

so:
    
    
    $ nim c -f --gc:none -d:release -d:danger modifyframe
    $ time ./modifyframe
    
    real        0m37,872s
    user        0m38,989s
    sys 0m1,997s

which is: 2640.47fps

On the other hand you can create your own filters. In that regard, I have 
managed to apply a simple Gauss filter to 100000frames in:
    
    
    $ time ./modifyframe
    
    real        8m25,425s
    user        8m24,112s
    sys 0m5,422s

which is 198fps. Way too slow when compared with the C++ version.

Reply via email to