antoniotuzzi / libyuv

Automatically exported from code.google.com/p/libyuv
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

ARGBAttenuate test #482

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Followup to chromium bug: 
https://code.google.com/p/chromium/issues/detail?id=450189

Chrome has an unoptimized ARGBAttentuate.  It uses different math than libyuv. 
The question was asked,

"Does ATTENUATE() c version match the following for all f and a in [0..255] ?"

unsigned char premult(unsigned char f, unsigned char a)
{
   const unsigned prod = f * a + 128;
   return (prod + (prod >> 8)) >> 8;

To test the differences in math, a unittest should be written.

Original issue reported on code.google.com by fbarch...@chromium.org on 11 Aug 2015 at 12:26