FLIF-hub / FLIF

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

Localise the YIQ transform #181

Closed hrj closed 8 years ago

hrj commented 8 years ago

Motivation

I am trying to create a lossy optimiser for FLIF. It works by modifying the source image such that mis-predictions are reduced.

However, the current YIQ transform in FLIF is not local. The 4*par factor, where par = max/4 is dependent on global values.

The other source of non-local effects is the grey value used in the predict function, where grey = (min + max) / 2.

Proposal

  1. Eliminate the 4*par factor in YIQ transform. This will essentially make I and Q values signed.
  2. Use a local substitute for grey in predict.

:one: shouldn't affect compression. :two: might affect compression (probably for the better).

I have a working POC for :one:. Will test and make a PR soon.

jonsneyers commented 8 years ago

Sounds good! Getting rid of grey is a good idea (especially because it's currently a global variable).

hrj commented 8 years ago

Both :one: and :two: are done!