[mad-dev] Verificattion for reducing the size of rq_table.dat
Swapnil Wagle
swapnil at geodesiconline.com
Sun Aug 28 22:20:50 PDT 2005
Hi,
For reducing the size of rq_tbale.dat as suggested by you people I have done
following changes within the libray.Can you please verify whether this is
correct or not.
The changed 'III_requantize' is as follows
static
mad_fixed_t III_requantize(unsigned int value, signed int exp)
{
mad_fixed_t requantized;
signed int frac;
struct fixedfloat const *power;
frac = exp % 4; /* assumes sign(frac) == sign(exp) */
exp /= 4;
value = value / 8; // Dividing the input value by 8
power = &rq_table[value];
power = power * 16; // Multiplying the result after finding the array
index by 16
requantized = power->mantissa;
exp += power->exponent;
if (exp < 0) {
if (-exp >= sizeof(mad_fixed_t) * CHAR_BIT) {
/* underflow */
requantized = 0;
}
else {
requantized += 1L << (-exp - 1);
requantized >>= -exp;
}
}
else {
if (exp >= 5) {
/* overflow */
# if defined(DEBUG)
fprintf(stderr, "requantize overflow (%f * 2^%d)\n",
mad_f_todouble(requantized), exp);
# endif
requantized = MAD_F_MAX;
}
else
requantized <<= exp;
}
return frac ? mad_f_mul(requantized, root_table[3 + frac]) : requantized;
}
Reagrds,
swapnil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /mailman/public/mad-dev/attachments/20050829/5c178e2e/attachment.html
More information about the mad-dev
mailing list