c++ - What causes IWICBitmapFrameEncode::SetPixelFormat to return a format different from the requested one? -


i've been using wic encode multiple images jpegxr format. occassionally, program logs error last logassert in following snippet of encode function.

hr = m_pfactory->createencoder(guid_containerformatwmp, null, &pencoder); logassert(succeeded(hr),"failed create encoder. err: 0x%x", hr);  hr = pencoder->initialize(poutputstream, wicbitmapencodernocache); logassert(succeeded(hr),"failed initialize encoder. err: 0x%x", hr);  hr = pencoder->createnewframe(&pbitmapframe, &ppropertybag); logassert(succeeded(hr),"encoder failed create new frame. err: 0x%x", hr);  setencodingproperties(ppropertybag);  hr = pbitmapframe->initialize(ppropertybag); logassert(succeeded(hr),"failed initialize pbitmapframe given properties. err: 0x%x", hr);  hr = pbitmapframe->setsize(rawwidth, rawheight); logassert(succeeded(hr),"failed 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 set pixel format guid_wicpixelformat24bppbgr. err: 0x%x", hr); } 

i checked dump file , seems returned formatguid guid_wicpixelformat24bpp rgb.

i have following questions:

  1. when setpixel format return different version? factors cause return different guid?

  2. i encoding jpegxr, , applying same properties. why behavior of setpixelformat non-deterministic? shouldn't either succeed, or return guid_wicpixelformat24bpprgb?

  3. if rgb format supported, why isn't bgr? it's change in order.

my code, written of examples here:

http://msdn.microsoft.com/en-us/library/windows/desktop/ee719871(v=vs.85).aspx

this issue can happen concurrent calls setpixelformat. i've heard fixed in windows 8.1.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -