static long conv_rgbaF_rgb8 (unsigned char *src, unsigned char *dst, long samples) { long n = samples; while (n--) { register float f = (*(float *) src); *(unsigned char *) dst = table_F_8[gggl_float_to_index16 (f)]; src += 4; dst += 1; f = (*(float *) src); *(unsigned char *) dst = table_F_8[gggl_float_to_index16 (f)]; src += 4; dst += 1; f = (*(float *) src); *(unsigned char *) dst = table_F_8[gggl_float_to_index16 (f)]; src += 4; dst += 1; src += 4; } return samples; }
static long conv_rgbAF_lrgba8 (unsigned char *srcc, unsigned char *dstc, long samples) { float *src = (void *) srcc; unsigned char *dst = (void *) dstc; long n = samples; while (n--) { float alpha = src[3]; float recip = (1.0/alpha); if (alpha < BABL_ALPHA_THRESHOLD) { dst[0] = dst[1] = dst[2] = dst[3] = 0; } else { dst[0] = table_F_8[gggl_float_to_index16 (src[0] * recip)]; dst[1] = table_F_8[gggl_float_to_index16 (src[1] * recip)]; dst[2] = table_F_8[gggl_float_to_index16 (src[2] * recip)]; dst[3] = table_F_8[gggl_float_to_index16 (alpha)]; } src += 4; dst += 4; } return samples; }
static long conv_F_16 (unsigned char *src, unsigned char *dst, long samples) { long n = samples; if (!table_inited) table_init (); while (n--) { register float f = (*(float *) src); *(unsigned short *) dst = table_F_16[gggl_float_to_index16 (f)]; dst += 2; src += 4; } return samples; }