wined3d: universal surface convertor function for unsigned integer color formats(5th attempt)

Michael Karcher wine at mkarcher.dialup.fu-berlin.de
Wed Jul 30 06:15:45 CDT 2008


Am Mittwoch, den 30.07.2008, 15:03 +0400 schrieb Victor:
> > You also have to expand types properly, i.e. converting a 
> > component from 4-bit to 8-bit isn't just a shift.
> In all places where I saw pixel format conversion before, it was _always_ done 
> by shifting components (even in MS-DOS vesa-based applications). 
> Your assumption that "converting isn't just a shift" requires link to official 
> documentation (i.e. proof), where it is clearly stated that during Blt() 
> (from which convert_unsigned_pixels is being called) between different 
> surface format, ddraw/d3d converts pixel format by means other than simply 
> shifting components. I doubt that in real software ddraw implementation blt 
> from 565 to 888 is done by completely recalculating components using floating 
> point operations.

Floating point is overkill. The correct way for a 5 to 8 conversion is
"divide by 31, multiply by 255". If you use
  bits8 = bits5 << 3 | bits5 >> 2;
you get "bits8 = bits5 * 8.25", which is always less than one off the
correct result. What you do is to repeat the bit pattern infinitely
instead of filling with zeroes on the right hand.

Regards,
  Michael Karcher




More information about the wine-devel mailing list