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

High CPU Usage During HEIF Format Conversion #1327

Open
Axin647 opened this issue Oct 8, 2024 · 4 comments
Open

High CPU Usage During HEIF Format Conversion #1327

Axin647 opened this issue Oct 8, 2024 · 4 comments

Comments

@Axin647
Copy link

Axin647 commented Oct 8, 2024

I tried to implement the conversion to HEIF format using a simple example, and it was successful. However, the CPU usage is very high. My encoders and decoders are libde265 and libx265. When running this code, the CPU usage spikes significantly:
error = heif_context_encode_image(ctx, image, encoder, nullptr, nullptr);
if (error.code != heif_error_Ok) {
std::cerr << "编码图像失败: " << error.message << std::endl;
heif_encoder_release(encoder);
heif_image_release(image);
heif_context_free(ctx);
return false;
}

@Axin647
Copy link
Author

Axin647 commented Oct 9, 2024

Is it possible to add an entry to set the x265 thread pool size in libheif?

@farindk
Copy link
Contributor

farindk commented Oct 9, 2024

Why would that be useful? It will make the encoding much slower.

@Axin647
Copy link
Author

Axin647 commented Oct 10, 2024

Thank you for your reply. What I mean is, are there any alternative solutions to address the issue of high CPU usage?

@farindk
Copy link
Contributor

farindk commented Oct 10, 2024

are there any alternative solutions to address the issue of high CPU usage?

Not much, actually. Encoding to HEIC/AVIF is simply much more computation intensive than JPEG.
Only hardware acceleration support might help.

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