导致IWICBitmapFrameEncode::SetPixelFormat返回与请求的格式不同的格式的原因
What causes IWICBitmapFrameEncode::SetPixelFormat to return a format different from the requested one?
我一直在使用WIC将多个图像编码为JPEGXR格式。有时,我的程序会在下面的Encode函数片段中记录最后一个LogAssert的错误。
hr = m_pFactory->CreateEncoder(GUID_ContainerFormatWmp, NULL, &pEncoder);
LogAssert(SUCCEEDED(hr),"Failed to create encoder. Err: 0x%x", hr);
hr = pEncoder->Initialize(pOutputStream, WICBitmapEncoderNoCache);
LogAssert(SUCCEEDED(hr),"Failed to initialize encoder. Err: 0x%x", hr);
hr = pEncoder->CreateNewFrame(&pBitmapFrame, &pPropertyBag);
LogAssert(SUCCEEDED(hr),"Encoder failed to create new frame. Err: 0x%x", hr);
SetEncodingProperties(pPropertyBag);
hr = pBitmapFrame->Initialize(pPropertyBag);
LogAssert(SUCCEEDED(hr),"Failed to initialize pBitmapFrame with the given properties. Err: 0x%x", hr);
hr = pBitmapFrame->SetSize(rawWidth, rawHeight);
LogAssert(SUCCEEDED(hr),"Failed to set bitmap size. Err: 0x%x", hr);
WICPixelFormatGUID formatGUID = GUID_WICPixelFormat24bppBGR;
hr = pBitmapFrame->SetPixelFormat(&formatGUID);
if(FAILED(hr) || !IsEqualGUID(formatGUID, GUID_WICPixelFormat24bppBGR))
{
LogAssert(false,"Failed to set pixel format to GUID_WICPixelFormat24bppBGR. Err: 0x%x", hr);
}
我检查了转储文件,返回的formatGUID似乎是GUID_WICPixelFormat24bppRGB。
我有以下问题:
SetPixel格式何时返回不同的版本?可能导致它返回不同GUID的因素是什么?
我总是对JPEGXR进行编码,并且总是应用相同的属性。为什么SetPixelFormat的行为是不确定的?它不是应该总是成功,还是总是返回GUID_WICPixelFormat24bppRGB?
如果支持RGB格式,为什么不支持BGR?这只是秩序的改变。
我的代码是在以下示例的帮助下编写的:
http://msdn.microsoft.com/en-us/library/windows/desktop/ee719871(v=vs.85).aspx
这是并发调用SetPixelFormat时可能发生的问题。我听说它将在Windows 8.1中修复。
相关文章:
- 有关插入适配器的错误。[错误]请求从 'back_insert_iterator<vector<>>' 类型转换为非标量类型
- 如何在openssl-ecc中获取十六进制格式的私钥
- 将"打开的CV图像"中的"颜色"转换为整数格式
- TDateTime格式在C++Builder中不会更改
- 如何在boost beast http请求中设置http头
- 发送一个带有libcurl C++问题的帖子请求:s
- 如何防止clang格式在流运算符调用之间添加换行符<<
- 检查不带转换的扫描格式
- 在多个核心中处理一个HTTP请求
- 当我尝试使用 sstream 和分面将 Boost Time_duration转换为字符串时,我没有得到所需的格式
- 是否可以从格式字符串中检索"width"
- clang格式:宏的缩进
- clang格式:禁用排序包含
- 在用于格式4的arm模拟器中实现功能时的一个问题
- 将RGB图像保存为PPM格式
- 询问在设计我的手臂模拟器功能表示格式1
- C++.SevenZip压缩为zip格式.ClassFactory无法提供请求的类
- 尝试使用 boost::asio 连接到 SOCKS 5 服务器,但我的连接请求格式不正确
- 导致IWICBitmapFrameEncode::SetPixelFormat返回与请求的格式不同的格式的原因
- 编译复杂的(有很多引用的)ASN模式-证书请求格式(RFC4211)