FS-10074 [libtiff] Update to tiff-4.0.7, move from codebase to download

This commit is contained in:
Andrey Volk 2017-03-16 20:12:30 +03:00
parent 0021530faf
commit 62f48cafe7
503 changed files with 256 additions and 134855 deletions

5
.gitignore vendored
View File

@ -242,4 +242,7 @@ libs/libav/
libs/libx264/
Win32/*.msi
x64/*.msi
x64/*.msi
libs/tiff-4.0.7/
libs/PaxHeaders.1693/

View File

@ -647,6 +647,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libx264", "libs\win32\libx2
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download libx264", "libs\win32\Download libx264.2015.vcxproj", "{6D1BC01C-3F97-4C08-8A45-69C9B94281AA}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download tiff", "libs\win32\Download tiff.2015.vcxproj", "{583D8CEA-4171-4493-9025-B63265F408D8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
All|Win32 = All|Win32
@ -2891,6 +2893,16 @@ Global
{6D1BC01C-3F97-4C08-8A45-69C9B94281AA}.Release|Win32.Build.0 = Release|Win32
{6D1BC01C-3F97-4C08-8A45-69C9B94281AA}.Release|x64.ActiveCfg = Release|Win32
{6D1BC01C-3F97-4C08-8A45-69C9B94281AA}.Release|x64.Build.0 = Release|Win32
{583D8CEA-4171-4493-9025-B63265F408D8}.All|Win32.ActiveCfg = Release|Win32
{583D8CEA-4171-4493-9025-B63265F408D8}.All|Win32.Build.0 = Release|Win32
{583D8CEA-4171-4493-9025-B63265F408D8}.All|x64.ActiveCfg = Release|Win32
{583D8CEA-4171-4493-9025-B63265F408D8}.All|x64.Build.0 = Release|Win32
{583D8CEA-4171-4493-9025-B63265F408D8}.Debug|Win32.ActiveCfg = Debug|Win32
{583D8CEA-4171-4493-9025-B63265F408D8}.Debug|Win32.Build.0 = Debug|Win32
{583D8CEA-4171-4493-9025-B63265F408D8}.Debug|x64.ActiveCfg = Debug|Win32
{583D8CEA-4171-4493-9025-B63265F408D8}.Release|Win32.ActiveCfg = Release|Win32
{583D8CEA-4171-4493-9025-B63265F408D8}.Release|Win32.Build.0 = Release|Win32
{583D8CEA-4171-4493-9025-B63265F408D8}.Release|x64.ActiveCfg = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -3121,5 +3133,6 @@ Global
{7AEE504B-23B6-4B05-829E-7CD34855F146} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
{20179127-853B-4FE9-B7C0-9E817E6A3A72} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{6D1BC01C-3F97-4C08-8A45-69C9B94281AA} = {C120A020-773F-4EA3-923F-B67AF28B750D}
{583D8CEA-4171-4493-9025-B63265F408D8} = {C120A020-773F-4EA3-923F-B67AF28B750D}
EndGlobalSection
EndGlobal

View File

@ -66,6 +66,9 @@
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\w32\extdll.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="..\..\..\w32\tiff.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
@ -80,7 +83,7 @@
</BuildLog>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.;..\..\src\spandsp;..\..\src;..\..\src\msvc;.\spandsp;.\msvc;..\..\tiff-4.0.2\libtiff;..\..\jpeg-8d;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>.;..\..\src\spandsp;..\..\src;..\..\src\msvc;.\spandsp;.\msvc;..\..\jpeg-8d;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -101,7 +104,7 @@
<Path>$(IntDir)BuildLog $(ProjectName).htm</Path>
</BuildLog>
<ClCompile>
<AdditionalIncludeDirectories>.;.\spandsp;.\msvc;..\..\tiff-4.0.2\libtiff;..\..\jpeg-8d;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>.;.\spandsp;.\msvc;..\..\jpeg-8d;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level4</WarningLevel>
@ -122,7 +125,7 @@
</BuildLog>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.;.\spandsp;.\msvc;..\..\tiff-4.0.2\libtiff;..\..\jpeg-8d;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>.;.\spandsp;.\msvc;..\..\jpeg-8d;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -143,7 +146,7 @@
<Path>$(IntDir)BuildLog $(ProjectName).htm</Path>
</BuildLog>
<ClCompile>
<AdditionalIncludeDirectories>.;.\spandsp;.\msvc;..\..\tiff-4.0.2\libtiff;..\..\jpeg-8d;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>.;.\spandsp;.\msvc;..\..\jpeg-8d;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level4</WarningLevel>

View File

@ -66,6 +66,9 @@
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\w32\extlib.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="..\..\..\w32\tiff.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
@ -79,8 +82,8 @@
<Path>$(IntDir)BuildLog $(ProjectName).htm</Path>
</BuildLog>
<PreBuildEvent>
<Command>if not exist "$(ProjectDir)../../tiff-4.0.2/libtiff/tiffconf.h" copy "$(ProjectDir)..\..\tiff-4.0.2\libtiff\tiffconf.vc.h" "$(ProjectDir)..\..\tiff-4.0.2\libtiff\tiffconf.h" /Y
if not exist "$(ProjectDir)../../tiff-4.0.2/libtiff/tif_config.h" copy "$(ProjectDir)..\..\tiff-4.0.2\libtiff\tif_config.vc.h" "$(ProjectDir)..\..\tiff-4.0.2\libtiff\tif_config.h" /Y
<Command>if not exist "$(TiffDir)/tiffconf.h" copy "$(TiffDir)\tiffconf.vc.h" "$(TiffDir)\tiffconf.h" /Y
if not exist "$(TiffDir)/tif_config.h" copy "$(TiffDir)\tif_config.vc.h" "$(TiffDir)\tif_config.h" /Y
</Command>
</PreBuildEvent>
<ClCompile>
@ -96,8 +99,8 @@ if not exist "$(ProjectDir)../../tiff-4.0.2/libtiff/tif_config.h" copy "$(Projec
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<PreBuildEvent>
<Command>if not exist "$(ProjectDir)../../tiff-4.0.2/libtiff/tiffconf.h" copy "$(ProjectDir)..\..\tiff-4.0.2\libtiff\tiffconf.vc.h" "$(ProjectDir)..\..\tiff-4.0.2\libtiff\tiffconf.h" /Y
if not exist "$(ProjectDir)../../tiff-4.0.2/libtiff/tif_config.h" copy "$(ProjectDir)..\..\tiff-4.0.2\libtiff\tif_config.vc.h" "$(ProjectDir)..\..\tiff-4.0.2\libtiff\tif_config.h" /Y
<Command>if not exist "$(TiffDir)/tiffconf.h" copy "$(TiffDir)\tiffconf.vc.h" "$(TiffDir)\tiffconf.h" /Y
if not exist "$(TiffDir)/tif_config.h" copy "$(TiffDir)\tif_config.vc.h" "$(TiffDir)\tif_config.h" /Y
</Command>
</PreBuildEvent>
<Midl>
@ -119,8 +122,8 @@ if not exist "$(ProjectDir)../../tiff-4.0.2/libtiff/tif_config.h" copy "$(Projec
<Path>$(IntDir)BuildLog $(ProjectName).htm</Path>
</BuildLog>
<PreBuildEvent>
<Command>if not exist "$(ProjectDir)../../tiff-4.0.2/libtiff/tiffconf.h" copy "$(ProjectDir)..\..\tiff-4.0.2\libtiff\tiffconf.vc.h" "$(ProjectDir)..\..\tiff-4.0.2\libtiff\tiffconf.h" /Y
if not exist "$(ProjectDir)../../tiff-4.0.2/libtiff/tif_config.h" copy "$(ProjectDir)..\..\tiff-4.0.2\libtiff\tif_config.vc.h" "$(ProjectDir)..\..\tiff-4.0.2\libtiff\tif_config.h" /Y
<Command>if not exist "$(TiffDir)/tiffconf.h" copy "$(TiffDir)\tiffconf.vc.h" "$(TiffDir)\tiffconf.h" /Y
if not exist "$(TiffDir)/tif_config.h" copy "$(TiffDir)\tif_config.vc.h" "$(TiffDir)\tif_config.h" /Y
</Command>
</PreBuildEvent>
<ClCompile>
@ -132,8 +135,8 @@ if not exist "$(ProjectDir)../../tiff-4.0.2/libtiff/tif_config.h" copy "$(Projec
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<PreBuildEvent>
<Command>if not exist "$(ProjectDir)../../tiff-4.0.2/libtiff/tiffconf.h" copy "$(ProjectDir)..\..\tiff-4.0.2\libtiff\tiffconf.vc.h" "$(ProjectDir)..\..\tiff-4.0.2\libtiff\tiffconf.h" /Y
if not exist "$(ProjectDir)../../tiff-4.0.2/libtiff/tif_config.h" copy "$(ProjectDir)..\..\tiff-4.0.2\libtiff\tif_config.vc.h" "$(ProjectDir)..\..\tiff-4.0.2\libtiff\tif_config.h" /Y
<Command>if not exist "$(TiffDir)/tiffconf.h" copy "$(TiffDir)\tiffconf.vc.h" "$(TiffDir)\tiffconf.h" /Y
if not exist "$(TiffDir)/tif_config.h" copy "$(TiffDir)\tif_config.vc.h" "$(TiffDir)\tif_config.h" /Y
</Command>
</PreBuildEvent>
<Midl>
@ -147,55 +150,60 @@ if not exist "$(ProjectDir)../../tiff-4.0.2/libtiff/tif_config.h" copy "$(Projec
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\tiff-4.0.2\libtiff\tif_aux.c" />
<ClCompile Include="..\..\tiff-4.0.2\libtiff\tif_close.c" />
<ClCompile Include="..\..\tiff-4.0.2\libtiff\tif_codec.c" />
<ClCompile Include="..\..\tiff-4.0.2\libtiff\tif_color.c" />
<ClCompile Include="..\..\tiff-4.0.2\libtiff\tif_compress.c" />
<ClCompile Include="..\..\tiff-4.0.2\libtiff\tif_dir.c" />
<ClCompile Include="..\..\tiff-4.0.2\libtiff\tif_dirinfo.c" />
<ClCompile Include="..\..\tiff-4.0.2\libtiff\tif_dirread.c" />
<ClCompile Include="..\..\tiff-4.0.2\libtiff\tif_dirwrite.c" />
<ClCompile Include="..\..\tiff-4.0.2\libtiff\tif_dumpmode.c" />
<ClCompile Include="..\..\tiff-4.0.2\libtiff\tif_error.c" />
<ClCompile Include="..\..\tiff-4.0.2\libtiff\tif_extension.c" />
<ClCompile Include="..\..\tiff-4.0.2\libtiff\tif_fax3.c" />
<ClCompile Include="..\..\tiff-4.0.2\libtiff\tif_fax3sm.c" />
<ClCompile Include="..\..\tiff-4.0.2\libtiff\tif_flush.c" />
<ClCompile Include="..\..\tiff-4.0.2\libtiff\tif_getimage.c" />
<ClCompile Include="..\..\tiff-4.0.2\libtiff\tif_jpeg.c" />
<ClCompile Include="..\..\tiff-4.0.2\libtiff\tif_luv.c" />
<ClCompile Include="..\..\tiff-4.0.2\libtiff\tif_lzw.c" />
<ClCompile Include="..\..\tiff-4.0.2\libtiff\tif_next.c" />
<ClCompile Include="..\..\tiff-4.0.2\libtiff\tif_ojpeg.c" />
<ClCompile Include="..\..\tiff-4.0.2\libtiff\tif_open.c" />
<ClCompile Include="..\..\tiff-4.0.2\libtiff\tif_packbits.c" />
<ClCompile Include="..\..\tiff-4.0.2\libtiff\tif_pixarlog.c" />
<ClCompile Include="..\..\tiff-4.0.2\libtiff\tif_predict.c" />
<ClCompile Include="..\..\tiff-4.0.2\libtiff\tif_print.c" />
<ClCompile Include="..\..\tiff-4.0.2\libtiff\tif_read.c" />
<ClCompile Include="..\..\tiff-4.0.2\libtiff\tif_strip.c" />
<ClCompile Include="..\..\tiff-4.0.2\libtiff\tif_swab.c" />
<ClCompile Include="..\..\tiff-4.0.2\libtiff\tif_thunder.c" />
<ClCompile Include="..\..\tiff-4.0.2\libtiff\tif_tile.c" />
<ClCompile Include="..\..\tiff-4.0.2\libtiff\tif_unix.c" />
<ClCompile Include="..\..\tiff-4.0.2\libtiff\tif_version.c" />
<ClCompile Include="..\..\tiff-4.0.2\libtiff\tif_warning.c" />
<ClCompile Include="..\..\tiff-4.0.2\libtiff\tif_write.c" />
<ClCompile Include="..\..\tiff-4.0.2\libtiff\tif_zip.c" />
<ClCompile Include="$(TiffDir)\tif_aux.c" />
<ClCompile Include="$(TiffDir)\tif_close.c" />
<ClCompile Include="$(TiffDir)\tif_codec.c" />
<ClCompile Include="$(TiffDir)\tif_color.c" />
<ClCompile Include="$(TiffDir)\tif_compress.c" />
<ClCompile Include="$(TiffDir)\tif_dir.c" />
<ClCompile Include="$(TiffDir)\tif_dirinfo.c" />
<ClCompile Include="$(TiffDir)\tif_dirread.c" />
<ClCompile Include="$(TiffDir)\tif_dirwrite.c" />
<ClCompile Include="$(TiffDir)\tif_dumpmode.c" />
<ClCompile Include="$(TiffDir)\tif_error.c" />
<ClCompile Include="$(TiffDir)\tif_extension.c" />
<ClCompile Include="$(TiffDir)\tif_fax3.c" />
<ClCompile Include="$(TiffDir)\tif_fax3sm.c" />
<ClCompile Include="$(TiffDir)\tif_flush.c" />
<ClCompile Include="$(TiffDir)\tif_getimage.c" />
<ClCompile Include="$(TiffDir)\tif_jpeg.c" />
<ClCompile Include="$(TiffDir)\tif_luv.c" />
<ClCompile Include="$(TiffDir)\tif_lzw.c" />
<ClCompile Include="$(TiffDir)\tif_next.c" />
<ClCompile Include="$(TiffDir)\tif_ojpeg.c" />
<ClCompile Include="$(TiffDir)\tif_open.c" />
<ClCompile Include="$(TiffDir)\tif_packbits.c" />
<ClCompile Include="$(TiffDir)\tif_pixarlog.c" />
<ClCompile Include="$(TiffDir)\tif_predict.c" />
<ClCompile Include="$(TiffDir)\tif_print.c" />
<ClCompile Include="$(TiffDir)\tif_read.c" />
<ClCompile Include="$(TiffDir)\tif_strip.c" />
<ClCompile Include="$(TiffDir)\tif_swab.c" />
<ClCompile Include="$(TiffDir)\tif_thunder.c" />
<ClCompile Include="$(TiffDir)\tif_tile.c" />
<ClCompile Include="$(TiffDir)\tif_unix.c" />
<ClCompile Include="$(TiffDir)\tif_version.c" />
<ClCompile Include="$(TiffDir)\tif_warning.c" />
<ClCompile Include="$(TiffDir)\tif_write.c" />
<ClCompile Include="$(TiffDir)\tif_zip.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\tiff-4.0.2\libtiff\t4.h" />
<ClInclude Include="..\..\tiff-4.0.2\libtiff\tif_dir.h" />
<ClInclude Include="..\..\tiff-4.0.2\libtiff\tif_fax3.h" />
<ClInclude Include="..\..\tiff-4.0.2\libtiff\tif_predict.h" />
<ClInclude Include="..\..\tiff-4.0.2\libtiff\tiff.h" />
<ClInclude Include="..\..\tiff-4.0.2\libtiff\tiffconf.h" />
<ClInclude Include="..\..\tiff-4.0.2\libtiff\tiffio.h" />
<ClInclude Include="..\..\tiff-4.0.2\libtiff\tiffio.hxx" />
<ClInclude Include="..\..\tiff-4.0.2\libtiff\tiffiop.h" />
<ClInclude Include="..\..\tiff-4.0.2\libtiff\tiffvers.h" />
<ClInclude Include="..\..\tiff-4.0.2\libtiff\uvcode.h" />
<ClInclude Include="$(TiffDir)\t4.h" />
<ClInclude Include="$(TiffDir)\tif_dir.h" />
<ClInclude Include="$(TiffDir)\tif_fax3.h" />
<ClInclude Include="$(TiffDir)\tif_predict.h" />
<ClInclude Include="$(TiffDir)\tiff.h" />
<ClInclude Include="$(TiffDir)\tiffconf.h" />
<ClInclude Include="$(TiffDir)\tiffio.h" />
<ClInclude Include="$(TiffDir)\tiffio.hxx" />
<ClInclude Include="$(TiffDir)\tiffiop.h" />
<ClInclude Include="$(TiffDir)\tiffvers.h" />
<ClInclude Include="$(TiffDir)\uvcode.h" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\win32\Download tiff.2015.vcxproj">
<Project>{583d8cea-4171-4493-9025-b63265f408d8}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View File

@ -19,6 +19,9 @@
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="PropertySheets">
<Import Project="$(SolutionDir)\w32\tiff.props" />
</ImportGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='All|Win32'" Label="PropertySheets">
@ -37,7 +40,7 @@
</BuildLog>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.;.\spandsp;.\msvc;..\..\tiff-4.0.2\libtiff;.\generated;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>.;.\spandsp;.\msvc;.\generated;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>

View File

@ -19,6 +19,9 @@
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="PropertySheets">
<Import Project="$(SolutionDir)\w32\tiff.props" />
</ImportGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='All|Win32'" Label="PropertySheets">
@ -37,7 +40,7 @@
</BuildLog>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.;.\spandsp;.\msvc;..\..\tiff-4.0.2\libtiff;.\generated;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>.;.\spandsp;.\msvc;.\generated;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>

View File

@ -19,6 +19,9 @@
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="PropertySheets">
<Import Project="$(SolutionDir)\w32\tiff.props" />
</ImportGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='All|Win32'" Label="PropertySheets">
@ -37,7 +40,7 @@
</BuildLog>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.;.\spandsp;.\msvc;..\..\tiff-4.0.2\libtiff;.\generated;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>.;.\spandsp;.\msvc;.\generated;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>

View File

@ -19,6 +19,9 @@
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="PropertySheets">
<Import Project="$(SolutionDir)\w32\tiff.props" />
</ImportGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='All|Win32'" Label="PropertySheets">
@ -37,7 +40,7 @@
</BuildLog>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.;.\spandsp;.\msvc;..\..\tiff-4.0.2\libtiff;.\generated;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>.;.\spandsp;.\msvc;.\generated;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>

View File

@ -19,6 +19,9 @@
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="PropertySheets">
<Import Project="$(SolutionDir)\w32\tiff.props" />
</ImportGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='All|Win32'" Label="PropertySheets">
@ -37,7 +40,7 @@
</BuildLog>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.;.\spandsp;.\msvc;..\..\tiff-4.0.2\libtiff;.\generated;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>.;.\spandsp;.\msvc;.\generated;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>

View File

@ -1,3 +0,0 @@
config/compile
config/depcomp
config/missing

View File

@ -1 +0,0 @@
Tue Dec 6 17:55:59 CST 2011

View File

@ -1,21 +0,0 @@
Copyright (c) 1988-1997 Sam Leffler
Copyright (c) 1991-1997 Silicon Graphics, Inc.
Permission to use, copy, modify, distribute, and sell this software and
its documentation for any purpose is hereby granted without fee, provided
that (i) the above copyright notices and this permission notice appear in
all copies of the software and related documentation, and (ii) the names of
Sam Leffler and Silicon Graphics may not be used in any advertising or
publicity relating to the software without the specific, prior written
permission of Sam Leffler and Silicon Graphics.
THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
OF THIS SOFTWARE.

File diff suppressed because it is too large Load Diff

View File

@ -1,116 +0,0 @@
HOWTO-RELEASE:
Notes on releasing.
0. Make sure that you have current FSF releases of autoconf, automake,
and libtool packages installed under a common installation prefix
and that these tools are in your executable search path prior to
any other installed versions. Versions delivered with Linux may be
altered so it is best to install official FSF releases. GNU 'm4'
1.4.6 or later is needed in order to avoid bugs in m4. These
packages may be downloaded from the following ftp locations:
autoconf - ftp://ftp.gnu.org/pub/gnu/autoconf
automake - ftp://ftp.gnu.org/pub/gnu/automake
libtool - ftp://ftp.gnu.org/pub/gnu/libtool
Release builds should only be done on a system with a functioning
and correctly set system clock and on a filesystem which accurately
records file update times. Use of GNU make is recommended.
1. Commit any unsaved changes.
2. Create html/vX.X.html. Take ChangeLog entries and html-ify in there.
Easist thing to do is take html/vX.(X-1).html and use it as a template.
Add that file to the list of EXTRA_DIST files in the html/Makefile.am.
3. Update html/index.html to refer to this new page as the current release.
4. Increment the release version in configure.ac. Put 'alpha' or
'beta' after the version, if applicable. For example:
4.0.0
or
4.0.0beta7
Version should be updated in two places: in the second argument of the
AC_INIT macro and in LIBTIFF_xxx_VERSION variables.
5. Update library ELF versioning in configure.ac (LIBTIFF_CURRENT,
LIBTIFF_REVISION, and LIBTIFF_AGE). These numbers have nothing to
do with the libtiff release version numbers.
Note that as of libtiff 4.X, proper ELF versioning is used so
please follow the rules listed in configure.ac. At a bare minimum,
you should increment LIBTIFF_REVISION for each release so that
installed library files don't overwrite existing files. If APIs
have been added, removed, or interface structures have changed,
then more care is required.
6. Add an entry to Changelog similar to:
* libtiff 4.0.0 released.
7. In the source tree do
./autogen.sh
This step may be skipped if you have already been using a
maintainer build with current autoconf, automake, and libtool
packages. It is only needed when updating tool versions.
8. It is recommended (but not required) to build outside of the source
tree so that the source tree is kept in a pristine state. This
also allows sharing the source directory on several networked
systems. For example:
mkdir libtiff-build
cd libtiff-build
/path/to/libtiff/configure --enable-maintainer-mode
otherwise do
./configure --enable-maintainer-mode
9. In the build tree do
make release
This will update "RELEASE-DATE", "VERSION", and libtiff/tiffvers.h
in the source tree.
10. In the source tree, verify that the version info in RELEASE-DATE,
VERSION and libtiff/tiffvers.h is right.
11. In the build tree do
make
make distcheck
If 'make distcheck' fails, then correct any issues until it
succeeds.
Two files with names tiff-version.tar.gz and tiff-version.zip will
be created in the top level build directory.
12. In the source tree do
'cvs commit'.
13. In the source tree do
cvs tag Release-v4-0-0
(or the appropriate name for the release)
14. Copy release packages from the build tree to the
ftp.remotesensing.org ftp site.
scp tiff-*.tar.gz tiff-*.zip \
warmerdam@upload.osgeo.org:/osgeo/download/libtiff
15. Announce to list, tiff@lists.maptools.org
16. Update libtiff page on freshmeat with new version announcement.

View File

@ -1,59 +0,0 @@
# Tag Image File Format (TIFF) Software
#
# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# Process this file with automake to produce Makefile.in.
docdir = $(LIBTIFF_DOCDIR)
AUTOMAKE_OPTIONS = 1.7 dist-zip foreign
ACLOCAL_AMFLAGS = -I m4
docfiles = \
COPYRIGHT \
ChangeLog \
README \
README.vms \
RELEASE-DATE \
TODO \
VERSION
EXTRA_DIST = \
HOWTO-RELEASE \
Makefile.vc \
SConstruct \
autogen.sh \
configure.com \
nmake.opt \
libtiff-4.pc.in
dist_doc_DATA = $(docfiles)
SUBDIRS = port libtiff tools build contrib test man html
release:
(rm -f $(top_srcdir)/RELEASE-DATE && echo $(LIBTIFF_RELEASE_DATE) > $(top_srcdir)/RELEASE-DATE)
(rm -f $(top_srcdir)/VERSION && echo $(LIBTIFF_VERSION) > $(top_srcdir)/VERSION)
(rm -f $(top_srcdir)/libtiff/tiffvers.h && sed 's,LIBTIFF_VERSION,$(LIBTIFF_VERSION),;s,LIBTIFF_RELEASE_DATE,$(LIBTIFF_RELEASE_DATE),' $(top_srcdir)/libtiff/tiffvers.h.in > $(top_srcdir)/libtiff/tiffvers.h)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libtiff-4.pc

View File

@ -1,58 +0,0 @@
# $Id: Makefile.vc,v 1.7 2008-01-01 15:53:10 fwarmerdam Exp $
#
# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
#
# Makefile for MS Visual C and Watcom C compilers.
# Edit nmake.opt file if you want to ajust building options.
#
# To build:
# C:\libtiff> nmake /f makefile.vc
!INCLUDE nmake.opt
all: port lib tools
port::
cd port
$(MAKE) /f Makefile.vc
cd..
lib: port
cd libtiff
$(MAKE) /f Makefile.vc
cd..
tools: lib
cd tools
$(MAKE) /f Makefile.vc
cd ..
clean:
cd port
$(MAKE) /f Makefile.vc clean
cd..
cd libtiff
$(MAKE) /f Makefile.vc clean
cd..
cd tools
$(MAKE) /f Makefile.vc clean
cd ..

View File

@ -1,61 +0,0 @@
$Header: /cvs/maptools/cvsroot/libtiff/README,v 1.7 2012-02-18 21:53:27 bfriesen Exp $
TIFF Software Distribution
--------------------------
This file is just a placeholder; all the documentation is now in
HTML in the html directory. To view the documentation point your
favorite WWW viewer at html/index.html;
e.g.
firefox html/index.html
If you don't have an HTML viewer then you can read the HTML source
or fetch a PostScript version of this documentation from the directory
ftp://ftp.remotesensing.org/pub/libtiff/
If you can't hack either of these options then basically what you
want to do is:
% ./configure
% make
% su
# make install
More information, email contacts, and mailing list information can be
found online at http://www.remotesensing.org/libtiff/.
Use and Copyright
-----------------
Silicon Graphics has seen fit to allow us to give this work away. It
is free. There is no support or guarantee of any sort as to its
operations, correctness, or whatever. If you do anything useful with
all or parts of it you need to honor the copyright notices. I would
also be interested in knowing about it and, hopefully, be acknowledged.
The legal way of saying that is:
Copyright (c) 1988-1997 Sam Leffler
Copyright (c) 1991-1997 Silicon Graphics, Inc.
Permission to use, copy, modify, distribute, and sell this software and
its documentation for any purpose is hereby granted without fee, provided
that (i) the above copyright notices and this permission notice appear in
all copies of the software and related documentation, and (ii) the names of
Sam Leffler and Silicon Graphics may not be used in any advertising or
publicity relating to the software without the specific, prior written
permission of Sam Leffler and Silicon Graphics.
THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
OF THIS SOFTWARE.

View File

@ -1,12 +0,0 @@
Dear OpenVMS user
to make this library, execute
$@CONFIGURE
$@BUILD
Build process should be error and warning free. When process will be finished,
LIBTIFF$STRATUP.COM file containing all required definitions, will be created.
Please call it from system startup procedure or individual user procedure LOGIN.COM
To link software with libtiff, use TIFF:LIBTIFF.OPT
best regards,
Alexey Chupahin, elvis_75@mail.ru

View File

@ -1 +0,0 @@
20120615

View File

@ -1,171 +0,0 @@
# $Id: SConstruct,v 1.4 2007-02-24 15:03:47 dron Exp $
# Tag Image File Format (TIFF) Software
#
# Copyright (C) 2005, Andrey Kiselev <dron@ak4719.spb.edu>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# This file contains rules to build software with the SCons tool
# (see the http://www.scons.org/ for details on SCons).
import os
env = Environment()
# Read the user supplied options
opts = Options('libtiff.conf')
opts.Add(PathOption('PREFIX', \
'install architecture-independent files in this directory', \
'/usr/local', PathOption.PathIsDirCreate))
opts.Add(BoolOption('ccitt', \
'enable support for CCITT Group 3 & 4 algorithms', \
'yes'))
opts.Add(BoolOption('packbits', \
'enable support for Macintosh PackBits algorithm', \
'yes'))
opts.Add(BoolOption('lzw', \
'enable support for LZW algorithm', \
'yes'))
opts.Add(BoolOption('thunder', \
'enable support for ThunderScan 4-bit RLE algorithm', \
'yes'))
opts.Add(BoolOption('next', \
'enable support for NeXT 2-bit RLE algorithm', \
'yes'))
opts.Add(BoolOption('logluv', \
'enable support for LogLuv high dynamic range encoding', \
'yes'))
opts.Add(BoolOption('strip_chopping', \
'support for strip chopping (whether or not to convert single-strip uncompressed images to mutiple strips of ~8Kb to reduce memory usage)', \
'yes'))
opts.Add(BoolOption('extrasample_as_alpha', \
'the RGBA interface will treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many packages produce RGBA files but don\'t mark the alpha properly', \
'yes'))
opts.Add(BoolOption('check_ycbcr_subsampling', \
'disable picking up YCbCr subsampling info from the JPEG data stream to support files lacking the tag', \
'yes'))
opts.Update(env)
opts.Save('libtiff.conf', env)
Help(opts.GenerateHelpText(env))
# Here are our installation paths:
idir_prefix = '$PREFIX'
idir_lib = '$PREFIX/lib'
idir_bin = '$PREFIX/bin'
idir_inc = '$PREFIX/include'
idir_doc = '$PREFIX/doc'
Export([ 'env', 'idir_prefix', 'idir_lib', 'idir_bin', 'idir_inc', 'idir_doc' ])
# Now proceed to system feature checks
target_cpu, target_vendor, target_kernel, target_os = \
os.popen("./config/config.guess").readlines()[0].split("-")
def Define(context, key, have):
import SCons.Conftest
SCons.Conftest._Have(context, key, have)
def CheckCustomOption(context, name):
context.Message('Checking is the ' + name + ' option set... ')
ret = env[name]
Define(context, name + '_SUPPORT', ret)
context.Result(ret)
return ret
def CheckFillorderOption(context):
context.Message('Checking for the native cpu bit order... ')
if target_cpu[0] == 'i' and target_cpu[2:] == '86':
Define(context, 'HOST_FILLORDER', 'FILLORDER_LSB2MSB')
context.Result('lsb2msb')
else:
Define(context, 'HOST_FILLORDER', 'FILLORDER_MSB2LSB')
context.Result('msb2lsb')
return 1
def CheckIEEEFPOption(context):
context.Message('Checking for the IEEE floating point format... ')
Define(context, 'HAVE_IEEEFP', 1)
context.Result(1)
return 1
def CheckOtherOption(context, name):
context.Message('Checking is the ' + name + ' option set... ')
ret = env[name]
Define(context, 'HAVE_' + name, ret)
context.Result(ret)
return ret
custom_tests = { \
'CheckCustomOption' : CheckCustomOption, \
'CheckFillorderOption' : CheckFillorderOption, \
'CheckIEEEFPOption' : CheckIEEEFPOption, \
'CheckOtherOption' : CheckOtherOption \
}
conf = Configure(env, custom_tests = custom_tests, \
config_h = 'libtiff/tif_config.h')
# Check for standard library
conf.CheckLib('c')
if target_os != 'cygwin' \
and target_os != 'mingw32' \
and target_os != 'beos' \
and target_os != 'darwin':
conf.CheckLib('m')
# Check for system headers
conf.CheckCHeader('assert.h')
conf.CheckCHeader('fcntl.h')
conf.CheckCHeader('io.h')
conf.CheckCHeader('limits.h')
conf.CheckCHeader('malloc.h')
conf.CheckCHeader('search.h')
conf.CheckCHeader('sys/time.h')
conf.CheckCHeader('unistd.h')
# Check for standard library functions
conf.CheckFunc('floor')
conf.CheckFunc('isascii')
conf.CheckFunc('memmove')
conf.CheckFunc('memset')
conf.CheckFunc('mmap')
conf.CheckFunc('pow')
conf.CheckFunc('setmode')
conf.CheckFunc('sqrt')
conf.CheckFunc('strchr')
conf.CheckFunc('strrchr')
conf.CheckFunc('strstr')
conf.CheckFunc('strtol')
conf.CheckFillorderOption()
conf.CheckIEEEFPOption()
conf.CheckCustomOption('ccitt')
conf.CheckCustomOption('packbits')
conf.CheckCustomOption('lzw')
conf.CheckCustomOption('thunder')
conf.CheckCustomOption('next')
conf.CheckCustomOption('logluv')
conf.CheckOtherOption('strip_chopping')
conf.CheckOtherOption('extrasample_as_alpha')
conf.CheckOtherOption('check_ycbcr_subsampling')
env = conf.Finish()
# Ok, now go to build files in the subdirectories
SConscript(dirs = [ 'libtiff' ], name = 'SConstruct')

View File

@ -1,12 +0,0 @@
# $Header: /cvs/maptools/cvsroot/libtiff/TODO,v 1.6 2002-10-10 05:28:43 warmerda Exp $
o gif2tiff segaulting on selected images
o tiffcmp read data by strip/tile instead of scanline
o YCbCr sampling support
o extracate colorspace conversion support
o look at isolating all codecs from TIFF library
o JPEG colormode order dependency problem
o Write documentation on how do extend tags, and how the custom field
stuff all works.

View File

@ -1 +0,0 @@
4.0.2

View File

@ -1,8 +0,0 @@
#!/bin/sh
set -x
libtoolize --force --copy
aclocal -I ./m4
autoheader
automake --foreign --add-missing --copy
autoconf

View File

@ -1,30 +0,0 @@
#
# Tag Image File Format (TIFF) Software
#
# Copyright (C) 2007, Andrey Kiselev <dron@ak4719.spb.edu>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# Process this file with automake to produce Makefile.in.
EXTRA_DIST = README
SUBDIRS =

View File

@ -1,3 +0,0 @@
This directory contains scripts and tools needed to build libtiff library
and its utilities in various environments.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +0,0 @@
#! /bin/sh
srcpath=$(dirname $0 2>/dev/null ) || srcpath="."
$srcpath/configure "$@" --disable-shared --with-pic

View File

@ -1,29 +0,0 @@
# Tag Image File Format (TIFF) Software
#
# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# Process this file with automake to produce Makefile.in.
EXTRA_DIST = README
SUBDIRS = addtiffo dbs iptcutil mfs pds ras stream tags win_dib

View File

@ -1,2 +0,0 @@
This directory contains various contributions from libtiff users.

View File

@ -1,36 +0,0 @@
# Tag Image File Format (TIFF) Software
#
# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# Process this file with automake to produce Makefile.in.
LIBTIFF = $(top_builddir)/libtiff/libtiff.la
EXTRA_DIST = README Makefile.vc
noinst_PROGRAMS = addtiffo
addtiffo_SOURCES = addtiffo.c tif_overview.c tif_ovrcache.c tif_ovrcache.h
addtiffo_LDADD = $(LIBTIFF)
AM_CPPFLAGS = -I$(top_srcdir)/libtiff

View File

@ -1,28 +0,0 @@
#
# If libtiff.a is installed in /usr/lib or /usr/local/lib just point
# LIBTIFF_DIR there. It doesn't need a full libtiff tree.
#
!INCLUDE ..\..\nmake.opt
LIBTIFF_DIR = ..\..\libtiff
#
INCL = -I..\..\libtiff
LIBS = $(LIBTIFF_DIR)\libtiff.lib
addtiffo: addtiffo.obj tif_overview.obj tif_ovrcache.obj
$(CC) $(CFLAGS) addtiffo.obj tif_overview.obj tif_ovrcache.obj \
$(LIBS) /Feaddtiffo.exe
addtiffo.obj: addtiffo.c
$(CC) -c $(CFLAGS) addtiffo.c
tif_overview.obj: tif_overview.c
$(CC) -c $(CFLAGS) tif_overview.c
tif_ovrcache.obj: tif_ovrcache.c
$(CC) -c $(CFLAGS) tif_ovrcache.c
clean:
-del *.obj
-del addtiffo.exe

View File

@ -1,142 +0,0 @@
addtiffo 1.0
============
The addtiffo utility is used to add overview pyramids to an existing
TIFF or GeoTIFF file. Some applications can take advantage of these
overviews to accelerate overview display performance of large rasters.
This release of addtiffo is primarily intended for compatibility testing
with applications, and to see if there is interest in a cleaner release
of the capability ... perhaps incorporation into the libtiff tools
distribution.
Please feel free to contact me with questions, or problems.
warmerda@home.com
http://home.gdal.org/~warmerda/
Usage
-----
Usage: addtiffo [-r {average/nearest} [-subifd]
tiff_filename [resolution_reductions]
Example:
% addtiffo abc.tif 2 4 8 16
The numeric arguments are the list of reduction factors to
generate. In this example a 1/2, 1/4 1/8 and 1/16
Limitations
-----------
See tif_overview.cpp for up to date details.
o Currently only images with bits_per_sample of a multiple of eight
will work.
o The code will attempt to use the same kind of compression,
photometric interpretation, and organization as the source image, but
it doesn't copy geotiff tags to the reduced resolution images.
o Reduced resolution overviews for multi-sample files will currently
always be generated as PLANARCONFIG_SEPARATE. This could be fixed
reasonable easily if needed to improve compatibility with other
packages. Many don't properly support PLANARCONFIG_SEPARATE.
o Overviews are always written as appended IFDs, rather than using the
``tree of tree's'' approach using the SUBIFD tag. I wanted to implement
both, but it isn't currently easy to add a SUBIFD tag to an existing
main tiff IFD with libtiff. I hope to try this again later.
TIFF File Tags
--------------
The results of running addtiffo on a 1024x1024 tiled greyscale file
with the arguments ``2 4 8 16'' is to add four additional TIFF directories
appended on the file with the SUBFILETYPE flag to 0x1 indicating the extra
items are reduced resolution images.
The tiffinfo output of such a file might look like this:
TIFF Directory at offset 0x118008
Image Width: 1024 Image Length: 1024
Tile Width: 256 Tile Length: 112
Bits/Sample: 8
Compression Scheme: none
Photometric Interpretation: min-is-black
Samples/Pixel: 1
Planar Configuration: single image plane
TIFF Directory at offset 0x15e1d2
Subfile Type: reduced-resolution image (1 = 0x1)
Image Width: 512 Image Length: 512
Tile Width: 256 Tile Length: 112
Bits/Sample: 8
Compression Scheme: none
Photometric Interpretation: min-is-black
Samples/Pixel: 1
Planar Configuration: separate image planes
TIFF Directory at offset 0x1732b8
Subfile Type: reduced-resolution image (1 = 0x1)
Image Width: 256 Image Length: 256
Tile Width: 256 Tile Length: 112
Bits/Sample: 8
Compression Scheme: none
Photometric Interpretation: min-is-black
Samples/Pixel: 1
Planar Configuration: separate image planes
TIFF Directory at offset 0x17a366
Subfile Type: reduced-resolution image (1 = 0x1)
Image Width: 128 Image Length: 128
Tile Width: 128 Tile Length: 112
Bits/Sample: 8
Compression Scheme: none
Photometric Interpretation: min-is-black
Samples/Pixel: 1
Planar Configuration: separate image planes
TIFF Directory at offset 0x17b40c
Subfile Type: reduced-resolution image (1 = 0x1)
Image Width: 64 Image Length: 64
Tile Width: 64 Tile Length: 64
Bits/Sample: 8
Compression Scheme: none
Photometric Interpretation: min-is-black
Samples/Pixel: 1
Planar Configuration: separate image planes
Building
--------
You will need a C compiler. You will need to have libtiff already
built and installed. The provided Makefile should work on most Unix systems.
A similar file will be needed for Windows, but is not provided.
The CFLAGS and LIBS macros in the Makefile will have to be updated to
point to the correct location of the libtiff include files, and library.
Credits
-------
o Intergraph Corporation for partially funding the work.
o Global Geomatics for partially funding reorganization of the overview
building ability as a separate utility.
o Orrin Long, and Ed Grissom of Intergraph for explaining what needed to
be done.
o Max Martinez of Erdas for his discussion of external overviews.
o Atlantis Scientific who supported adding averaging, and some other
generalizations.
o Frank Warmerdam for writing the bulk of the code.
o Sam Leffler since this only exists because of his libtiff.

View File

@ -1,176 +0,0 @@
/******************************************************************************
* $Id: addtiffo.c,v 1.7 2010-06-08 18:55:15 bfriesen Exp $
*
* Project: GeoTIFF Overview Builder
* Purpose: Mainline for building overviews in a TIFF file.
* Author: Frank Warmerdam, warmerdam@pobox.com
*
******************************************************************************
* Copyright (c) 1999, Frank Warmerdam
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
******************************************************************************
*
* $Log: addtiffo.c,v $
* Revision 1.7 2010-06-08 18:55:15 bfriesen
* * contrib: Add an emacs formatting mode footer to all source files
* so that emacs can be effectively used.
*
* Revision 1.6 2005/12/16 05:59:55 fwarmerdam
* Major upgrade to support YCbCr subsampled jpeg images
*
* Revision 1.4 2004/09/21 13:31:23 dron
* Add missed include string.h.
*
* Revision 1.3 2000/04/18 22:48:31 warmerda
* Added support for averaging resampling
*
* Revision 1.2 2000/01/28 15:36:38 warmerda
* pass TIFF handle instead of filename to overview builder
*
* Revision 1.1 1999/08/17 01:47:59 warmerda
* New
*
* Revision 1.1 1999/03/12 17:46:32 warmerda
* New
*
* Revision 1.2 1999/02/11 22:27:12 warmerda
* Added multi-sample support
*
* Revision 1.1 1999/02/11 18:12:30 warmerda
* New
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "tiffio.h"
void TIFFBuildOverviews( TIFF *, int, int *, int, const char *,
int (*)(double,void*), void * );
/************************************************************************/
/* main() */
/************************************************************************/
int main( int argc, char ** argv )
{
int anOverviews[100]; /* TODO: un-hardwire array length, flexible allocate */
int nOverviewCount = 0;
int bUseSubIFD = 0;
TIFF *hTIFF;
const char *pszResampling = "nearest";
/* -------------------------------------------------------------------- */
/* Usage: */
/* -------------------------------------------------------------------- */
if( argc < 2 )
{
printf( "Usage: addtiffo [-r {nearest,average,mode}]\n"
" tiff_filename [resolution_reductions]\n"
"\n"
"Example:\n"
" %% addtiffo abc.tif 2 4 8 16\n" );
return( 1 );
}
while( argv[1][0] == '-' )
{
if( strcmp(argv[1],"-subifd") == 0 )
{
bUseSubIFD = 1;
argv++;
argc--;
}
else if( strcmp(argv[1],"-r") == 0 )
{
argv += 2;
argc -= 2;
pszResampling = *argv;
}
else
{
fprintf( stderr, "Incorrect parameters\n" );
return( 1 );
}
}
/* TODO: resampling mode parameter needs to be encoded in an integer from this point on */
/* -------------------------------------------------------------------- */
/* Collect the user requested reduction factors. */
/* -------------------------------------------------------------------- */
while( nOverviewCount < argc - 2 && nOverviewCount < 100 )
{
anOverviews[nOverviewCount] = atoi(argv[nOverviewCount+2]);
if( anOverviews[nOverviewCount] <= 0)
{
fprintf( stderr, "Incorrect parameters\n" );
return(1);
}
nOverviewCount++;
}
/* -------------------------------------------------------------------- */
/* Default to four overview levels. It would be nicer if it */
/* defaulted based on the size of the source image. */
/* -------------------------------------------------------------------- */
/* TODO: make it default based on the size of the source image */
if( nOverviewCount == 0 )
{
nOverviewCount = 4;
anOverviews[0] = 2;
anOverviews[1] = 4;
anOverviews[2] = 8;
anOverviews[3] = 16;
}
/* -------------------------------------------------------------------- */
/* Build the overview. */
/* -------------------------------------------------------------------- */
hTIFF = TIFFOpen( argv[1], "r+" );
if( hTIFF == NULL )
{
fprintf( stderr, "TIFFOpen(%s) failed.\n", argv[1] );
return( 1 );
}
TIFFBuildOverviews( hTIFF, nOverviewCount, anOverviews, bUseSubIFD,
pszResampling, NULL, NULL );
TIFFClose( hTIFF );
/* -------------------------------------------------------------------- */
/* Optionally test for memory leaks. */
/* -------------------------------------------------------------------- */
#ifdef DBMALLOC
malloc_dump(1);
#endif
return( 0 );
}
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/

View File

@ -1,899 +0,0 @@
/******************************************************************************
* tif_overview.c,v 1.9 2005/05/25 09:03:16 dron Exp
*
* Project: TIFF Overview Builder
* Purpose: Library function for building overviews in a TIFF file.
* Author: Frank Warmerdam, warmerdam@pobox.com
*
* Notes:
* o Currently only images with bits_per_sample of a multiple of eight
* will work.
*
* o The downsampler currently just takes the top left pixel from the
* source rectangle. Eventually sampling options of averaging, mode, and
* ``center pixel'' should be offered.
*
* o The code will attempt to use the same kind of compression,
* photometric interpretation, and organization as the source image, but
* it doesn't copy geotiff tags to the reduced resolution images.
*
* o Reduced resolution overviews for multi-sample files will currently
* always be generated as PLANARCONFIG_SEPARATE. This could be fixed
* reasonable easily if needed to improve compatibility with other
* packages. Many don't properly support PLANARCONFIG_SEPARATE.
*
******************************************************************************
* Copyright (c) 1999, Frank Warmerdam
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
******************************************************************************
*/
/* TODO: update notes in header above */
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include "tiffio.h"
#include "tif_ovrcache.h"
#ifndef FALSE
# define FALSE 0
# define TRUE 1
#endif
#ifndef MAX
# define MIN(a,b) ((a<b) ? a : b)
# define MAX(a,b) ((a>b) ? a : b)
#endif
void TIFFBuildOverviews( TIFF *, int, int *, int, const char *,
int (*)(double,void*), void * );
/************************************************************************/
/* TIFF_WriteOverview() */
/* */
/* Create a new directory, without any image data for an overview. */
/* Returns offset of newly created overview directory, but the */
/* current directory is reset to be the one in used when this */
/* function is called. */
/************************************************************************/
uint32 TIFF_WriteOverview( TIFF *hTIFF, uint32 nXSize, uint32 nYSize,
int nBitsPerPixel, int nPlanarConfig, int nSamples,
int nBlockXSize, int nBlockYSize,
int bTiled, int nCompressFlag, int nPhotometric,
int nSampleFormat,
unsigned short *panRed,
unsigned short *panGreen,
unsigned short *panBlue,
int bUseSubIFDs,
int nHorSubsampling, int nVerSubsampling )
{
toff_t nBaseDirOffset;
toff_t nOffset;
(void) bUseSubIFDs;
nBaseDirOffset = TIFFCurrentDirOffset( hTIFF );
TIFFCreateDirectory( hTIFF );
/* -------------------------------------------------------------------- */
/* Setup TIFF fields. */
/* -------------------------------------------------------------------- */
TIFFSetField( hTIFF, TIFFTAG_IMAGEWIDTH, nXSize );
TIFFSetField( hTIFF, TIFFTAG_IMAGELENGTH, nYSize );
if( nSamples == 1 )
TIFFSetField( hTIFF, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG );
else
TIFFSetField( hTIFF, TIFFTAG_PLANARCONFIG, nPlanarConfig );
TIFFSetField( hTIFF, TIFFTAG_BITSPERSAMPLE, nBitsPerPixel );
TIFFSetField( hTIFF, TIFFTAG_SAMPLESPERPIXEL, nSamples );
TIFFSetField( hTIFF, TIFFTAG_COMPRESSION, nCompressFlag );
TIFFSetField( hTIFF, TIFFTAG_PHOTOMETRIC, nPhotometric );
TIFFSetField( hTIFF, TIFFTAG_SAMPLEFORMAT, nSampleFormat );
if( bTiled )
{
TIFFSetField( hTIFF, TIFFTAG_TILEWIDTH, nBlockXSize );
TIFFSetField( hTIFF, TIFFTAG_TILELENGTH, nBlockYSize );
}
else
TIFFSetField( hTIFF, TIFFTAG_ROWSPERSTRIP, nBlockYSize );
TIFFSetField( hTIFF, TIFFTAG_SUBFILETYPE, FILETYPE_REDUCEDIMAGE );
if( nPhotometric == PHOTOMETRIC_YCBCR || nPhotometric == PHOTOMETRIC_ITULAB )
{
TIFFSetField( hTIFF, TIFFTAG_YCBCRSUBSAMPLING, nHorSubsampling, nVerSubsampling);
/* TODO: also write YCbCrPositioning and YCbCrCoefficients tag identical to source IFD */
}
/* TODO: add command-line parameter for selecting jpeg compression quality
* that gets ignored when compression isn't jpeg */
/* -------------------------------------------------------------------- */
/* Write color table if one is present. */
/* -------------------------------------------------------------------- */
if( panRed != NULL )
{
TIFFSetField( hTIFF, TIFFTAG_COLORMAP, panRed, panGreen, panBlue );
}
/* -------------------------------------------------------------------- */
/* Write directory, and return byte offset. */
/* -------------------------------------------------------------------- */
if( TIFFWriteCheck( hTIFF, bTiled, "TIFFBuildOverviews" ) == 0 )
return 0;
TIFFWriteDirectory( hTIFF );
TIFFSetDirectory( hTIFF, (tdir_t) (TIFFNumberOfDirectories(hTIFF)-1) );
nOffset = TIFFCurrentDirOffset( hTIFF );
TIFFSetSubDirectory( hTIFF, nBaseDirOffset );
return nOffset;
}
/************************************************************************/
/* TIFF_GetSourceSamples() */
/************************************************************************/
static void
TIFF_GetSourceSamples( double * padfSamples, unsigned char *pabySrc,
int nPixelBytes, int nSampleFormat,
uint32 nXSize, uint32 nYSize,
int nPixelOffset, int nLineOffset )
{
uint32 iXOff, iYOff;
int iSample;
iSample = 0;
for( iYOff = 0; iYOff < nYSize; iYOff++ )
{
for( iXOff = 0; iXOff < nXSize; iXOff++ )
{
unsigned char *pabyData;
pabyData = pabySrc + iYOff * nLineOffset + iXOff * nPixelOffset;
if( nSampleFormat == SAMPLEFORMAT_UINT && nPixelBytes == 1 )
{
padfSamples[iSample++] = *pabyData;
}
else if( nSampleFormat == SAMPLEFORMAT_UINT && nPixelBytes == 2 )
{
padfSamples[iSample++] = ((uint16 *) pabyData)[0];
}
else if( nSampleFormat == SAMPLEFORMAT_UINT && nPixelBytes == 4 )
{
padfSamples[iSample++] = ((uint32 *) pabyData)[0];
}
else if( nSampleFormat == SAMPLEFORMAT_INT && nPixelBytes == 2 )
{
padfSamples[iSample++] = ((int16 *) pabyData)[0];
}
else if( nSampleFormat == SAMPLEFORMAT_INT && nPixelBytes == 32 )
{
padfSamples[iSample++] = ((int32 *) pabyData)[0];
}
else if( nSampleFormat == SAMPLEFORMAT_IEEEFP && nPixelBytes == 4 )
{
padfSamples[iSample++] = ((float *) pabyData)[0];
}
else if( nSampleFormat == SAMPLEFORMAT_IEEEFP && nPixelBytes == 8 )
{
padfSamples[iSample++] = ((double *) pabyData)[0];
}
}
}
}
/************************************************************************/
/* TIFF_SetSample() */
/************************************************************************/
static void
TIFF_SetSample( unsigned char * pabyData, int nPixelBytes, int nSampleFormat,
double dfValue )
{
if( nSampleFormat == SAMPLEFORMAT_UINT && nPixelBytes == 1 )
{
*pabyData = (unsigned char) MAX(0,MIN(255,dfValue));
}
else if( nSampleFormat == SAMPLEFORMAT_UINT && nPixelBytes == 2 )
{
*((uint16 *)pabyData) = (uint16) MAX(0,MIN(65535,dfValue));
}
else if( nSampleFormat == SAMPLEFORMAT_UINT && nPixelBytes == 4 )
{
*((uint32 *)pabyData) = (uint32) dfValue;
}
else if( nSampleFormat == SAMPLEFORMAT_INT && nPixelBytes == 2 )
{
*((int16 *)pabyData) = (int16) MAX(-32768,MIN(32767,dfValue));
}
else if( nSampleFormat == SAMPLEFORMAT_INT && nPixelBytes == 32 )
{
*((int32 *)pabyData) = (int32) dfValue;
}
else if( nSampleFormat == SAMPLEFORMAT_IEEEFP && nPixelBytes == 4 )
{
*((float *)pabyData) = (float) dfValue;
}
else if( nSampleFormat == SAMPLEFORMAT_IEEEFP && nPixelBytes == 8 )
{
*((double *)pabyData) = dfValue;
}
}
/************************************************************************/
/* TIFF_DownSample() */
/* */
/* Down sample a tile of full res data into a window of a tile */
/* of downsampled data. */
/************************************************************************/
static
void TIFF_DownSample( unsigned char *pabySrcTile,
uint32 nBlockXSize, uint32 nBlockYSize,
int nPixelSkewBits, int nBitsPerPixel,
unsigned char * pabyOTile,
uint32 nOBlockXSize, uint32 nOBlockYSize,
uint32 nTXOff, uint32 nTYOff, int nOMult,
int nSampleFormat, const char * pszResampling )
{
uint32 i, j;
int k, nPixelBytes = (nBitsPerPixel) / 8;
int nPixelGroupBytes = (nBitsPerPixel+nPixelSkewBits)/8;
unsigned char *pabySrc, *pabyDst;
double *padfSamples;
assert( nBitsPerPixel >= 8 );
padfSamples = (double *) malloc(sizeof(double) * nOMult * nOMult);
/* ==================================================================== */
/* Loop over scanline chunks to process, establishing where the */
/* data is going. */
/* ==================================================================== */
for( j = 0; j*nOMult < nBlockYSize; j++ )
{
if( j + nTYOff >= nOBlockYSize )
break;
pabyDst = pabyOTile + ((j+nTYOff)*nOBlockXSize + nTXOff)
* nPixelBytes * nPixelGroupBytes;
/* -------------------------------------------------------------------- */
/* Handler nearest resampling ... we don't even care about the */
/* data type, we just do a bytewise copy. */
/* -------------------------------------------------------------------- */
if( strncmp(pszResampling,"nearest",4) == 0
|| strncmp(pszResampling,"NEAR",4) == 0 )
{
pabySrc = pabySrcTile + j*nOMult*nBlockXSize * nPixelGroupBytes;
for( i = 0; i*nOMult < nBlockXSize; i++ )
{
if( i + nTXOff >= nOBlockXSize )
break;
/*
* For now use simple subsampling, from the top left corner
* of the source block of pixels.
*/
for( k = 0; k < nPixelBytes; k++ )
pabyDst[k] = pabySrc[k];
pabyDst += nPixelBytes * nPixelGroupBytes;
pabySrc += nOMult * nPixelGroupBytes;
}
}
/* -------------------------------------------------------------------- */
/* Handle the case of averaging. For this we also have to */
/* handle each sample format we are concerned with. */
/* -------------------------------------------------------------------- */
else if( strncmp(pszResampling,"averag",6) == 0
|| strncmp(pszResampling,"AVERAG",6) == 0 )
{
pabySrc = pabySrcTile + j*nOMult*nBlockXSize * nPixelGroupBytes;
for( i = 0; i*nOMult < nBlockXSize; i++ )
{
double dfTotal;
uint32 nXSize, nYSize, iSample;
if( i + nTXOff >= nOBlockXSize )
break;
nXSize = MIN((uint32)nOMult,nBlockXSize-i);
nYSize = MIN((uint32)nOMult,nBlockYSize-j);
TIFF_GetSourceSamples( padfSamples, pabySrc,
nPixelBytes, nSampleFormat,
nXSize, nYSize,
nPixelGroupBytes,
nPixelGroupBytes * nBlockXSize );
dfTotal = 0;
for( iSample = 0; iSample < nXSize*nYSize; iSample++ )
{
dfTotal += padfSamples[iSample];
}
TIFF_SetSample( pabyDst, nPixelBytes, nSampleFormat,
dfTotal / (nXSize*nYSize) );
pabySrc += nOMult * nPixelGroupBytes;
pabyDst += nPixelBytes;
}
}
}
free( padfSamples );
}
/************************************************************************/
/* TIFF_DownSample_Subsampled() */
/************************************************************************/
static
void TIFF_DownSample_Subsampled( unsigned char *pabySrcTile, int nSample,
uint32 nBlockXSize, uint32 nBlockYSize,
unsigned char * pabyOTile,
uint32 nOBlockXSize, uint32 nOBlockYSize,
uint32 nTXOff, uint32 nTYOff, int nOMult,
const char *pszResampling,
int nHorSubsampling, int nVerSubsampling )
{
/* TODO: test with variety of subsampling values, and incovinient tile/strip sizes */
int nSampleBlockSize;
int nSourceSampleRowSize;
int nDestSampleRowSize;
uint32 nSourceX, nSourceY;
uint32 nSourceXSec, nSourceYSec;
uint32 nSourceXSecEnd, nSourceYSecEnd;
uint32 nDestX, nDestY;
int nSampleOffsetInSampleBlock;
unsigned int nCummulator;
unsigned int nCummulatorCount;
nSampleBlockSize = nHorSubsampling * nVerSubsampling + 2;
nSourceSampleRowSize =
( ( nBlockXSize + nHorSubsampling - 1 ) / nHorSubsampling ) * nSampleBlockSize;
nDestSampleRowSize =
( ( nOBlockXSize + nHorSubsampling - 1 ) / nHorSubsampling ) * nSampleBlockSize;
if( strncmp(pszResampling,"nearest",4) == 0
|| strncmp(pszResampling,"NEAR",4) == 0 )
{
if( nSample == 0 )
{
for( nSourceY = 0, nDestY = nTYOff;
nSourceY < nBlockYSize;
nSourceY += nOMult, nDestY ++)
{
if( nDestY >= nOBlockYSize )
break;
for( nSourceX = 0, nDestX = nTXOff;
nSourceX < nBlockXSize;
nSourceX += nOMult, nDestX ++)
{
if( nDestX >= nOBlockXSize )
break;
* ( pabyOTile + ( nDestY / nVerSubsampling ) * nDestSampleRowSize
+ ( nDestY % nVerSubsampling ) * nHorSubsampling
+ ( nDestX / nHorSubsampling ) * nSampleBlockSize
+ ( nDestX % nHorSubsampling ) ) =
* ( pabySrcTile + ( nSourceY / nVerSubsampling ) * nSourceSampleRowSize
+ ( nSourceY % nVerSubsampling ) * nHorSubsampling
+ ( nSourceX / nHorSubsampling ) * nSampleBlockSize
+ ( nSourceX % nHorSubsampling ) );
}
}
}
else
{
nSampleOffsetInSampleBlock = nHorSubsampling * nVerSubsampling + nSample - 1;
for( nSourceY = 0, nDestY = ( nTYOff / nVerSubsampling );
nSourceY < ( nBlockYSize / nVerSubsampling );
nSourceY += nOMult, nDestY ++)
{
if( nDestY*nVerSubsampling >= nOBlockYSize )
break;
for( nSourceX = 0, nDestX = ( nTXOff / nHorSubsampling );
nSourceX < ( nBlockXSize / nHorSubsampling );
nSourceX += nOMult, nDestX ++)
{
if( nDestX*nHorSubsampling >= nOBlockXSize )
break;
* ( pabyOTile + nDestY * nDestSampleRowSize
+ nDestX * nSampleBlockSize
+ nSampleOffsetInSampleBlock ) =
* ( pabySrcTile + nSourceY * nSourceSampleRowSize
+ nSourceX * nSampleBlockSize
+ nSampleOffsetInSampleBlock );
}
}
}
}
else if( strncmp(pszResampling,"averag",6) == 0
|| strncmp(pszResampling,"AVERAG",6) == 0 )
{
if( nSample == 0 )
{
for( nSourceY = 0, nDestY = nTYOff; nSourceY < nBlockYSize; nSourceY += nOMult, nDestY ++)
{
if( nDestY >= nOBlockYSize )
break;
for( nSourceX = 0, nDestX = nTXOff; nSourceX < nBlockXSize; nSourceX += nOMult, nDestX ++)
{
if( nDestX >= nOBlockXSize )
break;
nSourceXSecEnd = nSourceX + nOMult;
if( nSourceXSecEnd > nBlockXSize )
nSourceXSecEnd = nBlockXSize;
nSourceYSecEnd = nSourceY + nOMult;
if( nSourceYSecEnd > nBlockYSize )
nSourceYSecEnd = nBlockYSize;
nCummulator = 0;
for( nSourceYSec = nSourceY; nSourceYSec < nSourceYSecEnd; nSourceYSec ++)
{
for( nSourceXSec = nSourceX; nSourceXSec < nSourceXSecEnd; nSourceXSec ++)
{
nCummulator += * ( pabySrcTile + ( nSourceYSec / nVerSubsampling ) * nSourceSampleRowSize
+ ( nSourceYSec % nVerSubsampling ) * nHorSubsampling
+ ( nSourceXSec / nHorSubsampling ) * nSampleBlockSize
+ ( nSourceXSec % nHorSubsampling ) );
}
}
nCummulatorCount = ( nSourceXSecEnd - nSourceX ) * ( nSourceYSecEnd - nSourceY );
* ( pabyOTile + ( nDestY / nVerSubsampling ) * nDestSampleRowSize
+ ( nDestY % nVerSubsampling ) * nHorSubsampling
+ ( nDestX / nHorSubsampling ) * nSampleBlockSize
+ ( nDestX % nHorSubsampling ) ) =
( ( nCummulator + ( nCummulatorCount >> 1 ) ) / nCummulatorCount );
}
}
}
else
{
nSampleOffsetInSampleBlock = nHorSubsampling * nVerSubsampling + nSample - 1;
for( nSourceY = 0, nDestY = ( nTYOff / nVerSubsampling ); nSourceY < ( nBlockYSize / nVerSubsampling );
nSourceY += nOMult, nDestY ++)
{
if( nDestY*nVerSubsampling >= nOBlockYSize )
break;
for( nSourceX = 0, nDestX = ( nTXOff / nHorSubsampling ); nSourceX < ( nBlockXSize / nHorSubsampling );
nSourceX += nOMult, nDestX ++)
{
if( nDestX*nHorSubsampling >= nOBlockXSize )
break;
nSourceXSecEnd = nSourceX + nOMult;
if( nSourceXSecEnd > ( nBlockXSize / nHorSubsampling ) )
nSourceXSecEnd = ( nBlockXSize / nHorSubsampling );
nSourceYSecEnd = nSourceY + nOMult;
if( nSourceYSecEnd > ( nBlockYSize / nVerSubsampling ) )
nSourceYSecEnd = ( nBlockYSize / nVerSubsampling );
nCummulator = 0;
for( nSourceYSec = nSourceY; nSourceYSec < nSourceYSecEnd; nSourceYSec ++)
{
for( nSourceXSec = nSourceX; nSourceXSec < nSourceXSecEnd; nSourceXSec ++)
{
nCummulator += * ( pabySrcTile + nSourceYSec * nSourceSampleRowSize
+ nSourceXSec * nSampleBlockSize
+ nSampleOffsetInSampleBlock );
}
}
nCummulatorCount = ( nSourceXSecEnd - nSourceX ) * ( nSourceYSecEnd - nSourceY );
* ( pabyOTile + nDestY * nDestSampleRowSize
+ nDestX * nSampleBlockSize
+ nSampleOffsetInSampleBlock ) =
( ( nCummulator + ( nCummulatorCount >> 1 ) ) / nCummulatorCount );
}
}
}
}
}
/************************************************************************/
/* TIFF_ProcessFullResBlock() */
/* */
/* Process one block of full res data, downsampling into each */
/* of the overviews. */
/************************************************************************/
void TIFF_ProcessFullResBlock( TIFF *hTIFF, int nPlanarConfig,
int bSubsampled,
int nHorSubsampling, int nVerSubsampling,
int nOverviews, int * panOvList,
int nBitsPerPixel,
int nSamples, TIFFOvrCache ** papoRawBIs,
uint32 nSXOff, uint32 nSYOff,
unsigned char *pabySrcTile,
uint32 nBlockXSize, uint32 nBlockYSize,
int nSampleFormat, const char * pszResampling )
{
int iOverview, iSample;
for( iSample = 0; iSample < nSamples; iSample++ )
{
/*
* We have to read a tile/strip for each sample for
* PLANARCONFIG_SEPARATE. Otherwise, we just read all the samples
* at once when handling the first sample.
*/
if( nPlanarConfig == PLANARCONFIG_SEPARATE || iSample == 0 )
{
if( TIFFIsTiled(hTIFF) )
{
TIFFReadEncodedTile( hTIFF,
TIFFComputeTile(hTIFF, nSXOff, nSYOff,
0, (tsample_t)iSample ),
pabySrcTile,
TIFFTileSize(hTIFF));
}
else
{
TIFFReadEncodedStrip( hTIFF,
TIFFComputeStrip(hTIFF, nSYOff,
(tsample_t) iSample),
pabySrcTile,
TIFFStripSize(hTIFF) );
}
}
/*
* Loop over destination overview layers
*/
for( iOverview = 0; iOverview < nOverviews; iOverview++ )
{
TIFFOvrCache *poRBI = papoRawBIs[iOverview];
unsigned char *pabyOTile;
uint32 nTXOff, nTYOff, nOXOff, nOYOff, nOMult;
uint32 nOBlockXSize = poRBI->nBlockXSize;
uint32 nOBlockYSize = poRBI->nBlockYSize;
int nSkewBits, nSampleByteOffset;
/*
* Fetch the destination overview tile
*/
nOMult = panOvList[iOverview];
nOXOff = (nSXOff/nOMult) / nOBlockXSize;
nOYOff = (nSYOff/nOMult) / nOBlockYSize;
if( bSubsampled )
{
pabyOTile = TIFFGetOvrBlock_Subsampled( poRBI, nOXOff, nOYOff );
/*
* Establish the offset into this tile at which we should
* start placing data.
*/
nTXOff = (nSXOff - nOXOff*nOMult*nOBlockXSize) / nOMult;
nTYOff = (nSYOff - nOYOff*nOMult*nOBlockYSize) / nOMult;
#ifdef DBMALLOC
malloc_chain_check( 1 );
#endif
TIFF_DownSample_Subsampled( pabySrcTile, iSample,
nBlockXSize, nBlockYSize,
pabyOTile,
poRBI->nBlockXSize, poRBI->nBlockYSize,
nTXOff, nTYOff,
nOMult, pszResampling,
nHorSubsampling, nVerSubsampling );
#ifdef DBMALLOC
malloc_chain_check( 1 );
#endif
}
else
{
pabyOTile = TIFFGetOvrBlock( poRBI, nOXOff, nOYOff, iSample );
/*
* Establish the offset into this tile at which we should
* start placing data.
*/
nTXOff = (nSXOff - nOXOff*nOMult*nOBlockXSize) / nOMult;
nTYOff = (nSYOff - nOYOff*nOMult*nOBlockYSize) / nOMult;
/*
* Figure out the skew (extra space between ``our samples'') and
* the byte offset to the first sample.
*/
assert( (nBitsPerPixel % 8) == 0 );
if( nPlanarConfig == PLANARCONFIG_SEPARATE )
{
nSkewBits = 0;
nSampleByteOffset = 0;
}
else
{
nSkewBits = nBitsPerPixel * (nSamples-1);
nSampleByteOffset = (nBitsPerPixel/8) * iSample;
}
/*
* Perform the downsampling.
*/
#ifdef DBMALLOC
malloc_chain_check( 1 );
#endif
TIFF_DownSample( pabySrcTile + nSampleByteOffset,
nBlockXSize, nBlockYSize,
nSkewBits, nBitsPerPixel, pabyOTile,
poRBI->nBlockXSize, poRBI->nBlockYSize,
nTXOff, nTYOff,
nOMult, nSampleFormat, pszResampling );
#ifdef DBMALLOC
malloc_chain_check( 1 );
#endif
}
}
}
}
/************************************************************************/
/* TIFF_BuildOverviews() */
/* */
/* Build the requested list of overviews. Overviews are */
/* maintained in a bunch of temporary files and then these are */
/* written back to the TIFF file. Only one pass through the */
/* source TIFF file is made for any number of output */
/* overviews. */
/************************************************************************/
void TIFFBuildOverviews( TIFF *hTIFF, int nOverviews, int * panOvList,
int bUseSubIFDs, const char *pszResampleMethod,
int (*pfnProgress)( double, void * ),
void * pProgressData )
{
TIFFOvrCache **papoRawBIs;
uint32 nXSize, nYSize, nBlockXSize, nBlockYSize;
uint16 nBitsPerPixel, nPhotometric, nCompressFlag, nSamples,
nPlanarConfig, nSampleFormat;
int bSubsampled;
uint16 nHorSubsampling, nVerSubsampling;
int bTiled, nSXOff, nSYOff, i;
unsigned char *pabySrcTile;
uint16 *panRedMap, *panGreenMap, *panBlueMap;
TIFFErrorHandler pfnWarning;
(void) pfnProgress;
(void) pProgressData;
/* -------------------------------------------------------------------- */
/* Get the base raster size. */
/* -------------------------------------------------------------------- */
TIFFGetField( hTIFF, TIFFTAG_IMAGEWIDTH, &nXSize );
TIFFGetField( hTIFF, TIFFTAG_IMAGELENGTH, &nYSize );
TIFFGetField( hTIFF, TIFFTAG_BITSPERSAMPLE, &nBitsPerPixel );
/* TODO: nBitsPerPixel seems misnomer and may need renaming to nBitsPerSample */
TIFFGetField( hTIFF, TIFFTAG_SAMPLESPERPIXEL, &nSamples );
TIFFGetFieldDefaulted( hTIFF, TIFFTAG_PLANARCONFIG, &nPlanarConfig );
TIFFGetFieldDefaulted( hTIFF, TIFFTAG_PHOTOMETRIC, &nPhotometric );
TIFFGetFieldDefaulted( hTIFF, TIFFTAG_COMPRESSION, &nCompressFlag );
TIFFGetFieldDefaulted( hTIFF, TIFFTAG_SAMPLEFORMAT, &nSampleFormat );
if( nPhotometric == PHOTOMETRIC_YCBCR || nPhotometric == PHOTOMETRIC_ITULAB )
{
if( nBitsPerPixel != 8 || nSamples != 3 || nPlanarConfig != PLANARCONFIG_CONTIG ||
nSampleFormat != SAMPLEFORMAT_UINT)
{
/* TODO: use of TIFFError is inconsistent with use of fprintf in addtiffo.c, sort out */
TIFFErrorExt( TIFFClientdata(hTIFF), "TIFFBuildOverviews",
"File `%s' has an unsupported subsampling configuration.\n",
TIFFFileName(hTIFF) );
/* If you need support for this particular flavor, please contact either
* Frank Warmerdam warmerdam@pobox.com
* Joris Van Damme info@awaresystems.be
*/
return;
}
bSubsampled = 1;
TIFFGetField( hTIFF, TIFFTAG_YCBCRSUBSAMPLING, &nHorSubsampling, &nVerSubsampling );
/* TODO: find out if maybe TIFFGetFieldDefaulted is better choice for YCbCrSubsampling tag */
}
else
{
if( nBitsPerPixel < 8 )
{
/* TODO: use of TIFFError is inconsistent with use of fprintf in addtiffo.c, sort out */
TIFFErrorExt( TIFFClientdata(hTIFF), "TIFFBuildOverviews",
"File `%s' has samples of %d bits per sample. Sample\n"
"sizes of less than 8 bits per sample are not supported.\n",
TIFFFileName(hTIFF), nBitsPerPixel );
return;
}
bSubsampled = 0;
nHorSubsampling = 1;
nVerSubsampling = 1;
}
/* -------------------------------------------------------------------- */
/* Turn off warnings to avoid alot of repeated warnings while */
/* rereading directories. */
/* -------------------------------------------------------------------- */
pfnWarning = TIFFSetWarningHandler( NULL );
/* -------------------------------------------------------------------- */
/* Get the base raster block size. */
/* -------------------------------------------------------------------- */
if( TIFFGetField( hTIFF, TIFFTAG_ROWSPERSTRIP, &(nBlockYSize) ) )
{
nBlockXSize = nXSize;
bTiled = FALSE;
}
else
{
TIFFGetField( hTIFF, TIFFTAG_TILEWIDTH, &nBlockXSize );
TIFFGetField( hTIFF, TIFFTAG_TILELENGTH, &nBlockYSize );
bTiled = TRUE;
}
/* -------------------------------------------------------------------- */
/* Capture the pallette if there is one. */
/* -------------------------------------------------------------------- */
if( TIFFGetField( hTIFF, TIFFTAG_COLORMAP,
&panRedMap, &panGreenMap, &panBlueMap ) )
{
uint16 *panRed2, *panGreen2, *panBlue2;
int nColorCount = 1 << nBitsPerPixel;
panRed2 = (uint16 *) _TIFFmalloc(2*nColorCount);
panGreen2 = (uint16 *) _TIFFmalloc(2*nColorCount);
panBlue2 = (uint16 *) _TIFFmalloc(2*nColorCount);
memcpy( panRed2, panRedMap, 2 * nColorCount );
memcpy( panGreen2, panGreenMap, 2 * nColorCount );
memcpy( panBlue2, panBlueMap, 2 * nColorCount );
panRedMap = panRed2;
panGreenMap = panGreen2;
panBlueMap = panBlue2;
}
else
{
panRedMap = panGreenMap = panBlueMap = NULL;
}
/* -------------------------------------------------------------------- */
/* Initialize overviews. */
/* -------------------------------------------------------------------- */
papoRawBIs = (TIFFOvrCache **) _TIFFmalloc(nOverviews*sizeof(void*));
for( i = 0; i < nOverviews; i++ )
{
uint32 nOXSize, nOYSize, nOBlockXSize, nOBlockYSize;
toff_t nDirOffset;
nOXSize = (nXSize + panOvList[i] - 1) / panOvList[i];
nOYSize = (nYSize + panOvList[i] - 1) / panOvList[i];
nOBlockXSize = MIN(nBlockXSize,nOXSize);
nOBlockYSize = MIN(nBlockYSize,nOYSize);
if( bTiled )
{
if( (nOBlockXSize % 16) != 0 )
nOBlockXSize = nOBlockXSize + 16 - (nOBlockXSize % 16);
if( (nOBlockYSize % 16) != 0 )
nOBlockYSize = nOBlockYSize + 16 - (nOBlockYSize % 16);
}
nDirOffset = TIFF_WriteOverview( hTIFF, nOXSize, nOYSize,
nBitsPerPixel, nPlanarConfig,
nSamples, nOBlockXSize, nOBlockYSize,
bTiled, nCompressFlag, nPhotometric,
nSampleFormat,
panRedMap, panGreenMap, panBlueMap,
bUseSubIFDs,
nHorSubsampling, nVerSubsampling );
papoRawBIs[i] = TIFFCreateOvrCache( hTIFF, nDirOffset );
}
if( panRedMap != NULL )
{
_TIFFfree( panRedMap );
_TIFFfree( panGreenMap );
_TIFFfree( panBlueMap );
}
/* -------------------------------------------------------------------- */
/* Allocate a buffer to hold a source block. */
/* -------------------------------------------------------------------- */
if( bTiled )
pabySrcTile = (unsigned char *) _TIFFmalloc(TIFFTileSize(hTIFF));
else
pabySrcTile = (unsigned char *) _TIFFmalloc(TIFFStripSize(hTIFF));
/* -------------------------------------------------------------------- */
/* Loop over the source raster, applying data to the */
/* destination raster. */
/* -------------------------------------------------------------------- */
for( nSYOff = 0; nSYOff < (int) nYSize; nSYOff += nBlockYSize )
{
for( nSXOff = 0; nSXOff < (int) nXSize; nSXOff += nBlockXSize )
{
/*
* Read and resample into the various overview images.
*/
TIFF_ProcessFullResBlock( hTIFF, nPlanarConfig,
bSubsampled,nHorSubsampling,nVerSubsampling,
nOverviews, panOvList,
nBitsPerPixel, nSamples, papoRawBIs,
nSXOff, nSYOff, pabySrcTile,
nBlockXSize, nBlockYSize,
nSampleFormat, pszResampleMethod );
}
}
_TIFFfree( pabySrcTile );
/* -------------------------------------------------------------------- */
/* Cleanup the rawblockedimage files. */
/* -------------------------------------------------------------------- */
for( i = 0; i < nOverviews; i++ )
{
TIFFDestroyOvrCache( papoRawBIs[i] );
}
if( papoRawBIs != NULL )
_TIFFfree( papoRawBIs );
TIFFSetWarningHandler( pfnWarning );
}
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/

View File

@ -1,341 +0,0 @@
/******************************************************************************
* $Id: tif_ovrcache.c,v 1.9 2010-06-08 18:55:15 bfriesen Exp $
*
* Project: TIFF Overview Builder
* Purpose: Library functions to maintain two rows of tiles or two strips
* of data for output overviews as an output cache.
* Author: Frank Warmerdam, warmerdam@pobox.com
*
******************************************************************************
* Copyright (c) 2000, Frank Warmerdam
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
******************************************************************************
*/
#include "tiffiop.h"
#include "tif_ovrcache.h"
#include <assert.h>
/************************************************************************/
/* TIFFCreateOvrCache() */
/* */
/* Create an overview cache to hold two rows of blocks from an */
/* existing TIFF directory. */
/************************************************************************/
TIFFOvrCache *TIFFCreateOvrCache( TIFF *hTIFF, toff_t nDirOffset )
{
TIFFOvrCache *psCache;
toff_t nBaseDirOffset;
psCache = (TIFFOvrCache *) _TIFFmalloc(sizeof(TIFFOvrCache));
psCache->nDirOffset = nDirOffset;
psCache->hTIFF = hTIFF;
/* -------------------------------------------------------------------- */
/* Get definition of this raster from the TIFF file itself. */
/* -------------------------------------------------------------------- */
nBaseDirOffset = TIFFCurrentDirOffset( psCache->hTIFF );
TIFFSetSubDirectory( hTIFF, nDirOffset );
TIFFGetField( hTIFF, TIFFTAG_IMAGEWIDTH, &(psCache->nXSize) );
TIFFGetField( hTIFF, TIFFTAG_IMAGELENGTH, &(psCache->nYSize) );
TIFFGetField( hTIFF, TIFFTAG_BITSPERSAMPLE, &(psCache->nBitsPerPixel) );
TIFFGetField( hTIFF, TIFFTAG_SAMPLESPERPIXEL, &(psCache->nSamples) );
TIFFGetField( hTIFF, TIFFTAG_PLANARCONFIG, &(psCache->nPlanarConfig) );
if( !TIFFIsTiled( hTIFF ) )
{
TIFFGetField( hTIFF, TIFFTAG_ROWSPERSTRIP, &(psCache->nBlockYSize) );
psCache->nBlockXSize = psCache->nXSize;
psCache->nBytesPerBlock = TIFFStripSize(hTIFF);
psCache->bTiled = FALSE;
}
else
{
TIFFGetField( hTIFF, TIFFTAG_TILEWIDTH, &(psCache->nBlockXSize) );
TIFFGetField( hTIFF, TIFFTAG_TILELENGTH, &(psCache->nBlockYSize) );
psCache->nBytesPerBlock = TIFFTileSize(hTIFF);
psCache->bTiled = TRUE;
}
/* -------------------------------------------------------------------- */
/* Compute some values from this. */
/* -------------------------------------------------------------------- */
psCache->nBlocksPerRow = (psCache->nXSize + psCache->nBlockXSize - 1)
/ psCache->nBlockXSize;
psCache->nBlocksPerColumn = (psCache->nYSize + psCache->nBlockYSize - 1)
/ psCache->nBlockYSize;
if (psCache->nPlanarConfig == PLANARCONFIG_SEPARATE)
psCache->nBytesPerRow = psCache->nBytesPerBlock
* psCache->nBlocksPerRow * psCache->nSamples;
else
psCache->nBytesPerRow =
psCache->nBytesPerBlock * psCache->nBlocksPerRow;
/* -------------------------------------------------------------------- */
/* Allocate and initialize the data buffers. */
/* -------------------------------------------------------------------- */
psCache->pabyRow1Blocks =
(unsigned char *) _TIFFmalloc(psCache->nBytesPerRow);
psCache->pabyRow2Blocks =
(unsigned char *) _TIFFmalloc(psCache->nBytesPerRow);
if( psCache->pabyRow1Blocks == NULL
|| psCache->pabyRow2Blocks == NULL )
{
TIFFErrorExt( hTIFF->tif_clientdata, hTIFF->tif_name,
"Can't allocate memory for overview cache." );
/* TODO: use of TIFFError is inconsistent with use of fprintf in addtiffo.c, sort out */
return NULL;
}
_TIFFmemset( psCache->pabyRow1Blocks, 0, psCache->nBytesPerRow );
_TIFFmemset( psCache->pabyRow2Blocks, 0, psCache->nBytesPerRow );
psCache->nBlockOffset = 0;
TIFFSetSubDirectory( psCache->hTIFF, nBaseDirOffset );
return psCache;
}
/************************************************************************/
/* TIFFWriteOvrRow() */
/* */
/* Write one entire row of blocks (row 1) to the tiff file, and */
/* then rotate the block buffers, essentially moving things */
/* down by one block. */
/************************************************************************/
static void TIFFWriteOvrRow( TIFFOvrCache * psCache )
{
int nRet, iTileX, iTileY = psCache->nBlockOffset;
unsigned char *pabyData;
toff_t nBaseDirOffset;
uint32 RowsInStrip;
/* -------------------------------------------------------------------- */
/* If the output cache is multi-byte per sample, and the file */
/* being written to is of a different byte order than the current */
/* platform, we will need to byte swap the data. */
/* -------------------------------------------------------------------- */
if( TIFFIsByteSwapped(psCache->hTIFF) )
{
if( psCache->nBitsPerPixel == 16 )
TIFFSwabArrayOfShort( (uint16 *) psCache->pabyRow1Blocks,
(psCache->nBytesPerBlock * psCache->nSamples) / 2 );
else if( psCache->nBitsPerPixel == 32 )
TIFFSwabArrayOfLong( (uint32 *) psCache->pabyRow1Blocks,
(psCache->nBytesPerBlock * psCache->nSamples) / 4 );
else if( psCache->nBitsPerPixel == 64 )
TIFFSwabArrayOfDouble( (double *) psCache->pabyRow1Blocks,
(psCache->nBytesPerBlock * psCache->nSamples) / 8 );
}
/* -------------------------------------------------------------------- */
/* Record original directory position, so we can restore it at */
/* end. */
/* -------------------------------------------------------------------- */
nBaseDirOffset = TIFFCurrentDirOffset( psCache->hTIFF );
nRet = TIFFSetSubDirectory( psCache->hTIFF, psCache->nDirOffset );
assert( nRet == 1 );
/* -------------------------------------------------------------------- */
/* Write blocks to TIFF file. */
/* -------------------------------------------------------------------- */
for( iTileX = 0; iTileX < psCache->nBlocksPerRow; iTileX++ )
{
int nTileID;
if (psCache->nPlanarConfig == PLANARCONFIG_SEPARATE)
{
int iSample;
for( iSample = 0; iSample < psCache->nSamples; iSample++ )
{
pabyData = TIFFGetOvrBlock( psCache, iTileX, iTileY, iSample );
if( psCache->bTiled )
{
nTileID = TIFFComputeTile( psCache->hTIFF,
iTileX * psCache->nBlockXSize,
iTileY * psCache->nBlockYSize,
0, (tsample_t) iSample );
TIFFWriteEncodedTile( psCache->hTIFF, nTileID,
pabyData,
TIFFTileSize(psCache->hTIFF) );
}
else
{
nTileID = TIFFComputeStrip( psCache->hTIFF,
iTileY * psCache->nBlockYSize,
(tsample_t) iSample );
RowsInStrip=psCache->nBlockYSize;
if ((iTileY+1)*psCache->nBlockYSize>psCache->nYSize)
RowsInStrip=psCache->nYSize-iTileY*psCache->nBlockYSize;
TIFFWriteEncodedStrip( psCache->hTIFF, nTileID,
pabyData,
TIFFVStripSize(psCache->hTIFF,RowsInStrip) );
}
}
}
else
{
pabyData = TIFFGetOvrBlock( psCache, iTileX, iTileY, 0 );
if( psCache->bTiled )
{
nTileID = TIFFComputeTile( psCache->hTIFF,
iTileX * psCache->nBlockXSize,
iTileY * psCache->nBlockYSize,
0, 0 );
TIFFWriteEncodedTile( psCache->hTIFF, nTileID,
pabyData,
TIFFTileSize(psCache->hTIFF) );
}
else
{
nTileID = TIFFComputeStrip( psCache->hTIFF,
iTileY * psCache->nBlockYSize,
0 );
RowsInStrip=psCache->nBlockYSize;
if ((iTileY+1)*psCache->nBlockYSize>psCache->nYSize)
RowsInStrip=psCache->nYSize-iTileY*psCache->nBlockYSize;
TIFFWriteEncodedStrip( psCache->hTIFF, nTileID,
pabyData,
TIFFVStripSize(psCache->hTIFF,RowsInStrip) );
}
}
}
/* TODO: add checks on error status return of TIFFWriteEncodedTile and TIFFWriteEncodedStrip */
/* -------------------------------------------------------------------- */
/* Rotate buffers. */
/* -------------------------------------------------------------------- */
pabyData = psCache->pabyRow1Blocks;
psCache->pabyRow1Blocks = psCache->pabyRow2Blocks;
psCache->pabyRow2Blocks = pabyData;
_TIFFmemset( pabyData, 0, psCache->nBytesPerRow );
psCache->nBlockOffset++;
/* -------------------------------------------------------------------- */
/* Restore access to original directory. */
/* -------------------------------------------------------------------- */
TIFFFlush( psCache->hTIFF );
/* TODO: add checks on error status return of TIFFFlush */
TIFFSetSubDirectory( psCache->hTIFF, nBaseDirOffset );
/* TODO: add checks on error status return of TIFFSetSubDirectory */
}
/************************************************************************/
/* TIFFGetOvrBlock() */
/************************************************************************/
/* TODO: make TIFF_Downsample handle iSample offset, so that we can
* do with a single TIFFGetOvrBlock and no longer need TIFFGetOvrBlock_Subsampled */
unsigned char *TIFFGetOvrBlock( TIFFOvrCache *psCache, int iTileX, int iTileY,
int iSample )
{
int nRowOffset;
if( iTileY > psCache->nBlockOffset + 1 )
TIFFWriteOvrRow( psCache );
assert( iTileX >= 0 && iTileX < psCache->nBlocksPerRow );
assert( iTileY >= 0 && iTileY < psCache->nBlocksPerColumn );
assert( iTileY >= psCache->nBlockOffset
&& iTileY < psCache->nBlockOffset+2 );
assert( iSample >= 0 && iSample < psCache->nSamples );
if (psCache->nPlanarConfig == PLANARCONFIG_SEPARATE)
nRowOffset = ((iTileX * psCache->nSamples) + iSample)
* psCache->nBytesPerBlock;
else
nRowOffset = iTileX * psCache->nBytesPerBlock +
(psCache->nBitsPerPixel + 7) / 8 * iSample;
if( iTileY == psCache->nBlockOffset )
return psCache->pabyRow1Blocks + nRowOffset;
else
return psCache->pabyRow2Blocks + nRowOffset;
}
/************************************************************************/
/* TIFFGetOvrBlock_Subsampled() */
/************************************************************************/
unsigned char *TIFFGetOvrBlock_Subsampled( TIFFOvrCache *psCache,
int iTileX, int iTileY )
{
int nRowOffset;
if( iTileY > psCache->nBlockOffset + 1 )
TIFFWriteOvrRow( psCache );
assert( iTileX >= 0 && iTileX < psCache->nBlocksPerRow );
assert( iTileY >= 0 && iTileY < psCache->nBlocksPerColumn );
assert( iTileY >= psCache->nBlockOffset
&& iTileY < psCache->nBlockOffset+2 );
assert( psCache->nPlanarConfig != PLANARCONFIG_SEPARATE );
nRowOffset = iTileX * psCache->nBytesPerBlock;
if( iTileY == psCache->nBlockOffset )
return psCache->pabyRow1Blocks + nRowOffset;
else
return psCache->pabyRow2Blocks + nRowOffset;
}
/************************************************************************/
/* TIFFDestroyOvrCache() */
/************************************************************************/
void TIFFDestroyOvrCache( TIFFOvrCache * psCache )
{
while( psCache->nBlockOffset < psCache->nBlocksPerColumn )
TIFFWriteOvrRow( psCache );
_TIFFfree( psCache->pabyRow1Blocks );
_TIFFfree( psCache->pabyRow2Blocks );
_TIFFfree( psCache );
}
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/

View File

@ -1,103 +0,0 @@
/******************************************************************************
* tif_ovrcache.h,v 1.3 2005/05/25 09:03:16 dron Exp
*
* Project: TIFF Overview Builder
* Purpose: Library functions to maintain two rows of tiles or two strips
* of data for output overviews as an output cache.
* Author: Frank Warmerdam, warmerdam@pobox.com
*
* This code could potentially be used by other applications wanting to
* manage a once-through write cache.
*
******************************************************************************
* Copyright (c) 2000, Frank Warmerdam
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
******************************************************************************
*/
#ifndef TIF_OVRCACHE_H_INCLUDED
#define TIF_OVRCACHE_H_INCLUDED
#include "tiffio.h"
#if defined(__cplusplus)
extern "C" {
#endif
typedef struct
{
uint32 nXSize;
uint32 nYSize;
uint16 nBitsPerPixel;
uint16 nSamples;
uint16 nPlanarConfig;
uint32 nBlockXSize;
uint32 nBlockYSize;
toff_t nBytesPerBlock;
toff_t nBytesPerRow;
int nBlocksPerRow;
int nBlocksPerColumn;
int nBlockOffset; /* what block is the first in papabyBlocks? */
unsigned char *pabyRow1Blocks;
unsigned char *pabyRow2Blocks;
toff_t nDirOffset;
TIFF *hTIFF;
int bTiled;
} TIFFOvrCache;
TIFFOvrCache *TIFFCreateOvrCache( TIFF *hTIFF, toff_t nDirOffset );
unsigned char *TIFFGetOvrBlock( TIFFOvrCache *psCache, int iTileX, int iTileY,
int iSample );
unsigned char *TIFFGetOvrBlock_Subsampled( TIFFOvrCache *psCache, int iTileX, int iTileY );
void TIFFDestroyOvrCache( TIFFOvrCache * );
void TIFFBuildOverviews( TIFF *, int, int *, int, const char *,
int (*)(double,void*), void * );
void TIFF_ProcessFullResBlock( TIFF *, int, int, int, int, int, int *, int,
int, TIFFOvrCache **, uint32, uint32,
unsigned char *, uint32, uint32,
int, const char * );
uint32 TIFF_WriteOverview( TIFF *, uint32, uint32, int, int, int, int, int,
int, int, int, int, unsigned short *,
unsigned short *, unsigned short *, int,
int, int);
#if defined(__cplusplus)
}
#endif
#endif /* ndef TIF_OVRCACHE_H_INCLUDED */
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/

View File

@ -1,44 +0,0 @@
# Tag Image File Format (TIFF) Software
#
# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# Process this file with automake to produce Makefile.in.
SUBDIRS = xtiff
LIBTIFF = $(top_builddir)/libtiff/libtiff.la
EXTRA_DIST = README
noinst_PROGRAMS = tiff-bi tiff-grayscale tiff-palette tiff-rgb
tiff_bi_SOURCES = tiff-bi.c
tiff_bi_LDADD = $(LIBTIFF)
tiff_grayscale_SOURCES = tiff-grayscale.c
tiff_grayscale_LDADD = $(LIBTIFF)
tiff_palette_SOURCES = tiff-palette.c
tiff_palette_LDADD = $(LIBTIFF)
tiff_rgb_SOURCES = tiff-rgb.c
tiff_rgb_LDADD = $(LIBTIFF)
AM_CPPFLAGS = -I$(top_srcdir)/libtiff

View File

@ -1,7 +0,0 @@
Wed May 9 09:11:35 PDT 1990
This directory contains programs from Dan Sears
(dbs@decwrl.dec.com). Contact him directly if
you have questions/problems.
Sam

View File

@ -1,91 +0,0 @@
/* $Id: tiff-bi.c,v 1.3 2010-06-08 18:55:15 bfriesen Exp $ */
/*
* tiff-bi.c -- create a Class B (bilevel) TIFF file
*
* Copyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* both that copyright notice and this permission notice appear in
* supporting documentation, and that the name of Digital not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
#include <stdio.h>
#include <stdlib.h>
#include "tiffio.h"
#define WIDTH 512
#define HEIGHT WIDTH
int main(int argc, char **argv)
{
int i;
unsigned char * scan_line;
TIFF * tif;
if (argc != 2) {
fprintf(stderr, "Usage: %s tiff-image\n", argv[0]);
return 0;
}
if ((tif = TIFFOpen(argv[1], "w")) == NULL) {
fprintf(stderr, "can't open %s as a TIFF file\n", argv[1]);
return 0;
}
TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, WIDTH);
TIFFSetField(tif, TIFFTAG_IMAGELENGTH, HEIGHT);
TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 1);
TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);
TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1);
TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, 1);
TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
TIFFSetField(tif, TIFFTAG_RESOLUTIONUNIT, RESUNIT_NONE);
scan_line = (unsigned char *) malloc(WIDTH / 8);
for (i = 0; i < (WIDTH / 8) / 2; i++)
scan_line[i] = 0;
for (i = (WIDTH / 8) / 2; i < (WIDTH / 8); i++)
scan_line[i] = 255;
for (i = 0; i < HEIGHT / 2; i++)
TIFFWriteScanline(tif, scan_line, i, 0);
for (i = 0; i < (WIDTH / 8) / 2; i++)
scan_line[i] = 255;
for (i = (WIDTH / 8) / 2; i < (WIDTH / 8); i++)
scan_line[i] = 0;
for (i = HEIGHT / 2; i < HEIGHT; i++)
TIFFWriteScanline(tif, scan_line, i, 0);
free(scan_line);
TIFFClose(tif);
return 0;
}
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/

View File

@ -1,147 +0,0 @@
/* $Id: tiff-grayscale.c,v 1.6 2010-06-08 18:55:15 bfriesen Exp $ */
/*
* tiff-grayscale.c -- create a Class G (grayscale) TIFF file
* with a gray response curve in linear optical density
*
* Copyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* both that copyright notice and this permission notice appear in
* supporting documentation, and that the name of Digital not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "tiffio.h"
#define WIDTH 512
#define HEIGHT WIDTH
char * programName;
void Usage();
int main(int argc, char **argv)
{
int bits_per_pixel = 8, cmsize, i, j, k,
gray_index, chunk_size = 32, nchunks = 16;
unsigned char * scan_line;
uint16 * gray;
float refblackwhite[2*1];
TIFF * tif;
programName = argv[0];
if (argc != 4)
Usage();
if (!strcmp(argv[1], "-depth"))
bits_per_pixel = atoi(argv[2]);
else
Usage();
switch (bits_per_pixel) {
case 8:
nchunks = 16;
chunk_size = 32;
break;
case 4:
nchunks = 4;
chunk_size = 128;
break;
case 2:
nchunks = 2;
chunk_size = 256;
break;
default:
Usage();
}
cmsize = nchunks * nchunks;
gray = (uint16 *) malloc(cmsize * sizeof(uint16));
gray[0] = 3000;
for (i = 1; i < cmsize; i++)
gray[i] = (uint16) (-log10((double) i / (cmsize - 1)) * 1000);
refblackwhite[0] = 0.0;
refblackwhite[1] = (float)((1L<<bits_per_pixel) - 1);
if ((tif = TIFFOpen(argv[3], "w")) == NULL) {
fprintf(stderr, "can't open %s as a TIFF file\n", argv[3]);
free(gray);
return 0;
}
TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, WIDTH);
TIFFSetField(tif, TIFFTAG_IMAGELENGTH, HEIGHT);
TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, bits_per_pixel);
TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);
TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1);
TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, 1);
TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
TIFFSetField(tif, TIFFTAG_REFERENCEBLACKWHITE, refblackwhite);
TIFFSetField(tif, TIFFTAG_TRANSFERFUNCTION, gray);
TIFFSetField(tif, TIFFTAG_RESOLUTIONUNIT, RESUNIT_NONE);
scan_line = (unsigned char *) malloc(WIDTH / (8 / bits_per_pixel));
for (i = 0; i < HEIGHT; i++) {
for (j = 0, k = 0; j < WIDTH;) {
gray_index = (j / chunk_size) + ((i / chunk_size) * nchunks);
switch (bits_per_pixel) {
case 8:
scan_line[k++] = gray_index;
j++;
break;
case 4:
scan_line[k++] = (gray_index << 4) + gray_index;
j += 2;
break;
case 2:
scan_line[k++] = (gray_index << 6) + (gray_index << 4)
+ (gray_index << 2) + gray_index;
j += 4;
break;
}
}
TIFFWriteScanline(tif, scan_line, i, 0);
}
free(scan_line);
TIFFClose(tif);
return 0;
}
void
Usage()
{
fprintf(stderr, "Usage: %s -depth (8 | 4 | 2) tiff-image\n", programName);
exit(0);
}
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/

View File

@ -1,284 +0,0 @@
/* $Id: tiff-palette.c,v 1.5 2010-06-08 18:55:15 bfriesen Exp $ */
/*
* tiff-palette.c -- create a Class P (palette) TIFF file
*
* Copyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* both that copyright notice and this permission notice appear in
* supporting documentation, and that the name of Digital not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "tiffio.h"
#define WIDTH 512
#define HEIGHT WIDTH
#define SCALE(x) ((x) * 257L)
char * programName;
void Usage();
int main(int argc, char **argv)
{
int bits_per_pixel = 8, cmsize, i, j, k,
cmap_index, chunk_size = 32, nchunks = 16;
unsigned char * scan_line;
uint16 *red, *green, *blue;
TIFF * tif;
programName = argv[0];
if (argc != 4)
Usage();
if (!strcmp(argv[1], "-depth"))
bits_per_pixel = atoi(argv[2]);
else
Usage();
switch (bits_per_pixel) {
case 8:
nchunks = 16;
chunk_size = 32;
break;
case 4:
nchunks = 4;
chunk_size = 128;
break;
case 2:
nchunks = 2;
chunk_size = 256;
break;
case 1:
nchunks = 2;
chunk_size = 256;
break;
default:
Usage();
}
if (bits_per_pixel != 1) {
cmsize = nchunks * nchunks;
} else {
cmsize = 2;
}
red = (uint16 *) malloc(cmsize * sizeof(uint16));
green = (uint16 *) malloc(cmsize * sizeof(uint16));
blue = (uint16 *) malloc(cmsize * sizeof(uint16));
switch (bits_per_pixel) {
case 8:
for (i = 0; i < cmsize; i++) {
if (i < 32)
red[i] = 0;
else if (i < 64)
red[i] = SCALE(36);
else if (i < 96)
red[i] = SCALE(73);
else if (i < 128)
red[i] = SCALE(109);
else if (i < 160)
red[i] = SCALE(146);
else if (i < 192)
red[i] = SCALE(182);
else if (i < 224)
red[i] = SCALE(219);
else if (i < 256)
red[i] = SCALE(255);
if ((i % 32) < 4)
green[i] = 0;
else if (i < 8)
green[i] = SCALE(36);
else if ((i % 32) < 12)
green[i] = SCALE(73);
else if ((i % 32) < 16)
green[i] = SCALE(109);
else if ((i % 32) < 20)
green[i] = SCALE(146);
else if ((i % 32) < 24)
green[i] = SCALE(182);
else if ((i % 32) < 28)
green[i] = SCALE(219);
else if ((i % 32) < 32)
green[i] = SCALE(255);
if ((i % 4) == 0)
blue[i] = SCALE(0);
else if ((i % 4) == 1)
blue[i] = SCALE(85);
else if ((i % 4) == 2)
blue[i] = SCALE(170);
else if ((i % 4) == 3)
blue[i] = SCALE(255);
}
break;
case 4:
red[0] = SCALE(255);
green[0] = 0;
blue[0] = 0;
red[1] = 0;
green[1] = SCALE(255);
blue[1] = 0;
red[2] = 0;
green[2] = 0;
blue[2] = SCALE(255);
red[3] = SCALE(255);
green[3] = SCALE(255);
blue[3] = SCALE(255);
red[4] = 0;
green[4] = SCALE(255);
blue[4] = SCALE(255);
red[5] = SCALE(255);
green[5] = 0;
blue[5] = SCALE(255);
red[6] = SCALE(255);
green[6] = SCALE(255);
blue[6] = 0;
red[7] = 0;
green[7] = 0;
blue[7] = 0;
red[8] = SCALE(176);
green[8] = SCALE(224);
blue[8] = SCALE(230);
red[9] = SCALE(100);
green[9] = SCALE(149);
blue[9] = SCALE(237);
red[10] = SCALE(46);
green[10] = SCALE(139);
blue[10] = SCALE(87);
red[11] = SCALE(160);
green[11] = SCALE(82);
blue[11] = SCALE(45);
red[12] = SCALE(238);
green[12] = SCALE(130);
blue[12] = SCALE(238);
red[13] = SCALE(176);
green[13] = SCALE(48);
blue[13] = SCALE(96);
red[14] = SCALE(50);
green[14] = SCALE(205);
blue[14] = SCALE(50);
red[15] = SCALE(240);
green[15] = SCALE(152);
blue[15] = SCALE(35);
break;
case 2:
red[0] = SCALE(255);
green[0] = 0;
blue[0] = 0;
red[1] = 0;
green[1] = SCALE(255);
blue[1] = 0;
red[2] = 0;
green[2] = 0;
blue[2] = SCALE(255);
red[3] = SCALE(255);
green[3] = SCALE(255);
blue[3] = SCALE(255);
break;
case 1:
red[0] = 0;
green[0] = 0;
blue[0] = 0;
red[1] = SCALE(255);
green[1] = SCALE(255);
blue[1] = SCALE(255);
break;
}
if ((tif = TIFFOpen(argv[3], "w")) == NULL) {
fprintf(stderr, "can't open %s as a TIFF file\n", argv[3]);
free(red);free(green);free(blue);
return 0;
}
TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, WIDTH);
TIFFSetField(tif, TIFFTAG_IMAGELENGTH, HEIGHT);
TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, bits_per_pixel);
TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_PALETTE);
TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1);
TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, 1);
TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
TIFFSetField(tif, TIFFTAG_RESOLUTIONUNIT, RESUNIT_NONE);
TIFFSetField(tif, TIFFTAG_COLORMAP, red, green, blue);
scan_line = (unsigned char *) malloc(WIDTH / (8 / bits_per_pixel));
for (i = 0; i < HEIGHT; i++) {
for (j = 0, k = 0; j < WIDTH;) {
cmap_index = (j / chunk_size) + ((i / chunk_size) * nchunks);
switch (bits_per_pixel) {
case 8:
scan_line[k++] = cmap_index;
j++;
break;
case 4:
scan_line[k++] = (cmap_index << 4) + cmap_index;
j += 2;
break;
case 2:
scan_line[k++] = (cmap_index << 6) + (cmap_index << 4)
+ (cmap_index << 2) + cmap_index;
j += 4;
break;
case 1:
scan_line[k++] =
((j / chunk_size) == (i / chunk_size)) ? 0x00 : 0xff;
j += 8;
break;
}
}
TIFFWriteScanline(tif, scan_line, i, 0);
}
free(scan_line);
TIFFClose(tif);
return 0;
}
void
Usage()
{
fprintf(stderr, "Usage: %s -depth (8 | 4 | 2 | 1) tiff-image\n", programName);
exit(0);
}
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/

View File

@ -1,201 +0,0 @@
/* $Id: tiff-rgb.c,v 1.4 2010-06-08 18:55:15 bfriesen Exp $ */
/*
* tiff-rgb.c -- create a 24-bit Class R (rgb) TIFF file
*
* Copyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* both that copyright notice and this permission notice appear in
* supporting documentation, and that the name of Digital not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
* ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "tiffio.h"
#define ROUND(x) (uint16) ((x) + 0.5)
#define CMSIZE 256
#define WIDTH 525
#define HEIGHT 512
#define TIFF_GAMMA 2.2
void Usage();
char * programName;
int main(int argc, char **argv)
{
char * input_file = NULL;
double image_gamma = TIFF_GAMMA;
int i, j;
TIFF * tif;
unsigned char * scan_line;
uint16 red[CMSIZE], green[CMSIZE], blue[CMSIZE];
float refblackwhite[2*3];
programName = argv[0];
switch (argc) {
case 2:
image_gamma = TIFF_GAMMA;
input_file = argv[1];
break;
case 4:
if (!strcmp(argv[1], "-gamma")) {
image_gamma = atof(argv[2]);
input_file = argv[3];
} else
Usage();
break;
default:
Usage();
}
for (i = 0; i < CMSIZE; i++) {
if (i == 0)
red[i] = green[i] = blue[i] = 0;
else {
red[i] = ROUND((pow(i / 255.0, 1.0 / image_gamma) * 65535.0));
green[i] = ROUND((pow(i / 255.0, 1.0 / image_gamma) * 65535.0));
blue[i] = ROUND((pow(i / 255.0, 1.0 / image_gamma) * 65535.0));
}
}
refblackwhite[0] = 0.0; refblackwhite[1] = 255.0;
refblackwhite[2] = 0.0; refblackwhite[3] = 255.0;
refblackwhite[4] = 0.0; refblackwhite[5] = 255.0;
if ((tif = TIFFOpen(input_file, "w")) == NULL) {
fprintf(stderr, "can't open %s as a TIFF file\n", input_file);
exit(0);
}
TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, WIDTH);
TIFFSetField(tif, TIFFTAG_IMAGELENGTH, HEIGHT);
TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8);
TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 3);
TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, 1);
TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
TIFFSetField(tif, TIFFTAG_RESOLUTIONUNIT, RESUNIT_NONE);
#ifdef notdef
TIFFSetField(tif, TIFFTAG_WHITEPOINT, whitex, whitey);
TIFFSetField(tif, TIFFTAG_PRIMARYCHROMATICITIES, primaries);
#endif
TIFFSetField(tif, TIFFTAG_REFERENCEBLACKWHITE, refblackwhite);
TIFFSetField(tif, TIFFTAG_TRANSFERFUNCTION, red, green, blue);
scan_line = (unsigned char *) malloc(WIDTH * 3);
for (i = 0; i < 255; i++) {
for (j = 0; j < 75; j++) {
scan_line[j * 3] = 255;
scan_line[(j * 3) + 1] = 255 - i;
scan_line[(j * 3) + 2] = 255 - i;
}
for (j = 75; j < 150; j++) {
scan_line[j * 3] = 255 - i;
scan_line[(j * 3) + 1] = 255;
scan_line[(j * 3) + 2] = 255 - i;
}
for (j = 150; j < 225; j++) {
scan_line[j * 3] = 255 - i;
scan_line[(j * 3) + 1] = 255 - i;
scan_line[(j * 3) + 2] = 255;
}
for (j = 225; j < 300; j++) {
scan_line[j * 3] = (i - 1) / 2;
scan_line[(j * 3) + 1] = (i - 1) / 2;
scan_line[(j * 3) + 2] = (i - 1) / 2;
}
for (j = 300; j < 375; j++) {
scan_line[j * 3] = 255 - i;
scan_line[(j * 3) + 1] = 255;
scan_line[(j * 3) + 2] = 255;
}
for (j = 375; j < 450; j++) {
scan_line[j * 3] = 255;
scan_line[(j * 3) + 1] = 255 - i;
scan_line[(j * 3) + 2] = 255;
}
for (j = 450; j < 525; j++) {
scan_line[j * 3] = 255;
scan_line[(j * 3) + 1] = 255;
scan_line[(j * 3) + 2] = 255 - i;
}
TIFFWriteScanline(tif, scan_line, i, 0);
}
for (i = 255; i < 512; i++) {
for (j = 0; j < 75; j++) {
scan_line[j * 3] = i;
scan_line[(j * 3) + 1] = 0;
scan_line[(j * 3) + 2] = 0;
}
for (j = 75; j < 150; j++) {
scan_line[j * 3] = 0;
scan_line[(j * 3) + 1] = i;
scan_line[(j * 3) + 2] = 0;
}
for (j = 150; j < 225; j++) {
scan_line[j * 3] = 0;
scan_line[(j * 3) + 1] = 0;
scan_line[(j * 3) + 2] = i;
}
for (j = 225; j < 300; j++) {
scan_line[j * 3] = (i - 1) / 2;
scan_line[(j * 3) + 1] = (i - 1) / 2;
scan_line[(j * 3) + 2] = (i - 1) / 2;
}
for (j = 300; j < 375; j++) {
scan_line[j * 3] = 0;
scan_line[(j * 3) + 1] = i;
scan_line[(j * 3) + 2] = i;
}
for (j = 375; j < 450; j++) {
scan_line[j * 3] = i;
scan_line[(j * 3) + 1] = 0;
scan_line[(j * 3) + 2] = i;
}
for (j = 450; j < 525; j++) {
scan_line[j * 3] = i;
scan_line[(j * 3) + 1] = i;
scan_line[(j * 3) + 2] = 0;
}
TIFFWriteScanline(tif, scan_line, i, 0);
}
free(scan_line);
TIFFClose(tif);
exit(0);
}
void
Usage()
{
fprintf(stderr, "Usage: %s -gamma gamma tiff-image\n", programName);
exit(0);
}
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/

View File

@ -1,42 +0,0 @@
#
# Tag Image File Format (TIFF) Software
#
# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# Process this file with automake to produce Makefile.in.
#LIBTIFF = $(top_builddir)/libtiff/libtiff.la
EXTRA_DIST = README patchlevel.h xtiff.c xtifficon.h
#noinst_PROGRAMS =
#if HAVE_XAW
#noinst_PROGRAMS += xtiff
#endif
#xtiff_SOURCES = patchlevel.h xtiff.c xtifficon.h
#xtiff_CFLAGS = $(CFLAGS) $(XAW_CFLAGS) $(AM_CFLAGS)
#xtiff_LDADD = $(LIBTIFF) $(X_LIBS) $(XAW_LIBS)
#INCLUDES = -I$(top_srcdir)/libtiff

View File

@ -1,6 +0,0 @@
xtiff 2.0
xtiff is a tool for viewing a TIFF file in an X window. It was written to
handle as many different kinds of TIFF files as possible while remaining
simple, portable and efficient. xtiff requires X11 R4, the Athena Widgets
and Sam Leffler's libtiff package (which can be found on ucbvax.berkeley.edu).

View File

@ -1,8 +0,0 @@
#define PATCHLEVEL 0
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/

File diff suppressed because it is too large Load Diff

View File

@ -1,21 +0,0 @@
#define xtifficon_width 32
#define xtifficon_height 32
static char xtifficon_bits[] = {
0xff, 0x00, 0x00, 0xc0, 0xfe, 0x01, 0x7e, 0xc0, 0xfc, 0x03, 0x7e, 0x60,
0xf8, 0x07, 0x06, 0x30, 0xf8, 0x07, 0x1e, 0x18, 0xf0, 0x0f, 0x1e, 0x0c,
0xe0, 0x1f, 0x06, 0x06, 0xc0, 0x3f, 0x06, 0x06, 0xc0, 0x3f, 0x06, 0x03,
0x80, 0x7f, 0x80, 0x01, 0x00, 0xff, 0xc0, 0x00, 0x00, 0xfe, 0x61, 0x00,
0x00, 0xfe, 0x31, 0x7e, 0x7e, 0xfc, 0x33, 0x7e, 0x7e, 0xf8, 0x1b, 0x06,
0x18, 0xf0, 0x0d, 0x1e, 0x18, 0xf0, 0x0e, 0x1e, 0x18, 0x60, 0x1f, 0x06,
0x18, 0xb0, 0x3f, 0x06, 0x18, 0x98, 0x7f, 0x06, 0x18, 0x98, 0x7f, 0x00,
0x00, 0x0c, 0xff, 0x00, 0x00, 0x06, 0xfe, 0x01, 0x00, 0x63, 0xfc, 0x03,
0x80, 0x61, 0xfc, 0x03, 0xc0, 0x60, 0xf8, 0x07, 0xc0, 0x60, 0xf0, 0x0f,
0x60, 0x60, 0xe0, 0x1f, 0x30, 0x60, 0xe0, 0x1f, 0x18, 0x60, 0xc0, 0x3f,
0x0c, 0x60, 0x80, 0x7f, 0x06, 0x00, 0x00, 0xff};
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/

View File

@ -1,36 +0,0 @@
# Tag Image File Format (TIFF) Software
#
# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# Process this file with automake to produce Makefile.in.
LIBTIFF = $(top_builddir)/libtiff/libtiff.la
EXTRA_DIST = README test.iptc test.txt
noinst_PROGRAMS = iptcutil
iptcutil_SOURCES = iptcutil.c
iptcutil_LDADD = $(LIBTIFF)
AM_CPPFLAGS = -I$(top_srcdir)/libtiff

View File

@ -1,25 +0,0 @@
Program: IPTCUTIL.C
Purpose: Convert between IPTC binary and a "special" IPTC text file format.
Usage: iptcutil -t | -b [-i file] [-o file] <input >output
Notes: You tell the program the "type" of input file via the -t and -b
switches. The -t says that the input is text, while the -b says
that the input is binary IPTC. You can use either the -i or the
-o switches to tell the program what the input and output files
will be, or use simple piping.
Author: William T. Radcliffe (billr@corbis.com)
Parts of this program were derived from other places. The original
binary to text conversion was taken from the PHP distribution and
the tokenizer was written many years ago, by someone else as well.
This software is provided freely "as is", without warranty of any kind,
express or implied, including but not limited to the warranties of
merchantability, fitness for a particular purpose and noninfringement.
In no event shall William T. Radcliffe be liable for any claim, damages or
other liability, whether in an action of contract, tort or otherwise,
arising from, out of or in connection with IPTCUTIL

View File

@ -1,943 +0,0 @@
/* $Id: iptcutil.c,v 1.8 2011-05-08 00:44:18 fwarmerdam Exp $ */
#include "tif_config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#ifdef HAVE_IO_H
# include <io.h>
#endif
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
#ifdef WIN32
#define STRNICMP strnicmp
#else
#define STRNICMP strncasecmp
#endif
typedef struct _tag_spec
{
short
id;
char
*name;
} tag_spec;
static tag_spec tags[] = {
{ 5,"Image Name" },
{ 7,"Edit Status" },
{ 10,"Priority" },
{ 15,"Category" },
{ 20,"Supplemental Category" },
{ 22,"Fixture Identifier" },
{ 25,"Keyword" },
{ 30,"Release Date" },
{ 35,"Release Time" },
{ 40,"Special Instructions" },
{ 45,"Reference Service" },
{ 47,"Reference Date" },
{ 50,"Reference Number" },
{ 55,"Created Date" },
{ 60,"Created Time" },
{ 65,"Originating Program" },
{ 70,"Program Version" },
{ 75,"Object Cycle" },
{ 80,"Byline" },
{ 85,"Byline Title" },
{ 90,"City" },
{ 95,"Province State" },
{ 100,"Country Code" },
{ 101,"Country" },
{ 103,"Original Transmission Reference" },
{ 105,"Headline" },
{ 110,"Credit" },
{ 115,"Source" },
{ 116,"Copyright String" },
{ 120,"Caption" },
{ 121,"Local Caption" },
{ 122,"Caption Writer" },
{ 200,"Custom Field 1" },
{ 201,"Custom Field 2" },
{ 202,"Custom Field 3" },
{ 203,"Custom Field 4" },
{ 204,"Custom Field 5" },
{ 205,"Custom Field 6" },
{ 206,"Custom Field 7" },
{ 207,"Custom Field 8" },
{ 208,"Custom Field 9" },
{ 209,"Custom Field 10" },
{ 210,"Custom Field 11" },
{ 211,"Custom Field 12" },
{ 212,"Custom Field 13" },
{ 213,"Custom Field 14" },
{ 214,"Custom Field 15" },
{ 215,"Custom Field 16" },
{ 216,"Custom Field 17" },
{ 217,"Custom Field 18" },
{ 218,"Custom Field 19" },
{ 219,"Custom Field 20" }
};
/*
* We format the output using HTML conventions
* to preserve control characters and such.
*/
void formatString(FILE *ofile, const char *s, int len)
{
putc('"', ofile);
for (; len > 0; --len, ++s) {
int c = *s;
switch (c) {
case '&':
fputs("&amp;", ofile);
break;
#ifdef HANDLE_GT_LT
case '<':
fputs("&lt;", ofile);
break;
case '>':
fputs("&gt;", ofile);
break;
#endif
case '"':
fputs("&quot;", ofile);
break;
default:
if (iscntrl(c))
fprintf(ofile, "&#%d;", c);
else
putc(*s, ofile);
break;
}
}
fputs("\"\n", ofile);
}
typedef struct _html_code
{
short
len;
const char
*code,
val;
} html_code;
static html_code html_codes[] = {
#ifdef HANDLE_GT_LT
{ 4,"&lt;",'<' },
{ 4,"&gt;",'>' },
#endif
{ 5,"&amp;",'&' },
{ 6,"&quot;",'"' }
};
/*
* This routine converts HTML escape sequence
* back to the original ASCII representation.
* - returns the number of characters dropped.
*/
int convertHTMLcodes(char *s, int len)
{
if (len <=0 || s==(char*)NULL || *s=='\0')
return 0;
if (s[1] == '#')
{
int val, o;
if (sscanf(s,"&#%d;",&val) == 1)
{
o = 3;
while (s[o] != ';')
{
o++;
if (o > 5)
break;
}
if (o < 5)
strcpy(s+1, s+1+o);
*s = val;
return o;
}
}
else
{
int
i,
codes = sizeof(html_codes) / sizeof(html_code);
for (i=0; i < codes; i++)
{
if (html_codes[i].len <= len)
if (STRNICMP(s, html_codes[i].code, html_codes[i].len) == 0)
{
strcpy(s+1, s+html_codes[i].len);
*s = html_codes[i].val;
return html_codes[i].len-1;
}
}
}
return 0;
}
int formatIPTC(FILE *ifile, FILE *ofile)
{
unsigned int
foundiptc,
tagsfound;
unsigned char
recnum,
dataset;
char
*readable,
*str;
long
tagindx,
taglen;
int
i,
tagcount = sizeof(tags) / sizeof(tag_spec);
char
c;
foundiptc = 0; /* found the IPTC-Header */
tagsfound = 0; /* number of tags found */
c = getc(ifile);
while (c != EOF)
{
if (c == 0x1c)
foundiptc = 1;
else
{
if (foundiptc)
return -1;
else
continue;
}
/* we found the 0x1c tag and now grab the dataset and record number tags */
dataset = getc(ifile);
if ((char) dataset == EOF)
return -1;
recnum = getc(ifile);
if ((char) recnum == EOF)
return -1;
/* try to match this record to one of the ones in our named table */
for (i=0; i< tagcount; i++)
{
if (tags[i].id == recnum)
break;
}
if (i < tagcount)
readable = tags[i].name;
else
readable = "";
/* then we decode the length of the block that follows - long or short fmt */
c = getc(ifile);
if (c == EOF)
return 0;
if (c & (unsigned char) 0x80)
{
unsigned char
buffer[4];
for (i=0; i<4; i++)
{
c = buffer[i] = getc(ifile);
if (c == EOF)
return -1;
}
taglen = (((long) buffer[ 0 ]) << 24) |
(((long) buffer[ 1 ]) << 16) |
(((long) buffer[ 2 ]) << 8) |
(((long) buffer[ 3 ]));
}
else
{
unsigned char
x = c;
taglen = ((long) x) << 8;
x = getc(ifile);
if ((char)x == EOF)
return -1;
taglen |= (long) x;
}
/* make a buffer to hold the tag data and snag it from the input stream */
str = (char *) malloc((unsigned int) (taglen+1));
if (str == (char *) NULL)
{
printf("Memory allocation failed");
return 0;
}
for (tagindx=0; tagindx<taglen; tagindx++)
{
c = str[tagindx] = getc(ifile);
if (c == EOF)
{
free(str);
return -1;
}
}
str[ taglen ] = 0;
/* now finish up by formatting this binary data into ASCII equivalent */
if (strlen(readable) > 0)
fprintf(ofile, "%d#%d#%s=",(unsigned int)dataset, (unsigned int) recnum, readable);
else
fprintf(ofile, "%d#%d=",(unsigned int)dataset, (unsigned int) recnum);
formatString( ofile, str, taglen );
free(str);
tagsfound++;
c = getc(ifile);
}
return tagsfound;
}
int tokenizer(unsigned inflag,char *token,int tokmax,char *line,
char *white,char *brkchar,char *quote,char eschar,char *brkused,
int *next,char *quoted);
char *super_fgets(char *b, int *blen, FILE *file)
{
int
c,
len;
char
*q;
len=*blen;
for (q=b; ; q++)
{
c=fgetc(file);
if (c == EOF || c == '\n')
break;
if (((long)q - (long)b + 1 ) >= (long) len)
{
long
tlen;
tlen=(long)q-(long)b;
len<<=1;
b=(char *) realloc((char *) b,(len+2));
if ((char *) b == (char *) NULL)
break;
q=b+tlen;
}
*q=(unsigned char) c;
}
*blen=0;
if ((unsigned char *)b != (unsigned char *) NULL)
{
int
tlen;
tlen=(long)q - (long)b;
if (tlen == 0)
return (char *) NULL;
b[tlen] = '\0';
*blen=++tlen;
}
return b;
}
#define BUFFER_SZ 4096
int main(int argc, char *argv[])
{
unsigned int
length;
unsigned char
*buffer;
int
i,
mode; /* iptc binary, or iptc text */
FILE
*ifile = stdin,
*ofile = stdout;
char
c,
*usage = "usage: iptcutil -t | -b [-i file] [-o file] <input >output";
if( argc < 2 )
{
puts(usage);
return 1;
}
mode = 0;
length = -1;
buffer = (unsigned char *)NULL;
for (i=1; i<argc; i++)
{
c = argv[i][0];
if (c == '-' || c == '/')
{
c = argv[i][1];
switch( c )
{
case 't':
mode = 1;
#ifdef WIN32
/* Set "stdout" to binary mode: */
_setmode( _fileno( ofile ), _O_BINARY );
#endif
break;
case 'b':
mode = 0;
#ifdef WIN32
/* Set "stdin" to binary mode: */
_setmode( _fileno( ifile ), _O_BINARY );
#endif
break;
case 'i':
if (mode == 0)
ifile = fopen(argv[++i], "rb");
else
ifile = fopen(argv[++i], "rt");
if (ifile == (FILE *)NULL)
{
printf("Unable to open: %s\n", argv[i]);
return 1;
}
break;
case 'o':
if (mode == 0)
ofile = fopen(argv[++i], "wt");
else
ofile = fopen(argv[++i], "wb");
if (ofile == (FILE *)NULL)
{
printf("Unable to open: %s\n", argv[i]);
return 1;
}
break;
default:
printf("Unknown option: %s\n", argv[i]);
return 1;
}
}
else
{
puts(usage);
return 1;
}
}
if (mode == 0) /* handle binary iptc info */
formatIPTC(ifile, ofile);
if (mode == 1) /* handle text form of iptc info */
{
char
brkused,
quoted,
*line,
*token,
*newstr;
int
state,
next;
unsigned char
recnum = 0,
dataset = 0;
int
inputlen = BUFFER_SZ;
line = (char *) malloc(inputlen);
token = (char *)NULL;
while((line = super_fgets(line,&inputlen,ifile))!=NULL)
{
state=0;
next=0;
token = (char *) malloc(inputlen);
newstr = (char *) malloc(inputlen);
while(tokenizer(0, token, inputlen, line, "", "=", "\"", 0,
&brkused,&next,&quoted)==0)
{
if (state == 0)
{
int
state,
next;
char
brkused,
quoted;
state=0;
next=0;
while(tokenizer(0, newstr, inputlen, token, "", "#", "", 0,
&brkused, &next, &quoted)==0)
{
if (state == 0)
dataset = (unsigned char) atoi(newstr);
else
if (state == 1)
recnum = (unsigned char) atoi(newstr);
state++;
}
}
else
if (state == 1)
{
int
next;
unsigned long
len;
char
brkused,
quoted;
next=0;
len = strlen(token);
while(tokenizer(0, newstr, inputlen, token, "", "&", "", 0,
&brkused, &next, &quoted)==0)
{
if (brkused && next > 0)
{
char
*s = &token[next-1];
len -= convertHTMLcodes(s, strlen(s));
}
}
fputc(0x1c, ofile);
fputc(dataset, ofile);
fputc(recnum, ofile);
if (len < 0x10000)
{
fputc((len >> 8) & 255, ofile);
fputc(len & 255, ofile);
}
else
{
fputc(((len >> 24) & 255) | 0x80, ofile);
fputc((len >> 16) & 255, ofile);
fputc((len >> 8) & 255, ofile);
fputc(len & 255, ofile);
}
next=0;
while (len--)
fputc(token[next++], ofile);
}
state++;
}
free(token);
token = (char *)NULL;
free(newstr);
newstr = (char *)NULL;
}
free(line);
fclose( ifile );
fclose( ofile );
}
return 0;
}
/*
This routine is a generalized, finite state token parser. It allows
you extract tokens one at a time from a string of characters. The
characters used for white space, for break characters, and for quotes
can be specified. Also, characters in the string can be preceded by
a specifiable escape character which removes any special meaning the
character may have.
There are a lot of formal parameters in this subroutine call, but
once you get familiar with them, this routine is fairly easy to use.
"#define" macros can be used to generate simpler looking calls for
commonly used applications of this routine.
First, some terminology:
token: used here, a single unit of information in
the form of a group of characters.
white space: space that gets ignored (except within quotes
or when escaped), like blanks and tabs. in
addition, white space terminates a non-quoted
token.
break character: a character that separates non-quoted tokens.
commas are a common break character. the
usage of break characters to signal the end
of a token is the same as that of white space,
except multiple break characters with nothing
or only white space between generate a null
token for each two break characters together.
for example, if blank is set to be the white
space and comma is set to be the break
character, the line ...
A, B, C , , DEF
... consists of 5 tokens:
1) "A"
2) "B"
3) "C"
4) "" (the null string)
5) "DEF"
quote character: a character that, when surrounding a group
of other characters, causes the group of
characters to be treated as a single token,
no matter how many white spaces or break
characters exist in the group. also, a
token always terminates after the closing
quote. for example, if ' is the quote
character, blank is white space, and comma
is the break character, the following
string ...
A, ' B, CD'EF GHI
... consists of 4 tokens:
1) "A"
2) " B, CD" (note the blanks & comma)
3) "EF"
4) "GHI"
the quote characters themselves do
not appear in the resultant tokens. the
double quotes are delimiters i use here for
documentation purposes only.
escape character: a character which itself is ignored but
which causes the next character to be
used as is. ^ and \ are often used as
escape characters. an escape in the last
position of the string gets treated as a
"normal" (i.e., non-quote, non-white,
non-break, and non-escape) character.
for example, assume white space, break
character, and quote are the same as in the
above examples, and further, assume that
^ is the escape character. then, in the
string ...
ABC, ' DEF ^' GH' I ^ J K^ L ^
... there are 7 tokens:
1) "ABC"
2) " DEF ' GH"
3) "I"
4) " " (a lone blank)
5) "J"
6) "K L"
7) "^" (passed as is at end of line)
OK, now that you have this background, here's how to call "tokenizer":
result=tokenizer(flag,token,maxtok,string,white,break,quote,escape,
brkused,next,quoted)
result: 0 if we haven't reached EOS (end of string), and
1 if we have (this is an "int").
flag: right now, only the low order 3 bits are used.
1 => convert non-quoted tokens to upper case
2 => convert non-quoted tokens to lower case
0 => do not convert non-quoted tokens
(this is a "char").
token: a character string containing the returned next token
(this is a "char[]").
maxtok: the maximum size of "token". characters beyond
"maxtok" are truncated (this is an "int").
string: the string to be parsed (this is a "char[]").
white: a string of the valid white spaces. example:
char whitesp[]={" \t"};
blank and tab will be valid white space (this is
a "char[]").
break: a string of the valid break characters. example:
char breakch[]={";,"};
semicolon and comma will be valid break characters
(this is a "char[]").
IMPORTANT: do not use the name "break" as a C
variable, as this is a reserved word in C.
quote: a string of the valid quote characters. an example
would be
char whitesp[]={"'\"");
(this causes single and double quotes to be valid)
note that a token starting with one of these characters
needs the same quote character to terminate it.
for example,
"ABC '
is unterminated, but
"DEF" and 'GHI'
are properly terminated. note that different quote
characters can appear on the same line; only for
a given token do the quote characters have to be
the same (this is a "char[]").
escape: the escape character (NOT a string ... only one
allowed). use zero if none is desired (this is
a "char").
brkused: the break character used to terminate the current
token. if the token was quoted, this will be the
quote used. if the token is the last one on the
line, this will be zero (this is a pointer to a
"char").
next: this variable points to the first character of the
next token. it gets reset by "tokenizer" as it steps
through the string. set it to 0 upon initialization,
and leave it alone after that. you can change it
if you want to jump around in the string or re-parse
from the beginning, but be careful (this is a
pointer to an "int").
quoted: set to 1 (true) if the token was quoted and 0 (false)
if not. you may need this information (for example:
in C, a string with quotes around it is a character
string, while one without is an identifier).
(this is a pointer to a "char").
*/
/* states */
#define IN_WHITE 0
#define IN_TOKEN 1
#define IN_QUOTE 2
#define IN_OZONE 3
int _p_state; /* current state */
unsigned _p_flag; /* option flag */
char _p_curquote; /* current quote char */
int _p_tokpos; /* current token pos */
/* routine to find character in string ... used only by "tokenizer" */
int sindex(char ch,char *string)
{
char *cp;
for(cp=string;*cp;++cp)
if(ch==*cp)
return (int)(cp-string); /* return postion of character */
return -1; /* eol ... no match found */
}
/* routine to store a character in a string ... used only by "tokenizer" */
void chstore(char *string,int max,char ch)
{
char c;
if(_p_tokpos>=0&&_p_tokpos<max-1)
{
if(_p_state==IN_QUOTE)
c=ch;
else
switch(_p_flag&3)
{
case 1: /* convert to upper */
c=toupper(ch);
break;
case 2: /* convert to lower */
c=tolower(ch);
break;
default: /* use as is */
c=ch;
break;
}
string[_p_tokpos++]=c;
}
return;
}
int tokenizer(unsigned inflag,char *token,int tokmax,char *line,
char *white,char *brkchar,char *quote,char eschar,char *brkused,
int *next,char *quoted)
{
int qp;
char c,nc;
*brkused=0; /* initialize to null */
*quoted=0; /* assume not quoted */
if(!line[*next]) /* if we're at end of line, indicate such */
return 1;
_p_state=IN_WHITE; /* initialize state */
_p_curquote=0; /* initialize previous quote char */
_p_flag=inflag; /* set option flag */
for(_p_tokpos=0;(c=line[*next]);++(*next)) /* main loop */
{
if((qp=sindex(c,brkchar))>=0) /* break */
{
switch(_p_state)
{
case IN_WHITE: /* these are the same here ... */
case IN_TOKEN: /* ... just get out */
case IN_OZONE: /* ditto */
++(*next);
*brkused=brkchar[qp];
goto byebye;
case IN_QUOTE: /* just keep going */
chstore(token,tokmax,c);
break;
}
}
else if((qp=sindex(c,quote))>=0) /* quote */
{
switch(_p_state)
{
case IN_WHITE: /* these are identical, */
_p_state=IN_QUOTE; /* change states */
_p_curquote=quote[qp]; /* save quote char */
*quoted=1; /* set to true as long as something is in quotes */
break;
case IN_QUOTE:
if(quote[qp]==_p_curquote) /* same as the beginning quote? */
{
_p_state=IN_OZONE;
_p_curquote=0;
}
else
chstore(token,tokmax,c); /* treat as regular char */
break;
case IN_TOKEN:
case IN_OZONE:
*brkused=c; /* uses quote as break char */
goto byebye;
}
}
else if((qp=sindex(c,white))>=0) /* white */
{
switch(_p_state)
{
case IN_WHITE:
case IN_OZONE:
break; /* keep going */
case IN_TOKEN:
_p_state=IN_OZONE;
break;
case IN_QUOTE:
chstore(token,tokmax,c); /* it's valid here */
break;
}
}
else if(c==eschar) /* escape */
{
nc=line[(*next)+1];
if(nc==0) /* end of line */
{
*brkused=0;
chstore(token,tokmax,c);
++(*next);
goto byebye;
}
switch(_p_state)
{
case IN_WHITE:
--(*next);
_p_state=IN_TOKEN;
break;
case IN_TOKEN:
case IN_QUOTE:
++(*next);
chstore(token,tokmax,nc);
break;
case IN_OZONE:
goto byebye;
}
}
else /* anything else is just a real character */
{
switch(_p_state)
{
case IN_WHITE:
_p_state=IN_TOKEN; /* switch states */
case IN_TOKEN: /* these 2 are */
case IN_QUOTE: /* identical here */
chstore(token,tokmax,c);
break;
case IN_OZONE:
goto byebye;
}
}
} /* end of main loop */
byebye:
token[_p_tokpos]=0; /* make sure token ends with EOS */
return 0;
}
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/

View File

@ -1,32 +0,0 @@
2#0="&#0;&#2;"
2#120#Caption="Chairman of the US House Judiciary Committee, Henry Hyde,R-IL, makes his opening statement during impeachment hearings 11 December on Capitol Hill in Washington, DC. The committee is debating the articles of impechment and my take a vote on the impeachment of US President BIll Clinton on charges that he obstucted justice, lied and abused the power of his office as early as today. AFP PHOTO Paul J. RICHARDS&#13;"
2#122#Caption Writer="kb/lt"
2#100#Country Code="USA"
2#105#Headline="Old fart squeezing two fingers."
2#30#Release Date="19981211"
2#35#Release Time="000000+0000"
2#40#Special Instructions="This is a test. This is only a test. ABCDEFGHIJKLMNOPQRSTUVWXYZ 1234567890"
2#80#Byline="PAUL J. RICHARDS"
2#85#Byline Title="STF"
2#110#Credit="AFP"
2#65#Originating Program="MacDesk Reporter"
2#115#Source="AFP"
2#5#Image Name="US-HYDE"
2#55#Created Date="19981211"
2#90#City="WASHINGTON"
2#95#Province State="DC"
2#101#Country="UNITED STATES"
2#103#Original Transmission Reference="DCA03"
2#15#Category="POL"
2#20#Supplemental Category="GOVERNMENT"
2#10#Priority="5"
2#25#Keyword="fart"
2#25#Keyword="squeezing"
2#25#Keyword="old"
2#25#Keyword="fingers"
2#75#Object Cycle="a"
2#60#Created Time="000000+0000"
2#70#Program Version="2.0.3"
2#130="3S"
2#135="GB"
2#231="Kaya A. Hoffmann 12/14/98 12:00:44 PM Copy To : Selects - \\KINYANI\Selects&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;&#0;"

View File

@ -1,27 +0,0 @@
# Tag Image File Format (TIFF) Software
#
# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# Process this file with automake to produce Makefile.in.
EXTRA_DIST = README mfs_file.c

View File

@ -1,37 +0,0 @@
Date: Mon, 23 Jun 1997 13:30:48 +0200
To: <sam@cthulhu.engr.sgi.com>
From: "Mike Johnson" <mikehunt@swipnet.se>
Subject: libtiff - Thanks
Return-Path: mikehunt@swipnet.se
Delivery-Date: Mon, 23 Jun 1997 06:53:39 -0700
Hi Sam,
I noticed in the README from libtiff that you would like to know about
what people have done with libtiff, so I thought I would drop you a
line.
We have used libtiff to create and convert TIFF images of financial
documents which are sent from and to major document processing systems
in Sweden and Denmark.
I would like to express my deep gratitude to yourself and Sillicon
Graphics for making this excellent library available for public use.
There is obviously a lot of work that has gone in to libtiff and the
quality of the code and documentation is an example to others.
One thing that libtiff did not do was work on a memory area rather than
files. In my applications I had already read a TIFF or other format
file in to memory and did not want to waste I/O writing it out again
for libtiff's benefit. I therefore constructed a set of functions to
pass up to TIFFClientOpen to simulate a file in memory. I have attached
my mfs (memory file system) source code for you to use or junk, as you
see fit. :-)
Once again, thanks very much for making my life simpler.
Best Regards,
Mike Johnson.

View File

@ -1,586 +0,0 @@
/*
--------------------------------------------------------------------------------
- Module : mem_file.c
- Description : A general purpose library for manipulating a memory area
- as if it were a file.
- mfs_ stands for memory file system.
- Author : Mike Johnson - Banctec AB 03/07/96
-
--------------------------------------------------------------------------------
*/
/*
Copyright (c) 1996 Mike Johnson
Copyright (c) 1996 BancTec AB
Permission to use, copy, modify, distribute, and sell this software
for any purpose is hereby granted without fee, provided
that (i) the above copyright notices and this permission notice appear in
all copies of the software and related documentation, and (ii) the names of
Mike Johnson and BancTec may not be used in any advertising or
publicity relating to the software.
THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT SHALL MIKE JOHNSON OR BANCTEC BE LIABLE FOR
ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
OF THIS SOFTWARE.
*/
/*
--------------------------------------------------------------------------------
- Includes
--------------------------------------------------------------------------------
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
--------------------------------------------------------------------------------
- Definitions
--------------------------------------------------------------------------------
*/
#define MAX_BUFFS 20
#define FALSE 0
#define TRUE 1
/*
--------------------------------------------------------------------------------
- Globals
--------------------------------------------------------------------------------
*/
static char *buf[MAX_BUFFS]; /* Memory for each open buf */
static long buf_off[MAX_BUFFS]; /* File pointer for each buf */
static long buf_size[MAX_BUFFS]; /* Count of bytes allocated for each buf */
static long fds[MAX_BUFFS]; /* File descriptor status */
static int buf_mode[MAX_BUFFS]; /* Mode of buffer (r, w, a) */
static int library_init_done = FALSE;
/*
--------------------------------------------------------------------------------
- Function prototypes
--------------------------------------------------------------------------------
*/
int mfs_open (void *ptr, int size, char *mode);
int mfs_lseek (int fd, int offset, int whence);
int mfs_read (int fd, void *buf, int size);
int mfs_write (int fd, void *buf, int size);
int mfs_size (int fd);
int mfs_map (int fd, char **addr, size_t *len);
int mfs_unmap (int fd);
int mfs_close (int fd);
static int extend_mem_file (int fd, int size);
static void mem_init ();
/*
--------------------------------------------------------------------------------
- Function code
--------------------------------------------------------------------------------
*/
/*
--------------------------------------------------------------------------------
- Function : mfs_open ()
-
- Arguments : Pointer to allocated buffer, initial size of buffer,
- mode spec (r, w, a)
-
- Returns : File descriptor or -1 if error.
-
- Description : Register this area of memory (which has been allocated
- and has a file read into it) under the mem_file library.
- A file descriptor is returned which can the be passed
- back to TIFFClientOpen and used as if it was a disk
- based fd.
- If the call is for mode 'w' then pass (void *)NULL as
- the buffer and zero size and the library will
- allocate memory for you.
- If the mode is append then pass (void *)NULL and size
- zero or with a valid address.
-
--------------------------------------------------------------------------------
*/
int mfs_open (void *buffer, int size, char *mode)
{
int ret, i;
void *tmp;
if (library_init_done == FALSE)
{
mem_init ();
library_init_done = TRUE;
}
ret = -1;
/* Find a free fd */
for (i = 0; i < MAX_BUFFS; i++)
{
if (fds[i] == -1)
{
ret = i;
break;
}
}
if (i == MAX_BUFFS) /* No more free descriptors */
{
ret = -1;
errno = EMFILE;
}
if (ret >= 0 && *mode == 'r')
{
if (buffer == (void *)NULL)
{
ret = -1;
errno = EINVAL;
}
else
{
buf[ret] = (char *)buffer;
buf_size[ret] = size;
buf_off[ret] = 0;
}
}
else if (ret >= 0 && *mode == 'w')
{
if (buffer != (void *)NULL)
{
ret = -1;
errno = EINVAL;
}
else
{
tmp = malloc (0); /* Get a pointer */
if (tmp == (void *)NULL)
{
ret = -1;
errno = EDQUOT;
}
else
{
buf[ret] = (char *)tmp;
buf_size[ret] = 0;
buf_off[ret] = 0;
}
}
}
else if (ret >= 0 && *mode == 'a')
{
if (buffer == (void *) NULL) /* Create space for client */
{
tmp = malloc (0); /* Get a pointer */
if (tmp == (void *)NULL)
{
ret = -1;
errno = EDQUOT;
}
else
{
buf[ret] = (char *)tmp;
buf_size[ret] = 0;
buf_off[ret] = 0;
}
}
else /* Client has file read in already */
{
buf[ret] = (char *)buffer;
buf_size[ret] = size;
buf_off[ret] = 0;
}
}
else /* Some other invalid combination of parameters */
{
ret = -1;
errno = EINVAL;
}
if (ret != -1)
{
fds[ret] = 0;
buf_mode[ret] = *mode;
}
return (ret);
}
/*
--------------------------------------------------------------------------------
- Function : mfs_lseek ()
-
- Arguments : File descriptor, offset, whence
-
- Returns : as per man lseek (2)
-
- Description : Does the same as lseek (2) except on a memory based file.
- Note: the memory area will be extended if the caller
- attempts to seek past the current end of file (memory).
-
--------------------------------------------------------------------------------
*/
int mfs_lseek (int fd, int offset, int whence)
{
int ret;
long test_off;
if (fds[fd] == -1) /* Not open */
{
ret = -1;
errno = EBADF;
}
else if (offset < 0 && whence == SEEK_SET)
{
ret = -1;
errno = EINVAL;
}
else
{
switch (whence)
{
case SEEK_SET:
if (offset > buf_size[fd])
extend_mem_file (fd, offset);
buf_off[fd] = offset;
ret = offset;
break;
case SEEK_CUR:
test_off = buf_off[fd] + offset;
if (test_off < 0)
{
ret = -1;
errno = EINVAL;
}
else
{
if (test_off > buf_size[fd])
extend_mem_file (fd, test_off);
buf_off[fd] = test_off;
ret = test_off;
}
break;
case SEEK_END:
test_off = buf_size[fd] + offset;
if (test_off < 0)
{
ret = -1;
errno = EINVAL;
}
else
{
if (test_off > buf_size[fd])
extend_mem_file (fd, test_off);
buf_off[fd] = test_off;
ret = test_off;
}
break;
default:
errno = EINVAL;
ret = -1;
break;
}
}
return (ret);
}
/*
--------------------------------------------------------------------------------
- Function : mfs_read ()
-
- Arguments : File descriptor, buffer, size
-
- Returns : as per man read (2)
-
- Description : Does the same as read (2) except on a memory based file.
- Note: An attempt to read past the end of memory currently
- allocated to the file will return 0 (End Of File)
-
--------------------------------------------------------------------------------
*/
int mfs_read (int fd, void *clnt_buf, int size)
{
int ret;
if (fds[fd] == -1 || buf_mode[fd] != 'r')
{
/* File is either not open, or not opened for read */
ret = -1;
errno = EBADF;
}
else if (buf_off[fd] + size > buf_size[fd])
{
ret = 0; /* EOF */
}
else
{
memcpy (clnt_buf, (void *) (buf[fd] + buf_off[fd]), size);
buf_off[fd] = buf_off[fd] + size;
ret = size;
}
return (ret);
}
/*
--------------------------------------------------------------------------------
- Function : mfs_write ()
-
- Arguments : File descriptor, buffer, size
-
- Returns : as per man write (2)
-
- Description : Does the same as write (2) except on a memory based file.
- Note: the memory area will be extended if the caller
- attempts to write past the current end of file (memory).
-
--------------------------------------------------------------------------------
*/
int mfs_write (int fd, void *clnt_buf, int size)
{
int ret;
if (fds[fd] == -1 || buf_mode[fd] == 'r')
{
/* Either the file is not open or it is opened for reading only */
ret = -1;
errno = EBADF;
}
else if (buf_mode[fd] == 'w')
{
/* Write */
if (buf_off[fd] + size > buf_size[fd])
{
extend_mem_file (fd, buf_off[fd] + size);
buf_size[fd] = (buf_off[fd] + size);
}
memcpy ((buf[fd] + buf_off[fd]), clnt_buf, size);
buf_off[fd] = buf_off[fd] + size;
ret = size;
}
else
{
/* Append */
if (buf_off[fd] != buf_size[fd])
buf_off[fd] = buf_size[fd];
extend_mem_file (fd, buf_off[fd] + size);
buf_size[fd] += size;
memcpy ((buf[fd] + buf_off[fd]), clnt_buf, size);
buf_off[fd] = buf_off[fd] + size;
ret = size;
}
return (ret);
}
/*
--------------------------------------------------------------------------------
- Function : mfs_size ()
-
- Arguments : File descriptor
-
- Returns : integer file size
-
- Description : This function returns the current size of the file in bytes.
-
--------------------------------------------------------------------------------
*/
int mfs_size (int fd)
{
int ret;
if (fds[fd] == -1) /* Not open */
{
ret = -1;
errno = EBADF;
}
else
ret = buf_size[fd];
return (ret);
}
/*
--------------------------------------------------------------------------------
- Function : mfs_map ()
-
- Arguments : File descriptor, ptr to address, ptr to length
-
- Returns : Map status (succeeded or otherwise)
-
- Description : This function tells the client where the file is mapped
- in memory and what size the mapped area is. It is provided
- to satisfy the MapProc function in libtiff. It pretends
- that the file has been mmap (2)ped.
-
--------------------------------------------------------------------------------
*/
int mfs_map (int fd, char **addr, size_t *len)
{
int ret;
if (fds[fd] == -1) /* Not open */
{
ret = -1;
errno = EBADF;
}
else
{
*addr = buf[fd];
*len = buf_size[fd];
ret = 0;
}
return (ret);
}
/*
--------------------------------------------------------------------------------
- Function : mfs_unmap ()
-
- Arguments : File descriptor
-
- Returns : UnMap status (succeeded or otherwise)
-
- Description : This function does nothing as the file is always
- in memory.
-
--------------------------------------------------------------------------------
*/
int mfs_unmap (int fd)
{
return (0);
}
/*
--------------------------------------------------------------------------------
- Function : mfs_close ()
-
- Arguments : File descriptor
-
- Returns : close status (succeeded or otherwise)
-
- Description : Close the open memory file. (Make fd available again.)
-
--------------------------------------------------------------------------------
*/
int mfs_close (int fd)
{
int ret;
if (fds[fd] == -1) /* Not open */
{
ret = -1;
errno = EBADF;
}
else
{
fds[fd] = -1;
ret = 0;
}
return (ret);
}
/*
--------------------------------------------------------------------------------
- Function : extend_mem_file ()
-
- Arguments : File descriptor, length to extend to.
-
- Returns : 0 - All OK, -1 - realloc () failed.
-
- Description : Increase the amount of memory allocated to a file.
-
--------------------------------------------------------------------------------
*/
static int extend_mem_file (int fd, int size)
{
void *new_mem;
int ret;
if ((new_mem = realloc (buf[fd], size)) == (void *) NULL)
ret = -1;
else
{
buf[fd] = (char *) new_mem;
ret = 0;
}
return (ret);
}
/*
--------------------------------------------------------------------------------
- Function : mem_init ()
-
- Arguments : None
-
- Returns : void
-
- Description : Initialise the library.
-
--------------------------------------------------------------------------------
*/
static void mem_init ()
{
int i;
for (i = 0; i < MAX_BUFFS; i++)
{
fds[i] = -1;
buf[i] = (char *)NULL;
buf_size[i] = 0;
buf_off[i] = 0;
}
}
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/

View File

@ -1,27 +0,0 @@
# Tag Image File Format (TIFF) Software
#
# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# Process this file with automake to produce Makefile.in.
EXTRA_DIST = README tif_imageiter.c tif_imageiter.h tif_pdsdirread.c tif_pdsdirwrite.c

View File

@ -1,90 +0,0 @@
Date: Fri, 01 Aug 1997 20:14:52 MDT
To: Sam Leffler <sam@cthulhu.engr.sgi.com>
From: "Conrad J. Poelman (WSAT)" <poelmanc@plk.af.mil>
Subject: Potential TIFF library additions
Delivery-Date: Fri, 01 Aug 1997 19:21:06 -0700
Sam,
You probably don't remember me, but I sent in a couple of bug fixes
regarding the TIFF library about a 16 months ago or so...
I just wanted to send you two other additions that I have made to our
local version of the TIFF library in hopes that you will want to
incorporate them into your next major release of the TIFF library.
(These additions are based on TIFF version 3.4beta31, but they sit on
top of the library so they shouldn't be much trouble to incorporate them
into any more recent version.) They are internally documented to a
reasonable extent and we've been successfully using them in our code
here for over a year. If you think they would make good additions to the
TIFF library, I'd be happy to clean them up more, document them more,
and/or integrate them with the latest version of the TIFF library, but I
figured I'd see if you were interested in using them before I went to
all that trouble.
TIFF Image Iterator
-------------------
Your ReadRGBA() routine works well for reading many different formats
(TILED, STIP, compressed or not, etc.) of the most basic types of data
(RGB, 8-bit greyscale, 8-bit colormapped) into an SGI-style data array,
and serves as a good template for users with other needs. I used it as
an exmaple of how to make an iterator which, rather than fill a data
array, calls an arbitrary user-supplied callback function for each
"chunk" of data - that "chunk" might be a strip or a tile, and might
have one sample-per-pixel or two, and might be 8-bit data or 16-bit or
24-bit. The callback function can do whatever it wants with the data -
store it in a big array, convert it to RGBA, or draw it directly to the
screen. I was able to use this iterator to read 16-bit greyscale and 32-
and 64-bit floating point data, which wasn't possible with ReadRGBA().
I have tested this routine with 8- and 16-bit greyscale data as well as
with 32- and 64-bit floating point data. I believe nearly all of our
data is organized in strips, so actually I'd appreciate it if you had
some tiled images that I could test it with.
It should certainly be possible and would be cleanest to reimplement
ReadRGBA() in terms of the image iterator, but I haven't done that.
Private Sub-Directory Read/Write
--------------------------------
TIFF-PL is a Phillips Laboratory extension to the TIFF tags that allows
us to store satellite imaging-specific information in a TIFF format,
such as the satellite's trajectory, the imaging time, etc. In order to
give us the flexibility to modify the tag definitions without getting
approval from the TIFF committee every time, we were given only three
TIFF tags - a PL signature, a PL version number, and PL directory
offset, which lists the position in the file at which to find a private
sub-directory of tags-value pairs. So I wrote two routines:
TIFFWritePrivateDataSubDirectory(), which takes a list of tags and a
"get" function and writes the tag values into the TIFF file, returning
the offset within the file at which it wrote the directory; and
TIFFReadPrivateDataSubDirectory(), which takes an offset, a list of
tags, and a "set" function and reads all the data from the private
directory. The functions themselves are pretty simple. (The files are
huge because I had to basically copy all of the tif_dirread.c and
tif_dirwrite.c files in order to access the various fetching routines
which were all declared static and therefore inaccessible in the TIFF
library.)
I'm including the four source files (tif_imgiter.h, tif_imgiter.c,
tif_pdsdirread.c, tif_pdsdirwrite.c) in case you want to take a look at
them. I can also send you some sample code that uses them if you like.
If you're interested in having them incorporated into the standard TIFF
library, I'd be happy to do that integration and clean up and document
the routines. (For example, I've already realized that instead of
limiting the SEP callback function to three bands (R,G,B) it should take
an array to enable the handling of n-banded multi-spectral data...) If
not, I'll just leave them as they are, since they work fine for us now.
Holler if you have any questions.
-- Conrad
__________________________________________________________________
Capt Conrad J. Poelman PL/WSAT (Phillips Laboratory)
505-846-4347 3550 Aberdeen Ave SE
(FAX) 505-846-4374 Kirtland AFB, NM 87117-5776

View File

@ -1,525 +0,0 @@
/* $Header: /cvs/maptools/cvsroot/libtiff/contrib/pds/tif_imageiter.c,v 1.4 2010-06-08 18:55:15 bfriesen Exp $ */
/*
* Copyright (c) 1991-1996 Sam Leffler
* Copyright (c) 1991-1996 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the names of
* Sam Leffler and Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Sam Leffler and Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
/*
* TIFF Library
*
* Written by Conrad J. Poelman, PL/WSAT, Kirtland AFB, NM on 26 Mar 96.
*
* This file contains code to allow a calling program to "iterate" over each
* pixels in an image as it is read from the file. The iterator takes care of
* reading strips versus (possibly clipped) tiles, decoding the information
* according to the decoding method, and so on, so that calling program can
* ignore those details. The calling program does, however, need to be
* conscious of the type of the pixel data that it is receiving.
*
* For reasons of efficiency, the callback function actually gets called for
* "blocks" of pixels rather than for individual pixels. The format of the
* callback arguments is given below.
*
* This code was taken from TIFFReadRGBAImage() in tif_getimage.c of the original
* TIFF distribution, and simplified and generalized to provide this general
* iteration capability. Those routines could certainly be re-implemented in terms
* of a TIFFImageIter if desired.
*
*/
#include "tiffiop.h"
#include "tif_imageiter.h"
#include <assert.h>
#include <stdio.h>
static int gtTileContig(TIFFImageIter*, void *udata, uint32, uint32);
static int gtTileSeparate(TIFFImageIter*, void *udata, uint32, uint32);
static int gtStripContig(TIFFImageIter*, void *udata, uint32, uint32);
static int gtStripSeparate(TIFFImageIter*, void *udata, uint32, uint32);
static const char photoTag[] = "PhotometricInterpretation";
static int
isCCITTCompression(TIFF* tif)
{
uint16 compress;
TIFFGetField(tif, TIFFTAG_COMPRESSION, &compress);
return (compress == COMPRESSION_CCITTFAX3 ||
compress == COMPRESSION_CCITTFAX4 ||
compress == COMPRESSION_CCITTRLE ||
compress == COMPRESSION_CCITTRLEW);
}
int
TIFFImageIterBegin(TIFFImageIter* img, TIFF* tif, int stop, char emsg[1024])
{
uint16* sampleinfo;
uint16 extrasamples;
uint16 planarconfig;
int colorchannels;
img->tif = tif;
img->stoponerr = stop;
TIFFGetFieldDefaulted(tif, TIFFTAG_BITSPERSAMPLE, &img->bitspersample);
img->alpha = 0;
TIFFGetFieldDefaulted(tif, TIFFTAG_SAMPLESPERPIXEL, &img->samplesperpixel);
TIFFGetFieldDefaulted(tif, TIFFTAG_EXTRASAMPLES,
&extrasamples, &sampleinfo);
if (extrasamples == 1)
switch (sampleinfo[0]) {
case EXTRASAMPLE_ASSOCALPHA: /* data is pre-multiplied */
case EXTRASAMPLE_UNASSALPHA: /* data is not pre-multiplied */
img->alpha = sampleinfo[0];
break;
}
colorchannels = img->samplesperpixel - extrasamples;
TIFFGetFieldDefaulted(tif, TIFFTAG_PLANARCONFIG, &planarconfig);
if (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &img->photometric)) {
switch (colorchannels) {
case 1:
if (isCCITTCompression(tif))
img->photometric = PHOTOMETRIC_MINISWHITE;
else
img->photometric = PHOTOMETRIC_MINISBLACK;
break;
case 3:
img->photometric = PHOTOMETRIC_RGB;
break;
default:
sprintf(emsg, "Missing needed %s tag", photoTag);
return (0);
}
}
switch (img->photometric) {
case PHOTOMETRIC_PALETTE:
if (!TIFFGetField(tif, TIFFTAG_COLORMAP,
&img->redcmap, &img->greencmap, &img->bluecmap)) {
TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "Missing required \"Colormap\" tag");
return (0);
}
/* fall thru... */
case PHOTOMETRIC_MINISWHITE:
case PHOTOMETRIC_MINISBLACK:
/* This should work now so skip the check - BSR
if (planarconfig == PLANARCONFIG_CONTIG && img->samplesperpixel != 1) {
sprintf(emsg,
"Sorry, can not handle contiguous data with %s=%d, and %s=%d",
photoTag, img->photometric,
"Samples/pixel", img->samplesperpixel);
return (0);
}
*/
break;
case PHOTOMETRIC_YCBCR:
if (planarconfig != PLANARCONFIG_CONTIG) {
sprintf(emsg, "Sorry, can not handle YCbCr images with %s=%d",
"Planarconfiguration", planarconfig);
return (0);
}
/* It would probably be nice to have a reality check here. */
{ uint16 compress;
TIFFGetField(tif, TIFFTAG_COMPRESSION, &compress);
if (compress == COMPRESSION_JPEG && planarconfig == PLANARCONFIG_CONTIG) {
/* can rely on libjpeg to convert to RGB */
/* XXX should restore current state on exit */
TIFFSetField(tif, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB);
img->photometric = PHOTOMETRIC_RGB;
}
}
break;
case PHOTOMETRIC_RGB:
if (colorchannels < 3) {
sprintf(emsg, "Sorry, can not handle RGB image with %s=%d",
"Color channels", colorchannels);
return (0);
}
break;
case PHOTOMETRIC_SEPARATED: {
uint16 inkset;
TIFFGetFieldDefaulted(tif, TIFFTAG_INKSET, &inkset);
if (inkset != INKSET_CMYK) {
sprintf(emsg, "Sorry, can not handle separated image with %s=%d",
"InkSet", inkset);
return (0);
}
if (img->samplesperpixel != 4) {
sprintf(emsg, "Sorry, can not handle separated image with %s=%d",
"Samples/pixel", img->samplesperpixel);
return (0);
}
break;
}
default:
sprintf(emsg, "Sorry, can not handle image with %s=%d",
photoTag, img->photometric);
return (0);
}
TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &img->width);
TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &img->height);
TIFFGetFieldDefaulted(tif, TIFFTAG_ORIENTATION, &img->orientation);
switch (img->orientation) {
case ORIENTATION_BOTRIGHT:
case ORIENTATION_RIGHTBOT: /* XXX */
case ORIENTATION_LEFTBOT: /* XXX */
TIFFWarning(TIFFFileName(tif), "using bottom-left orientation");
img->orientation = ORIENTATION_BOTLEFT;
/* fall thru... */
case ORIENTATION_BOTLEFT:
break;
case ORIENTATION_TOPRIGHT:
case ORIENTATION_RIGHTTOP: /* XXX */
case ORIENTATION_LEFTTOP: /* XXX */
default:
TIFFWarning(TIFFFileName(tif), "using top-left orientation");
img->orientation = ORIENTATION_TOPLEFT;
/* fall thru... */
case ORIENTATION_TOPLEFT:
break;
}
img->isContig =
!(planarconfig == PLANARCONFIG_SEPARATE && colorchannels > 1);
if (img->isContig) {
img->get = TIFFIsTiled(tif) ? gtTileContig : gtStripContig;
} else {
img->get = TIFFIsTiled(tif) ? gtTileSeparate : gtStripSeparate;
}
return (1);
}
int
TIFFImageIterGet(TIFFImageIter* img, void *udata, uint32 w, uint32 h)
{
if (img->get == NULL) {
TIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif), "No \"get\" routine setup");
return (0);
}
if (img->callback.any == NULL) {
TIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif),
"No \"put\" routine setupl; probably can not handle image format");
return (0);
}
return (*img->get)(img, udata, w, h);
}
TIFFImageIterEnd(TIFFImageIter* img)
{
/* Nothing to free... ? */
}
/*
* Read the specified image into an ABGR-format raster.
*/
int
TIFFReadImageIter(TIFF* tif,
uint32 rwidth, uint32 rheight, uint8* raster, int stop)
{
char emsg[1024];
TIFFImageIter img;
int ok;
if (TIFFImageIterBegin(&img, tif, stop, emsg)) {
/* XXX verify rwidth and rheight against width and height */
ok = TIFFImageIterGet(&img, raster, rwidth, img.height);
TIFFImageIterEnd(&img);
} else {
TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), emsg);
ok = 0;
}
return (ok);
}
/*
* Get an tile-organized image that has
* PlanarConfiguration contiguous if SamplesPerPixel > 1
* or
* SamplesPerPixel == 1
*/
static int
gtTileContig(TIFFImageIter* img, void *udata, uint32 w, uint32 h)
{
TIFF* tif = img->tif;
ImageIterTileContigRoutine callback = img->callback.contig;
uint16 orientation;
uint32 col, row;
uint32 tw, th;
u_char* buf;
int32 fromskew;
uint32 nrow;
buf = (u_char*) _TIFFmalloc(TIFFTileSize(tif));
if (buf == 0) {
TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "No space for tile buffer");
return (0);
}
TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw);
TIFFGetField(tif, TIFFTAG_TILELENGTH, &th);
orientation = img->orientation;
for (row = 0; row < h; row += th) {
nrow = (row + th > h ? h - row : th);
for (col = 0; col < w; col += tw) {
if (TIFFReadTile(tif, buf, col, row, 0, 0) < 0 && img->stoponerr)
break;
if (col + tw > w) {
/*
* Tile is clipped horizontally. Calculate
* visible portion and skewing factors.
*/
uint32 npix = w - col;
fromskew = tw - npix;
(*callback)(img, udata, col, row, npix, nrow, fromskew, buf);
} else {
(*callback)(img, udata, col, row, tw, nrow, 0, buf);
}
}
}
_TIFFfree(buf);
return (1);
}
/*
* Get an tile-organized image that has
* SamplesPerPixel > 1
* PlanarConfiguration separated
* We assume that all such images are RGB.
*/
static int
gtTileSeparate(TIFFImageIter* img, void *udata, uint32 w, uint32 h)
{
TIFF* tif = img->tif;
ImageIterTileSeparateRoutine callback = img->callback.separate;
uint16 orientation;
uint32 col, row;
uint32 tw, th;
u_char* buf;
u_char* r;
u_char* g;
u_char* b;
u_char* a;
tsize_t tilesize;
int32 fromskew;
int alpha = img->alpha;
uint32 nrow;
tilesize = TIFFTileSize(tif);
buf = (u_char*) _TIFFmalloc(4*tilesize);
if (buf == 0) {
TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "No space for tile buffer");
return (0);
}
r = buf;
g = r + tilesize;
b = g + tilesize;
a = b + tilesize;
if (!alpha)
memset(a, 0xff, tilesize);
TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw);
TIFFGetField(tif, TIFFTAG_TILELENGTH, &th);
orientation = img->orientation;
for (row = 0; row < h; row += th) {
nrow = (row + th > h ? h - row : th);
for (col = 0; col < w; col += tw) {
if (TIFFReadTile(tif, r, col, row,0,0) < 0 && img->stoponerr)
break;
if (TIFFReadTile(tif, g, col, row,0,1) < 0 && img->stoponerr)
break;
if (TIFFReadTile(tif, b, col, row,0,2) < 0 && img->stoponerr)
break;
if (alpha && TIFFReadTile(tif,a,col,row,0,3) < 0 && img->stoponerr)
break;
if (col + tw > w) {
/*
* Tile is clipped horizontally. Calculate
* visible portion and skewing factors.
*/
uint32 npix = w - col;
fromskew = tw - npix;
(*callback)(img, udata, col, row, npix, nrow, fromskew, r, g, b, a);
} else {
(*callback)(img, udata, col, row, tw, nrow, 0, r, g, b, a);
}
}
}
_TIFFfree(buf);
return (1);
}
/*
* Get a strip-organized image that has
* PlanarConfiguration contiguous if SamplesPerPixel > 1
* or
* SamplesPerPixel == 1
*/
static int
gtStripContig(TIFFImageIter* img, void *udata, uint32 w, uint32 h)
{
TIFF* tif = img->tif;
ImageIterTileContigRoutine callback = img->callback.contig;
uint16 orientation;
uint32 row, nrow;
u_char* buf;
uint32 rowsperstrip;
uint32 imagewidth = img->width;
tsize_t scanline;
int32 fromskew;
buf = (u_char*) _TIFFmalloc(TIFFStripSize(tif));
if (buf == 0) {
TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "No space for strip buffer");
return (0);
}
orientation = img->orientation;
TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
scanline = TIFFScanlineSize(tif);
fromskew = (w < imagewidth ? imagewidth - w : 0);
for (row = 0; row < h; row += rowsperstrip) {
nrow = (row + rowsperstrip > h ? h - row : rowsperstrip);
if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, row, 0),
buf, nrow*scanline) < 0 && img->stoponerr)
break;
(*callback)(img, udata, 0, row, w, nrow, fromskew, buf);
}
_TIFFfree(buf);
return (1);
}
/*
* Get a strip-organized image with
* SamplesPerPixel > 1
* PlanarConfiguration separated
* We assume that all such images are RGB.
*/
static int
gtStripSeparate(TIFFImageIter* img, void *udata, uint32 w, uint32 h)
{
TIFF* tif = img->tif;
ImageIterTileSeparateRoutine callback = img->callback.separate;
uint16 orientation;
u_char *buf;
u_char *r, *g, *b, *a;
uint32 row, nrow;
tsize_t scanline;
uint32 rowsperstrip;
uint32 imagewidth = img->width;
tsize_t stripsize;
int32 fromskew;
int alpha = img->alpha;
stripsize = TIFFStripSize(tif);
r = buf = (u_char *)_TIFFmalloc(4*stripsize);
if (buf == 0) {
TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "No space for tile buffer");
return (0);
}
g = r + stripsize;
b = g + stripsize;
a = b + stripsize;
if (!alpha)
memset(a, 0xff, stripsize);
orientation = img->orientation;
TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
scanline = TIFFScanlineSize(tif);
fromskew = (w < imagewidth ? imagewidth - w : 0);
for (row = 0; row < h; row += rowsperstrip) {
nrow = (row + rowsperstrip > h ? h - row : rowsperstrip);
if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, row, 0),
r, nrow*scanline) < 0 && img->stoponerr)
break;
if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, row, 1),
g, nrow*scanline) < 0 && img->stoponerr)
break;
if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, row, 2),
b, nrow*scanline) < 0 && img->stoponerr)
break;
if (alpha &&
(TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, row, 3),
a, nrow*scanline) < 0 && img->stoponerr))
break;
(*callback)(img, udata, 0, row, w, nrow, fromskew, r, g, b, a);
}
_TIFFfree(buf);
return (1);
}
DECLAREContigCallbackFunc(TestContigCallback)
{
printf("Contig Callback called with x = %d, y = %d, w = %d, h = %d, fromskew = %d\n",
x, y, w, h, fromskew);
}
DECLARESepCallbackFunc(TestSepCallback)
{
printf("Sep Callback called with x = %d, y = %d, w = %d, h = %d, fromskew = %d\n",
x, y, w, h, fromskew);
}
#ifdef MAIN
main(int argc, char **argv)
{
char emsg[1024];
TIFFImageIter img;
int ok;
int stop = 1;
TIFF *tif;
unsigned long nx, ny;
unsigned short BitsPerSample, SamplesPerPixel;
int isColorMapped, isPliFile;
unsigned char *ColorMap;
unsigned char *data;
if (argc < 2) {
fprintf(stderr,"usage: %s tiff_file\n",argv[0]);
exit(1);
}
tif = (TIFF *)PLIGetImage(argv[1], (void *) &data, &ColorMap,
&nx, &ny, &BitsPerSample, &SamplesPerPixel,
&isColorMapped, &isPliFile);
if (tif != NULL) {
if (TIFFImageIterBegin(&img, tif, stop, emsg)) {
/* Here need to set data and callback function! */
if (img.isContig) {
img.callback = TestContigCallback;
} else {
img.callback = TestSepCallback;
}
ok = TIFFImageIterGet(&img, NULL, img.width, img.height);
TIFFImageIterEnd(&img);
} else {
TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), emsg);
}
}
}
#endif
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/

View File

@ -1,64 +0,0 @@
typedef struct _TIFFImageIter TIFFImageIter;
/* The callback function is called for each "block" of image pixel data after
it has been read from the file and decoded. This image pixel data is in the
buffer pp, and this data represents the image pixels from (x,y) to
(x+w,y+h). It is stored in pixel format, so each pixel contains
img->samplesperpixel consecutive samples each containing img->bitspersample
bits of data. The array pp is ordered in h consecutive rows of w+fromskew
pixels each. */
typedef void (*ImageIterTileContigRoutine)
(TIFFImageIter*, void *, uint32, uint32, uint32, uint32, int32,
unsigned char*);
#define DECLAREContigCallbackFunc(name) \
static void name(\
TIFFImageIter* img, \
void* user_data, \
uint32 x, uint32 y, \
uint32 w, uint32 h, \
int32 fromskew, \
u_char* pp \
)
typedef void (*ImageIterTileSeparateRoutine)
(TIFFImageIter*, void *, uint32, uint32, uint32, uint32, int32,
unsigned char*, unsigned char*, unsigned char*, unsigned char*);
#define DECLARESepCallbackFunc(name) \
static void name(\
TIFFImageIter* img, \
void* user_data, \
uint32 x, uint32 y, \
uint32 w, uint32 h,\
int32 fromskew, \
u_char* r, u_char* g, u_char* b, u_char* a\
)
struct _TIFFImageIter {
TIFF* tif; /* image handle */
int stoponerr; /* stop on read error */
int isContig; /* data is packed/separate */
int alpha; /* type of alpha data present */
uint32 width; /* image width */
uint32 height; /* image height */
uint16 bitspersample; /* image bits/sample */
uint16 samplesperpixel; /* image samples/pixel */
uint16 orientation; /* image orientation */
uint16 photometric; /* image photometric interp */
uint16* redcmap; /* colormap pallete */
uint16* greencmap;
uint16* bluecmap;
/* get image data routine */
int (*get)(TIFFImageIter*, void *udata, uint32, uint32);
union {
void (*any)(TIFFImageIter*);
ImageIterTileContigRoutine contig;
ImageIterTileSeparateRoutine separate;
} callback; /* fn to exec for each block */
};
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/

File diff suppressed because it is too large Load Diff

View File

@ -1,971 +0,0 @@
/* $Header: /cvs/maptools/cvsroot/libtiff/contrib/pds/tif_pdsdirwrite.c,v 1.4 2010-06-08 18:55:15 bfriesen Exp $ */
/* When writing data to TIFF files, it is often useful to store application-
specific data in a private TIFF directory so that the tags don't need to
be registered and won't conflict with other people's user-defined tags.
One needs to have a registered public tag which contains some amount of
raw data. That raw data, however, is interpreted at an independent,
separate, private tiff directory. This file provides some routines which
will be useful for converting that data from its raw binary form into
the proper form for your application.
*/
/*
* Copyright (c) 1988-1996 Sam Leffler
* Copyright (c) 1991-1996 Silicon Graphics, Inc.
* Copyright (c( 1996 USAF Phillips Laboratory
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the names of
* Sam Leffler and Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Sam Leffler and Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
/*
* TIFF Library.
*
* These routines written by Conrad J. Poelman on a single late-night of
* March 20-21, 1996.
*
* The entire purpose of this file is to provide a single external function,
* TIFFWritePrivateDataSubDirectory(). This function is intended for use
* in writing a private subdirectory structure into a TIFF file. The
* actual reading of data from the structure is handled by the getFieldFn(),
* which is passed to TIFFWritePrivateDataSubDirectory() as a parameter. The
* idea is to enable any application wishing to read private subdirectories to
* do so easily using this function, without modifying the TIFF library.
*
* The astute observer will notice that only two functions are at all different
* from the original tif_dirwrite.c file: TIFFWritePrivateDataSubDirectory()and
* TIFFWriteNormalSubTag(). All the other stuff that makes this file so huge
* is only necessary because all of those functions are declared static in
* tif_dirwrite.c, so we have to totally duplicate them in order to use them.
*
* Oh, also please note the bug-fix in the routine TIFFWriteNormalSubTag(),
* which equally should be applied to TIFFWriteNormalTag().
*
*/
#include "tiffiop.h"
#if HAVE_IEEEFP
#define TIFFCvtNativeToIEEEFloat(tif, n, fp)
#define TIFFCvtNativeToIEEEDouble(tif, n, dp)
#else
extern void TIFFCvtNativeToIEEEFloat(TIFF*, uint32, float*);
extern void TIFFCvtNativeToIEEEDouble(TIFF*, uint32, double*);
#endif
static int TIFFWriteNormalTag(TIFF*, TIFFDirEntry*, const TIFFFieldInfo*);
static int TIFFWriteNormalSubTag(TIFF*, TIFFDirEntry*, const TIFFFieldInfo*,
int (*getFieldFn)(TIFF *tif,ttag_t tag,...));
static void TIFFSetupShortLong(TIFF*, ttag_t, TIFFDirEntry*, uint32);
static int TIFFSetupShortPair(TIFF*, ttag_t, TIFFDirEntry*);
static int TIFFWritePerSampleShorts(TIFF*, ttag_t, TIFFDirEntry*);
static int TIFFWritePerSampleAnys(TIFF*, TIFFDataType, ttag_t, TIFFDirEntry*);
static int TIFFWriteShortTable(TIFF*, ttag_t, TIFFDirEntry*, uint32, uint16**);
static int TIFFWriteShortArray(TIFF*,
TIFFDataType, ttag_t, TIFFDirEntry*, uint32, uint16*);
static int TIFFWriteLongArray(TIFF *,
TIFFDataType, ttag_t, TIFFDirEntry*, uint32, uint32*);
static int TIFFWriteRationalArray(TIFF *,
TIFFDataType, ttag_t, TIFFDirEntry*, uint32, float*);
static int TIFFWriteFloatArray(TIFF *,
TIFFDataType, ttag_t, TIFFDirEntry*, uint32, float*);
static int TIFFWriteDoubleArray(TIFF *,
TIFFDataType, ttag_t, TIFFDirEntry*, uint32, double*);
static int TIFFWriteByteArray(TIFF*, TIFFDirEntry*, char*);
static int TIFFWriteAnyArray(TIFF*,
TIFFDataType, ttag_t, TIFFDirEntry*, uint32, double*);
#ifdef COLORIMETRY_SUPPORT
static int TIFFWriteTransferFunction(TIFF*, TIFFDirEntry*);
#endif
static int TIFFWriteData(TIFF*, TIFFDirEntry*, char*);
static int TIFFLinkDirectory(TIFF*);
#define WriteRationalPair(type, tag1, v1, tag2, v2) { \
if (!TIFFWriteRational(tif, type, tag1, dir, v1)) \
goto bad; \
if (!TIFFWriteRational(tif, type, tag2, dir+1, v2)) \
goto bad; \
dir++; \
}
#define TIFFWriteRational(tif, type, tag, dir, v) \
TIFFWriteRationalArray((tif), (type), (tag), (dir), 1, &(v))
#ifndef TIFFWriteRational
static int TIFFWriteRational(TIFF*,
TIFFDataType, ttag_t, TIFFDirEntry*, float);
#endif
/* This function will write an entire directory to the disk, and return the
offset value indicating where in the file it wrote the beginning of the
directory structure. This is NOT the same as the offset value before
calling this function, because some of the fields may have caused various
data items to be written out BEFORE writing the directory structure.
This code was basically written by ripping of the TIFFWriteDirectory()
code and generalizing it, using RPS's TIFFWritePliIfd() code for
inspiration. My original goal was to make this code general enough that
the original TIFFWriteDirectory() could be rewritten to just call this
function with the appropriate field and field-accessing arguments.
However, now I realize that there's a lot of code that gets executed for
the main, standard TIFF directories that does not apply to special
private subdirectories, so such a reimplementation for the sake of
eliminating redundant or duplicate code is probably not possible,
unless we also pass in a Main flag to indiciate which type of handling
to do, which would be kind of a hack. I've marked those places where I
changed or ripped out code which would have to be re-inserted to
generalize this function. If it can be done in a clean and graceful way,
it would be a great way to generalize the TIFF library. Otherwise, I'll
just leave this code here where it duplicates but remains on top of and
hopefully mostly independent of the main TIFF library.
The caller will probably want to free the sub directory structure after
returning from this call, since otherwise once written out, the user
is likely to forget about it and leave data lying around.
*/
toff_t
TIFFWritePrivateDataSubDirectory(TIFF* tif,
uint32 pdir_fieldsset[], int pdir_fields_last,
TIFFFieldInfo *field_info,
int (*getFieldFn)(TIFF *tif, ttag_t tag, ...))
{
uint16 dircount;
uint32 diroff, nextdiroff;
ttag_t tag;
uint32 nfields;
tsize_t dirsize;
char* data;
TIFFDirEntry* dir;
u_long b, *fields, fields_size;
toff_t directory_offset;
TIFFFieldInfo* fip;
/*
* Deleted out all of the encoder flushing and such code from here -
* not necessary for subdirectories.
*/
/* Finish writing out any image data. */
TIFFFlushData(tif);
/*
* Size the directory so that we can calculate
* offsets for the data items that aren't kept
* in-place in each field.
*/
nfields = 0;
for (b = 0; b <= pdir_fields_last; b++)
if (FieldSet(pdir_fieldsset, b))
/* Deleted code to make size of first 4 tags 2
instead of 1. */
nfields += 1;
dirsize = nfields * sizeof (TIFFDirEntry);
data = (char*) _TIFFmalloc(dirsize);
if (data == NULL) {
TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
"Cannot write private subdirectory, out of space");
return (0);
}
/*
* Place directory in data section of the file. If there isn't one
* yet, place it at the end of the file. The directory is treated as
* data, so we don't link it into the directory structure at all.
*/
if (tif->tif_dataoff == 0)
tif->tif_dataoff =(TIFFSeekFile(tif, (toff_t) 0, SEEK_END)+1) &~ 1;
diroff = tif->tif_dataoff;
tif->tif_dataoff = (toff_t)(
diroff + sizeof (uint16) + dirsize + sizeof (toff_t));
if (tif->tif_dataoff & 1)
tif->tif_dataoff++;
(void) TIFFSeekFile(tif, tif->tif_dataoff, SEEK_SET);
/*tif->tif_curdir++;*/
dir = (TIFFDirEntry*) data;
/*
* Setup external form of directory
* entries and write data items.
*/
/*
* We make a local copy of the fieldsset here so that we don't mess
* up the original one when we call ResetFieldBit(). But I'm not sure
* why the original code calls ResetFieldBit(), since we're already
* going through the fields in order...
*
* fields_size is the number of uint32's we will need to hold the
* bit-mask for all of the fields. If our highest field number is
* 100, then we'll need 100 / (8*4)+1 == 4 uint32's to hold the
* fieldset.
*
* Unlike the original code, we allocate fields dynamically based
* on the requested pdir_fields_last value, allowing private
* data subdirectories to contain more than the built-in code's limit
* of 95 tags in a directory.
*/
fields_size = pdir_fields_last / (8*sizeof(uint32)) + 1;
fields = _TIFFmalloc(fields_size*sizeof(uint32));
_TIFFmemcpy(fields, pdir_fieldsset, fields_size * sizeof(uint32));
/* Deleted "write out extra samples tag" code here. */
/* Deleted code for checking a billion little special cases for the
* standard TIFF tags. Should add a general mechanism for overloading
* write function for each field, just like Brian kept telling me!!!
*/
for (fip = field_info; fip->field_tag; fip++) {
/* Deleted code to check for FIELD_IGNORE!! */
if (/* fip->field_bit == FIELD_IGNORE || */
!FieldSet(fields, fip->field_bit))
continue;
if (!TIFFWriteNormalSubTag(tif, dir, fip, getFieldFn))
goto bad;
dir++;
ResetFieldBit(fields, fip->field_bit);
}
/* Now we've written all of the referenced data, and are about to
write the main directory structure, so grab the tif_dataoff value
now so we can remember where we wrote the directory. */
directory_offset = tif->tif_dataoff;
/*
* Write directory.
*/
dircount = (uint16) nfields;
/* Deleted code to link to the next directory - we set it to zero! */
nextdiroff = 0;
if (tif->tif_flags & TIFF_SWAB) {
/*
* The file's byte order is opposite to the
* native machine architecture. We overwrite
* the directory information with impunity
* because it'll be released below after we
* write it to the file. Note that all the
* other tag construction routines assume that
* we do this byte-swapping; i.e. they only
* byte-swap indirect data.
*/
for (dir = (TIFFDirEntry*) data; dircount; dir++, dircount--) {
TIFFSwabArrayOfShort(&dir->tdir_tag, 2);
TIFFSwabArrayOfLong(&dir->tdir_count, 2);
}
dircount = (uint16) nfields;
TIFFSwabShort(&dircount);
TIFFSwabLong(&nextdiroff);
}
(void) TIFFSeekFile(tif, tif->tif_dataoff, SEEK_SET);
if (!WriteOK(tif, &dircount, sizeof (dircount))) {
TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Error writing private subdirectory count");
goto bad;
}
if (!WriteOK(tif, data, dirsize)) {
TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Error writing private subdirectory contents");
goto bad;
}
if (!WriteOK(tif, &nextdiroff, sizeof (nextdiroff))) {
TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Error writing private subdirectory link");
goto bad;
}
tif->tif_dataoff += sizeof(dircount) + dirsize + sizeof(nextdiroff);
_TIFFfree(data);
_TIFFfree(fields);
tif->tif_flags &= ~TIFF_DIRTYDIRECT;
#if (0)
/* This stuff commented out because I don't think we want it for
subdirectories, but I could be wrong. */
(*tif->tif_cleanup)(tif);
/*
* Reset directory-related state for subsequent
* directories.
*/
TIFFDefaultDirectory(tif);
tif->tif_curoff = 0;
tif->tif_row = (uint32) -1;
tif->tif_curstrip = (tstrip_t) -1;
#endif
return (directory_offset);
bad:
_TIFFfree(data);
_TIFFfree(fields);
return (0);
}
#undef WriteRationalPair
/*
* Process tags that are not special cased.
*/
/* The standard function TIFFWriteNormalTag() could definitely be replaced
with a simple call to this function, just adding TIFFGetField() as the
last argument. */
static int
TIFFWriteNormalSubTag(TIFF* tif, TIFFDirEntry* dir, const TIFFFieldInfo* fip,
int (*getFieldFn)(TIFF *tif, ttag_t tag, ...))
{
u_short wc = (u_short) fip->field_writecount;
dir->tdir_tag = fip->field_tag;
dir->tdir_type = (u_short) fip->field_type;
dir->tdir_count = wc;
#define WRITEF(x,y) x(tif, fip->field_type, fip->field_tag, dir, wc, y)
switch (fip->field_type) {
case TIFF_SHORT:
case TIFF_SSHORT:
if (wc > 1) {
uint16* wp;
if (wc == (u_short) TIFF_VARIABLE) {
(*getFieldFn)(tif, fip->field_tag, &wc, &wp);
dir->tdir_count = wc;
} else
(*getFieldFn)(tif, fip->field_tag, &wp);
if (!WRITEF(TIFFWriteShortArray, wp))
return (0);
} else {
uint16 sv;
(*getFieldFn)(tif, fip->field_tag, &sv);
dir->tdir_offset =
TIFFInsertData(tif, dir->tdir_type, sv);
}
break;
case TIFF_LONG:
case TIFF_SLONG:
if (wc > 1) {
uint32* lp;
if (wc == (u_short) TIFF_VARIABLE) {
(*getFieldFn)(tif, fip->field_tag, &wc, &lp);
dir->tdir_count = wc;
} else
(*getFieldFn)(tif, fip->field_tag, &lp);
if (!WRITEF(TIFFWriteLongArray, lp))
return (0);
} else {
/* XXX handle LONG->SHORT conversion */
(*getFieldFn)(tif, fip->field_tag, &dir->tdir_offset);
}
break;
case TIFF_RATIONAL:
case TIFF_SRATIONAL:
if (wc > 1) {
float* fp;
if (wc == (u_short) TIFF_VARIABLE) {
(*getFieldFn)(tif, fip->field_tag, &wc, &fp);
dir->tdir_count = wc;
} else
(*getFieldFn)(tif, fip->field_tag, &fp);
if (!WRITEF(TIFFWriteRationalArray, fp))
return (0);
} else {
float fv;
(*getFieldFn)(tif, fip->field_tag, &fv);
if (!WRITEF(TIFFWriteRationalArray, &fv))
return (0);
}
break;
case TIFF_FLOAT:
if (wc > 1) {
float* fp;
if (wc == (u_short) TIFF_VARIABLE) {
(*getFieldFn)(tif, fip->field_tag, &wc, &fp);
dir->tdir_count = wc;
} else
(*getFieldFn)(tif, fip->field_tag, &fp);
if (!WRITEF(TIFFWriteFloatArray, fp))
return (0);
} else {
float fv;
(*getFieldFn)(tif, fip->field_tag, &fv);
if (!WRITEF(TIFFWriteFloatArray, &fv))
return (0);
}
break;
case TIFF_DOUBLE:
/* Hey - I think this is a bug, or at least a "gross
inconsistency", in the TIFF library. Look at the original
TIFF library code below within the "#if (0) ... #else".
Just from the type of *dp, you can see that this code
expects TIFFGetField() to be handed a double ** for
any TIFF_DOUBLE tag, even for the constant wc==1 case.
This is totally inconsistent with other fields (like
TIFF_FLOAT, above) and is also inconsistent with the
TIFFSetField() function for TIFF_DOUBLEs, which expects
to be passed a single double by value for the wc==1 case.
(See the handling of TIFFFetchNormalTag() in tif_dirread.c
for an example.) Maybe this function was written before
TIFFWriteDoubleArray() was written, not that that's an
excuse. Anyway, the new code below is a trivial modification
of the TIFF_FLOAT code above. The fact that even single
doubles get written out in the data segment and get an
offset value stored is irrelevant here - that is all
handled by TIFFWriteDoubleArray(). */
#if (0)
{ double* dp;
if (wc == (u_short) TIFF_VARIABLE) {
(*getFieldFn)(tif, fip->field_tag, &wc, &dp);
dir->tdir_count = wc;
} else
(*getFieldFn)(tif, fip->field_tag, &dp);
TIFFCvtNativeToIEEEDouble(tif, wc, dp);
if (!TIFFWriteData(tif, dir, (char*) dp))
return (0);
}
#else
if (wc > 1) {
double* dp;
if (wc == (u_short) TIFF_VARIABLE) {
(*getFieldFn)(tif, fip->field_tag, &wc, &dp);
dir->tdir_count = wc;
} else
(*getFieldFn)(tif, fip->field_tag, &dp);
if (!WRITEF(TIFFWriteDoubleArray, dp))
return (0);
} else {
double dv;
(*getFieldFn)(tif, fip->field_tag, &dv);
if (!WRITEF(TIFFWriteDoubleArray, &dv))
return (0);
}
#endif
break;
case TIFF_ASCII:
{ char* cp;
(*getFieldFn)(tif, fip->field_tag, &cp);
dir->tdir_count = (uint32) (strlen(cp) + 1);
if (!TIFFWriteByteArray(tif, dir, cp))
return (0);
}
break;
case TIFF_UNDEFINED:
{ char* cp;
if (wc == (u_short) TIFF_VARIABLE) {
(*getFieldFn)(tif, fip->field_tag, &wc, &cp);
dir->tdir_count = wc;
} else
(*getFieldFn)(tif, fip->field_tag, &cp);
if (!TIFFWriteByteArray(tif, dir, cp))
return (0);
}
break;
}
return (1);
}
#undef WRITEF
/* Everything after this is exactly duplicated from the standard tif_dirwrite.c
file, necessitated by the fact that they are declared static there so
we can't call them!
*/
/*
* Setup a directory entry with either a SHORT
* or LONG type according to the value.
*/
static void
TIFFSetupShortLong(TIFF* tif, ttag_t tag, TIFFDirEntry* dir, uint32 v)
{
dir->tdir_tag = tag;
dir->tdir_count = 1;
if (v > 0xffffL) {
dir->tdir_type = (short) TIFF_LONG;
dir->tdir_offset = v;
} else {
dir->tdir_type = (short) TIFF_SHORT;
dir->tdir_offset = TIFFInsertData(tif, (int) TIFF_SHORT, v);
}
}
#undef MakeShortDirent
#ifndef TIFFWriteRational
/*
* Setup a RATIONAL directory entry and
* write the associated indirect value.
*/
static int
TIFFWriteRational(TIFF* tif,
TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, float v)
{
return (TIFFWriteRationalArray(tif, type, tag, dir, 1, &v));
}
#endif
#define NITEMS(x) (sizeof (x) / sizeof (x[0]))
/*
* Setup a directory entry that references a
* samples/pixel array of SHORT values and
* (potentially) write the associated indirect
* values.
*/
static int
TIFFWritePerSampleShorts(TIFF* tif, ttag_t tag, TIFFDirEntry* dir)
{
uint16 buf[10], v;
uint16* w = buf;
int i, status, samples = tif->tif_dir.td_samplesperpixel;
if (samples > NITEMS(buf))
w = (uint16*) _TIFFmalloc(samples * sizeof (uint16));
TIFFGetField(tif, tag, &v);
for (i = 0; i < samples; i++)
w[i] = v;
status = TIFFWriteShortArray(tif, TIFF_SHORT, tag, dir, samples, w);
if (w != buf)
_TIFFfree((char*) w);
return (status);
}
/*
* Setup a directory entry that references a samples/pixel array of ``type''
* values and (potentially) write the associated indirect values. The source
* data from TIFFGetField() for the specified tag must be returned as double.
*/
static int
TIFFWritePerSampleAnys(TIFF* tif,
TIFFDataType type, ttag_t tag, TIFFDirEntry* dir)
{
double buf[10], v;
double* w = buf;
int i, status;
int samples = (int) tif->tif_dir.td_samplesperpixel;
if (samples > NITEMS(buf))
w = (double*) _TIFFmalloc(samples * sizeof (double));
TIFFGetField(tif, tag, &v);
for (i = 0; i < samples; i++)
w[i] = v;
status = TIFFWriteAnyArray(tif, type, tag, dir, samples, w);
if (w != buf)
_TIFFfree(w);
return (status);
}
#undef NITEMS
/*
* Setup a pair of shorts that are returned by
* value, rather than as a reference to an array.
*/
static int
TIFFSetupShortPair(TIFF* tif, ttag_t tag, TIFFDirEntry* dir)
{
uint16 v[2];
TIFFGetField(tif, tag, &v[0], &v[1]);
return (TIFFWriteShortArray(tif, TIFF_SHORT, tag, dir, 2, v));
}
/*
* Setup a directory entry for an NxM table of shorts,
* where M is known to be 2**bitspersample, and write
* the associated indirect data.
*/
static int
TIFFWriteShortTable(TIFF* tif,
ttag_t tag, TIFFDirEntry* dir, uint32 n, uint16** table)
{
uint32 i, off;
dir->tdir_tag = tag;
dir->tdir_type = (short) TIFF_SHORT;
/* XXX -- yech, fool TIFFWriteData */
dir->tdir_count = (uint32) (1L<<tif->tif_dir.td_bitspersample);
off = tif->tif_dataoff;
for (i = 0; i < n; i++)
if (!TIFFWriteData(tif, dir, (char *)table[i]))
return (0);
dir->tdir_count *= n;
dir->tdir_offset = off;
return (1);
}
/*
* Write/copy data associated with an ASCII or opaque tag value.
*/
static int
TIFFWriteByteArray(TIFF* tif, TIFFDirEntry* dir, char* cp)
{
if (dir->tdir_count > 4) {
if (!TIFFWriteData(tif, dir, cp))
return (0);
} else
_TIFFmemcpy(&dir->tdir_offset, cp, dir->tdir_count);
return (1);
}
/*
* Setup a directory entry of an array of SHORT
* or SSHORT and write the associated indirect values.
*/
static int
TIFFWriteShortArray(TIFF* tif,
TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32 n, uint16* v)
{
dir->tdir_tag = tag;
dir->tdir_type = (short) type;
dir->tdir_count = n;
if (n <= 2) {
if (tif->tif_header.tiff_magic == TIFF_BIGENDIAN) {
dir->tdir_offset = (uint32) ((long) v[0] << 16);
if (n == 2)
dir->tdir_offset |= v[1] & 0xffff;
} else {
dir->tdir_offset = v[0] & 0xffff;
if (n == 2)
dir->tdir_offset |= (long) v[1] << 16;
}
return (1);
} else
return (TIFFWriteData(tif, dir, (char*) v));
}
/*
* Setup a directory entry of an array of LONG
* or SLONG and write the associated indirect values.
*/
static int
TIFFWriteLongArray(TIFF* tif,
TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32 n, uint32* v)
{
dir->tdir_tag = tag;
dir->tdir_type = (short) type;
dir->tdir_count = n;
if (n == 1) {
dir->tdir_offset = v[0];
return (1);
} else
return (TIFFWriteData(tif, dir, (char*) v));
}
/*
* Setup a directory entry of an array of RATIONAL
* or SRATIONAL and write the associated indirect values.
*/
static int
TIFFWriteRationalArray(TIFF* tif,
TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32 n, float* v)
{
uint32 i;
uint32* t;
int status;
dir->tdir_tag = tag;
dir->tdir_type = (short) type;
dir->tdir_count = n;
t = (uint32*) _TIFFmalloc(2*n * sizeof (uint32));
for (i = 0; i < n; i++) {
float fv = v[i];
int sign = 1;
uint32 den;
if (fv < 0) {
if (type == TIFF_RATIONAL) {
TIFFWarning(tif->tif_name,
"\"%s\": Information lost writing value (%g) as (unsigned) RATIONAL",
_TIFFFieldWithTag(tif,tag)->field_name, v);
fv = 0;
} else
fv = -fv, sign = -1;
}
den = 1L;
if (fv > 0) {
while (fv < 1L<<(31-3) && den < 1L<<(31-3))
fv *= 1<<3, den *= 1L<<3;
}
t[2*i+0] = sign * (fv + 0.5);
t[2*i+1] = den;
}
status = TIFFWriteData(tif, dir, (char *)t);
_TIFFfree((char*) t);
return (status);
}
static int
TIFFWriteFloatArray(TIFF* tif,
TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32 n, float* v)
{
dir->tdir_tag = tag;
dir->tdir_type = (short) type;
dir->tdir_count = n;
TIFFCvtNativeToIEEEFloat(tif, n, v);
if (n == 1) {
dir->tdir_offset = *(uint32*) &v[0];
return (1);
} else
return (TIFFWriteData(tif, dir, (char*) v));
}
static int
TIFFWriteDoubleArray(TIFF* tif,
TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32 n, double* v)
{
dir->tdir_tag = tag;
dir->tdir_type = (short) type;
dir->tdir_count = n;
TIFFCvtNativeToIEEEDouble(tif, n, v);
return (TIFFWriteData(tif, dir, (char*) v));
}
/*
* Write an array of ``type'' values for a specified tag (i.e. this is a tag
* which is allowed to have different types, e.g. SMaxSampleType).
* Internally the data values are represented as double since a double can
* hold any of the TIFF tag types (yes, this should really be an abstract
* type tany_t for portability). The data is converted into the specified
* type in a temporary buffer and then handed off to the appropriate array
* writer.
*/
static int
TIFFWriteAnyArray(TIFF* tif,
TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32 n, double* v)
{
char buf[10 * sizeof(double)];
char* w = buf;
int i, status = 0;
if (n * TIFFDataWidth(type) > sizeof buf)
w = (char*) _TIFFmalloc(n * TIFFDataWidth(type));
switch (type) {
case TIFF_BYTE:
{ unsigned char* bp = (unsigned char*) w;
for (i = 0; i < n; i++)
bp[i] = (unsigned char) v[i];
dir->tdir_tag = tag;
dir->tdir_type = (short) type;
dir->tdir_count = n;
if (!TIFFWriteByteArray(tif, dir, (char*) bp))
goto out;
}
break;
case TIFF_SBYTE:
{ signed char* bp = (signed char*) w;
for (i = 0; i < n; i++)
bp[i] = (signed char) v[i];
dir->tdir_tag = tag;
dir->tdir_type = (short) type;
dir->tdir_count = n;
if (!TIFFWriteByteArray(tif, dir, (char*) bp))
goto out;
}
break;
case TIFF_SHORT:
{ uint16* bp = (uint16*) w;
for (i = 0; i < n; i++)
bp[i] = (uint16) v[i];
if (!TIFFWriteShortArray(tif, type, tag, dir, n, (uint16*)bp))
goto out;
}
break;
case TIFF_SSHORT:
{ int16* bp = (int16*) w;
for (i = 0; i < n; i++)
bp[i] = (int16) v[i];
if (!TIFFWriteShortArray(tif, type, tag, dir, n, (uint16*)bp))
goto out;
}
break;
case TIFF_LONG:
{ uint32* bp = (uint32*) w;
for (i = 0; i < n; i++)
bp[i] = (uint32) v[i];
if (!TIFFWriteLongArray(tif, type, tag, dir, n, bp))
goto out;
}
break;
case TIFF_SLONG:
{ int32* bp = (int32*) w;
for (i = 0; i < n; i++)
bp[i] = (int32) v[i];
if (!TIFFWriteLongArray(tif, type, tag, dir, n, (uint32*) bp))
goto out;
}
break;
case TIFF_FLOAT:
{ float* bp = (float*) w;
for (i = 0; i < n; i++)
bp[i] = (float) v[i];
if (!TIFFWriteFloatArray(tif, type, tag, dir, n, bp))
goto out;
}
break;
case TIFF_DOUBLE:
return (TIFFWriteDoubleArray(tif, type, tag, dir, n, v));
default:
/* TIFF_NOTYPE */
/* TIFF_ASCII */
/* TIFF_UNDEFINED */
/* TIFF_RATIONAL */
/* TIFF_SRATIONAL */
goto out;
}
status = 1;
out:
if (w != buf)
_TIFFfree(w);
return (status);
}
#ifdef COLORIMETRY_SUPPORT
static int
TIFFWriteTransferFunction(TIFF* tif, TIFFDirEntry* dir)
{
TIFFDirectory* td = &tif->tif_dir;
tsize_t n = (1L<<td->td_bitspersample) * sizeof (uint16);
uint16** tf = td->td_transferfunction;
int ncols;
/*
* Check if the table can be written as a single column,
* or if it must be written as 3 columns. Note that we
* write a 3-column tag if there are 2 samples/pixel and
* a single column of data won't suffice--hmm.
*/
switch (td->td_samplesperpixel - td->td_extrasamples) {
default: if (_TIFFmemcmp(tf[0], tf[2], n)) { ncols = 3; break; }
case 2: if (_TIFFmemcmp(tf[0], tf[1], n)) { ncols = 3; break; }
case 1: case 0: ncols = 1;
}
return (TIFFWriteShortTable(tif,
TIFFTAG_TRANSFERFUNCTION, dir, ncols, tf));
}
#endif
/*
* Write a contiguous directory item.
*/
static int
TIFFWriteData(TIFF* tif, TIFFDirEntry* dir, char* cp)
{
tsize_t cc;
if (tif->tif_flags & TIFF_SWAB) {
switch (dir->tdir_type) {
case TIFF_SHORT:
case TIFF_SSHORT:
TIFFSwabArrayOfShort((uint16*) cp, dir->tdir_count);
break;
case TIFF_LONG:
case TIFF_SLONG:
case TIFF_FLOAT:
TIFFSwabArrayOfLong((uint32*) cp, dir->tdir_count);
break;
case TIFF_RATIONAL:
case TIFF_SRATIONAL:
TIFFSwabArrayOfLong((uint32*) cp, 2*dir->tdir_count);
break;
case TIFF_DOUBLE:
TIFFSwabArrayOfDouble((double*) cp, dir->tdir_count);
break;
}
}
dir->tdir_offset = tif->tif_dataoff;
cc = dir->tdir_count * TIFFDataWidth(dir->tdir_type);
if (SeekOK(tif, dir->tdir_offset) &&
WriteOK(tif, cp, cc)) {
tif->tif_dataoff += (cc + 1) & ~1;
return (1);
}
TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Error writing data for field \"%s\"",
_TIFFFieldWithTag(tif, dir->tdir_tag)->field_name);
return (0);
}
/*
* Link the current directory into the
* directory chain for the file.
*/
static int
TIFFLinkDirectory(TIFF* tif)
{
static const char module[] = "TIFFLinkDirectory";
uint32 nextdir;
uint32 diroff;
tif->tif_diroff = (TIFFSeekFile(tif, (toff_t) 0, SEEK_END)+1) &~ 1;
diroff = (uint32) tif->tif_diroff;
if (tif->tif_flags & TIFF_SWAB)
TIFFSwabLong(&diroff);
#if SUBIFD_SUPPORT
if (tif->tif_flags & TIFF_INSUBIFD) {
(void) TIFFSeekFile(tif, tif->tif_subifdoff, SEEK_SET);
if (!WriteOK(tif, &diroff, sizeof (diroff))) {
TIFFErrorExt(tif->tif_clientdata, module,
"%s: Error writing SubIFD directory link",
tif->tif_name);
return (0);
}
/*
* Advance to the next SubIFD or, if this is
* the last one configured, revert back to the
* normal directory linkage.
*/
if (--tif->tif_nsubifd)
tif->tif_subifdoff += sizeof (diroff);
else
tif->tif_flags &= ~TIFF_INSUBIFD;
return (1);
}
#endif
if (tif->tif_header.tiff_diroff == 0) {
/*
* First directory, overwrite offset in header.
*/
tif->tif_header.tiff_diroff = (uint32) tif->tif_diroff;
#define HDROFF(f) ((toff_t) &(((TIFFHeader*) 0)->f))
(void) TIFFSeekFile(tif, HDROFF(tiff_diroff), SEEK_SET);
if (!WriteOK(tif, &diroff, sizeof (diroff))) {
TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "Error writing TIFF header");
return (0);
}
return (1);
}
/*
* Not the first directory, search to the last and append.
*/
nextdir = tif->tif_header.tiff_diroff;
do {
uint16 dircount;
if (!SeekOK(tif, nextdir) ||
!ReadOK(tif, &dircount, sizeof (dircount))) {
TIFFErrorExt(tif->tif_clientdata, module, "Error fetching directory count");
return (0);
}
if (tif->tif_flags & TIFF_SWAB)
TIFFSwabShort(&dircount);
(void) TIFFSeekFile(tif,
dircount * sizeof (TIFFDirEntry), SEEK_CUR);
if (!ReadOK(tif, &nextdir, sizeof (nextdir))) {
TIFFErrorExt(tif->tif_clientdata, module, "Error fetching directory link");
return (0);
}
if (tif->tif_flags & TIFF_SWAB)
TIFFSwabLong(&nextdir);
} while (nextdir != 0);
(void) TIFFSeekFile(tif, -(toff_t) sizeof (nextdir), SEEK_CUR);
if (!WriteOK(tif, &diroff, sizeof (diroff))) {
TIFFErrorExt(tif->tif_clientdata, module, "Error writing directory link");
return (0);
}
return (1);
}
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/

View File

@ -1,27 +0,0 @@
# Tag Image File Format (TIFF) Software
#
# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# Process this file with automake to produce Makefile.in.
EXTRA_DIST = README ras2tif.c tif2ras.c

View File

@ -1,10 +0,0 @@
Sun May 19 22:28:16 PDT 1991
These programs are from Patrick Naughton (naughton@wind.sun.com).
I've tried to update them to reflect changes to the library, but
I am unable to verify that they operate properly, because they
require the Sun pixrect library.
Please contact Patrick directly if you have questions/problems.
Sam

View File

@ -1,254 +0,0 @@
#ifndef lint
static char sccsid[] = "@(#)ras2tif.c 1.2 90/03/06";
#endif
/*-
* ras2tif.c - Converts from a Sun Rasterfile to a Tagged Image File.
*
* Copyright (c) 1990 by Sun Microsystems, Inc.
*
* Author: Patrick J. Naughton
* naughton@wind.sun.com
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* both that copyright notice and this permission notice appear in
* supporting documentation.
*
* This file is provided AS IS with no warranties of any kind. The author
* shall have no liability with respect to the infringement of copyrights,
* trade secrets or any patents by this file or any part thereof. In no
* event will the author be liable for any lost revenue or profits or
* other special, indirect and consequential damages.
*
* Comments and additions should be sent to the author:
*
* Patrick J. Naughton
* Sun Microsystems
* 2550 Garcia Ave, MS 14-40
* Mountain View, CA 94043
* (415) 336-1080
*
* Revision History:
* 11-Jan-89: Created.
* 06-Mar-90: fix bug in SCALE() macro.
* got rid of xres and yres, (they weren't working anyways).
* fixed bpsl calculation.
* 25-Nov-99: y2k fix (year as 1900 + tm_year) <mike@onshore.com>
*
* Description:
* This program takes a Sun Rasterfile [see rasterfile(5)] as input and
* writes a MicroSoft/Aldus "Tagged Image File Format" image or "TIFF" file.
* The input file may be standard input, but the output TIFF file must be a
* real file since seek(2) is used.
*/
#include <stdio.h>
#include <sys/time.h>
#include <pixrect/pixrect_hs.h>
#include "tiffio.h"
typedef int boolean;
#define True (1)
#define False (0)
#define SCALE(x) (((x)*((1L<<16)-1))/255)
boolean Verbose = False;
boolean dummyinput = False;
char *pname; /* program name (used for error messages) */
void
error(s1, s2)
char *s1,
*s2;
{
fprintf(stderr, s1, pname, s2);
exit(1);
}
void
usage()
{
error("usage: %s -[vq] [-|rasterfile] TIFFfile\n", NULL);
}
main(argc, argv)
int argc;
char *argv[];
{
char *inf = NULL;
char *outf = NULL;
FILE *fp;
int depth,
i;
long row;
TIFF *tif;
Pixrect *pix; /* The Sun Pixrect */
colormap_t Colormap; /* The Pixrect Colormap */
u_short red[256],
green[256],
blue[256];
struct tm *ct;
struct timeval tv;
long width,
height;
long rowsperstrip;
int year;
short photometric;
short samplesperpixel;
short bitspersample;
int bpsl;
static char *version = "ras2tif 1.0";
static char *datetime = "1990:01:01 12:00:00";
gettimeofday(&tv, (struct timezone *) NULL);
ct = localtime(&tv.tv_sec);
year=1900 + ct->tm_year;
sprintf(datetime, "%04d:%02d:%02d %02d:%02d:%02d",
year, ct->tm_mon + 1, ct->tm_mday,
ct->tm_hour, ct->tm_min, ct->tm_sec);
setbuf(stderr, NULL);
pname = argv[0];
while (--argc) {
if ((++argv)[0][0] == '-') {
switch (argv[0][1]) {
case 'v':
Verbose = True;
break;
case 'q':
usage();
break;
case '\0':
if (inf == NULL)
dummyinput = True;
else
usage();
break;
default:
fprintf(stderr, "%s: illegal option -%c.\n", pname,
argv[0][1]);
exit(1);
}
} else if (inf == NULL && !dummyinput) {
inf = argv[0];
} else if (outf == NULL)
outf = argv[0];
else
usage();
}
if (outf == NULL)
error("%s: can't write output file to a stream.\n", NULL);
if (dummyinput || inf == NULL) {
inf = "Standard Input";
fp = stdin;
} else if ((fp = fopen(inf, "r")) == NULL)
error("%s: %s couldn't be opened.\n", inf);
if (Verbose)
fprintf(stderr, "Reading rasterfile from %s...", inf);
pix = pr_load(fp, &Colormap);
if (pix == NULL)
error("%s: %s is not a raster file.\n", inf);
if (Verbose)
fprintf(stderr, "done.\n");
if (Verbose)
fprintf(stderr, "Writing %s...", outf);
tif = TIFFOpen(outf, "w");
if (tif == NULL)
error("%s: error opening TIFF file %s", outf);
width = pix->pr_width;
height = pix->pr_height;
depth = pix->pr_depth;
switch (depth) {
case 1:
samplesperpixel = 1;
bitspersample = 1;
photometric = PHOTOMETRIC_MINISBLACK;
break;
case 8:
samplesperpixel = 1;
bitspersample = 8;
photometric = PHOTOMETRIC_PALETTE;
break;
case 24:
samplesperpixel = 3;
bitspersample = 8;
photometric = PHOTOMETRIC_RGB;
break;
case 32:
samplesperpixel = 4;
bitspersample = 8;
photometric = PHOTOMETRIC_RGB;
break;
default:
error("%s: bogus depth: %d\n", depth);
}
bpsl = ((depth * width + 15) >> 3) & ~1;
rowsperstrip = (8 * 1024) / bpsl;
TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, width);
TIFFSetField(tif, TIFFTAG_IMAGELENGTH, height);
TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, bitspersample);
TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_LZW);
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, photometric);
TIFFSetField(tif, TIFFTAG_DOCUMENTNAME, inf);
TIFFSetField(tif, TIFFTAG_IMAGEDESCRIPTION, "converted Sun rasterfile");
TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, samplesperpixel);
TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
TIFFSetField(tif, TIFFTAG_STRIPBYTECOUNTS, height / rowsperstrip);
TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
TIFFSetField(tif, TIFFTAG_SOFTWARE, version);
TIFFSetField(tif, TIFFTAG_DATETIME, datetime);
memset(red, 0, sizeof(red));
memset(green, 0, sizeof(green));
memset(blue, 0, sizeof(blue));
if (depth == 8) {
TIFFSetField(tif, TIFFTAG_COLORMAP, red, green, blue);
for (i = 0; i < Colormap.length; i++) {
red[i] = SCALE(Colormap.map[0][i]);
green[i] = SCALE(Colormap.map[1][i]);
blue[i] = SCALE(Colormap.map[2][i]);
}
}
if (Verbose)
fprintf(stderr, "%dx%dx%d image, ", width, height, depth);
for (row = 0; row < height; row++)
if (TIFFWriteScanline(tif,
(u_char *) mprd_addr(mpr_d(pix), 0, row),
row, 0) < 0) {
fprintf("failed a scanline write (%d)\n", row);
break;
}
TIFFFlushData(tif);
TIFFClose(tif);
if (Verbose)
fprintf(stderr, "done.\n");
pr_destroy(pix);
exit(0);
}
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/

View File

@ -1,344 +0,0 @@
#ifndef lint
static char id[] = "$Id: tif2ras.c,v 1.3 2010-06-08 18:55:15 bfriesen Exp $";
#endif
/*-
* tif2ras.c - Converts from a Tagged Image File Format image to a Sun Raster.
*
* Copyright (c) 1990 by Sun Microsystems, Inc.
*
* Author: Patrick J. Naughton
* naughton@wind.sun.com
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* both that copyright notice and this permission notice appear in
* supporting documentation.
*
* This file is provided AS IS with no warranties of any kind. The author
* shall have no liability with respect to the infringement of copyrights,
* trade secrets or any patents by this file or any part thereof. In no
* event will the author be liable for any lost revenue or profits or
* other special, indirect and consequential damages.
*
* Comments and additions should be sent to the author:
*
* Patrick J. Naughton
* Sun Microsystems
* 2550 Garcia Ave, MS 14-40
* Mountain View, CA 94043
* (415) 336-1080
*
* Revision History:
* 10-Jan-89: Created.
* 06-Mar-90: Change to byte encoded rasterfiles.
* fix bug in call to ReadScanline().
* fix bug in CVT() macro.
* fix assignment of td, (missing &).
*
* Description:
* This program takes a MicroSoft/Aldus "Tagged Image File Format" image or
* "TIFF" file as input and writes a Sun Rasterfile [see rasterfile(5)]. The
* output file may be standard output, but the input TIFF file must be a real
* file since seek(2) is used.
*/
#include <stdio.h>
#include <pixrect/pixrect_hs.h>
#include "tiffio.h"
typedef int boolean;
#define True (1)
#define False (0)
#define CVT(x) (((x) * 255) / ((1L<<16)-1))
boolean Verbose = False;
char *pname; /* program name (used for error messages) */
void
error(s1, s2)
char *s1,
*s2;
{
fprintf(stderr, s1, pname, s2);
exit(1);
}
void
usage()
{
error("usage: %s -[vq] TIFFfile [rasterfile]\n", NULL);
}
main(argc, argv)
int argc;
char *argv[];
{
char *inf = NULL;
char *outf = NULL;
FILE *fp;
long width,
height;
int depth,
numcolors;
register TIFF *tif;
TIFFDirectory *td;
register u_char *inp,
*outp;
register int col,
i;
register long row;
u_char *Map = NULL;
u_char *buf;
short bitspersample;
short samplesperpixel;
short photometric;
u_short *redcolormap,
*bluecolormap,
*greencolormap;
Pixrect *pix; /* The Sun Pixrect */
colormap_t Colormap; /* The Pixrect Colormap */
u_char red[256],
green[256],
blue[256];
setbuf(stderr, NULL);
pname = argv[0];
while (--argc) {
if ((++argv)[0][0] == '-')
switch (argv[0][1]) {
case 'v':
Verbose = True;
break;
case 'q':
usage();
break;
default:
fprintf(stderr, "%s: illegal option -%c.\n", pname,
argv[0][1]);
exit(1);
}
else if (inf == NULL)
inf = argv[0];
else if (outf == NULL)
outf = argv[0];
else
usage();
}
if (inf == NULL)
error("%s: can't read input file from a stream.\n", NULL);
if (Verbose)
fprintf(stderr, "Reading %s...", inf);
tif = TIFFOpen(inf, "r");
if (tif == NULL)
error("%s: error opening TIFF file %s", inf);
if (Verbose)
TIFFPrintDirectory(tif, stderr, True, False, False);
TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &bitspersample);
if (bitspersample > 8)
error("%s: can't handle more than 8-bits per sample\n", NULL);
TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &samplesperpixel);
switch (samplesperpixel) {
case 1:
if (bitspersample == 1)
depth = 1;
else
depth = 8;
break;
case 3:
case 4:
depth = 24;
break;
default:
error("%s: only handle 1-channel gray scale or 3-channel color\n");
}
TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &width);
TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &height);
if (Verbose)
fprintf(stderr, "%dx%dx%d image, ", width, height, depth);
if (Verbose)
fprintf(stderr, "%d bits/sample, %d samples/pixel, ",
bitspersample, samplesperpixel);
pix = mem_create(width, height, depth);
if (pix == (Pixrect *) NULL)
error("%s: can't allocate memory for output pixrect...\n", NULL);
numcolors = (1 << bitspersample);
TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &photometric);
if (numcolors == 2) {
if (Verbose)
fprintf(stderr, "monochrome ");
Colormap.type = RMT_NONE;
Colormap.length = 0;
Colormap.map[0] = Colormap.map[1] = Colormap.map[2] = NULL;
} else {
switch (photometric) {
case PHOTOMETRIC_MINISBLACK:
if (Verbose)
fprintf(stderr, "%d graylevels (min=black), ", numcolors);
Map = (u_char *) malloc(numcolors * sizeof(u_char));
for (i = 0; i < numcolors; i++)
Map[i] = (255 * i) / numcolors;
Colormap.type = RMT_EQUAL_RGB;
Colormap.length = numcolors;
Colormap.map[0] = Colormap.map[1] = Colormap.map[2] = Map;
break;
case PHOTOMETRIC_MINISWHITE:
if (Verbose)
fprintf(stderr, "%d graylevels (min=white), ", numcolors);
Map = (u_char *) malloc(numcolors * sizeof(u_char));
for (i = 0; i < numcolors; i++)
Map[i] = 255 - ((255 * i) / numcolors);
Colormap.type = RMT_EQUAL_RGB;
Colormap.length = numcolors;
Colormap.map[0] = Colormap.map[1] = Colormap.map[2] = Map;
break;
case PHOTOMETRIC_RGB:
if (Verbose)
fprintf(stderr, "truecolor ");
Colormap.type = RMT_NONE;
Colormap.length = 0;
Colormap.map[0] = Colormap.map[1] = Colormap.map[2] = NULL;
break;
case PHOTOMETRIC_PALETTE:
if (Verbose)
fprintf(stderr, "colormapped ");
Colormap.type = RMT_EQUAL_RGB;
Colormap.length = numcolors;
memset(red, 0, sizeof(red));
memset(green, 0, sizeof(green));
memset(blue, 0, sizeof(blue));
TIFFGetField(tif, TIFFTAG_COLORMAP,
&redcolormap, &greencolormap, &bluecolormap);
for (i = 0; i < numcolors; i++) {
red[i] = (u_char) CVT(redcolormap[i]);
green[i] = (u_char) CVT(greencolormap[i]);
blue[i] = (u_char) CVT(bluecolormap[i]);
}
Colormap.map[0] = red;
Colormap.map[1] = green;
Colormap.map[2] = blue;
break;
case PHOTOMETRIC_MASK:
error("%s: Don't know how to handle PHOTOMETRIC_MASK\n");
break;
case PHOTOMETRIC_DEPTH:
error("%s: Don't know how to handle PHOTOMETRIC_DEPTH\n");
break;
default:
error("%s: unknown photometric (cmap): %d\n", photometric);
}
}
buf = (u_char *) malloc(TIFFScanlineSize(tif));
if (buf == NULL)
error("%s: can't allocate memory for scanline buffer...\n", NULL);
for (row = 0; row < height; row++) {
if (TIFFReadScanline(tif, buf, row, 0) < 0)
error("%s: bad data read on line: %d\n", row);
inp = buf;
outp = (u_char *) mprd_addr(mpr_d(pix), 0, row);
switch (photometric) {
case PHOTOMETRIC_RGB:
if (samplesperpixel == 4)
for (col = 0; col < width; col++) {
*outp++ = *inp++; /* Blue */
*outp++ = *inp++; /* Green */
*outp++ = *inp++; /* Red */
inp++; /* skip alpha channel */
}
else
for (col = 0; col < width; col++) {
*outp++ = *inp++; /* Blue */
*outp++ = *inp++; /* Green */
*outp++ = *inp++; /* Red */
}
break;
case PHOTOMETRIC_MINISWHITE:
case PHOTOMETRIC_MINISBLACK:
switch (bitspersample) {
case 1:
for (col = 0; col < ((width + 7) / 8); col++)
*outp++ = *inp++;
break;
case 2:
for (col = 0; col < ((width + 3) / 4); col++) {
*outp++ = (*inp >> 6) & 3;
*outp++ = (*inp >> 4) & 3;
*outp++ = (*inp >> 2) & 3;
*outp++ = *inp++ & 3;
}
break;
case 4:
for (col = 0; col < width / 2; col++) {
*outp++ = *inp >> 4;
*outp++ = *inp++ & 0xf;
}
break;
case 8:
for (col = 0; col < width; col++)
*outp++ = *inp++;
break;
default:
error("%s: bad bits/sample: %d\n", bitspersample);
}
break;
case PHOTOMETRIC_PALETTE:
memcpy(outp, inp, width);
break;
default:
error("%s: unknown photometric (write): %d\n", photometric);
}
}
free((char *) buf);
if (Verbose)
fprintf(stderr, "done.\n");
if (outf == NULL || strcmp(outf, "Standard Output") == 0) {
outf = "Standard Output";
fp = stdout;
} else {
if (!(fp = fopen(outf, "w")))
error("%s: %s couldn't be opened for writing.\n", outf);
}
if (Verbose)
fprintf(stderr, "Writing rasterfile in %s...", outf);
if (pr_dump(pix, fp, &Colormap, RT_BYTE_ENCODED, 0) == PIX_ERR)
error("%s: error writing Sun Rasterfile: %s\n", outf);
if (Verbose)
fprintf(stderr, "done.\n");
pr_destroy(pix);
if (fp != stdout)
fclose(fp);
exit(0);
}
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/

View File

@ -1,27 +0,0 @@
# Tag Image File Format (TIFF) Software
#
# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# Process this file with automake to produce Makefile.in.
EXTRA_DIST = README tiffstream.cpp tiffstream.h

View File

@ -1,30 +0,0 @@
Subject: tiff stream interface (contrib)
Date: Thu, 30 Mar 2000 10:48:51 -0800
From: "Avi Bleiweiss" <avi@shutterfly.com>
To: <warmerda@home.com>, <mike@onshore.com>
Here at Shutterfly we have augmented the file based tiff library to support
C++ streams. The implementation is an adaptor class, which takes any C++
stream from the user and in return it deposits i/o operation method pointers
(e.g. read, write, seek and close) into the tiff's library client state.
The class TiffStream has an overloaded factory method - makeFileStream -
which takes the C++ stream as an argument, calls TIFFClientOpen and returns
a tiff handle. The class retains the tiff handle in its local state and
provides a helper function (getTiffHandle) to query the handle at any time.
Additional helper method - getStreamSize - provides the stream size to the
user. The implementation assumes client responsibility to delete the stream
object. The class calls TIFFClose at destruction time.
Attached are a definition (tiffstream.h) and an implementation
(tiffstream.cpp) files of the TiffStream class. No changes are required to
the tiff core piece and the class sits on top of the library. The code is
fairly tested at this point and is used internally in Shutterfly imaging
software. The code is portable across WindowsNT/Linux/Solaris.
We at Shutterfly believe this software has benefits to the larger community
of tiff library users and would like to contribute this software to be part
of the tiff distributed package. Let me know of any issue.
Thanks
Avi

View File

@ -1,238 +0,0 @@
// tiff stream interface class implementation
#include "tiffstream.h"
const char* TiffStream::m_name = "TiffStream";
TiffStream::TiffStream()
{
m_tif = NULL;
m_inStream = NULL;
m_outStream = NULL;
m_ioStream = NULL;
m_streamLength = 0;
m_this = reinterpret_cast<thandle_t>(this);
};
TiffStream::~TiffStream()
{
if(m_tif != NULL) TIFFClose(m_tif);
}
TIFF*
TiffStream::makeFileStream(istream* str)
{
m_inStream = str;
m_outStream = NULL;
m_ioStream = NULL;
m_streamLength = getSize(m_this);
m_tif = TIFFClientOpen(m_name,
"r",
m_this,
read,
write,
seek,
close,
size,
map,
unmap);
return m_tif;
}
TIFF*
TiffStream::makeFileStream(ostream* str)
{
m_inStream = NULL;
m_outStream = str;
m_ioStream = NULL;
m_streamLength = getSize(m_this);
m_tif = TIFFClientOpen(m_name,
"w",
m_this,
read,
write,
seek,
close,
size,
map,
unmap);
return m_tif;
}
TIFF*
TiffStream::makeFileStream(iostream* str)
{
m_inStream = NULL;
m_outStream = NULL;
m_ioStream = str;
m_streamLength = getSize(m_this);
m_tif = TIFFClientOpen(m_name,
"r+w",
m_this,
read,
write,
seek,
close,
size,
map,
unmap);
return m_tif;
}
tsize_t
TiffStream::read(thandle_t fd, tdata_t buf, tsize_t size)
{
istream* istr;
TiffStream* ts = reinterpret_cast<TiffStream*>(fd);
if(ts->m_inStream != NULL) {
istr = ts->m_inStream;
} else if(ts->m_ioStream != NULL) {
istr = ts->m_ioStream;
}
int remain = ts->m_streamLength - ts->tell(fd);
int actual = remain < size ? remain : size;
istr->read(reinterpret_cast<char*>(buf), actual);
return istr->gcount();
}
tsize_t
TiffStream::write(thandle_t fd, tdata_t buf, tsize_t size)
{
TiffStream* ts = reinterpret_cast<TiffStream*>(fd);
ostream* ostr;
if(ts->m_outStream != NULL) {
ostr = ts->m_outStream;
} else if(ts->m_ioStream != NULL) {
ostr = ts->m_ioStream;
}
streampos start = ostr->tellp();
ostr->write(reinterpret_cast<const char*>(buf), size);
return ostr->tellp() - start;
}
toff_t
TiffStream::seek(thandle_t fd, toff_t offset, int origin)
{
TiffStream* ts = reinterpret_cast<TiffStream*>(fd);
if(ts->seekInt(fd, offset, origin) == true) return offset;
else return -1;
}
int
TiffStream::close(thandle_t fd)
{
TiffStream* ts = reinterpret_cast<TiffStream*>(fd);
if(ts->m_inStream != NULL) {
ts->m_inStream = NULL;
return 0;
} else if(ts->m_outStream != NULL) {
ts->m_outStream = NULL;
return 0;
} else if(ts->m_ioStream != NULL) {
ts->m_ioStream = NULL;
return 0;
}
return -1;
}
toff_t
TiffStream::size(thandle_t fd)
{
TiffStream* ts = reinterpret_cast<TiffStream*>(fd);
return ts->getSize(fd);
}
int
TiffStream::map(thandle_t fd, tdata_t* phase, toff_t* psize)
{
return 0;
}
void
TiffStream::unmap(thandle_t fd, tdata_t base, tsize_t size)
{
}
unsigned int
TiffStream::getSize(thandle_t fd)
{
if(!isOpen(fd)) return 0;
unsigned int pos = tell(fd);
seekInt(fd, 0, end);
unsigned int size = tell(fd);
seekInt(fd, pos, beg);
return size;
}
unsigned int
TiffStream::tell(thandle_t fd)
{
TiffStream* ts = reinterpret_cast<TiffStream*>(fd);
if(ts->m_inStream != NULL) {
return ts->m_inStream->tellg();
} else if(ts->m_outStream != NULL) {
return ts->m_outStream->tellp();
} else if(ts->m_ioStream != NULL) {
return ts->m_ioStream->tellg();
}
return 0;
}
bool
TiffStream::seekInt(thandle_t fd, unsigned int offset, int origin)
{
if(!isOpen(fd)) return false;
ios::seek_dir org;
switch(origin) {
case beg:
org = ios::beg;
break;
case cur:
org = ios::cur;
break;
case end:
org = ios::end;
break;
}
TiffStream* ts = reinterpret_cast<TiffStream*>(fd);
if(ts->m_inStream != NULL) {
ts->m_inStream->seekg(offset, org);
return true;
} else if(ts->m_outStream != NULL) {
ts->m_outStream->seekp(offset, org);
return true;
} else if(ts->m_ioStream != NULL) {
ts->m_ioStream->seekg(offset, org);
ts->m_ioStream->seekp(offset, org);
return true;
}
return false;
}
bool
TiffStream::isOpen(thandle_t fd)
{
TiffStream* ts = reinterpret_cast<TiffStream*>(fd);
return (ts->m_inStream != NULL ||
ts->m_outStream != NULL ||
ts->m_ioStream != NULL);
}/*
* Local Variables:
* mode: c++
* c-basic-offset: 8
* fill-column: 78
* End:
*/

View File

@ -1,70 +0,0 @@
// tiff stream interface class definition
#ifndef _TIFF_STREAM_H_
#define _TIFF_STREAM_H_
#include <iostream.h>
#include "tiffio.h"
class TiffStream {
public:
// ctor/dtor
TiffStream();
~TiffStream();
public:
enum SeekDir {
beg,
cur,
end,
};
public:
// factory methods
TIFF* makeFileStream(iostream* str);
TIFF* makeFileStream(istream* str);
TIFF* makeFileStream(ostream* str);
public:
// tiff client methods
static tsize_t read(thandle_t fd, tdata_t buf, tsize_t size);
static tsize_t write(thandle_t fd, tdata_t buf, tsize_t size);
static toff_t seek(thandle_t fd, toff_t offset, int origin);
static toff_t size(thandle_t fd);
static int close(thandle_t fd);
static int map(thandle_t fd, tdata_t* phase, toff_t* psize);
static void unmap(thandle_t fd, tdata_t base, tsize_t size);
public:
// query method
TIFF* getTiffHandle() const { return m_tif; }
unsigned int getStreamLength() { return m_streamLength; }
private:
// internal methods
unsigned int getSize(thandle_t fd);
unsigned int tell(thandle_t fd);
bool seekInt(thandle_t fd, unsigned int offset, int origin);
bool isOpen(thandle_t fd);
private:
thandle_t m_this;
TIFF* m_tif;
static const char* m_name;
istream* m_inStream;
ostream* m_outStream;
iostream* m_ioStream;
int m_streamLength;
};
#endif // _TIFF_STREAM_H_
/*
* Local Variables:
* mode: c++
* c-basic-offset: 8
* fill-column: 78
* End:
*/

View File

@ -1,27 +0,0 @@
# Tag Image File Format (TIFF) Software
#
# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# Process this file with automake to produce Makefile.in.
EXTRA_DIST = README listtif.c maketif.c xtif_dir.c xtiffio.h xtiffiop.h

View File

@ -1,132 +0,0 @@
NOTE: Sept/2004
The following described approach to managing tag extensions has been
mostly superceeded since libtiff 3.6.0. The described approach requires
internal knowledge of the libtiff API and tends to be very fragile
in the face of libtiff upgrades.
Please read over the html/addingtags.html in preference to the below
described approach.
==================================
Client module for adding to LIBTIFF tagset
-------------------------------------------
Author: Niles Ritter
In the past, users of the "libtiff" package had to modify the
source code of the library if they required additional private tags
or codes not recognized by libtiff. Thus, whenever
a new revision of libtiff came out the client would have to
perform modifications to six or seven different files to re-install
their tags.
The latest versions of libtiff now provide client software new routines,
giving them the opportunity to install private extensions at runtime,
rather than compile-time. This means that the client may encapsulate
all of their private tags into a separate module, which need only
be recompiled when new versions of libtiff are released; no manual
editing of files is required.
How it works
------------
The mechanism for overriding the tag access has been enabled with
a single new routine, which has the following calling sequence:
TIFFExtendProc old_extender;
old_extender = TIFFSetTagExtender(tag_extender);
which must be called prior to opening or creating TIFF files.
This routine sets a static pointer to the user-specified function
<tag_extender>, which in turn is called by TIFFDefaultDirectory(),
just after the usual TIFFSetField() and TIFFGetField() methods
are defined, and just before the compression tag is set. It also
returns a pointer to the previously-defined value of the tag-extender,
so that multiple clients may be installed.
The TIFFExtendProc method that you define should be used to override
the TIFF file's "vsetfield" and "vgetfield" methods, so that you
can trap your new, private tags, and install their values into
a private directory structure. For your convienience, a new pointer
has also been added to the "TIFF" file structure:
tidata_t tif_clientdir; /* client TIFF directory */
into which you may install whatever private directory structures you like.
You should also override the tag-printing method from within your
"vsetfield" method, to permit the symbolic printing of your new tags.
Example Client Code:
--------------------
An example module has been provided as a template for installing
your own tags into a client tag extender. The module is called
"xtif_dir.c", and defines all of the interface routines, tag field
access, tag printing, etc. for most purpose.
To see how the client module operates, there are three "fake"
tags currently installed. If you use the existing makefile you can
build them with:
make all -f Makefile.gcc !or Makefile.mpw
maketif
listtif
This will build two example programs called "maketif" and "listtif"
and then run them. These programs do nothing more than create a small
file called "newtif.tif", install the fake tags, and then list them out
using TIFFPrintDirectory().
Installing Private Tags
-----------------------
To use this module for installing your own tags, edit each of the files
xtif_dir.c
xtiffio.h
xtiffiop.h
and search for the string "XXX". At these locations the comments
will direct you how to install your own tag values, define their
types, etc. Three examples tags are currently installed, demonstrating
how to implement multi-valued tags, single-valued tags, and ASCII tags.
The examples are not valid, registered tags, so you must replace them with
your own.
To test the routines, also edit the test programs "maketif.c" and
"listtif.c" and replace the portions of the code that set the
private tag values and list them.
Once you have edited these files, you may build the client module
with the Makefile provided, and run the test programs.
To use these files in your own code, the "xtif_dir.c" module defines
replacement routines for the standard "TIFFOpen()" "TIFFFdOpen",
and "TIFFClose()" routines, called XTIFFOpen, XTIFFFdOpen and XTIFFClose.
You must use these routines in order to have the extended tag handlers
installed. Once installed, the standard TIFFGetField() and TIFFSetField
routines may be used as before.
Adding Extended Tags to "tools"
-------------------------------
To create an extended-tag savvy "tiffinfo" program or other utility, you may
simply recompile and link the tools to your "libxtiff" library, adding
-DTIFFOpen=XTIFFOpen -DTIFFClose=XTIFFClose -DTIFFFdOpen=XTIFFFdOpen
to the compile statement.
Bugs, Comments Etc:
------------------
Send all reports and suggestions to ndr@tazboy.jpl.nasa.gov
(Niles Ritter).

View File

@ -1,39 +0,0 @@
/*
* listtif.c -- lists a tiff file.
*/
#include "xtiffio.h"
#include <stdlib.h>
void main(int argc,char *argv[])
{
char *fname="newtif.tif";
int flags;
TIFF *tif=(TIFF*)0; /* TIFF-level descriptor */
if (argc>1) fname=argv[1];
tif=XTIFFOpen(fname,"r");
if (!tif) goto failure;
/* We want the double array listed */
flags = TIFFPRINT_MYMULTIDOUBLES;
TIFFPrintDirectory(tif,stdout,flags);
XTIFFClose(tif);
exit (0);
failure:
printf("failure in listtif\n");
if (tif) XTIFFClose(tif);
exit (-1);
}
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/

View File

@ -1,77 +0,0 @@
/*
* maketif.c -- creates a little TIFF file, with
* the XTIFF extended tiff example tags.
*/
#include <stdlib.h>
#include "xtiffio.h"
void SetUpTIFFDirectory(TIFF *tif);
void WriteImage(TIFF *tif);
#define WIDTH 20
#define HEIGHT 20
void main()
{
TIFF *tif=(TIFF*)0; /* TIFF-level descriptor */
tif=XTIFFOpen("newtif.tif","w");
if (!tif) goto failure;
SetUpTIFFDirectory(tif);
WriteImage(tif);
XTIFFClose(tif);
exit (0);
failure:
printf("failure in maketif\n");
if (tif) XTIFFClose(tif);
exit (-1);
}
void SetUpTIFFDirectory(TIFF *tif)
{
double mymulti[6]={0.0,1.0,2.0, 3.1415926, 5.0,1.0};
uint32 mysingle=3456;
char *ascii="This file was produced by Steven Spielberg. NOT";
TIFFSetField(tif,TIFFTAG_IMAGEWIDTH,WIDTH);
TIFFSetField(tif,TIFFTAG_IMAGELENGTH,HEIGHT);
TIFFSetField(tif,TIFFTAG_COMPRESSION,COMPRESSION_NONE);
TIFFSetField(tif,TIFFTAG_PHOTOMETRIC,PHOTOMETRIC_MINISBLACK);
TIFFSetField(tif,TIFFTAG_PLANARCONFIG,PLANARCONFIG_CONTIG);
TIFFSetField(tif,TIFFTAG_BITSPERSAMPLE,8);
TIFFSetField(tif,TIFFTAG_ROWSPERSTRIP,20);
/* Install the extended TIFF tag examples */
TIFFSetField(tif,TIFFTAG_EXAMPLE_MULTI,6,mymulti);
TIFFSetField(tif,TIFFTAG_EXAMPLE_SINGLE,mysingle);
TIFFSetField(tif,TIFFTAG_EXAMPLE_ASCII,ascii);
}
void WriteImage(TIFF *tif)
{
int i;
char buffer[WIDTH];
memset(buffer,0,sizeof(buffer));
for (i=0;i<HEIGHT;i++)
if (!TIFFWriteScanline(tif, buffer, i, 0))
TIFFErrorExt(tif->tif_clientdata, "WriteImage","failure in WriteScanline\n");
}
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/

View File

@ -1,350 +0,0 @@
/*
* xtif_dir.c
*
* Extended TIFF Directory Tag Support.
*
* You may use this file as a template to add your own
* extended tags to the library. Only the parts of the code
* marked with "XXX" require modification. Three example tags
* are shown; you should replace them with your own.
*
* Author: Niles D. Ritter
*/
#include "xtiffiop.h"
#include <stdio.h>
/* Tiff info structure.
*
* Entry format:
* { TAGNUMBER, ReadCount, WriteCount, DataType, FIELDNUM,
* OkToChange, PassDirCountOnSet, AsciiName }
*
* For ReadCount, WriteCount, -1 = unknown; used for mult-valued
* tags and ASCII.
*/
static const TIFFFieldInfo xtiffFieldInfo[] = {
/* XXX Replace these example tags with your own extended tags */
{ TIFFTAG_EXAMPLE_MULTI, -1,-1, TIFF_DOUBLE, FIELD_EXAMPLE_MULTI,
TRUE, TRUE, "MyMultivaluedTag" },
{ TIFFTAG_EXAMPLE_SINGLE, 1, 1, TIFF_LONG, FIELD_EXAMPLE_SINGLE,
TRUE, FALSE, "MySingleLongTag" },
{ TIFFTAG_EXAMPLE_ASCII, -1,-1, TIFF_ASCII, FIELD_EXAMPLE_ASCII,
TRUE, FALSE, "MyAsciiTag" },
};
#define N(a) (sizeof (a) / sizeof (a[0]))
static void
_XTIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
{
xtiff *xt = XTIFFDIR(tif);
XTIFFDirectory *xd = &xt->xtif_dir;
int i,num;
/* call the inherited method */
if (PARENT(xt,printdir))
(PARENT(xt,printdir))(tif,fd,flags);
/* XXX Add field printing here. Replace the three example
* tags implemented below with your own.
*/
fprintf(fd,"--My Example Tags--\n");
/* Our first example tag may have a lot of values, so we
* will only print them out if the TIFFPRINT_MYMULTIDOUBLES
* flag is passed into the print method.
*/
if (TIFFFieldSet(tif,FIELD_EXAMPLE_MULTI))
{
fprintf(fd, " My Multi-Valued Doubles:");
if (flags & TIFFPRINT_MYMULTIDOUBLES)
{
double *value = xd->xd_example_multi;
num = xd->xd_num_multi;
fprintf(fd,"(");
for (i=0;i<num;i++) fprintf(fd, " %lg", *value++);
fprintf(fd,")\n");
} else
fprintf(fd, "(present)\n");
}
if (TIFFFieldSet(tif,FIELD_EXAMPLE_SINGLE))
{
fprintf(fd, " My Single Long Tag: %lu\n", xd->xd_example_single);
}
if (TIFFFieldSet(tif,FIELD_EXAMPLE_ASCII))
{
_TIFFprintAsciiTag(fd,"My ASCII Tag",
xd->xd_example_ascii);
}
}
static int
_XTIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)
{
xtiff *xt = XTIFFDIR(tif);
XTIFFDirectory* xd = &xt->xtif_dir;
int status = 1;
uint32 v32=0;
int i=0, v=0;
va_list ap1 = ap;
/* va_start is called by the calling routine */
switch (tag) {
/*
* XXX put your extended tags here; replace the implemented
* example tags with your own.
*/
case TIFFTAG_EXAMPLE_MULTI:
/* multi-valued tags need to store the count as well */
xd->xd_num_multi = (uint16) va_arg(ap, int);
_TIFFsetDoubleArray(&xd->xd_example_multi, va_arg(ap, double*),
(long) xd->xd_num_multi);
break;
case TIFFTAG_EXAMPLE_SINGLE:
xd->xd_example_single = va_arg(ap, uint32);
break;
case TIFFTAG_EXAMPLE_ASCII:
_TIFFsetString(&xd->xd_example_ascii, va_arg(ap, char*));
break;
default:
/* call the inherited method */
return (PARENT(xt,vsetfield))(tif,tag,ap);
break;
}
if (status) {
/* we have to override the print method here,
* after the compression tags have gotten to it.
* This makes sense because the only time we would
* need the extended print method is if an extended
* tag is set by the reader.
*/
if (!(xt->xtif_flags & XTIFFP_PRINT))
{
PARENT(xt,printdir) = TIFFMEMBER(tif,printdir);
TIFFMEMBER(tif,printdir) = _XTIFFPrintDirectory;
xt->xtif_flags |= XTIFFP_PRINT;
}
TIFFSetFieldBit(tif, _TIFFFieldWithTag(tif, tag)->field_bit);
tif->tif_flags |= TIFF_DIRTYDIRECT;
}
va_end(ap);
return (status);
badvalue:
TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%d: Bad value for \"%s\"", v,
_TIFFFieldWithTag(tif, tag)->field_name);
va_end(ap);
return (0);
badvalue32:
TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%ld: Bad value for \"%s\"", v32,
_TIFFFieldWithTag(tif, tag)->field_name);
va_end(ap);
return (0);
}
static int
_XTIFFVGetField(TIFF* tif, ttag_t tag, va_list ap)
{
xtiff *xt = XTIFFDIR(tif);
XTIFFDirectory* xd = &xt->xtif_dir;
switch (tag) {
/*
* XXX put your extended tags here; replace the implemented
* example tags with your own.
*/
case TIFFTAG_EXAMPLE_MULTI:
*va_arg(ap, uint16*) = xd->xd_num_multi;
*va_arg(ap, double**) = xd->xd_example_multi;
break;
case TIFFTAG_EXAMPLE_ASCII:
*va_arg(ap, char**) = xd->xd_example_ascii;
break;
case TIFFTAG_EXAMPLE_SINGLE:
*va_arg(ap, uint32*) = xd->xd_example_single;
break;
default:
/* return inherited method */
return (PARENT(xt,vgetfield))(tif,tag,ap);
break;
}
return (1);
}
#define CleanupField(member) { \
if (xd->member) { \
_TIFFfree(xd->member); \
xd->member = 0; \
} \
}
/*
* Release storage associated with a directory.
*/
static void
_XTIFFFreeDirectory(xtiff* xt)
{
XTIFFDirectory* xd = &xt->xtif_dir;
/*
* XXX - Purge all Your allocated memory except
* for the xtiff directory itself. This includes
* all fields that require a _TIFFsetXXX call in
* _XTIFFVSetField().
*/
CleanupField(xd_example_multi);
CleanupField(xd_example_ascii);
}
#undef CleanupField
static void _XTIFFLocalDefaultDirectory(TIFF *tif)
{
xtiff *xt = XTIFFDIR(tif);
XTIFFDirectory* xd = &xt->xtif_dir;
/* Install the extended Tag field info */
_TIFFMergeFieldInfo(tif, xtiffFieldInfo, N(xtiffFieldInfo));
/*
* free up any dynamically allocated arrays
* before the new directory is read in.
*/
_XTIFFFreeDirectory(xt);
_TIFFmemset(xt,0,sizeof(xtiff));
/* Override the tag access methods */
PARENT(xt,vsetfield) = TIFFMEMBER(tif,vsetfield);
TIFFMEMBER(tif,vsetfield) = _XTIFFVSetField;
PARENT(xt,vgetfield) = TIFFMEMBER(tif,vgetfield);
TIFFMEMBER(tif,vgetfield) = _XTIFFVGetField;
/*
* XXX Set up any default values here.
*/
xd->xd_example_single = 234;
}
/**********************************************************************
* Nothing below this line should need to be changed.
**********************************************************************/
static TIFFExtendProc _ParentExtender;
/*
* This is the callback procedure, and is
* called by the DefaultDirectory method
* every time a new TIFF directory is opened.
*/
static void
_XTIFFDefaultDirectory(TIFF *tif)
{
xtiff *xt;
/* Allocate Directory Structure if first time, and install it */
if (!(tif->tif_flags & XTIFF_INITIALIZED))
{
xt = _TIFFmalloc(sizeof(xtiff));
if (!xt)
{
/* handle memory allocation failure here ! */
return;
}
_TIFFmemset(xt,0,sizeof(xtiff));
/*
* Install into TIFF structure.
*/
TIFFMEMBER(tif,clientdir) = (tidata_t)xt;
tif->tif_flags |= XTIFF_INITIALIZED; /* dont do this again! */
}
/* set up our own defaults */
_XTIFFLocalDefaultDirectory(tif);
/* Since an XTIFF client module may have overridden
* the default directory method, we call it now to
* allow it to set up the rest of its own methods.
*/
if (_ParentExtender)
(*_ParentExtender)(tif);
}
/*
* XTIFF Initializer -- sets up the callback
* procedure for the TIFF module.
*/
static
void _XTIFFInitialize(void)
{
static first_time=1;
if (! first_time) return; /* Been there. Done that. */
first_time = 0;
/* Grab the inherited method and install */
_ParentExtender = TIFFSetTagExtender(_XTIFFDefaultDirectory);
}
/*
* Public File I/O Routines.
*/
TIFF*
XTIFFOpen(const char* name, const char* mode)
{
/* Set up the callback */
_XTIFFInitialize();
/* Open the file; the callback will set everything up
*/
return TIFFOpen(name, mode);
}
TIFF*
XTIFFFdOpen(int fd, const char* name, const char* mode)
{
/* Set up the callback */
_XTIFFInitialize();
/* Open the file; the callback will set everything up
*/
return TIFFFdOpen(fd, name, mode);
}
void
XTIFFClose(TIFF *tif)
{
xtiff *xt = XTIFFDIR(tif);
/* call inherited function first */
TIFFClose(tif);
/* Free up extended allocated memory */
_XTIFFFreeDirectory(xt);
_TIFFfree(xt);
}
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/

View File

@ -1,59 +0,0 @@
/*
* xtiffio.h -- Public interface to Extended TIFF tags
*
* This is a template for defining a client module
* which supports tag extensions to the standard libtiff
* set. Only portions of the code marked "XXX" need to
* be changed to support your tag set.
*
* written by: Niles D. Ritter
*/
#ifndef __xtiffio_h
#define __xtiffio_h
#include "tiffio.h"
/*
* XXX Define your private Tag names and values here
*/
/* These tags are not valid, but are provided for example */
#define TIFFTAG_EXAMPLE_MULTI 61234
#define TIFFTAG_EXAMPLE_SINGLE 61235
#define TIFFTAG_EXAMPLE_ASCII 61236
/*
* XXX Define Printing method flags. These
* flags may be passed in to TIFFPrintDirectory() to
* indicate that those particular field values should
* be printed out in full, rather than just an indicator
* of whether they are present or not.
*/
#define TIFFPRINT_MYMULTIDOUBLES 0x80000000
/**********************************************************************
* Nothing below this line should need to be changed by the user.
**********************************************************************/
#if defined(__cplusplus)
extern "C" {
#endif
extern TIFF* XTIFFOpen(const char* name, const char* mode);
extern TIFF* XTIFFFdOpen(int fd, const char* name, const char* mode);
extern void XTIFFClose(TIFF *tif);
#if defined(__cplusplus)
}
#endif
#endif /* __xtiffio_h */
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/

View File

@ -1,72 +0,0 @@
/*
* Private Extended TIFF library interface.
*
* uses private LIBTIFF interface.
*
* The portions of this module marked "XXX" should be
* modified to support your tags instead.
*
* written by: Niles D. Ritter
*
*/
#ifndef __xtiffiop_h
#define __xtiffiop_h
#include "tiffiop.h"
#include "xtiffio.h"
/**********************************************************************
* User Configuration
**********************************************************************/
/* XXX - Define number of your extended tags here */
#define NUM_XFIELD 3
#define XFIELD_BASE (FIELD_LAST-NUM_XFIELD)
/* XXX - Define your Tag Fields here */
#define FIELD_EXAMPLE_MULTI (XFIELD_BASE+0)
#define FIELD_EXAMPLE_SINGLE (XFIELD_BASE+1)
#define FIELD_EXAMPLE_ASCII (XFIELD_BASE+2)
/* XXX - Define Private directory tag structure here */
struct XTIFFDirectory {
uint16 xd_num_multi; /* dir-count for the multi tag */
double* xd_example_multi;
uint32 xd_example_single;
char* xd_example_ascii;
};
typedef struct XTIFFDirectory XTIFFDirectory;
/**********************************************************************
* Nothing below this line should need to be changed by the user.
**********************************************************************/
struct xtiff {
TIFF *xtif_tif; /* parent TIFF pointer */
uint32 xtif_flags;
#define XTIFFP_PRINT 0x00000001
XTIFFDirectory xtif_dir; /* internal rep of current directory */
TIFFVSetMethod xtif_vsetfield; /* inherited tag set routine */
TIFFVGetMethod xtif_vgetfield; /* inherited tag get routine */
TIFFPrintMethod xtif_printdir; /* inherited dir print method */
};
typedef struct xtiff xtiff;
#define PARENT(xt,pmember) ((xt)->xtif_ ## pmember)
#define TIFFMEMBER(tf,pmember) ((tf)->tif_ ## pmember)
#define XTIFFDIR(tif) ((xtiff *)TIFFMEMBER(tif,clientdir))
/* Extended TIFF flags */
#define XTIFF_INITIALIZED 0x80000000
#endif /* __xtiffiop_h */
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/

View File

@ -1,27 +0,0 @@
# Tag Image File Format (TIFF) Software
#
# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# Process this file with automake to produce Makefile.in.
EXTRA_DIST = Makefile.w95 README.Tiffile README.tiff2dib Tiffile.cpp tiff2dib.c

View File

@ -1,134 +0,0 @@
# $Header: /usr/people/sam/tiff/libtiff/RCS/Makefile.w95,v 1.2 1994/11/28
06:13:31 sam Exp $
#
# Tag Image File Format Library
#
# Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler
# Copyright (c) 1991, 1992 Silicon Graphics, Inc.
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
#
# This Makefile is for use with microsoft nmake version 1.50 and
# Microsoft 32-bit C/C++ Compiler 9.00
#
DESTDIR=.
#
IPATH= -I.
CONF_LIBRARY=$(NULL)
COPTS= -Oxa -DBSDTYPES -Zd
CFLAGS= $(COPTS) $(CONF_LIBRARY)
#
INCS= tiff.h tiffio.h
SRCS= tif_aux.c \
tif_close.c \
tif_codec.c \
tif_compress.c \
tif_dir.c \
tif_dirinfo.c \
tif_dirread.c \
tif_dirwrite.c \
tif_dumpmode.c \
tif_error.c \
tif_getimage.c \
tif_jpeg.c \
tif_flush.c \
tif_lzw.c \
tif_next.c \
tif_open.c \
tif_packbits.c \
tif_predict \
tif_print.c \
tif_read.c \
tif_swab.c \
tif_strip.c \
tif_thunder.c \
tif_tile.c \
tif_version.c \
tif_warning.c \
tif_write.c \
tif_win32.c
OBJS= tif_aux.obj \
tif_close.obj \
tif_codec.obj \
tif_compress.obj \
tif_dir.obj \
tif_dirinfo.obj \
tif_dirread.obj \
tif_dirwrite.obj \
tif_dumpmode.obj \
tif_error.obj \
tif_getimage.obj \
tif_jpeg.obj \
tif_flush.obj \
tif_lzw.obj \
tif_next.obj \
tif_open.obj \
tif_packbits.obj \
tif_predict.obj \
tif_print.obj \
tif_read.obj \
tif_swab.obj \
tif_strip.obj \
tif_thunder.obj \
tif_tile.obj \
tif_version.obj \
tif_warning.obj \
tif_write.obj \
tif_win32.obj
ALL= libtiff.lib
all: $(ALL)
%.obj : %.c
$(CC) $(CFLAGS) -c $*.c
#.INCLUDE .IGNORE : depend
libtiff.lib: $(OBJS)
- del libtiff.lib
lib /OUT:libtiff.lib $(OBJS)
#To include fax3 support, you need to modify mkg3states.c so it could run
#under windows 95 or NT. This application make the file g3state.h.
#after that, you have to add to the build script : tif_fax3.c and tif_fax3.obj
#and define CCITT_SUPPORT in the file tifconf.h
#$(OBJS): tiffio.h tiff.h tiffcomp.h tiffiop.h tiffconf.h
#tif_fax3.obj: tif_fax3.c g3states.h t4.h tif_fax3.h
#g3states.h: mkg3states.c t4.h
# $(CC) $(CFLAGS) mkg3states.c
# mkg3states -c > g3states.h
clean:
del *.obj
del mkg3stat
del g3states.h
tags: $(SRCS)
$(CTAGS) $(SRCS)

View File

@ -1,31 +0,0 @@
Frank,
I attached a file that uses RGBA interface (tif_getimage.c) to read a tiff
file and convert to a DIB. It's advantage is that it is easy to read *any*
tiff file suported by libtiff and easily convert it to a DIB. The disadvantage
is that bilevel (B&W) bitmaps (and all other non-rgba images) are also
converted to RGBA, thus taking up 32x as much memory as needed (4 bytes per
pixel, rather than 1 bit). I read tiff files, but don't need to
write them. And my files are typically small, so the overhead is mostly
inconsequential. But for bilevel images, I overrode the get() and put()
routines of the RGBA interface to just copy the data from the input raster
to the output raster, rather than expanding out to full 32 bit format. It
would be nice if there were a simple way to handle all palletized images,
but that would take more custom routines, and it's not that important to me.
Usage:
m_pDIB = (PBITMAPINFOHEADER)::ReadTIFF(pathName);
if (m_pDIB != 0) {
m_format = IMAGETYPE_TIF;
}
This is intended as Win32, but the modifications for new get() and put()
routines may be independent of platform.
Thanks for your work supporting the forum and the library!
Regards,
Mark James
mark@james.net

View File

@ -1,51 +0,0 @@
Date: 04 Dec 95 10:34:23 EST
From: Philippe <100423.3705@compuserve.com>
To: TIFF/sam Leffler <sam@cthulhu.engr.sgi.com>
Subject: TIFF library and Windows 95
Message-Id: <951204153422_100423.3705_BHG101-1@CompuServe.COM>
Sam,
First, let me thanks all of you how have worked
on that great TIFF library !
Here is some information that may help someone.
I build the library under Windows 95 as a 32-bit library.
The contribution of Scott Wagner (tif_win32.c) worked fine, but
the makefile "makefile.msc" was unsable because it was
written for DOS or Windows 3.1 and all the files names
are limited to 8 characters.
Here is the makefile I used : makefile.w95
Also, I had to disable fax3 support because I wasn't able
to build (as it is) the tool "mkg3states" to generate the include
file "g3states.h".
This source file must be modify to be build under Windows 95.
To build the library under Windows 95 with Visual C++ 2.0,
I had to :
- undefine CCITT_SUPPORT in "tiffconf.h"
- create the file version.h with this line :
#define VERSION "3.4beta024"
- build the makefile "makefile.w95"
I also join the source file "tif2dib.c" that I created,
it contain the function LoadTIFFinDIB that load
a TIFF file and build a memory DIB with it and return the
HANDLE (HDIB) of the memory bloc containing this DIB.
Since DIB is the "natural" bitmap format for Windows 3.1, 95 and NT,
this function sould be usefull for some Windows 95 (or NT) developer.
Sorry for my approximate english ...
Regards,
Philippe Tenenhaus 100423.3705@compuserve.com
Paris

View File

@ -1,449 +0,0 @@
#include "StdAfx.h"
//#define STRICT
#include <windows.h>
#include <windowsx.h>
#include <commdlg.h>
#include <stdlib.h> // MAX_ constants
#include "diblib.h"
/*--------------------------------------------------------------------
READ TIFF
Load the TIFF data from the file into memory. Return
a pointer to a valid DIB (or NULL for errors).
Uses the TIFFRGBA interface to libtiff.lib to convert
most file formats to a useable form. We just keep the 32 bit
form of the data to display, rather than optimizing for the
display.
Main entry points:
int ChkTIFF ( LPCTSTR lpszPath )
PVOID ReadTIFF ( LPCTSTR lpszPath )
RETURN
A valid DIB pointer for success; NULL for failure.
--------------------------------------------------------------------*/
#include "TiffLib/tiff.h"
#include "TiffLib/tiffio.h"
#include <assert.h>
#include <stdio.h>
// piggyback some data on top of the RGBA Image
struct TIFFDibImage {
TIFFRGBAImage tif;
int dibinstalled;
} ;
HANDLE LoadTIFFinDIB(LPCTSTR lpFileName);
HANDLE TIFFRGBA2DIB(TIFFDibImage* dib, uint32* raster) ;
static void
MyWarningHandler(const char* module, const char* fmt, va_list ap)
{
// ignore all warnings (unused tags, etc)
return;
}
static void
MyErrorHandler(const char* module, const char* fmt, va_list ap)
{
return;
}
// Turn off the error and warning handlers to check if a valid file.
// Necessary because of the way that the Doc loads images and restart files.
int ChkTIFF ( LPCTSTR lpszPath )
{
int rtn = 0;
TIFFErrorHandler eh;
TIFFErrorHandler wh;
eh = TIFFSetErrorHandler(NULL);
wh = TIFFSetWarningHandler(NULL);
TIFF* tif = TIFFOpen(lpszPath, "r");
if (tif) {
rtn = 1;
TIFFClose(tif);
}
TIFFSetErrorHandler(eh);
TIFFSetWarningHandler(wh);
return rtn;
}
void DibInstallHack(TIFFDibImage* img) ;
PVOID ReadTIFF ( LPCTSTR lpszPath )
{
void* pDIB = 0;
TIFFErrorHandler wh;
wh = TIFFSetWarningHandler(MyWarningHandler);
if (ChkTIFF(lpszPath)) {
TIFF* tif = TIFFOpen(lpszPath, "r");
if (tif) {
char emsg[1024];
if (TIFFRGBAImageOK(tif, emsg)) {
TIFFDibImage img;
char emsg[1024];
if (TIFFRGBAImageBegin(&img.tif, tif, -1, emsg)) {
size_t npixels;
uint32* raster;
DibInstallHack(&img);
npixels = img.tif.width * img.tif.height;
raster = (uint32*) _TIFFmalloc(npixels * sizeof (uint32));
if (raster != NULL) {
if (TIFFRGBAImageGet(&img.tif, raster, img.tif.width, img.tif.height)) {
pDIB = TIFFRGBA2DIB(&img, raster);
}
}
_TIFFfree(raster);
}
TIFFRGBAImageEnd(&img.tif);
}
else {
TRACE("Unable to open image(%s): %s\n", lpszPath, emsg );
}
TIFFClose(tif);
}
}
TIFFSetWarningHandler(wh);
return pDIB;
}
HANDLE TIFFRGBA2DIB(TIFFDibImage* dib, uint32* raster)
{
void* pDIB = 0;
TIFFRGBAImage* img = &dib->tif;
uint32 imageLength;
uint32 imageWidth;
uint16 BitsPerSample;
uint16 SamplePerPixel;
uint32 RowsPerStrip;
uint16 PhotometricInterpretation;
BITMAPINFOHEADER bi;
int dwDIBSize ;
TIFFGetField(img->tif, TIFFTAG_IMAGEWIDTH, &imageWidth);
TIFFGetField(img->tif, TIFFTAG_IMAGELENGTH, &imageLength);
TIFFGetField(img->tif, TIFFTAG_BITSPERSAMPLE, &BitsPerSample);
TIFFGetField(img->tif, TIFFTAG_ROWSPERSTRIP, &RowsPerStrip);
TIFFGetField(img->tif, TIFFTAG_SAMPLESPERPIXEL, &SamplePerPixel);
TIFFGetField(img->tif, TIFFTAG_PHOTOMETRIC, &PhotometricInterpretation);
if ( BitsPerSample == 1 && SamplePerPixel == 1 && dib->dibinstalled ) { // bilevel
bi.biSize = sizeof(BITMAPINFOHEADER);
bi.biWidth = imageWidth;
bi.biHeight = imageLength;
bi.biPlanes = 1; // always
bi.biBitCount = 1;
bi.biCompression = BI_RGB;
bi.biSizeImage = WIDTHBYTES(bi.biWidth * bi.biBitCount) * bi.biHeight;
bi.biXPelsPerMeter = 0;
bi.biYPelsPerMeter = 0;
bi.biClrUsed = 0; // must be zero for RGB compression (none)
bi.biClrImportant = 0; // always
// Get the size of the DIB
dwDIBSize = GetDIBSize( &bi );
// Allocate for the BITMAPINFO structure and the color table.
pDIB = GlobalAllocPtr( GHND, dwDIBSize );
if (pDIB == 0) {
return( NULL );
}
// Copy the header info
*((BITMAPINFOHEADER*)pDIB) = bi;
// Get a pointer to the color table
RGBQUAD *pRgbq = (RGBQUAD *)((LPSTR)pDIB + sizeof(BITMAPINFOHEADER));
pRgbq[0].rgbRed = 0;
pRgbq[0].rgbBlue = 0;
pRgbq[0].rgbGreen = 0;
pRgbq[0].rgbReserved = 0;
pRgbq[1].rgbRed = 255;
pRgbq[1].rgbBlue = 255;
pRgbq[1].rgbGreen = 255;
pRgbq[1].rgbReserved = 255;
// Pointers to the bits
//PVOID pbiBits = (LPSTR)pRgbq + bi.biClrUsed * sizeof(RGBQUAD);
//
// In the BITMAPINFOHEADER documentation, it appears that
// there should be no color table for 32 bit images, but
// experience shows that the image is off by 3 words if it
// is not included. So here it is.
PVOID pbiBits = GetDIBImagePtr((BITMAPINFOHEADER*)pDIB); //(LPSTR)pRgbq + 3 * sizeof(RGBQUAD);
int sizeWords = bi.biSizeImage/4;
RGBQUAD* rgbDib = (RGBQUAD*)pbiBits;
long* rgbTif = (long*)raster;
_TIFFmemcpy(pbiBits, raster, bi.biSizeImage);
}
// For now just always default to the RGB 32 bit form. // save as 32 bit for simplicity
else if ( true /*BitsPerSample == 8 && SamplePerPixel == 3*/ ) { // 24 bit color
bi.biSize = sizeof(BITMAPINFOHEADER);
bi.biWidth = imageWidth;
bi.biHeight = imageLength;
bi.biPlanes = 1; // always
bi.biBitCount = 32;
bi.biCompression = BI_RGB;
bi.biSizeImage = WIDTHBYTES(bi.biWidth * bi.biBitCount) * bi.biHeight;
bi.biXPelsPerMeter = 0;
bi.biYPelsPerMeter = 0;
bi.biClrUsed = 0; // must be zero for RGB compression (none)
bi.biClrImportant = 0; // always
// Get the size of the DIB
dwDIBSize = GetDIBSize( &bi );
// Allocate for the BITMAPINFO structure and the color table.
pDIB = GlobalAllocPtr( GHND, dwDIBSize );
if (pDIB == 0) {
return( NULL );
}
// Copy the header info
*((BITMAPINFOHEADER*)pDIB) = bi;
// Get a pointer to the color table
RGBQUAD *pRgbq = (RGBQUAD *)((LPSTR)pDIB + sizeof(BITMAPINFOHEADER));
// Pointers to the bits
//PVOID pbiBits = (LPSTR)pRgbq + bi.biClrUsed * sizeof(RGBQUAD);
//
// In the BITMAPINFOHEADER documentation, it appears that
// there should be no color table for 32 bit images, but
// experience shows that the image is off by 3 words if it
// is not included. So here it is.
PVOID pbiBits = (LPSTR)pRgbq + 3 * sizeof(RGBQUAD);
int sizeWords = bi.biSizeImage/4;
RGBQUAD* rgbDib = (RGBQUAD*)pbiBits;
long* rgbTif = (long*)raster;
// Swap the byte order while copying
for ( int i = 0 ; i < sizeWords ; ++i )
{
rgbDib[i].rgbRed = TIFFGetR(rgbTif[i]);
rgbDib[i].rgbBlue = TIFFGetB(rgbTif[i]);
rgbDib[i].rgbGreen = TIFFGetG(rgbTif[i]);
rgbDib[i].rgbReserved = 0;
}
}
return pDIB;
}
///////////////////////////////////////////////////////////////
//
// Hacked from tif_getimage.c in libtiff in v3.5.7
//
//
typedef unsigned char u_char;
#define DECLAREContigPutFunc(name) \
static void name(\
TIFFRGBAImage* img, \
uint32* cp, \
uint32 x, uint32 y, \
uint32 w, uint32 h, \
int32 fromskew, int32 toskew, \
u_char* pp \
)
#define DECLARESepPutFunc(name) \
static void name(\
TIFFRGBAImage* img,\
uint32* cp,\
uint32 x, uint32 y, \
uint32 w, uint32 h,\
int32 fromskew, int32 toskew,\
u_char* r, u_char* g, u_char* b, u_char* a\
)
DECLAREContigPutFunc(putContig1bitTile);
static int getStripContig1Bit(TIFFRGBAImage* img, uint32* uraster, uint32 w, uint32 h);
//typdef struct TIFFDibImage {
// TIFFRGBAImage tif;
// dibinstalled;
//} TIFFDibImage ;
void DibInstallHack(TIFFDibImage* dib) {
TIFFRGBAImage* img = &dib->tif;
dib->dibinstalled = false;
switch (img->photometric) {
case PHOTOMETRIC_MINISWHITE:
case PHOTOMETRIC_MINISBLACK:
switch (img->bitspersample) {
case 1:
img->put.contig = putContig1bitTile;
img->get = getStripContig1Bit;
dib->dibinstalled = true;
break;
}
break;
}
}
/*
* 1-bit packed samples => 1-bit
*
* Override to just copy the data
*/
DECLAREContigPutFunc(putContig1bitTile)
{
int samplesperpixel = img->samplesperpixel;
(void) y;
fromskew *= samplesperpixel;
int wb = WIDTHBYTES(w);
u_char* ucp = (u_char*)cp;
/* Conver 'w' to bytes from pixels (rounded up) */
w = (w+7)/8;
while (h-- > 0) {
_TIFFmemcpy(ucp, pp, w);
/*
for (x = wb; x-- > 0;) {
*cp++ = rgbi(Map[pp[0]], Map[pp[1]], Map[pp[2]]);
pp += samplesperpixel;
}
*/
ucp += (wb + toskew);
pp += (w + fromskew);
}
}
/*
* Hacked from the tif_getimage.c file.
*/
static uint32
setorientation(TIFFRGBAImage* img, uint32 h)
{
TIFF* tif = img->tif;
uint32 y;
switch (img->orientation) {
case ORIENTATION_BOTRIGHT:
case ORIENTATION_RIGHTBOT: /* XXX */
case ORIENTATION_LEFTBOT: /* XXX */
TIFFWarning(TIFFFileName(tif), "using bottom-left orientation");
img->orientation = ORIENTATION_BOTLEFT;
/* fall thru... */
case ORIENTATION_BOTLEFT:
y = 0;
break;
case ORIENTATION_TOPRIGHT:
case ORIENTATION_RIGHTTOP: /* XXX */
case ORIENTATION_LEFTTOP: /* XXX */
default:
TIFFWarning(TIFFFileName(tif), "using top-left orientation");
img->orientation = ORIENTATION_TOPLEFT;
/* fall thru... */
case ORIENTATION_TOPLEFT:
y = h-1;
break;
}
return (y);
}
/*
* Get a strip-organized image that has
* PlanarConfiguration contiguous if SamplesPerPixel > 1
* or
* SamplesPerPixel == 1
*
* Hacked from the tif_getimage.c file.
*
* This is set up to allow us to just copy the data to the raster
* for 1-bit bitmaps
*/
static int
getStripContig1Bit(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
{
TIFF* tif = img->tif;
tileContigRoutine put = img->put.contig;
uint16 orientation;
uint32 row, y, nrow, rowstoread;
uint32 pos;
u_char* buf;
uint32 rowsperstrip;
uint32 imagewidth = img->width;
tsize_t scanline;
int32 fromskew, toskew;
tstrip_t strip;
tsize_t stripsize;
u_char* braster = (u_char*)raster; // byte wide raster
uint32 wb = WIDTHBYTES(w);
int ret = 1;
buf = (u_char*) _TIFFmalloc(TIFFStripSize(tif));
if (buf == 0) {
TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "No space for strip buffer");
return (0);
}
y = setorientation(img, h);
orientation = img->orientation;
toskew = -(int32) (orientation == ORIENTATION_TOPLEFT ? wb+wb : wb-wb);
TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
scanline = TIFFScanlineSize(tif);
fromskew = (w < imagewidth ? imagewidth - w : 0)/8;
for (row = 0; row < h; row += nrow)
{
rowstoread = rowsperstrip - (row + img->row_offset) % rowsperstrip;
nrow = (row + rowstoread > h ? h - row : rowstoread);
strip = TIFFComputeStrip(tif,row+img->row_offset, 0);
stripsize = ((row + img->row_offset)%rowsperstrip + nrow) * scanline;
if (TIFFReadEncodedStrip(tif, strip, buf, stripsize ) < 0
&& img->stoponerr)
{
ret = 0;
break;
}
pos = ((row + img->row_offset) % rowsperstrip) * scanline;
(*put)(img, (uint32*)(braster+y*wb), 0, y, w, nrow, fromskew, toskew, buf + pos);
y += (orientation == ORIENTATION_TOPLEFT ?-(int32) nrow : (int32) nrow);
}
_TIFFfree(buf);
return (ret);
}
/*
* Local Variables:
* mode: c++
* c-basic-offset: 8
* fill-column: 78
* End:
*/

View File

@ -1,379 +0,0 @@
/*************************************************************************
*
* Source file for Windows 95/Win32.
*
* The function LoadTIFFinDIB in this source file let you load
* a TIFF file and build a memory DIB with it and return the
* HANDLE (HDIB) of the memory bloc containing the DIB.
*
* Example :
*
* HDIB hDIB;
* hDIB = LoadTIFFinDIB("sample.tif");
*
*
* To build this source file you must include the TIFF library
* in your project.
*
* 4/12/95 Philippe Tenenhaus 100423.3705@compuserve.com
*
************************************************************************/
#include "tiffio.h"
#define HDIB HANDLE
#define IS_WIN30_DIB(lpbi) ((*(LPDWORD)(lpbi)) == sizeof(BITMAPINFOHEADER))
#define CVT(x) (((x) * 255L) / ((1L<<16)-1))
static HDIB CreateDIB(DWORD dwWidth, DWORD dwHeight, WORD wBitCount);
static LPSTR FindDIBBits(LPSTR lpDIB);
static WORD PaletteSize(LPSTR lpDIB);
static WORD DIBNumColors(LPSTR lpDIB);
static int checkcmap(int n, uint16* r, uint16* g, uint16* b);
/*************************************************************************
*
* HDIB LoadTIFFinDIB(LPSTR lpFileName)
*
* Parameter:
*
* LPSTR lpDIB - File name of a tiff imag
*
* Return Value:
*
* LPSTR - HANDLE of a DIB
*
* Description:
*
* This function load a TIFF file and build a memory DIB with it
* and return the HANDLE (HDIB) of the memory bloc containing
* the DIB.
*
* 4/12/95 Philippe Tenenhaus 100423.3705@compuserve.com
*
************************************************************************/
HDIB LoadTIFFinDIB(LPSTR lpFileName)
{
TIFF *tif;
unsigned long imageLength;
unsigned long imageWidth;
unsigned int BitsPerSample;
unsigned long LineSize;
unsigned int SamplePerPixel;
unsigned long RowsPerStrip;
int PhotometricInterpretation;
long nrow;
unsigned long row;
char *buf;
LPBITMAPINFOHEADER lpDIB;
HDIB hDIB;
char *lpBits;
HGLOBAL hStrip;
int i,l;
int Align;
tif = TIFFOpen(lpFileName, "r");
if (!tif)
goto TiffOpenError;
TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &imageWidth);
TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &imageLength);
TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &BitsPerSample);
TIFFGetField(tif, TIFFTAG_ROWSPERSTRIP, &RowsPerStrip);
TIFFGetField(tif, TIFFTAG_ROWSPERSTRIP, &RowsPerStrip);
TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &PhotometricInterpretation);
LineSize = TIFFScanlineSize(tif); //Number of byte in ine line
SamplePerPixel = (int) (LineSize/imageWidth);
//Align = Number of byte to add at the end of each line of the DIB
Align = 4 - (LineSize % 4);
if (Align == 4) Align = 0;
//Create a new DIB
hDIB = CreateDIB((DWORD) imageWidth, (DWORD) imageLength, (WORD)
(BitsPerSample*SamplePerPixel));
lpDIB = (LPBITMAPINFOHEADER) GlobalLock(hDIB);
if (!lpDIB)
goto OutOfDIBMemory;
if (lpDIB)
lpBits = FindDIBBits((LPSTR) lpDIB);
//In the tiff file the lines are save from up to down
//In a DIB the lines must be save from down to up
if (lpBits)
{
lpBits = FindDIBBits((LPSTR) lpDIB);
lpBits+=((imageWidth*SamplePerPixel)+Align)*(imageLength-1);
//now lpBits pointe on the bottom line
hStrip = GlobalAlloc(GHND,TIFFStripSize(tif));
buf = GlobalLock(hStrip);
if (!buf)
goto OutOfBufMemory;
//PhotometricInterpretation = 2 image is RGB
//PhotometricInterpretation = 3 image have a color palette
if (PhotometricInterpretation == 3)
{
uint16* red;
uint16* green;
uint16* blue;
int16 i;
LPBITMAPINFO lpbmi;
int Palette16Bits;
TIFFGetField(tif, TIFFTAG_COLORMAP, &red, &green, &blue);
//Is the palette 16 or 8 bits ?
if (checkcmap(1<<BitsPerSample, red, green, blue) == 16)
Palette16Bits = TRUE;
else
Palette16Bits = FALSE;
lpbmi = (LPBITMAPINFO)lpDIB;
//load the palette in the DIB
for (i = (1<<BitsPerSample)-1; i >= 0; i--)
{
if (Palette16Bits)
{
lpbmi->bmiColors[i].rgbRed =(BYTE) CVT(red[i]);
lpbmi->bmiColors[i].rgbGreen = (BYTE) CVT(green[i]);
lpbmi->bmiColors[i].rgbBlue = (BYTE) CVT(blue[i]);
}
else
{
lpbmi->bmiColors[i].rgbRed = (BYTE) red[i];
lpbmi->bmiColors[i].rgbGreen = (BYTE) green[i];
lpbmi->bmiColors[i].rgbBlue = (BYTE) blue[i];
}
}
}
//read the tiff lines and save them in the DIB
//with RGB mode, we have to change the order of the 3 samples RGB
<=> BGR
for (row = 0; row < imageLength; row += RowsPerStrip)
{
nrow = (row + RowsPerStrip > imageLength ? imageLength - row :
RowsPerStrip);
if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, row, 0),
buf, nrow*LineSize)==-1)
{
goto TiffReadError;
}
else
{
for (l = 0; l < nrow; l++)
{
if (SamplePerPixel == 3)
for (i=0;i< (int) (imageWidth);i++)
{
lpBits[i*SamplePerPixel+0]=buf[l*LineSize+i*Sample
PerPixel+2];
lpBits[i*SamplePerPixel+1]=buf[l*LineSize+i*Sample
PerPixel+1];
lpBits[i*SamplePerPixel+2]=buf[l*LineSize+i*Sample
PerPixel+0];
}
else
memcpy(lpBits, &buf[(int) (l*LineSize)], (int)
imageWidth*SamplePerPixel);
lpBits-=imageWidth*SamplePerPixel+Align;
}
}
}
GlobalUnlock(hStrip);
GlobalFree(hStrip);
GlobalUnlock(hDIB);
TIFFClose(tif);
}
return hDIB;
OutOfBufMemory:
TiffReadError:
GlobalUnlock(hDIB);
GlobalFree(hStrip);
OutOfDIBMemory:
TIFFClose(tif);
TiffOpenError:
return (HANDLE) 0;
}
static int checkcmap(int n, uint16* r, uint16* g, uint16* b)
{
while (n-- > 0)
if (*r++ >= 256 || *g++ >= 256 || *b++ >= 256)
return (16);
return (8);
}
/*************************************************************************
* All the following functions were created by microsoft, they are
* parts of the sample project "wincap" given with the SDK Win32.
*
* Microsoft says that :
*
* You have a royalty-free right to use, modify, reproduce and
* distribute the Sample Files (and/or any modified version) in
* any way you find useful, provided that you agree that
* Microsoft has no warranty obligations or liability for any
* Sample Application Files which are modified.
*
************************************************************************/
HDIB CreateDIB(DWORD dwWidth, DWORD dwHeight, WORD wBitCount)
{
BITMAPINFOHEADER bi; // bitmap header
LPBITMAPINFOHEADER lpbi; // pointer to BITMAPINFOHEADER
DWORD dwLen; // size of memory block
HDIB hDIB;
DWORD dwBytesPerLine; // Number of bytes per scanline
// Make sure bits per pixel is valid
if (wBitCount <= 1)
wBitCount = 1;
else if (wBitCount <= 4)
wBitCount = 4;
else if (wBitCount <= 8)
wBitCount = 8;
else if (wBitCount <= 24)
wBitCount = 24;
else
wBitCount = 4; // set default value to 4 if parameter is bogus
// initialize BITMAPINFOHEADER
bi.biSize = sizeof(BITMAPINFOHEADER);
bi.biWidth = dwWidth; // fill in width from parameter
bi.biHeight = dwHeight; // fill in height from parameter
bi.biPlanes = 1; // must be 1
bi.biBitCount = wBitCount; // from parameter
bi.biCompression = BI_RGB;
bi.biSizeImage = (dwWidth*dwHeight*wBitCount)/8; //0; // 0's here
mean "default"
bi.biXPelsPerMeter = 2834; //0;
bi.biYPelsPerMeter = 2834; //0;
bi.biClrUsed = 0;
bi.biClrImportant = 0;
// calculate size of memory block required to store the DIB. This
// block should be big enough to hold the BITMAPINFOHEADER, the color
// table, and the bits
dwBytesPerLine = (((wBitCount * dwWidth) + 31) / 32 * 4);
dwLen = bi.biSize + PaletteSize((LPSTR)&bi) + (dwBytesPerLine * dwHeight);
// alloc memory block to store our bitmap
hDIB = GlobalAlloc(GHND, dwLen);
// major bummer if we couldn't get memory block
if (!hDIB)
{
return NULL;
}
// lock memory and get pointer to it
lpbi = (VOID FAR *)GlobalLock(hDIB);
// use our bitmap info structure to fill in first part of
// our DIB with the BITMAPINFOHEADER
*lpbi = bi;
// Since we don't know what the colortable and bits should contain,
// just leave these blank. Unlock the DIB and return the HDIB.
GlobalUnlock(hDIB);
/* return handle to the DIB */
return hDIB;
}
LPSTR FAR FindDIBBits(LPSTR lpDIB)
{
return (lpDIB + *(LPDWORD)lpDIB + PaletteSize(lpDIB));
}
WORD FAR PaletteSize(LPSTR lpDIB)
{
/* calculate the size required by the palette */
if (IS_WIN30_DIB (lpDIB))
return (DIBNumColors(lpDIB) * sizeof(RGBQUAD));
else
return (DIBNumColors(lpDIB) * sizeof(RGBTRIPLE));
}
WORD DIBNumColors(LPSTR lpDIB)
{
WORD wBitCount; // DIB bit count
/* If this is a Windows-style DIB, the number of colors in the
* color table can be less than the number of bits per pixel
* allows for (i.e. lpbi->biClrUsed can be set to some value).
* If this is the case, return the appropriate value.
*/
if (IS_WIN30_DIB(lpDIB))
{
DWORD dwClrUsed;
dwClrUsed = ((LPBITMAPINFOHEADER)lpDIB)->biClrUsed;
if (dwClrUsed)
return (WORD)dwClrUsed;
}
/* Calculate the number of colors in the color table based on
* the number of bits per pixel for the DIB.
*/
if (IS_WIN30_DIB(lpDIB))
wBitCount = ((LPBITMAPINFOHEADER)lpDIB)->biBitCount;
else
wBitCount = ((LPBITMAPCOREHEADER)lpDIB)->bcBitCount;
/* return number of colors based on bits per pixel */
switch (wBitCount)
{
case 1:
return 2;
case 4:
return 16;
case 8:
return 256;
default:
return 0;
}
}
/*
* Local Variables:
* mode: c
* c-basic-offset: 8
* fill-column: 78
* End:
*/

View File

@ -1,86 +0,0 @@
#
# Tag Image File Format (TIFF) Software
#
# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# Process this file with automake to produce Makefile.in.
docdir = $(LIBTIFF_DOCDIR)/html
docfiles = \
addingtags.html \
bugs.html \
build.html \
contrib.html \
document.html \
images.html \
index.html \
internals.html \
intro.html \
libtiff.html \
misc.html \
support.html \
TIFFTechNote2.html \
tools.html \
v3.4beta007.html \
v3.4beta016.html \
v3.4beta018.html \
v3.4beta024.html \
v3.4beta028.html \
v3.4beta029.html \
v3.4beta031.html \
v3.4beta032.html \
v3.4beta033.html \
v3.4beta034.html \
v3.4beta035.html \
v3.4beta036.html \
v3.5.1.html \
v3.5.2.html \
v3.5.3.html \
v3.5.4.html \
v3.5.5.html \
v3.5.6-beta.html \
v3.5.7.html \
v3.6.0.html \
v3.6.1.html \
v3.7.0alpha.html \
v3.7.0beta.html \
v3.7.0beta2.html \
v3.7.0.html \
v3.7.1.html \
v3.7.2.html \
v3.7.3.html \
v3.7.4.html \
v3.8.0.html \
v3.8.1.html \
v3.8.2.html \
v3.9.0beta.html \
v3.9.1.html \
v3.9.2.html \
v4.0.0.html \
v4.0.1.html \
v4.0.2.html
dist_doc_DATA = $(docfiles)
SUBDIRS = images man

View File

@ -1,707 +0,0 @@
<pre>
DRAFT TIFF Technical Note #2 17-Mar-95
============================
This Technical Note describes serious problems that have been found in
TIFF 6.0's design for embedding JPEG-compressed data in TIFF (Section 22
of the TIFF 6.0 spec of 3 June 1992). A replacement TIFF/JPEG
specification is given. Some corrections to Section 21 are also given.
To permit TIFF implementations to continue to read existing files, the 6.0
JPEG fields and tag values will remain reserved indefinitely. However,
TIFF writers are strongly discouraged from using the 6.0 JPEG design. It
is expected that the next full release of the TIFF specification will not
describe the old design at all, except to note that certain tag numbers
are reserved. The existing Section 22 will be replaced by the
specification text given in the second part of this Tech Note.
Problems in TIFF 6.0 JPEG
=========================
Abandoning a published spec is not a step to be taken lightly. This
section summarizes the reasons that have forced this decision.
TIFF 6.0's JPEG design suffers from design errors and limitations,
ambiguities, and unnecessary complexity.
Design errors and limitations
-----------------------------
The fundamental design error in the existing Section 22 is that JPEG's
various tables and parameters are broken out as separate fields which the
TIFF control logic must manage. This is bad software engineering: that
information should be treated as private to the JPEG codec
(compressor/decompressor). Worse, the fields themselves are specified
without sufficient thought for future extension and without regard to
well-established TIFF conventions. Here are some of the significant
problems:
* The JPEGxxTable fields do not store the table data directly in the
IFD/field structure; rather, the fields hold pointers to information
elsewhere in the file. This requires special-purpose code to be added to
*every* TIFF-manipulating application, whether it needs to decode JPEG
image data or not. Even a trivial TIFF editor, for example a program to
add an ImageDescription field to a TIFF file, must be explicitly aware of
the internal structure of the JPEG-related tables, or else it will probably
break the file. Every other auxiliary field in the TIFF spec contains
data, not pointers, and can be copied or relocated by standard code that
doesn't know anything about the particular field. This is a crucial
property of the TIFF format that must not be given up.
* To manipulate these fields, the TIFF control logic is required to know a
great deal about JPEG details, for example such arcana as how to compute
the length of a Huffman code table --- the length is not supplied in the
field structure and can only be found by inspecting the table contents.
This is again a violation of good software practice. Moreover, it will
prevent easy adoption of future JPEG extensions that might change these
low-level details.
* The design neglects the fact that baseline JPEG codecs support only two
sets of Huffman tables: it specifies a separate table for each color
component. This implies that encoders must waste space (by storing
duplicate Huffman tables) or else violate the well-founded TIFF convention
that prohibits duplicate pointers. Furthermore, baseline decoders must
test to find out which tables are identical, a waste of time and code
space.
* The JPEGInterchangeFormat field also violates TIFF's proscription against
duplicate pointers: the normal strip/tile pointers are expected to point
into the larger data area pointed to by JPEGInterchangeFormat. All TIFF
editing applications must be specifically aware of this relationship, since
they must maintain it or else delete the JPEGInterchangeFormat field. The
JPEGxxTables fields are also likely to point into the JPEGInterchangeFormat
area, creating additional pointer relationships that must be maintained.
* The JPEGQTables field is fixed at a byte per table entry; there is no
way to support 16-bit quantization values. This is a serious impediment
to extending TIFF to use 12-bit JPEG.
* The 6.0 design cannot support using different quantization tables in
different strips/tiles of an image (so as to encode some areas at higher
quality than others). Furthermore, since quantization tables are tied
one-for-one to color components, the design cannot support table switching
options that are likely to be added in future JPEG revisions.
Ambiguities
-----------
Several incompatible interpretations are possible for 6.0's treatment of
JPEG restart markers:
* It is unclear whether restart markers must be omitted at TIFF segment
(strip/tile) boundaries, or whether they are optional.
* It is unclear whether the segment size is required to be chosen as
a multiple of the specified restart interval (if any); perhaps the
JPEG codec is supposed to be reset at each segment boundary as if
there were a restart marker there, even if the boundary does not fall
at a multiple of the nominal restart interval.
* The spec fails to address the question of restart marker numbering:
do the numbers begin again within each segment, or not?
That last point is particularly nasty. If we make numbering begin again
within each segment, we give up the ability to impose a TIFF strip/tile
structure on an existing JPEG datastream with restarts (which was clearly a
goal of Section 22's authors). But the other choice interferes with random
access to the image segments: a reader must compute the first restart
number to be expected within a segment, and must have a way to reset its
JPEG decoder to expect a nonzero restart number first. This may not even
be possible with some JPEG chips.
The tile height restriction found on page 104 contradicts Section 15's
general description of tiles. For an image that is not vertically
downsampled, page 104 specifies a tile height of one MCU or 8 pixels; but
Section 15 requires tiles to be a multiple of 16 pixels high.
This Tech Note does not attempt to resolve these ambiguities, so
implementations that follow the 6.0 design should be aware that
inter-application compatibility problems are likely to arise.
Unnecessary complexity
----------------------
The 6.0 design creates problems for implementations that need to keep the
JPEG codec separate from the TIFF control logic --- for example, consider
using a JPEG chip that was not designed specifically for TIFF. JPEG codecs
generally want to produce or consume a standard ISO JPEG datastream, not
just raw compressed data. (If they were to handle raw data, a separate
out-of-band mechanism would be needed to load tables into the codec.)
With such a codec, the TIFF control logic must parse JPEG markers emitted
by the codec to create the TIFF table fields (when writing) or synthesize
JPEG markers from the TIFF fields to feed the codec (when reading). This
means that the control logic must know a great deal more about JPEG details
than we would like. The parsing and reconstruction of the markers also
represents a fair amount of unnecessary work.
Quite a few implementors have proposed writing "TIFF/JPEG" files in which
a standard JPEG datastream is simply dumped into the file and pointed to
by JPEGInterchangeFormat. To avoid parsing the JPEG datastream, they
suggest not writing the JPEG auxiliary fields (JPEGxxTables etc) nor even
the basic TIFF strip/tile data pointers. This approach is incompatible
with implementations that handle the full TIFF 6.0 JPEG design, since they
will expect to find strip/tile pointers and auxiliary fields. Indeed this
is arguably not TIFF at all, since *all* TIFF-reading applications expect
to find strip or tile pointers. A subset implementation that is not
upward-compatible with the full spec is clearly unacceptable. However,
the frequency with which this idea has come up makes it clear that
implementors find the existing Section 22 too complex.
Overview of the solution
========================
To solve these problems, we adopt a new design for embedding
JPEG-compressed data in TIFF files. The new design uses only complete,
uninterpreted ISO JPEG datastreams, so it should be much more forgiving of
extensions to the ISO standard. It should also be far easier to implement
using unmodified JPEG codecs.
To reduce overhead in multi-segment TIFF files, we allow JPEG overhead
tables to be stored just once in a JPEGTables auxiliary field. This
feature does not violate the integrity of the JPEG datastreams, because it
uses the notions of "tables-only datastreams" and "abbreviated image
datastreams" as defined by the ISO standard.
To prevent confusion with the old design, the new design is given a new
Compression tag value, Compression=7. Readers that need to handle
existing 6.0 JPEG files may read both old and new files, using whatever
interpretation of the 6.0 spec they did before. Compression tag value 6
and the field tag numbers defined by 6.0 section 22 will remain reserved
indefinitely, even though detailed descriptions of them will be dropped
from future editions of the TIFF specification.
Replacement TIFF/JPEG specification
===================================
[This section of the Tech Note is expected to replace Section 22 in the
next release of the TIFF specification.]
This section describes TIFF compression scheme 7, a high-performance
compression method for continuous-tone images.
Introduction
------------
This TIFF compression method uses the international standard for image
compression ISO/IEC 10918-1, usually known as "JPEG" (after the original
name of the standards committee, Joint Photographic Experts Group). JPEG
is a joint ISO/CCITT standard for compression of continuous-tone images.
The JPEG committee decided that because of the broad scope of the standard,
no one algorithmic procedure was able to satisfy the requirements of all
applications. Instead, the JPEG standard became a "toolkit" of multiple
algorithms and optional capabilities. Individual applications may select
a subset of the JPEG standard that meets their requirements.
The most important distinction among the JPEG processes is between lossy
and lossless compression. Lossy compression methods provide high
compression but allow only approximate reconstruction of the original
image. JPEG's lossy processes allow the encoder to trade off compressed
file size against reconstruction fidelity over a wide range. Typically,
10:1 or more compression of full-color data can be obtained while keeping
the reconstructed image visually indistinguishable from the original. Much
higher compression ratios are possible if a low-quality reconstructed image
is acceptable. Lossless compression provides exact reconstruction of the
source data, but the achievable compression ratio is much lower than for
the lossy processes; JPEG's rather simple lossless process typically
achieves around 2:1 compression of full-color data.
The most widely implemented JPEG subset is the "baseline" JPEG process.
This provides lossy compression of 8-bit-per-channel data. Optional
extensions include 12-bit-per-channel data, arithmetic entropy coding for
better compression, and progressive/hierarchical representations. The
lossless process is an independent algorithm that has little in
common with the lossy processes.
It should be noted that the optional arithmetic-coding extension is subject
to several US and Japanese patents. To avoid patent problems, use of
arithmetic coding processes in TIFF files intended for inter-application
interchange is discouraged.
All of the JPEG processes are useful only for "continuous tone" data,
in which the difference between adjacent pixel values is usually small.
Low-bit-depth source data is not appropriate for JPEG compression, nor
are palette-color images good candidates. The JPEG processes work well
on grayscale and full-color data.
Describing the JPEG compression algorithms in sufficient detail to permit
implementation would require more space than we have here. Instead, we
refer the reader to the References section.
What data is being compressed?
------------------------------
In lossy JPEG compression, it is customary to convert color source data
to YCbCr and then downsample it before JPEG compression. This gives
2:1 data compression with hardly any visible image degradation, and it
permits additional space savings within the JPEG compression step proper.
However, these steps are not considered part of the ISO JPEG standard.
The ISO standard is "color blind": it accepts data in any color space.
For TIFF purposes, the JPEG compression tag is considered to represent the
ISO JPEG compression standard only. The ISO standard is applied to the
same data that would be stored in the TIFF file if no compression were
used. Therefore, if color conversion or downsampling are used, they must
be reflected in the regular TIFF fields; these steps are not considered to
be implicit in the JPEG compression tag value. PhotometricInterpretation
and related fields shall describe the color space actually stored in the
file. With the TIFF 6.0 field definitions, downsampling is permissible
only for YCbCr data, and it must correspond to the YCbCrSubSampling field.
(Note that the default value for this field is not 1,1; so the default for
YCbCr is to apply downsampling!) It is likely that future versions of TIFF
will provide additional PhotometricInterpretation values and a more general
way of defining subsampling, so as to allow more flexibility in
JPEG-compressed files. But that issue is not addressed in this Tech Note.
Implementors should note that many popular JPEG codecs
(compressor/decompressors) provide automatic color conversion and
downsampling, so that the application may supply full-size RGB data which
is nonetheless converted to downsampled YCbCr. This is an implementation
convenience which does not excuse the TIFF control layer from its
responsibility to know what is really going on. The
PhotometricInterpretation and subsampling fields written to the file must
describe what is actually in the file.
A JPEG-compressed TIFF file will typically have PhotometricInterpretation =
YCbCr and YCbCrSubSampling = [2,1] or [2,2], unless the source data was
grayscale or CMYK.
Basic representation of JPEG-compressed images
----------------------------------------------
JPEG compression works in either strip-based or tile-based TIFF files.
Rather than repeating "strip or tile" constantly, we will use the term
"segment" to mean either a strip or a tile.
When the Compression field has the value 7, each image segment contains
a complete JPEG datastream which is valid according to the ISO JPEG
standard (ISO/IEC 10918-1). Any sequential JPEG process can be used,
including lossless JPEG, but progressive and hierarchical processes are not
supported. Since JPEG is useful only for continuous-tone images, the
PhotometricInterpretation of the image shall not be 3 (palette color) nor
4 (transparency mask). The bit depth of the data is also restricted as
specified below.
Each image segment in a JPEG-compressed TIFF file shall contain a valid
JPEG datastream according to the ISO JPEG standard's rules for
interchange-format or abbreviated-image-format data. The datastream shall
contain a single JPEG frame storing that segment of the image. The
required JPEG markers within a segment are:
SOI (must appear at very beginning of segment)
SOFn
SOS (one for each scan, if there is more than one scan)
EOI (must appear at very end of segment)
The actual compressed data follows SOS; it may contain RSTn markers if DRI
is used.
Additional JPEG "tables and miscellaneous" markers may appear between SOI
and SOFn, between SOFn and SOS, and before each subsequent SOS if there is
more than one scan. These markers include:
DQT
DHT
DAC (not to appear unless arithmetic coding is used)
DRI
APPn (shall be ignored by TIFF readers)
COM (shall be ignored by TIFF readers)
DNL markers shall not be used in TIFF files. Readers should abort if any
other marker type is found, especially the JPEG reserved markers;
occurrence of such a marker is likely to indicate a JPEG extension.
The tables/miscellaneous markers may appear in any order. Readers are
cautioned that although the SOFn marker refers to DQT tables, JPEG does not
require those tables to precede the SOFn, only the SOS. Missing-table
checks should be made when SOS is reached.
If no JPEGTables field is used, then each image segment shall be a complete
JPEG interchange datastream. Each segment must define all the tables it
references. To allow readers to decode segments in any order, no segment
may rely on tables being carried over from a previous segment.
When a JPEGTables field is used, image segments may omit tables that have
been specified in the JPEGTables field. Further details appear below.
The SOFn marker shall be of type SOF0 for strict baseline JPEG data, of
type SOF1 for non-baseline lossy JPEG data, or of type SOF3 for lossless
JPEG data. (SOF9 or SOF11 would be used for arithmetic coding.) All
segments of a JPEG-compressed TIFF image shall use the same JPEG
compression process, in particular the same SOFn type.
The data precision field of the SOFn marker shall agree with the TIFF
BitsPerSample field. (Note that when PlanarConfiguration=1, this implies
that all components must have the same BitsPerSample value; when
PlanarConfiguration=2, different components could have different bit
depths.) For SOF0 only precision 8 is permitted; for SOF1, precision 8 or
12 is permitted; for SOF3, precisions 2 to 16 are permitted.
The image dimensions given in the SOFn marker shall agree with the logical
dimensions of that particular strip or tile. For strip images, the SOFn
image width shall equal ImageWidth and the height shall equal RowsPerStrip,
except in the last strip; its SOFn height shall equal the number of rows
remaining in the ImageLength. (In other words, no padding data is counted
in the SOFn dimensions.) For tile images, each SOFn shall have width
TileWidth and height TileHeight; adding and removing any padding needed in
the edge tiles is the concern of some higher level of the TIFF software.
(The dimensional rules are slightly different when PlanarConfiguration=2,
as described below.)
The ISO JPEG standard only permits images up to 65535 pixels in width or
height, due to 2-byte fields in the SOFn markers. In TIFF, this limits
the size of an individual JPEG-compressed strip or tile, but the total
image size can be greater.
The number of components in the JPEG datastream shall equal SamplesPerPixel
for PlanarConfiguration=1, and shall be 1 for PlanarConfiguration=2. The
components shall be stored in the same order as they are described at the
TIFF field level. (This applies both to their order in the SOFn marker,
and to the order in which they are scanned if multiple JPEG scans are
used.) The component ID bytes are arbitrary so long as each component
within an image segment is given a distinct ID. To avoid any possible
confusion, we require that all segments of a TIFF image use the same ID
code for a given component.
In PlanarConfiguration 1, the sampling factors given in SOFn markers shall
agree with the sampling factors defined by the related TIFF fields (or with
the default values that are specified in the absence of those fields).
When DCT-based JPEG is used in a strip TIFF file, RowsPerStrip is required
to be a multiple of 8 times the largest vertical sampling factor, i.e., a
multiple of the height of an interleaved MCU. (For simplicity of
specification, we require this even if the data is not actually
interleaved.) For example, if YCbCrSubSampling = [2,2] then RowsPerStrip
must be a multiple of 16. An exception to this rule is made for
single-strip images (RowsPerStrip >= ImageLength): the exact value of
RowsPerStrip is unimportant in that case. This rule ensures that no data
padding is needed at the bottom of a strip, except perhaps the last strip.
Any padding required at the right edge of the image, or at the bottom of
the last strip, is expected to occur internally to the JPEG codec.
When DCT-based JPEG is used in a tiled TIFF file, TileLength is required
to be a multiple of 8 times the largest vertical sampling factor, i.e.,
a multiple of the height of an interleaved MCU; and TileWidth is required
to be a multiple of 8 times the largest horizontal sampling factor, i.e.,
a multiple of the width of an interleaved MCU. (For simplicity of
specification, we require this even if the data is not actually
interleaved.) All edge padding required will therefore occur in the course
of normal TIFF tile padding; it is not special to JPEG.
Lossless JPEG does not impose these constraints on strip and tile sizes,
since it is not DCT-based.
Note that within JPEG datastreams, multibyte values appear in the MSB-first
order specified by the JPEG standard, regardless of the byte ordering of
the surrounding TIFF file.
JPEGTables field
----------------
The only auxiliary TIFF field added for Compression=7 is the optional
JPEGTables field. The purpose of JPEGTables is to predefine JPEG
quantization and/or Huffman tables for subsequent use by JPEG image
segments. When this is done, these rather bulky tables need not be
duplicated in each segment, thus saving space and processing time.
JPEGTables may be used even in a single-segment file, although there is no
space savings in that case.
JPEGTables:
Tag = 347 (15B.H)
Type = UNDEFINED
N = number of bytes in tables datastream, typically a few hundred
JPEGTables provides default JPEG quantization and/or Huffman tables which
are used whenever a segment datastream does not contain its own tables, as
specified below.
Notice that the JPEGTables field is required to have type code UNDEFINED,
not type code BYTE. This is to cue readers that expanding individual bytes
to short or long integers is not appropriate. A TIFF reader will generally
need to store the field value as an uninterpreted byte sequence until it is
fed to the JPEG decoder.
Multibyte quantities within the tables follow the ISO JPEG convention of
MSB-first storage, regardless of the byte ordering of the surrounding TIFF
file.
When the JPEGTables field is present, it shall contain a valid JPEG
"abbreviated table specification" datastream. This datastream shall begin
with SOI and end with EOI. It may contain zero or more JPEG "tables and
miscellaneous" markers, namely:
DQT
DHT
DAC (not to appear unless arithmetic coding is used)
DRI
APPn (shall be ignored by TIFF readers)
COM (shall be ignored by TIFF readers)
Since JPEG defines the SOI marker to reset the DAC and DRI state, these two
markers' values cannot be carried over into any image datastream, and thus
they are effectively no-ops in the JPEGTables field. To avoid confusion,
it is recommended that writers not place DAC or DRI markers in JPEGTables.
However readers must properly skip over them if they appear.
When JPEGTables is present, readers shall load the table specifications
contained in JPEGTables before processing image segment datastreams.
Image segments may simply refer to these preloaded tables without defining
them. An image segment can still define and use its own tables, subject to
the restrictions below.
An image segment may not redefine any table defined in JPEGTables. (This
restriction is imposed to allow readers to process image segments in random
order without having to reload JPEGTables between segments.) Therefore, use
of JPEGTables divides the available table slots into two groups: "global"
slots are defined in JPEGTables and may be used but not redefined by
segments; "local" slots are available for local definition and use in each
segment. To permit random access, a segment may not reference any local
tables that it does not itself define.
Special considerations for PlanarConfiguration 2
------------------------------------------------
In PlanarConfiguration 2, each image segment contains data for only one
color component. To avoid confusing the JPEG codec, we wish the segments
to look like valid single-channel (i.e., grayscale) JPEG datastreams. This
means that different rules must be used for the SOFn parameters.
In PlanarConfiguration 2, the dimensions given in the SOFn of a subsampled
component shall be scaled down by the sampling factors compared to the SOFn
dimensions that would be used in PlanarConfiguration 1. This is necessary
to match the actual number of samples stored in that segment, so that the
JPEG codec doesn't complain about too much or too little data. In strip
TIFF files the computed dimensions may need to be rounded up to the next
integer; in tiled files, the restrictions on tile size make this case
impossible.
Furthermore, all SOFn sampling factors shall be given as 1. (This is
merely to avoid confusion, since the sampling factors in a single-channel
JPEG datastream have no real effect.)
Any downsampling will need to happen externally to the JPEG codec, since
JPEG sampling factors are defined with reference to the full-precision
component. In PlanarConfiguration 2, the JPEG codec will be working on
only one component at a time and thus will have no reference component to
downsample against.
Minimum requirements for TIFF/JPEG
----------------------------------
ISO JPEG is a large and complex standard; most implementations support only
a subset of it. Here we define a "core" subset of TIFF/JPEG which readers
must support to claim TIFF/JPEG compatibility. For maximum
cross-application compatibility, we recommend that writers confine
themselves to this subset unless there is very good reason to do otherwise.
Use the ISO baseline JPEG process: 8-bit data precision, Huffman coding,
with no more than 2 DC and 2 AC Huffman tables. Note that this implies
BitsPerSample = 8 for each component. We recommend deviating from baseline
JPEG only if 12-bit data precision or lossless coding is required.
Use no subsampling (all JPEG sampling factors = 1) for color spaces other
than YCbCr. (This is, in fact, required with the TIFF 6.0 field
definitions, but may not be so in future revisions.) For YCbCr, use one of
the following choices:
YCbCrSubSampling field JPEG sampling factors
1,1 1h1v, 1h1v, 1h1v
2,1 2h1v, 1h1v, 1h1v
2,2 (default value) 2h2v, 1h1v, 1h1v
We recommend that RGB source data be converted to YCbCr for best compression
results. Other source data colorspaces should probably be left alone.
Minimal readers need not support JPEG images with colorspaces other than
YCbCr and grayscale (PhotometricInterpretation = 6 or 1).
A minimal reader also need not support JPEG YCbCr images with nondefault
values of YCbCrCoefficients or YCbCrPositioning, nor with values of
ReferenceBlackWhite other than [0,255,128,255,128,255]. (These values
correspond to the RGB<=>YCbCr conversion specified by JFIF, which is widely
implemented in JPEG codecs.)
Writers are reminded that a ReferenceBlackWhite field *must* be included
when PhotometricInterpretation is YCbCr, because the default
ReferenceBlackWhite values are inappropriate for YCbCr.
If any subsampling is used, PlanarConfiguration=1 is preferred to avoid the
possibly-confusing requirements of PlanarConfiguration=2. In any case,
readers are not required to support PlanarConfiguration=2.
If possible, use a single interleaved scan in each image segment. This is
not legal JPEG if there are more than 4 SamplesPerPixel or if the sampling
factors are such that more than 10 blocks would be needed per MCU; in that
case, use a separate scan for each component. (The recommended color
spaces and sampling factors will not run into that restriction, so a
minimal reader need not support more than one scan per segment.)
To claim TIFF/JPEG compatibility, readers shall support multiple-strip TIFF
files and the optional JPEGTables field; it is not acceptable to read only
single-datastream files. Support for tiled TIFF files is strongly
recommended but not required.
Other recommendations for implementors
--------------------------------------
The TIFF tag Compression=7 guarantees only that the compressed data is
represented as ISO JPEG datastreams. Since JPEG is a large and evolving
standard, readers should apply careful error checking to the JPEG markers
to ensure that the compression process is within their capabilities. In
particular, to avoid being confused by future extensions to the JPEG
standard, it is important to abort if unknown marker codes are seen.
The point of requiring that all image segments use the same JPEG process is
to ensure that a reader need check only one segment to determine whether it
can handle the image. For example, consider a TIFF reader that has access
to fast but restricted JPEG hardware, as well as a slower, more general
software implementation. It is desirable to check only one image segment
to find out whether the fast hardware can be used. Thus, writers should
try to ensure that all segments of an image look as much "alike" as
possible: there should be no variation in scan layout, use of options such
as DRI, etc. Ideally, segments will be processed identically except
perhaps for using different local quantization or entropy-coding tables.
Writers should avoid including "noise" JPEG markers (COM and APPn markers).
Standard TIFF fields provide a better way to transport any non-image data.
Some JPEG codecs may change behavior if they see an APPn marker they
think they understand; since the TIFF spec requires these markers to be
ignored, this behavior is undesirable.
It is possible to convert an interchange-JPEG file (e.g., a JFIF file) to
TIFF simply by dropping the interchange datastream into a single strip.
(However, designers are reminded that the TIFF spec discourages huge
strips; splitting the image is somewhat more work but may give better
results.) Conversion from TIFF to interchange JPEG is more complex. A
strip-based TIFF/JPEG file can be converted fairly easily if all strips use
identical JPEG tables and no RSTn markers: just delete the overhead markers
and insert RSTn markers between strips. Converting tiled images is harder,
since the data will usually not be in the right order (unless the tiles are
only one MCU high). This can still be done losslessly, but it will require
undoing and redoing the entropy coding so that the DC coefficient
differences can be updated.
There is no default value for JPEGTables: standard TIFF files must define all
tables that they reference. For some closed systems in which many files will
have identical tables, it might make sense to define a default JPEGTables
value to avoid actually storing the tables. Or even better, invent a
private field selecting one of N default JPEGTables settings, so as to allow
for future expansion. Either of these must be regarded as a private
extension that will render the files unreadable by other applications.
References
----------
[1] Wallace, Gregory K. "The JPEG Still Picture Compression Standard",
Communications of the ACM, April 1991 (vol. 34 no. 4), pp. 30-44.
This is the best short technical introduction to the JPEG algorithms.
It is a good overview but does not provide sufficiently detailed
information to write an implementation.
[2] Pennebaker, William B. and Mitchell, Joan L. "JPEG Still Image Data
Compression Standard", Van Nostrand Reinhold, 1993, ISBN 0-442-01272-1.
638pp.
This textbook is by far the most complete exposition of JPEG in existence.
It includes the full text of the ISO JPEG standards (DIS 10918-1 and draft
DIS 10918-2). No would-be JPEG implementor should be without it.
[3] ISO/IEC IS 10918-1, "Digital Compression and Coding of Continuous-tone
Still Images, Part 1: Requirements and guidelines", February 1994.
ISO/IEC DIS 10918-2, "Digital Compression and Coding of Continuous-tone
Still Images, Part 2: Compliance testing", final approval expected 1994.
These are the official standards documents. Note that the Pennebaker and
Mitchell textbook is likely to be cheaper and more useful than the official
standards.
Changes to Section 21: YCbCr Images
===================================
[This section of the Tech Note clarifies section 21 to make clear the
interpretation of image dimensions in a subsampled image. Furthermore,
the section is changed to allow the original image dimensions not to be
multiples of the sampling factors. This change is necessary to support use
of JPEG compression on odd-size images.]
Add the following paragraphs to the Section 21 introduction (p. 89),
just after the paragraph beginning "When a Class Y image is subsampled":
In a subsampled image, it is understood that all TIFF image
dimensions are measured in terms of the highest-resolution
(luminance) component. In particular, ImageWidth, ImageLength,
RowsPerStrip, TileWidth, TileLength, XResolution, and YResolution
are measured in luminance samples.
RowsPerStrip, TileWidth, and TileLength are constrained so that
there are an integral number of samples of each component in a
complete strip or tile. However, ImageWidth/ImageLength are not
constrained. If an odd-size image is to be converted to subsampled
format, the writer should pad the source data to a multiple of the
sampling factors by replication of the last column and/or row, then
downsample. The number of luminance samples actually stored in the
file will be a multiple of the sampling factors. Conversely,
readers must ignore any extra data (outside the specified image
dimensions) after upsampling.
When PlanarConfiguration=2, each strip or tile covers the same
image area despite subsampling; that is, the total number of strips
or tiles in the image is the same for each component. Therefore
strips or tiles of the subsampled components contain fewer samples
than strips or tiles of the luminance component.
If there are extra samples per pixel (see field ExtraSamples),
these data channels have the same number of samples as the
luminance component.
Rewrite the YCbCrSubSampling field description (pp 91-92) as follows
(largely to eliminate possibly-misleading references to
ImageWidth/ImageLength of the subsampled components):
(first paragraph unchanged)
The two elements of this field are defined as follows:
Short 0: ChromaSubsampleHoriz:
1 = there are equal numbers of luma and chroma samples horizontally.
2 = there are twice as many luma samples as chroma samples
horizontally.
4 = there are four times as many luma samples as chroma samples
horizontally.
Short 1: ChromaSubsampleVert:
1 = there are equal numbers of luma and chroma samples vertically.
2 = there are twice as many luma samples as chroma samples
vertically.
4 = there are four times as many luma samples as chroma samples
vertically.
ChromaSubsampleVert shall always be less than or equal to
ChromaSubsampleHoriz. Note that Cb and Cr have the same sampling
ratios.
In a strip TIFF file, RowsPerStrip is required to be an integer
multiple of ChromaSubSampleVert (unless RowsPerStrip >=
ImageLength, in which case its exact value is unimportant).
If ImageWidth and ImageLength are not multiples of
ChromaSubsampleHoriz and ChromaSubsampleVert respectively, then the
source data shall be padded to the next integer multiple of these
values before downsampling.
In a tiled TIFF file, TileWidth must be an integer multiple of
ChromaSubsampleHoriz and TileLength must be an integer multiple of
ChromaSubsampleVert. Padding will occur to tile boundaries.
The default values of this field are [ 2,2 ]. Thus, YCbCr data is
downsampled by default!
</pre>

View File

@ -1,292 +0,0 @@
<HTML>
<HEAD>
<TITLE>
Modifying The TIFF Library
</TITLE>
</HEAD>
<BODY BGCOLOR=white>
<FONT FACE="Arial, Helvetica, Sans">
<H1>
Defining New TIFF Tags
</H1>
Libtiff has built-in knowledge of all the standard TIFF tags, as
well as extentions. The following describes how to add knowledge of
new tags as builtins to libtiff, or how to application specific tags can
be used by applications without modifying libtiff.
<p>
<h2>TIFFFieldInfo</h2>
How libtiff manages specific tags is primarily controlled by the
definition for that tag value stored internally as a TIFFFieldInfo structure.
This structure looks like this:
<p>
<pre>
typedef struct {
ttag_t field_tag; /* field's tag */
short field_readcount; /* read count/TIFF_VARIABLE/TIFF_SPP */
short field_writecount; /* write count/TIFF_VARIABLE */
TIFFDataType field_type; /* type of associated data */
unsigned short field_bit; /* bit in fieldsset bit vector */
unsigned char field_oktochange;/* if true, can change while writing */
unsigned char field_passcount;/* if true, pass dir count on set */
char *field_name; /* ASCII name */
} TIFFFieldInfo;
</pre>
<ul>
<li> <b>field_tag</b>: the tag number. For instance 277 for the
SamplesPerPixel tag. Builtin tags will generally have a #define in
tiff.h for each known tag. <p>
<li> <b>field_readcount</b>: The number of values which should be read.
The special value TIFF_VARIABLE (-1) indicates that a variable number of
values may be read. The special value TIFFTAG_SPP (-2) indicates that there
should be one value for each sample as defined by TIFFTAG_SAMPLESPERPIXEL.
The special value TIFF_VARIABLE2 (-3) is presumably similar to TIFF_VARIABLE
though I am not sure what the distinction in behaviour is. This field
is TIFF_VARIABLE for variable length ascii fields.<p>
<li> <b>field_writecount</b>: The number of values which should be written.
Generally the same as field_readcount. A few built-in exceptions exist, but
I haven't analysed why they differ. <p>
<li> <b>field_type</b>: Type of the field. One of TIFF_BYTE, TIFF_ASCII,
TIFF_SHORT, TIFF_LONG, TIFF_RATIONAL, TIFF_SBYTE, TIFF_UNDEFINED,
TIFF_SSHORT, TIFF_SLONG, TIFF_SRATIONAL, TIFF_FLOAT, TIFF_DOUBLE or
TIFF_IFD. Note that some fields can support more than one type (for
instance short and long). These fields should have multiple TIFFFieldInfos.
<p>
<li> <b>field_bit</b>: Built-in tags stored in special fields in the
TIFF structure have assigned field numbers to distinguish them (ie.
FIELD_SAMPLESPERPIXEL). New tags should generally just use
FIELD_CUSTOM indicating they are stored in the generic tag list.<p>
<li> <b>field_oktochange</b>: TRUE if it is OK to change this tag value
while an image is being written. FALSE for stuff that must be set once
and then left unchanged (like ImageWidth, or PhotometricInterpretation for
instance).<p>
<li> <b>field_passcount</b>: If TRUE, then the count value must be passed
in TIFFSetField(), and TIFFGetField(), otherwise the count is not required.
This should generally be TRUE for non-ascii variable count tags unless
the count is implicit (such as with the colormap).<p>
<li> <b>field_name</b>: A name for the tag. Normally mixed case (studly caps)
like "StripByteCounts" and relatively short. <p>
</ul>
A TIFFFieldInfo definition exists for each built-in tag in the tif_dirinfo.c
file. Some tags which support multiple data types have more than one
definition, one per data type supported. <p>
Various functions exist for getting the internal TIFFFieldInfo definitions,
including _TIFFFindFieldInfo(), and _TIFFFindFieldInfoByName(). See
tif_dirinfo.c for details. There must be some mechanism to get the whole
list, though I don't see it off hand.<p>
<h2>Default Tag Auto-registration</h2>
In libtiff 3.6.0 a new mechanism was introduced allowing libtiff to
read unrecognised tags automatically. When an unknown tags is encountered,
it is automatically internally defined with a default name and a type
derived from the tag value in the file. Applications only need to predefine
application specific tags if they need to be able to set them in a file, or
if particular calling conventions are desired for TIFFSetField() and
TIFFGetField().<p>
When tags are autodefined like this the <b>field_readcount</b> and
<b>field_writecount</b> values are always TIFF_VARIABLE. The
<b>field_passcount</b> is always TRUE, and the <b>field_bit</b> is
FIELD_CUSTOM. The field name will be "Tag %d" where the %d is the tag
number.<p>
<h2>Defining Application Tags</h2>
For various reasons, it is common for applications to want to define
their own tags to store information outside the core TIFF specification.
This is done by calling TIFFMergeFieldInfo() with one or more TIFFFieldInfos.
<p>
The libgeotiff library provides geospatial information extentions within
a TIFF file. First, a set of TIFFFieldInfo's is prepared with information
on the new tags:<p>
<pre>
static const TIFFFieldInfo xtiffFieldInfo[] = {
/* XXX Insert Your tags here */
{ TIFFTAG_GEOPIXELSCALE, -1,-1, TIFF_DOUBLE, FIELD_CUSTOM,
TRUE, TRUE, "GeoPixelScale" },
{ TIFFTAG_GEOTRANSMATRIX, -1,-1, TIFF_DOUBLE, FIELD_CUSTOM,
TRUE, TRUE, "GeoTransformationMatrix" },
{ TIFFTAG_GEOTIEPOINTS, -1,-1, TIFF_DOUBLE, FIELD_CUSTOM,
TRUE, TRUE, "GeoTiePoints" },
{ TIFFTAG_GEOKEYDIRECTORY, -1,-1, TIFF_SHORT, FIELD_CUSTOM,
TRUE, TRUE, "GeoKeyDirectory" },
{ TIFFTAG_GEODOUBLEPARAMS, -1,-1, TIFF_DOUBLE, FIELD_CUSTOM,
TRUE, TRUE, "GeoDoubleParams" },
{ TIFFTAG_GEOASCIIPARAMS, -1,-1, TIFF_ASCII, FIELD_CUSTOM,
TRUE, FALSE, "GeoASCIIParams" }
};
</pre>
In order to define the tags, we call TIFFMergeFieldInfo() on the
desired TIFF handle with the list of TIFFFieldInfos.<p>
<pre>
#define N(a) (sizeof (a) / sizeof (a[0]))
/* Install the extended Tag field info */
TIFFMergeFieldInfo(tif, xtiffFieldInfo, N(xtiffFieldInfo));
</pre>
The tags need to be defined for each TIFF file opened - and when reading
they should be defined before the tags of the file are read, yet a valid
TIFF * is needed to merge the tags against. In order to get them
registered at the appropriate part of the setup process, it is necessary
to register our merge function as an extender callback with libtiff.
This is done with TIFFSetTagExtender(). We also keep track of the
previous tag extender (if any) so that we can call it from our extender
allowing a chain of customizations to take effect. <P>
<pre>
static TIFFExtendProc _ParentExtender = NULL;
static
void _XTIFFInitialize(void)
{
static int first_time=1;
if (! first_time) return; /* Been there. Done that. */
first_time = 0;
/* Grab the inherited method and install */
_ParentExtender = TIFFSetTagExtender(_XTIFFDefaultDirectory);
}
</pre>
The extender callback is looks like this. It merges in our new fields
and then calls the next extender if there is one in effect.<p>
<pre>
static void
_XTIFFDefaultDirectory(TIFF *tif)
{
/* Install the extended Tag field info */
TIFFMergeFieldInfo(tif, xtiffFieldInfo, N(xtiffFieldInfo));
/* Since an XTIFF client module may have overridden
* the default directory method, we call it now to
* allow it to set up the rest of its own methods.
*/
if (_ParentExtender)
(*_ParentExtender)(tif);
}
</pre>
The above approach ensures that our new definitions are used when reading
or writing any TIFF file. However, since on reading we already have
default definitions for tags, it is usually not critical to pre-define them.
If tag definitions are only required for writing custom tags, you can just
call TIFFMergeFieldInfo() before setting new tags. The whole extender
architecture can then be avoided.<p>
<A NAME=AddingTags><P><H2>Adding New Builtin Tags</H2></A>
A similar approach is taken to the above. However, the TIFFFieldInfo
should be added to the tiffFieldInfo[] list in tif_dirinfo.c. Ensure that
new tags are added in sorted order by the tag number.<p>
Normally new built-in tags should be defined with FIELD_CUSTOM; however, if
it is desirable for the tag value to have it's own field in the TIFFDirectory
structure, then you will need to #define a new FIELD_ value for it, and
add appropriate handling as follows:
<OL>
<LI>Define the tag in <B>tiff.h</B>.
<LI>Add a field to the directory structure in <B>tif_dir.h</B>
and define a <TT>FIELD_*</TT> bit (also update the definition of
<TT>FIELD_CODEC</TT> to reflect your addition).
<LI>Add an entry in the <TT>TIFFFieldInfo</TT> array defined at the top of
<B>tif_dirinfo.c</B>.
Note that you must keep this array sorted by tag
number and that the widest variant entry for a tag should come
first (e.g. <TT>LONG</TT> before <TT>SHORT</TT>).
<LI>Add entries in <TT>_TIFFVSetField()</TT> and <TT>_TIFFVGetField()</TT>
for the new tag.
<LI>(<I>optional</I>) If the value associated with the tag is not a scalar value
(e.g. the array for <TT>TransferFunction</TT>) and requires
special processing,
then add the appropriate code to <TT>TIFFReadDirectory()</TT> and
<TT>TIFFWriteDirectory()</TT>. You're best off finding a similar tag and
cribbing code.
<LI>Add support to <TT>TIFFPrintDirectory()</TT> in <B>tif_print.c</B>
to print the tag's value.
</OL>
<P>
If you want to maintain portability, beware of making assumptions
about data types. Use the typedefs (<TT>uint16</TT>, etc. when dealing with
data on disk and <TT>t*_t</TT> when stuff is in memory) and be careful about
passing items through printf or similar vararg interfaces.
<A NAME=AddingCODECTags><P><H2>Adding New Codec-private Tags</H2></A>
To add tags that are meaningful <EM>only when a particular compression
algorithm is used</EM> follow these steps:
<OL>
<LI>Define the tag in <B>tiff.h</B>.
<LI>Allocate storage for the tag values in the private state block of
the codec.
<LI>Insure the state block is created when the codec is initialized.
<LI>At <TT>TIFFInitfoo</TT> time override the method pointers in the
TIFF structure
for getting, setting and printing tag values. For example,
<PRE>
sp->vgetparent = tif->tif_vgetfield;
tif->tif_vgetfield = fooVGetField; /* hook for codec tags */
sp->vsetparent = tif->tif_vsetfield;
tif->tif_vsetfield = fooVSetField; /* hook for codec tags */
tif->tif_printdir = fooPrintDir; /* hook for codec tags */
</PRE>
(Actually you may decide not to override the
<TT>tif_printdir</TT> method, but rather just specify it).
<LI>Create a private <TT>TIFFFieldInfo</TT> array for your tags and
merge them into the core tags at initialization time using
<TT>_TIFFMergeFieldInfo</TT>; e.g.
<PRE>
_TIFFMergeFieldInfo(tif, fooFieldInfo, N(fooFieldInfo));
</PRE>
(where <TT>N</TT> is a macro used liberaly throughout the distributed code).
<LI>Fill in the get and set routines. Be sure to call the parent method
for tags that you are not handled directly. Also be sure to set the
<TT>FIELD_*</TT> bits for tags that are to be written to the file. Note that
you can create ``pseudo-tags'' by defining tags that are processed
exclusively in the get/set routines and never written to file (see
the handling of <TT>TIFFTAG_FAXMODE</TT> in <B>tif_fax3.c</B>
for an example of this).
<LI>Fill in the print routine, if appropriate.
</OL>
Note that space has been allocated in the <TT>FIELD_*</TT> bit space for
codec-private tags. Define your bits as <TT>FIELD_CODEC+&lt;offset&gt;</TT> to
keep them away from the core tags. If you need more tags than there
is room for, just increase <TT>FIELD_SETLONGS</TT> at the top of
<B>tiffiop.h</B>.
<HR>
Last updated: $Date: 2004-09-10 14:43:18 $
</BODY>
</HTML>

View File

@ -1,63 +0,0 @@
<HTML>
<HEAD>
<TITLE>Bugs and the TIFF Mailing List</TITLE>
</HEAD>
<BODY BGCOLOR=white>
<FONT FACE="Arial, Helvetica, Sans">
<H1>
<IMG SRC=images/cover.jpg WIDTH=110 HEIGHT=110 ALIGN=left BORDER=1 HSPACE=6>
Bugs, Bugzilla, and the TIFF Mailing List
</H1>
<P>
This software is free. Please let us know when you find a problem or
fix a bug.
<P>
Thanks to <A HREF=http://www.maptools.org/>MapTools.org</a>, libtiff now uses
bugzilla to track bugs. All bugs filed in the older bugzilla at
bugzilla.remotesensing.org (pre April 2008) have unfortunately been lost.
<P>
If you think you've discovered a bug, please first check to see if it is
already known by looking at the list of already reported bugs. You can do so
by visiting the buglist at
<A HREF=http://bugzilla.maptools.org/buglist.cgi?product=libtiff>http://bugzilla.maptools.org/buglist.cgi?product=libtiff</A>. Also verify that
the problem is still reproducable with the current development software
from CVS.
<P>
If you'd like to enter a new bug, you can do so at
<A HREF=http://bugzilla.maptools.org/enter_bug.cgi?product=libtiff>http://bugzilla.maptools.org/enter_bug.cgi?product=libtiff</A>.
<P>
If you'd like to inform us about some kind of security issue that should not
be disclosed for a period of time, then you can contact maintainers directly.
Send a copies of your report to the following people: Frank Warmerdam
<a href="mailto:warmerdam@pobox.com">&lt;warmerdam@pobox.com&gt;</a>,
Andrey Kiselev
<a href="mailto:dron@ak4719.spb.edu">&lt;dron@ak4719.spb.edu&gt;</a>.
<P>
Of course, reporting bugs is no substitute for discussion. The
<a href="mailto:tiff@lists.maptools.org">tiff@lists.maptools.org</a> mailing
list is for users of this software, and discussion TIFF issues in general.
It is managed with the Mailman software, and the web interface for subscribing
and managing your access to the list is at:<p>
<a href="http://lists.maptools.org/mailman/listinfo/tiff">http://lists.maptools.org/mailman/listinfo/tiff</a><P>
Posts to the list are only accepted from members of the list in order
to limit the amount of spam propagated. Also, to be approved as a member
you will need to email the list administrator with a brief description of
why you are interested in TIFF so we can weed out spammers.<p>
A <A HREF="http://www.awaresystems.be/imaging/tiff/tml.html">Long Term
Archive</a> including recent messages, and most messages back to 1993,
with search capabilities is available, and
has been prepared and hosted by <a href="http://www.awaresystems.be">AWare
Systems</a>. <p>
<HR>
Last updated: $Date: 2008-09-03 08:05:04 $
</BODY>
</HTML>

View File

@ -1,524 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="generator" content=
"HTML Tidy for Linux (vers 25 March 2009), see www.w3.org">
<title>Building the TIFF Software Distribution</title>
</head>
<body bgcolor="white">
<h1><font face="Arial, Helvetica, Sans"><img src=
"images/cramps.gif" width="159" height="203" align="left" border=
"1" hspace="6"> Building the Software Distribution</font></h1>
<ul>
<li><a href="#UNIX">Building on a UNIX system</a>.</li>
<li><a href="#PC">Building on an MS-DOS or Windows system</a>.</li>
<li><a href="#VMS">Building on a VMS system</a>.</li>
<li><a href="#Other">Building the Software on Other
Systems</a></li>
</ul>
<br clear="left">
This chapter contains step-by-step instructions on how to configure
and build the TIFF software distribution. The software is most
easily built on a UNIX system, but with a little bit of work it can
easily be built and used on other non-UNIX platforms.
<hr>
<a name="UNIX" id="UNIX"></a>
<h2>Building on a UNIX System</h2>
To build the software on a UNIX system you need to first run the
configure shell script that is located in the top level of the
source directory. This script probes the target system for
necessary tools and functions and constructs a build environment in
which the software may be compiled. Once configuration is done, you
simply run <tt>make</tt> (or <tt>gmake</tt>) to build the software
and then <tt>make install</tt> to do the installation; for example:
<div style="margin-left: 2em">
<pre>
hyla% <b>cd ./tiff-4.0.0</b>
hyla% <b>./configure</b>
<i>...lots of messages...</i>
hyla% <b>make</b>
<i>...lots of messages...</i>
hyla% <b>make check</b>
<i>...lots of messages...</i>
hyla# <b>make install</b>
</pre></div>
Supplied makefiles are dependent on a <tt>make</tt> utility and a C
(and optionally a C++ compiler), so you will need these tools.
<p>In general, the software is designed such that the following
should be ``<i>make-able</i>'' in each directory:</p>
<div style="margin-left: 2em">
<pre>
make [all] build stuff
make check run the test suite
make install build&amp;install stuff
make clean remove .o files, executables and cruft
make distclean remove everything, that can be recreated
</pre></div>
Note that after running "<tt>make distclean</tt>" the
<tt>configure</tt> script must be run again to create the Makefiles
and other make-related files. <a name="BuildTrees" id=
"BuildTrees"></a>
<hr width="65%" align="right">
<h3>Build Trees</h3>
There are two schemes for configuring and building the software. If
you intend to build the software for only one target system, you
can configure the software so that it is built in the same
directories as the source code.
<div style="margin-left: 2em">
<pre>
hyla% <b>gzip -dc tiff-4.0.0.tar.gz | tar -xf -</b>
hyla% <b>cd ./tiff-4.0.0</b>
hyla% <b>./configure</b>
hyla% <b>make</b>
hyla% <b>make check</b>
hyla% <b>make install</b>
</pre></div>
<p>Otherwise, you can configure a build tree that is parallel to
the source tree hierarchy (or in some completely different place)
but which contains only configured files and files created during
the build procedure.</p>
<div style="margin-left: 2em">
<pre>
hyla% <b>gzip -dc tiff-4.0.0.tar.gz | tar -xf -</b>
hyla% <b>mkdir tiff-4.0.0-build</b>
hyla% <b>cd ./tiff-4.0.0-build</b>
hyla% <b>../tiff-4.0.0/configure</b>
hyla% <b>make</b>
hyla% <b>make check</b>
hyla% <b>make install</b>
</pre></div>
This second scheme is useful for:
<ul>
<li>building multiple targets from a single source tree</li>
<li>building from a read-only source tree (e.g. if you receive the
distribution on CD-ROM)</li>
<li>sharing the source files via a network, but building on
multiple systems</li>
</ul>
<a name="ConfigOptions" id="ConfigOptions"></a>
<hr width="65%" align="right">
<h3>Configuration Options</h3>
The configuration process is critical to the proper compilation,
installation, and operation of the software. The configure script
runs a series of tests to decide whether or not the target system
supports required functionality and, if it does not, whether it can
emulate or workaround the missing functions. This procedure is
fairly complicated and, due to the nonstandard nature of most UNIX
systems, prone to error. The first time that you configure the
software for use you should check the output from the configure
script and look for anything that does not make sense for your
system.
<p>A second function of the configure script is to set the default
configuration parameters for the software. Of particular note are
the directories where the software is to be installed. By default
the software is installed in the <b>/usr/local</b> hierarchy. To
change this behaviour the appropriate parameters can be specified
on the command line to configure. Run <b>./configure --help</b> to
get a full list of possible options. Standard installation related
options are shown below.</p>
<pre>
<tt>
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[/usr/local]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]
By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc. You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.
For better control, use the options below.
Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
--datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
--datadir=DIR read-only architecture-independent data [DATAROOTDIR]
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
--mandir=DIR man documentation [DATAROOTDIR/man]
--docdir=DIR documentation root [DATAROOTDIR/doc/tiff]
--htmldir=DIR html documentation [DOCDIR]
Program names:
--program-prefix=PREFIX prepend PREFIX to installed program names
--program-suffix=SUFFIX append SUFFIX to installed program names
--program-transform-name=PROGRAM run sed PROGRAM on installed program names
</tt>
</pre>
<a name="Packages" id="Packages"></a>
<hr width="65%" align="right">
<h3>Configuring Optional Packages/Support</h3>
The TIFF software comes with several packages that are installed
only as needed, or only if specifically configured at the time the
configure script is run. Packages can be configured via the
<b>configure</b> script commandline parameters.
<dl>
<dt><i>Static/Shared Objects Support</i></dt>
<dd><tt>--enable-shared[=PKGS]&nbsp;&nbsp;&nbsp;&nbsp;build shared
libraries [default=yes]<br>
--enable-static[=PKGS]&nbsp;&nbsp;&nbsp;&nbsp;build static
libraries [default=yes]</tt>
<p>These options control whether or not to configure the software
to build a shared and static binaries for the TIFF library. Use of
shared libraries can significantly reduce the disk space needed for
users of the TIFF software. If shared libarries are not used then
the code is statically linked into each application that uses it.
By default both types of binaries is configured.</p>
<p>
<tt>--enable-rpath&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Enable
runtime linker paths (-R libtool option)</tt></p>
<p>Add library directories (see other options below) to the TIFF
library run-time linker path.</p>
<p><tt>--enable-ld-version-script&nbsp;&nbsp;Enable linker version
script (default is disabled)</tt></p>
<p>Add shared library symbol versioning on ELF-based systems (e.g.
Linux and FreeBSD) which use the GNU linker. This is needed if
several major versions of libtiff might be loaded at once into the
same program.</p>
</dd>
<dt><i>JPEG Support</i></dt>
<dd><tt>--disable-jpeg&nbsp;&nbsp;&nbsp;&nbsp;disable IJG JPEG
library usage (required for JPEG compression, enabled by default)
--with-jpeg-include-dir=DIR&nbsp;&nbsp;&nbsp;&nbsp;location of IJG
JPEG library headers
--with-jpeg-lib-dir=DIR&nbsp;&nbsp;&nbsp;&nbsp;location of IJG JPEG
library binary)</tt></dd>
<dd>The <tt>JPEG</tt> package enables support for the handling of
TIFF images with JPEG-encoded data. Support for JPEG-encoded data
requires the Independent JPEG Group (IJG) <tt>libjpeg</tt>
distribution; this software is available at <a href=
"http://www.ijg.org/">http://www.ijg.org/</a>. <b>configure</b>
script automatically tries to search for a working IJG JPEG
installation. If it fails to find library, JPEG support will be
automatically disabled.If you want specify the exact paths to
library binary and headers, use above switches for that.</dd>
<dt><i>ZIP Support</i></dt>
<dd>The <tt>ZIP</tt> support enables support for the handling of
TIFF images with deflate-encoded data. Support for deflate-encoded
data requires the freely available <tt>zlib</tt> distribution
written by Jean-loup Gailly and Mark Adler; this software is
available at <a href=
"http://www.zlib.org/">http://www.zlib.org/</a>. If ZIP support is
enabled the <tt>DIRS_LIBINC</tt> and <tt>DIR_GZLIB</tt> parameters
should also be set (see below). By default this package is not
configured.</dd>
</dl>
<a name="Sample" id="Sample"></a>
<hr width="65%" align="right">
<a name="PC" id="PC"></a>
<h2>Building the Software under Windows 95/98/NT/2000 with MS
VC++</h2>
With Microsoft Visual C++ installed, and properly configured for
commandline use (you will likely need to source VCVARS32.BAT in
AUTOEXEC.bAT or somewhere similar) you should be able to use the
provided <tt>makefile.vc</tt>.
<p>The source package is delivered using Unix line termination
conventions, which work with MSVC but do not work with Windows
'notepad'. If you use unzip from the <a href=
"http://www.info-zip.org/pub/infozip/">Info-Zip</a> package, you
can extract the files using Windows normal line termination
conventions with a command similar to:</p>
<pre>
unzip -aa -a tiff-4.0.0.zip
</pre>
<p>By default libtiff expects that a pre-built zlib and jpeg
library are provided by the user. If this is not the case, then you
may edit libtiff\tiffconf.h using a text editor (e.g. notepad) and
comment out the entries for JPEG_SUPPORT, PIXARLOG_SUPPORT, and
ZIP_SUPPORT. Ignore the comment at the top of the file which says
that it has no influence on the build, because the statement is not
true for Windows. However, by taking this approach, libtiff will
not be able to open some TIFF files.</p>
<p>To build using the provided makefile.vc you may use:</p>
<pre>
C:\tiff-4.0.0&gt; nmake /f makefile.vc clean
C:\tiff-4.0.0&gt; nmake /f makefile.vc
or (the hard way)
C:\tiff-4.0.0&gt; cd port
C:\tiff-4.0.0\port&gt; nmake /f makefile.vc clean
C:\tiff-4.0.0\port&gt; nmake /f makefile.vc
C:\tiff-4.0.0&gt; cd ../libtiff
C:\tiff-4.0.0\libtiff&gt; nmake /f makefile.vc clean
C:\tiff-4.0.0\libtiff&gt; nmake /f makefile.vc
C:\tiff-4.0.0\libtiff&gt; cd ..\tools
C:\tiff-4.0.0\tools&gt; nmake /f makefile.vc clean
C:\tiff-4.0.0\tools&gt; nmake /f makefile.vc
</pre>
<p>This will build the library file
<tt>libtiff\libtiff\libtiff.lib</tt>. This can be used in Win32
programs. You may want to adjust the build options before start
compiling. All parameters contained in the <tt>nmake.opt</tt>
file.This is a plain text file you can open with your favorite text
editor.</p>
<p>The makefile also builds a DLL (libtiff.dll) with an associated
import library (libtiff_i.lib). Any builds using libtiff will need
to include the LIBTIFF\LIBTIFF directory in the include path.</p>
<p>The <tt>libtiff\tools\makefile.vc</tt> should build .exe's for
all the standard TIFF tool programs.</p>
<hr>
<a name="VMS" id="VMS"></a>
<h2>Building the Software on a VMS System</h2>
The VMS port was done by Karsten Spang (<a href=
"mailto:krs@kampsax.dk">krs@kampsax.dk</a>), who also "sort of"
maintains it. The VMS specific files are not in the main
directories. Instead they are placed under
<tt>[.CONTRIB.VMS...]</tt> in the distribution tree. Installation:
It is assumed that you have unpacked the tar file into a VMS
directory tree, in this text called DISK:[TIFF].
<ol>
<li>Move the VMS specific files to their proper directories.
<pre>
$ SET DEFAULT DISK:[TIFF.CONTRIB.VMS]
$ RENAME [.LIBTIFF]*.* [-.-.LIBTIFF]
$ RENAME [.TOOLS]*.* [-.-.TOOLS]
</pre></li>
<li>Compile the library.
<pre>
$ SET DEFAULT DISK:[TIFF.LIBTIFF]
$ @MAKEVMS
</pre></li>
<li>Compile the tools.
<pre>
$ SET DEFAULT DISK:[TIFF.TOOLS]
$ @MAKEVMS
</pre></li>
<li>Define the programs.
<pre>
$ DEFINE TIFFSHR DISK:[TIFF.LIBTIFF]TIFFSHR
$ FAX2PS :==$DISK:[TIFF.TOOLS]FAX2PS
$ FAX2TIFF :==$DISK:[TIFF.TOOLS]FAX2TIFF
$ GIF2TIFF :==$DISK:[TIFF.TOOLS]GIF2TIFF
$ PAL2RGB :==$DISK:[TIFF.TOOLS]PAL2RGB
$ PPM2TIFF :==$DISK:[TIFF.TOOLS]PPM2TIFF
$ RAS2TIFF :==$DISK:[TIFF.TOOLS]RAS2TIFF
$ RGB2YCBCR :==$DISK:[TIFF.TOOLS]RGB2YCBCR
$ THUMBNAIL :==$DISK:[TIFF.TOOLS]THUMBNAIL
$ TIFF2BW :==$DISK:[TIFF.TOOLS]TIFF2BW
$ TIFF2PS :==$DISK:[TIFF.TOOLS]TIFF2PS
$ TIFFCMP :==$DISK:[TIFF.TOOLS]TIFFCMP
$ TIFFCP :==$DISK:[TIFF.TOOLS]TIFFCP
$ TIFFDITHER:==$DISK:[TIFF.TOOLS]TIFFDITHER
$ TIFFDUMP :==$DISK:[TIFF.TOOLS]TIFFDUMP
$ TIFFINFO :==$DISK:[TIFF.TOOLS]TIFFINFO
$ TIFFMEDIAN:==$DISK:[TIFF.TOOLS]TIFFMEDIAN
$ TIFFSPLIT :==$DISK:[TIFF.TOOLS]TIFFSPLIT
$ YCBCR :==$DISK:[TIFF.TOOLS]YCBCR
</pre></li>
</ol>
You will want to add these lines to your <tt>LOGIN.COM</tt> file,
after changing the name of the directory that you have used on your
machine.
<p>This release has been tested on OpenVMS/VAX 5.5-2, using VAX C
3.2. A previous release was tested under OpenVMS/AXP ?.? using DEC
C ?.?, it is believed that this release as well works on AXP. The
code contains some GNU C specific things. This does *not* imply,
however, that the VAX/GCC configuration has been tested, *it has
not*.</p>
<p>The command procedures (<tt>MAKEVMS.COM</tt>) for building the
library and tools, is believed to choose the correct options for
the VAX and AXP cases automatically.</p>
<p>On the AXP, IEEE floating point is used by default. If you want
VAX floating point, remove the <tt>/FLOAT=IEEE_FLOAT</tt>
qualifier, and change <tt>HAVE_IEEEFP=1</tt> to
<tt>HAVE_IEEEFP=0</tt> in the <tt>MAKEVMS.COM</tt> files in both
the <b>libtiff</b> and <b>tools</b> directories.</p>
<h3>Compiling your own program on a VMS system:</h3>
When compiling a source file in which you <tt>"#include
&lt;tiffio.h&gt;"</tt>, use the following command
<pre>
$ CC/INCLUDE=DISK:[TIFF.LIBTIFF]
</pre>
This ensures that the header file is found. On the AXP, also add
<tt>/FLOAT=IEEE_FLOAT</tt> (if used when building the library).
<h3>Linking your own program to the TIFF library on a VMS
system:</h3>
You can link to the library in two ways: Either using the shareable
library, or using the object library. On the VAX these
possibilities are:
<ol>
<li>Using the shareable TIFF library.
<pre>
$ LINK MY_PROGRAM,DISK:[TIFF.LIBTIFF]TIFF/OPTIONS,SYS$INPUT:/OPTIONS
SYS$SHARE:VAXCRTL/SHAREABLE
</pre></li>
<li>Using the TIFF object library.
<pre>
$ LINK MY_PROGRAM, -
DISK:[TIFF.LIBTIFF]TIFF/LIBRARY/INCLUDE=(TIF_FAX3SM,TIF_CODEC), -
SYS$INPUT:/OPTIONS
SYS$SHARE:VAXCRTL/SHAREABLE
</pre></li>
</ol>
On AXP (and possibly also using DEC C on VAX) the corresponding
commands are
<ol>
<li>Using the shareable TIFF library.
<pre>
$ LINK MY_PROGRAM,DISK:[TIFF.LIBTIFF]TIFF/OPTIONS
</pre></li>
<li>Using the TIFF object library.
<pre>
$ LINK MY_PROGRAM,DISK:[TIFF.LIBTIFF]TIFF/LIBRARY
</pre></li>
</ol>
Method 1 uses the shortest link time and smallest <tt>.EXE</tt>
files, but it requires that <tt>TIFFSHR</tt> is defined as above at
link time and <strong>at run time</strong>. Using the compilation
procedure above, the tools are linked in this way.
<p>Method 2 gives somewhat longer link time and larger
<tt>.EXE</tt> files, but does not require <tt>TIFFSHR</tt> to be
defined. This method is recommended if you want to run your program
on another machine, and for some reason don't want to have the
library on that machine. If you plan to have more than one program
(including the tools) on the machine, it is recommended that you
copy the library to the other machine and use method 1.</p>
<hr>
<a name="Other" id="Other"></a>
<h2>Building the Software on Other Systems</h2>
This section contains information that might be useful if you are
working on a non-UNIX system that is not directly supported. All
library-related files described below are located in the
<b>libtiff</b> directory.
<p>The library requires two files that are generated
<i>on-the-fly</i>. The file <b>tif_fax3sm.c</b> has the state
tables for the Group 3 and Group 4 decoders. This file is generated
by the <tt>mkg3states</tt> program on a UNIX system; for
example,</p>
<div style="margin-left: 2em">
<pre>
<tt>
cd libtiff
cc -o mkg3states mkg3states.c
rm -f tif_fax3sm.c
./mkg3states -c const tif_fax3sm.c
</tt>
</pre></div>
The <tt>-c</tt> option can be used to control whether or not the
resutling tables are generated with a <tt>const</tt> declaration.
The <tt>-s</tt> option can be used to specify a C storage class for
the table declarations. The <tt>-b</tt> option can be used to force
data values to be explicitly bracketed with ``{}'' (apparently
needed for some MS-Windows compilers); otherwise the structures are
emitted in as compact a format as possible. Consult the source code
for this program if you have questions.
<p>The second file required to build the library, <b>version.h</b>,
contains the version information returned by the
<tt>TIFFGetVersion</tt> routine. This file is built on most systems
using the <tt>mkversion</tt> program and the contents of the
<tt>VERSION</tt> and <tt>tiff.alpha</tt> files; for example,</p>
<div style="margin-left: 2em">
<pre>
cd libtiff
cc -o mkversion mkversion.c
rm -f version.h
./mkversion -v ../VERSION -a ../dist/tiff.alpha version.h
</pre></div>
<p>Otherwise, when building the library on a non-UNIX system be
sure to consult the files <b>tiffcomp.h</b> and <b>tiffconf.h</b>.
The former contains system compatibility definitions while the
latter is provided so that the software configuration can be
controlled on systems that do not support the make facility for
building the software.</p>
<p>Systems without a 32-bit compiler may not be able to handle some
of the codecs in the library; especially the Group 3 and 4 decoder.
If you encounter problems try disabling support for a particular
codec; consult the <a href=
"internals.html#Config">documentation</a>.</p>
<p>Programs in the tools directory are written to assume an ANSI C
compilation environment. There may be a few POSIX'isms as well. The
code in the <b>port</b> directory is provided to emulate routines
that may be missing on some systems. On UNIX systems the
<tt>configure</tt> script automatically figures out which routines
are not present on a system and enables the use of the equivalent
emulation routines from the <b>port</b> directory. It may be
necessary to manually do this work on a non-UNIX system. <a name=
"Testing" id="Testing"></a></p>
<hr>
<h2>Checking out the Software</h2>
<p>Assuming you have working versions of <tt>tiffgt</tt> and
<tt>tiffsv</tt>, you can just use them to view any of the sample
images available for testing (see the <a href="images.html">section
on obtaining the test images</a>). Otherwise, you can do a cursory
check of the library with the <tt>tiffcp</tt> and <tt>tiffcmp</tt>
programs. For example,</p>
<div style="margin-left: 2em">
<pre>
tiffcp -lzw cramps.tif x.tif
tiffcmp cramps.tif x.tif
</pre></div>
<p>(<tt>tiffcmp</tt> should be silent if the files compare
correctly). <a name="TOC" id="TOC"></a></p>
<hr>
<h2>Table of Contents</h2>
The following files makup the core library:
<pre>
libtiff/tiff.h TIFF spec definitions
libtiff/tiffcomp.h non-UNIX OS-compatibility definitions
libtiff/tiffconf.h non-UNIX configuration definitions
libtiff/tiffio.h public TIFF library definitions
libtiff/tiffiop.h private TIFF library definitions
libtiff/t4.h CCITT Group 3/4 code tables+definitions
libtiff/tif_dir.h private defs for TIFF directory handling
libtiff/tif_fax3.h CCITT Group 3/4-related definitions
libtiff/tif_predict.h private defs for Predictor tag support
libtiff/uvcode.h LogL/LogLuv codec-specific definitions
libtiff/version.h version string (generated by Makefile)
libtiff/tif_apple.c Apple-related OS support
libtiff/tif_atari.c Atari-related OS support
libtiff/tif_aux.c auxilary directory-related functions
libtiff/tif_close.c close an open TIFF file
libtiff/tif_codec.c configuration table of builtin codecs
libtiff/tif_compress.c compression scheme support
libtiff/tif_dir.c directory tag interface code
libtiff/tif_dirinfo.c directory known tag support code
libtiff/tif_dirread.c directory reading code
libtiff/tif_dirwrite.c directory writing code
libtiff/tif_dumpmode.c "no" compression codec
libtiff/tif_error.c library error handler
libtiff/tif_fax3.c CCITT Group 3 and 4 codec
libtiff/tif_fax3sm.c G3/G4 state tables (generated by mkg3states)
libtiff/tif_flush.c i/o and directory state flushing
libtiff/tif_getimage.c TIFFRGBAImage support
libtiff/tif_jpeg.c JPEG codec (interface to the IJG distribution)
libtiff/tif_luv.c SGI LogL/LogLuv codec
libtiff/tif_lzw.c LZW codec
libtiff/tif_msdos.c MSDOS-related OS support
libtiff/tif_next.c NeXT 2-bit scheme codec (decoding only)
libtiff/tif_open.c open and simply query code
libtiff/tif_packbits.c Packbits codec
libtiff/tif_pixarlog.c Pixar codec
libtiff/tif_predict.c Predictor tag support
libtiff/tif_print.c directory printing support
libtiff/tif_read.c image data reading support
libtiff/tif_strip.c some strip-related code
libtiff/tif_swab.c byte and bit swapping support
libtiff/tif_thunder.c Thunderscan codec (decoding only)
libtiff/tif_tile.c some tile-related code
libtiff/tif_unix.c UNIX-related OS support
libtiff/tif_version.c library version support
libtiff/tif_vms.c VMS-related OS support
libtiff/tif_warning.c library warning handler
libtiff/tif_win3.c Windows-3.1-related OS support
libtiff/tif_win32.c Win32 (95/98/NT) related OS support
libtiff/tif_write.c image data writing support
libtiff/tif_zip.c Deflate codec
libtiff/mkg3states.c program to generate G3/G4 decoder state tables
libtiff/mkspans.c program to generate black-white span tables
libtiff/mkversion.c program to generate libtiff/version.h.
</pre>
<hr>
Last updated: $Date: 2012-02-18 21:36:31 $
</body>
</html>

View File

@ -1,209 +0,0 @@
<HTML>
<HEAD>
<TITLE>
Contributed TIFF Software
</TITLE>
</HEAD>
<BODY BGCOLOR=white>
<FONT FACE="Arial, Helvetica, Sans">
<H1>
<IMG SRC=images/smallliz.jpg WIDTH=144 HEIGHT=108 ALIGN=left BORDER=1 HSPACE=6>
Contributed TIFF Software
</H1>
<P>
The <B>contrib</B> directory has contributed software that
uses the TIFF library or which is associated with the library
(typically glue and guidance for ports to non-UNIX platforms, or tools that
aren't directly TIFF related).
<BR CLEAR=left>
<P>
<TABLE BORDER CELLPADDING=3>
<TR>
<TD VALIGN=top>
<B>contrib/vms</B>
</TD>
<TD>
scripts and files from Karsten Spang for building
the library and tools under VMS
</TD>
</TR>
<TR>
<TD VALIGN=top>
<B>contrib/dbs</B>
</TD>
<TD>
various tools from Dan & Chris Sears, including a simple X-based viewer
</TD>
</TR>
<TR>
<TD VALIGN=top>
<B>contrib/ras</B>
</TD>
<TD>
two programs by Patrick Naughton for converting
between Sun rasterfile format and TIFF (these
require <TT>libpixrect.a</TT>, as opposed to the one in
tools that doesn't)
</TD>
</TR>
<TR>
<TD VALIGN=top>
<B>contrib/mac-mpw</B><br>
<B>contrib/mac-cw</B>
</TD>
<TD>
scripts and files from Niles Ritter for building
the library and tools under Macintosh/MPW C and
code warrior.
</TD>
</TR>
<TR>
<TD VALIGN=top>
<B>contrib/acorn</B>
</TD>
<TD>
scripts and files from Peter Greenham for building
the library and tools on an Acorn RISC OS system.
</TD>
</TR>
<TR>
<TD VALIGN=top>
<B>contrib/win32</B>
</TD>
<TD>
scripts and files from Scott Wagner for building
the library under Windows NT and Windows 95. (The makefile.vc in the
libtiff/libtiff directory may be sufficient for most users.)
</TD>
</TR>
<TR>
<TD VALIGN=top>
<B>contrib/win_dib</B>
</TD>
<TD>
two separate implementations of TIFF to DIB code suitable for any Win32
platform. Contributed by Mark James, and Philippe Tenenhaus.
</TD>
</TR>
<TR>
<TD VALIGN=top>
<B>contrib/ojpeg</B>
</TD>
<TD>
Patch for IJG JPEG library related to support for some Old JPEG in TIFF files.
Contributed by Scott Marovich.
</TD>
</TR>
<TR>
<TD VALIGN=top>
<B>contrib/dosdjgpp</B>
</TD>
<TD>
scripts and files from Alexander Lehmann for building
the library under MSDOS with the DJGPP v2 compiler.
</TD>
</TR>
<TR>
<TD VALIGN=top>
<B>contrib/tags</B>
</TD>
<TD>
scripts and files from Niles Ritter for adding private
tag support at runtime, without changing libtiff.
</TD>
</TR>
<TR>
<TD VALIGN=top>
<B>contrib/mfs</B>
</TD>
<TD>
code from Mike Johnson to read+write images in memory
without modifying the library
</TD>
</TR>
<TR>
<TD VALIGN=top>
<B>contrib/pds</B>
</TD>
<TD>
various routines from Conrad Poelman; a TIFF image iterator and
code to support ``private sub-directories''
</TD>
</TR>
<TR>
<TD VALIGN=top>
<B>contrib/iptcutil</B>
</TD>
<TD>
A utility by <A HREF=mailto:billr@corbis.com>Bill Radcliffe</a> to
convert an extracted IPTC Newsphoto caption from a binary blob to
ASCII text, and vice versa. IPTC binary blobs can be extracted from
images via the <A
HREF=http://www.ImageMagick.org/>ImageMagick</a> convert(1)
utility.
</TD>
</TR>
<TR>
<TD VALIGN=top>
<B>contrib/addtiffo</B>
</TD>
<TD>
A utility (and supporting subroutine) for building
one or more reduce resolution
overviews to an existing TIFF file. Supplied by
<a href="http://pobox.com/~warmerdam">Frank Warmerdam</a>.
</TD>
</TR>
<TR>
<TD VALIGN=top>
<B>contrib/stream</B>
</TD>
<TD>
A class (TiffStream) for accessing TIFF files through a C++ stream
interface. Supplied by <a href="mailto:avi@shutterfly.com">Avi Bleiweiss</a>.
</TD>
</TR>
</TABLE>
<P>
Questions regarding these packages are usually best directed toward
their authors.
<P>
<HR>
Last updated: $Date: 2006-01-03 01:42:30 $
</BODY>
</HTML>

View File

@ -1,52 +0,0 @@
<HTML>
<HEAD>
<TITLE>
TIFF Documentation
</TITLE>
</HEAD>
<BODY BGCOLOR=white>
<FONT FACE="Arial, Helvetica, Sans">
<H1>
<IMG SRC=images/jim.gif WIDTH=139 HEIGHT=170 ALIGN=left BORDER=1 HSPACE=6>
TIFF Documentation
</H1>
<P>
A copy of the 6.0 specification is available from Adobe at
<A HREF="http://partners.adobe.com/public/developer/en/tiff/TIFF6.pdf">http://partners.adobe.com/public/developer/en/tiff/TIFF6.pdf</A>, or from the libtiff
ftp site at <a href="ftp://ftp.remotesensing.org/pub/libtiff/doc/TIFF6.pdf">
ftp://ftp.remotesensing.org/pub/libtiff/doc/TIFF6.pdf</A>.<p>
<P>
Draft <a href="TIFFTechNote2.html">TIFF Technical Note #2</A> covers problems
with the TIFF 6.0 design for embedding JPEG-compressed data in TIFF, and
describes an alternative. <p>
Other Adobe information on TIFF can be retrieved from:
<A HREF="http://partners.adobe.com/public/developer/tiff/index.html">
http://partners.adobe.com/public/developer/tiff/index.html</A>
<P>
Joris Van Damme maintains a list of known tags and their descriptions and
definitions. It is available online at
<A HREF="http://www.awaresystems.be/imaging/tiff/tifftags.html">
http://www.awaresystems.be/imaging/tiff/tifftags.html</A>
<P>
There is a FAQ, related both to TIFF format and libtiff library:
<A HREF="http://www.awaresystems.be/imaging/tiff/faq.html">
http://www.awaresystems.be/imaging/tiff/faq.html</A>
<P>
There is a preliminary <a href="bigtiffdesign.html">BigTIFF Design</a> for
a TIFF variation supporting files larger than 4GB.
<HR>
<ADDRESS>
Last updated: $Date: 2006-07-10 18:13:52 $
</ADDRESS>
</BODY>
</HTML>

View File

@ -1,41 +0,0 @@
<HTML>
<HEAD>
<TITLE>
TIFF Test Images
</TITLE>
</HEAD>
<BODY BGCOLOR=white>
<FONT FACE="Arial, Helvetica, Sans">
<H1>
<IMG SRC=images/bali.jpg WIDTH=158 HEIGHT=107 ALIGN=left BORDER=1 HSPACE=6>
TIFF Test Images
</H1>
<P>
Test images are available for most formats supported by the library.
Most of the images included in the test kit are also part of this
documentation (albeit in TIFF rather than GIF or JFIF).
The images are kept in a separate archive that should be located in
the same directory as this software.
<BR CLEAR=left>
<P>
The latest archive of test images is located at
<A HREF="ftp://ftp.remotesensing.org/pub/libtiff/pics-3.8.0.tar.gz">
ftp://ftp.remotesensing.org/pub/libtiff/pics-3.8.0.tar.gz</A>
<P>
There are two other good sources for TIFF test images:
the contributed software <B>contrib/dbs</B> includes several
programs that generate test images suitable for debugging, and
the <TT>tiffcp</TT> program can be used to generate a variety
of images with different storage characteristics.
<P>
<HR>
Last updated: $Date: 2006-01-02 23:50:44 $
</BODY>
</HTML>

View File

@ -1,46 +0,0 @@
# Tag Image File Format (TIFF) Software
#
# Copyright (C) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# Process this file with automake to produce Makefile.in.
docdir = $(LIBTIFF_DOCDIR)/html/images
docfiles = \
back.gif \
bali.jpg \
cat.gif \
cover.jpg \
cramps.gif \
dave.gif \
info.gif \
jello.jpg \
jim.gif \
note.gif \
oxford.gif \
quad.jpg \
ring.gif \
smallliz.jpg \
strike.gif \
warning.gif
dist_doc_DATA = $(docfiles)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1000 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 B

Some files were not shown because too many files have changed in this diff Show More