MysteryX
28th October 2015, 04:24
I've been trying to optimize performance of the AviSynth Shader plugin. Here's something I just found out: the conversion to float itself is very expensive on memory. What's surprising is: what's taking up most of the memory is BitBlt!
If I run in a single thread
Memory usage without any calls is 11MB
With ConvertToYV24, it goes up to 28MB
Adding my ConvertToFloat while commenting BitBlt in the code, it goes up to 30MB
Uncommenting BitBlt within ConvertToFloat doesn't change memory usage.
Now let's do it with 8 threads
Memory usage without any calls is 42MB
With ConvertToYV24, it goes up to 102MB
Adding my ConvertToFloat while commenting BitBlt in the code, it goes up to 121MB
Uncommenting BitBlt within ConvertToFloat... it goes up to 275MB!!
env->BitBlt(dst, pitch2, halfFloatBuffer, halfFloatBufferPitch, halfFloatBufferPitch, height);
ConvertToFloat().ConvertFromFloat() then take up 566MB on their own.
ConvertToFloat().ConvertFromFloat().ConvertToFloat().ConvertFromFloat() take up 604MB.
What's going on here?
If I run in a single thread
Memory usage without any calls is 11MB
With ConvertToYV24, it goes up to 28MB
Adding my ConvertToFloat while commenting BitBlt in the code, it goes up to 30MB
Uncommenting BitBlt within ConvertToFloat doesn't change memory usage.
Now let's do it with 8 threads
Memory usage without any calls is 42MB
With ConvertToYV24, it goes up to 102MB
Adding my ConvertToFloat while commenting BitBlt in the code, it goes up to 121MB
Uncommenting BitBlt within ConvertToFloat... it goes up to 275MB!!
env->BitBlt(dst, pitch2, halfFloatBuffer, halfFloatBufferPitch, halfFloatBufferPitch, height);
ConvertToFloat().ConvertFromFloat() then take up 566MB on their own.
ConvertToFloat().ConvertFromFloat().ConvertToFloat().ConvertFromFloat() take up 604MB.
What's going on here?