New Terminal Output:

root@f3f8d6319494:/app# python3 -c "
> import struct
> with open('/app/frames.tza', 'rb') as f:
>     f.read(4)
>     w, h = struct.unpack('<HH', f.read(4))
>     n_frames, max_bytes = struct.unpack('<II', f.read(8))
>
>     frames = []
>     for i in range(n_frames):
>         frames.append(f.read(w*h))
>
>     # Analyze runs in frame 3->4
>     prev, curr = frames[3], frames[4]
>     changes = [prev[j] != curr[j] for j in range(w*h)]
>
>     total_chars = 0
>     total_runs = 0
>
>     for r in range(h):
>         in_run = False
>         run_start = 0
>         for c in range(w):
>             idx = r * w + c
>             if changes[idx]:
>                 if not in_run:
>                     in_run = True
>                     run_start = c
>                     total_runs += 1
>             else:
>                 if in_run:
>                     in_run = False
>                     run_len = c - run_start
>                     total_chars += run_len
>         if in_run:
>             run_len = w - run_start
>             total_chars += run_len
>
>     print(f'Frame 3->4: {total_runs} runs, {total_chars} total chars in runs')
>     print(f'Est cost with cursor pos: {total_runs * 7 + total_chars + 1} bytes')
> "
Frame 3->4: 44 runs, 321 total chars in runs
Est cost with cursor pos: 630 bytes
root@f3f8d6319494:/app#
