WICConvertBitmapSource() throws error for GUID_WICPixelFormat16bppCbCr

1

I need to convert rgb to YCBCR pixel format. and i used WICConvertBitmapSource(). my source pixel format is GUID_WICPixelFormat24bppBGR. And iwanted to convert it to GUID_WICPixelFormat16bppCbCr

when I trying to pass that to the function, its return HRESULT as 0x88982F50. if i pass GUID_WICPixelFormat32bppBGRA ,the functions returns no error

my questions are

  1. why is my conversion fail
  2. how should i convert RGB to YCbCr correctly

  3. and what does 0x88982F50 means actually

This is how i tried.

int mwic_bitmap_converter 
(
REFWICPixelFormatGUID dstPixelFormt,    /* [in] Pixel format to be converted */
IWICBitmapSource* piBitmapSource,       /* [in] Image Data */
IWICBitmapSource** ppiBitmapDst         /* [out]converted image data */
)
{
    WICPixelFormatGUID srcPixelFormat = { 0 };  /* Pixel format of the source */
    UINT iWidth = 0, iHeight = 0;               /* Size of the source */
    UINT cbStride;                              /* Stride of the bitmap */
    UINT cbBufferSize;                          /* Size of the buffer */
    float* pixels;                              /* Pixel buffer */

    piBitmapSource->GetSize(&iWidth,&iHeight);
    piBitmapSource->GetPixelFormat(&srcPixelFormat);

    if (!IsEqualGUID(srcPixelFormat, dstPixelFormt))
    {
        //this line gives the error
        hr = WICConvertBitmapSource(dstPixelFormt, piBitmapSource, ppiBitmapDst);
    }
 .
 .
 .
 .
 .
}
c++
image
wic
asked on Stack Overflow Mar 14, 2015 by wicky • edited Mar 27, 2015 by wicky

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0