Menu

#25 OpenMP support

open
nobody
None
3
2016-12-30
2014-05-06
No

libpng is currently single threaded. That is a bottleneck in applications. For instance during conversion of CameraRAW images, including colour conversion, the libpng writer takes the longest time.

Therefore I would like to parallelise through OpenMP like follows:

pragma omp parallel for private(pointers)

for(y = 0; y < height; ++y)
{
void * p = getLine( image, y );
png_bytep pointers[2] = {0,0};

pointers[0] = p;
png_write_rows(png_ptr, pointers, 1);

}

Would a per line compression have side effects on compression ration?

Makes threaded PNG reading sense?

Discussion

  • Glenn Randers-Pehrson

    Per-line compression would have adverse affects because the zlib dictionary would have to be restarted at the beginning of each line. Per-line decoding could only work with PNG files that are known to have been per-line compressed.

     
  • Richard Steffen

    Richard Steffen - 2016-12-30

    If one is using OpenMP to compress/decompress multiple image files in an application already, OpenMP will not work anymore (no thread in thread in OpenMP possible).
    Side effects to thousend of implementations are huge.

     

Log in to post a comment.

MongoDB Logo MongoDB