Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving heif decoding performance #1215

Open
roticv opened this issue Jul 1, 2024 · 1 comment
Open

Improving heif decoding performance #1215

roticv opened this issue Jul 1, 2024 · 1 comment

Comments

@roticv
Copy link
Contributor

roticv commented Jul 1, 2024

I have been looking into improving heic decoding performance. My use case is:

  • Input: YUV420 HEVC, multiple tile
  • Output: RGB interlaced

In my benchmark with hacky implementation with libyuv (see the question below about why libyuv) and fixing the separate RGB channel to interlaced RGB conversion, my numbers are roughly:

  • 42ms with ffmpeg decoder plugin (and libheif yuv2rgb conversion)
  • 30ms with ffmpeg decoder plugin + libyuv for yuv2rgh interlaced conversion

Questions:

  • Does it make sense to use libyuv for yuv2rgb conversion? sharpyuv doesn't do yuv2rgb. The other alternative is libswscale (from ffmpeg), but following ffmpeg-devel mailing list, it has not been getting much love until recently and there is some suggestion that libyuv performs better than libswscale https://ffmpeg.org/pipermail/ffmpeg-devel/2024-June/330395.html
  • Is the logic to default to using chroma_444 in decode_image_planar intentional? Is there any objection to change it to depend on out_chroma instead?

Thanks

@farindk
Copy link
Contributor

farindk commented Oct 30, 2024

In the upcoming v1.19.0, I have removed many of the unnecessary internal color conversions. Decoding should be faster in many cases.

To get the best decoding speed, use heif_decode_image() with heif_colorspace_unknown and heif_chroma_unknown. Then libheif will use the colorspace of the input image as long as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants