Skip to content

perf(layout): Process multi-frame images one frame at a time - #520

Open
CyMule wants to merge 3 commits into
mainfrom
perf/process-multiframe-images-in-place
Open

CyMule wants to merge 3 commits into
mainfrom
perf/process-multiframe-images-in-place

Conversation

@CyMule

@CyMule CyMule commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Large multi-frame images currently retain every decoded RGB frame before layout inference starts. Process each frame through inference immediately and close its converted buffer after the page completes. Page order, dimensions, format metadata and pixel contents are preserved.

Validation:

  • Full local inference suite: 269 passed, 1 skipped; two added cleanup/streaming regressions also pass inside the dedicated SND.
  • Independent review checked ten baseline/candidate cases across TIFF color modes, GIF/APNG, varying frame dimensions and error paths.
  • Dedicated nick-oom-perf-oct01 SND, same core-product API image digest, separate Linux pods limited to two CPU cores: three matched trials on 160 compressed 1024×1024 TIFF frames produce identical output hashes. Median decoding time is 0.392 → 0.176 seconds; peak process RSS is 869 → 232 MiB. This isolates decoding using an empty fixed layout; it is not an end-to-end model latency claim.
  • At a 768 MiB pod limit, the baseline is OOMKilled (exit 137), while the candidate completes the same fixture.
  • Real YOLOX inference on a three-frame text TIFF also produced matching baseline/candidate output in the SND.

A corrupt later frame is now discovered after inference on earlier valid frames; the tested corrupt input raises the same exception and neither implementation returns a partial document. Decoded page layouts still accumulate in the returned document, so memory remains proportional to output size.

Release metadata targets 1.6.15. Sibling PRs take #518 → 1.6.14, #521 → 1.6.16 and #522 → 1.6.17; merging out of that order requires renumbering. Consumers require the resulting inference-library release to receive the fix.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-01T21:12:13.482349Z 4eb4684 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

Shadow auto-approve: would not auto-approve. This PR does not meet the repository auto-approval settings.

Re-trigger cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 2 files (changes from recent commits).

Shadow auto-approve: would not auto-approve. This PR does not meet the repository auto-approval settings.

Re-trigger cubic

@CyMule
CyMule marked this pull request as draft October 2, 2026 03:33
@CyMule
CyMule marked this pull request as ready for review October 2, 2026 04:13
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

Shadow auto-approve: would not auto-approve. This PR does not meet the repository auto-approval settings.

Re-trigger cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant