ihhub / penguinV

Computer vision library with focus on heterogeneous systems
Other
119 stars 90 forks source link

Optimise Bitmap image saving function #644

Closed ihhub closed 3 years ago

ihhub commented 4 years ago

We have Bitmap image saving function void Save( const std::string & path, const penguinV::Image & image, uint32_t startX, uint32_t startY, uint32_t width, uint32_t height ) which locates in src/file/bmp_image.h and src/file/bmp_image.cpp files.

During file saving we purposely copy a line of image to temporary array and then write the array into file. The reason behind this is that Bitmap image must have number of bytes to be as a multiplier of 4. For example, if image is 10 bytes/pixel it means that we need to write an additional 2 pixels of value 0.

We want to avoid extra copying to temporary array and directly write data from Image object and add needed amount of bytes into the file.

manekenpix commented 3 years ago

Can I try this one for hacktoberfest?

ihhub commented 3 years ago

Hi @manekenpix , yes you can.