FLIF-hub / FLIF

Free Lossless Image Format
Other
3.72k stars 229 forks source link

More iteration does not mean better compression #103

Closed psykauze closed 9 years ago

psykauze commented 9 years ago

I have tried flif today and here the first result I've had:

Setting "-r" parameter to 32 make a FLIF file much bigger than default and bigger than "-r 1"

psykauze@psykauze-laptop:/tmp/FLIF-master$ ./flif -vvv -n -r 1 ../DSC_0658.rggb ../DSC0658-4.FLIF ____ () ___ (_ || | | || _) FLIF 0.1 [19 October 2015](_ || |||| ) Free Lossless Image Format (||__) |__) (c) 2010-2015 J.Sneyers & P.Wuille, GNU GPL v3+

Loading input file: ../DSC_0658.rggb
Input: 2144x1422, channels: 4, depth: 16 bit Transforms: YIQ, BND Header: 29 bytes. MANIAC tree: 16415 bytes. 50% done [1/4] ENC[2144x1422] filesize : 2542227 (+2525783 for 3048768 pixels, 6.627682 bpp) 62% done [2/4] ENC[2144x1422] filesize : 4818995 (+2276768 for 3048768 pixels, 5.974264 bpp) 75% done [3/4] ENC[2144x1422] filesize : 7448578 (+2629583 for 3048768 pixels, 6.900054 bpp) 87% done [4/4] ENC[2144x1422] filesize : 10074713 (+2626135 for 3048768 pixels, 6.891006 bpp) Encoding done, 10074713 bytes for 2144x1422 pixels (3.3045bpp)
psykauze@psykauze-laptop:/tmp/FLIF-master$ ./flif -vvv -n -r 2 ../DSC_0658.rggb ../DSC0658-3.FLIF ____ () ___ (_ || | | || _) FLIF 0.1 [19 October 2015](_ || |||| ) Free Lossless Image Format (||__) |__) (c) 2010-2015 J.Sneyers & P.Wuille, GNU GPL v3+

Loading input file: ../DSC_0658.rggb
Input: 2144x1422, channels: 4, depth: 16 bit Transforms: YIQ, BND Learning a MANIAC tree. Iterating 2 times. Header: 29 bytes. MANIAC tree: 27688 bytes. 66% done [1/4] ENC[2144x1422] filesize : 2549610 (+2521893 for 3048768 pixels, 6.617474 bpp) 75% done [2/4] ENC[2144x1422] filesize : 4822739 (+2273129 for 3048768 pixels, 5.964715 bpp) 83% done [3/4] ENC[2144x1422] filesize : 7447366 (+2624627 for 3048768 pixels, 6.887049 bpp) 91% done [4/4] ENC[2144x1422] filesize : 10067538 (+2620172 for 3048768 pixels, 6.875359 bpp) Encoding done, 10067538 bytes for 2144x1422 pixels (3.3022bpp)
psykauze@psykauze-laptop:/tmp/FLIF-master$ ./flif -vvv -n -r 3 ../DSC_0658.rggb ../DSC0658-2.FLIF ____ () ___ (_ || | | || _) FLIF 0.1 [19 October 2015](_ || |||| ) Free Lossless Image Format (||__) |__) (c) 2010-2015 J.Sneyers & P.Wuille, GNU GPL v3+

Loading input file: ../DSC_0658.rggb
Input: 2144x1422, channels: 4, depth: 16 bit Transforms: YIQ, BND Learning a MANIAC tree. Iterating 3 times. Header: 29 bytes. MANIAC tree: 38648 bytes. 75% done [1/4] ENC[2144x1422] filesize : 2558251 (+2519574 for 3048768 pixels, 6.611389 bpp) 81% done [2/4] ENC[2144x1422] filesize : 4829066 (+2270815 for 3048768 pixels, 5.958643 bpp) 87% done [3/4] ENC[2144x1422] filesize : 7450784 (+2621718 for 3048768 pixels, 6.879416 bpp) 93% done [4/4] ENC[2144x1422] filesize : 10067431 (+2616647 for 3048768 pixels, 6.866110 bpp) Encoding done, 10067431 bytes for 2144x1422 pixels (3.3021bpp)
psykauze@psykauze-laptop:/tmp/FLIF-master$ ./flif -vvv -n -r 32 ../DSC_0658.rggb ../DSC0658-r32.FLIF ____ () ___ (_ || | | || _) FLIF 0.1 [19 October 2015](_ || |||| ) Free Lossless Image Format (||__) |__) (c) 2010-2015 J.Sneyers & P.Wuille, GNU GPL v3+

Loading input file: ../DSC_0658.rggb
Input: 2144x1422, channels: 4, depth: 16 bit Transforms: YIQ, BND Learning a MANIAC tree. Iterating 32 times. Header: 29 bytes. MANIAC tree: 1131612 bytes. 96% done [1/4] ENC[2144x1422] filesize : 3639961 (+2508320 for 3048768 pixels, 6.581859 bpp) 97% done [2/4] ENC[2144x1422] filesize : 5899357 (+2259396 for 3048768 pixels, 5.928679 bpp) 98% done [3/4] ENC[2144x1422] filesize : 8505177 (+2605820 for 3048768 pixels, 6.837700 bpp) 99% done [4/4] ENC[2144x1422] filesize : 11103368 (+2598191 for 3048768 pixels, 6.817681 bpp) Encoding done, 11103368 bytes for 2144x1422 pixels (3.6419bpp)

matthiaskrgr commented 9 years ago

I guess that's why the default is set to 3.

jonsneyers commented 9 years ago

Exactly. Nobody claims that more iterations will result in better compression. Iterating more than 5 times will almost certainly result in worse compression.

psykauze commented 9 years ago

I'm sorry. I have thinked that "iteration" tried with "1" to "n" and took the best compression. :/

heavyk commented 9 years ago

hmmm, interesting. could there be an option to iterate until the compression gets worse, then use the second to last iteration?

matthiaskrgr commented 9 years ago

I started working on some script which runs flif with different iterations and compares/tries to find out the best one. https://github.com/matthiaskrgr/flifcrush_bad It's still a bit buggy and very stupid (thus the "bad" suffix) but should be enough to get some rough idea regarding maniac iterations.