Skip to content

Avoid full-frame VP8 macroblock allocation for subsampled WebP reads#1265

Open
foryourever wants to merge 2 commits intoharaldk:masterfrom
foryourever:fix/webp-oom-on-subsampled-read
Open

Avoid full-frame VP8 macroblock allocation for subsampled WebP reads#1265
foryourever wants to merge 2 commits intoharaldk:masterfrom
foryourever:fix/webp-oom-on-subsampled-read

Conversation

@foryourever
Copy link
Copy Markdown

What is fixed

Fixes excessive memory use when reading very large lossy WebP images with source subsampling, which could result in
OutOfMemoryError.

Why is this change proposed

The VP8 decoder allocated macroblock state for the full frame up front, even when only a subsampled result was
requested. For large images this caused unnecessary memory pressure and could make the read fail before the reduced
output was produced.

What is changed

  • Changed VP8Frame to decode with a bounded row-window working set instead of a full-frame macroblock allocation
  • Preserved the VP8 neighbor/context behavior needed for correct decoding
  • Added a repository-safe regression test for subsampled decode using the checked-in alpha_filter.webp sample

@foryourever
Copy link
Copy Markdown
Author

foryourever commented Mar 31, 2026 via email

@haraldk
Copy link
Copy Markdown
Owner

haraldk commented Apr 7, 2026

Thanks for the PR! Looks good, but I'll review in detail when I find some spare time.

In the mean time, can you please look at the comments/suggestions from Sonar Cloud? At least 3 out of 4 should be quick fixes.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 7, 2026

@foryourever
Copy link
Copy Markdown
Author

foryourever commented Apr 7, 2026 via email

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.

2 participants