pbristow
14th April 2010, 20:17
Hi again.
I've been dabbling with SetMTmode, and the functions MT and MTi, in my recent work. Basically there are two ways in which the MT-equipped Avisynth can divided up the data to allow parallel processing:
- Time-wise (e.g. MTi() splits the source data into two streams of alternate frames, then re-interleaves them after processing),
- Space-wise (e.g. MT() splits clips either horizontally or vertically, then stitches them together after processing)
In the the job I'm currently doing, neither of these approaches is really ideal - Although I did come up with a trick to exploit MTi quite efficiently (Split the source file in two equal-length halves using Trim(); Interleave these halves into a single (very odd!) clip; use MTi() to re-separate, process and re-interleave the two unrelated streams of frames; Use SelectOdd and SelectEven to recover the original halves, and then use "+" to join them back together. Lots of needless splitting, re-ordering and re-joining going on, but it works!)
However, the data I'm working with has natural parallelism that could be exploited. I'm running pairs or triads of identical or similar functions, on pairs or triads of similar but separate clips, e.g. those created by:
Red = ShowRed(Source)
Green = ShowGreen(Source)
Blue = ShowBlue(Source)
What I *can* do is make a separate script for each of these three data streams, run them in separate instances of Virtuladub, encode them as AVI files and then knit them together with a fourth script... But that's very unwieldy and uses up lots of disk space for the temporary files.
What I'd like is a construct in AviSynth that's a bit like a select or case statement in other languages, but which is used to bracket together and list chunks of code (even if they're only single function calls) that can be safely run in separate threads. e.g.:
Source = AviSource("whatever.avi")
Parallel {
Thread:
Red = ShowRed(Source)
R2 = FancySlowFilter(Red, mode=1).SpatialSoften(1,12,10)
Thread:
Green = ShowGreen(Source)
G2 = FancySlowFilter(Green, mode=2)
Thread:
Blue = ShowBlue(Source)
B2 = FancySlowFilter.MassiveBlur.(Blue, mode=1)
}
Is that feasible? Does anyone else think it would be useful?
I've been dabbling with SetMTmode, and the functions MT and MTi, in my recent work. Basically there are two ways in which the MT-equipped Avisynth can divided up the data to allow parallel processing:
- Time-wise (e.g. MTi() splits the source data into two streams of alternate frames, then re-interleaves them after processing),
- Space-wise (e.g. MT() splits clips either horizontally or vertically, then stitches them together after processing)
In the the job I'm currently doing, neither of these approaches is really ideal - Although I did come up with a trick to exploit MTi quite efficiently (Split the source file in two equal-length halves using Trim(); Interleave these halves into a single (very odd!) clip; use MTi() to re-separate, process and re-interleave the two unrelated streams of frames; Use SelectOdd and SelectEven to recover the original halves, and then use "+" to join them back together. Lots of needless splitting, re-ordering and re-joining going on, but it works!)
However, the data I'm working with has natural parallelism that could be exploited. I'm running pairs or triads of identical or similar functions, on pairs or triads of similar but separate clips, e.g. those created by:
Red = ShowRed(Source)
Green = ShowGreen(Source)
Blue = ShowBlue(Source)
What I *can* do is make a separate script for each of these three data streams, run them in separate instances of Virtuladub, encode them as AVI files and then knit them together with a fourth script... But that's very unwieldy and uses up lots of disk space for the temporary files.
What I'd like is a construct in AviSynth that's a bit like a select or case statement in other languages, but which is used to bracket together and list chunks of code (even if they're only single function calls) that can be safely run in separate threads. e.g.:
Source = AviSource("whatever.avi")
Parallel {
Thread:
Red = ShowRed(Source)
R2 = FancySlowFilter(Red, mode=1).SpatialSoften(1,12,10)
Thread:
Green = ShowGreen(Source)
G2 = FancySlowFilter(Green, mode=2)
Thread:
Blue = ShowBlue(Source)
B2 = FancySlowFilter.MassiveBlur.(Blue, mode=1)
}
Is that feasible? Does anyone else think it would be useful?