Hi, On Tue, Jun 7, 2011 at 2:43 PM, Justin Ruggles <[email protected]> wrote: > On 06/07/2011 02:20 PM, Ronald S. Bultje wrote: > >> if ((R|G|B)&(0xC0000000)) {\ >> - if (R>=(256<<22)) R=(256<<22)-1; \ >> - else if (R<0)R=0; \ >> - if (G>=(256<<22)) G=(256<<22)-1; \ >> - else if (G<0)G=0; \ >> - if (B>=(256<<22)) B=(256<<22)-1; \ >> - else if (B<0)B=0; \ >> + R = av_clip_uintp2(R, 22); \ >> + G = av_clip_uintp2(G, 22); \ >> + B = av_clip_uintp2(B, 22); \ >> } > > > 256<<22 is 1<<30
Oops, should have tested (for others, Justin asked for stuff to review so I posted some stuff I was working on). Will change. > Also, just in general, these are only checking for overflow by 1 bit, > correct? Yes. In these codepaths, overflow by more than 1 bit is not really possible, I think. Ronald _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
