Can a high-performance jpeglib-turbo implmentation decompress/compress in <100ms?

旧巷老猫 提交于 2019-12-30 05:19:08

问题


I'm currently implementing a jpeg resizer in C++ using the jpeglib-turbo library.

I've been given the target of 100 milli-seconds for JPEG decompression and recompression using the library. The best I can come up with using the recommended optimisation settings (documented in jpeglib-turbo usage.txt) is around 320ms, so I'm wondering is 100ms even possible/realistic? This would be to decompress/recompress an image of 3000x4000 px from around 6Mb in size to 130Kb.

The code that I'm using for fast decompression is:

    dinfo.dct_method = JDCT_IFAST;
    dinfo.do_fancy_upsampling = FALSE;
    dinfo.two_pass_quantize = FALSE;
    dinfo.dither_mode = JDITHER_ORDERED;
    dinfo.scale_num = 1/8;

回答1:


Thanks for the answers.

It is actually possible to decompress and re-compress in around 100ms. After contacting the writer of libjpeg-turbo he told me that the dinfo.scale_num property I was using was wrong. This property is the scale numerator - I also needed to set the scale_denom (denominator) property.

So the good code would be:

 dinfo.dct_method = JDCT_IFAST;
 dinfo.do_fancy_upsampling = FALSE;
 dinfo.two_pass_quantize = FALSE;
 dinfo.dither_mode = JDITHER_ORDERED;
 dinfo.scale_num = 1;
 dinfo.scale_denom = 8;

I want the code to be so fast as the image scaling should be imperceptible for the user as it's in a client application where speed/user-experience is the most important thing.



来源:https://stackoverflow.com/questions/10146434/can-a-high-performance-jpeglib-turbo-implmentation-decompress-compress-in-100ms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!