Hardware Accelerated Image Scaling in windows using C++

坚强是说给别人听的谎言 提交于 2019-12-11 00:36:20

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/35277510/hardware-accelerated-image-scaling-in-windows-using-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!