iamrameshkumar
iamrameshkumar

Reputation: 1408

LibWebP is taking too much time for image compression

I'm working on the image compression techniques and analyzing the best algorithms that could produce smaller output within 100 ms or lesser for images of resolution 1920 * 1080 on a laptop with octa core processor for transmission through the network.

I had been using GDI+ and CxImage libraries for image compression, through JPG or PNG compression techniques that gives me the output image within around 30 ms for JPG and around 70 ms using PNG for colorful images, time taken is pretty good but the compressed data size is much higher in size if I go for better quality.

Then I came across google's WebP format. I tried it using libWebP with VC++. The quality and the compression rate is really awesome but the time taken is is much higher than I expected. It takes more than 300 ms and sime times even more than 1 second if I set true for alpha filtering and alpha compression.

Here are my WebpConfig settings

    m_webp_config.quality           = 50;
    m_webp_config.alpha_quality     = 0;
    m_webp_config.lossless          = false;
    m_webp_config.method            = 3;
    m_webp_config.alpha_compression = false;
    m_webp_config.alpha_filtering   = false;
    m_webp_config.autofilter        = false;
    m_webp_config.filter_sharpness  = false;
    m_webp_config.filter_strength   = 0;
    m_webp_config.filter_type       = 0;
    m_webp_config.use_sharp_yuv     = false;

And sometimes I get black images whenever I capture command prompt or notepad++ (I suspect that the problem is with those images with lot of text data but the same is not true with web pages that has huge amount of text)

Am I doing anything wrong with the WebPConfig ? Is there a way to optimize it?.

I didn't find much documentation and any forums that can give me some idea with these problems.

Any help would be appreciated. Thanks in advance.

Upvotes: 2

Views: 501

Answers (1)

Jyrki Alakuijala
Jyrki Alakuijala

Reputation: 705

Try lossless compression? There can be modes of lossless that are faster than the lossy.

If you are in control of the compression and decompression, split the image into 256x256 squares and compress and send them separately. That way you can not only parallelize the computation, but also interleave some of the transmission to happen during the compression, which may simplify your time budgeting for the compression computation.

If you reduce the 'method' value, you will generally find a faster WebP compression. For lossless, you need to reduce BOTH method and quality, they control the same thing in a complicated manner. For lossless, try quality 20 and method 1 (or perhaps there is a 0 method, too, don't remember).

Upvotes: 1

Related Questions