mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 679527 - Avoid float operation in qcms transforms. r=jrmuizel
This commit is contained in:
parent
778fa3932c
commit
d6c2573d25
@ -476,6 +476,10 @@ static void qcms_transform_data_clut(qcms_transform *transform, unsigned char *s
|
||||
}
|
||||
*/
|
||||
|
||||
static int int_div_ceil(int value, int div) {
|
||||
return ((value + div - 1) / div);
|
||||
}
|
||||
|
||||
// Using lcms' tetra interpolation algorithm.
|
||||
static void qcms_transform_data_tetra_clut_rgba(qcms_transform *transform, unsigned char *src, unsigned char *dest, size_t length) {
|
||||
unsigned int i;
|
||||
@ -496,12 +500,12 @@ static void qcms_transform_data_tetra_clut_rgba(qcms_transform *transform, unsig
|
||||
unsigned char in_a = *src++;
|
||||
float linear_r = in_r/255.0f, linear_g=in_g/255.0f, linear_b = in_b/255.0f;
|
||||
|
||||
int x = floorf(linear_r * (transform->grid_size-1));
|
||||
int y = floorf(linear_g * (transform->grid_size-1));
|
||||
int z = floorf(linear_b * (transform->grid_size-1));
|
||||
int x_n = ceilf(linear_r * (transform->grid_size-1));
|
||||
int y_n = ceilf(linear_g * (transform->grid_size-1));
|
||||
int z_n = ceilf(linear_b * (transform->grid_size-1));
|
||||
int x = in_r * (transform->grid_size-1) / 255;
|
||||
int y = in_g * (transform->grid_size-1) / 255;
|
||||
int z = in_b * (transform->grid_size-1) / 255;
|
||||
int x_n = int_div_ceil(in_r * (transform->grid_size-1), 255);
|
||||
int y_n = int_div_ceil(in_g * (transform->grid_size-1), 255);
|
||||
int z_n = int_div_ceil(in_b * (transform->grid_size-1), 255);
|
||||
float rx = linear_r * (transform->grid_size-1) - x;
|
||||
float ry = linear_g * (transform->grid_size-1) - y;
|
||||
float rz = linear_b * (transform->grid_size-1) - z;
|
||||
@ -611,15 +615,15 @@ static void qcms_transform_data_tetra_clut(qcms_transform *transform, unsigned c
|
||||
unsigned char in_b = *src++;
|
||||
float linear_r = in_r/255.0f, linear_g=in_g/255.0f, linear_b = in_b/255.0f;
|
||||
|
||||
int x = floorf(linear_r * (transform->grid_size-1));
|
||||
int y = floorf(linear_g * (transform->grid_size-1));
|
||||
int z = floorf(linear_b * (transform->grid_size-1));
|
||||
int x_n = ceilf(linear_r * (transform->grid_size-1));
|
||||
int y_n = ceilf(linear_g * (transform->grid_size-1));
|
||||
int z_n = ceilf(linear_b * (transform->grid_size-1));
|
||||
float rx = linear_r * (transform->grid_size-1) - x;
|
||||
int x = in_r * (transform->grid_size-1) / 255;
|
||||
int y = in_g * (transform->grid_size-1) / 255;
|
||||
int z = in_b * (transform->grid_size-1) / 255;
|
||||
int x_n = int_div_ceil(in_r * (transform->grid_size-1), 255);
|
||||
int y_n = int_div_ceil(in_g * (transform->grid_size-1), 255);
|
||||
int z_n = int_div_ceil(in_b * (transform->grid_size-1), 255);
|
||||
float rx = linear_r * (transform->grid_size-1) - x;
|
||||
float ry = linear_g * (transform->grid_size-1) - y;
|
||||
float rz = linear_b * (transform->grid_size-1) - z;
|
||||
float rz = linear_b * (transform->grid_size-1) - z;
|
||||
|
||||
c0_r = CLU(r_table, x, y, z);
|
||||
c0_g = CLU(g_table, x, y, z);
|
||||
|
Loading…
Reference in New Issue
Block a user