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
how should i convert RGB to YCbCr correctly
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);
}
.
.
.
.
.
}
User contributions licensed under CC BY-SA 3.0