[meta-freescale] [meta-fsl-demos][PATCH V2 1/2] devil: Add a recipe for cross-platform image library
Neena Busireddy
neenareddy.busireddy at nxp.com
Tue Jan 19 08:51:55 PST 2016
This recipe is required as fsl-gpu-sdk is dependent on it.
Signed-off-by: Neena Busireddy <neenareddy.busireddy at nxp.com>
---
.../devil/devil/Fix-GCC-5.2-erros.patch | 21 ++
recipes-graphics/devil/devil/M4Patch.patch | 18 ++
recipes-graphics/devil/devil/il_manip_c.patch | 211 ++++++++++++++++++++
recipes-graphics/devil/devil/il_manip_h.patch | 220 +++++++++++++++++++++
recipes-graphics/devil/devil_1.7.8.bb | 22 +++
5 files changed, 492 insertions(+)
create mode 100644 recipes-graphics/devil/devil/Fix-GCC-5.2-erros.patch
create mode 100644 recipes-graphics/devil/devil/M4Patch.patch
create mode 100644 recipes-graphics/devil/devil/il_manip_c.patch
create mode 100644 recipes-graphics/devil/devil/il_manip_h.patch
create mode 100644 recipes-graphics/devil/devil_1.7.8.bb
diff --git a/recipes-graphics/devil/devil/Fix-GCC-5.2-erros.patch b/recipes-graphics/devil/devil/Fix-GCC-5.2-erros.patch
new file mode 100644
index 0000000..b99dfd9
--- /dev/null
+++ b/recipes-graphics/devil/devil/Fix-GCC-5.2-erros.patch
@@ -0,0 +1,21 @@
+diff -Naur devil-1.7.8_org/include/IL/il.h devil-1.7.8/include/IL/il.h
+--- devil-1.7.8_org/include/IL/il.h 2015-12-16 14:31:33.105076974 -0600
++++ devil-1.7.8/include/IL/il.h 2015-12-16 14:33:47.000000000 -0600
+@@ -63,13 +63,13 @@
+ #endif
+ #endif
+
+-#ifdef RESTRICT_KEYWORD
+-#define RESTRICT restrict
+-#define CONST_RESTRICT const restrict
++#if defined(RESTRICT_KEYWORD) && !defined(__cplusplus)
++#define RESTRICT __restrict__
++#define CONST_RESTRICT const __restrict__
+ #else
+ #define RESTRICT
+ #define CONST_RESTRICT const
+-#endif
++#endif // RESTRICT keyword and not C++
+
+ #include <stdio.h>
+
diff --git a/recipes-graphics/devil/devil/M4Patch.patch b/recipes-graphics/devil/devil/M4Patch.patch
new file mode 100644
index 0000000..ad67adf
--- /dev/null
+++ b/recipes-graphics/devil/devil/M4Patch.patch
@@ -0,0 +1,18 @@
+--- devil-1.7.8/m4/devil-definitions.m4
++++ devil-1.7.8/m4/devil-definitions.m4
+@@ -244,12 +244,12 @@
+
+ AC_DEFUN([SETTLE_PNG],
+ [DEVIL_IL_LIB([png.h],
+- [png12])
+- AS_IF([test "x$have_png12" = "xno"],
++ [png])
++ AS_IF([test "x$have_png" = "xno"],
+ [DEVIL_IL_LIB([png.h],
+ [png])
+ lib_test_result="$have_png"],
+- [lib_test_result="$have_png12"])
++ [lib_test_result="$have_png"])
+ AS_IF([test "x$lib_test_result" = "xyes"],
+ [MAYBE_OPTIONAL_DEPENDENCY([IL],
+ [libpng]) ]) ])
diff --git a/recipes-graphics/devil/devil/il_manip_c.patch b/recipes-graphics/devil/devil/il_manip_c.patch
new file mode 100644
index 0000000..7bf852c
--- /dev/null
+++ b/recipes-graphics/devil/devil/il_manip_c.patch
@@ -0,0 +1,211 @@
+--- devil-1.7.8/src-IL/src/il_manip.c 2009-03-25 13:30:42.000000000 -0600
++++ devil-1.7.8/src-IL/src/il_manip.c 2014-05-21 19:09:33.017902907 -0500
+@@ -13,6 +13,208 @@
+ #include "il_internal.h"
+ #include "il_manip.h"
+
++ILushort ILAPIENTRY ilFloatToHalf(ILuint i) {
++ //
++ // Our floating point number, f, is represented by the bit
++ // pattern in integer i. Disassemble that bit pattern into
++ // the sign, s, the exponent, e, and the significand, m.
++ // Shift s into the position where it will go in in the
++ // resulting half number.
++ // Adjust e, accounting for the different exponent bias
++ // of float and half (127 versus 15).
++ //
++
++ register int s = (i >> 16) & 0x00008000;
++ register int e = ((i >> 23) & 0x000000ff) - (127 - 15);
++ register int m = i & 0x007fffff;
++
++ //
++ // Now reassemble s, e and m into a half:
++ //
++
++ if (e <= 0)
++ {
++ if (e < -10)
++ {
++ //
++ // E is less than -10. The absolute value of f is
++ // less than HALF_MIN (f may be a small normalized
++ // float, a denormalized float or a zero).
++ //
++ // We convert f to a half zero.
++ //
++
++ return 0;
++ }
++
++ //
++ // E is between -10 and 0. F is a normalized float,
++ // whose magnitude is less than HALF_NRM_MIN.
++ //
++ // We convert f to a denormalized half.
++ //
++
++ m = (m | 0x00800000) >> (1 - e);
++
++ //
++ // Round to nearest, round "0.5" up.
++ //
++ // Rounding may cause the significand to overflow and make
++ // our number normalized. Because of the way a half's bits
++ // are laid out, we don't have to treat this case separately;
++ // the code below will handle it correctly.
++ //
++
++ if (m & 0x00001000)
++ m += 0x00002000;
++
++ //
++ // Assemble the half from s, e (zero) and m.
++ //
++
++ return s | (m >> 13);
++ }
++ else if (e == 0xff - (127 - 15))
++ {
++ if (m == 0)
++ {
++ //
++ // F is an infinity; convert f to a half
++ // infinity with the same sign as f.
++ //
++
++ return s | 0x7c00;
++ }
++ else
++ {
++ //
++ // F is a NAN; we produce a half NAN that preserves
++ // the sign bit and the 10 leftmost bits of the
++ // significand of f, with one exception: If the 10
++ // leftmost bits are all zero, the NAN would turn
++ // into an infinity, so we have to set at least one
++ // bit in the significand.
++ //
++
++ m >>= 13;
++ return s | 0x7c00 | m | (m == 0);
++ }
++ }
++ else
++ {
++ //
++ // E is greater than zero. F is a normalized float.
++ // We try to convert f to a normalized half.
++ //
++
++ //
++ // Round to nearest, round "0.5" up
++ //
++
++ if (m & 0x00001000)
++ {
++ m += 0x00002000;
++
++ if (m & 0x00800000)
++ {
++ m = 0; // overflow in significand,
++ e += 1; // adjust exponent
++ }
++ }
++
++ //
++ // Handle exponent overflow
++ //
++
++ if (e > 30)
++ {
++ ilFloatToHalfOverflow(); // Cause a hardware floating point overflow;
++ return s | 0x7c00; // if this returns, the half becomes an
++ } // infinity with the same sign as f.
++
++ //
++ // Assemble the half from s, e and m.
++ //
++
++ return s | (e << 10) | (m >> 13);
++ }
++}
++
++// Taken from OpenEXR
++ILuint ILAPIENTRY ilHalfToFloat (ILushort y) {
++
++ int s = (y >> 15) & 0x00000001;
++ int e = (y >> 10) & 0x0000001f;
++ int m = y & 0x000003ff;
++
++ if (e == 0)
++ {
++ if (m == 0)
++ {
++ //
++ // Plus or minus zero
++ //
++
++ return s << 31;
++ }
++ else
++ {
++ //
++ // Denormalized number -- renormalize it
++ //
++
++ while (!(m & 0x00000400))
++ {
++ m <<= 1;
++ e -= 1;
++ }
++
++ e += 1;
++ m &= ~0x00000400;
++ }
++ }
++ else if (e == 31)
++ {
++ if (m == 0)
++ {
++ //
++ // Positive or negative infinity
++ //
++
++ return (s << 31) | 0x7f800000;
++ }
++ else
++ {
++ //
++ // Nan -- preserve sign and significand bits
++ //
++
++ return (s << 31) | 0x7f800000 | (m << 13);
++ }
++ }
++
++ //
++ // Normalized number
++ //
++
++ e = e + (127 - 15);
++ m = m << 13;
++
++ //
++ // Assemble s, e and m.
++ //
++
++ return (s << 31) | (e << 23) | m;
++}
++
++ILfloat /*ILAPIENTRY*/ ilFloatToHalfOverflow() {
++ ILfloat f = 1e10;
++ ILint j;
++ for (j = 0; j < 10; j++)
++ f *= f; // this will overflow before
++ // the for loop terminates
++ return f;
++}
+
+ ILAPI void ILAPIENTRY iFlipBuffer(ILubyte *buff, ILuint depth, ILuint line_size, ILuint line_num)
+ {
diff --git a/recipes-graphics/devil/devil/il_manip_h.patch b/recipes-graphics/devil/devil/il_manip_h.patch
new file mode 100644
index 0000000..53ea091
--- /dev/null
+++ b/recipes-graphics/devil/devil/il_manip_h.patch
@@ -0,0 +1,220 @@
+--- devil-1.7.8/src-IL/include/il_manip.h 2009-03-25 13:30:42.000000000 -0600
++++ devil-1.7.8/src-IL/include/il_manip.h 2014-05-21 19:09:33.013902907 -0500
+@@ -31,14 +31,7 @@
+ #pragma warning(push)
+ #pragma warning(disable : 4756) // Disables 'named type definition in parentheses' warning
+ #endif
+-INLINE ILfloat /*ILAPIENTRY*/ ilFloatToHalfOverflow() {
+- ILfloat f = 1e10;
+- ILint j;
+- for (j = 0; j < 10; j++)
+- f *= f; // this will overflow before
+- // the for loop terminates
+- return f;
+-}
++ILfloat /*ILAPIENTRY*/ ilFloatToHalfOverflow();
+ #if defined(_MSC_VER)
+ #pragma warning(pop)
+ #endif
+@@ -47,199 +40,10 @@
+ // Float-to-half conversion -- general case, including
+ // zeroes, denormalized numbers and exponent overflows.
+ //-----------------------------------------------------
+-INLINE ILushort ILAPIENTRY ilFloatToHalf(ILuint i) {
+- //
+- // Our floating point number, f, is represented by the bit
+- // pattern in integer i. Disassemble that bit pattern into
+- // the sign, s, the exponent, e, and the significand, m.
+- // Shift s into the position where it will go in in the
+- // resulting half number.
+- // Adjust e, accounting for the different exponent bias
+- // of float and half (127 versus 15).
+- //
+-
+- register int s = (i >> 16) & 0x00008000;
+- register int e = ((i >> 23) & 0x000000ff) - (127 - 15);
+- register int m = i & 0x007fffff;
+-
+- //
+- // Now reassemble s, e and m into a half:
+- //
+-
+- if (e <= 0)
+- {
+- if (e < -10)
+- {
+- //
+- // E is less than -10. The absolute value of f is
+- // less than HALF_MIN (f may be a small normalized
+- // float, a denormalized float or a zero).
+- //
+- // We convert f to a half zero.
+- //
+-
+- return 0;
+- }
+-
+- //
+- // E is between -10 and 0. F is a normalized float,
+- // whose magnitude is less than HALF_NRM_MIN.
+- //
+- // We convert f to a denormalized half.
+- //
+-
+- m = (m | 0x00800000) >> (1 - e);
+-
+- //
+- // Round to nearest, round "0.5" up.
+- //
+- // Rounding may cause the significand to overflow and make
+- // our number normalized. Because of the way a half's bits
+- // are laid out, we don't have to treat this case separately;
+- // the code below will handle it correctly.
+- //
+-
+- if (m & 0x00001000)
+- m += 0x00002000;
+-
+- //
+- // Assemble the half from s, e (zero) and m.
+- //
+-
+- return s | (m >> 13);
+- }
+- else if (e == 0xff - (127 - 15))
+- {
+- if (m == 0)
+- {
+- //
+- // F is an infinity; convert f to a half
+- // infinity with the same sign as f.
+- //
+-
+- return s | 0x7c00;
+- }
+- else
+- {
+- //
+- // F is a NAN; we produce a half NAN that preserves
+- // the sign bit and the 10 leftmost bits of the
+- // significand of f, with one exception: If the 10
+- // leftmost bits are all zero, the NAN would turn
+- // into an infinity, so we have to set at least one
+- // bit in the significand.
+- //
+-
+- m >>= 13;
+- return s | 0x7c00 | m | (m == 0);
+- }
+- }
+- else
+- {
+- //
+- // E is greater than zero. F is a normalized float.
+- // We try to convert f to a normalized half.
+- //
+-
+- //
+- // Round to nearest, round "0.5" up
+- //
+-
+- if (m & 0x00001000)
+- {
+- m += 0x00002000;
+-
+- if (m & 0x00800000)
+- {
+- m = 0; // overflow in significand,
+- e += 1; // adjust exponent
+- }
+- }
+-
+- //
+- // Handle exponent overflow
+- //
+-
+- if (e > 30)
+- {
+- ilFloatToHalfOverflow(); // Cause a hardware floating point overflow;
+- return s | 0x7c00; // if this returns, the half becomes an
+- } // infinity with the same sign as f.
+-
+- //
+- // Assemble the half from s, e and m.
+- //
+-
+- return s | (e << 10) | (m >> 13);
+- }
+-}
++ILushort ILAPIENTRY ilFloatToHalf(ILuint i);
+
+ // Taken from OpenEXR
+-INLINE ILuint ILAPIENTRY ilHalfToFloat (ILushort y) {
+-
+- int s = (y >> 15) & 0x00000001;
+- int e = (y >> 10) & 0x0000001f;
+- int m = y & 0x000003ff;
+-
+- if (e == 0)
+- {
+- if (m == 0)
+- {
+- //
+- // Plus or minus zero
+- //
+-
+- return s << 31;
+- }
+- else
+- {
+- //
+- // Denormalized number -- renormalize it
+- //
+-
+- while (!(m & 0x00000400))
+- {
+- m <<= 1;
+- e -= 1;
+- }
+-
+- e += 1;
+- m &= ~0x00000400;
+- }
+- }
+- else if (e == 31)
+- {
+- if (m == 0)
+- {
+- //
+- // Positive or negative infinity
+- //
+-
+- return (s << 31) | 0x7f800000;
+- }
+- else
+- {
+- //
+- // Nan -- preserve sign and significand bits
+- //
+-
+- return (s << 31) | 0x7f800000 | (m << 13);
+- }
+- }
+-
+- //
+- // Normalized number
+- //
+-
+- e = e + (127 - 15);
+- m = m << 13;
+-
+- //
+- // Assemble s, e and m.
+- //
+-
+- return (s << 31) | (e << 23) | m;
+-}
++ILuint ILAPIENTRY ilHalfToFloat (ILushort y);
+ #endif //NOINLINE
+
+ #ifdef _cplusplus
diff --git a/recipes-graphics/devil/devil_1.7.8.bb b/recipes-graphics/devil/devil_1.7.8.bb
new file mode 100644
index 0000000..4b7c856
--- /dev/null
+++ b/recipes-graphics/devil/devil_1.7.8.bb
@@ -0,0 +1,22 @@
+DESCRIPTION = "A full featured cross-platform image library"
+SECTION = "libs"
+LICENSE = "LGPL-2.1"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/LGPL-2.1;md5=1a6d268fd218675ffea8be556788b780"
+PR = "r0"
+
+DEPENDS = "libpng jpeg tiff xz"
+
+SRC_URI = "http://sourceforge.net/projects/openil/files/DevIL/1.7.8/DevIL-${PV}.zip \
+ file://il_manip_c.patch \
+ file://il_manip_h.patch \
+ file://M4Patch.patch \
+ file://Fix-GCC-5.2-erros.patch"
+SRC_URI[md5sum] = "312853ef9c85ad7b2100f9cd068b2a5b"
+SRC_URI[sha256sum] = "4368d83b3016b5eafe8984f0d7f86ccee76b8993cf900d3a8cbd4901b52f64eb"
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+S = "${WORKDIR}/devil-${PV}"
+
+TARGET_CFLAGS += "-Dpng_set_gray_1_2_4_to_8=png_set_expand_gray_1_2_4_to_8"
+
+inherit autotools-brokensep
--
1.9.1
More information about the meta-freescale
mailing list