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

Encoder improvement: smaller, faster and finer #3

Merged
merged 1 commit into from
Feb 25, 2016

Conversation

saitoha
Copy link
Contributor

@saitoha saitoha commented Feb 24, 2016

This patch introduces various improvements to Encode() method

Quarity improvement
The patched version does median-cut quantization(by using github.com/soniakeys/quant/median) and floyd-steinberg error diffusion dithering.

former:
snake

new:
snake

Compression improvement
The SIXEL file converted from above test image(snake.jpg) by patched version is reduced its size by 55.4%.

former:

$ curl -O https://raw.githubusercontent.com/saitoha/libsixel/master/images/snake.jp
$ ./gosr snake.jpg |wc -c
928336

new:

$ curl -O https://raw.githubusercontent.com/saitoha/libsixel/master/images/snake.jp
$ ./gosr snake.jpg |wc -c
414259

Performance improvement
The patched version encodes above test image(snake.jpg) more 41.4% faster than current version.

former:

$ curl -O https://raw.githubusercontent.com/saitoha/libsixel/master/images/snake.jp
$ seq 1 10|while read i ;do time ./gosr snake.jpg > /dev/null; done 2>&1|awk '{sum+=$11;c++}END{print(sum/c)}'       
1.5232

new:

$ curl -O https://raw.githubusercontent.com/saitoha/libsixel/master/images/snake.jp
$ seq 1 10|while read i ;do time ./gosr snake.jpg > /dev/null; done 2>&1|awk '{sum+=$11;c++}END{print(sum/c)}'       
0.893

@mattn
Copy link
Owner

mattn commented Feb 25, 2016

Wow!

mattn added a commit that referenced this pull request Feb 25, 2016
Encoder improvement: smaller, faster and finer
@mattn mattn merged commit a952203 into mattn:master Feb 25, 2016
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

Successfully merging this pull request may close these issues.

2 participants