diff options
| author | Mattias Andrée <maandree@kth.se> | 2016-07-16 19:28:39 +0200 |
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2016-07-16 19:28:39 +0200 |
| commit | 0c0d0ca0da8060484ab5f41a6ee73087755a69e3 (patch) | |
| tree | dd455f5a29edba440f2194a60fc06f0ceed8f397 /src/ramps.c | |
| parent | attributes (diff) | |
| download | coopgammad-0c0d0ca0da8060484ab5f41a6ee73087755a69e3.tar.gz coopgammad-0c0d0ca0da8060484ab5f41a6ee73087755a69e3.tar.bz2 coopgammad-0c0d0ca0da8060484ab5f41a6ee73087755a69e3.tar.xz | |
Restructure
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
| -rw-r--r-- | src/types/ramps.c (renamed from src/ramps.c) | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/src/ramps.c b/src/types/ramps.c index 2b855a4..30bed3e 100644 --- a/src/ramps.c +++ b/src/types/ramps.c @@ -96,70 +96,3 @@ size_t gamma_ramps_unmarshal(union gamma_ramps* restrict this, const void* restr return ramps_size; } - -/** - * Apply a ramp-trio on top of another ramp-trio - * - * @param dest The output for the resulting ramp-trio, must be initialised - * @param application The red, green and blue ramps, as one single raw array, - * of the filter that should be applied - * @param depth -1: `float` stops - * -2: `double` stops - * Other: the number of bits of each (integral) stop - * @param base The CLUT on top of which the new filter should be applied, - * this can be the same pointer as `dest` - */ -void apply(union gamma_ramps* restrict dest, void* restrict application, - int depth, union gamma_ramps* restrict base) -{ - union gamma_ramps app; - size_t bytedepth; - size_t red_width, green_width, blue_width; - - if (depth == -1) - bytedepth = sizeof(float); - else if (depth == -2) - bytedepth = sizeof(double); - else - bytedepth = (size_t)depth / 8; - - red_width = (app.u8.red_size = base->u8.red_size) * bytedepth; - green_width = (app.u8.green_size = base->u8.green_size) * bytedepth; - blue_width = (app.u8.blue_size = base->u8.blue_size) * bytedepth; - - app.u8.red = application; - app.u8.green = app.u8.red + red_width; - app.u8.blue = app.u8.green + green_width; - - if (dest != base) - { - memcpy(dest->u8.red, base->u8.red, red_width); - memcpy(dest->u8.green, base->u8.green, green_width); - memcpy(dest->u8.blue, base->u8.blue, blue_width); - } - - switch (depth) - { - case 8: - libclut_apply(&(dest->u8), UINT8_MAX, uint8_t, &(app.u8), UINT8_MAX, uint8_t, 1, 1, 1); - break; - case 16: - libclut_apply(&(dest->u16), UINT16_MAX, uint16_t, &(app.u16), UINT16_MAX, uint16_t, 1, 1, 1); - break; - case 32: - libclut_apply(&(dest->u32), UINT32_MAX, uint32_t, &(app.u32), UINT32_MAX, uint32_t, 1, 1, 1); - break; - case 64: - libclut_apply(&(dest->u64), UINT64_MAX, uint64_t, &(app.u64), UINT64_MAX, uint64_t, 1, 1, 1); - break; - case -1: - libclut_apply(&(dest->f), 1.0f, float, &(app.d), 1.0f, float, 1, 1, 1); - break; - case -2: - libclut_apply(&(dest->d), (double)1, double, &(app.f), (double)1, double, 1, 1, 1); - break; - default: - abort(); - } -} - |
