Skip to content

Conversation

@RunDevelopment
Copy link
Collaborator

Small PR. Changes:

  1. BCn encoder don't allocate for each line anymore. If the width of an image encode with a BCn format isn't divisible by 4, we have to add padding to get a full 4x4 block. This full block was previously allocated on the heap for every row of the image. I fixed this by adding a new const generic param BLOCK_SIZE (= BLOCK_WIDTH * BLOCK_HEIGHT) to use an array on the stack instead.
  2. For bi-planar formats, the vec for the 2nd plane now allocates all its memory up front instead of growing dynamically.
  3. Where possible, I converted vecs into boxed slices to make accidental reallocations impossible.

This makes generally makes it easier to reason about allocations and should make the code a tiny bit faster.

@fintelia fintelia mentioned this pull request Nov 10, 2025
2 tasks
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