Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Development
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 28th October 2015, 04:24   #1  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,559
Why Is BitBlt Expensive on Memory?

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?

Last edited by MysteryX; 28th October 2015 at 04:27.
MysteryX is offline   Reply With Quote
Old 28th October 2015, 11:42   #2  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,559
When it comes to the full SuperRes script with 2 passes, and running it twice within a larger script with 4 threads, performance looks like this.

FPS (min | max | average): 0.533 | 1000000 | 7.035
Memory usage (phys | virt): 1173 | 1702 MB
Thread count: 195
CPU usage (average): 42%

If I comment BitBlt in the frame format conversion, then performance is this

FPS (cur | min | max | avg): 4.571 | 0.542 | 1000000 | 8.797
Memory usage (phys | virt): 779 | 1682 MB
Thread count: 190
CPU usage (current | average): 45% | 37%

Virtual memory is similar, but there is a drastic difference in physical memory usage. When it comes to the 2GB limit, which one matters?
MysteryX is offline   Reply With Quote
Old 28th October 2015, 13:18   #3  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,559
OK, I've done plenty of tests around this. What varies is physical memory, not virtual memory. It probably sees no need to use physical memory when the data isn't being used, period. So it's fine.

I did manage to do considerable memory optimizations somewhere else.
MysteryX is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 14:51.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.