News for hackers. Stuff that matters.
Re:How are zlib, gzip and Zip related? (2013) by lpage on Friday June 17, 2016 @04:36PM (#11925386)
In other compression news, Apple open sourced their implementation of lzfse yesterday: https://github.com/lzfse/lzfse. It's based on a relatively new type of coding - asymmetric numeral systems. Huffman coding is only optimal if you consider one bit as the smallest unit of information. ANS (and more broadly, arithmetic coding) allows for fractional bits and gets closer to the Shannon limit. It's also simpler to implement than (real world) Huffman.

Unfortunately, most open source implementations of ANS are not highly optimized and quite division heavy, so they lag on speed benchmarks. Apple's implementation looks pretty good (they're using it in OS X, err, macOS, and iOS) and there's some promising academic work being done on better implementations (optimizing Huffman for x86, ARM, and FPGA is a pretty well studied problem). The compression story is still being written.

Re:How are zlib, gzip and Zip related? (2013) by twitch_checksum on Saturday June 18, 2016 @09:22AM (#11928491)
History rewritten once again...

Apple's fse implementation is based on an open-source work from an individual which predates lzfse by about ~20 months.

https://github.com/Cyan4973/FiniteStateEntropy

It's even less optimized than the original one, due to a few errors that slipped through during lzfse conception.

http://encode.ru/threads/2221-LZFSE-New-Apple-Data-Compressi...

Re:How are zlib, gzip and Zip related? (2013) by twotwotwo on Friday June 17, 2016 @07:56PM (#11926267)
More compression news!: https://github.com/Cyan4973/zstd declared its format stable a couple days ago, getting a step towards 1.0. In the example there, it's a little denser than gzip -1 and a lot faster, and includes entropy encoding that uses finite state machines (and that I don't truly understand--maybe there's some similarity to lzfse there). It can look at your data and construct a static dictionary, which sounds cool for tasks like packing a bunch of 4kb database pages.

(https://github.com/google/gipfeli is another compressor aiming at that general space ('fast but not Snappy/LZ4 fast'), but I don't think it caught on much.)

Re:How are zlib, gzip and Zip related? (2013) by legulere on Friday June 17, 2016 @06:08PM (#11925862)
I followed your link which leads me to rant a bit:

LZFSE has been out since one year. Not one mention on wikipedia. The repo lacks a good description what lzfse is. It also contains a LZVN encoder/decoder. The only information I found about it is some blog where someone seems to reverse engineer it for some hackintosh purposes.

I know documenting and presenting the case why people should use your software/file format can be annoying to do, but it's really important.

Re:How are zlib, gzip and Zip related? (2013) by js2 on Friday June 17, 2016 @07:28PM (#11926162)
WWDC video talking about it:

https://developer.apple.com/videos/play/wwdc2015/712/

Apple's docs:

https://developer.apple.com/library/mac/documentation/Perfor...

Generic info on finite state entropy compression:

http://fastcompression.blogspot.com/2013/12/finite-state-ent...

The last link was submitted to HN:

https://news.ycombinator.com/item?id=7040951

The repo's README seems pretty clear. Google provides the rest. Not really sure how much more there is to say about a reference compression algorithm.

Re:How are zlib, gzip and Zip related? (2013) by AceJohnny2 on Friday June 17, 2016 @09:15PM (#11926526)
Those first two links should ideally have been included in the project's README. From a maintainer's perspective, "Google it" should never be acceptable.
Re:How are zlib, gzip and Zip related? (2013) by mayoff on Friday June 17, 2016 @05:00PM (#11925520)
Strange that Apple didn't publish it on https://github.com/apple (which holds all of their open Swift repos).

Also, to clarify, ANS is relatively new (2009) but arithmetic coding has been around for a long time. Historically it was avoided because of patents, many (all?) of which have now expired. Apparently ANS isn't going to be patented.

Re:How are zlib, gzip and Zip related? (2013) by eln1 on Sunday June 19, 2016 @03:41AM (#11932178)
There is an attempt to patent something ANS-related: http://cbloomrants.blogspot.com/2015/05/05-21-15-software-pa...
Re:How are zlib, gzip and Zip related? (2013) by bch on Friday June 17, 2016 @05:06PM (#11925557)
Question not about ANS, but patenting: Wouldn't it make more sense for Apple (or anybody) to actually patent it, and keep those patents, but make it open via licensing ? If there's patentable material and $developer passes on filing for it, doesn't that leave it open for poaching by $third_party ?
Re:How are zlib, gzip and Zip related? (2013) by riffraff on Friday June 17, 2016 @05:36PM (#11925714)
The patent is invalid if prior art exists,so publishing it is enough to avoid it being poached by others
Re:How are zlib, gzip and Zip related? (2013) by derekp7 on Friday June 17, 2016 @06:05PM (#11925844)
But doesn't the patent office only look at previous patents when searching for prior art? Of course, other sources of prior art can be brought in as a defense, but it still may not stop someone from getting a patent initially and using it to harass financially weak opponents.
Re:How are zlib, gzip and Zip related? (2013) by thwarted on Friday June 17, 2016 @08:37PM (#11926411)
Lack of patent examiner familiarity with the industry, history, and the state of the art is traditionally considered a weak point in the system as a whole. Supposedly when writing the patent claims you're supposed to do a search to make sure you're not conflicting with other patents and that there is no prior art, but this is often used to word the patent in such a way to avoid the prior art from invalidating the patent, or use differences with the prior art as support for the uniqueness of the patent being applied for. Unfortunately, patent examiners are traditionally illequipped to accurately make an assessment, and the patent applicant is allowed to make adjustments to address the issues the patent examiner found. I remember there was work on getting patent examiners to be more familiar with the areas the patents they are examining/approving are for (technology, software, or business, for example), but I don't know where that stands today.

However, IANAPL and IANAPE.

Re:How are zlib, gzip and Zip related? (2013) by leeoniya on Saturday June 18, 2016 @12:32AM (#11927125)
Re:How are zlib, gzip and Zip related? (2013) by andrepd on Saturday June 18, 2016 @05:54PM (#11930787)
Offtopic, but I wonder what do you intend to gain by writing "$word" instead of "a word".
Re:How are zlib, gzip and Zip related? (2013) by bch on Monday June 20, 2016 @02:30PM (#11940105)
As it ended up being posted, it really could have been "a <word>". During the course of producing it, it seemed like the entities involved might be confusing, and my first approach was to treat everything like a unique variable.

TLDR, made sense during composition, not w/ final product.

Re:How are zlib, gzip and Zip related? (2013) by eln1 on Saturday June 18, 2016 @01:15AM (#11927209)
Apple tANS implementation was suboptimal - both from the quantization and symbol spread point of view: http://encode.ru/threads/2221-LZFSE-New-Apple-Data-Compressi... The author of this post (Eric Biggers) has made corrections and one of them was already merged in lzfse github (the second would make it incompatible).

There is a paper about FPGA implementation of tANS encoder ( ieeexplore.ieee.org/xpl/login.jsp?tp=&arnumber=7306068 ), but it uses branch which is removed in more recent implementations (bottom of the first post of http://encode.ru/threads/2078-List-of-Asymmetric-Numeral-Sys... ).

It is worth to mention that rANS variant - using one multiplication per symbol (e.g. in Google VP10), has recently exceeded the speed of tANS/FSE: https://github.com/jkbonfield/rans_static

Re:How are zlib, gzip and Zip related? (2013) by ralfd on Saturday June 18, 2016 @02:17PM (#11929876)
Interesting, but it is all spanish to me ... What are "fractional bits"?
Re:How are zlib, gzip and Zip related? (2013) by eln1 on Saturday June 18, 2016 @04:22PM (#11930444)
Generally, a symbol of probability p contains lg(1/p) bits of information: 1 bit if p=1/2, 2 bits if p=1/4 etc. In Huffman you directly assign a concrete bit sequence to every symbol - it is perfect if their probabilities are powers of 1/2, but generally is not true: requires approximations, leading to a suboptimal compression ratio.

Accurate entropy coders like arithmetic/range coding or ANS family can directly work on symbols of general probabilities: containing a non-integer number of bits. It has to finally produce complete bits - their fractional number is handled by the state of the coder - kind of a buffer containing a fractional number of bits. Complete bits are produced as soon as they accumulate.

Re:How are zlib, gzip and Zip related? (2013) by niftich on Saturday June 18, 2016 @02:23PM (#11929902)
This blog post [1] and its predecessor explaining Huffman Codes [2] was a very helpful guide for me.

[1] https://hbfs.wordpress.com/2011/11/01/fractional-bits-part-i... [2] https://hbfs.wordpress.com/2011/05/17/huffman-codes/