tests/color_util: add transfer_fn_invert()
When defining a color space with a transfer function, this looks up the inverse transfer function without needing to store that separately. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
parent
fa477d2407
commit
141cd3021e
|
@ -93,6 +93,29 @@ find_tone_curve_type(enum transfer_fn fn, int *type, double params[5])
|
|||
return false;
|
||||
}
|
||||
|
||||
enum transfer_fn
|
||||
transfer_fn_invert(enum transfer_fn fn)
|
||||
{
|
||||
switch (fn) {
|
||||
case TRANSFER_FN_ADOBE_RGB_EOTF:
|
||||
return TRANSFER_FN_ADOBE_RGB_EOTF_INVERSE;
|
||||
case TRANSFER_FN_ADOBE_RGB_EOTF_INVERSE:
|
||||
return TRANSFER_FN_ADOBE_RGB_EOTF;
|
||||
case TRANSFER_FN_IDENTITY:
|
||||
return TRANSFER_FN_IDENTITY;
|
||||
case TRANSFER_FN_POWER2_4_EOTF:
|
||||
return TRANSFER_FN_POWER2_4_EOTF_INVERSE;
|
||||
case TRANSFER_FN_POWER2_4_EOTF_INVERSE:
|
||||
return TRANSFER_FN_POWER2_4_EOTF;
|
||||
case TRANSFER_FN_SRGB_EOTF:
|
||||
return TRANSFER_FN_SRGB_EOTF_INVERSE;
|
||||
case TRANSFER_FN_SRGB_EOTF_INVERSE:
|
||||
return TRANSFER_FN_SRGB_EOTF;
|
||||
}
|
||||
assert(0 && "bad transfer_fn");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* NaN comes out as is
|
||||
*This function is not intended for hiding NaN.
|
||||
|
|
|
@ -106,3 +106,6 @@ process_pixel_using_pipeline(enum transfer_fn pre_curve,
|
|||
|
||||
struct color_float
|
||||
color_float_apply_matrix(const struct lcmsMAT3 *mat, struct color_float c);
|
||||
|
||||
enum transfer_fn
|
||||
transfer_fn_invert(enum transfer_fn fn);
|
||||
|
|
Loading…
Reference in New Issue