google / guetzli

Perceptual JPEG encoder
Apache License 2.0
12.9k stars 976 forks source link

Progress/cancellation #229

Open loganhope560 opened 7 years ago

loganhope560 commented 7 years ago

Is there any way when using Guetzli as a library to insert checkpoints where one could check an early exit flag and abort the compression operation? Thanks.

khavishbhundoo commented 7 years ago

At what points you do think early exits would make sense

On 31 Jul 2017 23:19, "loganhope560" notifications@github.com wrote:

Is there any way when using Guetzli as a library to insert checkpoints where one could check an early exit flag and abort the compression operation? Thanks.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/google/guetzli/issues/229, or mute the thread https://github.com/notifications/unsubscribe-auth/ARp_YcnIT1qaMHbT-UgvhpJZePeJjC6Eks5sTiimgaJpZM4Oozt6 .

loganhope560 commented 7 years ago

I don't know anything about the algorithm(s) that Guetzli uses. What I'm asking is if there exist any natural "rounds" or such where a callback could be made and the callback could decide to free the resources associated with the operation.

kornelski commented 7 years ago

Yes, guetzli is an iterative algorithm so earlier abort (with larger/less optimized result) is possible.

loganhope560 commented 7 years ago

Thanks, pornel. Do you happen to have any pointers on how I might hook that in? Currently I am using a single call to guetzli::Process.

kornelski commented 7 years ago

Look for stop_early variables in the code. You'll need to hook them up (or another variable in similar places) to whatever mechanism you want to use for stopping.