rav1e icon indicating copy to clipboard operation
rav1e copied to clipboard

suspicious discarding of buffer

Open vrtgs opened this issue 2 months ago • 1 comments

code for encoding here creates a new buffer called t35_buf then writes it... then clears it before it gets dropped?

https://github.com/xiph/rav1e/blob/b7bf39066ec4f004c9b9cdb81c91734ec2edfac7/src/encoder.rs#L3785-L3793

there is also the fact that this suspicously isn't writing to the packet directly but that can be for bit padding or whatever I am not too sure, but it seems pointless to clear the buffer before dropping unless the intention was to reuse said buffer if that wasn't the intention it probably would be good to implement by just pulling the buffers declaration out of the loop

vrtgs avatar Oct 03 '25 16:10 vrtgs

It is a tiny buffer for metadata, potentially the clear can be omitted but I guess who wrote the code kept the pattern used everywhere.

lu-zero avatar Oct 03 '25 16:10 lu-zero