mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-05-13 06:40:38 +00:00
https://datatracker.ietf.org/doc/html/rfc6386#section-14.5 says: """ The summing procedure is fairly straightforward, having only a couple of details. The prediction and residue buffers are both arrays of 16-bit signed integers. Each individual (Y, U, and V pixel) result is calculated first as a 32-bit sum of the prediction and residue, and is then saturated to 8-bit unsigned range (using, say, the clamp255 function defined above) before being stored as an 8-bit unsigned pixel value. """ It's IMHO not 100% clear if the clamping is supposed to happen immediately (so that it affects prediction inputs for the next macroblock) or later. But vp8_dixie_idct_add() on page 173 in https://datatracker.ietf.org/doc/html/rfc6386#section-20.8 does: recon[0] = CLAMP_255(predict[0] + ((a1 + d1 + 4) >> 3)); So it does look like it should happen immediately. (I'm a bit confused why the spec then says "The prediction and residue buffers are both arrays of 16-bit signed integers", since the prediction buffer can just be an u8 buffer now, without changing behavior.