1.BMP file structure, attention byte alignment
__packed struct tagBITMAPFILEHEADER
{
T_U16 bfType;
T_U32 bfSize;
T_U16 bfReserved1;
T_U16 bfReserved2;
T_U32 bfOffBits;
} ;
Data structured packing, wherein RawWidth, RawHeight refers RAW image width and height, little endian
the memcpy (& file_head_t.bfType, "the BM", the sizeof (file_head_t.bfType));
file_head_t.bfSize = 1078 * + rawwidth rawheight;
file_head_t.bfOffBits = 1078;
2. BMP information structure, attention byte alignment
__packed struct tagBITMAPINFOHEADER
{
T_U32 biSize;
T_U32 biWidth;
T_U32 biHeight;
T_U16 biPlanes;
T_U16 biBitCount;
T_U32 biCompression;
T_U32 biSizeImage;
T_U32 biXPelsePerMeter;
T_U32 biYPelsePerMeter;
T_U32 biClrUsed;
T_U32 biClrImportant;
} ;
Data structured packing, wherein RawWidth, RawHeight refers RAW image width and height, little endian
info_head_t.biSize = 40;
info_head_t.biWidth = RawWidth;
info_head_t.biHeight = RawHeight;
info_head_t.biPlanes = 1;
info_head_t.biBitCount = 8;
info_head_t.biCompression = 0;
info_head_t.biSizeImage = RawWidth*RawHeight;
info_head_t.biClrUsed = 256;
3. palette data structure
__packed typedef struct tagRGBQUAD
{
T_U8 rgbBlue;
T_U8 rgbGreen;
T_U8 rgbRed;
T_U8 rgbReserved;
} ;
The data length by info_head_t.biClrUsed (color index number) impact value, each index represents a pixel value, if the grayscale image rgbBlue = rgbGreen = rgbRed, each index 256 index occupies 4 bytes occupy 1024 bytes ,
And the image data value is the index number
The image data
Direct Copy RAW