mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 679527 - Use floorf/ceilf in qcms transform function. r=jrmuizel
This commit is contained in:
parent
f3eedbbb1b
commit
778fa3932c
@ -138,12 +138,12 @@ static void qcms_transform_module_clut_only(struct qcms_modular_transform *trans
|
||||
float linear_g = *src++;
|
||||
float linear_b = *src++;
|
||||
|
||||
int x = floor(linear_r * (transform->grid_size-1));
|
||||
int y = floor(linear_g * (transform->grid_size-1));
|
||||
int z = floor(linear_b * (transform->grid_size-1));
|
||||
int x_n = ceil(linear_r * (transform->grid_size-1));
|
||||
int y_n = ceil(linear_g * (transform->grid_size-1));
|
||||
int z_n = ceil(linear_b * (transform->grid_size-1));
|
||||
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 x_d = linear_r * (transform->grid_size-1) - x;
|
||||
float y_d = linear_g * (transform->grid_size-1) - y;
|
||||
float z_d = linear_b * (transform->grid_size-1) - z;
|
||||
@ -198,12 +198,12 @@ static void qcms_transform_module_clut(struct qcms_modular_transform *transform,
|
||||
float linear_b = lut_interp_linear_float(device_b,
|
||||
transform->input_clut_table_b, transform->input_clut_table_length);
|
||||
|
||||
int x = floor(linear_r * (transform->grid_size-1));
|
||||
int y = floor(linear_g * (transform->grid_size-1));
|
||||
int z = floor(linear_b * (transform->grid_size-1));
|
||||
int x_n = ceil(linear_r * (transform->grid_size-1));
|
||||
int y_n = ceil(linear_g * (transform->grid_size-1));
|
||||
int z_n = ceil(linear_b * (transform->grid_size-1));
|
||||
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 x_d = linear_r * (transform->grid_size-1) - x;
|
||||
float y_d = linear_g * (transform->grid_size-1) - y;
|
||||
float z_d = linear_b * (transform->grid_size-1) - z;
|
||||
@ -271,12 +271,12 @@ static void qcms_transform_module_tetra_clut(struct qcms_modular_transform *tran
|
||||
float linear_b = lut_interp_linear_float(device_b,
|
||||
transform->input_clut_table_b, transform->input_clut_table_length);
|
||||
|
||||
int x = floor(linear_r * (transform->grid_size-1));
|
||||
int y = floor(linear_g * (transform->grid_size-1));
|
||||
int z = floor(linear_b * (transform->grid_size-1));
|
||||
int x_n = ceil(linear_r * (transform->grid_size-1));
|
||||
int y_n = ceil(linear_g * (transform->grid_size-1));
|
||||
int z_n = ceil(linear_b * (transform->grid_size-1));
|
||||
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;
|
||||
float ry = linear_g * (transform->grid_size-1) - y;
|
||||
float rz = linear_b * (transform->grid_size-1) - z;
|
||||
|
@ -435,12 +435,12 @@ static void qcms_transform_data_clut(qcms_transform *transform, unsigned char *s
|
||||
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 = floor(linear_r * (transform->grid_size-1));
|
||||
int y = floor(linear_g * (transform->grid_size-1));
|
||||
int z = floor(linear_b * (transform->grid_size-1));
|
||||
int x_n = ceil(linear_r * (transform->grid_size-1));
|
||||
int y_n = ceil(linear_g * (transform->grid_size-1));
|
||||
int z_n = ceil(linear_b * (transform->grid_size-1));
|
||||
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 x_d = linear_r * (transform->grid_size-1) - x;
|
||||
float y_d = linear_g * (transform->grid_size-1) - y;
|
||||
float z_d = linear_b * (transform->grid_size-1) - z;
|
||||
@ -496,12 +496,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 = floor(linear_r * (transform->grid_size-1));
|
||||
int y = floor(linear_g * (transform->grid_size-1));
|
||||
int z = floor(linear_b * (transform->grid_size-1));
|
||||
int x_n = ceil(linear_r * (transform->grid_size-1));
|
||||
int y_n = ceil(linear_g * (transform->grid_size-1));
|
||||
int z_n = ceil(linear_b * (transform->grid_size-1));
|
||||
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;
|
||||
float ry = linear_g * (transform->grid_size-1) - y;
|
||||
float rz = linear_b * (transform->grid_size-1) - z;
|
||||
@ -611,12 +611,12 @@ 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 = floor(linear_r * (transform->grid_size-1));
|
||||
int y = floor(linear_g * (transform->grid_size-1));
|
||||
int z = floor(linear_b * (transform->grid_size-1));
|
||||
int x_n = ceil(linear_r * (transform->grid_size-1));
|
||||
int y_n = ceil(linear_g * (transform->grid_size-1));
|
||||
int z_n = ceil(linear_b * (transform->grid_size-1));
|
||||
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;
|
||||
float ry = linear_g * (transform->grid_size-1) - y;
|
||||
float rz = linear_b * (transform->grid_size-1) - z;
|
||||
|
@ -76,8 +76,8 @@ float lut_interp_linear_float(float value, float *table, int length)
|
||||
{
|
||||
int upper, lower;
|
||||
value = value * (length - 1);
|
||||
upper = ceil(value);
|
||||
lower = floor(value);
|
||||
upper = ceilf(value);
|
||||
lower = floorf(value);
|
||||
//XXX: can we be more performant here?
|
||||
value = table[upper]*(1. - (upper - value)) + table[lower]*(upper - value);
|
||||
/* scale the value */
|
||||
|
Loading…
Reference in New Issue
Block a user