PDA

View Full Version : Generating a bitmap fast on Windoze.. ;)


scratt
2007-07-30, 03:02
Can anyone throw me a bone..

I am writing a piece of client software which takes a 200 - 300 MB file and generates an 8 bit bitmap relief map of the data.
Typically we are talking about a 150,000 x 500 pixel bitmap. Which is viewed a bit like on an old style HD fragmentation view.
I have bitmap blitting and smooth scrolling and all the nice stuff working once the bitmap is generated.
I can even start multiple threads to populate the bitmap and watch it grow.. but it's soooo dammm slow to populate!
It seems like the population loops keep getting stalled somewhere... or are BYTE accesses really that slow?!?!? :confused:

Unfortunately the data is 8 bit so the best way to view it is as a 256 colour bitmap, and it needs to run on portables so I can't really just go the whole hog and do a 24 bit or 32 bit bitmap.

My problem is (I suspect) that the tight loop I have written to populate the bitmap takes forever, but it's pretty much just a fast line draw which scan converts each pixel line of the bitmap.

I am beginning to wonder if there is something really bad about doing BYTE operations on PeeCees, other than the obvious four fold loss of efficiency in each instruction.

I have multithreaded several of these tight loops as I mentioned above, but they just seem to gum up the machine so they all execute a bit slower than just one single tight loop. I am testing this on Parallels, so a real PeeCee with access to both cores of a modern CPU will be about 50% faster, but still.... 20 minutes to populate a bitmap? Something is strange there!!

Anyone got any cool suggestions.. chucker!?!? ;)

scratt
2007-07-30, 04:57
Don't worry about it I was looking in the wrong place..

I have a small class I use instead of std::vector, and I forgot to include it in the headers, so my compiler was using the real std::vector, which was actually the cause of the slow down..

But wow! I knew std::vector stuff was slow, hence my own class to replace it, but that is insane.. I have gone from a 20 minute render time to less than a couple of seconds!