00001 #ifndef __TONEMAP_UTILS_H__
00002 #define __TONEMAP_UTILS_H__
00003
00004 #include <stdlib.h>
00005 #include <stdio.h>
00006 #include <stdint.h>
00007
00008 #include "stm_export.h"
00009
00010 #ifdef __cplusplus
00011 extern "C" {
00012 #endif
00013
00014
00015
00016
00017
00018 #define CLS_INVALID 0
00019 #define CLS_SRGB_LINEAR 1
00020 #define CLS_SRGB 2
00021 #define CLS_CIE_XYZ 3
00022 #define CLS_CIE_XYY 4
00023 #define CLS_LOG_LUV 5
00024 #define CLS_LUMINANCE 6
00025 #define CLS_DENSITY 7
00026
00027
00028
00029
00030 typedef float Matrix33[3][3];
00031
00032 uint32_t STM_EXPORT get_pixel_size(uint32_t colour_space);
00033
00034
00035
00036
00037 float STM_EXPORT scalar_product(const float *a, const float *b);
00038 void STM_EXPORT vector_product(const float *a, const float *b, float *out);
00039 void STM_EXPORT vector_normalise(float *a);
00040 void STM_EXPORT transform_vector(const Matrix33, float *vector);
00041
00042 void STM_EXPORT matrix_identity(Matrix33 *m);
00043 void STM_EXPORT matrix_multiply(const Matrix33 m1,
00044 const Matrix33 m2,
00045 Matrix33 *out);
00046 float STM_EXPORT matrix_inverse(const Matrix33 m, Matrix33 *out);
00047
00048
00049 void STM_EXPORT transform_colour(const Matrix33, float *colour);
00050 float STM_EXPORT remove_srgb_gamma(float x);
00051 float STM_EXPORT apply_srgb_gamma(float x);
00052 void STM_EXPORT linear_srgb_to_xyy(float *);
00053 void STM_EXPORT xyy_to_linear_srgb(float *);
00054 void STM_EXPORT xyy_to_xyz(float *);
00055 void STM_EXPORT xyz_to_xyy(float *);
00056 void STM_EXPORT xyz_to_linear_srgb(float *);
00057 void STM_EXPORT chromatic_adaptation(const float *ws, const float *wd, Matrix33 *out);
00058
00059 double STM_EXPORT luminance_to_density(double);
00060 double STM_EXPORT density_to_luminance(double);
00061
00062
00063
00064
00065 double STM_EXPORT halton(uint32_t base, uint32_t n);
00066 double STM_EXPORT gaussian(double sigma, double r);
00067
00068 float STM_EXPORT round_float(float x);
00069 double STM_EXPORT round_double(float x);
00070
00071 float STM_EXPORT trunc_float(float x);
00072 double STM_EXPORT trunc_double(float x);
00073
00074 #ifdef __cplusplus
00075 }
00076 #endif
00077
00078 #endif