xoblite™ / Blackbox for Windows bb5 | RC6 preview | 0.25.2.14
http://xoblite.net/
BImage.cpp File Reference
#include "BImage.h"
#include <malloc.h>

Functions

template<typename T>
lmax (T a, T b)
 
template<typename T>
lmin (T a, T b)
 
static unsigned long bsqrt (unsigned long x)
 
unsigned long getSqrt (unsigned int x)
 

Variables

unsigned long * sqrt_table = NULL
 

Function Documentation

◆ lmax()

template<typename T>
T lmax ( T a,
T b )
523{ return ((a > b) ? a : b); }

◆ lmin()

template<typename T>
T lmin ( T a,
T b )
524{ return ((a < b) ? a : b); }

◆ bsqrt()

static unsigned long bsqrt ( unsigned long x)
static
1284{
1285 if (x <= 0) return 0;
1286 if (x == 1) return 1;
1287
1288 unsigned long r = x >> 1;
1289 unsigned long q;
1290
1291 while (1)
1292 {
1293 q = x / r;
1294 if (q >= r) return r;
1295 r = (r + q) >> 1;
1296 }
1297}

◆ getSqrt()

unsigned long getSqrt ( unsigned int x)
1302{
1303 if (!sqrt_table)
1304 {
1305 // build sqrt table for use with elliptic gradient
1306 sqrt_table = new unsigned long[(256 * 256 * 2) + 1];
1307
1308 for (int i = 0; i < (256 * 256 * 2); i++)
1309 *(sqrt_table + i) = bsqrt(i);
1310 }
1311 return (*(sqrt_table + x));
1312}
unsigned long * sqrt_table
Definition BImage.cpp:40
static unsigned long bsqrt(unsigned long x)
Definition BImage.cpp:1283

Variable Documentation

◆ sqrt_table

unsigned long* sqrt_table = NULL