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

Making JPEG decoder faster #944

Closed
photopea opened this issue Apr 1, 2020 · 4 comments
Closed

Making JPEG decoder faster #944

photopea opened this issue Apr 1, 2020 · 4 comments

Comments

@photopea
Copy link

photopea commented Apr 1, 2020

I would like to use your JPEG decoder in a webapp. I compiled it to WebAssembly (13.8 kB .WASM file).

It works well and is quite fast (3x faster than the Javascript decoder from the pdf.js library).

Do you think it could be made even faster? Sadly, WASM does not support SIMD instructions, so we should aim for other ways of optimization. What about reading Huffman codes faster (use different hash tables, to decode more bits at one step). Do you think it is possible?

@rygorous
Copy link
Collaborator

rygorous commented Apr 1, 2020 via email

@photopea
Copy link
Author

photopea commented Apr 1, 2020

I should say, that I value the simplicity over the speed. But maybe, it is possible just to rewrite something, to get more speed. Or increase the size of the code only by 10 - 20%, while the speed gains will be much higher. I think libjpeg_turbo is fast because of cpu-specific code (assembly or SIMD instructions), which is not what I want.

I implemented a Deflate decoder once, which is much faster than the ZLIB. My decoder requires 64 kB of RAM, while ZLIB works in 32 kB of RAM. And my code is much shorter.

Could you spend an hour or two to implement your speed-up ideas? Maybe you can make it 2x faster with 20 extra lines of code. I can donate 100 - 200 USD to this project for that.

@rygorous
Copy link
Collaborator

rygorous commented Apr 5, 2020 via email

@photopea
Copy link
Author

photopea commented Apr 5, 2020

I was talking about 20 extra lines of code, you are talking about 500 lines, which I never said.

I understand your position. I think you are doing a great job and I wish you good luck, keep up the good work!

@photopea photopea closed this as completed Apr 5, 2020
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