Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added always_inline attributes to functions

  • Loading branch information...
commit 873f27dc1a81a97d86c0a7b773c17f4ee0b2e4bc 1 parent 0caac9f
@pornel authored
Showing with 14 additions and 4 deletions.
  1. +4 −4 mediancut.c
  2. +10 −0 pam.h
View
8 mediancut.c
@@ -59,7 +59,7 @@ inline static int weightedcompare_other(const hist_item *h1p, const hist_item *h
if (c1p[channel_sort_order[3].chan] < c2p[channel_sort_order[3].chan]) return 1;
return 0;
-}
+ }
/** these are specialised functions to make first comparison faster without lookup in channel_sort_order[] */
static int weightedcompare_r(const void *a, const void *b)
@@ -93,7 +93,7 @@ static int weightedcompare_b(const void *a, const void *b)
if (h1p->acolor.b < h2p->acolor.b) return -1;
return weightedcompare_other(h1p, h2p);
-}
+ }
static int weightedcompare_a(const void *a, const void *b)
{
@@ -104,14 +104,14 @@ static int weightedcompare_a(const void *a, const void *b)
if (h1p->acolor.a < h2p->acolor.a) return -1;
return weightedcompare_other(h1p, h2p);
-}
+ }
inline static double variance_diff(double val, const double good_enough)
{
val *= val;
if (val < good_enough*good_enough) return val / 2.f;
return val;
-}
+ }
static f_pixel box_variance(const hist_item achv[], const struct box *box)
{
View
10 pam.h
@@ -39,6 +39,12 @@
#define SSE_ALIGN
#endif
+#if defined(__GNUC__) || defined (__llvm__)
+#define ALWAYS_INLINE __attribute__((always_inline))
+#else
+#define ALWAYS_INLINE
+#endif
+
/* from pam.h */
typedef struct {
@@ -55,6 +61,7 @@ static const float internal_gamma = 0.45455f;
Converts 8-bit color to internal gamma and premultiplied alpha.
(premultiplied color space is much better for blending of semitransparent colors)
*/
+inline static f_pixel to_f(float gamma, rgb_pixel px) ALWAYS_INLINE;
inline static f_pixel to_f(float gamma, rgb_pixel px)
{
float r = px.r/255.f,
@@ -108,6 +115,7 @@ inline static rgb_pixel to_rgb(float gamma, f_pixel px)
};
}
+inline static float colordifference_ch(const float x, const float y, const float alphas) ALWAYS_INLINE;
inline static float colordifference_ch(const float x, const float y, const float alphas)
{
// maximum of channel blended on white, and blended on black
@@ -116,6 +124,7 @@ inline static float colordifference_ch(const float x, const float y, const float
return MAX(black*black, white*white);
}
+inline static float colordifference_stdc(const f_pixel px, const f_pixel py) ALWAYS_INLINE;
inline static float colordifference_stdc(const f_pixel px, const f_pixel py)
{
const float alphas = py.a-px.a;
@@ -124,6 +133,7 @@ inline static float colordifference_stdc(const f_pixel px, const f_pixel py)
colordifference_ch(px.b, py.b, alphas);
}
+inline static float colordifference(f_pixel px, f_pixel py) ALWAYS_INLINE;
inline static float colordifference(f_pixel px, f_pixel py)
{
#if USE_SSE
Please sign in to comment.
Something went wrong with that request. Please try again.