Log in

View Full Version : Multithreaded input


PhrostByte
28th February 2010, 14:38
Hello all,

While developing an Avisynth plugin, I ran into a bit of a unique problem -- I needed to read 100 input frames for each one that I outputted. After making my own code as concurrent and optimized as possible, I've still got a huge bottleneck of only being able to decode one input frame at a time.

I'm a newbie to Avisynth plugin coding (though not to C++) -- is there a recommended way to decode multiple frames concurrently? It'd be nice if future Avisynth versions had a flag associated with each clip telling if IClip::GetFrame could safely be called concurrently.

wonkey_monkey
28th February 2010, 15:28
What's the source of the input frames?

David

PhrostByte
28th February 2010, 16:04
ffdshow via DirectShowSource

pbristow
1st March 2010, 06:34
Is it really the decoding that's the bottleneck, or retrieving the frames from storage?

The only way I can imagine 100 frames being retrieved faster than ffdshow (on a decent processor) can decode them is if the storage is something like a ramdisk, or if the 100 frames are coming from several different files each of which is on a separate spindle (physical hard drive). Or *possibly* if you're reading the frames non-sequentially and expecting the one you want to be in the read cache more often than not... in which case it may be worth looking at re-ordering your code to fetch the frames in an order that the disk subsystem finds less taxing.

But then, I R just a Helpful Newbie... :helpful: