硬件加速图像缩放在Windows中使用C ++ [英] Hardware Accelerated Image Scaling in windows using C++

查看:1293
本文介绍了硬件加速图像缩放在Windows中使用C ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须缩放位图图片(例如1280 x 720至1920 X 180,反之亦然)。

我正在使用这个缩放功能,基于软件的扩展会消耗大量的CPU缩放和较慢的速度。



有没有硬件加速的API或库来执行扩展?



href =http://stackoverflow.com/questions/13691857/how-to-use-hardware-video-scalers?answertab=oldest#tab-top>如何使用硬件视频缩放器?。



需要支持:Windows 7以上

解决方案

如果您要缩放的图片有aa IDirect3DTexture9 ,则可以使用 StretchRect



在D3D11中没有等效的函数,但是如果你有一个 ID3D11Texture2D 您可以简单地创建所需目标大小的渲染目标,全屏四分之一,并使用简单的着色器渲染到目标,只需对原始纹理进行采样。生成的渲染目标将是输入的缩放图像。注意:这个全屏四方法也将在D3D9中工作。


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

解决方案

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.

这篇关于硬件加速图像缩放在Windows中使用C ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆