Uh oh!
There was an error while loading. Please reload this page.
Reduce the number of memory allocations in lossless WebP encoder - #2940
Conversation
JimBobSquarePants
left a comment
There was a problem hiding this comment.
Just a quick read so far but looking good. I'll have to pull it down to review properly.
| { | ||
| PixOrCopy v = backwardRefsEnumerator.Current; | ||
| int ix = ((y >> histoBits) * histoXSize) + (x >> histoBits); | ||
| histograms[ix].AddSinglePixOrCopy(v, false); |
There was a problem hiding this comment.
This method could be updated to take the struct via in to avoid the copy.
There was a problem hiding this comment.
I've made the change. But if there is any performance difference, it's hard to notice. The structure is not that big.
Uh oh!
There was an error while loading. Please reload this page.
antonfirsov
left a comment
There was a problem hiding this comment.
Looks good after skimming through all changes.
JimBobSquarePants
commented
Jun 12, 2025
I'm thinking of backporting this to V3. @antonfirsov what do you think? |
antonfirsov
commented
Jun 12, 2025
The change looks simple and safe enough to backport. |
JimBobSquarePants
commented
Jun 13, 2025
Thanks for this @SladeThe it's very much appreciated!! |
This PR closes#2934
The results of benchmark
#55 EncodeWebp:Before
After
Pin the refs (without the capacity guard)