Мне нужно преобразовать rgb в формат пикселей YCBCR. и я использовал WICConvertBitmapSource()
. мой формат исходного пикселя GUID_WICPixelFormat24bppBGR
. И я хотел преобразовать его в GUID_WICPixelFormat16bppCbCr
когда я пытаюсь передать это функции, она возвращает HRESULT как 0x88982F50. если я передам GUID_WICPixelFormat32bppBGRA
, функции не вернут ошибку
мои вопросы
- почему моя конвертация не удалась
как мне правильно преобразовать RGB в YCbCr
и что на самом деле означает 0x88982F50
Вот как я пытался.
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);
}
.
.
.
.
.
}