Improve progress bar UX for encode/decode
- Add indeterminate (barber pole) animation during Argon2/initializing phase - Prevent progress from jumping backwards (fixes flash-to-zero bug) - Initial progress write at 5% when embedding actually starts - Reset progress tracking on new operations Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -919,6 +919,10 @@ def _embed_in_channel_safe(
|
||||
blocks_needed = (total_bits + bits_per_block - 1) // bits_per_block
|
||||
blocks_to_process = min(blocks_needed, len(block_order))
|
||||
|
||||
# Initial progress write - signals Argon2/prep is done, embedding starting
|
||||
if progress_file:
|
||||
_write_progress(progress_file, 5, 100, "embedding")
|
||||
|
||||
# Vectorized embedding: process blocks in batches
|
||||
BATCH_SIZE = 500
|
||||
bit_idx = 0
|
||||
@@ -1113,6 +1117,10 @@ def _embed_jpegio(
|
||||
total_bits = len(bits)
|
||||
progress_interval = max(total_bits // 20, 100) # Report ~20 times or every 100 bits
|
||||
|
||||
# Initial progress write - signals prep is done, embedding starting
|
||||
if progress_file:
|
||||
_write_progress(progress_file, 5, 100, "embedding")
|
||||
|
||||
for bit_idx, pos_idx in enumerate(order):
|
||||
if bit_idx >= len(bits):
|
||||
break
|
||||
|
||||
@@ -746,6 +746,10 @@ def _embed_lsb(
|
||||
modified_pixels = 0
|
||||
total_pixels_to_process = len(selected_indices)
|
||||
|
||||
# Initial progress write - signals prep is done, embedding starting
|
||||
if progress_file:
|
||||
_write_progress(progress_file, 5, 100, "embedding")
|
||||
|
||||
for progress_idx, pixel_idx in enumerate(selected_indices):
|
||||
if bit_idx >= len(binary_data):
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user