Interesting. Could be an ARM vs x86 related bug...
Breakpoint 1, ColorRangesCB::snap (this=0x232a70, this@entry=0x3b12c0, p=p@entry=2, pp=..., minv=@0xbeffe528: 10000, maxv=@0xbeffe524: -10000, v=@0xbeffe46c: 24) at transform/colorbuckets.hpp:300
300 e_printf("Corruption detected in snap (%d)!\n", cnt);
(gdb) p b
$1 = (const ColorBucket &) @0x22f878: {snapvalues = {<std::_Vector_base<short, std::allocator<short> >> = {
_M_impl = {<std::allocator<short>> = {<__gnu_cxx::new_allocator<short>> = {<No data fields>}, <No data fields>}, _M_start = 0x0, _M_finish = 0x0, _M_end_of_storage = 0x0}}, <No data fields>},
values = {<std::_Vector_base<short, std::allocator<short> >> = {_M_impl = {<std::allocator<short>> = {<__gnu_cxx::new_allocator<short>> = {<No data fields>}, <No data fields>}, _M_start = 0x0,
_M_finish = 0x0, _M_end_of_storage = 0x0}}, <No data fields>}, min = 10000, max = -10000, discrete = true}
Python Exception <class 'RuntimeError'> Type is not a template.:
Breakpoint 1, ColorRangesCB::snap (this=0x7a64f0, p=0, pp=..., minv=@0x7fffffffd94c: 0, maxv=@0x7fffffffd948: 47, v=@0x7fffffffd7ec: 11)
at transform/colorbuckets.hpp:300
Breakpoint 1, ColorRangesCB::snap (this=0x232a70, this@entry=0x3b12c0, p=p@entry=2, pp=..., minv=@0xbeffe528: 14, maxv=@0xbeffe524: 17, v=@0xbeffe46c: 24) at transform/colorbuckets.hpp:297
297 printf("STOP!\n");
Loading input file: ../bwgradiant800x600.png Alpha channel not actually used, dropping it.
(800x600)
Filled color buckets with 0 discrete colors + 731 continous buckets
Saving Y Color Bucket:
Saving I Color Buckets
Saving Q Color Buckets
Y buckets:
C0..244
I buckets:
C-1..1 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-2..2 C-1..2 C-2..2 C-2..2 C-2..2 C-1..2 C-2..2 C-2..2 C-2..2 C-2..1 C-2..2 C-2..1 C-1..1 C-1..0
Q buckets:
C-1..1 E
C-2..2 C-1..0
C-2..2 S0
C-2..2 C-1..0
C-2..2 C-1..1
C-2..2 S0
C-2..2 C0..1
C-2..2 S0
C-2..2 C-1..0
C-2..2 S0
C-2..2 C0..1
C-2..2 S0
C-2..2 C-1..1
C-2..2 C-1..0
C-2..2 S0
C-2..2 S0
C-2..2 C0..1
C-2..2 C0..1
C-2..2 S0
C-2..2 S0
C-2..2 C-1..1
C-2..2 C0..1
C-2..2 C0..1
C-2..2 C-1..1
C-2..2 C-1..0
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C0..1
C-2..2 C0..1
C-2..2 C0..1
C-2..2 C-1..0
C-2..2 C-1..1
C-2..2 C0..1
C-2..2 C0..1
C-2..2 C0..1
C-2..2 C-1..1
C-2..2 C-1..0
C-2..2 C0..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 S0
C-2..2 C-1..0
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C0..1
C-2..2 C-1..0
C-2..2 C0..1
C-2..2 S0
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..0
C-2..2 C0..1
C-2..2 C-1..1
C-2..2 S0
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..0
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..0
C-2..2 C-1..0
C-2..2 C-1..1
C-2..2 C-1..0
C-2..2 C-1..0
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..0
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..0
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..0
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..0
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..0
C-2..2 C0..1
C-2..2 C-1..0
C-2..2 C-1..1
C-2..2 C-1..0
C-2..2 C0..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..0
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C0..1
C-2..2 C-1..0
C-2..2 C-1..1
C-2..2 C-1..0
C-2..2 C-1..1
C-2..2 C-1..0
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..0
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..0
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..0
C-2..2 C-1..0
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..0
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..0
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C0..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..0
C-2..2 C-1..0
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C0..1
C-2..2 C-1..1
C-2..2 C-1..0
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C0..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C0..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C0..1
C-2..2 C0..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C0..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C0..1
C-2..2 C0..1
C-2..2 S0
C-2..2 C-1..1
C-2..2 C-1..1
C-2..2 C0..1
C-2..2 C0..1
C-2..2 C0..1
C-2..2 C0..1
C-2..2 C-1..1
C-2..2 C-1..0
C-2..2 C0..1
C-2..2 S0
C-2..2 S0
C-2..2 C0..1
C-2..2 C-1..1
C-2..2 C-1..0
C-2..2 C-1..1
C-2..2 S0
C-2..2 S0
C-2..2 C-1..0
C-2..2 C-1..0
C-2..2 C0..1
C-2..2 C-1..1
C-2..2 S0
C-2..2 C0..1
C-2..2 C-1..1
C-2..2 C-1..0
C-2..2 C-1..1
C-2..2 C0..1
C-2..2 C0..1
C-2..2 C-1..0
C-2..2 S0
C-2..2 C-1..0
C-2..2 S0
C-2..2 C0..1
C-2..2 C0..1
C-2..2 C-1..1
C-2..2 S0
C-2..2 C0..1
C-2..2 C-1..1
C-2..2 S0
C-2..2 S0
C-2..2 S0
C-2..2 C-1..1
C-2..2 C0..1
C-2..2 S0
C-2..2 C0..1
C-2..2 S0
C-2..2 S0
C-2..2 S0
C-2..2 S0
C-2..2 S0
C-1..2 C-1..0
C-2..2 S1
C-2..2 C-1..0
C-2..2 S0
C-2..2 C0..1
C-2..2 S0
C-2..2 S0
C-1..2 S0
C-2..2 C-1..0
C-1..2 E
C-2..2 S0
C-2..2 E
C-1..2 E
C0..1 E
Corruption detected!
Corruption detected!
Corruption detected!
Corruption detected!
Corruption detected!
Corruption detected!
flif: flif-enc.cpp:224: void flif_encode_FLIF2_inner(IO&, Rac&, std::vector<Coder>&, const Images&, const ColorRanges*, int, int, const int*) [with IO = FileIO; Rac = RacOutput24<FileIO>; Coder = FinalPropertySymbolCoder<SimpleBitChance, RacOutput24<FileIO>, 10>; Images = std::vector<Image>]: Assertion `curr <= max' failed.
Aborted
94% done [23/23] ENC[2,800x600] Writing checksum: 4CB1EECA
Wrote output FLIF file test05.flif, 212307 bytes for 800x600 pixels (3.5385bpp)
(gdb) bt
#0 ColorRangesCB::snap (this=0x1ff3d8, this@entry=0x3dc948, p=p@entry=2, pp=..., minv=@0xbeffe528: 10000, maxv=@0xbeffe524: -10000, v=@0xbeffe46c: 0) at transform/colorbuckets.hpp:295
#1 0x0004e130 in predict_and_calcProps_plane<Plane<short>, Plane<unsigned char>, false, false, 2, ColorRanges> (properties=..., ranges=0x3dc948, ranges@entry=0x1ff3d8, image=..., plane=..., planeY=...,
z=z@entry=1, r=287, r@entry=333092, c=797, c@entry=2, min=@0xbeffe528: 10000, max=@0xbeffe524: -10000, predictor=0, predictor@entry=-1090525912) at common.hpp:295
#2 0x00048bac in predict_and_calcProps (properties=..., ranges=0x1ff3d8, ranges@entry=0x11f, image=..., z=1, z@entry=0, p=p@entry=2, r=r@entry=287, c=c@entry=797, min=@0xbeffe528: 10000,
max=@0xbeffe524: -10000, predictor=0, predictor@entry=1) at common.cpp:148
#3 0x00051524 in find_best_predictor (images=..., ranges=0x11f, ranges@entry=0x1ff3d8, p=p@entry=2, z=0, z@entry=1) at flif-enc.cpp:163
#4 0x0006d708 in flif_encode<FileIO> (io=..., images=..., transDesc=..., encoding=<optimized out>, learn_repeats=2, acb=-1, palette_size=512, lookback=1, divisor=30, min_size=50,
split_threshold=split_threshold@entry=349504, cutoff=cutoff@entry=2, alpha=1, alpha@entry=19, crc_check=<optimized out>, crc_check@entry=-1, loss=19, loss@entry=0, predictor=0xffffffff,
predictor@entry=0xbeffe944, invisible_predictor=invisible_predictor@entry=2) at flif-enc.cpp:947
#5 0x00128bb4 in encode_flif (argc=argc@entry=1, argv=0x1, argv@entry=0xbeffeb00, images=..., options=...) at flif.cpp:387
#6 0x001299c8 in handle_encode (argc=1, argc@entry=2, argv=0xbeffeb00, argv@entry=0xbeffeafc, images=..., options=...) at flif.cpp:395
#7 0x0012a94c in main (argc=2, argv=0xbeffeafc) at flif.cpp:706
/media/sda1/sources/git/FLIF/src$ ./flif -v ../bwgradiant800x600.png ../test05.flif -B
FLIF (Free Lossless Image Format) 0.2.0rc19 [26 Aug 2016]
Loading input file: ../bwgradiant800x600.png Alpha channel not actually used, dropping it.
(800x600)
flif: flif-enc.cpp:224: void flif_encode_FLIF2_inner(IO&, Rac&, std::vector<Coder>&, const Images&, const ColorRanges*, int, int, const int*) [with IO = FileIO; Rac = RacOutput24<FileIO>; Coder = FinalPropertySymbolCoder<SimpleBitChance, RacOutput24<FileIO>, 10>; Images = std::vector<Image>]: Assertion `curr <= max' failed.
Aborted
seb@mint64-VirtualBox ~/git/FLIF $ src/flif -v -v -v -v -v -v -v /mnt/pandora/media/sda1/sources/git/FLIF/bwgradiant800x600.png test05.flif -B
____ _(_)____
(___ | | | ___) FLIF (Free Lossless Image Format) 0.2.0rc19 [26 Aug 2016]
(__ | |_| __) Copyright (C) 2016 Jon Sneyers and Pieter Wuille
(_|___|_) License LGPLv3+: GNU LGPL version 3 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Loading input file: /mnt/pandora/media/sda1/sources/git/FLIF/bwgradiant800x600.png Encountered unknown PNG text chunk (key: Software), ignoring it.
Alpha channel not actually used, dropping it.
(800x600, 3 channels, 8-bit)
Transforms: YCoCg, Bounds[0:0..244][1:-2..2][2:-2..2]
Plane 0: 0..244
Plane 1: -2..2
Plane 2: -2..2
Using pixel predictor method: -G??? -> -G200
i=2, r=1, fr=0, c=0, curr=69, min=0, max=244
i=2, r=1, fr=0, c=1, curr=172, min=0, max=244
Learning a MANIAC tree. Iterating 2 times.
0% done [1/23] ENC[0,100x75] i=1, r=1, fr=0, c=0, curr=0, min=0, max=244
/media/sda1/sources/git/FLIF/src$ ./flif -v -v -v -v -v -v -v ../bwgradiant800x600.png ../test05.flif -B
____ _(_)____
(___ | | | ___) FLIF (Free Lossless Image Format) 0.2.0rc19 [26 Aug 2016]
(__ | |_| __) Copyright (C) 2016 Jon Sneyers and Pieter Wuille
(_|___|_) License LGPLv3+: GNU LGPL version 3 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Loading input file: ../bwgradiant800x600.png Encountered unknown PNG text chunk (key: Software), ignoring it.
Alpha channel not actually used, dropping it.
(800x600, 3 channels, 8-bit)
Transforms: YCoCg, Bounds[0:0..244][1:-2..2][2:-2..2]
Plane 0: 0..244
Plane 1: -2..2
Plane 2: -2..2
Using pixel predictor method: -G??? -> -G000
i=2, r=1, fr=0, c=0, curr=228, min=0, max=244
i=2, r=1, fr=0, c=1, curr=170, min=0, max=244
flif: flif-enc.cpp:225: void flif_encode_FLIF2_inner(IO&, Rac&, std::vector<Coder>&, const Images&, const ColorRanges*, int, int, const int*) [with IO = FileIO; Rac = RacOutput24<FileIO>; Coder = FinalPropertySymbolCoder<SimpleBitChance, RacOutput24<FileIO>, 10>; Images = std::vector<Image>]: Assertion `curr <= max' failed.
Aborted
maniac/../image/image.hpp: In member function ‘virtual FourColorVals ConstantPlane::get4(uint32_t) const’:
maniac/../image/image.hpp:373:64: warning: SSE vector return without SSE enabled changes the ABI [-Wpsabi]
FourColorVals get4(const uint32_t pos) const ATTRIBUTE_HOT {
FWIW, I just built this at fdf0fc21 (v0.2 + fix #301) on my headless P3 server. Perhaps unsurprisingly, the compilation came with a far few warnings of the style:
Code:maniac/../image/image.hpp: In member function ‘virtual FourColorVals ConstantPlane::get4(uint32_t) const’: maniac/../image/image.hpp:373:64: warning: SSE vector return without SSE enabled changes the ABI [-Wpsabi] FourColorVals get4(const uint32_t pos) const ATTRIBUTE_HOT {
I guess that's because my Pentium 3 doesn't have any SSE instructions. But I've done a quick test of encoding and decoding on a couple of the included png files. The smaller tux with a limited palette comes back binary identical, but the photographic 512 line image came back slightly larger. Transferring those to my laptop though, they seem to look pretty similar to each other, if not identical.
It also seems to run a lot more quickly than old v0.1 did, so that's more good news. Thanks for all your hard work so far!
I'm working on a new lossless image compression algorithm, called FLIF.
I tried 0.2 and it's very good and without patent constraints it actually could go places - esp. considering it doesn't feature a generation loss after "lossy" optimization.
For widespread use, good metadata handling is paramount - it's supposed to support icc, xmp and exif? For this to happen, the support of the one ring app to rule them all would be very welcome - Phil Harvey's exiftool. Please be a dear and send him some flif samples with the respective metadata and a link to the spec, would you ...
http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,7665.msg38910.html#msg38910
[doublepost=1475956627,1475954640][/doublepost]Is metadata supposed to work in flif 0.2 anyway? I've tried and ...
* xmp: encodes ok, but xmp tag is garbled on decoding back to png
* exif: encodes ok, but tag is lost on conversion back
* icc: refuses to encode
See samples attached.
The file format has been standardised and versioned. The latest stable version is FLIF16 and is documented here