From 290cdc1f4e1beb19709cc95689444115dcc52ce8 Mon Sep 17 00:00:00 2001 From: Denton Woods Date: Sat, 17 Dec 2016 19:14:45 -0600 Subject: Github patches --- DevIL/bindings/DotNet/DevIL.NET.sln | 84 +++---- DevIL/bindings/DotNet/vcproj vs2005/DevIL.NET.sln | 158 ++++++------- DevIL/bindings/Mathematica/DevIL Interface.c | 180 +++++++-------- DevIL/bindings/Mathematica/DevIL Mathematica.sln | 40 ++-- DevIL/include/IL/il.h | 2 +- DevIL/include/IL/ilu.h | 2 + DevIL/src-IL/include/il_endian.h | 43 ++++ DevIL/src-IL/include/il_manip.h | 12 + DevIL/src-IL/src/il_endian.c | 268 ++++++++++++++++++++++ DevIL/src-IL/src/il_manip.c | 206 +++++++++++++++++ DevIL/src-ILU/ilur/ilur.c | 2 +- DevIL/src-ILU/include/ilu_internal.h | 22 ++ DevIL/src-ILU/src/ilu_filter.c | 63 +++++ DevIL/src-ILU/src/ilu_internal.c | 12 + DevIL/src-ILU/src/ilu_manip.c | 119 ++++++++++ 15 files changed, 980 insertions(+), 233 deletions(-) diff --git a/DevIL/bindings/DotNet/DevIL.NET.sln b/DevIL/bindings/DotNet/DevIL.NET.sln index a569d448..787c801b 100755 --- a/DevIL/bindings/DotNet/DevIL.NET.sln +++ b/DevIL/bindings/DotNet/DevIL.NET.sln @@ -1,42 +1,42 @@ -Microsoft Visual Studio Solution File, Format Version 7.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DevIL.NET", "DevIL.NET.vcproj", "{30D94686-D452-4A73-B59D-178288807EE5}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ThumbView", "..\ThumbView\ThumbView.csproj", "{1541F8B7-DBE4-490B-9E1A-8D0122339F09}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImageViewCs", "..\ImageViewCs\ImageViewCs.csproj", "{C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}" -EndProject -Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ImageViewVb", "..\ImageViewVb\ImageViewVb.vbproj", "{F073580C-F355-4F4A-98B7-83D571B96B9E}" -EndProject -Global - GlobalSection(DPCodeReviewSolutionGUID) = preSolution - DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000} - EndGlobalSection - GlobalSection(SolutionConfiguration) = preSolution - ConfigName.0 = Debug - ConfigName.1 = Release - EndGlobalSection - GlobalSection(ProjectDependencies) = postSolution - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {30D94686-D452-4A73-B59D-178288807EE5}.Debug.ActiveCfg = Debug|Win32 - {30D94686-D452-4A73-B59D-178288807EE5}.Debug.Build.0 = Debug|Win32 - {30D94686-D452-4A73-B59D-178288807EE5}.Release.ActiveCfg = Release|Win32 - {30D94686-D452-4A73-B59D-178288807EE5}.Release.Build.0 = Release|Win32 - {1541F8B7-DBE4-490B-9E1A-8D0122339F09}.Debug.ActiveCfg = Debug|.NET - {1541F8B7-DBE4-490B-9E1A-8D0122339F09}.Debug.Build.0 = Debug|.NET - {1541F8B7-DBE4-490B-9E1A-8D0122339F09}.Release.ActiveCfg = Release|.NET - {1541F8B7-DBE4-490B-9E1A-8D0122339F09}.Release.Build.0 = Release|.NET - {C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}.Debug.ActiveCfg = Debug|.NET - {C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}.Debug.Build.0 = Debug|.NET - {C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}.Release.ActiveCfg = Release|.NET - {C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}.Release.Build.0 = Release|.NET - {F073580C-F355-4F4A-98B7-83D571B96B9E}.Debug.ActiveCfg = Debug|.NET - {F073580C-F355-4F4A-98B7-83D571B96B9E}.Debug.Build.0 = Debug|.NET - {F073580C-F355-4F4A-98B7-83D571B96B9E}.Release.ActiveCfg = Release|.NET - {F073580C-F355-4F4A-98B7-83D571B96B9E}.Release.Build.0 = Release|.NET - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DevIL.NET", "DevIL.NET.vcproj", "{30D94686-D452-4A73-B59D-178288807EE5}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ThumbView", "..\ThumbView\ThumbView.csproj", "{1541F8B7-DBE4-490B-9E1A-8D0122339F09}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImageViewCs", "..\ImageViewCs\ImageViewCs.csproj", "{C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}" +EndProject +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ImageViewVb", "..\ImageViewVb\ImageViewVb.vbproj", "{F073580C-F355-4F4A-98B7-83D571B96B9E}" +EndProject +Global + GlobalSection(DPCodeReviewSolutionGUID) = preSolution + DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000} + EndGlobalSection + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {30D94686-D452-4A73-B59D-178288807EE5}.Debug.ActiveCfg = Debug|Win32 + {30D94686-D452-4A73-B59D-178288807EE5}.Debug.Build.0 = Debug|Win32 + {30D94686-D452-4A73-B59D-178288807EE5}.Release.ActiveCfg = Release|Win32 + {30D94686-D452-4A73-B59D-178288807EE5}.Release.Build.0 = Release|Win32 + {1541F8B7-DBE4-490B-9E1A-8D0122339F09}.Debug.ActiveCfg = Debug|.NET + {1541F8B7-DBE4-490B-9E1A-8D0122339F09}.Debug.Build.0 = Debug|.NET + {1541F8B7-DBE4-490B-9E1A-8D0122339F09}.Release.ActiveCfg = Release|.NET + {1541F8B7-DBE4-490B-9E1A-8D0122339F09}.Release.Build.0 = Release|.NET + {C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}.Debug.ActiveCfg = Debug|.NET + {C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}.Debug.Build.0 = Debug|.NET + {C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}.Release.ActiveCfg = Release|.NET + {C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}.Release.Build.0 = Release|.NET + {F073580C-F355-4F4A-98B7-83D571B96B9E}.Debug.ActiveCfg = Debug|.NET + {F073580C-F355-4F4A-98B7-83D571B96B9E}.Debug.Build.0 = Debug|.NET + {F073580C-F355-4F4A-98B7-83D571B96B9E}.Release.ActiveCfg = Release|.NET + {F073580C-F355-4F4A-98B7-83D571B96B9E}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/DevIL/bindings/DotNet/vcproj vs2005/DevIL.NET.sln b/DevIL/bindings/DotNet/vcproj vs2005/DevIL.NET.sln index 29b3b065..b1fdae77 100755 --- a/DevIL/bindings/DotNet/vcproj vs2005/DevIL.NET.sln +++ b/DevIL/bindings/DotNet/vcproj vs2005/DevIL.NET.sln @@ -1,79 +1,79 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DevIL.NET", "DevIL.NET.vcproj", "{30D94686-D452-4A73-B59D-178288807EE5}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ThumbView", "..\ThumbView\ThumbView.csproj", "{1541F8B7-DBE4-490B-9E1A-8D0122339F09}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImageViewCs", "..\ImageViewCs\ImageViewCs.csproj", "{C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}" -EndProject -Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ImageViewVb", "..\ImageViewVb\ImageViewVb.vbproj", "{F073580C-F355-4F4A-98B7-83D571B96B9E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|Mixed Platforms = Debug|Mixed Platforms - Debug|Win32 = Debug|Win32 - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|Mixed Platforms = Release|Mixed Platforms - Release|Win32 = Release|Win32 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {30D94686-D452-4A73-B59D-178288807EE5}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {30D94686-D452-4A73-B59D-178288807EE5}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {30D94686-D452-4A73-B59D-178288807EE5}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {30D94686-D452-4A73-B59D-178288807EE5}.Debug|Win32.ActiveCfg = Debug|Win32 - {30D94686-D452-4A73-B59D-178288807EE5}.Debug|Win32.Build.0 = Debug|Win32 - {30D94686-D452-4A73-B59D-178288807EE5}.Debug|x86.ActiveCfg = Debug|Win32 - {30D94686-D452-4A73-B59D-178288807EE5}.Release|Any CPU.ActiveCfg = Release|Win32 - {30D94686-D452-4A73-B59D-178288807EE5}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {30D94686-D452-4A73-B59D-178288807EE5}.Release|Mixed Platforms.Build.0 = Release|Win32 - {30D94686-D452-4A73-B59D-178288807EE5}.Release|Win32.ActiveCfg = Release|Win32 - {30D94686-D452-4A73-B59D-178288807EE5}.Release|Win32.Build.0 = Release|Win32 - {30D94686-D452-4A73-B59D-178288807EE5}.Release|x86.ActiveCfg = Release|Win32 - {30D94686-D452-4A73-B59D-178288807EE5}.Release|x86.Build.0 = Release|Win32 - {1541F8B7-DBE4-490B-9E1A-8D0122339F09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1541F8B7-DBE4-490B-9E1A-8D0122339F09}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {1541F8B7-DBE4-490B-9E1A-8D0122339F09}.Debug|Win32.ActiveCfg = Debug|Any CPU - {1541F8B7-DBE4-490B-9E1A-8D0122339F09}.Debug|x86.ActiveCfg = Debug|Any CPU - {1541F8B7-DBE4-490B-9E1A-8D0122339F09}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1541F8B7-DBE4-490B-9E1A-8D0122339F09}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {1541F8B7-DBE4-490B-9E1A-8D0122339F09}.Release|Win32.ActiveCfg = Release|Any CPU - {1541F8B7-DBE4-490B-9E1A-8D0122339F09}.Release|x86.ActiveCfg = Release|Any CPU - {C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}.Debug|Win32.ActiveCfg = Debug|Any CPU - {C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}.Debug|x86.ActiveCfg = Debug|x86 - {C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}.Debug|x86.Build.0 = Debug|x86 - {C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}.Release|Any CPU.Build.0 = Release|Any CPU - {C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}.Release|Win32.ActiveCfg = Release|Any CPU - {C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}.Release|x86.ActiveCfg = Release|x86 - {C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}.Release|x86.Build.0 = Release|x86 - {F073580C-F355-4F4A-98B7-83D571B96B9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F073580C-F355-4F4A-98B7-83D571B96B9E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F073580C-F355-4F4A-98B7-83D571B96B9E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {F073580C-F355-4F4A-98B7-83D571B96B9E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {F073580C-F355-4F4A-98B7-83D571B96B9E}.Debug|Win32.ActiveCfg = Debug|Any CPU - {F073580C-F355-4F4A-98B7-83D571B96B9E}.Debug|x86.ActiveCfg = Debug|x86 - {F073580C-F355-4F4A-98B7-83D571B96B9E}.Debug|x86.Build.0 = Debug|x86 - {F073580C-F355-4F4A-98B7-83D571B96B9E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F073580C-F355-4F4A-98B7-83D571B96B9E}.Release|Any CPU.Build.0 = Release|Any CPU - {F073580C-F355-4F4A-98B7-83D571B96B9E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {F073580C-F355-4F4A-98B7-83D571B96B9E}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {F073580C-F355-4F4A-98B7-83D571B96B9E}.Release|Win32.ActiveCfg = Release|Any CPU - {F073580C-F355-4F4A-98B7-83D571B96B9E}.Release|x86.ActiveCfg = Release|x86 - {F073580C-F355-4F4A-98B7-83D571B96B9E}.Release|x86.Build.0 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(DPCodeReviewSolutionGUID) = preSolution - DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000} - EndGlobalSection -EndGlobal +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DevIL.NET", "DevIL.NET.vcproj", "{30D94686-D452-4A73-B59D-178288807EE5}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ThumbView", "..\ThumbView\ThumbView.csproj", "{1541F8B7-DBE4-490B-9E1A-8D0122339F09}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImageViewCs", "..\ImageViewCs\ImageViewCs.csproj", "{C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}" +EndProject +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ImageViewVb", "..\ImageViewVb\ImageViewVb.vbproj", "{F073580C-F355-4F4A-98B7-83D571B96B9E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|Mixed Platforms = Debug|Mixed Platforms + Debug|Win32 = Debug|Win32 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|Mixed Platforms = Release|Mixed Platforms + Release|Win32 = Release|Win32 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {30D94686-D452-4A73-B59D-178288807EE5}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {30D94686-D452-4A73-B59D-178288807EE5}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {30D94686-D452-4A73-B59D-178288807EE5}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {30D94686-D452-4A73-B59D-178288807EE5}.Debug|Win32.ActiveCfg = Debug|Win32 + {30D94686-D452-4A73-B59D-178288807EE5}.Debug|Win32.Build.0 = Debug|Win32 + {30D94686-D452-4A73-B59D-178288807EE5}.Debug|x86.ActiveCfg = Debug|Win32 + {30D94686-D452-4A73-B59D-178288807EE5}.Release|Any CPU.ActiveCfg = Release|Win32 + {30D94686-D452-4A73-B59D-178288807EE5}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {30D94686-D452-4A73-B59D-178288807EE5}.Release|Mixed Platforms.Build.0 = Release|Win32 + {30D94686-D452-4A73-B59D-178288807EE5}.Release|Win32.ActiveCfg = Release|Win32 + {30D94686-D452-4A73-B59D-178288807EE5}.Release|Win32.Build.0 = Release|Win32 + {30D94686-D452-4A73-B59D-178288807EE5}.Release|x86.ActiveCfg = Release|Win32 + {30D94686-D452-4A73-B59D-178288807EE5}.Release|x86.Build.0 = Release|Win32 + {1541F8B7-DBE4-490B-9E1A-8D0122339F09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1541F8B7-DBE4-490B-9E1A-8D0122339F09}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {1541F8B7-DBE4-490B-9E1A-8D0122339F09}.Debug|Win32.ActiveCfg = Debug|Any CPU + {1541F8B7-DBE4-490B-9E1A-8D0122339F09}.Debug|x86.ActiveCfg = Debug|Any CPU + {1541F8B7-DBE4-490B-9E1A-8D0122339F09}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1541F8B7-DBE4-490B-9E1A-8D0122339F09}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {1541F8B7-DBE4-490B-9E1A-8D0122339F09}.Release|Win32.ActiveCfg = Release|Any CPU + {1541F8B7-DBE4-490B-9E1A-8D0122339F09}.Release|x86.ActiveCfg = Release|Any CPU + {C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}.Debug|Win32.ActiveCfg = Debug|Any CPU + {C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}.Debug|x86.ActiveCfg = Debug|x86 + {C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}.Debug|x86.Build.0 = Debug|x86 + {C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}.Release|Any CPU.Build.0 = Release|Any CPU + {C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}.Release|Win32.ActiveCfg = Release|Any CPU + {C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}.Release|x86.ActiveCfg = Release|x86 + {C6EF7F8A-0CCB-4DAD-A70E-CCCB25608A5E}.Release|x86.Build.0 = Release|x86 + {F073580C-F355-4F4A-98B7-83D571B96B9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F073580C-F355-4F4A-98B7-83D571B96B9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F073580C-F355-4F4A-98B7-83D571B96B9E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {F073580C-F355-4F4A-98B7-83D571B96B9E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {F073580C-F355-4F4A-98B7-83D571B96B9E}.Debug|Win32.ActiveCfg = Debug|Any CPU + {F073580C-F355-4F4A-98B7-83D571B96B9E}.Debug|x86.ActiveCfg = Debug|x86 + {F073580C-F355-4F4A-98B7-83D571B96B9E}.Debug|x86.Build.0 = Debug|x86 + {F073580C-F355-4F4A-98B7-83D571B96B9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F073580C-F355-4F4A-98B7-83D571B96B9E}.Release|Any CPU.Build.0 = Release|Any CPU + {F073580C-F355-4F4A-98B7-83D571B96B9E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {F073580C-F355-4F4A-98B7-83D571B96B9E}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {F073580C-F355-4F4A-98B7-83D571B96B9E}.Release|Win32.ActiveCfg = Release|Any CPU + {F073580C-F355-4F4A-98B7-83D571B96B9E}.Release|x86.ActiveCfg = Release|x86 + {F073580C-F355-4F4A-98B7-83D571B96B9E}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(DPCodeReviewSolutionGUID) = preSolution + DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000} + EndGlobalSection +EndGlobal diff --git a/DevIL/bindings/Mathematica/DevIL Interface.c b/DevIL/bindings/Mathematica/DevIL Interface.c index 3b39874e..7dc3f1b8 100755 --- a/DevIL/bindings/Mathematica/DevIL Interface.c +++ b/DevIL/bindings/Mathematica/DevIL Interface.c @@ -1,90 +1,90 @@ -#include -#include -#include -#include - -int main(int argc, char *argv[]) -{ - int retval; - int image; - - ilInit(); - iluInit(); - ilutInit(); - - ilGenImages(1, &image); - ilBindImage(image); - ilOriginFunc(IL_ORIGIN_LOWER_LEFT); - - retval = MLMain(argc, argv); - - ilDeleteImages(1, &image); - - ilShutDown(); // Only need to shut down DevIL, not ILU or ILUT - - return retval; -} - -/*int f(int x, int y) -{ - return x+y; -} - - -void bits(int i) -{ - int a[32], k; - for(k=0; k<32; k++) { - a[k] = i%2; - i >>= 1; - if (i==0) break; - } - - if (k<32) k++; - MLPutInteger32List(stdlink, a, k); - return; -}*/ - -int mlLoad(char *Filename) -{ - int ret = ilLoadImage(Filename); - if (ilGetInteger(IL_ORIGIN_MODE) != IL_ORIGIN_UPPER_LEFT) - iluFlipImage(); - ilConvertImage(IL_RGBA, IL_DOUBLE); - return ret; -} - -int mlWidth(void) -{ - return ilGetInteger(IL_IMAGE_WIDTH); -} - -int mlHeight(void) -{ - return ilGetInteger(IL_IMAGE_HEIGHT); -} - -void mlData(void) -{ - /*int x, y, c; - int *Data; - ILubyte *OrigData = ilGetData(); - - Data = malloc(ilGetInteger(IL_IMAGE_WIDTH) * ilGetInteger(IL_IMAGE_HEIGHT) * 4 * sizeof(int)); - for (y = 0; y < ilGetInteger(IL_IMAGE_HEIGHT); y++) { - for (x = 0; x < ilGetInteger(IL_IMAGE_WIDTH); x++) { - for (c = 0; c < 4; c++) { - Data[y * ilGetInteger(IL_IMAGE_WIDTH) * 4 + x * 4 + c] = OrigData[y * ilGetInteger(IL_IMAGE_WIDTH) * 4 + x * 4 + c]; - } - } - } - - MLPutInteger32List(stdlink, Data, ilGetInteger(IL_IMAGE_WIDTH) * ilGetInteger(IL_IMAGE_HEIGHT) * 4); - - free(Data);*/ - - MLPutReal64List(stdlink, (ILdouble*)ilGetData(), ilGetInteger(IL_IMAGE_WIDTH) * ilGetInteger(IL_IMAGE_HEIGHT) * 4); - - return; -} - +#include +#include +#include +#include + +int main(int argc, char *argv[]) +{ + int retval; + int image; + + ilInit(); + iluInit(); + ilutInit(); + + ilGenImages(1, &image); + ilBindImage(image); + ilOriginFunc(IL_ORIGIN_LOWER_LEFT); + + retval = MLMain(argc, argv); + + ilDeleteImages(1, &image); + + ilShutDown(); // Only need to shut down DevIL, not ILU or ILUT + + return retval; +} + +/*int f(int x, int y) +{ + return x+y; +} + + +void bits(int i) +{ + int a[32], k; + for(k=0; k<32; k++) { + a[k] = i%2; + i >>= 1; + if (i==0) break; + } + + if (k<32) k++; + MLPutInteger32List(stdlink, a, k); + return; +}*/ + +int mlLoad(char *Filename) +{ + int ret = ilLoadImage(Filename); + if (ilGetInteger(IL_ORIGIN_MODE) != IL_ORIGIN_UPPER_LEFT) + iluFlipImage(); + ilConvertImage(IL_RGBA, IL_DOUBLE); + return ret; +} + +int mlWidth(void) +{ + return ilGetInteger(IL_IMAGE_WIDTH); +} + +int mlHeight(void) +{ + return ilGetInteger(IL_IMAGE_HEIGHT); +} + +void mlData(void) +{ + /*int x, y, c; + int *Data; + ILubyte *OrigData = ilGetData(); + + Data = malloc(ilGetInteger(IL_IMAGE_WIDTH) * ilGetInteger(IL_IMAGE_HEIGHT) * 4 * sizeof(int)); + for (y = 0; y < ilGetInteger(IL_IMAGE_HEIGHT); y++) { + for (x = 0; x < ilGetInteger(IL_IMAGE_WIDTH); x++) { + for (c = 0; c < 4; c++) { + Data[y * ilGetInteger(IL_IMAGE_WIDTH) * 4 + x * 4 + c] = OrigData[y * ilGetInteger(IL_IMAGE_WIDTH) * 4 + x * 4 + c]; + } + } + } + + MLPutInteger32List(stdlink, Data, ilGetInteger(IL_IMAGE_WIDTH) * ilGetInteger(IL_IMAGE_HEIGHT) * 4); + + free(Data);*/ + + MLPutReal64List(stdlink, (ILdouble*)ilGetData(), ilGetInteger(IL_IMAGE_WIDTH) * ilGetInteger(IL_IMAGE_HEIGHT) * 4); + + return; +} + diff --git a/DevIL/bindings/Mathematica/DevIL Mathematica.sln b/DevIL/bindings/Mathematica/DevIL Mathematica.sln index 5d4dcd1b..375930ed 100755 --- a/DevIL/bindings/Mathematica/DevIL Mathematica.sln +++ b/DevIL/bindings/Mathematica/DevIL Mathematica.sln @@ -1,20 +1,20 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DevIL Mathematica", "DevIL Mathematica.vcproj", "{A73E8E53-2A08-405E-B462-E1541FE3E00F}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {A73E8E53-2A08-405E-B462-E1541FE3E00F}.Debug|Win32.ActiveCfg = Debug|Win32 - {A73E8E53-2A08-405E-B462-E1541FE3E00F}.Debug|Win32.Build.0 = Debug|Win32 - {A73E8E53-2A08-405E-B462-E1541FE3E00F}.Release|Win32.ActiveCfg = Release|Win32 - {A73E8E53-2A08-405E-B462-E1541FE3E00F}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DevIL Mathematica", "DevIL Mathematica.vcproj", "{A73E8E53-2A08-405E-B462-E1541FE3E00F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A73E8E53-2A08-405E-B462-E1541FE3E00F}.Debug|Win32.ActiveCfg = Debug|Win32 + {A73E8E53-2A08-405E-B462-E1541FE3E00F}.Debug|Win32.Build.0 = Debug|Win32 + {A73E8E53-2A08-405E-B462-E1541FE3E00F}.Release|Win32.ActiveCfg = Release|Win32 + {A73E8E53-2A08-405E-B462-E1541FE3E00F}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/DevIL/include/IL/il.h b/DevIL/include/IL/il.h index 00d8eec0..71eab078 100644 --- a/DevIL/include/IL/il.h +++ b/DevIL/include/IL/il.h @@ -63,7 +63,7 @@ extern "C" { #endif #endif -#ifdef RESTRICT_KEYWORD +#if defined(RESTRICT_KEYWORD) && !defined(__cplusplus) #define RESTRICT restrict #define CONST_RESTRICT const restrict #else diff --git a/DevIL/include/IL/ilu.h b/DevIL/include/IL/ilu.h index a85355cc..cdedfc40 100644 --- a/DevIL/include/IL/ilu.h +++ b/DevIL/include/IL/ilu.h @@ -151,6 +151,7 @@ ILAPI ILboolean ILAPIENTRY iluEmboss(void); ILAPI ILboolean ILAPIENTRY iluEnlargeCanvas(ILuint Width, ILuint Height, ILuint Depth); ILAPI ILboolean ILAPIENTRY iluEnlargeImage(ILfloat XDim, ILfloat YDim, ILfloat ZDim); ILAPI ILboolean ILAPIENTRY iluEqualize(void); +ILAPI ILboolean ILAPIENTRY iluEqualize2(void); ILAPI ILconst_string ILAPIENTRY iluErrorString(ILenum Error); ILAPI ILboolean ILAPIENTRY iluConvolution(ILint *matrix, ILint scale, ILint bias); ILAPI ILboolean ILAPIENTRY iluFlipImage(void); @@ -178,6 +179,7 @@ ILAPI ILboolean ILAPIENTRY iluSaturate4f(ILfloat r, ILfloat g, ILfloat b, I ILAPI ILboolean ILAPIENTRY iluScale(ILuint Width, ILuint Height, ILuint Depth); ILAPI ILboolean ILAPIENTRY iluScaleAlpha(ILfloat scale); ILAPI ILboolean ILAPIENTRY iluScaleColours(ILfloat r, ILfloat g, ILfloat b); +ILAPI ILboolean ILAPIENTRY iluSepia(void); ILAPI ILboolean ILAPIENTRY iluSetLanguage(ILenum Language); ILAPI ILboolean ILAPIENTRY iluSharpen(ILfloat Factor, ILuint Iter); ILAPI ILboolean ILAPIENTRY iluSwapColours(void); diff --git a/DevIL/src-IL/include/il_endian.h b/DevIL/src-IL/include/il_endian.h index 252dd8c9..d170358e 100644 --- a/DevIL/src-IL/include/il_endian.h +++ b/DevIL/src-IL/include/il_endian.h @@ -39,8 +39,10 @@ #define BigDouble(d) #else #undef __BIG_ENDIAN__ +#if !defined(__LITTLE_ENDIAN__) #undef __LITTLE_ENDIAN__ // Not sure if it's defined by any compiler... #define __LITTLE_ENDIAN__ +#endif #define Short(s) #define UShort(s) #define Int(i) @@ -56,6 +58,7 @@ #define BigDouble(d) iSwapDouble(d) #endif +<<<<<<< HEAD STATIC_INLINE void iSwapUShort(ILushort *s) { @@ -336,5 +339,45 @@ STATIC_INLINE ILubyte SaveBigDouble(ILdouble d) { } void EndianSwapData(void *_Image); +======= +#ifdef IL_ENDIAN_C +#undef NOINLINE +#undef INLINE +#define INLINE +#endif + +void iSwapUShort(ILushort *s); +void iSwapShort(ILshort *s); +void iSwapUInt(ILuint *i); +void iSwapInt(ILint *i); +void iSwapFloat(ILfloat *f); +void iSwapDouble(ILdouble *d); +ILushort GetLittleUShort(); +ILshort GetLittleShort(); +ILuint GetLittleUInt(); +ILint GetLittleInt(); +ILfloat GetLittleFloat(); +ILdouble GetLittleDouble(); +ILushort GetBigUShort(); +ILshort GetBigShort(); +ILuint GetBigUInt(); +ILint GetBigInt(); +ILfloat GetBigFloat(); +ILdouble GetBigDouble(); +ILubyte SaveLittleUShort(ILushort s); +ILubyte SaveLittleShort(ILshort s); +ILubyte SaveLittleUInt(ILuint i); +ILubyte SaveLittleInt(ILint i); +ILubyte SaveLittleFloat(ILfloat f); +ILubyte SaveLittleDouble(ILdouble d); +ILubyte SaveBigUShort(ILushort s); +ILubyte SaveBigShort(ILshort s); +ILubyte SaveBigUInt(ILuint i); +ILubyte SaveBigInt(ILint i); +ILubyte SaveBigFloat(ILfloat f); +ILubyte SaveBigDouble(ILdouble d); + +void EndianSwapData(void *_Image); +>>>>>>> 08765db00c5bfd0c21c360f7266a670a6031e44a #endif//ENDIAN_H diff --git a/DevIL/src-IL/include/il_manip.h b/DevIL/src-IL/include/il_manip.h index e6ee92c4..9095d237 100644 --- a/DevIL/src-IL/include/il_manip.h +++ b/DevIL/src-IL/include/il_manip.h @@ -35,6 +35,7 @@ ILboolean ilMirrorImage(void); //@JASON New routine created 03/28/2001 #pragma warning(push) #pragma warning(disable : 4756) // Disables 'named type definition in parentheses' warning #endif +<<<<<<< HEAD STATIC_INLINE ILfloat ilFloatToHalfOverflow() { ILfloat f = 1e10; ILint j; @@ -43,6 +44,11 @@ STATIC_INLINE ILfloat ilFloatToHalfOverflow() { // the for loop terminates return f; } +======= + +ILfloat /*ILAPIENTRY*/ ilFloatToHalfOverflow(); + +>>>>>>> 08765db00c5bfd0c21c360f7266a670a6031e44a #if defined(_MSC_VER) #pragma warning(pop) #endif @@ -51,6 +57,7 @@ STATIC_INLINE ILfloat ilFloatToHalfOverflow() { // Float-to-half conversion -- general case, including // zeroes, denormalized numbers and exponent overflows. //----------------------------------------------------- +<<<<<<< HEAD STATIC_INLINE ILushort ilFloatToHalf(ILuint i) { // // Our floating point number, f, is represented by the bit @@ -244,6 +251,11 @@ STATIC_INLINE ILuint ilHalfToFloat (ILushort y) { return (s << 31) | (e << 23) | m; } +======= +ILushort ILAPIENTRY ilFloatToHalf(ILuint i); + +#endif //NOINLINE +>>>>>>> 08765db00c5bfd0c21c360f7266a670a6031e44a #ifdef _cplusplus } diff --git a/DevIL/src-IL/src/il_endian.c b/DevIL/src-IL/src/il_endian.c index 82860f16..60a42f19 100644 --- a/DevIL/src-IL/src/il_endian.c +++ b/DevIL/src-IL/src/il_endian.c @@ -14,6 +14,274 @@ #include "il_endian.h" +void iSwapUShort(ILushort *s) { + #ifdef USE_WIN32_ASM + __asm { + mov ebx, s + mov al, [ebx+1] + mov ah, [ebx ] + mov [ebx], ax + } + #else + #ifdef GCC_X86_ASM + asm("ror $8,%0" + : "=r" (*s) + : "0" (*s)); + #else + *s = ((*s)>>8) | ((*s)<<8); + #endif //GCC_X86_ASM + #endif //USE_WIN32_ASM +} + +void iSwapShort(ILshort *s) { + iSwapUShort((ILushort*)s); +} + +void iSwapUInt(ILuint *i) { + #ifdef USE_WIN32_ASM + __asm { + mov ebx, i + mov eax, [ebx] + bswap eax + mov [ebx], eax + } + #else + #ifdef GCC_X86_ASM + asm("bswap %0;" + : "+r" (*i)); + #else + *i = ((*i)>>24) | (((*i)>>8) & 0xff00) | (((*i)<<8) & 0xff0000) | ((*i)<<24); + #endif //GCC_X86_ASM + #endif //USE_WIN32_ASM +} + +void iSwapInt(ILint *i) { + iSwapUInt((ILuint*)i); +} + +void iSwapFloat(ILfloat *f) { + iSwapUInt((ILuint*)f); +} + +void iSwapDouble(ILdouble *d) { + #ifdef GCC_X86_ASM + int *t = (int*)d; + asm("bswap %2 \n" + "bswap %3 \n" + "movl %2,%1 \n" + "movl %3,%0 \n" + : "=g" (t[0]), "=g" (t[1]) + : "r" (t[0]), "r" (t[1])); + #else + ILubyte t,*b = (ILubyte*)d; + #define dswap(x,y) t=b[x];b[x]=b[y];b[y]=b[x]; + dswap(0,7); + dswap(1,6); + dswap(2,5); + dswap(3,4); + #undef dswap + #endif +} + + +ILushort GetLittleUShort() { + ILushort s; + iread(&s, sizeof(ILushort), 1); +#ifdef __BIG_ENDIAN__ + iSwapUShort(&s); +#endif + return s; +} + +ILshort GetLittleShort() { + ILshort s; + iread(&s, sizeof(ILshort), 1); +#ifdef __BIG_ENDIAN__ + iSwapShort(&s); +#endif + return s; +} + +ILuint GetLittleUInt() { + ILuint i; + iread(&i, sizeof(ILuint), 1); +#ifdef __BIG_ENDIAN__ + iSwapUInt(&i); +#endif + return i; +} + +ILint GetLittleInt() { + ILint i; + iread(&i, sizeof(ILint), 1); +#ifdef __BIG_ENDIAN__ + iSwapInt(&i); +#endif + return i; +} + +ILfloat GetLittleFloat() { + ILfloat f; + iread(&f, sizeof(ILfloat), 1); +#ifdef __BIG_ENDIAN__ + iSwapFloat(&f); +#endif + return f; +} + +ILdouble GetLittleDouble() { + ILdouble d; + iread(&d, sizeof(ILdouble), 1); +#ifdef __BIG_ENDIAN__ + iSwapDouble(&d); +#endif + return d; +} + +ILushort GetBigUShort() { + ILushort s; + iread(&s, sizeof(ILushort), 1); +#ifdef __LITTLE_ENDIAN__ + iSwapUShort(&s); +#endif + return s; +} + +ILshort GetBigShort() { + ILshort s; + iread(&s, sizeof(ILshort), 1); +#ifdef __LITTLE_ENDIAN__ + iSwapShort(&s); +#endif + return s; +} + +ILuint GetBigUInt() { + ILuint i; + iread(&i, sizeof(ILuint), 1); +#ifdef __LITTLE_ENDIAN__ + iSwapUInt(&i); +#endif + return i; +} + +ILint GetBigInt() { + ILint i; + iread(&i, sizeof(ILint), 1); +#ifdef __LITTLE_ENDIAN__ + iSwapInt(&i); +#endif + return i; +} + +ILfloat GetBigFloat() { + ILfloat f; + iread(&f, sizeof(ILfloat), 1); +#ifdef __LITTLE_ENDIAN__ + iSwapFloat(&f); +#endif + return f; +} + +ILdouble GetBigDouble() { + ILdouble d; + iread(&d, sizeof(ILdouble), 1); +#ifdef __LITTLE_ENDIAN__ + iSwapDouble(&d); +#endif + return d; +} + +ILubyte SaveLittleUShort(ILushort s) { +#ifdef __BIG_ENDIAN__ + iSwapUShort(&s); +#endif + return iwrite(&s, sizeof(ILushort), 1); +} + +ILubyte SaveLittleShort(ILshort s) { +#ifdef __BIG_ENDIAN__ + iSwapShort(&s); +#endif + return iwrite(&s, sizeof(ILshort), 1); +} + +ILubyte SaveLittleUInt(ILuint i) { +#ifdef __BIG_ENDIAN__ + iSwapUInt(&i); +#endif + return iwrite(&i, sizeof(ILuint), 1); +} + +ILubyte SaveLittleInt(ILint i) { +#ifdef __BIG_ENDIAN__ + iSwapInt(&i); +#endif + return iwrite(&i, sizeof(ILint), 1); +} + +ILubyte SaveLittleFloat(ILfloat f) { +#ifdef __BIG_ENDIAN__ + iSwapFloat(&f); +#endif + return iwrite(&f, sizeof(ILfloat), 1); +} + +ILubyte SaveLittleDouble(ILdouble d) { +#ifdef __BIG_ENDIAN__ + iSwapDouble(&d); +#endif + return iwrite(&d, sizeof(ILdouble), 1); +} + + +ILubyte SaveBigUShort(ILushort s) { +#ifdef __LITTLE_ENDIAN__ + iSwapUShort(&s); +#endif + return iwrite(&s, sizeof(ILushort), 1); +} + + +ILubyte SaveBigShort(ILshort s) { +#ifdef __LITTLE_ENDIAN__ + iSwapShort(&s); +#endif + return iwrite(&s, sizeof(ILshort), 1); +} + + +ILubyte SaveBigUInt(ILuint i) { +#ifdef __LITTLE_ENDIAN__ + iSwapUInt(&i); +#endif + return iwrite(&i, sizeof(ILuint), 1); +} + + +ILubyte SaveBigInt(ILint i) { +#ifdef __LITTLE_ENDIAN__ + iSwapInt(&i); +#endif + return iwrite(&i, sizeof(ILint), 1); +} + + +ILubyte SaveBigFloat(ILfloat f) { +#ifdef __LITTLE_ENDIAN__ + iSwapFloat(&f); +#endif + return iwrite(&f, sizeof(ILfloat), 1); +} + + +ILubyte SaveBigDouble(ILdouble d) { +#ifdef __LITTLE_ENDIAN__ + iSwapDouble(&d); +#endif + return iwrite(&d, sizeof(ILdouble), 1); +} + void EndianSwapData(void *_Image) { ILuint i; diff --git a/DevIL/src-IL/src/il_manip.c b/DevIL/src-IL/src/il_manip.c index 5d0b9b96..76985554 100644 --- a/DevIL/src-IL/src/il_manip.c +++ b/DevIL/src-IL/src/il_manip.c @@ -13,6 +13,212 @@ #include "il_internal.h" +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; +} + +//----------------------------------------------------- +// Float-to-half conversion -- general case, including +// zeroes, denormalized numbers and exponent overflows. +//----------------------------------------------------- +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 +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; +} void ILAPIENTRY iFlipBuffer(ILubyte *buff, ILuint depth, ILuint line_size, ILuint line_num) { diff --git a/DevIL/src-ILU/ilur/ilur.c b/DevIL/src-ILU/ilur/ilur.c index 9663e3b4..a366bbe4 100644 --- a/DevIL/src-ILU/ilur/ilur.c +++ b/DevIL/src-ILU/ilur/ilur.c @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include diff --git a/DevIL/src-ILU/include/ilu_internal.h b/DevIL/src-ILU/include/ilu_internal.h index abf4d011..c77d7efd 100644 --- a/DevIL/src-ILU/include/ilu_internal.h +++ b/DevIL/src-ILU/include/ilu_internal.h @@ -59,6 +59,7 @@ extern const ILdouble IL_PI; extern const ILdouble IL_DEGCONV; +<<<<<<< HEAD STATIC_INLINE ILfloat ilCos(ILfloat Angle) { return (ILfloat)(cos(Angle * IL_DEGCONV)); } @@ -66,11 +67,32 @@ STATIC_INLINE ILfloat ilCos(ILfloat Angle) { STATIC_INLINE ILfloat ilSin(ILfloat Angle) { return (ILfloat)(sin(Angle * IL_DEGCONV)); } +======= +#ifdef ILU_INTERNAL_C +#undef NOINLINE +#undef INLINE +#define INLINE +#endif + +// Internal functions +ILfloat ilCos(ILfloat Angle); +ILfloat ilSin(ILfloat Angle); +ILint ilRound(ILfloat Num); +#ifndef NOINLINE +ILfloat ilCos(ILfloat Angle); +>>>>>>> 08765db00c5bfd0c21c360f7266a670a6031e44a +ILfloat ilSin(ILfloat Angle); + +<<<<<<< HEAD STATIC_INLINE ILint ilRound(ILfloat Num) { return (ILint)(Num + 0.5); // this is truncating in away-from-0, not rounding } +======= +ILint ilRound(ILfloat Num); +#endif +>>>>>>> 08765db00c5bfd0c21c360f7266a670a6031e44a diff --git a/DevIL/src-ILU/src/ilu_filter.c b/DevIL/src-ILU/src/ilu_filter.c index 2b974468..19d37d1c 100644 --- a/DevIL/src-ILU/src/ilu_filter.c +++ b/DevIL/src-ILU/src/ilu_filter.c @@ -1316,3 +1316,66 @@ ILAPI ILboolean ILAPIENTRY iluConvolution(ILint *matrix, ILint scale, ILint bias return IL_TRUE; } + +// Sepia conversion values recommended by Microsoft and seen at +// http://stackoverflow.com/questions/1061093/how-is-a-sepia-tone-created +ILboolean ILAPIENTRY iluSepia(void) +{ + ILubyte *Data; + + iluCurImage = ilGetCurImage(); + if (iluCurImage == NULL) { + ilSetError(ILU_ILLEGAL_OPERATION); + return IL_FALSE; + } + if (iluCurImage->Type != IL_UNSIGNED_BYTE) { + ilSetError(ILU_INVALID_VALUE); //@TODO: Support other types + return IL_FALSE; + } + Data = iluCurImage->Data; + + switch (iluCurImage->Format) + { + case IL_BGR: + case IL_BGRA: + for (ILuint i = 0; i < iluCurImage->SizeOfData; i += iluCurImage->Bpp) { + ILubyte r = Data[i+2], g = Data[i+1], b = Data[i]; + /*double Y = 0.299 * r + 0.587 * g + 0.114 * b; + double I = 0.596 * r - 0.274 * g - 0.322 * b; + double Q = 0.212 * r - 0.523 * g + 0.311 * b; + I = 51; + Q = 0; + Data[i+2] = (ILubyte)IL_MIN(255, 1.0 * Y + 0.956 * I + 0.621 * Q); + Data[i+1] = (ILubyte)IL_MIN(255, 1.0 * Y - 0.272 * I - 0.647 * Q); + Data[i] = (ILubyte)IL_MIN(255, 1.0 * Y - 1.105 * I + 1.702 * Q);*/ + Data[i+2] = (ILubyte)IL_MIN(255, (r * 0.393) + (g * 0.769) + (b * 0.189)); + Data[i+1] = (ILubyte)IL_MIN(255, (r * 0.349) + (g * 0.686) + (b * 0.168)); + Data[i] = (ILubyte)IL_MIN(255, (r * 0.272) + (g * 0.534) + (b * 0.131)); + } + break; + + case IL_RGB: + case IL_RGBA: + for (ILuint i = 0; i < iluCurImage->SizeOfData; i += iluCurImage->Bpp) { + ILubyte r = Data[i], g = Data[i+1], b = Data[i+2]; + /*double Y = 0.299 * r + 0.587 * g + 0.114 * b; + double I = 0.596 * r - 0.274 * g - 0.322 * b; + double Q = 0.212 * r - 0.523 * g + 0.311 * b; + I = 51; + Q = 0; + Data[i] = (ILubyte)IL_MIN(255, 1.0 * Y + 0.956 * I + 0.621 * Q); + Data[i+1] = (ILubyte)IL_MIN(255, 1.0 * Y - 0.272 * I - 0.647 * Q); + Data[i+2] = (ILubyte)IL_MIN(255, 1.0 * Y - 1.105 * I + 1.702 * Q);*/ + Data[i] = (ILubyte)IL_MIN(255, (r * 0.393) + (g * 0.769) + (b * 0.189)); + Data[i+1] = (ILubyte)IL_MIN(255, (r * 0.349) + (g * 0.686) + (b * 0.168)); + Data[i+2] = (ILubyte)IL_MIN(255, (r * 0.272) + (g * 0.534) + (b * 0.131)); + } + break; + + default: + //ilSetError(ILU_ILLEGAL_OPERATION); + return IL_FALSE; + } + + return IL_TRUE; +} diff --git a/DevIL/src-ILU/src/ilu_internal.c b/DevIL/src-ILU/src/ilu_internal.c index d1ef2380..20036d7f 100644 --- a/DevIL/src-ILU/src/ilu_internal.c +++ b/DevIL/src-ILU/src/ilu_internal.c @@ -7,3 +7,15 @@ const ILdouble IL_PI = 3.1415926535897932384626; const ILdouble IL_DEGCONV = 0.0174532925199432957692; ILimage *iluCurImage = NULL; +ILfloat ilCos(ILfloat Angle) { + return (ILfloat)(cos(Angle * IL_DEGCONV)); +} + +ILfloat ilSin(ILfloat Angle) { + return (ILfloat)(sin(Angle * IL_DEGCONV)); +} + + +ILint ilRound(ILfloat Num) { + return (ILint)(Num + 0.5); // this is truncating in away-from-0, not rounding +} diff --git a/DevIL/src-ILU/src/ilu_manip.c b/DevIL/src-ILU/src/ilu_manip.c index bf6d55b7..856b8c1b 100644 --- a/DevIL/src-ILU/src/ilu_manip.c +++ b/DevIL/src-ILU/src/ilu_manip.c @@ -903,3 +903,122 @@ ILboolean ILAPIENTRY iluEqualize() { return IL_TRUE; } + + +// Method from the paper "Underwater image quality enhancement through composition of +// dual - intensity images and Rayleigh - stretching" by Ghani and Isa +// (http://springerplus.springeropen.com/articles/10.1186/2193-1801-3-757), +// DOI : 10.1186 / 2193 - 1801 - 3 - 757 +// Note that the ordering of the colors does not matter for the first part of this method. +ILboolean ILAPIENTRY iluEqualize2(void) +{ + iluCurImage = ilGetCurImage(); + if (iluCurImage == NULL) { + ilSetError(ILU_ILLEGAL_OPERATION); + return 0; + } + + // @TODO: Change to work with other types! + if (iluCurImage->Bpc > 1 || (iluCurImage->Format != IL_RGB && iluCurImage->Format != IL_RGBA + && iluCurImage->Format != IL_BGR && iluCurImage->Format != IL_BGRA)) { + ilSetError(ILU_INTERNAL_ERROR); + return IL_FALSE; + } + + // Start of the Modified Von Kries hypothesis + + ILdouble ChanAvgs[3] = { 0.0, 0.0, 0.0 }; + ILuint NumPix = iluCurImage->Width * iluCurImage->Height; + if (NumPix < 1) { + ilSetError(IL_INTERNAL_ERROR); + return IL_FALSE; + } + for (ILuint i = 0; i < iluCurImage->SizeOfData; i += iluCurImage->Bpp) + { + ChanAvgs[0] += iluCurImage->Data[i + 0]; + ChanAvgs[1] += iluCurImage->Data[i + 1]; + ChanAvgs[2] += iluCurImage->Data[i + 2]; + } + ChanAvgs[0] /= NumPix; + ChanAvgs[1] /= NumPix; + ChanAvgs[2] /= NumPix; + + //@TODO: This is a really crude way of sorting the array - could be much simpler code + // in C++ or using an actual sorting function. With only 3 elements, this isn't too bad. + ILdouble ChanAvgsCopy[3]; + ChanAvgsCopy[0] = IL_MIN(ChanAvgs[0], IL_MIN(ChanAvgs[1], ChanAvgs[2])); + ChanAvgsCopy[2] = IL_MAX(ChanAvgs[0], IL_MAX(ChanAvgs[1], ChanAvgs[2])); + ChanAvgsCopy[1] = -1; // Just a dummy value + + ILuint MinPos = -1, MaxPos = -1; + for (ILuint i = 0; i < 3; i++) + { + if (ChanAvgs[i] == ChanAvgsCopy[0]) + MinPos = i; + if (ChanAvgs[i] == ChanAvgsCopy[2]) + MaxPos = i; + } + for (ILuint i = 0; i < 3; i++) + { + if (i != MinPos && i != MaxPos) + ChanAvgsCopy[1] = ChanAvgs[i]; + } + + if (ChanAvgsCopy[0] < 1.0 || ChanAvgsCopy[2] < 1.0) { + // This prevents division by 0 - could possibly be lowered less than 1 + //ilSetError(IL_INTERNAL_ERROR); + return IL_FALSE; + } + + ILdouble A = ChanAvgsCopy[1] / ChanAvgsCopy[0]; // Median of RGB divided by minimum of RGB + ILdouble B = ChanAvgsCopy[1] / ChanAvgsCopy[2]; // Median of RGB divided by maximum of RGB + + ILdouble *Corrected = (ILdouble*)ialloc(iluCurImage->SizeOfData * sizeof(ILdouble)); + if (Corrected == NULL) { + return IL_FALSE; + } + + // Make a copy of the data as doubles + for (ILuint i = 0; i < iluCurImage->SizeOfData; i++) + Corrected[i] = iluCurImage->Data[i]; + + for (ILuint i = 0; i < iluCurImage->SizeOfData; i += iluCurImage->Bpp) + { + // These values can overflow + Corrected[i + MinPos] = iluCurImage->Data[i + MinPos] * A; + Corrected[i + MaxPos] = iluCurImage->Data[i + MaxPos] * B; + } + + ILdouble MinVals[3] = { 1e9, 1e9, 1e9 }, MaxVals[3] = { -1, -1, -1 }; + //@TODO: This could be rolled into the averaging loop, since we can just scale these by A and B + for (ILuint i = 0; i < iluCurImage->SizeOfData; i += iluCurImage->Bpp) + { + for (ILuint c = 0; c < 3; c++) { + if (Corrected[i + c] > MaxVals[c]) + MaxVals[c] = Corrected[i + c]; + if (Corrected[i + c] < MinVals[c]) + MinVals[c] = Corrected[i + c]; + } + } + + // Histogram stretching + + for (ILuint c = 0; c < 3; c++) { + if ((MaxVals[c] - MinVals[c]) < 1.0) { + // This is the case if an image is a solid color. The original image is unmodified. + return IL_FALSE; + } + } + + for (ILuint i = 0; i < iluCurImage->SizeOfData; i += iluCurImage->Bpp) + { + for (ILuint c = 0; c < 3; c++) { + iluCurImage->Data[i + c] = (ILubyte)((Corrected[i + c] - MinVals[c]) * ((255.0 - 0.0) / (MaxVals[c] - MinVals[c])) + 0); + } + } + + ifree(Corrected); + + return IL_TRUE; +} + -- cgit v1.2.1