There are a lot of comparisons between Android phones and iphones. We can't make a better conclusion, but we all know that the quality of the Android phone picture is worse than the iphone. Whether you're using Facebook, Twitter or even Instagram, taking photos, adding a filter, and then sharing it with a social platform, the images from Android phones are always rough. Why is it?
Since last year, our team has been working on this for a year. After in-depth research, this is due to Google's "very small" error. It's a small mistake, but its impact is very large (all Android apps involve pictures), and it continues to this day.
The problem is: libjpeg
We all know that libjpeg is widely used in a variety of open source image libraries. Android also uses Libjpeg to compress images. After digging deep into Android's source code, we can find that Android is based on an open-source image engine called Skia, compared to using the Libjpeg library directly. Skia is a great engine maintained by Google and it involves all the picture features. It is widely used in Google and other company products, such as Chrome, Firefox, Android and so on. Sika has good encapsulation, on the basis of which you can easily develop picture tools.
When we use Libjpeg to compress a picture, optimize_coding is a very important parameter. In Libjpeg's documentation, we can see that this parameter is described as follows:
Boolean optimize_coding
TRUE causes the compressor to compute optimal Huffman coding tables for the image. This requires an extra pass over the data and therefore costs a good deal of space and time. The default is FALSE, which tells the compressor to use the supplied or default Huffman tables. In most cases optimal tables save only a few percent of file size compared to the default tables. Note that if this was TRUE, you need not supply Huffman tables at all, and any of you do supply would be overwritten.
Source: >
As Libjpeg's documentation shows, we don't know that because optimize_coding is set to true it can take a lot of time and space, andthe default value for Optimize_coding is false.
Everything in the document seems to be fine, and the Libjpeg library is very stable. But a lot of people have overlooked this document for more than 10 years. At that time, space and computational power were very limited. These are not problems in today's modern computers or even on mobile phones. Instead, we should focus more on the quality of the image (Reitna screen) and the size of the image (cloud service).
Google Skia Project engineers did not set this parameter, so skia in theThe optimize_coding parameter is left false as the default value, and Skia hides the setting, and you cannot change this setting outside of the Sika project. So this becomes a big problem and we have to endure bad picture quality and larger file size.
Our team has tested a lot of different pictures. If you want image compression of the same quality, it willoptimize_coding set to False will be 5 to 10 times times larger than the size of the file set to True. The gap is very large.
We also compared the image compression between Android and iOS (they are all hiddenoptimize_coding Parameters). Under the same original picture, if you want to get the same quality level, you need 5 to 10 times times the file size on Android. The conclusion is clear that Apple does knowthe importance of optimize_coding and Huffman tables, and Google does not know. (Apple uses their own Huffman table algorithm, not like Libjpeg or Libjpeg-turbo, and it seems Apple does more work on compressing pictures)Finally, we decided not to use the JPEG compression algorithm provided by Android, and we compiled a native library based on the Libjpeg-turbo (Libjpeg-turbo also improved in performance). Now we can save 5 to 10 times times the space and enjoy the same even better picture quality. This job is entirely worth our doing.
Thank you for reading.
From for notes (Wiz)
Why is the image quality of the iphone better than Android?