Need sugestion to optimize realtime bitblt->StretchBlt (scaling takes to much CPU)

Started by
26 comments, last by Krypt0n 9 years, 9 months ago

Could you try comparing each pixel to the previous pixel to determine a difference, and then divvy the screen up into 32x32 sized chunks and only StretchBlt the chunks that contained at least one differing pixel?

Advertisement

Hi Samith.

I am not sure this will work since the scaling also does some smoting and i think that doing this in your way will make the borders of the 32*32 squares to be seen ...

I can try that but i am not sure how to do that.

The simplest solution would be to perform the resizing of the images in parallel in multiple threads. You could put the captured images into a queue, and have the threads grab the images from said queue and resize them.

It doesn't change the fact, that 40ms is awefully slow for a resize, but if you have the CPU cores to spare, why not use them.

Hi Samith.
I am not sure this will work since the scaling also does some smoting and i think that doing this in your way will make the borders of the 32*32 squares to be seen ...
I can try that but i am not sure how to do that.

You might be able to work around that by having the grid squares "overlap" with a border that is as wide as the kernel of the filter.

It would mean processing some pixels twice, but it would still be less then doing every pixel.

Apart from that, and using multiple cores to update squares in paralell, I don't think its much you can do unless using graphics hardware. (which is a massively parallell processor designed for image processing, seems pretty ideal for the task)

Why not using graphics hardware? It would be a lot less complex to get to work.

MAybe a bit off-topic, but why exactly do you need to scale anyway? (I'm not sure what you mean by "live screen drawing" and why this implies scaling?)

Olof Hi

I grab screenshot, scall it to the destination device resolution and trasmit it to that device.

The device that the screens are sent to can not do the scalling.

I already use the extra CPU to encode the images so it will not help to scall using the extra cpu.

I am more looking for a way to decrease cpu time than to have more fps (if i will be able to decrease cpu time then the extra fps will come by themself).

Hi. I don't know why you have that while(1) in your render
What breaks it.
Can you show your render code.

Whats break the while(1) is the user that press the stop button in the gui to stop.

It is

while(user did not press the stop button)

{

capture screenshot and scale it (Streachblt)

}

I say the slowness is comming from your code set up.

I say the slowness is comming from your code set up.

ankhd hi.

I do not think so since i think this is the most FPS my CPU can give me with StretchBlt which is done on the cpu (i use gpu monitor and i see that it does not do that on gpu).

But if you have more details why it is coming from my code then i would love to hear.

We need to see your render code

This topic is closed to new replies.

Advertisement