FLIF-hub / FLIF

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

Bug in encoding / decoding of animations after removing greys #190

Closed hrj closed 8 years ago

hrj commented 8 years ago

Since 119018a22cac368625e58fb633b04873d8623fdb, a bug has been introduced. The last working commit is 1957cf6496dc04cd0ea41d5d526a82df6b1e6277 (which includes centered YIQ).

Encoding and decoding fails for the spinning firefox animation, in interlaced mode.

Everything works with the -A option, so I suspect the bug is in how the alpha=0 pixels are being predicted.

I have been trying to debug; but haven't been successful so far.

hrj commented 8 years ago

This is reproducible with just the first two frames of the animation... in case it helps debugging.

jonsneyers commented 8 years ago

Looks like the problem is related to FRS (frame shaping), which depends on alpha=0 RGB interpolation to depend only on the previous zoomlevel so it can safely ignore the RGB values of A=0 pixels without initiating a potential chain of different interpolations which can lead to mispredictions. Fix coming up.

hrj commented 8 years ago

That was quick; thanks!

Could that prediction function receive a boolean indicating this dependency, so as to choose the optimal prediction?

jonsneyers commented 8 years ago

I don't think it makes enough of a difference (it's a border case of a border case) to matter, neither for compression nor for progressive loading image quality. And doing it this way makes it possible to parallelize the interpolation steps, while otherwise it would become inherently sequential.