CreateBitmapFromWicBitmap失败并显示E_OUTOFMEMORY [英] CreateBitmapFromWicBitmap fails with E_OUTOFMEMORY

查看:177
本文介绍了CreateBitmapFromWicBitmap失败并显示E_OUTOFMEMORY的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

平台:Windows 7上的DirectX 11. 32 C ++位测试应用程序。 Visual Studio 2012.

Platform: DirectX 11 on Windows 7. 32 C++ bit test application. Visual Studio 2012.

我通过WIC加载JPEG文件,通过IWICColorContext应用ICC配置文件,并使用IWICFormatConverter将位图转换为WICPixelFormat32bppPBGRA。所有这些工作都是
成功,即使对于大型图片也是如此。

I load a JPEG file via WIC, apply an ICC profile via IWICColorContext and convert the bitmap to WICPixelFormat32bppPBGRA using an IWICFormatConverter. All this works successfully, even for large images.

但是最后一步,调用 ID2D1DeviceContext :: CreateBitmapFromWicBitmap失败,E_OUTOFMEMORY用于任一维度为20,000像素的图像。我需要让这些代码适用于标准全景照片,通常是
20,000像素或更多。

But the last step, the call to ID2D1DeviceContext::CreateBitmapFromWicBitmap fails with E_OUTOFMEMORY for images which are 20,000 pixels in either dimension. I need to make this code working for standard panorama photos, which are often 20,000 pixel or more.

我试图切换初始化3DDevice时使用D3D_DRIVER_TYPE_WARP或D3D_DRIVER_TYPE_REFERENCE进行软件渲染,但
结果相同

I tried to switch to software rendering by using D3D_DRIVER_TYPE_WARP or D3D_DRIVER_TYPE_REFERENCE when initializing the 3DDevice, but the results are the same.

当CreateBitmapFromWicBitmap失败时,我的应用程序只使用160 MB的RAM和12 GB的RAM。即使是32位应用程序也应该能够在Windows上加载和显示一个大的JPEG文件,没有?

At the time the CreateBitmapFromWicBitmap fails my application only uses 160 MB of RAM and 12 GB RAM are available. Even a 32 bit application should be able to load and display one large JPEG file on Windows, no?

所有这些方法的MSDN文档很少,只告诉我,当返回E_OUTOFMEMORY时,
'Direct2D无法分配足够的内存来完成调用。'在哪里?什么?

The MSDN documentation on all these methods is sparse and only tells me that when E_OUTOFMEMORY is returned the 'Direct2D could not allocate sufficient memory to complete the call.' Where? What?

我知道 GetMaximumBitmapSize ,当硬件渲染打开时返回16384,当我切换到软件渲染时返回2Gig。但是CreateBitmapFromWicBitmap 无论是哪种方式都失败了,还有软件渲染,

I know about GetMaximumBitmapSize and it returns 16384 when hardware rendering is on, and 2Gig when I switch to software rendering. But the CreateBitmapFromWicBitmap  fails either way, also with software rendering,

为什么会这样? CreateBitmapFromWicBitmap的限制是什么?如何克服这个问题并在任一维度上加载20,000像素的标准全景文件?

Why is that? What are the limits of CreateBitmapFromWicBitmap? How to overcome this and load standard panorama files with 20,000 pixels in either dimension?




推荐答案

我还没有尝试过小于
GetMaximumBitmapSize 返回的值的其他图像,例如16380 x 12000像素的文件。但
CreateBitmapFromWicBitmap
仍然失败。我在MSDN上找不到有关此功能限制的任何信息,如何获取有关问题来源,检查内容的其他信息。非常稀疏的文档......
I have no also tried other images which are smaller than the value returned by GetMaximumBitmapSize, e.g. files with 16380 x 12000 pixel. But CreateBitmapFromWicBitmap still fails. I could not find any information on MSDN about the limits of this function, how to get additional information about the source of the problem, what to check. Very sparse documentation...


这篇关于CreateBitmapFromWicBitmap失败并显示E_OUTOFMEMORY的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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