I am trying to read a blob from memory which has a 16 bpp BMP encoded in UYVY.
I'm using it in directshow; I read the BimapInfoHeader from a IMediaSample, write my own BITMAPFILEHEADER, then copy the BITMAPINFOHEADER as follows.
Code: Select all
const int SZ_BMP_HEADER = 54;
[...]
//BITMAPFILEHEADER
_this->m_pDatos[0] = 'B'; _this->m_pDatos[1] = 'M';
*((int*) &_this->m_pDatos[2]) = _this->m_szDatos + SZ_BMP_HEADER;
*((short*) &_this->m_pDatos[6]) = 0;
*((short*) &_this->m_pDatos[8]) = 0;
*((int*) &_this->m_pDatos[10]) = SZ_BMP_HEADER;
//BITMAPINFOHEADER
*((int*) &_this->m_pDatos[14]) = _this->m_BMIHeader.biSize;
*((int*) &_this->m_pDatos[18]) = _this->m_BMIHeader.biWidth;
*((int*) &_this->m_pDatos[22]) = _this->m_BMIHeader.biHeight;
*((short*) &_this->m_pDatos[26]) = _this->m_BMIHeader.biPlanes;
*((short*) &_this->m_pDatos[28]) = _this->m_BMIHeader.biBitCount;
*((int*) &_this->m_pDatos[30]) = _this->m_BMIHeader.biCompression;
*((int*) &_this->m_pDatos[34]) = _this->m_BMIHeader.biSizeImage;
*((int*) &_this->m_pDatos[38]) = _this->m_BMIHeader.biXPelsPerMeter;
*((int*) &_this->m_pDatos[42]) = _this->m_BMIHeader.biYPelsPerMeter;
*((int*) &_this->m_pDatos[46]) = _this->m_BMIHeader.biClrUsed;
*((int*) &_this->m_pDatos[50]) = _this->m_BMIHeader.biClrImportant;
If I write a 0 in m_pDatos[30], then everything works fine m_BMIHeader contains 'YVYU' )SYSTEM32: unrecognized compression `' @ bmp.c/ReadBMPImage/805
I'm using ImageMagick-6.4.9-Q8 on Windows XP
Do I need a plugin or something?
Thanks.