BfxALULUT Class Reference

#include <bfxalu.h>

Inheritance diagram for BfxALULUT:

CCObject SimpleCCObject List of all members.

Public Member Functions

BOOL LinearABK (double PropA, double PropB, double Offset)
BYTE GetLUT (UINT32 A, UINT32 B)
 Gets a value out a LUT.

Protected Attributes

BYTE Data [256 *256]

Private Member Functions

 CC_DECLARE_DYNCREATE (BfxALULUT)

Friends

class BfxALU

Detailed Description

Definition at line 447 of file bfxalu.h.


Member Function Documentation

BfxALULUT::CC_DECLARE_DYNCREATE BfxALULUT   )  [private]
 

BYTE BfxALULUT::GetLUT UINT32  A,
UINT32  B
 

Gets a value out a LUT.

Author:
Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
Date:
02/11/94
Parameters:
A & B LUT address [INPUTS]
None [OUTPUTS]
Returns:
Byte in LUT

Errors: None at present

See also:
-
The addresses must be 0..255

Definition at line 275 of file bfxalu.cpp.

00276 {
00277     return LUTBYTE(A,B);
00278 }

BOOL BfxALULUT::LinearABK double  PropA,
double  PropB,
double  Offset
 

Definition at line 218 of file bfxalu.cpp.

00219 {
00220     INT32 pa=(INT32)(PropA*(1<<15));
00221     INT32 pb=(INT32)(PropB*(1<<15));
00222     INT32 po=(INT32)(Offset*((1<<15)*255)+/* for rounding */(1<<14));
00223 
00224     // Please note how we're *NOT* using doubles in the loop as that's
00225     // sooooo sloooooow on 486SX. We use 17.15 arithmetic throughout
00226 
00227 #ifndef FASTLINEARABK
00228     INT32 a;
00229     INT32 b;
00230     INT32 r;
00231     for (a=0; a<256; a++) for (b=0; b<256; b++)
00232     {
00233         r=(a*pa+b*pb+po)>>15; /* we did the rounding in the offset calc */
00234         LUTBYTE(a,b)=(r<0)?0:((r>255)?255:(BYTE)(INT32)(r));
00235     }
00236 #else
00237     FastLinearABK(Data, pa, pb, po, 256);
00238 #if 0
00239     INT32 a;
00240     INT32 b;
00241     INT32 r;
00242     for (a=0; a<256; a++) for (b=0; b<256; b++)
00243     {
00244         r=(a*pa+b*pb+po)>>15; /* we did the rounding in the offset calc */
00245         if (LUTBYTE(a,b)!=((r<0)?0:((r>255)?255:(BYTE)(INT32)(r))))
00246         {
00247             TRACEUSER( "Alex", _T("Byte %x,%x was %x should be %x\n"),a,b,
00248                 LUTBYTE(a,b),( (r<0)?0:((r>255)?255:(BYTE)(INT32)(r)) ) );
00249         }
00250     }
00251 #endif
00252 #endif
00253 
00254 
00255     return(TRUE);
00256 }


Friends And Related Function Documentation

friend class BfxALU [friend]
 

Definition at line 451 of file bfxalu.h.


Member Data Documentation

BYTE BfxALULUT::Data[256 *256] [protected]
 

Definition at line 463 of file bfxalu.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:51:07 2007 for Camelot by  doxygen 1.4.4