"Ronald S. Bultje" <[email protected]> writes: > Hi, > > On Thu, Dec 15, 2011 at 8:10 PM, Luca Barbato <[email protected]> wrote: > >> On 16/12/11 02:03, Ronald S. Bultje wrote: >> >>> From: "Ronald S. Bultje"<[email protected]> >>> >>> For certain types of filters where the intermediate sum of coefficients >>> can go above the fixed-point equivalent of 1.0 in the middle of a filter, >>> the sum of a 31-bit calculation can overflow in both directions and can >>> thus not be represented in a 32-bit signed or unsigned integer. To work >>> around this, we subtract 0x40000000 from a signed integer base, so that >>> we're halfway signed/unsigned, which makes it fit even if it overflows. >>> After the filter finishes, we add the scaled bias back after a shift. >>> >>> We use the same trick for 16-bit bpc YUV output routines. >>> --- >>> >> >> Since I hate magic numbers w/out a name what about using >> >> BIAS and BIAS_SHIFTED or something similar? >> > > The values (not the 0x40000000, but the 0x10000) change per use depending > on their use afterwards... So a macro doesn't help much. As long as it's > commented, it should be OK.
I'm OK with the numbers as they are. -- Måns Rullgård [email protected] _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
