FLIF-hub / FLIF

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

What's the difference between quality=10000 and decode_over=true? #409

Closed saschanaz closed 7 years ago

saschanaz commented 7 years ago

The PR #400 said some clients can skip preview when decode_over=true, but I'm not getting it. Is there some situation that decode_over=true but quality<10000?

hrj commented 7 years ago

Is there some situation that decode_over=true but quality<10000?

Yes, when the bitstream is truncated.

saschanaz commented 7 years ago

If that happen probably the callback with decode_over=true is the last callback. Still not 100% sure when I may skip preview, can I expect:

  1. decode_over=true, quality=10000 -> no need to skip
  2. decode_over=true, quality<10000 -> probably want to skip

?

If yes on 2, what would the previous callback look like?

hrj commented 7 years ago

decode_over==true will always be the last callback.

Whether to skip that depends on how you use the API. In viewflif only the preview_images are displayed, not the fully decoded images! So the last preview (which will be same as decoded image) is never skipped.

However, in Poly-FLIF, the decoded image is shown at the end. Hence, it skips the last preview callback.

I hope that makes sense. IMO, since you are using the FLIF C API in libflif.js just as viewflif does, you could follow the logic employed in viewflif.