Re: [Pixman] [RFC] mmx: add and use expand_4xpacked565

2012-05-18 Thread Matt Turner
On Thu, May 17, 2012 at 8:05 PM, Bill Spitzak wrote: > Also this original one: > > >  R8 = ( R5 * 527 + 23 ) >> 6; > > produces the same results as the floor(i*255/31.0+.5) result. > > I believe almost *all* graphics software will do the bit-shifting math and > thus the (i*33)>>2 result is the one

Re: [Pixman] [RFC] mmx: add and use expand_4xpacked565

2012-05-18 Thread Matt Turner
On Thu, May 17, 2012 at 5:40 PM, Søren Sandmann wrote: > Søren Sandmann writes: > >>> Given a pixel with only the red component of these values, the results >>> are off-by-one. >>> >>> 0x03 -> 0x19 (0x18) >>> 0x07 -> 0x3A (0x39) >>> 0x18 -> 0xC5 (0xC6) >>> 0x1C -> 0xE6 (0xE7) >>> >>> (Same for bl

Re: [Pixman] [RFC] mmx: add and use expand_4xpacked565

2012-05-17 Thread Bill Spitzak
Also this original one: R8 = ( R5 * 527 + 23 ) >> 6; produces the same results as the floor(i*255/31.0+.5) result. I believe almost *all* graphics software will do the bit-shifting math and thus the (i*33)>>2 result is the one to use. Bill Spitzak wrote: Søren Sandmann wrote: Søren Sand

Re: [Pixman] [RFC] mmx: add and use expand_4xpacked565

2012-05-17 Thread Bill Spitzak
Søren Sandmann wrote: Søren Sandmann writes: Given a pixel with only the red component of these values, the results are off-by-one. 0x03 -> 0x19 (0x18) 0x07 -> 0x3A (0x39) 0x18 -> 0xC5 (0xC6) 0x1C -> 0xE6 (0xE7) (Same for blue, and green has many more cases) It uses R8 = ( R5 * 527 + 23 )

Re: [Pixman] [RFC] mmx: add and use expand_4xpacked565

2012-05-17 Thread Søren Sandmann
Søren Sandmann writes: >> Given a pixel with only the red component of these values, the results >> are off-by-one. >> >> 0x03 -> 0x19 (0x18) >> 0x07 -> 0x3A (0x39) >> 0x18 -> 0xC5 (0xC6) >> 0x1C -> 0xE6 (0xE7) >> >> (Same for blue, and green has many more cases) >> >> It uses >> R8 = ( R5 * 527

Re: [Pixman] [RFC] mmx: add and use expand_4xpacked565

2012-05-17 Thread Søren Sandmann
Matt Turner writes: > Given a pixel with only the red component of these values, the results > are off-by-one. > > 0x03 -> 0x19 (0x18) > 0x07 -> 0x3A (0x39) > 0x18 -> 0xC5 (0xC6) > 0x1C -> 0xE6 (0xE7) > > (Same for blue, and green has many more cases) > > It uses > R8 = ( R5 * 527 + 23 ) >> 6; >

[Pixman] [RFC] mmx: add and use expand_4xpacked565

2012-05-17 Thread Matt Turner
Given a pixel with only the red component of these values, the results are off-by-one. 0x03 -> 0x19 (0x18) 0x07 -> 0x3A (0x39) 0x18 -> 0xC5 (0xC6) 0x1C -> 0xE6 (0xE7) (Same for blue, and green has many more cases) It uses R8 = ( R5 * 527 + 23 ) >> 6; G8 = ( G6 * 259 + 33 ) >> 6; B8 = ( B5 * 527