/usr/include/gegl-0.3/gegl-lookup.h is in libgegl-dev 0.3.8-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | /* This file is part of GEGL
*
* GEGL is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* GEGL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with GEGL; if not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2009 Øyvind Kolås
*/
#ifndef __GEGL_LOOKUP_H__
#define __GEGL_LOOKUP_H__
G_BEGIN_DECLS
#ifndef __cplusplus
typedef gfloat (* GeglLookupFunction) (gfloat value,
gpointer data);
#define GEGL_LOOKUP_MAX_ENTRIES (819200)
typedef struct GeglLookup
{
GeglLookupFunction function;
gpointer data;
gint shift;
guint32 positive_min, positive_max, negative_min, negative_max;
guint32 bitmask[GEGL_LOOKUP_MAX_ENTRIES/32];
gfloat table[];
} GeglLookup;
/**
* gegl_lookup_new_full: (skip)
* @function: The function to build a lookup for
* @data: A user data pointer passed to lookup calls
* @start: Lower bound of the lookup
* @end: Upper bound of the lookup
* @precision: The precision of the lookup table
*
* Return value: a #GeglLookup
*/
GeglLookup *gegl_lookup_new_full (GeglLookupFunction function,
gpointer data,
gfloat start,
gfloat end,
gfloat precision);
/**
* gegl_lookup_new: (skip)
* @function: The function to build a lookup for
* @data: A user data pointer passed to lookup calls
*
* Return value: a #GeglLookup
*/
GeglLookup *gegl_lookup_new (GeglLookupFunction function,
gpointer data);
/**
* gegl_lookup_free: (skip)
* @lookup: #GeglLookup to free
*/
void gegl_lookup_free (GeglLookup *lookup);
static inline gfloat
gegl_lookup (GeglLookup *lookup,
gfloat number)
{
union
{
float f;
guint32 i;
} u;
guint i;
u.f = number;
i = u.i >> lookup->shift;
if (i > lookup->positive_min &&
i < lookup->positive_max)
i = i - lookup->positive_min;
else if (i > lookup->negative_min &&
i < lookup->negative_max)
i = i - lookup->negative_min + (lookup->positive_max - lookup->positive_min);
else
return lookup->function (number, lookup->data);
if (!(lookup->bitmask[i/32] & (1<<(i & 31))))
{
lookup->table[i]= lookup->function (number, lookup->data);
lookup->bitmask[i/32] |= (1<<(i & 31));
}
return lookup->table[i];
}
#endif /* __cplusplus */
G_END_DECLS
#endif
|