The JPG encoding class after vector optimization is four times more efficient than the class with the same functions provided by Adobe.

Source: Internet
Author: User

Class file javasencoder: http://www.bytearray.org/wp-content/projects/fastjpeg/JPEGEncoder.as

 

Here is a little demo (encoding a 2880*2880 bitmapdata) showing the difference between the old version and the new one, if you cocould post your results through the comments that wocould be interesting:

 

 

 

 

So what did I do?

  • I used bitwise operators as much as possible.
  • I replaced all arrays with Fixed Length vectors.
  • I used pre-incrementation rather than post-incrementation (thanks Joa for this one ).
  • I casted to int almost all my vector indices access.
  • Other minor stuff you always do to optimize your code

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.