return mk_ancestry_iter (copy);
}
-static const char *fish_cache_path (void)
+static const char *
+fish_cache_path (void)
{
struct stat stat_buf;
static char path[4096];
return dest;
}
-static int compare_fish_pixels (const void *a, const void *b)
+static int
+compare_fish_pixels (const void *a, const void *b)
{
const Babl **fa = (void*)a;
const Babl **fb = (void*)b;
return ((*fb)->fish.pixels - (*fa)->fish.pixels);
}
-static const char *cache_header (void)
+static const char *
+cache_header (void)
{
static char buf[2048];
if (strchr (BABL_GIT_VERSION, ' ')) // we must be building from tarball
return buf;
}
-void babl_store_db (void)
+void
+babl_store_db (void)
{
BablDb *db = babl_fish_db ();
int i;
const Babl *destination,
int is_reference);
-void babl_init_db (void)
+void
+babl_init_db (void)
{
const char *path = fish_cache_path ();
long length = -1;
static int
-is_component_duplicate (Babl *babl, int luma, int chroma, int alpha)
+is_component_duplicate (Babl *babl,
+ int luma,
+ int chroma,
+ int alpha)
{
if (babl->component.luma != luma ||
babl->component.chroma != chroma ||
static void
babl_conversion_planar_process (const Babl *babl,
- const char *src,
- char *dst,
- long n,
- void *user_data)
+ const char *src,
+ char *dst,
+ long n,
+ void *user_data)
{
BablConversion *conversion = (void*)babl;
const BablImage *source = (void*)src;
static void dispatch_plane (const Babl *babl,
const char *source,
- char *destination,
- long n,
- void *user_data)
+ char *destination,
+ long n,
+ void *user_data)
{
const BablConversion *conversion = &babl->conversion;
const void *src_data = NULL;
static char buf[512] = "";
static int collisions = 0;
+
static char *
-create_name (Babl *source, Babl *destination, int type)
+create_name (Babl *source,
+ Babl *destination,
+ int type)
{
if (babl_extender ())
{
}
const char *
-babl_conversion_create_name (Babl *source, Babl *destination, int type,
- int allow_collision)
+babl_conversion_create_name (Babl *source,
+ Babl *destination,
+ int type,
+ int allow_collision)
{
Babl *babl;
char *name;
return error;
}
-const Babl *babl_conversion_get_source_space (const Babl *conversion)
+const Babl *
+babl_conversion_get_source_space (const Babl *conversion)
{
return conversion->conversion.source->format.space;
}
-const Babl *babl_conversion_get_destination_space (const Babl *conversion)
+const Babl *
+babl_conversion_get_destination_space (const Babl *conversion)
{
return conversion->conversion.destination->format.space;
}
#include "babl-internal.h"
static int
-db_find_by_name (Babl *item, void *data)
+db_find_by_name (Babl *item,
+ void *data)
{
if (!strcmp (item->instance.name, (char *) data))
return 1;
}
static int
-db_find_by_id (Babl *item, void *data)
+db_find_by_id (Babl *item,
+ void *data)
{
if (item->instance.id == *((int *) data))
return 1;
}
static int
-db_hash_by_name (BablHashTable *htab, Babl *item)
+db_hash_by_name (BablHashTable *htab,
+ Babl *item)
{
return babl_hash_by_str (htab, item->instance.name);
}
static int
-db_hash_by_id (BablHashTable *htab, Babl *item)
+db_hash_by_id (BablHashTable *htab,
+ Babl *item)
{
return babl_hash_by_int (htab, item->instance.id);
}
return babl;
}
-void babl_extension_deinit (void)
+void
+babl_extension_deinit (void)
{
babl_free (babl_quiet);
babl_quiet = NULL;
#define dlopen(path, flags) shl_load (path, flags, 0L)
#define dlclose(handle) shl_unload (handle)
#define dlerror() strerror (errno)
-static void *dlsym (HLIB handle, const char *name) {
+
+static void *
+dlsym (HLIB handle,
+ const char *name)
+{
void *address = 0;
shl_findsym(&handle, name, TYPE_UNDEFINED, &address);
return address;
static int debug_conversions = 0;
int _babl_instrument = 0;
-double _babl_legal_error (void)
+double
+_babl_legal_error (void)
{
static double error = 0.0;
const char *env;
return error;
}
-static int max_path_length (void)
+static int
+max_path_length (void)
{
static int max_length = 0;
const char *env;
return max_length;
}
-int _babl_max_path_len (void)
+int
+_babl_max_path_len (void)
{
return max_path_length ();
}
return babl;
}
-const Babl * babl_fast_fish (const void *source_format,
+const Babl *
+babl_fast_fish (const void *source_format,
const void *destination_format,
const char *performance)
{
static char *
create_name (const Babl *source,
const Babl *destination,
- int is_reference)
+ int is_reference)
{
int size = 0;
static char *
create_name (const Babl *source,
const Babl *destination,
- int is_reference)
+ int is_reference)
{
int size = 0;
char *buf = NULL;
#include "babl-ref-pixels.h"
-static int babl_format_destruct (void *babl)
+static int
+babl_format_destruct (void *babl)
{
BablFormat *format = babl;
if (format->image_template != NULL)
int components,
BablModel *model,
const Babl *space,
- BablComponent **component,
- BablSampling **sampling,
+ BablComponent **component,
+ BablSampling **sampling,
const BablType **type)
{
Babl *babl;
}
Babl *
-format_new_from_format_with_space (const Babl *format, const Babl *space)
+format_new_from_format_with_space (const Babl *format,
+ const Babl *space)
{
Babl *ret;
char new_name[256];
}
void
-babl_set_user_data (const Babl *cbabl, void *data)
+babl_set_user_data (const Babl *cbabl,
+ void *data)
{
Babl *babl = (Babl*) cbabl;
switch (cbabl->instance.class_type)
int psize;
} ICC;
-ICC *icc_state_new (char *data, int length, int tags);
-
-ICC *icc_state_new (char *data, int length, int tags)
+ICC *
+icc_state_new (char *data,
+ int length,
+ int tags);
+
+ICC *
+icc_state_new (char *data,
+ int length,
+ int tags)
{
ICC *ret = babl_calloc (sizeof (ICC), 1);
ret->data = data;
#define icc_write(type, offset, value) write_##type(state,offset,value)
#define icc_read(type, offset) read_##type(state,offset)
-static void write_u8 (ICC *state, int offset, uint8_t value)
+static void
+write_u8 (ICC *state,
+ int offset,
+ uint8_t value)
{
if (offset < 0 || offset >= state->length)
return;
*(uint8_t*) (&state->data[offset]) = value;
}
-static void write_s8 (ICC *state, int offset, int8_t value)
+static void
+write_s8 (ICC *state,
+ int offset,
+ int8_t value)
{
if (offset < 0 || offset >= state->length)
return;
*(int8_t*) (&state->data[offset]) = value;
}
-static int read_u8 (ICC *state, int offset)
+static int
+read_u8 (ICC *state,
+ int offset)
{
/* all reading functions take both the char *pointer and the length of the
* buffer, and all reads thus gets protected by this condition.
return *(uint8_t*) (&state->data[offset]);
}
-static int read_s8 (ICC *state, int offset)
+static int
+read_s8 (ICC *state,
+ int offset)
{
if (offset < 0 || offset > state->length)
return 0;
return *(int8_t*) (&state->data[offset]);
}
-static void write_s16 (ICC *state, int offset, int16_t value)
+static void
+write_s16 (ICC *state,
+ int offset,
+ int16_t value)
{
write_s8 (state, offset + 0, value >> 8);
write_u8 (state, offset + 1, value & 0xff);
}
-static int16_t read_s16 (ICC *state, int offset)
+static int16_t
+read_s16 (ICC *state,
+ int offset)
{
return icc_read (u8, offset + 1) +
(read_s8 (state, offset + 0) << 8); //XXX: transform to icc_read macro
}
-static uint16_t read_u16 (ICC *state, int offset)
+static
+uint16_t read_u16 (ICC *state,
+ int offset)
{
return icc_read (u8, offset + 1) +
(icc_read (u8, offset + 0) << 8);
}
-static void write_u16 (ICC *state, int offset, uint16_t value)
+static void
+write_u16 (ICC *state,
+ int offset,
+ uint16_t value)
{
write_u8 (state, offset + 0, value >> 8);
write_u8 (state, offset + 1, value & 0xff);
}
-static u8f8_t read_u8f8_ (ICC *state, int offset)
+static u8f8_t
+read_u8f8_ (ICC *state,
+ int offset)
{
u8f8_t ret ={icc_read (u8, offset),
icc_read (u8, offset + 1)};
return ret;
}
-static s15f16_t read_s15f16_ (ICC *state, int offset)
+static s15f16_t
+read_s15f16_ (ICC *state,
+ int offset)
{
s15f16_t ret ={icc_read (s16, offset),
icc_read (u16, offset + 2)};
return ret;
}
-static void write_u8f8_ (ICC *state, int offset, u8f8_t val)
+static void
+write_u8f8_ (ICC *state,
+ int offset,
+ u8f8_t val)
{
icc_write (u8, offset, val.integer),
icc_write (u8, offset + 1, val.fraction);
}
-static void write_s15f16_ (ICC *state, int offset, s15f16_t val)
+static void
+write_s15f16_ (ICC *state,
+ int offset,
+ s15f16_t val)
{
icc_write (s16, offset, val.integer),
icc_write (u16, offset + 2, val.fraction);
}
-static s15f16_t d_to_s15f16 (double value)
+static s15f16_t
+d_to_s15f16 (double value)
{
s15f16_t ret;
ret.integer = floor (value);
return ret;
}
-static u8f8_t d_to_u8f8 (double value)
+static u8f8_t
+d_to_u8f8 (double value)
{
u8f8_t ret;
ret.integer = floor (value);
return ret;
}
-static double s15f16_to_d (s15f16_t fix)
+static double
+s15f16_to_d (s15f16_t fix)
{
return fix.integer + fix.fraction / 65536.0;
}
-static double u8f8_to_d (u8f8_t fix)
+static double
+u8f8_to_d (u8f8_t fix)
{
return fix.integer + fix.fraction / 256.0;
}
-static void write_s15f16 (ICC *state, int offset, double value)
+static void
+write_s15f16 (ICC *state,
+ int offset,
+ double value)
{
write_s15f16_ (state, offset, d_to_s15f16 (value));
}
-static void write_u8f8 (ICC *state, int offset, double value)
+static void
+write_u8f8 (ICC *state,
+ int offset,
+ double value)
{
write_u8f8_ (state, offset, d_to_u8f8 (value));
}
-static double read_s15f16 (ICC *state, int offset)
+static double
+read_s15f16 (ICC *state,
+ int offset)
{
return s15f16_to_d (read_s15f16_ (state, offset));
}
-static double read_u8f8 (ICC *state, int offset)
+static double
+read_u8f8 (ICC *state,
+ int offset)
{
return u8f8_to_d (read_u8f8_ (state, offset));
}
#if 0
-static inline void print_u8f8 (u8f8_t fix)
+static inline void
+print_u8f8 (u8f8_t fix)
{
int i;
uint32_t foo;
}
}
-static inline void print_s15f16 (s15f16_t fix)
+static inline void
+print_s15f16 (s15f16_t fix)
{
int i;
uint32_t foo;
}
#endif
-static void write_u32 (ICC *state, int offset, uint32_t value)
+static void
+write_u32 (ICC *state,
+ int offset,
+ uint32_t value)
{
int i;
for (i = 0; i < 4; i ++)
}
}
-static uint32_t read_u32 (ICC *state, int offset)
+static uint32_t
+read_u32 (ICC *state,
+ int offset)
{
return icc_read (u8, offset + 3) +
(icc_read (u8, offset + 2) << 8) +
(icc_read (u8, offset + 0) << 24);
}
-static sign_t read_sign (ICC *state, int offset)
+static sign_t
+read_sign (ICC *state,
+ int offset)
{
sign_t ret;
ret.str[0]=icc_read (u8, offset);
return ret;
}
-static void write_sign (ICC *state, int offset, const char *sign)
+static void
+write_sign (ICC *state,
+ int offset,
+ const char *sign)
{
int i;
for (i = 0; i < 4; i ++)
/* looks up offset and length for a specific icc tag
*/
-static int icc_tag (ICC *state,
- const char *tag, int *offset, int *el_length)
+static int
+icc_tag (ICC *state,
+ const char *tag,
+ int *offset,
+ int *el_length)
{
int tag_count = icc_read (u32, TAG_COUNT_OFF);
int t;
return 0;
}
-static const Babl *babl_trc_from_icc (ICC *state, int offset,
- const char **error)
+static const Babl *
+babl_trc_from_icc (ICC *state,
+ int offset,
+ const char **error)
{
{
int count = icc_read (u32, offset + 8);
return NULL;
}
-static void icc_allocate_tag (ICC *state, const char *tag, int size)
+static void
+icc_allocate_tag (ICC *state,
+ const char *tag,
+ int size)
{
while (state->no % 4 != 0)
state->no++;
state->no+=size;
}
-static void icc_duplicate_tag(ICC *state, const char *tag)
+static void
+icc_duplicate_tag(ICC *state,
+ const char *tag)
{
icc_write (sign, 128 + 4 + 4 * state->headpos++, tag);
icc_write (u32, 128 + 4 + 4 * state->headpos++, state->p);
static const uint16_t lut_srgb_26[]={0,202,455,864,1423,2154,3060,4156,5454,6960,8689,10637,12821,15247,17920,20855,24042,27501,31233,35247,39549,44132,49018,54208,59695,65535};
-void write_trc (ICC *state,
- const char *name,
+void write_trc (ICC *state,
+ const char *name,
const BablTRC *trc,
- BablICCFlags flags);
-void write_trc (ICC *state,
- const char *name,
+ BablICCFlags flags);
+
+void write_trc (ICC *state,
+ const char *name,
const BablTRC *trc,
- BablICCFlags flags)
+ BablICCFlags flags)
{
switch (trc->type)
{
}
}
-static void symmetry_test (ICC *state);
+static void
+symmetry_test (ICC *state);
-char *babl_space_to_icc (const Babl *babl,
+char *
+babl_space_to_icc (const Babl *babl,
const char *description,
const char *copyright,
BablICCFlags flags,
}
}
-const char *babl_space_get_icc (const Babl *babl, int *length)
+const char *
+babl_space_get_icc (const Babl *babl,
+ int *length)
{
if (!babl->space.icc_profile)
{
lenientConversion
} ConversionFlags;
-static int ConvertUTF16toUTF8 (const UTF16** sourceStart,
- const UTF16* sourceEnd,
- UTF8** targetStart,
- UTF8* targetEnd,
- ConversionFlags flags);
-
-static char *icc_decode_mluc (ICC *state,
- int offset,
- int element_length,
- const char *lang,
- const char *country)
+static int
+ConvertUTF16toUTF8 (const UTF16 **sourceStart,
+ const UTF16 *sourceEnd,
+ UTF8 **targetStart,
+ UTF8 *targetEnd,
+ ConversionFlags flags);
+
+static char *
+icc_decode_mluc (ICC *state,
+ int offset,
+ int element_length,
+ const char *lang,
+ const char *country)
{
int n_records = icc_read (u32, offset + 8);
int record_size = icc_read (u32, offset + 12);
return NULL;
}
-static char *decode_string (ICC *state, const char *tag, const char *lang, const char *country)
+static char *
+decode_string (ICC *state,
+ const char *tag,
+ const char *lang,
+ const char *country)
{
int offset, element_size;
assert (icc_read (u32, 8) == 4);
}
-char *babl_icc_get_key (const char *icc_data,
- int icc_length,
- const char *key,
- const char *language,
- const char *country)
+char *
+babl_icc_get_key (const char *icc_data,
+ int icc_length,
+ const char *key,
+ const char *language,
+ const char *country)
{
char *ret = NULL;
ICC *state = icc_state_new ((void*)icc_data, icc_length, 0);
typedef unsigned short UTF16; /* at least 16 bits */
typedef unsigned char UTF8; /* typically 8 bits */
typedef unsigned char Boolean; /* 0 or 1 */
+
typedef enum {
conversionOK, /* conversion successful */
sourceExhausted, /* partial character in source, but hit end */
static const UTF32 halfBase = 0x0010000UL;
static const UTF8 firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
-static int ConvertUTF16toUTF8 (const UTF16** sourceStart, const UTF16* sourceEnd,
- UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags)
+static int
+ConvertUTF16toUTF8 (const UTF16 **sourceStart,
+ const UTF16 *sourceEnd,
+ UTF8 **targetStart,
+ UTF8 *targetEnd,
+ ConversionFlags flags)
{
ConversionResult result = conversionOK;
const UTF16* source = *sourceStart;
#include "babl-internal.h"
-static int babl_image_destruct (void *babl)
+static int
+babl_image_destruct (void *babl)
{
BablFormat *format = BABL (babl)->image.format;
if (format && format->image_template == NULL)
}
static int
-is_model_duplicate (Babl *babl, const Babl *space, int components, BablComponent **component)
+is_model_duplicate (Babl *babl,
+ const Babl *space,
+ int components,
+ BablComponent **component)
{
int i;
#define TOLERANCE 0.001
-static const Babl *reference_format (void)
+static const Babl *
+reference_format (void)
{
static const Babl *self = NULL;
return self;
}
-static const Babl *construct_double_format (const Babl *model)
+static const Babl *
+construct_double_format (const Babl *model)
{
const void *argument[44 + 1];
int args = 0;
int babl_n_remodels = 0;
const Babl *
-babl_remodel_with_space (const Babl *model, const Babl *space)
+babl_remodel_with_space (const Babl *model,
+ const Babl *space)
{
Babl *ret;
int i;
}
const Babl *
-babl_model_with_space (const char *name, const Babl *space)
+babl_model_with_space (const char *name,
+ const Babl *space)
{
return babl_remodel_with_space (babl_model (name), space);
}
-BablModelFlag babl_get_model_flags (const Babl *babl)
+BablModelFlag
+babl_get_model_flags (const Babl *babl)
{
if (!babl) return 0;
switch (babl->class_type)
#endif
-BablMutex *
+BablMutex *
babl_mutex_new (void)
{
BablMutex *mutex = malloc (sizeof (BablMutex));
}
}
-static BablPalette *make_pal (const Babl *pal_space, const Babl *format, const void *data, int count)
+static BablPalette *
+make_pal (const Babl *pal_space,
+ const Babl *format,
+ const void *data,
+ int count)
{
BablPalette *pal = NULL;
int bpp = babl_format_get_bytes_per_pixel (format);
return pal;
}
-static void babl_palette_free (BablPalette *pal)
+static void
+babl_palette_free (BablPalette *pal)
{
babl_free (pal->data);
babl_free (pal->data_double);
babl_free (pal);
}
-static BablPalette *default_palette (void)
+static BablPalette *
+default_palette (void)
{
static BablPalette pal;
static int inited = 0;
#include "base/util.h"
static inline long
-conv_pal8_pala8 (Babl *conversion,
- unsigned char *src, unsigned char *dst, long samples)
+conv_pal8_pala8 (Babl *conversion,
+ unsigned char *src,
+ unsigned char *dst,
+ long samples)
{
long n = samples;
}
static inline long
-conv_pala8_pal8 (Babl *conversion,
- unsigned char *src, unsigned char *dst, long samples)
+conv_pala8_pal8 (Babl *conversion,
+ unsigned char *src,
+ unsigned char *dst,
+ long samples)
{
long n = samples;
}
-const Babl *babl_new_palette_with_space (const char *name,
- const Babl *space,
- const Babl **format_u8,
- const Babl **format_u8_with_alpha)
+const Babl *
+babl_new_palette_with_space (const char *name,
+ const Babl *space,
+ const Babl **format_u8,
+ const Babl **format_u8_with_alpha)
{
const Babl *model;
const Babl *model_no_alpha;
/* should return the BablModel, permitting to fetch
* other formats out of it?
*/
-const Babl *babl_new_palette (const char *name,
- const Babl **format_u8,
- const Babl **format_u8_with_alpha)
+const Babl *
+babl_new_palette (const char *name,
+ const Babl **format_u8,
+ const Babl **format_u8_with_alpha)
{
return babl_new_palette_with_space (name, NULL,
format_u8, format_u8_with_alpha);
static double
babl_polynomial_get (const BablPolynomial *poly,
int i)
-
{
return poly->coeff[poly->degree - i];
}
babl_polynomial_set (BablPolynomial *poly,
int i,
double c)
-
{
poly->coeff[poly->degree - i] = c;
}
return 0;
}
-static Babl *babl_conversion_destination (Babl *babl);
+static Babl *
+babl_conversion_destination (Babl *babl);
static int
type_sanity (Babl *babl,
return OK;
}
-static Babl *babl_conversion_destination (Babl *babl)
+static Babl *
+babl_conversion_destination (Babl *babl)
{
return (Babl *)babl->conversion.destination;
}
static void babl_chromatic_adaptation_matrix (const double *whitepoint,
const double *target_whitepoint,
- double *chad_matrix)
+ double *chad_matrix)
{
double bradford[9]={ 0.8951000, 0.2664000, -0.1614000,
-0.7502000, 1.7135000, 0.0367000,
* matrix looking for the bit-exact inverse of this integer-solution.
*
*/
-static void babl_matrix_equalize (double *in_mat)
+static void
+babl_matrix_equalize (double *in_mat)
{
double mat[9];
int j[9];
}
}
-static void babl_space_compute_matrices (BablSpace *space, BablSpaceFlags equalize_matrix)
+static void
+babl_space_compute_matrices (BablSpace *space,
+ BablSpaceFlags equalize_matrix)
{
#define _ space->
/* transform spaces xy(Y) specified data to XYZ */
}
Babl *
-_babl_space_for_lcms (const char *icc_data, int icc_length)
+_babl_space_for_lcms (const char *icc_data,
+ int icc_length)
{
int i=0;
BablSpace space;
return (Babl*)&space_db[i];
}
-const Babl * babl_space_from_chromaticities (const char *name,
- double wx, double wy,
- double rx, double ry,
- double gx, double gy,
- double bx, double by,
- const Babl *trc_red,
- const Babl *trc_green,
- const Babl *trc_blue,
- BablSpaceFlags flags)
+const Babl *
+babl_space_from_chromaticities (const char *name,
+ double wx, double wy,
+ double rx, double ry,
+ double gx, double gy,
+ double bx, double by,
+ const Babl *trc_red,
+ const Babl *trc_green,
+ const Babl *trc_blue,
+ BablSpaceFlags flags)
{
int i=0;
static BablSpace space;
}
-void babl_space_to_xyz (const Babl *space, const double *rgb, double *xyz)
+void
+babl_space_to_xyz (const Babl *space,
+ const double *rgb,
+ double *xyz)
{
_babl_space_to_xyz (space, rgb, xyz);
}
-void babl_space_from_xyz (const Babl *space, const double *xyz, double *rgb)
+void
+babl_space_from_xyz (const Babl *space,
+ const double *xyz,
+ double *rgb)
{
_babl_space_from_xyz (space, xyz, rgb);
}
-const double * babl_space_get_rgbtoxyz (const Babl *space)
+const double *
+babl_space_get_rgbtoxyz (const Babl *space)
{
return space->space.RGBtoXYZ;
}
///////////////////
-static void prep_conversion (const Babl *babl)
+static void
+prep_conversion (const Babl *babl)
{
Babl *conversion = (void*) babl;
const Babl *source_space = babl_conversion_get_source_space (conversion);
static inline void
-universal_nonlinear_rgba_converter (const Babl *conversion,unsigned char *src_char, unsigned char *dst_char, long samples, void *data)
+universal_nonlinear_rgba_converter (const Babl *conversion,
+ unsigned char *src_char,
+ unsigned char *dst_char,
+ long samples,
+ void *data)
{
const Babl *source_space = babl_conversion_get_source_space (conversion);
const Babl *destination_space = babl_conversion_get_destination_space (conversion);
}
static inline void
-universal_nonlinear_rgb_linear_converter (const Babl *conversion,unsigned char *src_char, unsigned char *dst_char, long samples, void *data)
+universal_nonlinear_rgb_linear_converter (const Babl *conversion,
+ unsigned char *src_char,
+ unsigned char *dst_char,
+ long samples,
+ void *data)
{
const Babl *source_space = babl_conversion_get_source_space (conversion);
float * matrixf = data;
}
static inline void
-universal_nonlinear_rgba_u8_converter (const Babl *conversion,unsigned char *src_char, unsigned char *dst_char, long samples, void *data)
+universal_nonlinear_rgba_u8_converter (const Babl *conversion,
+ unsigned char *src_char,
+ unsigned char *dst_char,
+ long samples,
+ void *data)
{
const Babl *destination_space = conversion->conversion.destination->format.space;
static inline void
-universal_rgba_converter (const Babl *conversion,unsigned char *src_char, unsigned char *dst_char, long samples, void *data)
+universal_rgba_converter (const Babl *conversion,
+ unsigned char *src_char,
+ unsigned char *dst_char,
+ long samples,
+ void *data)
{
float *matrixf = data;
float *rgba_in = (void*)src_char;
}
static inline void
-universal_rgb_converter (const Babl *conversion,unsigned char *src_char, unsigned char *dst_char, long samples, void *data)
+universal_rgb_converter (const Babl *conversion,
+ unsigned char *src_char,
+ unsigned char *dst_char,
+ long samples,
+ void *data)
{
float *matrixf = data;
float *rgb_in = (void*)src_char;
static inline void
-universal_nonlinear_rgb_u8_converter (const Babl *conversion,unsigned char *src_char, unsigned char *dst_char, long samples, void *data)
+universal_nonlinear_rgb_u8_converter (const Babl *conversion,
+ unsigned char *src_char,
+ unsigned char *dst_char,
+ long samples,
+ void *data)
{
const Babl *destination_space = conversion->conversion.destination->format.space;
static inline void babl_matrix_mul_vectorff_buf4_sse2 (const float *mat,
const float *v_in,
- float *v_out,
- int samples)
+ float *v_out,
+ int samples)
{
const __v4sf m___0 = {m(mat, 0, 0), m(mat, 1, 0), m(mat, 2, 0), 0};
const __v4sf m___1 = {m(mat, 0, 1), m(mat, 1, 1), m(mat, 2, 1), 0};
static inline void
-universal_nonlinear_rgba_converter_sse2 (const Babl *conversion,unsigned char *src_char, unsigned char *dst_char, long samples, void *data)
+universal_nonlinear_rgba_converter_sse2 (const Babl *conversion,
+ unsigned char *src_char,
+ unsigned char *dst_char,
+ long samples,
+ void *data)
{
const Babl *source_space = babl_conversion_get_source_space (conversion);
const Babl *destination_space = babl_conversion_get_destination_space (conversion);
static inline void
-universal_rgba_converter_sse2 (const Babl *conversion,unsigned char *src_char, unsigned char *dst_char, long samples, void *data)
+universal_rgba_converter_sse2 (const Babl *conversion,
+ unsigned char *src_char,
+ unsigned char *dst_char,
+ long samples,
+ void *data)
{
float *matrixf = data;
float *rgba_in = (void*)src_char;
}
static inline void
-universal_nonlinear_rgba_u8_converter_sse2 (const Babl *conversion,unsigned char *src_char, unsigned char *dst_char, long samples, void *data)
+universal_nonlinear_rgba_u8_converter_sse2 (const Babl *conversion,
+ unsigned char *src_char,
+ unsigned char *dst_char,
+ long samples,
+ void *data)
{
const Babl *destination_space = conversion->conversion.destination->format.space;
}
static inline void
-universal_nonlinear_rgb_u8_converter_sse2 (const Babl *conversion,unsigned char *src_char, unsigned char *dst_char, long samples, void *data)
+universal_nonlinear_rgb_u8_converter_sse2 (const Babl *conversion,
+ unsigned char *src_char,
+ unsigned char *dst_char,
+ long samples,
+ void *data)
{
const Babl *destination_space = conversion->conversion.destination->format.space;
static inline void
-universal_nonlinear_rgb_linear_converter_sse2 (const Babl *conversion,unsigned char *src_char, unsigned char *dst_char, long samples, void *data)
+universal_nonlinear_rgb_linear_converter_sse2 (const Babl *conversion,
+ unsigned char *src_char,
+ unsigned char *dst_char,
+ long samples,
+ void *data)
{
const Babl *source_space = babl_conversion_get_source_space (conversion);
float * matrixf = data;
* with conversions internally as well as for conversions to and from other RGB
* spaces.
*/
-void _babl_space_add_universal_rgb (const Babl *space)
+void
+_babl_space_add_universal_rgb (const Babl *space)
{
babl_space_class_for_each (add_rgb_adapter, (void*)space);
}
-const Babl *babl_space_match_trc_matrix (const Babl *trc_red,
- const Babl *trc_green,
- const Babl *trc_blue,
- float rx, float ry, float rz,
- float gx, float gy, float gz,
- float bx, float by, float bz)
+const Babl *
+babl_space_match_trc_matrix (const Babl *trc_red,
+ const Babl *trc_green,
+ const Babl *trc_blue,
+ float rx, float ry, float rz,
+ float gx, float gy, float gz,
+ float bx, float by, float bz)
{
int i;
double delta = 0.001;
return NULL;
}
-const Babl *babl_space_with_trc (const Babl *babl, const Babl *trc)
+const Babl *
+babl_space_with_trc (const Babl *babl,
+ const Babl *trc)
{
double xw, yw, xr, yr, xg, yg, xb, yb;
const Babl *red_trc = NULL;
}
-void babl_space_get (const Babl *babl,
- double *xw, double *yw,
- double *xr, double *yr,
- double *xg, double *yg,
- double *xb, double *yb,
- const Babl **red_trc,
- const Babl **green_trc,
- const Babl **blue_trc)
+void
+babl_space_get (const Babl *babl,
+ double *xw, double *yw,
+ double *xr, double *yr,
+ double *xg, double *yg,
+ double *xb, double *yb,
+ const Babl **red_trc,
+ const Babl **green_trc,
+ const Babl **blue_trc)
{
const BablSpace *space = &babl->space;
/* XXX: note: for spaces set by matrix should be possible to derive
if(blue_trc)*blue_trc = space->trc[2];
}
-int babl_space_is_cmyk (const Babl *space)
+int
+babl_space_is_cmyk (const Babl *space)
{
return space?space->space.cmyk.is_cmyk:0;
}
static BablTRC trc_db[MAX_TRCS];
-static inline float _babl_trc_linear (const Babl *trc_, float value)
+static inline float
+_babl_trc_linear (const Babl *trc_,
+ float value)
{
return value;
}
-static inline float babl_trc_lut_from_linear (const Babl *trc_, float x)
+static inline float
+babl_trc_lut_from_linear (const Babl *trc_,
+ float x)
{
BablTRC *trc = (void*)trc_;
int entry;
return ret;
}
-static inline float babl_trc_lut_to_linear (const Babl *trc_, float x)
+static inline float
+babl_trc_lut_to_linear (const Babl *trc_,
+ float x)
{
BablTRC *trc = (void*)trc_;
int entry;
return ret;
}
-static inline float _babl_trc_gamma_to_linear (const Babl *trc_, float value)
+static inline float
+_babl_trc_gamma_to_linear (const Babl *trc_,
+ float value)
{
BablTRC *trc = (void*)trc_;
if (value >= trc->poly_gamma_to_linear_x0 &&
return 0.0f;
}
-static inline float _babl_trc_gamma_from_linear (const Babl *trc_, float value)
+static inline float
+_babl_trc_gamma_from_linear (const Babl *trc_,
+ float value)
{
BablTRC *trc = (void*)trc_;
if (value >= trc->poly_gamma_from_linear_x0 &&
return 0.0f;
}
-static inline void _babl_trc_gamma_to_linear_buf (const Babl *trc_, const float *in, float *out, int in_gap, int out_gap, int components, int count)
+static inline void
+_babl_trc_gamma_to_linear_buf (const Babl *trc_,
+ const float *in,
+ float *out,
+ int in_gap,
+ int out_gap,
+ int components,
+ int count)
{
int i, c;
for (i = 0; i < count; i ++)
out[out_gap * i + c] = _babl_trc_gamma_to_linear (trc_, in[in_gap *i + c]);
}
-static inline void _babl_trc_gamma_from_linear_buf (const Babl *trc_, const float *in, float *out, int in_gap, int out_gap, int components, int count)
+static inline void
+_babl_trc_gamma_from_linear_buf (const Babl *trc_,
+ const float *in,
+ float *out,
+ int in_gap,
+ int out_gap,
+ int components,
+ int count)
{
int i, c;
for (i = 0; i < count; i ++)
out[out_gap * i + c] = _babl_trc_gamma_from_linear (trc_, in[in_gap *i + c]);
}
-static inline float _babl_trc_formula_srgb_from_linear (const Babl *trc_, float value)
+static inline float
+_babl_trc_formula_srgb_from_linear (const Babl *trc_,
+ float value)
{
BablTRC *trc = (void*)trc_;
float x= value;
return 0.0;
}
-static inline float _babl_trc_formula_srgb_to_linear (const Babl *trc_, float value)
+static inline float
+_babl_trc_formula_srgb_to_linear (const Babl *trc_,
+ float value)
{
BablTRC *trc = (void*)trc_;
float x= value;
return c * x;
}
-static inline float _babl_trc_srgb_to_linear (const Babl *trc_, float value)
+static inline float
+_babl_trc_srgb_to_linear (const Babl *trc_,
+ float value)
{
return babl_gamma_2_2_to_linearf (value);
}
-static inline float _babl_trc_srgb_from_linear (const Babl *trc_, float value)
+static inline float
+_babl_trc_srgb_from_linear (const Babl *trc_,
+ float value)
{
return babl_linear_to_gamma_2_2f (value);
}
-static inline void _babl_trc_srgb_to_linear_buf (const Babl *trc_, const float *in, float *out, int in_gap, int out_gap, int components, int count)
+static inline void
+_babl_trc_srgb_to_linear_buf (const Babl *trc_,
+ const float *in,
+ float *out,
+ int in_gap,
+ int out_gap,
+ int components,
+ int count)
{
int i, c;
for (i = 0; i < count; i ++)
out[out_gap * i + c] = babl_gamma_2_2_to_linearf (in[in_gap * i + c]);
}
-static inline void _babl_trc_srgb_from_linear_buf (const Babl *trc_,
- const float *in, float *out,
- int in_gap, int out_gap,
- int components,
- int count)
+static inline void
+_babl_trc_srgb_from_linear_buf (const Babl *trc_,
+ const float *in,
+ float *out,
+ int in_gap,
+ int out_gap,
+ int components,
+ int count)
{
int i, c;
for (i = 0; i < count; i ++)
out[out_gap * i + c] = babl_linear_to_gamma_2_2f (in[in_gap * i + c]);
}
-static inline void _babl_trc_to_linear_buf_generic (const Babl *trc_, const float *in, float *out, int in_gap, int out_gap, int components, int count)
+static inline void
+_babl_trc_to_linear_buf_generic (const Babl *trc_,
+ const float *in,
+ float *out,
+ int in_gap,
+ int out_gap,
+ int components,
+ int count)
{
int i, c;
BablTRC *trc = (void*)trc_;
out[out_gap * i + c] = trc->fun_to_linear (trc_, in[in_gap * i + c]);
}
-static inline void _babl_trc_from_linear_buf_generic (const Babl *trc_,
- const float *in, float *out,
- int in_gap, int out_gap,
- int components,
- int count)
+static inline void
+_babl_trc_from_linear_buf_generic (const Babl *trc_,
+ const float *in,
+ float *out,
+ int in_gap,
+ int out_gap,
+ int components,
+ int count)
{
int i, c;
BablTRC *trc = (void*)trc_;
out[out_gap * i + c] = trc->fun_from_linear (trc_, in[in_gap * i + c]);
}
-static inline void _babl_trc_linear_buf (const Babl *trc_,
- const float *in, float *out,
- int in_gap, int out_gap,
- int components,
- int count)
+static inline void _babl_trc_linear_buf (const Babl *trc_,
+ const float *in,
+ float *out,
+ int in_gap,
+ int out_gap,
+ int components,
+ int count)
{
int i, c;
for (i = 0; i < count; i ++)
return (Babl*)&trc_db[i];
}
-const Babl * babl_trc_lut (const char *name, int n, float *entries)
+const Babl *
+babl_trc_lut (const char *name,
+ int n,
+ float *entries)
{
return babl_trc_new (name, BABL_TRC_LUT, 0, n, entries);
}
void
babl_trc_class_for_each (BablEachFunction each_fun,
- void *user_data)
+ void *user_data)
{
int i=0;
for (i = 0; trc_db[i].instance.class_type; i++)
}
const Babl *
-babl_trc_formula_srgb (double g, double a, double b, double c, double d)
+babl_trc_formula_srgb (double g,
+ double a,
+ double b,
+ double c,
+ double d)
{
char name[128];
int i;
}
#if 0
-float babl_trc_from_linear (const Babl *trc_, float value)
+float
+babl_trc_from_linear (const Babl *trc_,
+ float value)
{
return babl_trc_from_linear (trc_, value);
}
-float babl_trc_to_linear (const Babl *trc_, float value)
+float
+babl_trc_to_linear (const Babl *trc_,
+ float value)
{
return babl_trc_to_linear (trc_, value);
}
#endif
static int
-babl_lut_match_gamma (float *lut, int lut_size, float gamma)
+babl_lut_match_gamma (float *lut,
+ int lut_size,
+ float gamma)
{
int match = 1;
int i;
return match;
}
-const Babl *babl_trc_lut_find (float *lut, int lut_size)
+const Babl *
+babl_trc_lut_find (float *lut,
+ int lut_size)
{
int i;
int match = 1;
}
static int
-is_type_duplicate (Babl *babl, int bits)
+is_type_duplicate (Babl *babl,
+ int bits)
{
if (babl->type.bits != bits)
return 0;
#define TOLERANCE 0.000000001
-static const Babl *double_vector_format (void)
+static const Babl *
+double_vector_format (void)
{
static const Babl *self = NULL;
#undef babl_model_is
-int babl_model_is (const Babl *babl, const char *model)
+int
+babl_model_is (const Babl *babl,
+ const char *model)
{
return babl && ((babl)==babl_model_with_space(model, babl));
}
};
-int gettimeofday (struct timeval *tv, struct timezone *tz)
+int
+gettimeofday (struct timeval *tv,
+ struct timezone *tz)
{
FILETIME ft;
LARGE_INTEGER li;