tests/color_util: refactor into color_float_apply_curve()
Make process_pixel_using_pipeline() slightly easier to read by extracting a meaningful function. Pure refactoring, no changes. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
committed by
Pekka Paalanen
parent
85738af912
commit
c8195289a7
+13
-4
@@ -221,6 +221,17 @@ a8r8g8b8_to_float(uint32_t v)
|
|||||||
return cf;
|
return cf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct color_float
|
||||||
|
color_float_apply_curve(enum transfer_fn fn, struct color_float c)
|
||||||
|
{
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
for (i = 0; i < COLOR_CHAN_NUM; i++)
|
||||||
|
c.rgb[i] = apply_tone_curve(fn, c.rgb[i]);
|
||||||
|
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
process_pixel_using_pipeline(enum transfer_fn pre_curve,
|
process_pixel_using_pipeline(enum transfer_fn pre_curve,
|
||||||
const struct lcmsMAT3 *mat,
|
const struct lcmsMAT3 *mat,
|
||||||
@@ -232,8 +243,7 @@ process_pixel_using_pipeline(enum transfer_fn pre_curve,
|
|||||||
struct color_float cf;
|
struct color_float cf;
|
||||||
float tmp;
|
float tmp;
|
||||||
|
|
||||||
for (i = 0; i < COLOR_CHAN_NUM; i++)
|
cf = color_float_apply_curve(pre_curve, *in);
|
||||||
cf.rgb[i] = apply_tone_curve(pre_curve, in->rgb[i]);
|
|
||||||
|
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
tmp = 0.0f;
|
tmp = 0.0f;
|
||||||
@@ -242,6 +252,5 @@ process_pixel_using_pipeline(enum transfer_fn pre_curve,
|
|||||||
out->rgb[i] = tmp;
|
out->rgb[i] = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < COLOR_CHAN_NUM; i++)
|
*out = color_float_apply_curve(post_curve, *out);
|
||||||
out->rgb[i] = apply_tone_curve(post_curve, out->rgb[i]);
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user