libheif icon indicating copy to clipboard operation
libheif copied to clipboard

Reuse decoder buffer (instead of alloc + memcpy)

Open roticv opened this issue 7 months ago • 4 comments

My understanding is that when attempting to decode heic to an output colorspace (such as RGB), libheif does this:

  • Use plugin to decode
  • Each plugin has its own decode buffer to decode to and call into heif_image_add_plane to allocate for each plane and then memcpy from the decode buffer into the heif image plane buffer
  • Color conversion (such as from YUV420 to RGB): another heif_image has to allocate buffer and the color conversion happens

Is there a need to memcpy from decoder buffer into heif image plane buffer? In theory, there isn't a need to do so, there is just a need to support custom memory (how to scan through the data for color conversion). This should improve heif decoding performance.

The above is just my surface understanding of libheif. Let me know if it makes sense.

roticv avatar Jun 27 '24 18:06 roticv