[babl] gggl-lies.c: Remove dead code



commit 580c622574970e3b6d3361bfe857cb9c0099a57b
Author: Daniel Sabo <DanielSabo gmail com>
Date:   Mon Apr 29 19:59:15 2013 -0700

    gggl-lies.c: Remove dead code

 extensions/gggl-lies.c |  656 +++++-------------------------------------------
 1 files changed, 57 insertions(+), 599 deletions(-)
---
diff --git a/extensions/gggl-lies.c b/extensions/gggl-lies.c
index 47a973b..1c73a04 100644
--- a/extensions/gggl-lies.c
+++ b/extensions/gggl-lies.c
@@ -32,10 +32,6 @@
 #include "babl.h"
 #include "extensions/util.h"
 
-
-#define INLINE    inline
-
-
 /*
  * Implemented according to information read from:
  *
@@ -156,7 +152,7 @@ gggl_float_to_index16 (float f)
 }
 
 
-static INLINE long
+static long
 conv_F_8 (unsigned char *src, unsigned char *dst, long samples)
 {
   long n = samples;
@@ -173,7 +169,7 @@ conv_F_8 (unsigned char *src, unsigned char *dst, long samples)
   return samples;
 }
 
-static INLINE long
+static long
 conv_F_16 (unsigned char *src, unsigned char *dst, long samples)
 {
   long n = samples;
@@ -190,7 +186,7 @@ conv_F_16 (unsigned char *src, unsigned char *dst, long samples)
   return samples;
 }
 
-static INLINE long
+static long
 conv_8_F (unsigned char *src, unsigned char *dst, long samples)
 {
   long n = samples;
@@ -206,7 +202,7 @@ conv_8_F (unsigned char *src, unsigned char *dst, long samples)
   return samples;
 }
 
-static INLINE long
+static long
 conv_16_F (unsigned char *src, unsigned char *dst, long samples)
 {
   long n = samples;
@@ -224,7 +220,7 @@ conv_16_F (unsigned char *src, unsigned char *dst, long samples)
 
 #else
 
-static INLINE long
+static long
 conv_F_8 (unsigned char *src, unsigned char *dst, long samples)
 {
   long n = samples;
@@ -250,7 +246,7 @@ conv_F_8 (unsigned char *src, unsigned char *dst, long samples)
   return samples;
 }
 
-static INLINE long
+static long
 conv_F_16 (unsigned char *src, unsigned char *dst, long samples)
 {
   long n = samples;
@@ -278,7 +274,7 @@ conv_F_16 (unsigned char *src, unsigned char *dst, long samples)
 
 
 
-static INLINE long
+static long
 conv_8_F (unsigned char *src, unsigned char *dst, long samples)
 {
   long n = samples;
@@ -292,7 +288,7 @@ conv_8_F (unsigned char *src, unsigned char *dst, long samples)
   return samples;
 }
 
-static INLINE long
+static long
 conv_16_F (unsigned char *src, unsigned char *dst, long samples)
 {
   long n = samples;
@@ -309,7 +305,7 @@ conv_16_F (unsigned char *src, unsigned char *dst, long samples)
 
 #endif
 
-static INLINE long
+static long
 conv_F_D (unsigned char *src, unsigned char *dst, long samples)
 {
   long n = samples;
@@ -324,7 +320,7 @@ conv_F_D (unsigned char *src, unsigned char *dst, long samples)
 }
 
 
-static INLINE long
+static long
 conv_D_F (unsigned char *src, unsigned char *dst, long samples)
 {
   long n = samples;
@@ -337,7 +333,7 @@ conv_D_F (unsigned char *src, unsigned char *dst, long samples)
     }
   return samples;
 }
-static INLINE long
+static long
 conv_16_8 (unsigned char *src, unsigned char *dst, long samples)
 {
   long n = samples;
@@ -352,7 +348,7 @@ conv_16_8 (unsigned char *src, unsigned char *dst, long samples)
   return samples;
 }
 
-static INLINE long
+static long
 conv_8_16 (unsigned char *src, unsigned char *dst, long samples)
 {
   long n = samples;
@@ -367,7 +363,7 @@ conv_8_16 (unsigned char *src, unsigned char *dst, long samples)
 }
 
 /*********/
-static INLINE long
+static long
 conv_rgbaF_rgba8 (unsigned char *src, unsigned char *dst, long samples)
 {
   conv_F_8 (src, dst, samples * 4);
@@ -376,14 +372,14 @@ conv_rgbaF_rgba8 (unsigned char *src, unsigned char *dst, long samples)
 
 #define conv_rgbaF_rgbP8    conv_rgbaF_rgba8
 
-static INLINE long
+static long
 conv_rgbF_rgb8 (unsigned char *src, unsigned char *dst, long samples)
 {
   conv_F_8 (src, dst, samples * 3);
   return samples;
 }
 
-static INLINE long
+static long
 conv_gaF_ga8 (unsigned char *src, unsigned char *dst, long samples)
 {
   conv_F_8 (src, dst, samples * 2);
@@ -394,35 +390,35 @@ conv_gaF_ga8 (unsigned char *src, unsigned char *dst, long samples)
 #define conv_gF_g8          conv_F_8
 #define conv_gAF_gA8        conv_gaF_ga8
 
-static INLINE long
+static long
 conv_rgbaF_rgba16 (unsigned char *src, unsigned char *dst, long samples)
 {
   conv_F_16 (src, dst, samples * 4);
   return samples;
 }
 
-static INLINE long
+static long
 conv_rgbaF_rgbaD (unsigned char *src, unsigned char *dst, long samples)
 {
   conv_F_D (src, dst, samples * 4);
   return samples;
 }
 
-static INLINE long
+static long
 conv_rgbaD_rgbaF (unsigned char *src, unsigned char *dst, long samples)
 {
   conv_D_F (src, dst, samples * 4);
   return samples;
 }
 
-static INLINE long
+static long
 conv_rgbF_rgb16 (unsigned char *src, unsigned char *dst, long samples)
 {
   conv_F_16 (src, dst, samples * 3);
   return samples;
 }
 
-static INLINE long
+static long
 conv_gaF_ga16 (unsigned char *src, unsigned char *dst, long samples)
 {
   conv_F_16 (src, dst, samples * 2);
@@ -435,21 +431,21 @@ conv_gaF_ga16 (unsigned char *src, unsigned char *dst, long samples)
 #define conv_gF_g16          conv_F_16
 #define conv_gAF_gA16        conv_gaF_ga16
 
-static INLINE long
+static long
 conv_rgba8_rgbaF (unsigned char *src, unsigned char *dst, long samples)
 {
   conv_8_F (src, dst, samples * 4);
   return samples;
 }
 
-static INLINE long
+static long
 conv_rgb8_rgbF (unsigned char *src, unsigned char *dst, long samples)
 {
   conv_8_F (src, dst, samples * 3);
   return samples;
 }
 
-static INLINE long
+static long
 conv_ga8_gaF (unsigned char *src, unsigned char *dst, long samples)
 {
   conv_8_F (src, dst, samples * 2);
@@ -460,21 +456,21 @@ conv_ga8_gaF (unsigned char *src, unsigned char *dst, long samples)
 #define conv_gA8_gAF        conv_ga8_gaF
 #define conv_g8_gF          conv_8_F
 
-static INLINE long
+static long
 conv_rgba16_rgbaF (unsigned char *src, unsigned char *dst, long samples)
 {
   conv_16_F (src, dst, samples * 4);
   return samples;
 }
 
-static INLINE long
+static long
 conv_rgb16_rgbF (unsigned char *src, unsigned char *dst, long samples)
 {
   conv_16_F (src, dst, samples * 3);
   return samples;
 }
 
-static INLINE long
+static long
 conv_ga16_gaF (unsigned char *src, unsigned char *dst, long samples)
 {
   conv_16_F (src, dst, samples * 2);
@@ -485,21 +481,21 @@ conv_ga16_gaF (unsigned char *src, unsigned char *dst, long samples)
 #define conv_gA16_gAF        conv_ga16_gaF
 #define conv_g16_gF          conv_16_F
 
-static INLINE long
+static long
 conv_rgba16_rgba8 (unsigned char *src, unsigned char *dst, long samples)
 {
   conv_16_8 (src, dst, samples * 4);
   return samples;
 }
 
-static INLINE long
+static long
 conv_rgb16_rgb8 (unsigned char *src, unsigned char *dst, long samples)
 {
   conv_16_8 (src, dst, samples * 3);
   return samples;
 }
 
-static INLINE long
+static long
 conv_ga16_ga8 (unsigned char *src, unsigned char *dst, long samples)
 {
   conv_16_8 (src, dst, samples * 2);
@@ -510,21 +506,21 @@ conv_ga16_ga8 (unsigned char *src, unsigned char *dst, long samples)
 #define conv_gA16_gA8        conv_ga16_ga8
 #define conv_g16_g8          conv_16_8
 
-static INLINE long
+static long
 conv_rgba8_rgba16 (unsigned char *src, unsigned char *dst, long samples)
 {
   conv_8_16 (src, dst, samples * 4);
   return samples;
 }
 
-static INLINE long
+static long
 conv_rgb8_rgb16 (unsigned char *src, unsigned char *dst, long samples)
 {
   conv_8_16 (src, dst, samples * 3);
   return samples;
 }
 
-static INLINE long
+static long
 conv_ga8_ga16 (unsigned char *src, unsigned char *dst, long samples)
 {
   conv_8_16 (src, dst, samples * 2);
@@ -537,7 +533,7 @@ conv_ga8_ga16 (unsigned char *src, unsigned char *dst, long samples)
 
 /* alpha conversions */
 
-static INLINE long
+static long
 conv_gaF_gAF (unsigned char *src, unsigned char *dst, long samples)
 {
   long n = samples;
@@ -556,7 +552,7 @@ conv_gaF_gAF (unsigned char *src, unsigned char *dst, long samples)
   return samples;
 }
 
-static INLINE long
+static long
 conv_gAF_gaF (unsigned char *src, unsigned char *dst, long samples)
 {
   long n = samples;
@@ -575,7 +571,7 @@ conv_gAF_gaF (unsigned char *src, unsigned char *dst, long samples)
   return samples;
 }
 
-static INLINE long
+static long
 conv_rgbAF_rgbaF (unsigned char *src, unsigned char *dst, long samples)
 {
   long n = samples;
@@ -618,7 +614,7 @@ conv_rgbAF_rgbaF (unsigned char *src, unsigned char *dst, long samples)
   return samples;
 }
 
-static INLINE long
+static long
 conv_rgbaF_rgbAF (unsigned char *src, unsigned char *dst, long samples)
 {
   long n = samples;
@@ -664,7 +660,7 @@ conv_rgbaF_rgbAF (unsigned char *src, unsigned char *dst, long samples)
 
 /* alpha stripping and adding */
 
-static INLINE long
+static long
 conv_rgbaF_rgbF (unsigned char *src, unsigned char *dst, long samples)
 {
   long n = samples;
@@ -685,7 +681,7 @@ conv_rgbaF_rgbF (unsigned char *src, unsigned char *dst, long samples)
   return samples;
 }
 
-static INLINE long
+static long
 conv_rgbF_rgbaF (unsigned char *src, unsigned char *dst, long samples)
 {
   long n = samples;
@@ -707,7 +703,7 @@ conv_rgbF_rgbaF (unsigned char *src, unsigned char *dst, long samples)
   return samples;
 }
 
-static INLINE long
+static long
 conv_gaF_gF (unsigned char *src, unsigned char *dst, long samples)
 {
   long n = samples;
@@ -722,7 +718,7 @@ conv_gaF_gF (unsigned char *src, unsigned char *dst, long samples)
   return samples;
 }
 
-static INLINE long
+static long
 conv_gF_gaF (unsigned char *src, unsigned char *dst, long samples)
 {
   long n = samples;
@@ -744,7 +740,7 @@ conv_gF_gaF (unsigned char *src, unsigned char *dst, long samples)
 
 /* colorchannel dropping and adding */
 
-static INLINE long
+static long
 conv_gF_rgbF (unsigned char *src, unsigned char *dst, long samples)
 {
   long n = samples;
@@ -763,7 +759,7 @@ conv_gF_rgbF (unsigned char *src, unsigned char *dst, long samples)
   return samples;
 }
 
-static INLINE long
+static long
 conv_rgbF_gF (unsigned char *src, unsigned char *dst, long samples)
 {
   long n = samples;
@@ -785,7 +781,7 @@ conv_rgbF_gF (unsigned char *src, unsigned char *dst, long samples)
   return samples;
 }
 
-static INLINE long
+static long
 conv_gaF_rgbaF (unsigned char *src, unsigned char *dst, long samples)
 {
   long n = samples;
@@ -807,7 +803,7 @@ conv_gaF_rgbaF (unsigned char *src, unsigned char *dst, long samples)
   return samples;
 }
 
-static INLINE long
+static long
 conv_rgbaF_gaF (unsigned char *src, unsigned char *dst, long samples)
 {
   long n = samples;
@@ -836,7 +832,7 @@ conv_rgbaF_gaF (unsigned char *src, unsigned char *dst, long samples)
 
 /* other conversions coded for some optimisation reason or sumthin */
 
-static INLINE long
+static long
 conv_rgbaF_rgbA8 (unsigned char *src, unsigned char *dst, long samples)
 {
   long n = samples;
@@ -859,7 +855,7 @@ conv_rgbaF_rgbA8 (unsigned char *src, unsigned char *dst, long samples)
   return samples;
 }
 
-static INLINE long
+static long
 conv_rgbaF_rgb8 (unsigned char *src, unsigned char *dst, long samples)
 {
   long n = samples;
@@ -879,7 +875,7 @@ conv_rgbaF_rgb8 (unsigned char *src, unsigned char *dst, long samples)
   return samples;
 }
 
-static INLINE long
+static long
 conv_rgbaF_g8 (unsigned char *src, unsigned char *dst, long samples)
 {
   long n = samples;
@@ -901,7 +897,7 @@ conv_rgbaF_g8 (unsigned char *src, unsigned char *dst, long samples)
   return samples;
 }
 
-static INLINE long
+static long
 conv_rgbaF_rgb16 (unsigned char *src, unsigned char *dst, long samples)
 {
   long n = samples;
@@ -921,135 +917,7 @@ conv_rgbaF_rgb16 (unsigned char *src, unsigned char *dst, long samples)
   return samples;
 }
 
-static INLINE long
-conv_rgbP8_rgbaF (unsigned char *src, unsigned char *dst, long samples)
-{
-  long n = samples;
-
-  while (n--)
-    {
-      int c;
-
-      for (c = 0; c < 3; c++)
-        {
-          (*(float *) dst) = *(unsigned char *) src / 255.0;
-          dst             += 4;
-          src             += 1;
-        }
-      (*(float *) dst) = 1.0;
-      dst             += 4;
-      src             += 1;
-    }
-  return samples;
-}
-
-static INLINE long
-conv_rgbA16_rgbaF (unsigned char *src, unsigned char *dst, long samples)
-{
-  long n = samples;
-
-  while (n--)
-    {
-      float alpha = (*(unsigned short *) src + (3)) / 65535.0;
-      int   c;
-
-      for (c = 0; c < 3; c++)
-        {
-          (*(float *) dst) = (*(unsigned short *) src / 65535.0) / alpha;
-          dst             += 4;
-          src             += 2;
-        }
-      *(float *) dst = alpha;
-      dst           += 4;
-      src           += 2;
-    }
-  return samples;
-}
-
-/*
-   static INLINE long
-   conv_rgb8_rgbaF (unsigned char *src,
-                 unsigned char *dst,
-                 int samples)
-   {
-    long n=samples;
-    while (n--) {
-        int c;
-
-        for (c = 0; c < 3; c++) {
-            (*(float *) dst) = *(unsigned char *) src / 255.0;
-            dst += 4;
-            src += 1;
-        }
-        (*(float *) dst) = 1.0;
-        dst += 4;
-    }
-   return samples;
-   }
-
-   static INLINE long
-   conv_g8_rgbaF (unsigned char *src,
-               unsigned char *dst,
-               int samples)
-   {
-    long n=samples;
-    while (n--) {
-        int c;
-
-        for (c = 0; c < 3; c++) {
-            (*(float *) dst) = *(unsigned char *) src / 255.0;
-            dst += 4;
-        }
-        src += 1;
-        (*(float *) dst) = 1.0;
-        dst += 4;
-    }
-   return samples;
-   }
-
-   static INLINE long
-   conv_rgb16_rgbaF (unsigned char *src,
-                  unsigned char *dst,
-                  int samples)
-   {
-    long n=samples;
-    while (n--) {
-        int c;
-
-        for (c = 0; c < 3; c++) {
- *(float *) dst = (*(unsigned short *) src) / 65535.0;
-            src += 2;
-            dst += 4;
-        }
- *(float *) dst = 1.0;
-        src += 2;
-        dst += 4;
-    }
-   return samples;
-   }
-
-   static INLINE long
-   conv_gF_rgbaF (unsigned char *src,
-               unsigned char *dst,
-               int samples)
-   {
-    long n=samples;
-    while (n--) {
-        (*(float *) dst) = (*(float *) src);
-        dst += 4;
-        (*(float *) dst) = (*(float *) src);
-        dst += 4;
-        (*(float *) dst) = (*(float *) src);
-        dst += 4;
-        (*(float *) dst) = 1.0;
-        dst += 4;
-        src += 4;
-
-    }
-   return samples;
-   }
- */
-static INLINE long
+static long
 conv_rgba8_rgbA8 (unsigned char *src, unsigned char *dst, long samples)
 {
   long n = samples;
@@ -1078,7 +946,7 @@ conv_rgba8_rgbA8 (unsigned char *src, unsigned char *dst, long samples)
   return samples;
 }
 
-static INLINE long
+static long
 conv_rgbA8_rgba8 (unsigned char *src, unsigned char *dst, long samples)
 {
   long n = samples;
@@ -1108,161 +976,7 @@ conv_rgbA8_rgba8 (unsigned char *src, unsigned char *dst, long samples)
   return samples;
 }
 
-static INLINE long
-conv_argb8_rgba8 (unsigned char *src, unsigned char *dst, long samples)
-{
-  long n = samples;
-
-  while (n--)
-    {
-      dst[0] = src[2];
-      dst[1] = src[1];
-      dst[2] = src[0];
-      dst[3] = src[3];
-      src   += 4;
-      dst   += 4;
-    }
-  return samples;
-}
-
-static INLINE long
-conv_rgba8_argb8 (unsigned char *src, unsigned char *dst, long samples)
-{
-  long n = samples;
-
-  while (n--)
-    {
-      dst[0] = src[3];
-      dst[1] = src[0];
-      dst[2] = src[1];
-      dst[3] = src[2];
-      src   += 4;
-      dst   += 4;
-    }
-  return samples;
-}
-
-static INLINE long
-conv_Argb8_rgbA8 (unsigned char *src, unsigned char *dst, long samples)
-{
-  long n = samples;
-
-  while (n--)
-    {
-      dst[0] = src[2];
-      dst[1] = src[1];
-      dst[2] = src[0];
-      dst[3] = src[3];
-      src   += 4;
-      dst   += 4;
-    }
-  return samples;
-}
-
-static INLINE long
-conv_rgbA8_Argb8 (unsigned char *src, unsigned char *dst, long samples)
-{
-  long n = samples;
-
-  while (n--)
-    {
-      dst[0] = src[2];
-      dst[1] = src[1];
-      dst[2] = src[0];
-      dst[3] = src[3];
-      src   += 4;
-      dst   += 4;
-    }
-  return samples;
-}
-
-static INLINE long
-conv_Prgb8_rgbP8 (unsigned char *src, unsigned char *dst, long samples)
-{
-  long n = samples;
-
-  while (n--)
-    {
-      dst[0] = src[2];
-      dst[1] = src[1];
-      dst[2] = src[0];
-      dst[3] = 255;
-      src   += 4;
-      dst   += 4;
-    }
-  return samples;
-}
-
-static INLINE long
-conv_rgbP8_Prgb8 (unsigned char *src, unsigned char *dst, long samples)
-{
-  long n = samples;
-
-  while (n--)
-    {
-      dst[0] = src[2];
-      dst[1] = src[1];
-      dst[2] = src[0];
-      dst[3] = 255;
-      src   += 4;
-      dst   += 4;
-    }
-  return samples;
-}
-
-static INLINE long
-conv_Prgb8_rgb8 (unsigned char *src, unsigned char *dst, long samples)
-{
-  long n = samples;
-
-  while (n--)
-    {
-      dst[0] = src[2];
-      dst[1] = src[1];
-      dst[2] = src[0];
-      /*dst[3] = src[3]; */
-      src += 4;
-      dst += 3;
-    }
-  return samples;
-}
-
-
-/* FIXME: this is actually BGRP */
-static INLINE long
-conv_rgb8_Prgb8 (unsigned char *src, unsigned char *dst, long samples)
-{
-  long n = samples;
-
-  while (n--)
-    {
-      dst[0] = src[2];          /* blue */
-      dst[1] = src[1];          /* green */
-      dst[2] = src[0];          /* red */
-      dst[3] = 255;
-      src   += 3;
-      dst   += 4;
-    }
-  return samples;
-}
-
-static INLINE long
-conv_rgb8_rgbP8 (unsigned char *src, unsigned char *dst, long samples)
-{
-  long n = samples;
-
-  while (n--)
-    {
-      dst[0] = src[0];
-      dst[1] = src[1];
-      dst[2] = src[2];
-      src   += 3;
-      dst   += 4;
-    }
-  return samples;
-}
-
-static INLINE long
+static long
 conv_rgb8_rgba8 (unsigned char *src, unsigned char *dst, long samples)
 {
   long n = samples;
@@ -1282,49 +996,7 @@ conv_rgb8_rgba8 (unsigned char *src, unsigned char *dst, long samples)
 
 #define conv_rgb8_rgbA8    conv_rgb8_rgba8
 
-static INLINE long
-conv_rgbP8_rgba8 (unsigned char *src, unsigned char *dst, long samples)
-{
-  long n = samples;
-
-  while (n--)
-    {
-      *(unsigned int *) dst = *(unsigned int *) src;
-      dst[3]                = 255;
-      src                  += 4;
-      dst                  += 4;
-    }
-  return samples;
-}
-
-#define conv_rgbP8_rgbA8    conv_rgbP8_rgba8
-
-static INLINE long
-conv_rgba8_rgbP8 (unsigned char *src, unsigned char *dst, long samples)
-{
-  memcpy (dst, src, samples * 4);
-  return samples;
-}
-
-#define conv_rgbA8_rgbP8    conv_rgba8_rgbP8
-
-static INLINE long
-conv_rgbP8_rgb8 (unsigned char *src, unsigned char *dst, long samples)
-{
-  long n = samples;
-
-  while (n--)
-    {
-      dst[0] = src[0];
-      dst[1] = src[1];
-      dst[2] = src[2];
-      src   += 4;
-      dst   += 3;
-    }
-  return samples;
-}
-
-static INLINE long
+static long
 conv_rgba8_rgb8 (unsigned char *src, unsigned char *dst, long samples)
 {
   long n = samples;
@@ -1340,225 +1012,6 @@ conv_rgba8_rgb8 (unsigned char *src, unsigned char *dst, long samples)
   return samples;
 }
 
-#ifndef byteclamp
-#define byteclamp(j)                   do { if (j < 0) j = 0;else if (j > 255) j = 255; } while (0)
-#endif
-
-#define YUV82RGB8(Y, U, V, R, G, B)    do { \
-      R = ((Y << 15) + 37355 * (V - 128)) >> 15; \
-      G = ((Y << 15) - 12911 * (U - 128) - 19038 * (V - 128)) >> 15; \
-      B = ((Y << 15) + 66454 * (U - 128)) >> 15; \
-      byteclamp (R); \
-      byteclamp (G); \
-      byteclamp (B); \
-    } while (0)
-
-#define RGB82YUV8(R, G, B, Y, U, V)    do { \
-      Y = ((9798 * R + 19234 * G + 3736 * B) >> 15) + 000; \
-      U = ((-4817 * R - 9470 * G + 14320 * B) >> 15) + 128; \
-      V = ((20152 * R - 16875 * G - 3277 * B) >> 15) + 128; \
-      byteclamp (Y); \
-      byteclamp (U); \
-      byteclamp (V); \
-    } while (0)
-
-/******* lab, xyz and rgb interaction, lifted from cpercep by adam d. moss */
-
-/*
-   static const double Xn = 0.951;
-   static const double Yn = 1.0;
-   static const double Zn = 1.089;
- */
-
-#define LXN    0.312713F
-#define LYN    0.329016F
-
-static const double lxn = LXN;
-static const double lyn = LYN;
-static double       xnn = LXN / LYN;
-static double       znn = (1.0F - (LXN + LYN)) / LYN;
-
-
-static const double LRAMP = 7.99959199F;
-
-static INLINE long
-conv_rgbF_xyzF (unsigned char *src, unsigned char *dst, long samples)
-{
-  float *src_f = (float *) src;
-  float *dst_f = (float *) dst;
-  long   n     = samples;
-
-  while (n--)
-    {
-      float x, y, z;
-      float red, green, blue;
-
-      red   = src_f[0];
-      green = src_f[1];
-      blue  = src_f[2];
-
-      x = 0.431 * red + 0.342 * green + 0.179 * blue;
-      y = 0.222 * red + 0.707 * green + 0.071 * blue;
-      z = 0.020 * red + 0.130 * green + 0.939 * blue;
-
-      dst_f[0] = x;
-      dst_f[1] = y;
-      dst_f[2] = z;
-      dst_f   += 3;
-      src_f   += 3;
-    }
-  return samples;
-}
-
-static INLINE long
-conv_xyzF_rgbF (unsigned char *src, unsigned char *dst, long samples)
-{
-  float *src_f = (float *) src;
-  float *dst_f = (float *) dst;
-  long   n     = samples;
-
-  while (n--)
-    {
-      dst_f[0] = src_f[0];
-      dst_f[1] = src_f[1];
-      dst_f[2] = src_f[2];
-      dst_f   += 3;
-      src_f   += 3;
-    }
-  return samples;
-}
-
-static INLINE double
-ffunc (const double t)
-{
-  if (t > 0.008856F)
-    {
-      return (cbrt (t));
-    }
-  else
-    {
-      return (7.787F * t + 16.0F / 116.0F);
-    }
-}
-
-
-static INLINE double
-ffunc_inv (const double t)
-{
-  if (t > 0.206893F)
-    {
-      return (t * t * t);
-    }
-  else
-    {
-      return ((t - 16.0F / 116.0F) / 7.787F);
-    }
-}
-
-static INLINE long
-conv_labF_xyzF (unsigned char *src, unsigned char *dst, long samples)
-{
-  float *src_f = (float *) src;
-  float *dst_f = (float *) dst;
-  long   n     = samples;
-
-  while (n--)
-    {
-      float P;
-      float X, Y, Z;
-      float L, a, b;
-
-      L = src_f[0];
-      a = src_f[1];
-      b = src_f[2];
-
-      if (L > LRAMP)
-        {
-          P = Y = (L + 16.0F) / 116.0F;
-          Y = Y * Y * Y;
-        }
-      else
-        {
-          Y = L / 903.3F;
-          P = 7.787F * Y + 16.0F / 116.0F;
-        }
-
-      X = (P + a / 500.0F);
-      X = xnn *ffunc_inv (X);
-      Z = (P - b / 200.0F);
-      Z = znn *ffunc_inv (Z);
-
-
-      dst_f[0] = X;
-      dst_f[1] = Y;
-      dst_f[2] = Z;
-      dst_f   += 3;
-      src_f   += 3;
-    }
-  return samples;
-}
-
-static INLINE long
-conv_xyzF_labF (unsigned char *src, unsigned char *dst, long samples)
-{
-  float *src_f = (float *) src;
-  float *dst_f = (float *) dst;
-  long   n     = samples;
-
-  while (n--)
-    {
-      double ffuncY;
-      float  X, Y, Z;
-      float  L, a, b;
-      X = src_f[0];
-      Y = src_f[1];
-      Z = src_f[2];
-
-      if (Y > 0.0F)
-        {
-          if (Y > 0.008856F)
-            {
-              L = (116.0F * cbrt (Y)) - 16.0F;
-            }
-          else
-            {
-              L = (Y * 903.3F);
-            }
-        }
-      else
-        {
-          L = 0.0;
-        }
-
-      ffuncY = ffunc (Y);
-      a      = 500.0F * (ffunc (X / xnn) - ffuncY);
-      b      = 200.0F * (ffuncY - ffunc (Z / znn));
-
-      dst_f[0] = L;
-      dst_f[1] = a;
-      dst_f[2] = b;
-      dst_f   += 3;
-      src_f   += 3;
-    }
-  return samples;
-}
-
-/******* end of cpercep lift out **/
-
-
-#define MAX_CONVERSIONS    100
-
-typedef struct Conversion
-{
-  int from_fmt;
-  int to_fmt;
-  int cost;               /* cost of function,. calculated as ms to convert 1024*1024 samples */
-  int loss;                     /* 0 maps ok, 1 precision loss, 2 alpha loss, 4 channel loss
-                                   (should be dwelled further into) */
-  void (*function)(unsigned char *src, unsigned char *dst, long samples);
-} Conversion;
-
-
 int init (void);
 
 int
@@ -1759,5 +1212,10 @@ init (void)
   o (rgba8, rgb8);
   o (rgbaF, rgbA8);
 
+#ifdef USE_TABLES
+  if (!table_inited)
+    table_init ();
+#endif
+
   return 0;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]