anu2702
anu2702

Reputation: 358

Hardware Accelerated Image Scaling in windows using C++

I have to scale a bitmap image (e.g 1280 x 720 to 1920 X 180 and vice versa).

I am using this scaling in video capturing from screen. Software based scaling consumes lots of CPU scaling and slower as well.

Is there any hardware accelerated API or library to perform scaling?

Some methods are discussed in thread How to use hardware video scalers?. Buts no final conclusion.

Support Needed : Windows 7 onwards

Upvotes: 2

Views: 1957

Answers (1)

MuertoExcobito
MuertoExcobito

Reputation: 10039

If you have a a IDirect3DTexture9 of the image to be scaled, you can use StretchRect.

There is no equivalent function in D3D11, however, if you have a ID3D11Texture2D of the image to be scaled, you can simply create a render target of the desired destination size, a fullscreen quad, and render to the target with a simple shader that just samples the original texture. The resulting render target will be a scaled image of the input. Note: this fullscreen quad method will also work in D3D9.

Upvotes: 1

Related Questions