diff --git a/CSJ2K/CSJ2K/AssemblyInfo.cs b/CSJ2K/AssemblyInfo.cs similarity index 100% rename from CSJ2K/CSJ2K/AssemblyInfo.cs rename to CSJ2K/AssemblyInfo.cs diff --git a/CSJ2K/CSJ2K.sln b/CSJ2K/CSJ2K.sln deleted file mode 100644 index 02ebd5e8..00000000 --- a/CSJ2K/CSJ2K.sln +++ /dev/null @@ -1,84 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSJ2K", "CSJ2K\CSJ2K.csproj", "{1EA0F9BA-0194-4F08-9E55-89888D5A4724}" -EndProject -Project("{E6FDF86B-F3D1-11D4-8576-0002A516ECE8}") = "j2kdecoder", "jj2kdecoder\j2kdecoder.vjsproj", "{32801F5D-4A99-47E2-B1A3-62A8F3ABFA99}" -EndProject -Project("{E6FDF86B-F3D1-11D4-8576-0002A516ECE8}") = "j2kencoder", "jj2kencoder\j2kencoder.vjsproj", "{F6477386-69EA-494B-AEC0-5E3A1FDBA10D}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "codectest", "codectest\codectest.csproj", "{08EBCC10-76CD-4198-9F60-E8091432E4D8}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|Mixed Platforms = Debug|Mixed Platforms - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|Mixed Platforms = Release|Mixed Platforms - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {1EA0F9BA-0194-4F08-9E55-89888D5A4724}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1EA0F9BA-0194-4F08-9E55-89888D5A4724}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1EA0F9BA-0194-4F08-9E55-89888D5A4724}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {1EA0F9BA-0194-4F08-9E55-89888D5A4724}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {1EA0F9BA-0194-4F08-9E55-89888D5A4724}.Debug|x86.ActiveCfg = Debug|Any CPU - {1EA0F9BA-0194-4F08-9E55-89888D5A4724}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1EA0F9BA-0194-4F08-9E55-89888D5A4724}.Release|Any CPU.Build.0 = Release|Any CPU - {1EA0F9BA-0194-4F08-9E55-89888D5A4724}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {1EA0F9BA-0194-4F08-9E55-89888D5A4724}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {1EA0F9BA-0194-4F08-9E55-89888D5A4724}.Release|x86.ActiveCfg = Release|Any CPU - {32801F5D-4A99-47E2-B1A3-62A8F3ABFA99}.Debug|Any CPU.ActiveCfg = Debug|x86 - {32801F5D-4A99-47E2-B1A3-62A8F3ABFA99}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {32801F5D-4A99-47E2-B1A3-62A8F3ABFA99}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {32801F5D-4A99-47E2-B1A3-62A8F3ABFA99}.Debug|x86.ActiveCfg = Debug|x86 - {32801F5D-4A99-47E2-B1A3-62A8F3ABFA99}.Debug|x86.Build.0 = Debug|x86 - {32801F5D-4A99-47E2-B1A3-62A8F3ABFA99}.Release|Any CPU.ActiveCfg = Release|x86 - {32801F5D-4A99-47E2-B1A3-62A8F3ABFA99}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {32801F5D-4A99-47E2-B1A3-62A8F3ABFA99}.Release|Mixed Platforms.Build.0 = Release|x86 - {32801F5D-4A99-47E2-B1A3-62A8F3ABFA99}.Release|x86.ActiveCfg = Release|x86 - {32801F5D-4A99-47E2-B1A3-62A8F3ABFA99}.Release|x86.Build.0 = Release|x86 - {F6477386-69EA-494B-AEC0-5E3A1FDBA10D}.Debug|Any CPU.ActiveCfg = Debug|x86 - {F6477386-69EA-494B-AEC0-5E3A1FDBA10D}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {F6477386-69EA-494B-AEC0-5E3A1FDBA10D}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {F6477386-69EA-494B-AEC0-5E3A1FDBA10D}.Debug|x86.ActiveCfg = Debug|x86 - {F6477386-69EA-494B-AEC0-5E3A1FDBA10D}.Debug|x86.Build.0 = Debug|x86 - {F6477386-69EA-494B-AEC0-5E3A1FDBA10D}.Release|Any CPU.ActiveCfg = Release|x86 - {F6477386-69EA-494B-AEC0-5E3A1FDBA10D}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {F6477386-69EA-494B-AEC0-5E3A1FDBA10D}.Release|Mixed Platforms.Build.0 = Release|x86 - {F6477386-69EA-494B-AEC0-5E3A1FDBA10D}.Release|x86.ActiveCfg = Release|x86 - {F6477386-69EA-494B-AEC0-5E3A1FDBA10D}.Release|x86.Build.0 = Release|x86 - {08EBCC10-76CD-4198-9F60-E8091432E4D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {08EBCC10-76CD-4198-9F60-E8091432E4D8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {08EBCC10-76CD-4198-9F60-E8091432E4D8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {08EBCC10-76CD-4198-9F60-E8091432E4D8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {08EBCC10-76CD-4198-9F60-E8091432E4D8}.Debug|x86.ActiveCfg = Debug|Any CPU - {08EBCC10-76CD-4198-9F60-E8091432E4D8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {08EBCC10-76CD-4198-9F60-E8091432E4D8}.Release|Any CPU.Build.0 = Release|Any CPU - {08EBCC10-76CD-4198-9F60-E8091432E4D8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {08EBCC10-76CD-4198-9F60-E8091432E4D8}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {08EBCC10-76CD-4198-9F60-E8091432E4D8}.Release|x86.ActiveCfg = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(TeamFoundationVersionControl) = preSolution - SccNumberOfProjects = 5 - SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} - SccTeamFoundationServer = https://tfs03.codeplex.com/ - SccLocalPath0 = . - SccProjectUniqueName1 = CSJ2K\\CSJ2K.csproj - SccProjectName1 = CSJ2K - SccLocalPath1 = CSJ2K - SccProjectUniqueName2 = jj2kdecoder\\j2kdecoder.vjsproj - SccProjectName2 = jj2kdecoder - SccLocalPath2 = jj2kdecoder - SccProjectUniqueName3 = jj2kencoder\\j2kencoder.vjsproj - SccProjectName3 = jj2kencoder - SccLocalPath3 = jj2kencoder - SccProjectUniqueName4 = codectest\\codectest.csproj - SccProjectName4 = codectest - SccLocalPath4 = codectest - EndGlobalSection -EndGlobal diff --git a/CSJ2K/CSJ2K/CSJ2K.csproj b/CSJ2K/CSJ2K/CSJ2K.csproj deleted file mode 100644 index c5eef00c..00000000 --- a/CSJ2K/CSJ2K/CSJ2K.csproj +++ /dev/null @@ -1,388 +0,0 @@ - - - Local - 2.0 - Debug - AnyCPU - - - - - CSJ2K - - - JScript - Grid - IE50 - false - Library - CSJ2K - false - OnBuildSuccess - - - - - {1EA0F9BA-0194-4F08-9E55-89888D5A4724} - - - - - - - - - 2.0 - - - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - - - ..\..\bin\ - false - 285212672 - false - - - - - - - true - 4096 - false - - - false - false - false - 4 - full - prompt - true - - - bin\Release\ - false - 285212672 - false - - - - - - - true - 4096 - false - - - false - false - false - 4 - full - prompt - - - - mscorlib - - - System - - - System.Data - - - System.Design - - - System.Drawing - - - System.Management - - - System.Windows.Forms - - - System.Xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Code - - - Preview - - - - - False - .NET Framework Client Profile - false - - - False - .NET Framework 2.0 %28x86%29 - true - - - False - .NET Framework 3.0 %28x86%29 - false - - - False - .NET Framework 3.5 - false - - - False - .NET Framework 3.5 SP1 - false - - - - - - - - - - \ No newline at end of file diff --git a/CSJ2K/CSJ2K/CSJ2K.csproj.user b/CSJ2K/CSJ2K/CSJ2K.csproj.user deleted file mode 100644 index 17f151f5..00000000 --- a/CSJ2K/CSJ2K/CSJ2K.csproj.user +++ /dev/null @@ -1,19 +0,0 @@ - - - ShowAllFiles - - - - - - - - - - - - - en-US - false - - \ No newline at end of file diff --git a/CSJ2K/CSJ2K/j2k/util/NativeServices.cs b/CSJ2K/CSJ2K/j2k/util/NativeServices.cs deleted file mode 100644 index f2c52a30..00000000 --- a/CSJ2K/CSJ2K/j2k/util/NativeServices.cs +++ /dev/null @@ -1,275 +0,0 @@ -/* -* CVS identifier: -* -* $Id: NativeServices.java,v 1.7 2000/09/05 09:25:26 grosbois Exp $ -* -* Class: NativeServices -* -* Description: Static methods allowing to access to some -* native services. It uses native methods. -* -* -* -* COPYRIGHT: -* -* This software module was originally developed by Raphaël Grosbois and -* Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel -* Askelöf (Ericsson Radio Systems AB); and Bertrand Berthelot, David -* Bouchard, Félix Henry, Gerard Mozelle and Patrice Onno (Canon Research -* Centre France S.A) in the course of development of the JPEG2000 -* standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This -* software module is an implementation of a part of the JPEG 2000 -* Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio -* Systems AB and Canon Research Centre France S.A (collectively JJ2000 -* Partners) agree not to assert against ISO/IEC and users of the JPEG -* 2000 Standard (Users) any of their rights under the copyright, not -* including other intellectual property rights, for this software module -* with respect to the usage by ISO/IEC and Users of this software module -* or modifications thereof for use in hardware or software products -* claiming conformance to the JPEG 2000 Standard. Those intending to use -* this software module in hardware or software products are advised that -* their use may infringe existing patents. The original developers of -* this software module, JJ2000 Partners and ISO/IEC assume no liability -* for use of this software module or modifications thereof. No license -* or right to this software module is granted for non JPEG 2000 Standard -* conforming products. JJ2000 Partners have full right to use this -* software module for his/her own purpose, assign or donate this -* software module to any third party and to inhibit third parties from -* using this software module for non JPEG 2000 Standard conforming -* products. This copyright notice must be included in all copies or -* derivative works of this software module. -* -* Copyright (c) 1999/2000 JJ2000 Partners. -* -* -* -*/ -using System; -namespace jj2000.j2k.util -{ - - /// This class presents a collection of static methods that allow access to - /// some native methods. It makes use of native methods to access those thread - /// properties. - /// - ///

Since the methods in this class require the presence of a shared library - /// with the name defined in SHLIB_NAME it is necessary to load it prior to - /// making use of any such methods. All methods that require the shared library - /// will automatically load the library if that has not been already done. The - /// library might also be manually loaded with the 'loadLibrary()' method of - /// this class. - /// - ///

This class provides only static methods. It should not be instantiated. - /// - ///

Currently the only native services available is settings relative to - /// POSIX threads, which are not accessible from the Java API. - /// - ///

Currently the methods in this class make sense with POSIX threads only, - /// since they access POSIX threads settings. POSIX threads are most used under - /// UNIX and UNIX-like operating systems and are mostly referred to as "native" - /// threads in Java Virtual Machine (JVM) implementations. - /// - ///

The shared library SHLIB_NAME uses functions of the POSIX thread library - /// (i.e. 'pthread'). Calling the methods that use the 'pthread' library will - /// most prbably cause the Java Virtual Machine (JVM) to crash if it is not - /// using the POSIX threads, due to unsatisfied references. For instance, JVMs - /// that use "green" threads will most certainly crash. POSIX threads are - /// referred to as "native" threads in JVMs under UNIX operating systems. - /// - ///

On Operating Systems where POSIX threads are not available (typically - /// Windows 95/98/NT/2000, MacIntosh, OS/2) there is no problem since the - /// SHLIB_NAME, if available, will not make use of POSIX threads library - /// functions, thus no problem should occur. - /// - ///

- public sealed class NativeServices - { - //UPGRADE_NOTE: Respective javadoc comments were merged. It should be changed in order to comply with .NET documentation conventions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1199'" - /// Returns the current concurrency level. See 'setThreadConcurrency' for - /// details on the meaning of concurrency - /// - /// - /// The current concurrency level - /// - /// - /// - /// - /// - /// Sets the concurrency level of the threading system of the Java Virtual - /// Machine (JVM) to the specified level. The concurrency level specifies - /// how many threads can run in parallel on different CPUs at any given - /// time for JVM implementations that use POSIX threads with - /// PTHREAD_SCOPE_PROCESS scheduling scope. A concurrency level of 0 means - /// that the operating system will automatically adjust the concurrency - /// level depending on the number of threads blocking on system calls, but - /// this will probably not exploit more than one CPU in multiporocessor - /// machines. If the concurrency level if set to more than the number of - /// available processors in the machine the performance might degrade. - /// - ///

For JVM implementations that use POSIX threads with - /// PTHREAD_SCOPE_SYSTEM scheduling scope or JVM implementations that use - /// Windows(R) threads and maybe others, setting the concurrency level has - /// no effect. In this cases the number of CPUs that can be exploited by - /// the JVM is not limited in principle, all CPUs are available to the JVM. - /// - ///

For JVM implementations that use "green" threads setting the - /// concurrency level, and thus calling this method, makes no sense, since - /// "green" threads are all contained in one user process and can not use - /// multiple CPUs. In fact calling this method can result in a JVM crash is - /// the shared library SHLIB_NAME has been compiled to use POSIX threads. - /// - ///

- /// The new concurrency level to set. - /// - /// - /// Concurrency level is negative - /// - /// - /// If the shared native library - /// implementing the functionality could not be loaded. - /// - /// - public static int ThreadConcurrency - { - get - { - // Check that the library is loaded - checkLibrary(); - // Return concurrency from native method - return ThreadConcurrencyN; - } - - set - { - // Check that the library is loaded - checkLibrary(); - // Check argument - if (value < 0) - throw new System.ArgumentException(); - // Set concurrency with native method - ThreadConcurrencyN = value; - } - - } - //UPGRADE_NOTE: Respective javadoc comments were merged. It should be changed in order to comply with .NET documentation conventions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1199'" - /// Calls the POSIX threads 'pthread_getconcurrency', or equivalent, - /// function and return the result. - /// - /// - /// The current concurrency level. - /// - /// - /// Calls the POSIX threads 'pthread_setconcurrency', or equivalent, - /// function with 'level' as the argument. - /// - /// - private static extern int ThreadConcurrencyN - { - get; - - set; - - } - - /// The name of the shared library containing the implementation of the - /// native methods: 'jj2000'. The actual file name of the library is system - /// dependent. Under UNIX it will be 'libjj2000.so', while under Windows it - /// will be 'jj2000.dll'. - /// - /// - public const System.String SHLIB_NAME = "jj2000"; - - /// The state of the library loading - private static int libState; - - /// Library load state ID indicating that no attept to load the library has - /// been done yet. - /// - private const int LIB_STATE_NOT_LOADED = 0; - - /// Library load state ID indicating that the library was successfully - /// loaded. - /// - private const int LIB_STATE_LOADED = 1; - - /// Library load state ID indicating that an attempt to load the library - /// was done and that it could not be found. - /// - private const int LIB_STATE_NOT_FOUND = 2; - - /// Private and only constructor, so that no class instance might be - /// created. Since all methods are static creating a class instance is - /// useless. If called it throws an 'IllegalArgumentException'. - /// - /// - private NativeServices() - { - throw new System.ArgumentException("Class can not be instantiated"); - } - - /// Loads the shared library implementing the native methods of this - /// class and returns true on success. Multiple calls to this method after - /// a successful call have no effect and return true. Multiple calls to - /// this method after unsuccesful calls will make new attempts to load the - /// library. - /// - /// - /// True if the libary could be loaded or is already loaded. False - /// if the library can not be found and loaded. - /// - /// - public static bool loadLibrary() - { - // If already loaded return true without doing anything - if (libState == LIB_STATE_LOADED) - return true; - // Try to load the library - try - { - //UPGRADE_ISSUE: Method 'java.lang.System.loadLibrary' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javalangSystem'" - System_Renamed.loadLibrary(SHLIB_NAME); - } - //UPGRADE_NOTE: Exception 'java.lang.UnsatisfiedLinkError' was converted to 'System.Exception' which has different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1100'" - catch (System.Exception e) - { - // Library was not found - libState = LIB_STATE_NOT_FOUND; - return false; - } - // Library was found - libState = LIB_STATE_LOADED; - return true; - } - - /// Checks if the library SHLIB_NAME is already loaded and attempts to load - /// if not yet loaded. If the library can not be found (either in a - /// previous attempt to load it or in an attempt in this method) an - /// 'UnsatisfiedLinkError' exception is thrown. - /// - /// - /// If the library SHLIB_NAME can not be - /// found. - /// - /// - private static void checkLibrary() - { - switch (libState) - { - - case LIB_STATE_LOADED: // Already loaded, nothing to do - return ; - - case LIB_STATE_NOT_LOADED: // Not yet loaded => load now - // If load successful break, otherwise continue to the - // LIB_STATE_NOT_LOADED state - if (loadLibrary()) - break; - goto case LIB_STATE_NOT_FOUND; - - case LIB_STATE_NOT_FOUND: // Could not be found, throw exception - //UPGRADE_NOTE: Exception 'java.lang.UnsatisfiedLinkError' was converted to 'System.Exception' which has different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1100'" - throw new System.Exception("NativeServices: native shared " + "library could not be loaded"); - } - } - } -} \ No newline at end of file diff --git a/CSJ2K/CSJ2K/Color/ChannelDefinitionMapper.cs b/CSJ2K/Color/ChannelDefinitionMapper.cs similarity index 100% rename from CSJ2K/CSJ2K/Color/ChannelDefinitionMapper.cs rename to CSJ2K/Color/ChannelDefinitionMapper.cs diff --git a/CSJ2K/CSJ2K/Color/ColorSpace.cs b/CSJ2K/Color/ColorSpace.cs similarity index 100% rename from CSJ2K/CSJ2K/Color/ColorSpace.cs rename to CSJ2K/Color/ColorSpace.cs diff --git a/CSJ2K/CSJ2K/Color/ColorSpaceException.cs b/CSJ2K/Color/ColorSpaceException.cs similarity index 100% rename from CSJ2K/CSJ2K/Color/ColorSpaceException.cs rename to CSJ2K/Color/ColorSpaceException.cs diff --git a/CSJ2K/CSJ2K/Color/ColorSpaceMapper.cs b/CSJ2K/Color/ColorSpaceMapper.cs similarity index 100% rename from CSJ2K/CSJ2K/Color/ColorSpaceMapper.cs rename to CSJ2K/Color/ColorSpaceMapper.cs diff --git a/CSJ2K/CSJ2K/Color/EnumeratedColorSpaceMapper.cs b/CSJ2K/Color/EnumeratedColorSpaceMapper.cs similarity index 100% rename from CSJ2K/CSJ2K/Color/EnumeratedColorSpaceMapper.cs rename to CSJ2K/Color/EnumeratedColorSpaceMapper.cs diff --git a/CSJ2K/CSJ2K/Color/EsRgbColorSpaceMapper.cs b/CSJ2K/Color/EsRgbColorSpaceMapper.cs similarity index 100% rename from CSJ2K/CSJ2K/Color/EsRgbColorSpaceMapper.cs rename to CSJ2K/Color/EsRgbColorSpaceMapper.cs diff --git a/CSJ2K/CSJ2K/Color/PalettizedColorSpaceMapper.cs b/CSJ2K/Color/PalettizedColorSpaceMapper.cs similarity index 100% rename from CSJ2K/CSJ2K/Color/PalettizedColorSpaceMapper.cs rename to CSJ2K/Color/PalettizedColorSpaceMapper.cs diff --git a/CSJ2K/CSJ2K/Color/Resampler.cs b/CSJ2K/Color/Resampler.cs similarity index 100% rename from CSJ2K/CSJ2K/Color/Resampler.cs rename to CSJ2K/Color/Resampler.cs diff --git a/CSJ2K/CSJ2K/Color/SYccColorSpaceMapper.cs b/CSJ2K/Color/SYccColorSpaceMapper.cs similarity index 100% rename from CSJ2K/CSJ2K/Color/SYccColorSpaceMapper.cs rename to CSJ2K/Color/SYccColorSpaceMapper.cs diff --git a/CSJ2K/CSJ2K/Color/boxes/ChannelDefinitionBox.cs b/CSJ2K/Color/boxes/ChannelDefinitionBox.cs similarity index 100% rename from CSJ2K/CSJ2K/Color/boxes/ChannelDefinitionBox.cs rename to CSJ2K/Color/boxes/ChannelDefinitionBox.cs diff --git a/CSJ2K/CSJ2K/Color/boxes/ColorSpecificationBox.cs b/CSJ2K/Color/boxes/ColorSpecificationBox.cs similarity index 100% rename from CSJ2K/CSJ2K/Color/boxes/ColorSpecificationBox.cs rename to CSJ2K/Color/boxes/ColorSpecificationBox.cs diff --git a/CSJ2K/CSJ2K/Color/boxes/ComponentMappingBox.cs b/CSJ2K/Color/boxes/ComponentMappingBox.cs similarity index 100% rename from CSJ2K/CSJ2K/Color/boxes/ComponentMappingBox.cs rename to CSJ2K/Color/boxes/ComponentMappingBox.cs diff --git a/CSJ2K/CSJ2K/Color/boxes/ImageHeaderBox.cs b/CSJ2K/Color/boxes/ImageHeaderBox.cs similarity index 100% rename from CSJ2K/CSJ2K/Color/boxes/ImageHeaderBox.cs rename to CSJ2K/Color/boxes/ImageHeaderBox.cs diff --git a/CSJ2K/CSJ2K/Color/boxes/JP2Box.cs b/CSJ2K/Color/boxes/JP2Box.cs similarity index 100% rename from CSJ2K/CSJ2K/Color/boxes/JP2Box.cs rename to CSJ2K/Color/boxes/JP2Box.cs diff --git a/CSJ2K/CSJ2K/Color/boxes/PaletteBox.cs b/CSJ2K/Color/boxes/PaletteBox.cs similarity index 100% rename from CSJ2K/CSJ2K/Color/boxes/PaletteBox.cs rename to CSJ2K/Color/boxes/PaletteBox.cs diff --git a/CSJ2K/CSJ2K/Icc/ICCMatrixBasedInputProfile.cs b/CSJ2K/Icc/ICCMatrixBasedInputProfile.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/ICCMatrixBasedInputProfile.cs rename to CSJ2K/Icc/ICCMatrixBasedInputProfile.cs diff --git a/CSJ2K/CSJ2K/Icc/ICCMonochromeInputProfile.cs b/CSJ2K/Icc/ICCMonochromeInputProfile.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/ICCMonochromeInputProfile.cs rename to CSJ2K/Icc/ICCMonochromeInputProfile.cs diff --git a/CSJ2K/CSJ2K/Icc/ICCProfile.cs b/CSJ2K/Icc/ICCProfile.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/ICCProfile.cs rename to CSJ2K/Icc/ICCProfile.cs diff --git a/CSJ2K/CSJ2K/Icc/ICCProfileException.cs b/CSJ2K/Icc/ICCProfileException.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/ICCProfileException.cs rename to CSJ2K/Icc/ICCProfileException.cs diff --git a/CSJ2K/CSJ2K/Icc/ICCProfileInvalidException.cs b/CSJ2K/Icc/ICCProfileInvalidException.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/ICCProfileInvalidException.cs rename to CSJ2K/Icc/ICCProfileInvalidException.cs diff --git a/CSJ2K/CSJ2K/Icc/ICCProfileNotFoundException.cs b/CSJ2K/Icc/ICCProfileNotFoundException.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/ICCProfileNotFoundException.cs rename to CSJ2K/Icc/ICCProfileNotFoundException.cs diff --git a/CSJ2K/CSJ2K/Icc/ICCProfiler.cs b/CSJ2K/Icc/ICCProfiler.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/ICCProfiler.cs rename to CSJ2K/Icc/ICCProfiler.cs diff --git a/CSJ2K/CSJ2K/Icc/Lut/LookUpTable.cs b/CSJ2K/Icc/Lut/LookUpTable.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/Lut/LookUpTable.cs rename to CSJ2K/Icc/Lut/LookUpTable.cs diff --git a/CSJ2K/CSJ2K/Icc/Lut/LookUpTable16.cs b/CSJ2K/Icc/Lut/LookUpTable16.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/Lut/LookUpTable16.cs rename to CSJ2K/Icc/Lut/LookUpTable16.cs diff --git a/CSJ2K/CSJ2K/Icc/Lut/LookUpTable16Gamma.cs b/CSJ2K/Icc/Lut/LookUpTable16Gamma.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/Lut/LookUpTable16Gamma.cs rename to CSJ2K/Icc/Lut/LookUpTable16Gamma.cs diff --git a/CSJ2K/CSJ2K/Icc/Lut/LookUpTable16Interp.cs b/CSJ2K/Icc/Lut/LookUpTable16Interp.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/Lut/LookUpTable16Interp.cs rename to CSJ2K/Icc/Lut/LookUpTable16Interp.cs diff --git a/CSJ2K/CSJ2K/Icc/Lut/LookUpTable16LinearSRGBtoSRGB.cs b/CSJ2K/Icc/Lut/LookUpTable16LinearSRGBtoSRGB.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/Lut/LookUpTable16LinearSRGBtoSRGB.cs rename to CSJ2K/Icc/Lut/LookUpTable16LinearSRGBtoSRGB.cs diff --git a/CSJ2K/CSJ2K/Icc/Lut/LookUpTable32.cs b/CSJ2K/Icc/Lut/LookUpTable32.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/Lut/LookUpTable32.cs rename to CSJ2K/Icc/Lut/LookUpTable32.cs diff --git a/CSJ2K/CSJ2K/Icc/Lut/LookUpTable32Gamma.cs b/CSJ2K/Icc/Lut/LookUpTable32Gamma.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/Lut/LookUpTable32Gamma.cs rename to CSJ2K/Icc/Lut/LookUpTable32Gamma.cs diff --git a/CSJ2K/CSJ2K/Icc/Lut/LookUpTable32Interp.cs b/CSJ2K/Icc/Lut/LookUpTable32Interp.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/Lut/LookUpTable32Interp.cs rename to CSJ2K/Icc/Lut/LookUpTable32Interp.cs diff --git a/CSJ2K/CSJ2K/Icc/Lut/LookUpTable32LinearSRGBtoSRGB.cs b/CSJ2K/Icc/Lut/LookUpTable32LinearSRGBtoSRGB.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/Lut/LookUpTable32LinearSRGBtoSRGB.cs rename to CSJ2K/Icc/Lut/LookUpTable32LinearSRGBtoSRGB.cs diff --git a/CSJ2K/CSJ2K/Icc/Lut/LookUpTable8.cs b/CSJ2K/Icc/Lut/LookUpTable8.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/Lut/LookUpTable8.cs rename to CSJ2K/Icc/Lut/LookUpTable8.cs diff --git a/CSJ2K/CSJ2K/Icc/Lut/LookUpTable8Gamma.cs b/CSJ2K/Icc/Lut/LookUpTable8Gamma.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/Lut/LookUpTable8Gamma.cs rename to CSJ2K/Icc/Lut/LookUpTable8Gamma.cs diff --git a/CSJ2K/CSJ2K/Icc/Lut/LookUpTable8Interp.cs b/CSJ2K/Icc/Lut/LookUpTable8Interp.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/Lut/LookUpTable8Interp.cs rename to CSJ2K/Icc/Lut/LookUpTable8Interp.cs diff --git a/CSJ2K/CSJ2K/Icc/Lut/LookUpTableFP.cs b/CSJ2K/Icc/Lut/LookUpTableFP.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/Lut/LookUpTableFP.cs rename to CSJ2K/Icc/Lut/LookUpTableFP.cs diff --git a/CSJ2K/CSJ2K/Icc/Lut/LookUpTableFPGamma.cs b/CSJ2K/Icc/Lut/LookUpTableFPGamma.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/Lut/LookUpTableFPGamma.cs rename to CSJ2K/Icc/Lut/LookUpTableFPGamma.cs diff --git a/CSJ2K/CSJ2K/Icc/Lut/LookUpTableFPInterp.cs b/CSJ2K/Icc/Lut/LookUpTableFPInterp.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/Lut/LookUpTableFPInterp.cs rename to CSJ2K/Icc/Lut/LookUpTableFPInterp.cs diff --git a/CSJ2K/CSJ2K/Icc/Lut/MatrixBasedTransformException.cs b/CSJ2K/Icc/Lut/MatrixBasedTransformException.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/Lut/MatrixBasedTransformException.cs rename to CSJ2K/Icc/Lut/MatrixBasedTransformException.cs diff --git a/CSJ2K/CSJ2K/Icc/Lut/MatrixBasedTransformTosRGB.cs b/CSJ2K/Icc/Lut/MatrixBasedTransformTosRGB.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/Lut/MatrixBasedTransformTosRGB.cs rename to CSJ2K/Icc/Lut/MatrixBasedTransformTosRGB.cs diff --git a/CSJ2K/CSJ2K/Icc/Lut/MonochromeTransformException.cs b/CSJ2K/Icc/Lut/MonochromeTransformException.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/Lut/MonochromeTransformException.cs rename to CSJ2K/Icc/Lut/MonochromeTransformException.cs diff --git a/CSJ2K/CSJ2K/Icc/Lut/MonochromeTransformTosRGB.cs b/CSJ2K/Icc/Lut/MonochromeTransformTosRGB.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/Lut/MonochromeTransformTosRGB.cs rename to CSJ2K/Icc/Lut/MonochromeTransformTosRGB.cs diff --git a/CSJ2K/CSJ2K/Icc/MatrixBasedRestrictedProfile.cs b/CSJ2K/Icc/MatrixBasedRestrictedProfile.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/MatrixBasedRestrictedProfile.cs rename to CSJ2K/Icc/MatrixBasedRestrictedProfile.cs diff --git a/CSJ2K/CSJ2K/Icc/MonochromeInputRestrictedProfile.cs b/CSJ2K/Icc/MonochromeInputRestrictedProfile.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/MonochromeInputRestrictedProfile.cs rename to CSJ2K/Icc/MonochromeInputRestrictedProfile.cs diff --git a/CSJ2K/CSJ2K/Icc/RestrictedICCProfile.cs b/CSJ2K/Icc/RestrictedICCProfile.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/RestrictedICCProfile.cs rename to CSJ2K/Icc/RestrictedICCProfile.cs diff --git a/CSJ2K/CSJ2K/Icc/Tags/ICCCurveType.cs b/CSJ2K/Icc/Tags/ICCCurveType.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/Tags/ICCCurveType.cs rename to CSJ2K/Icc/Tags/ICCCurveType.cs diff --git a/CSJ2K/CSJ2K/Icc/Tags/ICCCurveTypeReverse.cs b/CSJ2K/Icc/Tags/ICCCurveTypeReverse.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/Tags/ICCCurveTypeReverse.cs rename to CSJ2K/Icc/Tags/ICCCurveTypeReverse.cs diff --git a/CSJ2K/CSJ2K/Icc/Tags/ICCDataType.cs b/CSJ2K/Icc/Tags/ICCDataType.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/Tags/ICCDataType.cs rename to CSJ2K/Icc/Tags/ICCDataType.cs diff --git a/CSJ2K/CSJ2K/Icc/Tags/ICCMeasurementType.cs b/CSJ2K/Icc/Tags/ICCMeasurementType.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/Tags/ICCMeasurementType.cs rename to CSJ2K/Icc/Tags/ICCMeasurementType.cs diff --git a/CSJ2K/CSJ2K/Icc/Tags/ICCSignatureType.cs b/CSJ2K/Icc/Tags/ICCSignatureType.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/Tags/ICCSignatureType.cs rename to CSJ2K/Icc/Tags/ICCSignatureType.cs diff --git a/CSJ2K/CSJ2K/Icc/Tags/ICCTag.cs b/CSJ2K/Icc/Tags/ICCTag.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/Tags/ICCTag.cs rename to CSJ2K/Icc/Tags/ICCTag.cs diff --git a/CSJ2K/CSJ2K/Icc/Tags/ICCTagTable.cs b/CSJ2K/Icc/Tags/ICCTagTable.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/Tags/ICCTagTable.cs rename to CSJ2K/Icc/Tags/ICCTagTable.cs diff --git a/CSJ2K/CSJ2K/Icc/Tags/ICCTextDescriptionType.cs b/CSJ2K/Icc/Tags/ICCTextDescriptionType.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/Tags/ICCTextDescriptionType.cs rename to CSJ2K/Icc/Tags/ICCTextDescriptionType.cs diff --git a/CSJ2K/CSJ2K/Icc/Tags/ICCTextType.cs b/CSJ2K/Icc/Tags/ICCTextType.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/Tags/ICCTextType.cs rename to CSJ2K/Icc/Tags/ICCTextType.cs diff --git a/CSJ2K/CSJ2K/Icc/Tags/ICCViewType.cs b/CSJ2K/Icc/Tags/ICCViewType.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/Tags/ICCViewType.cs rename to CSJ2K/Icc/Tags/ICCViewType.cs diff --git a/CSJ2K/CSJ2K/Icc/Tags/ICCXYZType.cs b/CSJ2K/Icc/Tags/ICCXYZType.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/Tags/ICCXYZType.cs rename to CSJ2K/Icc/Tags/ICCXYZType.cs diff --git a/CSJ2K/CSJ2K/Icc/Tags/ICCXYZTypeReverse.cs b/CSJ2K/Icc/Tags/ICCXYZTypeReverse.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/Tags/ICCXYZTypeReverse.cs rename to CSJ2K/Icc/Tags/ICCXYZTypeReverse.cs diff --git a/CSJ2K/CSJ2K/Icc/Types/ICCDateTime.cs b/CSJ2K/Icc/Types/ICCDateTime.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/Types/ICCDateTime.cs rename to CSJ2K/Icc/Types/ICCDateTime.cs diff --git a/CSJ2K/CSJ2K/Icc/Types/ICCProfileHeader.cs b/CSJ2K/Icc/Types/ICCProfileHeader.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/Types/ICCProfileHeader.cs rename to CSJ2K/Icc/Types/ICCProfileHeader.cs diff --git a/CSJ2K/CSJ2K/Icc/Types/ICCProfileVersion.cs b/CSJ2K/Icc/Types/ICCProfileVersion.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/Types/ICCProfileVersion.cs rename to CSJ2K/Icc/Types/ICCProfileVersion.cs diff --git a/CSJ2K/CSJ2K/Icc/Types/XYZNumber.cs b/CSJ2K/Icc/Types/XYZNumber.cs similarity index 100% rename from CSJ2K/CSJ2K/Icc/Types/XYZNumber.cs rename to CSJ2K/Icc/Types/XYZNumber.cs diff --git a/CSJ2K/CSJ2K/J2kImage.cs b/CSJ2K/J2kImage.cs similarity index 100% rename from CSJ2K/CSJ2K/J2kImage.cs rename to CSJ2K/J2kImage.cs diff --git a/CSJ2K/CSJ2K/Util/EndianBinaryReader.cs b/CSJ2K/Util/EndianBinaryReader.cs similarity index 100% rename from CSJ2K/CSJ2K/Util/EndianBinaryReader.cs rename to CSJ2K/Util/EndianBinaryReader.cs diff --git a/CSJ2K/CSJ2K/Util/EndianBinaryWriter.cs b/CSJ2K/Util/EndianBinaryWriter.cs similarity index 100% rename from CSJ2K/CSJ2K/Util/EndianBinaryWriter.cs rename to CSJ2K/Util/EndianBinaryWriter.cs diff --git a/CSJ2K/CSJ2K/Util/SupportClass.cs b/CSJ2K/Util/SupportClass.cs similarity index 100% rename from CSJ2K/CSJ2K/Util/SupportClass.cs rename to CSJ2K/Util/SupportClass.cs diff --git a/CSJ2K/codectest/HighPerfTimer.cs b/CSJ2K/codectest/HighPerfTimer.cs deleted file mode 100644 index 673745c4..00000000 --- a/CSJ2K/codectest/HighPerfTimer.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.ComponentModel; -using System.Threading; - -namespace codectest -{ - public class HiPerfTimer - { - [DllImport("Kernel32.dll")] - private static extern bool QueryPerformanceCounter(out long lpPerformanceCount); - [DllImport("Kernel32.dll")] - private static extern bool QueryPerformanceFrequency(out long lpFrequency); - private long startTime; - private long stopTime; - private long freq; - /// - /// ctor - /// - public HiPerfTimer() - { - startTime = 0; - stopTime = 0; - freq = 0; - if (QueryPerformanceFrequency(out freq) == false) - { - throw new Win32Exception(); // timer not supported - } - } - /// - /// Start the timer - /// - /// long - tick count - public long Start() - { - QueryPerformanceCounter(out startTime); - return startTime; - } - /// - /// Stop timer - /// - /// long - tick count - public long Stop() - { - QueryPerformanceCounter(out stopTime); - return stopTime; - } - /// - /// Return the duration of the timer (in seconds) - /// - /// double - duration - public double Duration - { - get - { - return (double)(stopTime - startTime) / (double)freq; - } - } - /// - /// Frequency of timer (no counts in one second on this machine) - /// - ///long - Frequency - public long Frequency - { - get - { - QueryPerformanceFrequency(out freq); - return freq; - } - } - } -} diff --git a/CSJ2K/codectest/ImageDialog.Designer.cs b/CSJ2K/codectest/ImageDialog.Designer.cs deleted file mode 100644 index cfecedd8..00000000 --- a/CSJ2K/codectest/ImageDialog.Designer.cs +++ /dev/null @@ -1,63 +0,0 @@ -namespace codectest -{ - partial class ImageDialog - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.pictureBox1 = new System.Windows.Forms.PictureBox(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); - this.SuspendLayout(); - // - // pictureBox1 - // - this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill; - this.pictureBox1.Location = new System.Drawing.Point(0, 0); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(292, 273); - this.pictureBox1.TabIndex = 0; - this.pictureBox1.TabStop = false; - // - // ImageDialog - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(292, 273); - this.Controls.Add(this.pictureBox1); - this.Name = "ImageDialog"; - this.Text = "ImageDialog"; - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - public System.Windows.Forms.PictureBox pictureBox1; - - } -} \ No newline at end of file diff --git a/CSJ2K/codectest/ImageDialog.cs b/CSJ2K/codectest/ImageDialog.cs deleted file mode 100644 index 66807e24..00000000 --- a/CSJ2K/codectest/ImageDialog.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; -using System.Windows.Forms; - -namespace codectest -{ - public partial class ImageDialog : Form - { - public ImageDialog() - { - InitializeComponent(); - } - } -} \ No newline at end of file diff --git a/CSJ2K/codectest/ImageDialog.resx b/CSJ2K/codectest/ImageDialog.resx deleted file mode 100644 index ff31a6db..00000000 --- a/CSJ2K/codectest/ImageDialog.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/CSJ2K/codectest/Program.cs b/CSJ2K/codectest/Program.cs deleted file mode 100644 index 61a4a50a..00000000 --- a/CSJ2K/codectest/Program.cs +++ /dev/null @@ -1,85 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Drawing.Imaging; -using System.IO; -using System.Text; -using CSJ2K; - -namespace codectest -{ - class Program - { - static void Main(string[] args) - { - for (int i = 1; i <= 10; i++) - { - try - { - HiPerfTimer timer = new HiPerfTimer(); - timer.Start(); - Bitmap image = (Bitmap)J2kImage.FromFile("file" + i + ".jp2"); - timer.Stop(); - Console.WriteLine("file" + i + ": " + timer.Duration + " seconds"); - - Bitmap histogram=GenerateHistogram(image); - - Graphics g = Graphics.FromImage(image); - g.DrawImage(histogram, 0, 0); - - ImageDialog dlg = new ImageDialog(); - dlg.Text = "file" + i + ".jp2"; - dlg.ClientSize = new Size(image.Width, image.Height); - dlg.pictureBox1.Image = image; - dlg.ShowDialog(); - } - catch (Exception e) - { - Console.WriteLine("file" + i + ":\r\n" + e.Message); - if (e.InnerException != null) - { - Console.WriteLine(e.InnerException.Message); - Console.WriteLine(e.InnerException.StackTrace); - } - else Console.WriteLine(e.StackTrace); - - } - } - } - static Bitmap GenerateHistogram(Bitmap image) - { - Bitmap histogram = new Bitmap(256, 100); - - int[] colorcounts = new int[256]; - - // This is ungodly slow but it's just for diagnostics. - for (int y = 0; y < image.Height; y++) - { - for (int x = 0; x < image.Width; x++) - { - Color c=image.GetPixel(x, y); - colorcounts[c.R]++; - colorcounts[c.G]++; - colorcounts[c.B]++; - } - } - - int maxval = 0; - for (int i = 0; i < 256; i++) if (colorcounts[i] > maxval) maxval = colorcounts[i]; - for (int i = 1; i < 255; i++) - { - //Console.WriteLine(i + ": " + histogram[i] + "," + (((float)histogram[i] / (float)maxval) * 100F)); - colorcounts[i] = (int)Math.Round(((double)colorcounts[i] / (double)maxval) * 100D); - } - for (int x = 0; x < 256; x++) - { - for (int y = 0; y < 100; y++) - { - if (colorcounts[x] >= (100 - y)) histogram.SetPixel(x, y, Color.Black); - else histogram.SetPixel(x, y, Color.White); - } - } - return histogram; - } - } -} diff --git a/CSJ2K/codectest/Properties/AssemblyInfo.cs b/CSJ2K/codectest/Properties/AssemblyInfo.cs deleted file mode 100644 index fe760aa6..00000000 --- a/CSJ2K/codectest/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("codectest")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("codectest")] -[assembly: AssemblyCopyright("Copyright © 2007")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("2637284e-8f49-4db5-8882-d50a46dfcda1")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/CSJ2K/codectest/codectest.csproj b/CSJ2K/codectest/codectest.csproj deleted file mode 100644 index e8d3b29e..00000000 --- a/CSJ2K/codectest/codectest.csproj +++ /dev/null @@ -1,113 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {08EBCC10-76CD-4198-9F60-E8091432E4D8} - Exe - Properties - codectest - codectest - - - - - - - - - - - 2.0 - - - - - true - full - true - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - Form - - - ImageDialog.cs - - - - - - - {1EA0F9BA-0194-4F08-9E55-89888D5A4724} - CSJ2K - - - - - Designer - ImageDialog.cs - - - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - - - \ No newline at end of file diff --git a/CSJ2K/codectest/file1.jp2 b/CSJ2K/codectest/file1.jp2 deleted file mode 100644 index e41b5c71..00000000 Binary files a/CSJ2K/codectest/file1.jp2 and /dev/null differ diff --git a/CSJ2K/codectest/file10.jp2 b/CSJ2K/codectest/file10.jp2 deleted file mode 100644 index 83282b37..00000000 Binary files a/CSJ2K/codectest/file10.jp2 and /dev/null differ diff --git a/CSJ2K/codectest/file2.jp2 b/CSJ2K/codectest/file2.jp2 deleted file mode 100644 index fd60c6d5..00000000 Binary files a/CSJ2K/codectest/file2.jp2 and /dev/null differ diff --git a/CSJ2K/codectest/file3.jp2 b/CSJ2K/codectest/file3.jp2 deleted file mode 100644 index 18c130a4..00000000 Binary files a/CSJ2K/codectest/file3.jp2 and /dev/null differ diff --git a/CSJ2K/codectest/file4.jp2 b/CSJ2K/codectest/file4.jp2 deleted file mode 100644 index a895c64a..00000000 Binary files a/CSJ2K/codectest/file4.jp2 and /dev/null differ diff --git a/CSJ2K/codectest/file5.jp2 b/CSJ2K/codectest/file5.jp2 deleted file mode 100644 index 9e3a171f..00000000 Binary files a/CSJ2K/codectest/file5.jp2 and /dev/null differ diff --git a/CSJ2K/codectest/file6.jp2 b/CSJ2K/codectest/file6.jp2 deleted file mode 100644 index f59e33e4..00000000 Binary files a/CSJ2K/codectest/file6.jp2 and /dev/null differ diff --git a/CSJ2K/codectest/file7.jp2 b/CSJ2K/codectest/file7.jp2 deleted file mode 100644 index 0bc6280f..00000000 Binary files a/CSJ2K/codectest/file7.jp2 and /dev/null differ diff --git a/CSJ2K/codectest/file8.jp2 b/CSJ2K/codectest/file8.jp2 deleted file mode 100644 index 17497763..00000000 Binary files a/CSJ2K/codectest/file8.jp2 and /dev/null differ diff --git a/CSJ2K/codectest/file9.jp2 b/CSJ2K/codectest/file9.jp2 deleted file mode 100644 index c25091ad..00000000 Binary files a/CSJ2K/codectest/file9.jp2 and /dev/null differ diff --git a/CSJ2K/CSJ2K/j2k/IntegerSpec.cs b/CSJ2K/j2k/IntegerSpec.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/IntegerSpec.cs rename to CSJ2K/j2k/IntegerSpec.cs diff --git a/CSJ2K/CSJ2K/j2k/JJ2KExceptionHandler.cs b/CSJ2K/j2k/JJ2KExceptionHandler.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/JJ2KExceptionHandler.cs rename to CSJ2K/j2k/JJ2KExceptionHandler.cs diff --git a/CSJ2K/CSJ2K/j2k/JJ2KInfo.cs b/CSJ2K/j2k/JJ2KInfo.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/JJ2KInfo.cs rename to CSJ2K/j2k/JJ2KInfo.cs diff --git a/CSJ2K/CSJ2K/j2k/ModuleSpec.cs b/CSJ2K/j2k/ModuleSpec.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/ModuleSpec.cs rename to CSJ2K/j2k/ModuleSpec.cs diff --git a/CSJ2K/CSJ2K/j2k/NoNextElementException.cs b/CSJ2K/j2k/NoNextElementException.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/NoNextElementException.cs rename to CSJ2K/j2k/NoNextElementException.cs diff --git a/CSJ2K/CSJ2K/j2k/NotImplementedError.cs b/CSJ2K/j2k/NotImplementedError.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/NotImplementedError.cs rename to CSJ2K/j2k/NotImplementedError.cs diff --git a/CSJ2K/CSJ2K/j2k/StringSpec.cs b/CSJ2K/j2k/StringSpec.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/StringSpec.cs rename to CSJ2K/j2k/StringSpec.cs diff --git a/CSJ2K/CSJ2K/j2k/codestream/CBlkCoordInfo.cs b/CSJ2K/j2k/codestream/CBlkCoordInfo.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/codestream/CBlkCoordInfo.cs rename to CSJ2K/j2k/codestream/CBlkCoordInfo.cs diff --git a/CSJ2K/CSJ2K/j2k/codestream/CoordInfo.cs b/CSJ2K/j2k/codestream/CoordInfo.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/codestream/CoordInfo.cs rename to CSJ2K/j2k/codestream/CoordInfo.cs diff --git a/CSJ2K/CSJ2K/j2k/codestream/CorruptedCodestreamException.cs b/CSJ2K/j2k/codestream/CorruptedCodestreamException.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/codestream/CorruptedCodestreamException.cs rename to CSJ2K/j2k/codestream/CorruptedCodestreamException.cs diff --git a/CSJ2K/CSJ2K/j2k/codestream/HeaderInfo.cs b/CSJ2K/j2k/codestream/HeaderInfo.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/codestream/HeaderInfo.cs rename to CSJ2K/j2k/codestream/HeaderInfo.cs diff --git a/CSJ2K/CSJ2K/j2k/codestream/Markers.cs b/CSJ2K/j2k/codestream/Markers.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/codestream/Markers.cs rename to CSJ2K/j2k/codestream/Markers.cs diff --git a/CSJ2K/CSJ2K/j2k/codestream/PrecCoordInfo.cs b/CSJ2K/j2k/codestream/PrecCoordInfo.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/codestream/PrecCoordInfo.cs rename to CSJ2K/j2k/codestream/PrecCoordInfo.cs diff --git a/CSJ2K/CSJ2K/j2k/codestream/PrecInfo.cs b/CSJ2K/j2k/codestream/PrecInfo.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/codestream/PrecInfo.cs rename to CSJ2K/j2k/codestream/PrecInfo.cs diff --git a/CSJ2K/CSJ2K/j2k/codestream/ProgressionType.cs b/CSJ2K/j2k/codestream/ProgressionType.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/codestream/ProgressionType.cs rename to CSJ2K/j2k/codestream/ProgressionType.cs diff --git a/CSJ2K/CSJ2K/j2k/codestream/reader/BitstreamReaderAgent.cs b/CSJ2K/j2k/codestream/reader/BitstreamReaderAgent.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/codestream/reader/BitstreamReaderAgent.cs rename to CSJ2K/j2k/codestream/reader/BitstreamReaderAgent.cs diff --git a/CSJ2K/CSJ2K/j2k/codestream/reader/CBlkInfo.cs b/CSJ2K/j2k/codestream/reader/CBlkInfo.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/codestream/reader/CBlkInfo.cs rename to CSJ2K/j2k/codestream/reader/CBlkInfo.cs diff --git a/CSJ2K/CSJ2K/j2k/codestream/reader/FileBitstreamReaderAgent.cs b/CSJ2K/j2k/codestream/reader/FileBitstreamReaderAgent.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/codestream/reader/FileBitstreamReaderAgent.cs rename to CSJ2K/j2k/codestream/reader/FileBitstreamReaderAgent.cs diff --git a/CSJ2K/CSJ2K/j2k/codestream/reader/HeaderDecoder.cs b/CSJ2K/j2k/codestream/reader/HeaderDecoder.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/codestream/reader/HeaderDecoder.cs rename to CSJ2K/j2k/codestream/reader/HeaderDecoder.cs diff --git a/CSJ2K/CSJ2K/j2k/codestream/reader/PktDecoder.cs b/CSJ2K/j2k/codestream/reader/PktDecoder.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/codestream/reader/PktDecoder.cs rename to CSJ2K/j2k/codestream/reader/PktDecoder.cs diff --git a/CSJ2K/CSJ2K/j2k/codestream/reader/PktHeaderBitReader.cs b/CSJ2K/j2k/codestream/reader/PktHeaderBitReader.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/codestream/reader/PktHeaderBitReader.cs rename to CSJ2K/j2k/codestream/reader/PktHeaderBitReader.cs diff --git a/CSJ2K/CSJ2K/j2k/codestream/reader/PktInfo.cs b/CSJ2K/j2k/codestream/reader/PktInfo.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/codestream/reader/PktInfo.cs rename to CSJ2K/j2k/codestream/reader/PktInfo.cs diff --git a/CSJ2K/CSJ2K/j2k/codestream/reader/TagTreeDecoder.cs b/CSJ2K/j2k/codestream/reader/TagTreeDecoder.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/codestream/reader/TagTreeDecoder.cs rename to CSJ2K/j2k/codestream/reader/TagTreeDecoder.cs diff --git a/CSJ2K/CSJ2K/j2k/codestream/writer/BitOutputBuffer.cs b/CSJ2K/j2k/codestream/writer/BitOutputBuffer.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/codestream/writer/BitOutputBuffer.cs rename to CSJ2K/j2k/codestream/writer/BitOutputBuffer.cs diff --git a/CSJ2K/CSJ2K/j2k/codestream/writer/CodestreamWriter.cs b/CSJ2K/j2k/codestream/writer/CodestreamWriter.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/codestream/writer/CodestreamWriter.cs rename to CSJ2K/j2k/codestream/writer/CodestreamWriter.cs diff --git a/CSJ2K/CSJ2K/j2k/codestream/writer/FileCodestreamWriter.cs b/CSJ2K/j2k/codestream/writer/FileCodestreamWriter.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/codestream/writer/FileCodestreamWriter.cs rename to CSJ2K/j2k/codestream/writer/FileCodestreamWriter.cs diff --git a/CSJ2K/CSJ2K/j2k/codestream/writer/HeaderEncoder.cs b/CSJ2K/j2k/codestream/writer/HeaderEncoder.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/codestream/writer/HeaderEncoder.cs rename to CSJ2K/j2k/codestream/writer/HeaderEncoder.cs diff --git a/CSJ2K/CSJ2K/j2k/codestream/writer/PktEncoder.cs b/CSJ2K/j2k/codestream/writer/PktEncoder.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/codestream/writer/PktEncoder.cs rename to CSJ2K/j2k/codestream/writer/PktEncoder.cs diff --git a/CSJ2K/CSJ2K/j2k/codestream/writer/TagTreeEncoder.cs b/CSJ2K/j2k/codestream/writer/TagTreeEncoder.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/codestream/writer/TagTreeEncoder.cs rename to CSJ2K/j2k/codestream/writer/TagTreeEncoder.cs diff --git a/CSJ2K/CSJ2K/j2k/decoder/DecoderSpecs.cs b/CSJ2K/j2k/decoder/DecoderSpecs.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/decoder/DecoderSpecs.cs rename to CSJ2K/j2k/decoder/DecoderSpecs.cs diff --git a/CSJ2K/CSJ2K/j2k/encoder/EncoderSpecs.cs b/CSJ2K/j2k/encoder/EncoderSpecs.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/encoder/EncoderSpecs.cs rename to CSJ2K/j2k/encoder/EncoderSpecs.cs diff --git a/CSJ2K/CSJ2K/j2k/entropy/CBlkSizeSpec.cs b/CSJ2K/j2k/entropy/CBlkSizeSpec.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/entropy/CBlkSizeSpec.cs rename to CSJ2K/j2k/entropy/CBlkSizeSpec.cs diff --git a/CSJ2K/CSJ2K/j2k/entropy/CodedCBlk.cs b/CSJ2K/j2k/entropy/CodedCBlk.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/entropy/CodedCBlk.cs rename to CSJ2K/j2k/entropy/CodedCBlk.cs diff --git a/CSJ2K/CSJ2K/j2k/entropy/PrecinctSizeSpec.cs b/CSJ2K/j2k/entropy/PrecinctSizeSpec.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/entropy/PrecinctSizeSpec.cs rename to CSJ2K/j2k/entropy/PrecinctSizeSpec.cs diff --git a/CSJ2K/CSJ2K/j2k/entropy/Progression.cs b/CSJ2K/j2k/entropy/Progression.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/entropy/Progression.cs rename to CSJ2K/j2k/entropy/Progression.cs diff --git a/CSJ2K/CSJ2K/j2k/entropy/ProgressionSpec.cs b/CSJ2K/j2k/entropy/ProgressionSpec.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/entropy/ProgressionSpec.cs rename to CSJ2K/j2k/entropy/ProgressionSpec.cs diff --git a/CSJ2K/CSJ2K/j2k/entropy/StdEntropyCoderOptions.cs b/CSJ2K/j2k/entropy/StdEntropyCoderOptions.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/entropy/StdEntropyCoderOptions.cs rename to CSJ2K/j2k/entropy/StdEntropyCoderOptions.cs diff --git a/CSJ2K/CSJ2K/j2k/entropy/decoder/ByteInputBuffer.cs b/CSJ2K/j2k/entropy/decoder/ByteInputBuffer.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/entropy/decoder/ByteInputBuffer.cs rename to CSJ2K/j2k/entropy/decoder/ByteInputBuffer.cs diff --git a/CSJ2K/CSJ2K/j2k/entropy/decoder/ByteToBitInput.cs b/CSJ2K/j2k/entropy/decoder/ByteToBitInput.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/entropy/decoder/ByteToBitInput.cs rename to CSJ2K/j2k/entropy/decoder/ByteToBitInput.cs diff --git a/CSJ2K/CSJ2K/j2k/entropy/decoder/CodedCBlkDataSrcDec.cs b/CSJ2K/j2k/entropy/decoder/CodedCBlkDataSrcDec.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/entropy/decoder/CodedCBlkDataSrcDec.cs rename to CSJ2K/j2k/entropy/decoder/CodedCBlkDataSrcDec.cs diff --git a/CSJ2K/CSJ2K/j2k/entropy/decoder/DecLyrdCBlk.cs b/CSJ2K/j2k/entropy/decoder/DecLyrdCBlk.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/entropy/decoder/DecLyrdCBlk.cs rename to CSJ2K/j2k/entropy/decoder/DecLyrdCBlk.cs diff --git a/CSJ2K/CSJ2K/j2k/entropy/decoder/EntropyDecoder.cs b/CSJ2K/j2k/entropy/decoder/EntropyDecoder.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/entropy/decoder/EntropyDecoder.cs rename to CSJ2K/j2k/entropy/decoder/EntropyDecoder.cs diff --git a/CSJ2K/CSJ2K/j2k/entropy/decoder/MQDecoder.cs b/CSJ2K/j2k/entropy/decoder/MQDecoder.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/entropy/decoder/MQDecoder.cs rename to CSJ2K/j2k/entropy/decoder/MQDecoder.cs diff --git a/CSJ2K/CSJ2K/j2k/entropy/decoder/StdEntropyDecoder.cs b/CSJ2K/j2k/entropy/decoder/StdEntropyDecoder.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/entropy/decoder/StdEntropyDecoder.cs rename to CSJ2K/j2k/entropy/decoder/StdEntropyDecoder.cs diff --git a/CSJ2K/CSJ2K/j2k/entropy/encoder/BitToByteOutput.cs b/CSJ2K/j2k/entropy/encoder/BitToByteOutput.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/entropy/encoder/BitToByteOutput.cs rename to CSJ2K/j2k/entropy/encoder/BitToByteOutput.cs diff --git a/CSJ2K/CSJ2K/j2k/entropy/encoder/ByteOutputBuffer.cs b/CSJ2K/j2k/entropy/encoder/ByteOutputBuffer.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/entropy/encoder/ByteOutputBuffer.cs rename to CSJ2K/j2k/entropy/encoder/ByteOutputBuffer.cs diff --git a/CSJ2K/CSJ2K/j2k/entropy/encoder/CBlkRateDistStats.cs b/CSJ2K/j2k/entropy/encoder/CBlkRateDistStats.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/entropy/encoder/CBlkRateDistStats.cs rename to CSJ2K/j2k/entropy/encoder/CBlkRateDistStats.cs diff --git a/CSJ2K/CSJ2K/j2k/entropy/encoder/CodedCBlkDataSrcEnc.cs b/CSJ2K/j2k/entropy/encoder/CodedCBlkDataSrcEnc.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/entropy/encoder/CodedCBlkDataSrcEnc.cs rename to CSJ2K/j2k/entropy/encoder/CodedCBlkDataSrcEnc.cs diff --git a/CSJ2K/CSJ2K/j2k/entropy/encoder/EBCOTLayer.cs b/CSJ2K/j2k/entropy/encoder/EBCOTLayer.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/entropy/encoder/EBCOTLayer.cs rename to CSJ2K/j2k/entropy/encoder/EBCOTLayer.cs diff --git a/CSJ2K/CSJ2K/j2k/entropy/encoder/EBCOTRateAllocator.cs b/CSJ2K/j2k/entropy/encoder/EBCOTRateAllocator.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/entropy/encoder/EBCOTRateAllocator.cs rename to CSJ2K/j2k/entropy/encoder/EBCOTRateAllocator.cs diff --git a/CSJ2K/CSJ2K/j2k/entropy/encoder/EntropyCoder.cs b/CSJ2K/j2k/entropy/encoder/EntropyCoder.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/entropy/encoder/EntropyCoder.cs rename to CSJ2K/j2k/entropy/encoder/EntropyCoder.cs diff --git a/CSJ2K/CSJ2K/j2k/entropy/encoder/LayersInfo.cs b/CSJ2K/j2k/entropy/encoder/LayersInfo.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/entropy/encoder/LayersInfo.cs rename to CSJ2K/j2k/entropy/encoder/LayersInfo.cs diff --git a/CSJ2K/CSJ2K/j2k/entropy/encoder/MQCoder.cs b/CSJ2K/j2k/entropy/encoder/MQCoder.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/entropy/encoder/MQCoder.cs rename to CSJ2K/j2k/entropy/encoder/MQCoder.cs diff --git a/CSJ2K/CSJ2K/j2k/entropy/encoder/PostCompRateAllocator.cs b/CSJ2K/j2k/entropy/encoder/PostCompRateAllocator.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/entropy/encoder/PostCompRateAllocator.cs rename to CSJ2K/j2k/entropy/encoder/PostCompRateAllocator.cs diff --git a/CSJ2K/CSJ2K/j2k/entropy/encoder/StdEntropyCoder.cs b/CSJ2K/j2k/entropy/encoder/StdEntropyCoder.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/entropy/encoder/StdEntropyCoder.cs rename to CSJ2K/j2k/entropy/encoder/StdEntropyCoder.cs diff --git a/CSJ2K/CSJ2K/j2k/fileformat/FileFormatBoxes.cs b/CSJ2K/j2k/fileformat/FileFormatBoxes.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/fileformat/FileFormatBoxes.cs rename to CSJ2K/j2k/fileformat/FileFormatBoxes.cs diff --git a/CSJ2K/CSJ2K/j2k/fileformat/reader/FileFormatReader.cs b/CSJ2K/j2k/fileformat/reader/FileFormatReader.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/fileformat/reader/FileFormatReader.cs rename to CSJ2K/j2k/fileformat/reader/FileFormatReader.cs diff --git a/CSJ2K/CSJ2K/j2k/fileformat/writer/FileFormatWriter.cs b/CSJ2K/j2k/fileformat/writer/FileFormatWriter.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/fileformat/writer/FileFormatWriter.cs rename to CSJ2K/j2k/fileformat/writer/FileFormatWriter.cs diff --git a/CSJ2K/CSJ2K/j2k/image/BlkImgDataSrc.cs b/CSJ2K/j2k/image/BlkImgDataSrc.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/image/BlkImgDataSrc.cs rename to CSJ2K/j2k/image/BlkImgDataSrc.cs diff --git a/CSJ2K/CSJ2K/j2k/image/CompTransfSpec.cs b/CSJ2K/j2k/image/CompTransfSpec.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/image/CompTransfSpec.cs rename to CSJ2K/j2k/image/CompTransfSpec.cs diff --git a/CSJ2K/CSJ2K/j2k/image/Coord.cs b/CSJ2K/j2k/image/Coord.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/image/Coord.cs rename to CSJ2K/j2k/image/Coord.cs diff --git a/CSJ2K/CSJ2K/j2k/image/DataBlk.cs b/CSJ2K/j2k/image/DataBlk.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/image/DataBlk.cs rename to CSJ2K/j2k/image/DataBlk.cs diff --git a/CSJ2K/CSJ2K/j2k/image/DataBlkFloat.cs b/CSJ2K/j2k/image/DataBlkFloat.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/image/DataBlkFloat.cs rename to CSJ2K/j2k/image/DataBlkFloat.cs diff --git a/CSJ2K/CSJ2K/j2k/image/DataBlkInt.cs b/CSJ2K/j2k/image/DataBlkInt.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/image/DataBlkInt.cs rename to CSJ2K/j2k/image/DataBlkInt.cs diff --git a/CSJ2K/CSJ2K/j2k/image/ImgData.cs b/CSJ2K/j2k/image/ImgData.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/image/ImgData.cs rename to CSJ2K/j2k/image/ImgData.cs diff --git a/CSJ2K/CSJ2K/j2k/image/ImgDataAdapter.cs b/CSJ2K/j2k/image/ImgDataAdapter.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/image/ImgDataAdapter.cs rename to CSJ2K/j2k/image/ImgDataAdapter.cs diff --git a/CSJ2K/CSJ2K/j2k/image/ImgDataConverter.cs b/CSJ2K/j2k/image/ImgDataConverter.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/image/ImgDataConverter.cs rename to CSJ2K/j2k/image/ImgDataConverter.cs diff --git a/CSJ2K/CSJ2K/j2k/image/ImgDataJoiner.cs b/CSJ2K/j2k/image/ImgDataJoiner.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/image/ImgDataJoiner.cs rename to CSJ2K/j2k/image/ImgDataJoiner.cs diff --git a/CSJ2K/CSJ2K/j2k/image/Tiler.cs b/CSJ2K/j2k/image/Tiler.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/image/Tiler.cs rename to CSJ2K/j2k/image/Tiler.cs diff --git a/CSJ2K/CSJ2K/j2k/image/forwcomptransf/ForwCompTransf.cs b/CSJ2K/j2k/image/forwcomptransf/ForwCompTransf.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/image/forwcomptransf/ForwCompTransf.cs rename to CSJ2K/j2k/image/forwcomptransf/ForwCompTransf.cs diff --git a/CSJ2K/CSJ2K/j2k/image/forwcomptransf/ForwCompTransfSpec.cs b/CSJ2K/j2k/image/forwcomptransf/ForwCompTransfSpec.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/image/forwcomptransf/ForwCompTransfSpec.cs rename to CSJ2K/j2k/image/forwcomptransf/ForwCompTransfSpec.cs diff --git a/CSJ2K/CSJ2K/j2k/image/input/ImgReader.cs b/CSJ2K/j2k/image/input/ImgReader.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/image/input/ImgReader.cs rename to CSJ2K/j2k/image/input/ImgReader.cs diff --git a/CSJ2K/CSJ2K/j2k/image/input/ImgReaderPGM.cs b/CSJ2K/j2k/image/input/ImgReaderPGM.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/image/input/ImgReaderPGM.cs rename to CSJ2K/j2k/image/input/ImgReaderPGM.cs diff --git a/CSJ2K/CSJ2K/j2k/image/input/ImgReaderPGX.cs b/CSJ2K/j2k/image/input/ImgReaderPGX.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/image/input/ImgReaderPGX.cs rename to CSJ2K/j2k/image/input/ImgReaderPGX.cs diff --git a/CSJ2K/CSJ2K/j2k/image/input/ImgReaderPPM.cs b/CSJ2K/j2k/image/input/ImgReaderPPM.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/image/input/ImgReaderPPM.cs rename to CSJ2K/j2k/image/input/ImgReaderPPM.cs diff --git a/CSJ2K/CSJ2K/j2k/image/invcomptransf/InvCompTransf.cs b/CSJ2K/j2k/image/invcomptransf/InvCompTransf.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/image/invcomptransf/InvCompTransf.cs rename to CSJ2K/j2k/image/invcomptransf/InvCompTransf.cs diff --git a/CSJ2K/CSJ2K/j2k/image/output/ImgWriter.cs b/CSJ2K/j2k/image/output/ImgWriter.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/image/output/ImgWriter.cs rename to CSJ2K/j2k/image/output/ImgWriter.cs diff --git a/CSJ2K/CSJ2K/j2k/image/output/ImgWriterPGM.cs b/CSJ2K/j2k/image/output/ImgWriterPGM.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/image/output/ImgWriterPGM.cs rename to CSJ2K/j2k/image/output/ImgWriterPGM.cs diff --git a/CSJ2K/CSJ2K/j2k/image/output/ImgWriterPGX.cs b/CSJ2K/j2k/image/output/ImgWriterPGX.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/image/output/ImgWriterPGX.cs rename to CSJ2K/j2k/image/output/ImgWriterPGX.cs diff --git a/CSJ2K/CSJ2K/j2k/image/output/ImgWriterPPM.cs b/CSJ2K/j2k/image/output/ImgWriterPPM.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/image/output/ImgWriterPPM.cs rename to CSJ2K/j2k/image/output/ImgWriterPPM.cs diff --git a/CSJ2K/CSJ2K/j2k/io/BEBufferedRandomAccessFile.cs b/CSJ2K/j2k/io/BEBufferedRandomAccessFile.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/io/BEBufferedRandomAccessFile.cs rename to CSJ2K/j2k/io/BEBufferedRandomAccessFile.cs diff --git a/CSJ2K/CSJ2K/j2k/io/BinaryDataInput.cs b/CSJ2K/j2k/io/BinaryDataInput.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/io/BinaryDataInput.cs rename to CSJ2K/j2k/io/BinaryDataInput.cs diff --git a/CSJ2K/CSJ2K/j2k/io/BinaryDataOutput.cs b/CSJ2K/j2k/io/BinaryDataOutput.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/io/BinaryDataOutput.cs rename to CSJ2K/j2k/io/BinaryDataOutput.cs diff --git a/CSJ2K/CSJ2K/j2k/io/BufferedRandomAccessFile.cs b/CSJ2K/j2k/io/BufferedRandomAccessFile.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/io/BufferedRandomAccessFile.cs rename to CSJ2K/j2k/io/BufferedRandomAccessFile.cs diff --git a/CSJ2K/CSJ2K/j2k/io/EndianType.cs b/CSJ2K/j2k/io/EndianType.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/io/EndianType.cs rename to CSJ2K/j2k/io/EndianType.cs diff --git a/CSJ2K/CSJ2K/j2k/io/RandomAccessIO.cs b/CSJ2K/j2k/io/RandomAccessIO.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/io/RandomAccessIO.cs rename to CSJ2K/j2k/io/RandomAccessIO.cs diff --git a/CSJ2K/CSJ2K/j2k/quantization/GuardBitsSpec.cs b/CSJ2K/j2k/quantization/GuardBitsSpec.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/quantization/GuardBitsSpec.cs rename to CSJ2K/j2k/quantization/GuardBitsSpec.cs diff --git a/CSJ2K/CSJ2K/j2k/quantization/QuantStepSizeSpec.cs b/CSJ2K/j2k/quantization/QuantStepSizeSpec.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/quantization/QuantStepSizeSpec.cs rename to CSJ2K/j2k/quantization/QuantStepSizeSpec.cs diff --git a/CSJ2K/CSJ2K/j2k/quantization/QuantTypeSpec.cs b/CSJ2K/j2k/quantization/QuantTypeSpec.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/quantization/QuantTypeSpec.cs rename to CSJ2K/j2k/quantization/QuantTypeSpec.cs diff --git a/CSJ2K/CSJ2K/j2k/quantization/QuantizationType.cs b/CSJ2K/j2k/quantization/QuantizationType.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/quantization/QuantizationType.cs rename to CSJ2K/j2k/quantization/QuantizationType.cs diff --git a/CSJ2K/CSJ2K/j2k/quantization/dequantizer/CBlkQuantDataSrcDec.cs b/CSJ2K/j2k/quantization/dequantizer/CBlkQuantDataSrcDec.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/quantization/dequantizer/CBlkQuantDataSrcDec.cs rename to CSJ2K/j2k/quantization/dequantizer/CBlkQuantDataSrcDec.cs diff --git a/CSJ2K/CSJ2K/j2k/quantization/dequantizer/Dequantizer.cs b/CSJ2K/j2k/quantization/dequantizer/Dequantizer.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/quantization/dequantizer/Dequantizer.cs rename to CSJ2K/j2k/quantization/dequantizer/Dequantizer.cs diff --git a/CSJ2K/CSJ2K/j2k/quantization/dequantizer/DequantizerParams.cs b/CSJ2K/j2k/quantization/dequantizer/DequantizerParams.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/quantization/dequantizer/DequantizerParams.cs rename to CSJ2K/j2k/quantization/dequantizer/DequantizerParams.cs diff --git a/CSJ2K/CSJ2K/j2k/quantization/dequantizer/StdDequantizer.cs b/CSJ2K/j2k/quantization/dequantizer/StdDequantizer.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/quantization/dequantizer/StdDequantizer.cs rename to CSJ2K/j2k/quantization/dequantizer/StdDequantizer.cs diff --git a/CSJ2K/CSJ2K/j2k/quantization/dequantizer/StdDequantizerParams.cs b/CSJ2K/j2k/quantization/dequantizer/StdDequantizerParams.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/quantization/dequantizer/StdDequantizerParams.cs rename to CSJ2K/j2k/quantization/dequantizer/StdDequantizerParams.cs diff --git a/CSJ2K/CSJ2K/j2k/quantization/quantizer/CBlkQuantDataSrcEnc.cs b/CSJ2K/j2k/quantization/quantizer/CBlkQuantDataSrcEnc.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/quantization/quantizer/CBlkQuantDataSrcEnc.cs rename to CSJ2K/j2k/quantization/quantizer/CBlkQuantDataSrcEnc.cs diff --git a/CSJ2K/CSJ2K/j2k/quantization/quantizer/Quantizer.cs b/CSJ2K/j2k/quantization/quantizer/Quantizer.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/quantization/quantizer/Quantizer.cs rename to CSJ2K/j2k/quantization/quantizer/Quantizer.cs diff --git a/CSJ2K/CSJ2K/j2k/quantization/quantizer/StdQuantizer.cs b/CSJ2K/j2k/quantization/quantizer/StdQuantizer.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/quantization/quantizer/StdQuantizer.cs rename to CSJ2K/j2k/quantization/quantizer/StdQuantizer.cs diff --git a/CSJ2K/CSJ2K/j2k/roi/MaxShiftSpec.cs b/CSJ2K/j2k/roi/MaxShiftSpec.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/roi/MaxShiftSpec.cs rename to CSJ2K/j2k/roi/MaxShiftSpec.cs diff --git a/CSJ2K/CSJ2K/j2k/roi/ROIDeScaler.cs b/CSJ2K/j2k/roi/ROIDeScaler.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/roi/ROIDeScaler.cs rename to CSJ2K/j2k/roi/ROIDeScaler.cs diff --git a/CSJ2K/CSJ2K/j2k/roi/encoder/ArbROIMaskGenerator.cs b/CSJ2K/j2k/roi/encoder/ArbROIMaskGenerator.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/roi/encoder/ArbROIMaskGenerator.cs rename to CSJ2K/j2k/roi/encoder/ArbROIMaskGenerator.cs diff --git a/CSJ2K/CSJ2K/j2k/roi/encoder/ROI.cs b/CSJ2K/j2k/roi/encoder/ROI.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/roi/encoder/ROI.cs rename to CSJ2K/j2k/roi/encoder/ROI.cs diff --git a/CSJ2K/CSJ2K/j2k/roi/encoder/ROIMaskGenerator.cs b/CSJ2K/j2k/roi/encoder/ROIMaskGenerator.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/roi/encoder/ROIMaskGenerator.cs rename to CSJ2K/j2k/roi/encoder/ROIMaskGenerator.cs diff --git a/CSJ2K/CSJ2K/j2k/roi/encoder/ROIScaler.cs b/CSJ2K/j2k/roi/encoder/ROIScaler.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/roi/encoder/ROIScaler.cs rename to CSJ2K/j2k/roi/encoder/ROIScaler.cs diff --git a/CSJ2K/CSJ2K/j2k/roi/encoder/RectROIMaskGenerator.cs b/CSJ2K/j2k/roi/encoder/RectROIMaskGenerator.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/roi/encoder/RectROIMaskGenerator.cs rename to CSJ2K/j2k/roi/encoder/RectROIMaskGenerator.cs diff --git a/CSJ2K/CSJ2K/j2k/roi/encoder/SubbandROIMask.cs b/CSJ2K/j2k/roi/encoder/SubbandROIMask.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/roi/encoder/SubbandROIMask.cs rename to CSJ2K/j2k/roi/encoder/SubbandROIMask.cs diff --git a/CSJ2K/CSJ2K/j2k/roi/encoder/SubbandRectROIMask.cs b/CSJ2K/j2k/roi/encoder/SubbandRectROIMask.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/roi/encoder/SubbandRectROIMask.cs rename to CSJ2K/j2k/roi/encoder/SubbandRectROIMask.cs diff --git a/CSJ2K/CSJ2K/j2k/util/ArrayUtil.cs b/CSJ2K/j2k/util/ArrayUtil.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/util/ArrayUtil.cs rename to CSJ2K/j2k/util/ArrayUtil.cs diff --git a/CSJ2K/CSJ2K/j2k/util/CodestreamManipulator.cs b/CSJ2K/j2k/util/CodestreamManipulator.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/util/CodestreamManipulator.cs rename to CSJ2K/j2k/util/CodestreamManipulator.cs diff --git a/CSJ2K/CSJ2K/j2k/util/FacilityManager.cs b/CSJ2K/j2k/util/FacilityManager.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/util/FacilityManager.cs rename to CSJ2K/j2k/util/FacilityManager.cs diff --git a/CSJ2K/CSJ2K/j2k/util/ISRandomAccessIO.cs b/CSJ2K/j2k/util/ISRandomAccessIO.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/util/ISRandomAccessIO.cs rename to CSJ2K/j2k/util/ISRandomAccessIO.cs diff --git a/CSJ2K/CSJ2K/j2k/util/MathUtil.cs b/CSJ2K/j2k/util/MathUtil.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/util/MathUtil.cs rename to CSJ2K/j2k/util/MathUtil.cs diff --git a/CSJ2K/CSJ2K/j2k/util/MsgLogger.cs b/CSJ2K/j2k/util/MsgLogger.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/util/MsgLogger.cs rename to CSJ2K/j2k/util/MsgLogger.cs diff --git a/CSJ2K/CSJ2K/j2k/util/MsgPrinter.cs b/CSJ2K/j2k/util/MsgPrinter.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/util/MsgPrinter.cs rename to CSJ2K/j2k/util/MsgPrinter.cs diff --git a/CSJ2K/CSJ2K/j2k/util/ParameterList.cs b/CSJ2K/j2k/util/ParameterList.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/util/ParameterList.cs rename to CSJ2K/j2k/util/ParameterList.cs diff --git a/CSJ2K/CSJ2K/j2k/util/ProgressWatch.cs b/CSJ2K/j2k/util/ProgressWatch.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/util/ProgressWatch.cs rename to CSJ2K/j2k/util/ProgressWatch.cs diff --git a/CSJ2K/CSJ2K/j2k/util/StreamMsgLogger.cs b/CSJ2K/j2k/util/StreamMsgLogger.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/util/StreamMsgLogger.cs rename to CSJ2K/j2k/util/StreamMsgLogger.cs diff --git a/CSJ2K/CSJ2K/j2k/util/StringFormatException.cs b/CSJ2K/j2k/util/StringFormatException.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/util/StringFormatException.cs rename to CSJ2K/j2k/util/StringFormatException.cs diff --git a/CSJ2K/CSJ2K/j2k/util/ThreadPool.cs b/CSJ2K/j2k/util/ThreadPool.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/util/ThreadPool.cs rename to CSJ2K/j2k/util/ThreadPool.cs diff --git a/CSJ2K/CSJ2K/j2k/wavelet/FilterTypes.cs b/CSJ2K/j2k/wavelet/FilterTypes.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/wavelet/FilterTypes.cs rename to CSJ2K/j2k/wavelet/FilterTypes.cs diff --git a/CSJ2K/CSJ2K/j2k/wavelet/Subband.cs b/CSJ2K/j2k/wavelet/Subband.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/wavelet/Subband.cs rename to CSJ2K/j2k/wavelet/Subband.cs diff --git a/CSJ2K/CSJ2K/j2k/wavelet/WTDecompSpec.cs b/CSJ2K/j2k/wavelet/WTDecompSpec.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/wavelet/WTDecompSpec.cs rename to CSJ2K/j2k/wavelet/WTDecompSpec.cs diff --git a/CSJ2K/CSJ2K/j2k/wavelet/WTFilterSpec.cs b/CSJ2K/j2k/wavelet/WTFilterSpec.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/wavelet/WTFilterSpec.cs rename to CSJ2K/j2k/wavelet/WTFilterSpec.cs diff --git a/CSJ2K/CSJ2K/j2k/wavelet/WaveletFilter.cs b/CSJ2K/j2k/wavelet/WaveletFilter.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/wavelet/WaveletFilter.cs rename to CSJ2K/j2k/wavelet/WaveletFilter.cs diff --git a/CSJ2K/CSJ2K/j2k/wavelet/WaveletTransform.cs b/CSJ2K/j2k/wavelet/WaveletTransform.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/wavelet/WaveletTransform.cs rename to CSJ2K/j2k/wavelet/WaveletTransform.cs diff --git a/CSJ2K/CSJ2K/j2k/wavelet/analysis/AnWTFilter.cs b/CSJ2K/j2k/wavelet/analysis/AnWTFilter.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/wavelet/analysis/AnWTFilter.cs rename to CSJ2K/j2k/wavelet/analysis/AnWTFilter.cs diff --git a/CSJ2K/CSJ2K/j2k/wavelet/analysis/AnWTFilterFloat.cs b/CSJ2K/j2k/wavelet/analysis/AnWTFilterFloat.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/wavelet/analysis/AnWTFilterFloat.cs rename to CSJ2K/j2k/wavelet/analysis/AnWTFilterFloat.cs diff --git a/CSJ2K/CSJ2K/j2k/wavelet/analysis/AnWTFilterFloatLift9x7.cs b/CSJ2K/j2k/wavelet/analysis/AnWTFilterFloatLift9x7.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/wavelet/analysis/AnWTFilterFloatLift9x7.cs rename to CSJ2K/j2k/wavelet/analysis/AnWTFilterFloatLift9x7.cs diff --git a/CSJ2K/CSJ2K/j2k/wavelet/analysis/AnWTFilterInt.cs b/CSJ2K/j2k/wavelet/analysis/AnWTFilterInt.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/wavelet/analysis/AnWTFilterInt.cs rename to CSJ2K/j2k/wavelet/analysis/AnWTFilterInt.cs diff --git a/CSJ2K/CSJ2K/j2k/wavelet/analysis/AnWTFilterIntLift5x3.cs b/CSJ2K/j2k/wavelet/analysis/AnWTFilterIntLift5x3.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/wavelet/analysis/AnWTFilterIntLift5x3.cs rename to CSJ2K/j2k/wavelet/analysis/AnWTFilterIntLift5x3.cs diff --git a/CSJ2K/CSJ2K/j2k/wavelet/analysis/AnWTFilterSpec.cs b/CSJ2K/j2k/wavelet/analysis/AnWTFilterSpec.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/wavelet/analysis/AnWTFilterSpec.cs rename to CSJ2K/j2k/wavelet/analysis/AnWTFilterSpec.cs diff --git a/CSJ2K/CSJ2K/j2k/wavelet/analysis/CBlkWTData.cs b/CSJ2K/j2k/wavelet/analysis/CBlkWTData.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/wavelet/analysis/CBlkWTData.cs rename to CSJ2K/j2k/wavelet/analysis/CBlkWTData.cs diff --git a/CSJ2K/CSJ2K/j2k/wavelet/analysis/CBlkWTDataFloat.cs b/CSJ2K/j2k/wavelet/analysis/CBlkWTDataFloat.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/wavelet/analysis/CBlkWTDataFloat.cs rename to CSJ2K/j2k/wavelet/analysis/CBlkWTDataFloat.cs diff --git a/CSJ2K/CSJ2K/j2k/wavelet/analysis/CBlkWTDataInt.cs b/CSJ2K/j2k/wavelet/analysis/CBlkWTDataInt.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/wavelet/analysis/CBlkWTDataInt.cs rename to CSJ2K/j2k/wavelet/analysis/CBlkWTDataInt.cs diff --git a/CSJ2K/CSJ2K/j2k/wavelet/analysis/CBlkWTDataSrc.cs b/CSJ2K/j2k/wavelet/analysis/CBlkWTDataSrc.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/wavelet/analysis/CBlkWTDataSrc.cs rename to CSJ2K/j2k/wavelet/analysis/CBlkWTDataSrc.cs diff --git a/CSJ2K/CSJ2K/j2k/wavelet/analysis/ForwWT.cs b/CSJ2K/j2k/wavelet/analysis/ForwWT.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/wavelet/analysis/ForwWT.cs rename to CSJ2K/j2k/wavelet/analysis/ForwWT.cs diff --git a/CSJ2K/CSJ2K/j2k/wavelet/analysis/ForwWTDataProps.cs b/CSJ2K/j2k/wavelet/analysis/ForwWTDataProps.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/wavelet/analysis/ForwWTDataProps.cs rename to CSJ2K/j2k/wavelet/analysis/ForwWTDataProps.cs diff --git a/CSJ2K/CSJ2K/j2k/wavelet/analysis/ForwWTFull.cs b/CSJ2K/j2k/wavelet/analysis/ForwWTFull.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/wavelet/analysis/ForwWTFull.cs rename to CSJ2K/j2k/wavelet/analysis/ForwWTFull.cs diff --git a/CSJ2K/CSJ2K/j2k/wavelet/analysis/ForwardWT.cs b/CSJ2K/j2k/wavelet/analysis/ForwardWT.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/wavelet/analysis/ForwardWT.cs rename to CSJ2K/j2k/wavelet/analysis/ForwardWT.cs diff --git a/CSJ2K/CSJ2K/j2k/wavelet/analysis/SubbandAn.cs b/CSJ2K/j2k/wavelet/analysis/SubbandAn.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/wavelet/analysis/SubbandAn.cs rename to CSJ2K/j2k/wavelet/analysis/SubbandAn.cs diff --git a/CSJ2K/CSJ2K/j2k/wavelet/synthesis/CBlkWTDataSrcDec.cs b/CSJ2K/j2k/wavelet/synthesis/CBlkWTDataSrcDec.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/wavelet/synthesis/CBlkWTDataSrcDec.cs rename to CSJ2K/j2k/wavelet/synthesis/CBlkWTDataSrcDec.cs diff --git a/CSJ2K/CSJ2K/j2k/wavelet/synthesis/InvWT.cs b/CSJ2K/j2k/wavelet/synthesis/InvWT.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/wavelet/synthesis/InvWT.cs rename to CSJ2K/j2k/wavelet/synthesis/InvWT.cs diff --git a/CSJ2K/CSJ2K/j2k/wavelet/synthesis/InvWTAdapter.cs b/CSJ2K/j2k/wavelet/synthesis/InvWTAdapter.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/wavelet/synthesis/InvWTAdapter.cs rename to CSJ2K/j2k/wavelet/synthesis/InvWTAdapter.cs diff --git a/CSJ2K/CSJ2K/j2k/wavelet/synthesis/InvWTData.cs b/CSJ2K/j2k/wavelet/synthesis/InvWTData.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/wavelet/synthesis/InvWTData.cs rename to CSJ2K/j2k/wavelet/synthesis/InvWTData.cs diff --git a/CSJ2K/CSJ2K/j2k/wavelet/synthesis/InvWTFull.cs b/CSJ2K/j2k/wavelet/synthesis/InvWTFull.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/wavelet/synthesis/InvWTFull.cs rename to CSJ2K/j2k/wavelet/synthesis/InvWTFull.cs diff --git a/CSJ2K/CSJ2K/j2k/wavelet/synthesis/InverseWT.cs b/CSJ2K/j2k/wavelet/synthesis/InverseWT.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/wavelet/synthesis/InverseWT.cs rename to CSJ2K/j2k/wavelet/synthesis/InverseWT.cs diff --git a/CSJ2K/CSJ2K/j2k/wavelet/synthesis/MultiResImgData.cs b/CSJ2K/j2k/wavelet/synthesis/MultiResImgData.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/wavelet/synthesis/MultiResImgData.cs rename to CSJ2K/j2k/wavelet/synthesis/MultiResImgData.cs diff --git a/CSJ2K/CSJ2K/j2k/wavelet/synthesis/MultiResImgDataAdapter.cs b/CSJ2K/j2k/wavelet/synthesis/MultiResImgDataAdapter.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/wavelet/synthesis/MultiResImgDataAdapter.cs rename to CSJ2K/j2k/wavelet/synthesis/MultiResImgDataAdapter.cs diff --git a/CSJ2K/CSJ2K/j2k/wavelet/synthesis/SubbandSyn.cs b/CSJ2K/j2k/wavelet/synthesis/SubbandSyn.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/wavelet/synthesis/SubbandSyn.cs rename to CSJ2K/j2k/wavelet/synthesis/SubbandSyn.cs diff --git a/CSJ2K/CSJ2K/j2k/wavelet/synthesis/SynWTFilter.cs b/CSJ2K/j2k/wavelet/synthesis/SynWTFilter.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/wavelet/synthesis/SynWTFilter.cs rename to CSJ2K/j2k/wavelet/synthesis/SynWTFilter.cs diff --git a/CSJ2K/CSJ2K/j2k/wavelet/synthesis/SynWTFilterFloat.cs b/CSJ2K/j2k/wavelet/synthesis/SynWTFilterFloat.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/wavelet/synthesis/SynWTFilterFloat.cs rename to CSJ2K/j2k/wavelet/synthesis/SynWTFilterFloat.cs diff --git a/CSJ2K/CSJ2K/j2k/wavelet/synthesis/SynWTFilterFloatLift9x7.cs b/CSJ2K/j2k/wavelet/synthesis/SynWTFilterFloatLift9x7.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/wavelet/synthesis/SynWTFilterFloatLift9x7.cs rename to CSJ2K/j2k/wavelet/synthesis/SynWTFilterFloatLift9x7.cs diff --git a/CSJ2K/CSJ2K/j2k/wavelet/synthesis/SynWTFilterInt.cs b/CSJ2K/j2k/wavelet/synthesis/SynWTFilterInt.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/wavelet/synthesis/SynWTFilterInt.cs rename to CSJ2K/j2k/wavelet/synthesis/SynWTFilterInt.cs diff --git a/CSJ2K/CSJ2K/j2k/wavelet/synthesis/SynWTFilterIntLift5x3.cs b/CSJ2K/j2k/wavelet/synthesis/SynWTFilterIntLift5x3.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/wavelet/synthesis/SynWTFilterIntLift5x3.cs rename to CSJ2K/j2k/wavelet/synthesis/SynWTFilterIntLift5x3.cs diff --git a/CSJ2K/CSJ2K/j2k/wavelet/synthesis/SynWTFilterSpec.cs b/CSJ2K/j2k/wavelet/synthesis/SynWTFilterSpec.cs similarity index 100% rename from CSJ2K/CSJ2K/j2k/wavelet/synthesis/SynWTFilterSpec.cs rename to CSJ2K/j2k/wavelet/synthesis/SynWTFilterSpec.cs diff --git a/CSJ2K/jj2kdecoder/CmdLnDecoder.jsl b/CSJ2K/jj2kdecoder/CmdLnDecoder.jsl deleted file mode 100644 index 634285a6..00000000 --- a/CSJ2K/jj2kdecoder/CmdLnDecoder.jsl +++ /dev/null @@ -1,203 +0,0 @@ -/* - * CVS identifier: - * - * $Id: CmdLnDecoder.java,v 1.42 2001/07/17 12:27:32 grosbois Exp $ - * - * Class: CmdLnDecoder - * - * Description: The command line decoder - * - * - * - * COPYRIGHT: - * - * This software module was originally developed by Raphaël Grosbois and - * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel - * Askelöf (Ericsson Radio Systems AB); and Bertrand Berthelot, David - * Bouchard, Félix Henry, Gerard Mozelle and Patrice Onno (Canon Research - * Centre France S.A) in the course of development of the JPEG2000 - * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This - * software module is an implementation of a part of the JPEG 2000 - * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio - * Systems AB and Canon Research Centre France S.A (collectively JJ2000 - * Partners) agree not to assert against ISO/IEC and users of the JPEG - * 2000 Standard (Users) any of their rights under the copyright, not - * including other intellectual property rights, for this software module - * with respect to the usage by ISO/IEC and Users of this software module - * or modifications thereof for use in hardware or software products - * claiming conformance to the JPEG 2000 Standard. Those intending to use - * this software module in hardware or software products are advised that - * their use may infringe existing patents. The original developers of - * this software module, JJ2000 Partners and ISO/IEC assume no liability - * for use of this software module or modifications thereof. No license - * or right to this software module is granted for non JPEG 2000 Standard - * conforming products. JJ2000 Partners have full right to use this - * software module for his/her own purpose, assign or donate this - * software module to any third party and to inhibit third parties from - * using this software module for non JPEG 2000 Standard conforming - * products. This copyright notice must be included in all copies or - * derivative works of this software module. - * - * Copyright (c) 1999/2000 JJ2000 Partners. - * */ -package CSJ2K.j2k.decoder; - -import CSJ2K.j2k.util.*; - -import java.io.*; - -/** - * This class runs the JJ2000 decoder from the command line interface. It - * parses command-line arguments in order to fill a ParameterList object. Then - * this one is provided to a Decoder object. - * */ -public class CmdLnDecoder -{ - - /** The parameter list (with modules arguments) */ - private ParameterList pl; - - /** The default parameter list (with modules arguments) */ - private ParameterList defpl; - - /** The current Decoder object */ - private Decoder dec; - - /** - * The starting point of the program. It calls the constructor with the - * command line options in a String array. - * - * @param argv The command line parameters - * */ - public static void main(String argv[]) - { - if (argv.length == 0) - { - FacilityManager.getMsgLogger() - .println("CmdLnDecoder: JJ2000's JPEG 2000 Decoder\n" + - " use CSJ2K.j2k.decoder.CmdLnDecoder -u " + - "to get help\n", 0, 0); - System.exit(1); - } - - new CmdLnDecoder(argv); - } - - /** - * Instantiates a command line decoder object, width the 'argv' command - * line arguments. It also initializes the default parameters. If the - * argument list is empty an IllegalArgumentException is thrown. If an - * error occurs while parsing the arguments error messages are written to - * stderr and the run exit code is set to non-zero, see getExitCode() - * - * @exception IllegalArgumentException If 'argv' is empty - * - * @see Decoder#getExitCode - * */ - public CmdLnDecoder(String argv[]) - { - // Initialize default parameters - defpl = new ParameterList(); - String[][] param = Decoder.getAllParameters(); - - for (int i = param.length - 1; i >= 0; i--) - { - if (param[i][3] != null) - { - defpl.Set(param[i][0], param[i][3]); - } - } - - // Create parameter list using defaults - pl = new ParameterList(defpl); - - if (argv.length == 0) - { - throw new IllegalArgumentException("No arguments!"); - } - - // Parse arguments from argv - try - { - pl.parseArgs(argv); - } - catch (StringFormatException e) - { - System.err.println("An error occured while parsing the " + - "arguments:\n" + e.get_Message()); - return; - } - /* - // Parse the arguments from some file? - if (pl.getParameter("pfile") != null) - { - // Load parameters from file - InputStream is; - try - { - is = new FileInputStream(pl.getParameter("pfile")); - is = new BufferedInputStream(is); - pl.load(is); - } - catch (FileNotFoundException e) - { - System.err.println("Could not load the argument file " + - pl.getParameter("pfile")); - return; - } - catch (IOException e) - { - System.err.println("An error ocurred while reading from " + - "the argument " + "file " + - pl.getParameter("pfile")); - return; - } - try - { - is.close(); - } - catch (IOException e) - { - System.out.println("[WARNING]: Could not close the argument" + - " file after reading"); - } - // Now reparse command line arguments so that they override file - // arguments - try - { - pl.parseArgs(argv); - } - catch (StringFormatException e) - { - System.err.println("An error occured while re-parsing the " + - "arguments:\n" + e.getMessage()); - return; - } - } - */ - - // Instantiate the Decoder object - dec = new Decoder(pl); - if (dec.getExitCode() != 0) - { // An error ocurred - System.exit(dec.getExitCode()); - } - - // Run the decoder - try - { - dec.run(); - } - catch (Throwable e) - { - e.printStackTrace(); - } - finally - { - if (dec.getExitCode() != 0) - { - System.exit(dec.getExitCode()); - } - } - } -} diff --git a/CSJ2K/jj2kdecoder/Decoder.jsl b/CSJ2K/jj2kdecoder/Decoder.jsl deleted file mode 100644 index 6ab3e8e6..00000000 --- a/CSJ2K/jj2kdecoder/Decoder.jsl +++ /dev/null @@ -1,1586 +0,0 @@ -/* - * CVS identifier: - * - * $Id: Decoder.java,v 1.74 2002/08/08 14:09:35 grosbois Exp $ - * - * Class: Decoder - * - * Description: The decoder object - * - * - * - * COPYRIGHT: - * - * This software module was originally developed by Raphaël Grosbois and - * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel - * Askelöf (Ericsson Radio Systems AB); and Bertrand Berthelot, David - * Bouchard, Félix Henry, Gerard Mozelle and Patrice Onno (Canon Research - * Centre France S.A) in the course of development of the JPEG2000 - * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This - * software module is an implementation of a part of the JPEG 2000 - * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio - * Systems AB and Canon Research Centre France S.A (collectively JJ2000 - * Partners) agree not to assert against ISO/IEC and users of the JPEG - * 2000 Standard (Users) any of their rights under the copyright, not - * including other intellectual property rights, for this software module - * with respect to the usage by ISO/IEC and Users of this software module - * or modifications thereof for use in hardware or software products - * claiming conformance to the JPEG 2000 Standard. Those intending to use - * this software module in hardware or software products are advised that - * their use may infringe existing patents. The original developers of - * this software module, JJ2000 Partners and ISO/IEC assume no liability - * for use of this software module or modifications thereof. No license - * or right to this software module is granted for non JPEG 2000 Standard - * conforming products. JJ2000 Partners have full right to use this - * software module for his/her own purpose, assign or donate this - * software module to any third party and to inhibit third parties from - * using this software module for non JPEG 2000 Standard conforming - * products. This copyright notice must be included in all copies or - * derivative works of this software module. - * - * Copyright (c) 1999/2000 JJ2000 Partners. - * */ -package CSJ2K.j2k.decoder; - -import CSJ2K.j2k.quantization.dequantizer.*; -import CSJ2K.j2k.image.invcomptransf.*; -import CSJ2K.j2k.fileformat.reader.*; -import CSJ2K.j2k.codestream.reader.*; -import CSJ2K.j2k.wavelet.synthesis.*; -import CSJ2K.j2k.entropy.decoder.*; -import CSJ2K.j2k.image.output.*; -import CSJ2K.j2k.codestream.*; -import CSJ2K.j2k.image.*; -import CSJ2K.j2k.util.*; -import CSJ2K.j2k.roi.*; -import CSJ2K.j2k.io.*; -import CSJ2K.disp.*; -import CSJ2K.j2k.*; - -import CSJ2K.Color.*; -import CSJ2K.Icc.*; - -import java.awt.image.*; -import java.awt.event.*; -import java.util.*; -import java.awt.*; -import java.net.*; -import java.io.*; - -/** - * This class is the main class of JJ2000's decoder. It instantiates all - * objects and performs the decoding operations. It then writes the image to - * the output file or displays it. - * - *

First the decoder should be initialized with a ParameterList object - * given through the constructor. The when the run() method is invoked and the - * decoder executes. The exit code of the class can be obtained with the - * getExitCode() method, after the constructor and after the run method. A - * non-zero value indicates that an error has ocurred.

- * - *

The decoding chain corresponds to the following sequence of modules:

- * - * - * - *

The 2 last modules cannot be used at the same time and corresponds - * respectively to the writing of decoded image into a file or the graphical - * display of this same image.

- * - *

The behaviour of each module may be modified according to the current - * tile-component. All the specifications are kept in modules extending - * ModuleSpec and accessible through an instance of DecoderSpecs class.

- * - * @see BitstreamReaderAgent - * @see EntropyDecoder - * @see ROIDeScaler - * @see Dequantizer - * @see InverseWT - * @see ImgDataConverter - * @see InvCompTransf - * @see ImgWriter - * @see BlkImgDataSrcImageProducer - * @see ModuleSpec - * @see DecoderSpecs - * */ -public class Decoder implements Runnable -{ - - /** Parses the inputstream to analyze the box structure of the JP2 - * file. */ - private ColorSpace csMap = null; - - /** Reference to the TitleUpdater instance. Only used when decoded image - * is displayed */ - TitleUpdater title = null; - - /** False if the Decoder instance is self-contained process, false if - * thrown by another process (i.e by a GUI)*/ - private boolean isChildProcess = false; - - /** The exit code of the run method */ - private int exitCode; - - /** The parameter list (arguments) */ - private ParameterList pl; - - /** Information contained in the codestream's headers */ - private HeaderInfo hi; - - /** The default parameter list (arguments) */ - private ParameterList defpl; - - /** The valid list of options prefixes */ - private final static char vprfxs[] = {BitstreamReaderAgent.OPT_PREFIX, - EntropyDecoder.OPT_PREFIX, - ROIDeScaler.OPT_PREFIX, - Dequantizer.OPT_PREFIX, - InvCompTransf.OPT_PREFIX, - HeaderDecoder.OPT_PREFIX, - ColorSpaceMapper.OPT_PREFIX - }; - - /** Frame used to display decoded image */ - private Frame win = null; - - /** The component where the image is to be displayed */ - private ImgScrollPane isp; - - /** The parameter information for this class */ - private final static String[][] pinfo = { - { "u", "[on|off]", - "Prints usage information. "+ - "If specified all other arguments (except 'v') are ignored","off"}, - { "v", "[on|off]", - "Prints version and copyright information","off"}, - { "verbose", "[on|off]", - "Prints information about the decoded codestream","on"}, - { "pfile", "", - "Loads the arguments from the specified file. Arguments that are "+ - "specified on the command line override the ones from the file.\n"+ - "The arguments file is a simple text file with one argument per "+ - "line of the following form:\n" + - " =\n"+ - "If the argument is of boolean type (i.e. its presence turns a "+ - "feature on), then the 'on' value turns it on, while the 'off' "+ - "value turns it off. The argument name does not include the '-' "+ - "or '+' character. Long lines can be broken into several lines "+ - "by terminating them with '\\'. Lines starting with '#' are "+ - "considered as comments. This option is not recursive: any 'pfile' "+ - "argument appearing in the file is ignored.",null}, - { "res", "", - "The resolution level at which to reconstruct the image "+ - " (0 means the lowest available resolution whereas the maximum "+ - "resolution level corresponds to the original image resolution). "+ - "If the given index"+ - " is greater than the number of available resolution levels of the "+ - "compressed image, the image is reconstructed at its highest "+ - "resolution (among all tile-components). Note that this option"+ - " affects only the inverse wavelet transform and not the number "+ - " of bytes read by the codestream parser: this number of bytes "+ - "depends only on options '-nbytes' or '-rate'.", null}, - { "i", "", - "The file containing the JPEG 2000 compressed data. This can be "+ - "either a JPEG 2000 codestream or a JP2 file containing a "+ - "JPEG 2000 "+ - "codestream. In the latter case the first codestream in the file "+ - "will be decoded. If an URL is specified (e.g., http://...) "+ - "the data will be downloaded and cached in memory before decoding. "+ - "This is intended for easy use in applets, but it is not a very "+ - "efficient way of decoding network served data.", null}, - { "o", "", - "This is the name of the file to which the decompressed image "+ - "is written. If no output filename is given, the image is "+ - "displayed on the screen. "+ - "Output file format is PGX by default. If the extension"+ - " is '.pgm' then a PGM file is written as output, however this is "+ - "only permitted if the component bitdepth does not exceed 8. If "+ - "the extension is '.ppm' then a PPM file is written, however this "+ - "is only permitted if there are 3 components and none of them has "+ - "a bitdepth of more than 8. If there is more than 1 component, "+ - "suffices '-1', '-2', '-3', ... are added to the file name, just "+ - "before the extension, except for PPM files where all three "+ - "components are written to the same file.",null}, - { "rate","", - "Specifies the decoding rate in bits per pixel (bpp) where the "+ - "number of pixels is related to the image's original size (Note:"+ - " this number is not affected by the '-res' option). If it is equal"+ - "to -1, the whole codestream is decoded. "+ - "The codestream is either parsed (default) or truncated depending "+ - "the command line option '-parsing'. To specify the decoding "+ - "rate in bytes, use '-nbytes' options instead.","-1"}, - { "nbytes","", - "Specifies the decoding rate in bytes. "+ - "The codestream is either parsed (default) or truncated depending "+ - "the command line option '-parsing'. To specify the decoding "+ - "rate in bits per pixel, use '-rate' options instead.","-1"}, - { "parsing", null, - "Enable or not the parsing mode when decoding rate is specified "+ - "('-nbytes' or '-rate' options). If it is false, the codestream "+ - "is decoded as if it were truncated to the given rate. If it is "+ - "true, the decoder creates, truncates and decodes a virtual layer"+ - " progressive codestream with the same truncation points in each "+ - "code-block.","on"}, - { "ncb_quit","", - "Use the ncb and lbody quit conditions. If state information is "+ - "found for more code blocks than is indicated with this option, "+ - "the decoder "+ - "will decode using only information found before that point. "+ - "Using this otion implies that the 'rate' or 'nbyte' parameter "+ - "is used to indicate the lbody parameter which is the number of "+ - "packet body bytes the decoder will decode.","-1"}, - { "l_quit","", - "Specifies the maximum number of layers to decode for any code-"+ - "block","-1"}, - { "m_quit","", - "Specifies the maximum number of bit planes to decode for any code"+ - "-block","-1"}, - { "poc_quit",null, - "Specifies the whether the decoder should only decode code-blocks "+ - "included in the first progression order.","off"}, - { "one_tp",null, - "Specifies whether the decoder should only decode the first "+ - "tile part of each tile.","off"}, - { "comp_transf",null, - "Specifies whether the component transform indicated in the "+ - "codestream should be used.","on"}, - { "debug", null, - "Print debugging messages when an error is encountered.","off"}, - { "cdstr_info", null, - "Display information about the codestream. This information is: "+ - "\n- Marker segments value in main and tile-part headers,"+ - "\n- Tile-part length and position within the code-stream.", "off"}, - { "nocolorspace",null, - "Ignore any colorspace information in the image.","off"}, - { "colorspace_debug", null, - "Print debugging messages when an error is encountered in the"+ - " colorspace module.","off"} - }; - - /** - * Instantiates a decoder object, with the ParameterList object given as - * argument and a component where to display the image if no output file - * is specified. It also retrieves the default ParameterList. - * - * @param pl The ParameterList for this decoder (contains also defaults - * values). - * - * @param isp The component where the image is to be displayed if not - * output file is specified. If null a new frame will be created to - * display the image. - * */ - public Decoder(ParameterList pl, ImgScrollPane isp) - { - this.pl = pl; - defpl = pl; // pl.getDefaultParameterList(); - this.isp = isp; - } - - /** - * Instantiates a decoder object, with the ParameterList object given as - * argument. It also retrieves the default ParameterList. - * - * @param pl The ParameterList for this decoder (contains also defaults - * values). - * */ - public Decoder(ParameterList pl) - { - this(pl, null); - } - - /** - * Returns the exit code of the class. This is only initialized after the - * constructor and when the run method returns. - * - * @return The exit code of the constructor and the run() method. - * */ - public int getExitCode() - { - return exitCode; - } - - /** - * Returns the parameters that are used in this class. It returns a 2D - * String array. Each of the 1D arrays is for a different option, and they - * have 3 elements. The first element is the option name, the second one - * is the synopsis and the third one is a long description of what the - * parameter is. The synopsis or description may be 'null', in which case - * it is assumed that there is no synopsis or description of the option, - * respectively. - * - * @return the options name, their synopsis and their explanation. - * */ - public static String[][] getParameterInfo() - { - return pinfo; - } - - /** - * Runs the decoder. After completion the exit code is set, a non-zero - * value indicates that an error ocurred. - * - * @see #getExitCode - * */ - public void run() - { - boolean verbose; - int res; // resolution level to reconstruct - String infile; - RandomAccessIO in; - FileFormatReader ff; - String - outfile = "", - outbase = "", - outext = ""; - String out[] = null; - BitstreamReaderAgent breader; - HeaderDecoder hd; - EntropyDecoder entdec; - ROIDeScaler roids; - Dequantizer deq; - InverseWT invWT; - InvCompTransf ictransf; - ImgWriter imwriter[] = null; - ImgDataConverter converter; - DecoderSpecs decSpec = null; - BlkImgDataSrc palettized; - BlkImgDataSrc channels; - BlkImgDataSrc resampled; - BlkImgDataSrc color; - int i; - int depth[]; - //float rate; - //int nbytes; - boolean disp = false; - Image img = null; - Dimension winDim, scrnDim; - Insets ins = null; - String btitle = ""; - - try - { - - // **** Usage and version **** - try - { - // Do we print version information? - if (pl.getBooleanParameter("v")) - { - printVersionAndCopyright(); - } - // Do we print usage information? - if (pl.getParameter("u").equals("on")) - { - printUsage(); - return; // When printing usage => exit - } - // Do we print info ? - verbose = pl.getBooleanParameter("verbose"); - } - catch (StringFormatException e) - { - error("An error occured while parsing the arguments:\n" + - e.get_Message(), 1); - if (pl.getParameter("debug").equals("on")) - { - error(e.get_StackTrace(), 2); //printStackTrace(); - } - else - { - error("Use '-debug' option for more details", 2); - } - return; - } - catch (NumberFormatException e) - { - error("An error occured while parsing the arguments:\n" + - e.getMessage(), 1); - if (pl.getParameter("debug").equals("on")) - { - e.printStackTrace(); - } - else - { - error("Use '-debug' option for more details", 2); - } - return; - } - - // **** Check parameters **** - try - { - pl.checkList(vprfxs, pl.toNameArray(pinfo)); - } - catch (IllegalArgumentException e) - { - error(e.getMessage(), 2); - if (pl.getParameter("debug").equals("on")) - { - e.printStackTrace(); - } - else - { - error("Use '-debug' option for more details", 2); - } - return; - } - - // Get input file - infile = pl.getParameter("i"); - if (infile == null) - { - error("Input file ('-i' option) has not been specified", 1); - return; - } - - // Get output files - outfile = pl.getParameter("o"); - if (outfile == null) - { - disp = true; - } - else if (outfile.lastIndexOf('.') != -1) - { - outext = outfile.substring(outfile.lastIndexOf('.'), - outfile.length()); - outbase = outfile.substring(0, outfile.lastIndexOf('.')); - } - else - { - outbase = outfile; - outext = ".pgx"; - } - - // **** Open input files **** - // Creates a BEBufferedRandomAccessFile of a ISRandomAccessIO - // instance for reading the file format and codestream data - // HTTP disabled - /* - if (infile.indexOf("/") >= 1 && infile.charAt(infile.indexOf("/") - 1) == ':') - { // an URL - URL inurl; - URLConnection conn; - int datalen; - InputStream is; - - try - { - inurl = new URL(infile); - } - catch (MalformedURLException e) - { - error("Malformed URL for input file " + infile, 4); - if (pl.getParameter("debug").equals("on")) - { - e.printStackTrace(); - } - else - { - error("Use '-debug' option for more details", 2); - } - return; - } - try - { - conn = inurl.openConnection(); - conn.connect(); - } - catch (IOException e) - { - error("Cannot open connection to " + infile + - ((e.getMessage() != null) ? - (":\n" + e.getMessage()) : ""), 4); - if (pl.getParameter("debug").equals("on")) - { - e.printStackTrace(); - } - else - { - error("Use '-debug' option for more details", 2); - } - return; - } - datalen = conn.getContentLength(); - try - { - is = conn.getInputStream(); - } - catch (IOException e) - { - error("Cannot get data from connection to " + infile + - ((e.getMessage() != null) ? - (":\n" + e.getMessage()) : ""), 4); - if (pl.getParameter("debug").equals("on")) - { - e.printStackTrace(); - } - else - { - error("Use '-debug' option for more details", 2); - } - return; - } - if (datalen != -1) - { // known length => initialize to length - in = new ISRandomAccessIO(is, datalen, 1, datalen); - } - else - { // unknown length => use defaults - in = new ISRandomAccessIO(is); - } - // HACK: to verify if the URL is valid try to read some data - try - { - in.read(); - in.seek(0); - } - catch (IOException e) - { - error("Cannot get input data from " + infile + - " Invalid URL?", 4); - if (pl.getParameter("debug").equals("on")) - { - e.printStackTrace(); - } - else - { - error("Use '-debug' option for more details", 2); - } - return; - } - } - else - */ - { // a normal file - try - { - in = new BEBufferedRandomAccessFile(infile, "r"); - } - catch (System.IO.IOException e) - { - error("Cannot open input file " + - ((e.get_Message() != null) ? - (":\n" + e.get_Message()) : ""), 4); - if (pl.getParameter("debug").equals("on")) - { - error(e.get_StackTrace(), 2); - //e.printStackTrace(); - } - else - { - error("Use '-debug' option for more details", 2); - } - return; - } - } - - // **** File Format **** - // If the codestream is wrapped in the jp2 fileformat, Read the - // file format wrapper - ff = new FileFormatReader(in); - ff.readFileFormat(); - if (ff.JP2FFUsed) - { - in.seek(ff.get_FirstCodeStreamPos()); - } - - // +----------------------------+ - // | Instantiate decoding chain | - // +----------------------------+ - - // **** Header decoder **** - // Instantiate header decoder and read main header - hi = new HeaderInfo(); - try - { - hd = new HeaderDecoder(in, pl, hi); - } - catch (System.IO.EndOfStreamException e) - { - error("Codestream too short or bad header, " + - "unable to decode.", 2); - if (pl.getParameter("debug").equals("on")) - { - error(e.get_StackTrace(), 2); - } - else - { - error("Use '-debug' option for more details", 2); - } - return; - } - - int nCompCod = hd.get_NumComps(); - int nTiles = hi.sizValue.get_NumTiles(); - decSpec = hd.get_DecoderSpecs(); - - // Report information - if (verbose) - { - String info = nCompCod + " component(s) in codestream, " + nTiles + - " tile(s)\n"; - info += "Image dimension: "; - for (int c = 0; c < nCompCod; c++) - { - info += hi.sizValue.getCompImgWidth(c) + "x" + - hi.sizValue.getCompImgHeight(c) + " "; - } - - if (nTiles != 1) - { - info += "\nNom. Tile dim. (in canvas): " + - hi.sizValue.xtsiz + "x" + hi.sizValue.ytsiz; - } - FacilityManager.getMsgLogger().printmsg(MsgLogger_Fields.INFO, info); - } - if (pl.getBooleanParameter("cdstr_info")) - { - FacilityManager.getMsgLogger().printmsg(MsgLogger_Fields.INFO, - "Main header:\n" + hi. - toStringMainHeader()); - } - - // Get demixed bitdepths - depth = new int[nCompCod]; - for (i = 0; i < nCompCod; i++) { depth[i] = hd.getOriginalBitDepth(i); } - - // **** Bit stream reader **** - try - { - breader = BitstreamReaderAgent. - createInstance(in, hd, pl, decSpec, - pl.getBooleanParameter("cdstr_info"), hi); - } - catch (System.IO.IOException e) - { - error("Error while reading bit stream header or parsing " + - "packets" + ((e.get_Message() != null) ? - (":\n" + e.get_Message()) : ""), 4); - if (pl.getParameter("debug").equals("on")) - { - error(e.get_StackTrace(), 2); // e.printStackTrace(); - } - else - { - error("Use '-debug' option for more details", 2); - } - return; - } - catch (IllegalArgumentException e) - { - error("Cannot instantiate bit stream reader" + - ((e.getMessage() != null) ? - (":\n" + e.getMessage()) : ""), 2); - if (pl.getParameter("debug").equals("on")) - { - e.printStackTrace(); - } - else - { - error("Use '-debug' option for more details", 2); - } - return; - } - - // **** Entropy decoder **** - try - { - entdec = hd.createEntropyDecoder(breader, pl); - } - catch (IllegalArgumentException e) - { - error("Cannot instantiate entropy decoder" + - ((e.getMessage() != null) ? - (":\n" + e.getMessage()) : ""), 2); - if (pl.getParameter("debug").equals("on")) - { - e.printStackTrace(); - } - else - { - error("Use '-debug' option for more details", 2); - } - return; - } - - // **** ROI de-scaler **** - try - { - roids = hd.createROIDeScaler(entdec, pl, decSpec); - } - catch (IllegalArgumentException e) - { - error("Cannot instantiate roi de-scaler." + - ((e.getMessage() != null) ? - (":\n" + e.getMessage()) : ""), 2); - if (pl.getParameter("debug").equals("on")) - { - e.printStackTrace(); - } - else - { - error("Use '-debug' option for more details", 2); - } - return; - } - - // **** Dequantizer **** - try - { - deq = hd.createDequantizer(roids, depth, decSpec); - } - catch (IllegalArgumentException e) - { - error("Cannot instantiate dequantizer" + - ((e.getMessage() != null) ? - (":\n" + e.getMessage()) : ""), 2); - if (pl.getParameter("debug").equals("on")) - { - e.printStackTrace(); - } - else - { - error("Use '-debug' option for more details", 2); - } - return; - } - - // **** Inverse wavelet transform *** - try - { - // full page inverse wavelet transform - invWT = InverseWT.createInstance(deq, decSpec); - } - catch (IllegalArgumentException e) - { - error("Cannot instantiate inverse wavelet transform" + - ((e.getMessage() != null) ? - (":\n" + e.getMessage()) : ""), 2); - if (pl.getParameter("debug").equals("on")) - { - e.printStackTrace(); - } - else - { - error("Use '-debug' option for more details", 2); - } - return; - } - - res = breader.get_ImgRes(); - invWT.set_ImgResLevel(res); - - // **** Data converter **** (after inverse transform module) - converter = new ImgDataConverter(invWT, 0); - - // **** Inverse component transformation **** - ictransf = new InvCompTransf(converter, decSpec, depth, pl); - - // **** Color space mapping **** - if (ff.JP2FFUsed && pl.getParameter("nocolorspace").equals("off")) - { - try - { - csMap = new ColorSpace(in, hd, pl); - channels = hd. - createChannelDefinitionMapper(ictransf, csMap); - resampled = hd.createResampler(channels, csMap); - palettized = hd. - createPalettizedColorSpaceMapper(resampled, csMap); - color = hd.createColorSpaceMapper(palettized, csMap); - - if (csMap.debugging()) - { - FacilityManager.getMsgLogger(). - printmsg(MsgLogger_Fields.ERROR, "" + csMap); - FacilityManager.getMsgLogger(). - printmsg(MsgLogger_Fields.ERROR, "" + channels); - FacilityManager.getMsgLogger(). - printmsg(MsgLogger_Fields.ERROR, "" + resampled); - FacilityManager.getMsgLogger(). - printmsg(MsgLogger_Fields.ERROR, "" + palettized); - FacilityManager.getMsgLogger(). - printmsg(MsgLogger_Fields.ERROR, "" + color); - } - } - catch (IllegalArgumentException e) - { - error("Could not instantiate ICC profiler" + - ((e.getMessage() != null) ? - (":\n" + e.getMessage()) : ""), 1, e); - return; - } - catch (ColorSpaceException e) - { - error("error processing jp2 colorspace information" + - ((e.get_Message() != null) ? - (": " + e.get_Message()) : " "), 1); - return; - } - } - else - { // Skip colorspace mapping - color = ictransf; - } - - // This is the last image in the decoding chain and should be - // assigned by the last transformation: - BlkImgDataSrc decodedImage = color; - if (color == null) - { - decodedImage = ictransf; - } - int nCompImg = decodedImage.get_NumComps(); - - // **** Create image writers/image display **** - if (disp) - { // No output file has been specified. Display - // decoded image - - // Set up the display elements - - btitle = "JJ2000: " + (new File(infile)).getName() + " " + - decodedImage.get_ImgWidth() + "x" + decodedImage.get_ImgHeight(); - if (isp == null) - { - win = new Frame(btitle + " @ (0,0) : 1"); - win.setBackground(Color.white); - win.addWindowListener(new ExitHandler(this)); - isp = new ImgScrollPane(ImgScrollPane. - SCROLLBARS_AS_NEEDED); - win.add(isp, BorderLayout.CENTER); - isp.addKeyListener(new ImgKeyListener(isp, this)); - // HACK to make it work under Windows: for some reason - // under JDK 1.1.x the event is delivered to the window - // and not to the ImgScrollPane. - win.addKeyListener(new ImgKeyListener(isp, this)); - // END HACK - } - else - { - win = null; - } - - // Get the window dimension to use, do not use more - // than 8/10 of the screen size, in either dimension. - if (win != null) - { - win.addNotify(); // Instantiate peer to get insets - ins = win.getInsets(); - int subX = decodedImage.getCompSubsX(0); - int subY = decodedImage.getCompSubsY(0); - int w = (decodedImage.get_ImgWidth() + subX - 1) / subX; - int h = (decodedImage.get_ImgHeight() + subY - 1) / subY; - winDim = new Dimension(w + ins.left + ins.right, - h + ins.top + ins.bottom); - scrnDim = win.getToolkit().getScreenSize(); - if (winDim.width > scrnDim.width * 8 / 10f) - { - // Width too large for screen - winDim.width = (int)(scrnDim.width * 8 / 10f); - } - if (winDim.height > scrnDim.height * 8 / 10f) - { - // Height too large for screen - winDim.height = (int)(scrnDim.height * 8 / 10f); - } - win.setSize(winDim); - win.validate(); - win.setVisible(true); - // Start the title updater - Thread tu; - title = new TitleUpdater(isp, win, btitle); - tu = new Thread(title); - tu.start(); - } - else - { - title = null; - } - } - else - { // Write decoded image to specified output file - - // Create output file names - if (csMap != null) - { - if (outext.equalsIgnoreCase(".PPM") && - (nCompImg != 3 || decodedImage.getNomRangeBits(0) > 8 || - decodedImage.getNomRangeBits(1) > 8 || - decodedImage.getNomRangeBits(2) > 8 || - csMap.isOutputSigned(0) || csMap.isOutputSigned(1) || - csMap.isOutputSigned(2))) - { - error("Specified PPM output file but compressed image" + - " is not of the correct format for PPM or " + - "limited decoded components to less than 3.", 1); - return; - } - } - else - { - if (outext.equalsIgnoreCase(".PPM") && - (nCompImg != 3 || decodedImage.getNomRangeBits(0) > 8 || - decodedImage.getNomRangeBits(1) > 8 || - decodedImage.getNomRangeBits(2) > 8 || - hd.isOriginalSigned(0) || hd.isOriginalSigned(1) || - hd.isOriginalSigned(2))) - { - error("Specified PPM output file but compressed image" + - " is not of the correct format for PPM or " + - "limited decoded components to less than 3.", 1); - return; - } - } - out = new String[nCompImg]; - // initiate all strings to keep compiler happy - for (i = 0; i < nCompImg; i++) - { - out[i] = ""; - } - if (nCompImg > 1 && - !outext.equalsIgnoreCase(".PPM")) - { // Multiple file output - // files - // If PGM verify bitdepth and if signed - if (outext.equalsIgnoreCase(".PGM")) - { - for (i = 0; i < nCompImg; i++) - { - if (csMap != null) - { - if (csMap.isOutputSigned(i)) - { - error("Specified PGM output file but " + - "compressed image is not of the " + - "correct " + - "format for PGM.", 1); - return; - } - } - else - { - if (hd.isOriginalSigned(i)) - { - error("Specified PGM output file but " + - "compressed image is not of the " + - "correct " + - "format for PGM.", 1); - return; - } - } - } - } - // Open multiple output files - for (i = 0; i < nCompImg; i++) - { - out[i] = outbase + "-" + (i + 1) + outext; - } - } - else - { // Single output file - out[0] = outbase + outext; - } - // Now get the image writers - if (outext.equalsIgnoreCase(".PPM")) - { - imwriter = new ImgWriter[1]; - try - { - imwriter[0] = new ImgWriterPPM(out[0], decodedImage, - 0, 1, 2); - } - catch (System.IO.IOException e) - { - error("Cannot write PPM header or open output file" - + i + ((e.get_Message() != null) ? - (":\n" + e.get_Message()) : ""), 2); - if (pl.getParameter("debug").equals("on")) - { - error(e.get_StackTrace(), 2); // e.printStackTrace(); - } - else - { - error("Use '-debug' option for more details", 2); - } - return; - } - } - else - { // PGX or PGM - imwriter = new ImgWriter[nCompImg]; - } - - // If 3 (originally) unsigned components with depths less than - // 8 bits and a component transformation is used in at least - // one tile, ImgWriterPPM is better than ImgWriterPGM (the - // image is entirely decoded 3 times). - if (csMap != null) - { - if (imwriter.length == 3 && - decodedImage.getNomRangeBits(0) <= 8 && - decodedImage.getNomRangeBits(1) <= 8 && - decodedImage.getNomRangeBits(2) <= 8 && - !csMap.isOutputSigned(0) && !csMap.isOutputSigned(1) - && !csMap.isOutputSigned(2) && - decSpec.cts.get_CompTransfUsed()) - { - warning("JJ2000 is quicker with one PPM output " + - "file than with 3 PGM/PGX output files when a" + - " component transformation is applied."); - } - } - else - { - if (imwriter.length == 3 && - decodedImage.getNomRangeBits(0) <= 8 && - decodedImage.getNomRangeBits(1) <= 8 && - decodedImage.getNomRangeBits(2) <= 8 && - !hd.isOriginalSigned(0) && !hd.isOriginalSigned(1) - && !hd.isOriginalSigned(2) && - decSpec.cts.get_CompTransfUsed()) - { - warning("JJ2000 is quicker with one PPM output " + - "file than with 3 PGM/PGX output files when a" + - " component transformation is applied."); - } - } - } - - // **** Report info **** - int mrl = decSpec.dls.get_Min(); - if (verbose) - { - if (mrl != res) - { - FacilityManager.getMsgLogger(). - println("Reconstructing resolution " + res + " on " + - mrl + " (" + breader.getImgWidth(res) + "x" + - breader.getImgHeight(res) + ")", 8, 8); - } - if (pl.getFloatParameter("rate") != -1) - { - FacilityManager.getMsgLogger(). - println("Target rate = " + breader.get_TargetRate() + - " bpp (" + - breader.get_TargetNbytes() + " bytes)", 8, 8); - } - } - - // **** Decode and write/display result **** - if (disp) - { - // Now create the image and decode. Use a low priority for - // this so as not to block other threads. - Thread.currentThread().setPriority(Thread.MIN_PRIORITY + 1); - img = BlkImgDataSrcImageProducer.createImage(decodedImage, isp); - isp.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - // HACK for JDK 1.1.x under Windows - if (win != null) - { - win.setCursor(Cursor. - getPredefinedCursor(Cursor.WAIT_CURSOR)); - } - // END HACK - isp.setImage(img); - isp.setCursor(Cursor. - getPredefinedCursor(Cursor.DEFAULT_CURSOR)); - // HACK for JDK 1.1.x under Windows - if (win != null) - { - win.setCursor(Cursor. - getPredefinedCursor(Cursor.DEFAULT_CURSOR)); - } - // END HACK - - // Check the image status, every 100ms, until it is finished. - if (win != null) - { - int status; - do - { - status = isp.checkImage(img, null); - if ((status & ImageObserver.ERROR) != 0) - { - FacilityManager.getMsgLogger(). - printmsg(MsgLogger_Fields.ERROR, - "An unknown error occurred while " + - "producing the image"); - return; - } - else if ((status & ImageObserver.ABORT) != 0) - { - FacilityManager.getMsgLogger(). - printmsg(MsgLogger_Fields.ERROR, - "Image production was aborted for " + - "some unknown reason"); - } - else if ((status & ImageObserver.ALLBITS) != 0) - { - ImgMouseListener iml = new ImgMouseListener(isp); - isp.addMouseListener(iml); - isp.addMouseMotionListener(iml); - } - else - { // Check again in 100 ms - try - { - Thread.currentThread().sleep(100); - } - catch (InterruptedException e) { } - } - } while ((status & - (ImageObserver.ALLBITS | ImageObserver.ABORT | - ImageObserver.ERROR)) == 0); - } - } - else - { - // Need to optimize! If no component mixer is used and PGM - // files are written need to write blocks in parallel - // (otherwise decodes 3 times) - - // Now write the image to the file (decodes as needed) - for (i = 0; i < imwriter.length; i++) - { - if (outext.equalsIgnoreCase(".PGM")) - { - try - { - imwriter[i] = new ImgWriterPGM(out[i], decodedImage, - i); - } - catch (System.IO.IOException e) - { - error("Cannot write PGM header or open output " + - "file for component " - + i + ((e.get_Message() != null) ? - (":\n" + e.get_Message()) : ""), 2); - if (pl.getParameter("debug").equals("on")) - { - error(e.get_StackTrace(), 2); // e.printStackTrace(); - } - else - { - error("Use '-debug' option for more " + - "details", 2); - } - return; - } - } - else if (outext.equalsIgnoreCase(".PGX")) - { - // Not PGM and not PPM means PGX used - try - { - if (csMap != null) - { - imwriter[i] = - new ImgWriterPGX(out[i], decodedImage, i, - csMap.isOutputSigned(i)); - } - else - { - imwriter[i] = - new ImgWriterPGX(out[i], decodedImage, i, - hd.isOriginalSigned(i)); - } - } - catch (System.IO.IOException e) - { - error("Cannot write PGX header or open output " + - "file for component " - + i + ((e.get_Message() != null) ? - (":\n" + e.get_Message()) : ""), 2); - if (pl.getParameter("debug").equals("on")) - { - error(e.get_StackTrace(), 2); // e.printStackTrace(); - } - else - { - error("Use '-debug' option for more " + - "details", 2); - } - return; - } - } - - try - { - imwriter[i].writeAll(); - } - catch (System.IO.IOException e) - { - error("I/O error while writing output file" + - ((e.get_Message() != null) ? - (":\n" + e.get_Message()) : ""), 2); - if (pl.getParameter("debug").equals("on")) - { - error(e.get_StackTrace(), 2); // e.printStackTrace(); - } - else - { - error("Use '-debug' option for more details", 2); - } - return; - } - try - { - imwriter[i].close(); - } - catch (System.IO.IOException e) - { - error("I/O error while closing output file (data may " + - "be corrupted" + ((e.get_Message() != null) ? - (":\n" + e.get_Message()) : ""), - 2); - if (pl.getParameter("debug").equals("on")) - { - error(e.get_StackTrace(), 2); // e.printStackTrace(); - } - else - { - error("Use '-debug' option for more details", 2); - } - return; - } - } - } - - // **** Print some resulting info **** - if (verbose) - { - // Print actually read bitrate - // if file format used add the read file format bytes - float bitrate = breader.get_ActualRate(); - int numBytes = breader.get_ActualNbytes(); - if (ff.JP2FFUsed) - { - int imageSize = (int)((8.0f * numBytes) / bitrate); - numBytes += ff.get_FirstCodeStreamPos(); - bitrate = (numBytes * 8.0f) / imageSize; - } - - if (pl.getIntParameter("ncb_quit") == -1) - { - FacilityManager.getMsgLogger(). - println("Actual bitrate = " + bitrate + - " bpp (i.e. " + numBytes + " bytes)", 8, 8); - } - else - { - FacilityManager.getMsgLogger(). - println("Number of packet body bytes read = " + numBytes, - 8, 8); - } - FacilityManager.getMsgLogger().flush(); - } - - } - catch (IllegalArgumentException e) - { - error(e.getMessage(), 2); - if (pl.getParameter("debug").equals("on")) - e.printStackTrace(); - return; - } - catch (Error e) - { - if (e.getMessage() != null) - { - error(e.getMessage(), 2); - } - else - { - error("An error has occured during decoding.", 2); - } - - if (pl.getParameter("debug").equals("on")) - { - e.printStackTrace(); - } - else - { - error("Use '-debug' option for more details", 2); - } - return; - } - catch (RuntimeException e) - { - if (e.getMessage() != null) - { - error("An uncaught runtime exception has occurred:\n" + - e.getMessage(), 2); - } - else - { - error("An uncaught runtime exception has occurred.", 2); - } - if (pl.getParameter("debug").equals("on")) - { - e.printStackTrace(); - } - else - { - error("Use '-debug' option for more details", 2); - } - return; - } - catch (Throwable e) - { - error("An uncaught exception has occurred.", 2); - if (pl.getParameter("debug").equals("on")) - { - e.printStackTrace(); - } - else - { - error("Use '-debug' option for more details", 2); - } - return; - } - } - - /** - * Prints the error message 'msg' to standard err, prepending "ERROR" to - * it, and sets the exitCode to 'code'. An exit code different than 0 - * indicates that there where problems. - * - * @param msg The error message - * - * @param code The exit code to set - * */ - private void error(String msg, int code) - { - exitCode = code; - FacilityManager.getMsgLogger().printmsg(MsgLogger_Fields.ERROR, msg); - } - - /** - * Prints the error message 'msg' to standard err, prepending - * "ERROR" to it, and sets the exitCode to 'code'. An exit code - * different than 0 indicates that there where problems. Either - * the stacktrace or a "details" message is output depending on - * the data of the "debug" parameter. - * - * @param msg The error message - * - * @param code The exit code to set - * - * @param ex The exception associated with the call - * */ - private void error(String msg, int code, Throwable ex) - { - exitCode = code; - FacilityManager.getMsgLogger().printmsg(MsgLogger_Fields.ERROR, msg); - if (pl.getParameter("debug").equals("on")) - { - ex.printStackTrace(); - } - else - { - error("Use '-debug' option for more details", 2); - } - } - - /** - * Return the information found in the COM marker segments encountered in - * the decoded codestream. - * - public String[] getCOMInfo() - { - if (hi == null) - { // The codestream has not been read yet - return null; - } - - int nCOMMarkers = hi.get_NumCOM(); - System.Collections.ICollection com = hi.com.GetEnumerator(); // elements(); - com. - String[] infoCOM = new String[nCOMMarkers]; - for (int i = 0; i < nCOMMarkers; i++) - { - infoCOM[i] = com - } - return infoCOM; - } - */ - /** - * Returns all the parameters used in the decoding chain. It calls - * parameter from each module and store them in one array (one row per - * parameter and 4 columns). - * - * @return All decoding parameters - * - * @see #getParameterInfo - * */ - public static String[][] getAllParameters() - { - Vector vec = new Vector(); - int i; - - String[][] str = BitstreamReaderAgent.get_ParameterInfo(); - if (str != null) for (i = str.length - 1; i >= 0; i--) vec.addElement(str[i]); - - str = EntropyDecoder.get_ParameterInfo(); - if (str != null) for (i = str.length - 1; i >= 0; i--) vec.addElement(str[i]); - - str = ROIDeScaler.get_ParameterInfo(); - if (str != null) for (i = str.length - 1; i >= 0; i--) vec.addElement(str[i]); - - str = Dequantizer.get_ParameterInfo(); - if (str != null) for (i = str.length - 1; i >= 0; i--) vec.addElement(str[i]); - - str = InvCompTransf.get_ParameterInfo(); - if (str != null) for (i = str.length - 1; i >= 0; i--) vec.addElement(str[i]); - - str = HeaderDecoder.get_ParameterInfo(); - if (str != null) for (i = str.length - 1; i >= 0; i--) vec.addElement(str[i]); - - str = ICCProfiler.get_ParameterInfo(); - if (str != null) for (i = str.length - 1; i >= 0; i--) vec.addElement(str[i]); - - str = getParameterInfo(); - if (str != null) for (i = str.length - 1; i >= 0; i--) vec.addElement(str[i]); - - str = new String[vec.size()][4]; - if (str != null) for (i = str.length - 1; i >= 0; i--) - str[i] = (String[])vec.elementAt(i); - - return str; - } - - /** - * Prints the warning message 'msg' to standard err, prepending "WARNING" - * to it. - * - * @param msg The error message - * */ - private void warning(String msg) - { - FacilityManager.getMsgLogger().printmsg(MsgLogger_Fields.WARNING, msg); - } - - /** - * Prints version and copyright information to the logging facility - * returned by FacilityManager.getMsgLogger() - * */ - private void printVersionAndCopyright() - { - FacilityManager.getMsgLogger() - .println("JJ2000's JPEG 2000 Decoder\n", 2, 4); - FacilityManager.getMsgLogger() - .println("Version: " + JJ2KInfo.version + "\n", 2, 4); - FacilityManager.getMsgLogger() - .println("Copyright:\n\n" + JJ2KInfo.copyright + "\n", 2, 4); - FacilityManager.getMsgLogger(). - println("Send bug reports to: " + JJ2KInfo.bugaddr + "\n", 2, 4); - } - - /** - * Prints the usage information to stdout. The usage information is - * written for all modules in the decoder. - * */ - private void printUsage() - { - //String opts[][]; - //int i; - MsgLogger ml = FacilityManager.getMsgLogger(); - - ml.println("Usage:", 0, 0); - ml.println("JJ2KDecoder args...\n", 10, 12); - ml.println("The exit code of the decoder is non-zero " + - "if an error occurs.", 2, 4); - ml.println("The following arguments are recongnized:\n", 2, 4); - - // Print decoding options - printParamInfo(ml, getAllParameters()); - - // Print bug-report address - FacilityManager.getMsgLogger().println("\n\n", 0, 0); - FacilityManager.getMsgLogger(). - println("Send bug reports to: " + JJ2KInfo.bugaddr + "\n", 2, 4); - } - - /** - * Prints the parameters in 'pinfo' to the provided output, 'out', showing - * the existing defaults. The message is printed to the logging facility - * returned by FacilityManager.getMsgLogger(). The 'pinfo' argument is a - * 2D String array. The first dimension contains String arrays, 1 for each - * parameter. Each of these arrays has 3 elements, the first element is - * the parameter name, the second element is the synopsis for the - * parameter and the third one is a long description of the parameter. If - * the synopsis or description is 'null' then no synopsis or description - * is printed, respectively. If there is a default value for a parameter - * it is also printed. - * - * @param out Where to print. - * - * @param pinfo The parameter information to write. - * */ - private void printParamInfo(MsgLogger out, String pinfo[][]) - { - String defval; - - for (int i = 0; i < pinfo.length; i++) - { - defval = defpl.getParameter(pinfo[i][0]); - if (defval != null) - { // There is a default value - out.println("-" + pinfo[i][0] + - ((pinfo[i][1] != null) ? " " + pinfo[i][1] + " " : " ") + - "(default = " + defval + ")", 4, 8); - } - else - { // There is no default value - out.println("-" + pinfo[i][0] + - ((pinfo[i][1] != null) ? " " + pinfo[i][1] : ""), 4, 8); - } - // Is there an explanatory message? - if (pinfo[i][2] != null) - { - out.println(pinfo[i][2], 6, 6); - } - } - } - - /** - * Exit the decoding process according to the isChildProcess variable - **/ - public void exit() - { - if (isChildProcess) - { - if (win != null) - win.dispose(); - if (title != null) - title.done = true; - return; - } - else - { - System.exit(0); - } - } - - /** - * Set isChildProcess variable. - * - * @param b The boolean value - * */ - public void setChildProcess(boolean b) - { - isChildProcess = b; - } -} diff --git a/CSJ2K/jj2kdecoder/Properties/AssemblyInfo.jsl b/CSJ2K/jj2kdecoder/Properties/AssemblyInfo.jsl deleted file mode 100644 index 8d5a4f96..00000000 --- a/CSJ2K/jj2kdecoder/Properties/AssemblyInfo.jsl +++ /dev/null @@ -1,36 +0,0 @@ -import System.Reflection.*; -import System.Runtime.CompilerServices.*; -import System.Runtime.InteropServices.*; - -// -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -// - -/** @assembly AssemblyTitle("j2kdecode") */ -/** @assembly AssemblyDescription("") */ -/** @assembly AssemblyCompany("") */ -/** @assembly AssemblyProduct("j2kdecode") */ -/** @assembly AssemblyCopyright("Copyright © 2007") */ -/** @assembly AssemblyTrademark("") */ -/** @assembly AssemblyCulture("") */ - - -// The ComVisible attribute controls accessibility of an individual type -// or member, or of all types within this assembly, from COM. To access -// a type or member in this assembly from COM, set the ComVisible attribute -// on that type or member to true. -/** @assembly ComVisible(false) */ - - -// -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// - -/** @assembly AssemblyVersion("1.0.0.0") */ diff --git a/CSJ2K/jj2kdecoder/SimpleAppletDecoder.jsl b/CSJ2K/jj2kdecoder/SimpleAppletDecoder.jsl deleted file mode 100644 index 632e4ca2..00000000 --- a/CSJ2K/jj2kdecoder/SimpleAppletDecoder.jsl +++ /dev/null @@ -1,249 +0,0 @@ -/* - * CVS identifier: - * - * $Id: SimpleAppletDecoder.java,v 1.2 2000/12/04 17:22:04 grosbois Exp $ - * - * Class: SimpleAppletDecoder - * - * Description: A very simple applet that embeds a decoder in a - * web page. - * - * - * - * COPYRIGHT: - * - * This software module was originally developed by Raphaël Grosbois and - * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel - * Askelöf (Ericsson Radio Systems AB); and Bertrand Berthelot, David - * Bouchard, Félix Henry, Gerard Mozelle and Patrice Onno (Canon Research - * Centre France S.A) in the course of development of the JPEG2000 - * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This - * software module is an implementation of a part of the JPEG 2000 - * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio - * Systems AB and Canon Research Centre France S.A (collectively JJ2000 - * Partners) agree not to assert against ISO/IEC and users of the JPEG - * 2000 Standard (Users) any of their rights under the copyright, not - * including other intellectual property rights, for this software module - * with respect to the usage by ISO/IEC and Users of this software module - * or modifications thereof for use in hardware or software products - * claiming conformance to the JPEG 2000 Standard. Those intending to use - * this software module in hardware or software products are advised that - * their use may infringe existing patents. The original developers of - * this software module, JJ2000 Partners and ISO/IEC assume no liability - * for use of this software module or modifications thereof. No license - * or right to this software module is granted for non JPEG 2000 Standard - * conforming products. JJ2000 Partners have full right to use this - * software module for his/her own purpose, assign or donate this - * software module to any third party and to inhibit third parties from - * using this software module for non JPEG 2000 Standard conforming - * products. This copyright notice must be included in all copies or - * derivative works of this software module. - * - * Copyright (c) 1999/2000 JJ2000 Partners. - * */ -package CSJ2K.j2k.decoder; - -import CSJ2K.j2k.util.*; -import CSJ2K.j2k.*; -import CSJ2K.disp.*; - -import java.applet.*; -import java.awt.*; -import java.awt.image.*; -import java.net.*; - -/** - * This applet implements a simple mean to embed the JJ2000 decoder in an HTML - * page. The applet accepts all the parameters of the JJ2000 decoder, except - * output files. The image is downloaded, decoded and shown in the applet - * area. Scrollbars appear if the image is larger than the applet area. - * - *

An example use could be:

- * - * <applet code="CSJ2K.j2k.decoder.SimpleAppletDecoder.class"
- *  archive="jj2000-aplt.jar"
- *  width="512" height="512">
- *    <param name="i" value="tools.jp2">
- *    <param name="res" value"3">
- * </applet>

- * - * */ -public class SimpleAppletDecoder extends Applet implements Runnable { - - /** The parameter info, with all possible options. */ - private static String pinfo[][] = Decoder.getAllParameters(); - - /** The decoder */ - private Decoder dec; - - /** The parameter list to give to the decoder */ - private ParameterList pl; - - /** The thread where the decoder is run */ - private Thread decThread; - - /** If the decoder thread has already been started */ - private boolean decStarted; - - /** Where the image is displayed */ - private ImgScrollPane isp; - - /** - * Initializes the applet. It reads the parameters and creates the decoder - * thread. - * */ - public void init() { - ParameterList defpl; - String param; - int i; - URL input; - - // Get the dfault parameter values - defpl = new ParameterList(); - for (i=pinfo.length-1; i>=0; i--) { - if(pinfo[i][3]!=null) - defpl.Set(pinfo[i][0], pinfo[i][3]); //defpl.put(pinfo[i][0], pinfo[i][3]); - } - - // Get all parameters from and put them in a parameter list - pl = new ParameterList(defpl); - for (i=0; i nothing to do - decStarted = true; - decThread.start(); - } - - /** - * Does nothing, since the decoder thread can not be stopped. - * */ - public void stop() { - // Nothing we can do, we can not stop the decoding thread - } - - /** - * Waits for the decoder thread to end and sets it to null. - * */ - public void destroy() { - if (!decStarted) return; - while (decThread != null && decThread.isAlive()) { - try { - Thread.currentThread().sleep(100); - } catch (InterruptedException e) { - } - } - decThread = null; - } - - /** - * The run method for the decoding thread. Instantiates the decoder, runs - * it and updates the status message. - * */ - public void run() { - ImgMouseListener iml; - Image img; - int status; - - if (dec != null) return; // already running a decoder! - showStatus("Initializing JJ2000 decoder..."); - // Create and start the decoder - dec = new Decoder(pl,isp); - dec.setChildProcess(true); - showStatus("Decoding..."); - dec.run(); - // Check decoding status - img = isp.getImage(); - do { - status = isp.checkImage(img,null); - if ((status & ImageObserver.ERROR) != 0) { - showStatus("An unknown error occurred while "+ - "producing the image"); - return; - } - else if ((status & ImageObserver.ABORT) != 0) { - showStatus("Image production was aborted for "+ - "some unknown reason"); - } - else if ((status & ImageObserver.ALLBITS) != 0) { - showStatus("Done."); - } - else { // Check again in 100 ms - try { - Thread.currentThread().sleep(100); - } catch (InterruptedException e) { - } - } - } while ((status & - (ImageObserver.ALLBITS| - ImageObserver.ABORT| - ImageObserver.ERROR)) == 0); - // Bind mouse and key event handlers - if ((status & ImageObserver.ERROR) == 0) { - iml = new ImgMouseListener(isp); - isp.addKeyListener(new ImgKeyListener(isp,dec)); - isp.addMouseListener(iml); - isp.addMouseMotionListener(iml); - } - } - - /** - * Returns the applet information (version, copyright, etc.) - * - * @return A multi-line string containing the applet name, version, - * copyright and bug reporting address. - * */ - public String getAppletInfo() { - return "JJ2000's JPEG 2000 simple applet decoder\n"+ - "Version: "+JJ2KInfo.version+"\n"+ - "Copyright:\n\n"+JJ2KInfo.copyright+"\n"+ - "Send bug reports to: "+JJ2KInfo.bugaddr+"\n"; - } - - /** - * Returns the applet parameter information. See Applet class. - * - * @see Applet#getParameterInfo - * */ - public String[][] getParameterInfo() { - return pinfo; - } -} diff --git a/CSJ2K/jj2kdecoder/disp/BlkImgDataSrcImageProducer.jsl b/CSJ2K/jj2kdecoder/disp/BlkImgDataSrcImageProducer.jsl deleted file mode 100644 index 61c62d32..00000000 --- a/CSJ2K/jj2kdecoder/disp/BlkImgDataSrcImageProducer.jsl +++ /dev/null @@ -1,510 +0,0 @@ -/* - * CVS identifier: - * - * $Id: BlkImgDataSrcImageProducer.java,v 1.19 2002/08/08 14:08:42 grosbois Exp $ - * - * Class: BlkImgDataSrcImageProducer - * - * Description: Creates an Java AWT ImapeProducer from a - * BlkImgDataSrc - * - * - * - * COPYRIGHT: - * - * This software module was originally developed by Raphaël Grosbois and - * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel - * Askelöf (Ericsson Radio Systems AB); and Bertrand Berthelot, David - * Bouchard, Félix Henry, Gerard Mozelle and Patrice Onno (Canon Research - * Centre France S.A) in the course of development of the JPEG2000 - * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This - * software module is an implementation of a part of the JPEG 2000 - * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio - * Systems AB and Canon Research Centre France S.A (collectively JJ2000 - * Partners) agree not to assert against ISO/IEC and users of the JPEG - * 2000 Standard (Users) any of their rights under the copyright, not - * including other intellectual property rights, for this software module - * with respect to the usage by ISO/IEC and Users of this software module - * or modifications thereof for use in hardware or software products - * claiming conformance to the JPEG 2000 Standard. Those intending to use - * this software module in hardware or software products are advised that - * their use may infringe existing patents. The original developers of - * this software module, JJ2000 Partners and ISO/IEC assume no liability - * for use of this software module or modifications thereof. No license - * or right to this software module is granted for non JPEG 2000 Standard - * conforming products. JJ2000 Partners have full right to use this - * software module for his/her own purpose, assign or donate this - * software module to any third party and to inhibit third parties from - * using this software module for non JPEG 2000 Standard conforming - * products. This copyright notice must be included in all copies or - * derivative works of this software module. - * - * Copyright (c) 1999/2000 JJ2000 Partners. - * */ -package CSJ2K.disp; - -import CSJ2K.j2k.image.*; -import CSJ2K.j2k.util.*; -import CSJ2K.j2k.*; - -import java.awt.image.*; -import java.util.*; -import java.awt.*; - -/** - * This class provides an ImageProducer for the BlkImgDataSrc interface. It - * will request data from the BlkImgDataSrc source and deliver it to the - * registered image consumers. The data is requested line by line, starting at - * the top of each tile. The tiles are requested in raster-scan order. - * - *

The image data is not rescaled to fit the available dynamic range (not - * even the alpha values for RGBA data).

- * - *

BlkImgDataSrc sources with 1, 3 and 4 components are supported. If 1, it - * is assumed to be gray-level data. If 3 it is assumed to be RGB data, in - * that order. If 4 it is assumed to be RGBA data (RGB plus alpha plane), in - * that order. All components must have the same size.

- * - * @see ImageProducer - * @see BlkImgDataSrc - * */ -public class BlkImgDataSrcImageProducer implements ImageProducer { - - /** The list of image consumers for this image producer */ - private volatile Vector consumers; - - /** The source of image data */ - private BlkImgDataSrc src; - - /** The type of image: GRAY, RGB or RGBA */ - private int type; - - /** The gray-level image type (256 levels). For this type the source of - * image data must have only 1 component. */ - private static final int GRAY = 0; - - /** The color image type (24 bits RGB). No alpha plane. For this type the - * source of image data must have 3 components, which are considered to be - * R, G and B, in that order */ - private static final int RGB = 1; - - /** The color image type (32 bits RGBA). For this type the source of image - * data must have 4 components, which are considered to be R, G, B and A, - * in that order. */ - private static final int RGBA = 2; - - /** The default color model (0xAARRGGBB) used in Java */ - private static final ColorModel cm = ColorModel.getRGBdefault(); - - /** - * Creates an image producer which uses 'src' as the source of image - * data. If 'once' is true then the image is produced only once. - * - * @param src The source of image data. - * - * @param once If the image is to be produced only once or not. - * */ - public BlkImgDataSrcImageProducer(BlkImgDataSrc src) { - int i; - - // Check for image type - switch (src.get_NumComps()) { - case 1: - type = GRAY; - break; - case 3: - type = RGB; - break; - case 4: - type = RGBA; - break; - default: - throw new IllegalArgumentException("Only 1, 3, and 4 components "+ - "supported"); - } - // Check component sizes and bit depths - int imh = src.getCompImgHeight(0); - int imw = src.getCompImgWidth(0); - for(i=src.get_NumComps()-1; i>=0; i--) { - if(src.getCompImgHeight(i) != imh || - src.getCompImgWidth(i) != imw) { - throw new IllegalArgumentException("All components must have "+ - "the same dimensions and "+ - "no subsampling"); - } - if(src.getNomRangeBits(i)>8) { - throw new IllegalArgumentException("Depths greater than 8 "+ - "bits per component is "+ - "not supported"); - } - } - this.src = src; - consumers = new Vector(); - } - - /** - * Returns an Image object given an BlkImgDataSrc source. It will use a - * new J2KImageProducer object as the underlying image producer. - * - *

This method uses the JVM default Toolkit, which might not be what it - * is desired.

- * - * @param src The source of image data. - * - * @return An image which has a J2KImageProducer object as the underlying - * image producer. - * */ - public static Image createImage(BlkImgDataSrc src) { - // Use the system toolkit's createImage method - return Toolkit.getDefaultToolkit(). - createImage(new BlkImgDataSrcImageProducer(src)); - } - - /** - * Returns an Image object given an BlkImgDataSrc source. It will use a - * new J2KImageProducer object as the underlying image producer. - * - *

This method uses the component's toolkit. The toolkit of a component - * may change if it is moved from one frame to another one, since it is - * the frame that controls which toolkit is used.

- * - * @param src The source of image data. - * - * @param c The component to use to generate the 'Image' object from the - * 'ImageProducer'. - * - * @return An image which has a J2KImageProducer object as the underlying - * image producer. - * */ - public static Image createImage(BlkImgDataSrc src, Component c){ - // Use the component's toolkit createImage method - return c.getToolkit(). - createImage(new BlkImgDataSrcImageProducer(src)); - } - - /** - * Registers an image consumer with this image producer. The delivery of - * image data does not start immediately. It will only start after the - * next call to the startProduction() method. - * - * @param ic The image consumer to which image data has to be delivered. - * - * @see #startProduction - * */ - public final synchronized void addConsumer(ImageConsumer ic) { - if (ic != null && !consumers.contains(ic)) { - consumers.addElement(ic); - } - } - - /** - * This method determines if the given image consumer, 'ic', is registered - * with this image producer. - * - * @param ic The image consumer to test. - * - * @return True if 'ic' is registered with this image producer, false - * otherwise. - * */ - public boolean isConsumer(ImageConsumer ic) { - return consumers.contains(ic); - } - - /** - * Removes the given image consumer 'ic' from the list of consumers - * registered with this producer. This image producer will stop sending - * pixel data to 'ic' as soon as it is feasible. The method call is - * ignored if 'ic' has not been registered with this image producer. - * - * @param ic The image consumer to be removed - * */ - public synchronized void removeConsumer(ImageConsumer ic) { - consumers.removeElement(ic); - } - - /** - * Registers the given ImageConsumer object as a consumer and starts an - * immediate reconstruction of the image data which will then be delivered - * to this consumer and any other consumer which may have already been - * registered with the producer. - * - *

Delivery is performed in "parallel" to all the registered image - * consumers. By "parallel" it is meant that each line of the image is - * delivered to all consumers before delivering the next line.

- * - *

If the data returned by the BlkImgDataSrc source happens to be - * progressive (see BlkImgDataSrc and DataBlk) then the abort condition is - * sent to the image consumers and no further data is delivered.

- * - *

Once all the data is sent to a consumer this one is automatically - * removed from the list of registered ones, unless an abort happens.

- * - *

To start the BlkImgDataSrc is set to tile (0,0), and the tiles are - * produced in raster sacn order. Once the last tile is produced, - * setTile(0,0) is called again, which signals that we are done with the - * current tile, which might free up resources.

- * - * @param ic The image consumer to register - * */ - public void startProduction(ImageConsumer ic) { - int i,k1,k2,k3,k4,l; // counters - int tmp1,tmp2,tmp3,tmp4; // temporary storage for sample values - int mv1=0,mv2,mv3,mv4; // max value for each component - int ls1=0,ls2,ls3,ls4; // level shift for each component - int fb1=0,fb2,fb3,fb4; // fractional bits for each component - int[] data1,data2,data3,data4; // references to data buffers - final ImageConsumer[] cons; // image consumers cache - int hints; // hints to image consumers - int height; // image height - int width; // image width - int pixbuf[]; // line buffer for pixel data - DataBlkInt db1,db2,db3,db4; // data-blocks to request data from src - int tOffx, tOffy; // Active tile offset - boolean prog; // Flag for progressive data - Coord nT = src.getNumTiles(null); - int tIdx = 0; // index of the current tile - - // Register ic - if (ic != null) { - addConsumer(ic); - } - - // Set the cache for the consumers - synchronized (this) { - // synchronized to avoid addition or deletion of consumers while - // copying them to cache - cons = new ImageConsumer[consumers.size()]; - consumers.copyInto(cons); - } - - if(src == null) { - // We cant't render with no source - for (i=cons.length-1; i>=0; i--) { - cons[i].imageComplete(ImageConsumer.IMAGEERROR); - } - return; // can not continue processing - } - - // Initialize - pixbuf = null; // to keep compiler happy - ls2 = fb2 = mv2 = 0; // to keep compiler happy - ls3 = fb3 = mv3 = 0; // to keep compiler happy - ls4 = fb4 = mv4 = 0; // to keep compiler happy - db1 = db2 = db3 = db4 = null; // to keep compiler happy - switch (type) { - case RGBA: - db4 = new DataBlkInt(); // Alpha plane - ls4 = 1<<(src.getNomRangeBits(3)-1); - mv4 = (1<=0; i--) { - cons[i].setColorModel(cm); - cons[i].setDimensions(src.getCompImgWidth(0), - src.getCompImgHeight(0)); - cons[i].setHints(hints); - } - - // Start the data delivery to the cached consumers tile by tile - for(int y=0; y=0; i--) { - cons[i].imageComplete(ImageConsumer.IMAGEABORTED); - } - return; // can not continue processing - } - // Put pixel data in line buffer - switch (type) - { - case GRAY: - data1 = db1.data_array; - k1 = db1.offset + width - 1; - for (i = width - 1; i >= 0; i--) - { - tmp1 = (data1[k1--] >> fb1) + ls1; - tmp1 = (tmp1 < 0) ? 0 : - ((tmp1 > mv1) ? mv1 : tmp1); - pixbuf[i] = (0xFF << 24) | (tmp1 << 16) | (tmp1 << 8) | tmp1; - } - break; - case RGB: - data1 = db1.data_array; // red - data2 = db2.data_array; // green - data3 = db3.data_array; // blue - k1 = db1.offset + width - 1; - k2 = db2.offset + width - 1; - k3 = db3.offset + width - 1; - for (i = width - 1; i >= 0; i--) - { - tmp1 = (data1[k1--] >> fb1) + ls1; - tmp1 = (tmp1 < 0) ? 0 : - ((tmp1 > mv1) ? mv1 : tmp1); - tmp2 = (data2[k2--] >> fb2) + ls2; - tmp2 = (tmp2 < 0) ? 0 : - ((tmp2 > mv2) ? mv2 : tmp2); - tmp3 = (data3[k3--] >> fb3) + ls3; - tmp3 = (tmp3 < 0) ? 0 : - ((tmp3 > mv3) ? mv3 : tmp3); - pixbuf[i] = (0xFF << 24) | (tmp1 << 16) | (tmp2 << 8) | tmp3; - } - break; - case RGBA: - data1 = db1.data_array; // red - data2 = db2.data_array; // green - data3 = db3.data_array; // blue - data4 = db4.data_array; // alpha - k1 = db1.offset + width - 1; - k2 = db2.offset + width - 1; - k3 = db3.offset + width - 1; - k4 = db4.offset + width - 1; - for (i = width - 1; i >= 0; i--) - { - tmp1 = (data1[k1--] >> fb1) + ls1; - tmp1 = (tmp1 < 0) ? 0 : - ((tmp1 > mv1) ? mv1 : tmp1); - tmp2 = (data2[k2--] >> fb2) + ls2; - tmp2 = (tmp2 < 0) ? 0 : - ((tmp2 > mv2) ? mv2 : tmp2); - tmp3 = (data3[k3--] >> fb3) + ls3; - tmp3 = (tmp3 < 0) ? 0 : - ((tmp3 > mv3) ? mv3 : tmp3); - tmp4 = (data4[k4--] >> fb4) + ls4; - tmp4 = (tmp4 < 0) ? 0 : - ((tmp4 > mv4) ? mv4 : tmp4); - pixbuf[i] = (tmp4 << 24) | (tmp1 << 16) | (tmp2 << 8) | tmp3; - } - break; - default: - // stop the compiler from complaining. - break; - } - // Send the line data to the consumers - for (i=cons.length-1; i>=0; i--) { - cons[i].setPixels(tOffx,tOffy+l,width,1,cm,pixbuf, - 0,width); - } - } - } // End loop on horizontal tiles - } // End loop on vertical tiles - - // Signal that this frame is complete. This is so that display of the - // last tile occurs as soon as possible. When calling with - // STATICIMAGEDONE the ImageConsumer might do some cleanup that will - // take a considerable amount of time on large images, this is why we - // first signal the frame as done (even though there is only one). - for (i=cons.length-1; i>=0; i--) { - cons[i].imageComplete(ImageConsumer.SINGLEFRAMEDONE); - } - // Signal that image is complete - for (i=cons.length-1; i>=0; i--) { - cons[i].imageComplete(ImageConsumer.STATICIMAGEDONE); - } - // Remove the consumers since all the data has been sent - synchronized (this) { - for (i=cons.length-1; i>=0; i--) { - consumers.removeElement(cons[i]); - } - } - } - - /** - * Starts the delivery of pixel data in the top-down letf-right order to - * the image consumer 'ic'. The TOPDOWNLEFTRIGHT hint is set in the image - * consumer on delivery. - * - *

Currently this call is ignored (which is perfectly legal according - * to the ImageProducer interface specification).

- * - * @param ic The image consumer to which the data is sent in top-down, - * left-right order. - * */ - public void requestTopDownLeftRightResend(ImageConsumer ic) { } -} diff --git a/CSJ2K/jj2kdecoder/disp/ExitHandler.jsl b/CSJ2K/jj2kdecoder/disp/ExitHandler.jsl deleted file mode 100644 index 6d2033f2..00000000 --- a/CSJ2K/jj2kdecoder/disp/ExitHandler.jsl +++ /dev/null @@ -1,71 +0,0 @@ -/* - * CVS identifier: - * - * $Id: ExitHandler.java,v 1.6 2000/09/05 09:21:59 grosbois Exp $ - * - * Class: ExitHandler - * - * Description: Handles exiting from window close event - * - * - * - * COPYRIGHT: - * - * This software module was originally developed by Raphaël Grosbois and - * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel - * Askelöf (Ericsson Radio Systems AB); and Bertrand Berthelot, David - * Bouchard, Félix Henry, Gerard Mozelle and Patrice Onno (Canon Research - * Centre France S.A) in the course of development of the JPEG2000 - * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This - * software module is an implementation of a part of the JPEG 2000 - * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio - * Systems AB and Canon Research Centre France S.A (collectively JJ2000 - * Partners) agree not to assert against ISO/IEC and users of the JPEG - * 2000 Standard (Users) any of their rights under the copyright, not - * including other intellectual property rights, for this software module - * with respect to the usage by ISO/IEC and Users of this software module - * or modifications thereof for use in hardware or software products - * claiming conformance to the JPEG 2000 Standard. Those intending to use - * this software module in hardware or software products are advised that - * their use may infringe existing patents. The original developers of - * this software module, JJ2000 Partners and ISO/IEC assume no liability - * for use of this software module or modifications thereof. No license - * or right to this software module is granted for non JPEG 2000 Standard - * conforming products. JJ2000 Partners have full right to use this - * software module for his/her own purpose, assign or donate this - * software module to any third party and to inhibit third parties from - * using this software module for non JPEG 2000 Standard conforming - * products. This copyright notice must be included in all copies or - * derivative works of this software module. - * - * Copyright (c) 1999/2000 JJ2000 Partners. - * - * - * - */ -package CSJ2K.disp; - -import CSJ2K.j2k.decoder.*; - -import java.awt.event.*; -import java.awt.*; - - -/** This class implements the WindowHandler for the ImageFrames */ -public class ExitHandler extends WindowAdapter { - /** The decoder instance */ - private Decoder dec; - - /** - * Class constructor. Keep a reference to the decoder to properly - * exit when windowClosing method is called. */ - public ExitHandler(Decoder dec){ - this.dec = dec; - } - - - /** Close the window and exit the application */ - public void windowClosing(WindowEvent evt) { - dec.exit(); - } -} diff --git a/CSJ2K/jj2kdecoder/disp/ImgKeyListener.jsl b/CSJ2K/jj2kdecoder/disp/ImgKeyListener.jsl deleted file mode 100644 index a598cdbb..00000000 --- a/CSJ2K/jj2kdecoder/disp/ImgKeyListener.jsl +++ /dev/null @@ -1,274 +0,0 @@ -/* - * CVS identifier: - * - * $Id: ImgKeyListener.java,v 1.8 2000/09/21 16:12:41 dsanta Exp $ - * - * Class: ImgKeyListener - * - * Description: Handles the key events for zooming and scrolling - * an image displayed in an ImgScrollPane. - * - * - * - * COPYRIGHT: - * - * This software module was originally developed by Raphaël Grosbois and - * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel - * Askelöf (Ericsson Radio Systems AB); and Bertrand Berthelot, David - * Bouchard, Félix Henry, Gerard Mozelle and Patrice Onno (Canon Research - * Centre France S.A) in the course of development of the JPEG2000 - * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This - * software module is an implementation of a part of the JPEG 2000 - * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio - * Systems AB and Canon Research Centre France S.A (collectively JJ2000 - * Partners) agree not to assert against ISO/IEC and users of the JPEG - * 2000 Standard (Users) any of their rights under the copyright, not - * including other intellectual property rights, for this software module - * with respect to the usage by ISO/IEC and Users of this software module - * or modifications thereof for use in hardware or software products - * claiming conformance to the JPEG 2000 Standard. Those intending to use - * this software module in hardware or software products are advised that - * their use may infringe existing patents. The original developers of - * this software module, JJ2000 Partners and ISO/IEC assume no liability - * for use of this software module or modifications thereof. No license - * or right to this software module is granted for non JPEG 2000 Standard - * conforming products. JJ2000 Partners have full right to use this - * software module for his/her own purpose, assign or donate this - * software module to any third party and to inhibit third parties from - * using this software module for non JPEG 2000 Standard conforming - * products. This copyright notice must be included in all copies or - * derivative works of this software module. - * - * Copyright (c) 1999/2000 JJ2000 Partners. - * - * - * - */ -package CSJ2K.disp; - -import CSJ2K.j2k.decoder.*; - -import java.awt.event.*; -import java.awt.*; - -/** - * This class implements the listener for keyboard events for the JJ2000 - * decoder that displays in a ImgScrollPane. - * - *

The following key sequences are defined: - *
- * - : scroll image up
- * - : scroll image down
- * - : scroll image left
- * - : scroll image right
- * - : scroll image up by a vertical block increment
- * - : scroll image down by a vertical block increment
- * - 'Q' or 'q': exit the application
- * - '-': zoom out by 2
- * - '=' or '+': zoom in by 2
- * - '1': display at a zoom of 1
- * - 'Ctrl-C': exit the application
- * - *

The amount by which the arrows scroll the image is determined by the - * modifier keys. If the Ctrl key is held down, the block increment will be - * used, otherwise the unit increment will. If the Shift key is held down then - * the increment is multiplied by ACCEL_FACTOR. That is the Ctrl key selects - * between unit and block increments, while the Shift key selects between - * normal and accelerated mode. - * - * */ -public class ImgKeyListener extends KeyAdapter { - - /** Frame used to display tools */ - Frame helpFrame = null; - - /** The component where the image is displayed */ - ImgScrollPane isp; - - /** Decoder instance */ - Decoder dec; - - /** The acceleration factor when the shift key is pressed: 10 */ - public static final int ACCEL_FACTOR = 10; - - /** - * Instantiate a new ImgKeyListener that will work on the specified - * ImgScrollPane. - * - * @param isp The image scroll pane on which the actions should - * operate. - * - * @param dec The decoder instance - * */ - public ImgKeyListener(ImgScrollPane isp,Decoder dec) { - this.isp = isp; - this.dec = dec; - } - - /** - * Hanldes the keyPressed events. Normal keys are not treated here because - * some don't have a defined keycode (as incredible as it might seem!). - * - * @param evt The key event to process. - * */ - public void keyPressed(KeyEvent evt) { - Adjustable adj; - - // Do nothing if consumed - if (evt.isConsumed()) return; - - // Perform action based on key - switch (evt.getKeyCode()) { - case KeyEvent.VK_LEFT: // Move left - adj = isp.getHAdjustable(); - adj.setValue(adj.getValue()-calcIncrement(evt,adj)); - break; - case KeyEvent.VK_RIGHT: // Move right - adj = isp.getHAdjustable(); - adj.setValue(adj.getValue()+calcIncrement(evt,adj)); - break; - case KeyEvent.VK_UP: // Move up - adj = isp.getVAdjustable(); - adj.setValue(adj.getValue()-calcIncrement(evt,adj)); - break; - case KeyEvent.VK_DOWN: // Move down - adj = isp.getVAdjustable(); - adj.setValue(adj.getValue()+calcIncrement(evt,adj)); - break; - case KeyEvent.VK_PAGE_UP: // Move up by a page - adj = isp.getVAdjustable(); - adj.setValue(adj.getValue()-adj.getBlockIncrement()); - break; - case KeyEvent.VK_PAGE_DOWN: // Move down by a page - adj = isp.getVAdjustable(); - adj.setValue(adj.getValue()+adj.getBlockIncrement()); - break; - case KeyEvent.VK_C: - // Exit if ctrl is pressed - if (evt.isControlDown()) { - dec.exit(); - } - break; - default: - return; - } - - // Consume the event so nothing else is done - evt.consume(); - } - - /** - * Handles the key typed event. Normal (i.e. "text") keys are handled - * here. - * - * @param evt The key event to process. - * */ - public void keyTyped(KeyEvent evt) { - - // Do nothing if consumed - if (evt.isConsumed()) return; - - // Perform action based on key - switch (evt.getKeyChar()) { - case '+': - case '=': - // Zoom in - isp.zoom(2f); - break; - case '-': - // Zoom out - isp.zoom(0.5f); - break; - case '1': - // Set zoom to 1 - isp.setZoom(1f); - break; - case 'q': - case 'Q': - // Exit - dec.exit(); - break; - case 'h': - case 'H': - // Help display - if(helpFrame==null){ - helpFrame = new Frame("Tools"); - helpFrame.add(getHelp()); - helpFrame.pack(); - helpFrame.setResizable(false); - helpFrame.addWindowListener(new WindowAdapter(){ - public void windowClosing(WindowEvent e){ - helpFrame.setVisible(false); - } - }); - } - if(helpFrame.isVisible()) - helpFrame.setVisible(false); - else - helpFrame.setVisible(true); - break; - default: - return; - } - - // Consume the event so nothing else is done - evt.consume(); - } - - /** - * Returns the increment based on the modifier keys of the KeyEvent. If - * control is down then the Adjustable block increment is used, otherwise - * the unit one is used. If the shift key is down the increment is - * multiplied by ACCEL_FACTOR. - * - * @param evt The KeyEvent fom where to obtain the modifiers - * - * @param adj The Adjustable from where to obtain the increments - * */ - private int calcIncrement(KeyEvent evt, Adjustable adj) { - int incr; - // Control selects block instead of unit - if (evt.isControlDown()) { - incr = adj.getBlockIncrement(); - } - else { - incr = adj.getUnitIncrement(); - } - // Shift accelerates by ACCEL_FACTOR - if (evt.isShiftDown()) { - incr *= ACCEL_FACTOR; - } - return incr; - } - - /** - * Create a help TextArea concerning the tools associated with keys. - * - * @return The help TextArea - * - */ - private static TextArea getHelp(){ - TextArea ta = new TextArea("",17,61,TextArea.SCROLLBARS_NONE); - ta.setEditable(false); - ta.setFont(new Font("Monospaced",Font.PLAIN,10)); - - ta.append("The following key sequences are recognized in the \n"+ - "image display window:\n\n"); - ta.append("'-' : zoom out by a factor of 2.\n"); - ta.append("'+' or '=' : zoom in by a factor of 2.\n"); - ta.append("'1' : set the zoom factor to 1 (i.e. no zoom).\n"); - ta.append(" : scroll the image up by one pixel.\n"); - ta.append(" : scroll the image down by one pixel.\n"); - ta.append(" : scroll the image left by one pixel.\n"); - ta.append(" : scroll the image right by one pixel.\n"); - ta.append(" : scroll the image up by a whole page.\n"); - ta.append(" : scroll the image down by a whole page.\n"); - ta.append("Ctrl+ : scroll in the direction of the arrow a \n"+ - " page at a time instead of a pixel at a time.\n"); - ta.append("Shift+ : accelerate the scroll speed by 10.\n"); - ta.append("'Q' or 'q' : exit the application.\n"); - ta.append("'Ctrl-C' : exit the application.\n"); - - return ta; - } -} diff --git a/CSJ2K/jj2kdecoder/disp/ImgMouseListener.jsl b/CSJ2K/jj2kdecoder/disp/ImgMouseListener.jsl deleted file mode 100644 index e18762c9..00000000 --- a/CSJ2K/jj2kdecoder/disp/ImgMouseListener.jsl +++ /dev/null @@ -1,129 +0,0 @@ -/* - * CVS identifier: - * - * $Id: ImgMouseListener.java,v 1.7 2000/09/21 16:12:42 dsanta Exp $ - * - * Class: ImgMouseListener - * - * Description: Handles the mouse events for scrolling an image - * displayed in an ImgScrollPane. - * - * - * - * COPYRIGHT: - * - * This software module was originally developed by Raphaël Grosbois and - * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel - * Askelöf (Ericsson Radio Systems AB); and Bertrand Berthelot, David - * Bouchard, Félix Henry, Gerard Mozelle and Patrice Onno (Canon Research - * Centre France S.A) in the course of development of the JPEG2000 - * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This - * software module is an implementation of a part of the JPEG 2000 - * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio - * Systems AB and Canon Research Centre France S.A (collectively JJ2000 - * Partners) agree not to assert against ISO/IEC and users of the JPEG - * 2000 Standard (Users) any of their rights under the copyright, not - * including other intellectual property rights, for this software module - * with respect to the usage by ISO/IEC and Users of this software module - * or modifications thereof for use in hardware or software products - * claiming conformance to the JPEG 2000 Standard. Those intending to use - * this software module in hardware or software products are advised that - * their use may infringe existing patents. The original developers of - * this software module, JJ2000 Partners and ISO/IEC assume no liability - * for use of this software module or modifications thereof. No license - * or right to this software module is granted for non JPEG 2000 Standard - * conforming products. JJ2000 Partners have full right to use this - * software module for his/her own purpose, assign or donate this - * software module to any third party and to inhibit third parties from - * using this software module for non JPEG 2000 Standard conforming - * products. This copyright notice must be included in all copies or - * derivative works of this software module. - * - * Copyright (c) 1999/2000 JJ2000 Partners. - * - * - * - */ -package CSJ2K.disp; - -import CSJ2K.j2k.decoder.*; - -import java.awt.event.*; -import java.awt.*; - -/** - * This class handles the dragging of an image displayed in an - * ImgScrollPane. When the mouse is dragged the image scrolls accordingly. - * - *

Objects of this class must be registerd as both mouse listener and mouse - * motion listener. - * - *

While the dragging is taking place the cursor is changed to the - * MOVE_CURSOR type. The original cursor is restored when the mouse is - * released after the drag. - * - * */ -public class ImgMouseListener extends MouseAdapter - implements MouseMotionListener { - /** The component where the image is displayed */ - ImgScrollPane isp; - - /** The horizontal coordinate where the drag starts */ - int startMouseX; - - /** The vertical coordinate where the drag starts */ - int startMouseY; - - /** The horizontal scroll position when the drag started */ - int startScrollX; - - /** The vertical scroll position when the drag started */ - int startScrollY; - - Cursor prevCursor; - - /** - * Instantiate a new ImgMouseListener that will work on the specified - * ImgScrollPane. - * - * @param isp The image scroll pane on which the actions should operate. - * */ - public ImgMouseListener(ImgScrollPane isp) { - this.isp = isp; - } - - public void mousePressed(MouseEvent e) { - // Get the possibly start drag position - startMouseX = e.getX(); - startMouseY = e.getY(); - // Get the start scroll position - startScrollX = isp.getHAdjustable().getValue(); - startScrollY = isp.getVAdjustable().getValue(); - } - - public void mouseReleased(MouseEvent e) { - // Restore the last cursor, if any - if (prevCursor != null) { - isp.setCursor(prevCursor); - prevCursor = null; - } - } - - public void mouseDragged(MouseEvent evt) { - int scrollX,scrollY; - - // Set the drag cursor - if (prevCursor == null) { - prevCursor = isp.getCursor(); - isp.setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); - } - - // Calculate new scroll position and set it - scrollX = startScrollX + startMouseX - evt.getX(); - scrollY = startScrollY + startMouseY - evt.getY(); - isp.setScrollPosition(scrollX,scrollY); - } - - public void mouseMoved(MouseEvent evt) { - } -} diff --git a/CSJ2K/jj2kdecoder/disp/ImgScrollPane.jsl b/CSJ2K/jj2kdecoder/disp/ImgScrollPane.jsl deleted file mode 100644 index 7c4dcb44..00000000 --- a/CSJ2K/jj2kdecoder/disp/ImgScrollPane.jsl +++ /dev/null @@ -1,1402 +0,0 @@ -/* - * CVS identifier: - * - * $Id: ImgScrollPane.java,v 1.10 2000/12/04 17:19:27 grosbois Exp $ - * - * Class: ImgScrollPane - * - * Description: - * - * - * - * COPYRIGHT: - * - * This software module was originally developed by Raphaël Grosbois and - * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel - * Askelöf (Ericsson Radio Systems AB); and Bertrand Berthelot, David - * Bouchard, Félix Henry, Gerard Mozelle and Patrice Onno (Canon Research - * Centre France S.A) in the course of development of the JPEG2000 - * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This - * software module is an implementation of a part of the JPEG 2000 - * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio - * Systems AB and Canon Research Centre France S.A (collectively JJ2000 - * Partners) agree not to assert against ISO/IEC and users of the JPEG - * 2000 Standard (Users) any of their rights under the copyright, not - * including other intellectual property rights, for this software module - * with respect to the usage by ISO/IEC and Users of this software module - * or modifications thereof for use in hardware or software products - * claiming conformance to the JPEG 2000 Standard. Those intending to use - * this software module in hardware or software products are advised that - * their use may infringe existing patents. The original developers of - * this software module, JJ2000 Partners and ISO/IEC assume no liability - * for use of this software module or modifications thereof. No license - * or right to this software module is granted for non JPEG 2000 Standard - * conforming products. JJ2000 Partners have full right to use this - * software module for his/her own purpose, assign or donate this - * software module to any third party and to inhibit third parties from - * using this software module for non JPEG 2000 Standard conforming - * products. This copyright notice must be included in all copies or - * derivative works of this software module. - * - * Copyright (c) 1999/2000 JJ2000 Partners. - * */ -package CSJ2K.disp; - -import java.awt.event.*; -import java.awt.image.*; -import java.awt.*; - -/** - * This class implements an image viewer that can display an image larger than - * the actual display area, and presents scrollbars to scroll the viewable - * area. This class also supports zooming in and out the image, with no extra - * memory requirements. - * - *

The zoom factor by default is 1. It can be changed with the 'zoom()' and - * 'setZoom()' methods. The maximum zoom factor is defined by MAX_ZOOM. - * - *

The zoom scaling is done directly by the AWT display system. In general - * it is performed by dropping or repeating lines. It is just intended to - * provide a display zoom and not for proper scaling of an image. - * - *

The scrolling can be performed by copying the actual displayed data to - * the new scrolled position and redrawing the damaged parts, or by redrawing - * the entire displayed image portion at the new scrolled position. Which is - * more efficient depends on the JVM and working environment. By default it is - * done by copying since it tends to provide less annoying visual artifacts - * while scrolling, but that can be changed with 'setCopyScroll()'. - * - *

This class is very similar to the AWT ScrollPane one, but it is - * optimized for display of large images and does not suffer from the problems - * of ScrollPane when changing zoom. The Adjustable elements that represent - * the scrollbars are made available as in ScrollPane, but the minimum, - * maximum, visible amount and block increment should not be set - * (IllegalArgumentException is thrown if attempted), since they are set - * internally by this class. - * - *

Focus and key event listeners that are registered are in fact registered - * with the components that implement the three areas (the image display and - * the two scrollbars) so that if any such event is fired in any of these - * areas it is handled by the registered listener. - * - *

Mouse and mouse movement event listeners that are registered are in fact - * registered with the image display component only. The mouse and mouse - * movement events on the scrollbars are handled by the Scrollbar default - * listeners only. - * - *

Although it is implemented as a container, it behaves like a - * component. Specifically no components can be added or removed from objects - * of this class. Furthermore, no layout manager can be set. It is internally - * set and it can not be changed. - * - *

The implementation uses a lightweight container with an inner class to - * display the image itself, and two scrollbars. The layout manager is a - * BorderLayout. - * - *

This class should be really implemented as a Component, but it is - * implemented as a Container for easyness. It should not be assumed it is a - * subclass of Container since in the future it might be rewritten as a - * subclass of Component only. - * - * - * @see ScrollPane - * - * @see Adjustable - * */ -public class ImgScrollPane extends Container { - - /** The ID for always visible scrollbars */ - public final static int SCROLLBARS_ALWAYS = ScrollPane.SCROLLBARS_ALWAYS; - - /** The ID for as needed visible scrollbars */ - public final static int SCROLLBARS_AS_NEEDED = - ScrollPane.SCROLLBARS_AS_NEEDED; - - /** The ID for never visible scrollbars */ - public final static int SCROLLBARS_NEVER = ScrollPane.SCROLLBARS_NEVER; - - /** The maximum possible zoom factor: 32. */ - // This is used because factors too large cause problems with JVMs. - public static final float MAX_ZOOM = 32f; - - /** The thickness of the scrollbars: 16 pixels */ - final static int SCROLLBAR_THICKNESS = 16; - - /** The inetrnal gap between the elements, in pixels: 0 */ - final static int INTERNAL_GAP = 0; - - /** The propertion between the visible scrollbar length and the block - * increment amount: 0.8 */ - final static float BLOCK_INCREMENT_PROPORTION = 0.8f; - - /** The horizontal scrollbar. - * - * @serial - */ - ISPScrollbar hsbar; - - /** The vertical scrollabr. - * - * @serial - */ - ISPScrollbar vsbar; - - /** The image display - * - * @serial - */ - private ImageScrollDisplay imgDisplay; - - /** The scrollbar type (always, as needed, etc.) - * - * @serial - */ - private int sbType; - - /** The zoom to use in displaying the image. A factor larger than one - * produces a zoom in effect. - * - * @serial - */ - private float zoom = 1f; - - /** The zoom used in the last scrollbar calculation. - * - * @serial - */ - private float lastZoom; - - /** The viewable size used in the last scrollbar calculation. - * - * @serial - */ - private Dimension lastSize; - - /** If scrolling is to be done by copying ot not. If not done by copying - * everything is redrawn. - * - * @serial*/ - private boolean copyScroll = true; - - /** - * Creates a new ImgScrollPane with SCROLLBARS_AS_NEEDED scrollbars. - * */ - public ImgScrollPane() { - this(SCROLLBARS_AS_NEEDED); - } - - /** - * Creates a new ImgScrollPane with the specified type of scrollbar - * visibility. - * - * @param svt The scrollbar visibility type - * */ - public ImgScrollPane(int svt) { - // Initialize - super.setLayout(new BorderLayout(INTERNAL_GAP,INTERNAL_GAP)); - sbType = svt; - hsbar = new ISPScrollbar(Scrollbar.HORIZONTAL,0,1,0,1); - vsbar = new ISPScrollbar(Scrollbar.VERTICAL,0,1,0,1); - imgDisplay = new ImageScrollDisplay(); - super.add(hsbar,BorderLayout.SOUTH); - super.add(vsbar,BorderLayout.EAST); - super.add(imgDisplay,BorderLayout.CENTER); - - // Set the initial scrollbar visibility - switch (svt) { - case SCROLLBARS_NEVER: - case SCROLLBARS_AS_NEEDED: - hsbar.setVisible(false); - vsbar.setVisible(false); - break; - case SCROLLBARS_ALWAYS: - hsbar.setVisible(true); - vsbar.setVisible(true); - break; - default: - throw new IllegalArgumentException(); - } - } - - /** - * Sets the image to display in this component. If the image is not - * ready for display it will be prepared in the current thread. The - * current zoom factor applies. - * - *

If the image is not ready for display (i.e. it has not been - * rendered at its natural size) it will be rendered in the current - * thread, if not being already rendered in another one. This means - * that the current thread can block until the image is ready. - * - *

If the image is rendered incrementally (it depends on the - * underlying 'ImageProducer') it will be displayed in that way if the - * incremental display is set for the Component class. See the - * 'imageUpdate()' method of the 'Component' class. - * - *

If the image is the same as the current one nothing is done. - * - * @param img The image to display. - * - * @see Component#imageUpdate - * */ - public void setImage(Image img) { - imgDisplay.setImage(img); - } - - /** - * Returns the image that is displayed in this component. - * - * @return The image displayed in this component, or null if none. - * */ - public synchronized Image getImage() { - return imgDisplay.img; - } - - /** - * Sets the zoom factor to display the image. A zoom factor larger than 1 - * corresponds to a zoom in. A factor of 1 corresponds to no - * scaling. After setting the zoom factor the component is invalidated and - * 'repaint()' is automatically called so that the image is redrawn at the - * new zoom factor. In order to revalidate the layout 'validate()' should - * be called on one of the parent containers. If the new zoom factor is - * larger than MAX_ZOOM, then MAX_ZOOM will be used. - * - * @param zf The zoom factor - * */ - public synchronized void setZoom(float zf) { - if (zf == zoom || (zf > MAX_ZOOM && zoom == MAX_ZOOM)) { - // No change => do nothing - return; - } - // Set the zoom factor and recalculate the component dimensions - zoom = zf; - if (zoom > MAX_ZOOM) zoom = MAX_ZOOM; - setScrollbars(); - // Check if we need to change the scrollbar display - if (sbType == SCROLLBARS_AS_NEEDED) doLayout(); - // We need to erase previous scaled image - imgDisplay.erase = true; - // Redraw image - imgDisplay.repaint(); - } - - /** - * Modifies the current zoom factor by the given multiplier. After setting - * the zoom factor the component is invalidated and 'repaint()' is - * automatically called so that the image is redrawn at the new zoom - * factor. In order to revalidate the layout 'validate()' should be called - * on one of the parent containers. If the resulting zoom factor is larger - * than MAX_ZOOM, then MAX_ZOOM will be used. - * - * @param zm The zoom multiplier to apply. - * */ - public synchronized void zoom(float zm) { - setZoom(zoom*zm); - } - - /** - * Returns the current zoom factor. - * - * @return The current zoom factor - * */ - public synchronized float getZoom() { - return zoom; - } - - /** - * Returns the Adjustable object which represents the state of the - * horizontal scrollbar. - * */ - public Adjustable getHAdjustable() { - return hsbar; - } - - /** - * Returns the Adjustable object which represents the state of the - * vertical scrollbar. - * */ - public Adjustable getVAdjustable() { - return vsbar; - } - - /** - * Returns the display policy for the scrollbars. - * - * @return the display policy for the scrollbars - * */ - public int getScrollbarDisplayPolicy() { - return sbType; - } - - /** - * Sets the display policy for the scrollbars. - * - * @param v the display policy for the scrollbars - * */ - public void setScrollbarDisplayPolicy(int v) { - // If no change do nothing - if (v == sbType) return; - switch (sbType) { - case SCROLLBARS_NEVER: - case SCROLLBARS_AS_NEEDED: - hsbar.setVisible(false); - vsbar.setVisible(false); - break; - case SCROLLBARS_ALWAYS: - hsbar.setVisible(true); - vsbar.setVisible(true); - break; - default: - throw new IllegalArgumentException(); - } - // Now redo the layout - doLayout(); - } - - /** - * Scrolls to the specified position within the image. Specifying a - * position outside of the legal scrolling bounds of the image will scroll - * to the closest legal position. This is a convenience method which - * interfaces with the Adjustable objects which represent the state of the - * scrollbars. - * - * @param x the x position to scroll to - * - * @param y the y position to scroll to - * */ - public synchronized void setScrollPosition(int x, int y) { - hsbar.setValueI(x); - vsbar.setValueI(y); - // Check if we need to repaint - x = hsbar.getValue(); // get the actual value for check - y = vsbar.getValue(); // get the actual value for check - if (imgDisplay.lastUpdateOffset != null && - imgDisplay.lastUpdateOffset.x == x && - imgDisplay.lastUpdateOffset.y == y) { - return; // No change - } - // New value changes from last drawn => repaint - imgDisplay.repaint(); - } - - /** - * Scrolls to the specified position within the image. Specifying a - * position outside of the legal scrolling bounds of the image will scroll - * to the closest legal position. This is a convenience method which - * interfaces with the Adjustable objects which represent the state of the - * scrollbars. - * - * @param p the position to scroll to - * */ - public synchronized void setScrollPosition(Point p) { - setScrollPosition(p.x,p.y); - } - - /** - * Returns the current x,y position within the child which is displayed at - * the 0,0 location of the scrolled panel's view port. This is a - * convenience method which interfaces with the adjustable objects which - * represent the state of the scrollbars. - * - * @return the coordinate position for the current scroll position - * */ - public Point getScrollPosition() { - return new Point(hsbar.getValue(),vsbar.getValue()); - } - - /** - * Returns the current size of the image scroll pane's view port. This is - * the size of the image display area. If this component has not been - * layed out yet the value is not defined. - * - * @return The size of the image display area - * */ - public Dimension getViewportSize() { - return imgDisplay.getSize(); - } - - /** - * Sets if the scrolling is to be done by copying and redrawing of damaged - * parts of the displayed image. Otherwise it is done by redrawing the - * entire displayed image. In general copy scrolling is faster and - * produces less annoying effects. See the class description. - * - * @param v If true scrolling will be done by copying. - * */ - public synchronized void setCopyScroll(boolean v) { - copyScroll = v; - } - - /** - * Returns true if the scrolling is done by copying. - * - * @return If the copy is done by scrolling - * */ - public synchronized boolean getCopyScroll() { - return copyScroll; - } - - /** - * Causes this container to lay out its components. Most programs should - * not call this method directly, but should invoke the validate method - * instead. - * */ - public synchronized void doLayout() { - // Let's see if we should include the scrollbars or not - if (sbType == SCROLLBARS_AS_NEEDED && imgDisplay.calcDim()) { - Dimension sz = getSize(); - Dimension imsz = imgDisplay.getPreferredSize(); - - if (sz.width>=imsz.width+2*INTERNAL_GAP) { - if (sz.height>=imsz.height+2*INTERNAL_GAP) { - // We don't need scrollbars - hsbar.setVisible(false); - vsbar.setVisible(false); - } - else { - // We need at least the vertical one, check again for the - // horizontal. - vsbar.setVisible(true); - if (sz.width >= - imsz.width+3*INTERNAL_GAP+SCROLLBAR_THICKNESS) { - hsbar.setVisible(false); - } - else { - hsbar.setVisible(true); - } - } - } - else { - // We need at least the horizontal, check for the vertical - // one. - hsbar.setVisible(true); - if (sz.height >= - imsz.height+3*INTERNAL_GAP+SCROLLBAR_THICKNESS) { - vsbar.setVisible(false); - } - else { - vsbar.setVisible(true); - } - } - } - // Indicate that we are erasing the image (the doLayout() will erase) - imgDisplay.erase = true; - // Now do the layout - super.doLayout(); - // Trick the lower scrollbar: if both scrollbars are showing then - // shorten the horizontal one so that the traditional empty square - // appears at the lower right corner. This is probably not the best - // solution but it works. - if (hsbar.isVisible() && vsbar.isVisible()) { - Rectangle b = hsbar.getBounds(); - if (b.width > SCROLLBAR_THICKNESS+INTERNAL_GAP) { - b.width -= SCROLLBAR_THICKNESS+INTERNAL_GAP; - } - hsbar.setBounds(b); - } - // We need to calculate the scrollbars with the possibly new size - setScrollbars(); - } - - /** - * Adds the specified focus listener to receive focus events from this - * component. It is added to the image and scrollbar areas. - * - * @param l the focus listener - * */ - public synchronized void addFocusListener(FocusListener l) { - super.addFocusListener(l); - imgDisplay.addFocusListener(l); - hsbar.addFocusListener(l); - vsbar.addFocusListener(l); - } - - /** - * Removes the specified focus listener so that it no longer receives - * focus events from this component. - * - * @param l the focus listener - * */ - public synchronized void removeFocusListener(FocusListener l) { - super.removeFocusListener(l); - imgDisplay.removeFocusListener(l); - hsbar.removeFocusListener(l); - vsbar.removeFocusListener(l); - } - - /** - * Adds the specified key listener to receive key events from this - * component. It is added to the image and scrollbar areas. - * - * @param l the key listener - * */ - public synchronized void addKeyListener(KeyListener l) { - super.addKeyListener(l); - imgDisplay.addKeyListener(l); - hsbar.addKeyListener(l); - vsbar.addKeyListener(l); - } - - /** - * Removes the specified key listener so that it no longer receives key - * events from this component. - * - * @param l the key listener - * */ - public synchronized void removeKeyListener(KeyListener l) { - super.removeKeyListener(l); - imgDisplay.removeKeyListener(l); - hsbar.removeKeyListener(l); - vsbar.removeKeyListener(l); - } - - /** - * Adds the specified mouse listener to receive mouse events from this - * component. It is actually added to the image area only and not to the - * scrollbar areas. - * - * @param l the mouse listener - * */ - public synchronized void addMouseListener(MouseListener l) { - super.addMouseListener(l); - imgDisplay.addMouseListener(l); - } - - /** - * Removes the specified mouse listener so that it no longer receives - * mouse events from this component. - * - * @param l the mouse listener - * */ - public synchronized void removeMouseListener(MouseListener l) { - super.removeMouseListener(l); - imgDisplay.removeMouseListener(l); - } - - /** - * Adds the specified mouse motion listener to receive mouse motion events - * from this component. It is actually added to the image area only and - * not to the scrollbar areas. - * - * @param l the mouse motion listener - * */ - public synchronized void addMouseMotionListener(MouseMotionListener l) { - super.addMouseMotionListener(l); - imgDisplay.addMouseMotionListener(l); - } - - /** - * Removes the specified mouse motion listener so that it no longer - * receives mouse motion events from this component. - * - * @param l the mouse motion listener - * */ - public synchronized void removeMouseMotionListener(MouseMotionListener l) { - super.removeMouseMotionListener(l); - imgDisplay.removeMouseMotionListener(l); - } - /** - * Sets the background color of this component. It sets the background of - * the 3 areas (image and scrollbars) plus the container itself. - * - * @param c The color to become background color for this component - * */ - public synchronized void setBackground(Color c) { - super.setBackground(c); - imgDisplay.setBackground(c); - hsbar.setBackground(c); - vsbar.setBackground(c); - } - - /** - * Set the cursor image to a predefined cursor. It sets the cursor of the - * image area and this container to the specified one. It does not set the - * cursor of the scrollbars. - * - * @param cursor One of the constants defined by the Cursor class. - * */ - public synchronized void setCursor(Cursor cursor) { - super.setCursor(cursor); - imgDisplay.setCursor(cursor); - } - - /** - * Enables or disables this component, depending on the value of the - * parameter b. An enabled component can respond to user input and - * generate events. Components are enabled initially by default. - * - * @param b If true, this component is enabled; otherwise this component - * is disabled. - * */ - public synchronized void setEnabled(boolean b) { - super.setEnabled(b); - imgDisplay.setEnabled(b); - hsbar.setEnabled(b); - vsbar.setEnabled(b); - } - - /** - * Sets the foreground color of this component. It sets the foreground of - * the 3 areas (image display and scrollbars) plus this contaioner's - * foreground. - * - * @param c The color to become this component's foreground color. - * */ - public synchronized void setForeground(Color c) { - super.setForeground(c); - imgDisplay.setForeground(c); - hsbar.setForeground(c); - vsbar.setForeground(c); - } - - /** - * Throws an IllegalArgumentException since no components can be added to - * this container. - * */ - public Component add(Component comp) { - throw new IllegalArgumentException(); - } - - /** - * Throws an IllegalArgumentException since no components can be added to - * this container. - * */ - public Component add(String name,Component comp) { - throw new IllegalArgumentException(); - } - - /** - * Throws an IllegalArgumentException since no components can be added to - * this container. - * */ - public Component add(Component comp, int index) { - throw new IllegalArgumentException(); - } - - /** - * Throws an IllegalArgumentException since no components can be added to - * this container. - * */ - public void add(Component comp, Object constraints) { - throw new IllegalArgumentException(); - } - - /** - * Throws an IllegalArgumentException since no components can be added to - * this container. - * */ - public void add(Component comp, Object constraints, int index) { - throw new IllegalArgumentException(); - } - - /** - * Throws an IllegalArgumentException since the components should never be - * removed from this container. - * */ - public void remove(int index) { - throw new IllegalArgumentException(); - } - - /** - * Throws an IllegalArgumentException since the components should never be - * removed from this container. - * */ - public void remove(Component comp) { - throw new IllegalArgumentException(); - } - - /** - * Throws an IllegalArgumentException since the components should never be - * removed from this container. - * */ - public void removeAll() { - throw new IllegalArgumentException(); - } - - /** - * Throws an IllegalArgumentException since the layout manager is - * internally set and can not be changed. - * */ - public void setLayout(LayoutManager mgr) { - throw new IllegalArgumentException(); - } - - /** - * Sets the scrollbars values, according to the image display area and - * image size. The current scroll position is kept. - * - * */ - private void setScrollbars() { - Dimension asz; // actual image area size - Dimension psz; // preferred size - int pos; // current scroll position - int szx,szy; // actual image display area size - - if (!imgDisplay.calcDim()) { - // While the image dimensions are not known we can't really update - // the scrollbar. - return; - } - - // Get the dimensions - asz = imgDisplay.getSize(); - psz = imgDisplay.getPreferredSize(); - - // Initialize lastZoom and lastSize if never done yet - if (lastZoom == 0f) lastZoom = zoom; - if (lastSize == null) lastSize = new Dimension(asz.width,asz.height); - - // Get the actual display size - szx = (asz.width < psz.width) ? asz.width : psz.width; - szy = (asz.height < psz.height) ? asz.height : psz.height; - - // Set horizontal scrollbar - pos = (int)((hsbar.getValue()+lastSize.width/2f)/lastZoom*zoom-szx/2f); - if (pos > (psz.width-asz.width)) pos = psz.width-asz.width; - if (pos < 0) pos = 0; - if (asz.width <= 0) asz.width = 1; - if (psz.width <= 0) psz.width = 1; - hsbar.setValues(pos,asz.width,0,psz.width); - asz.width = (int)(asz.width*BLOCK_INCREMENT_PROPORTION); - if (asz.width <= 0) asz.width = 1; - hsbar.setBlockIncrementI(asz.width); - - // Set vertical scrollbar - pos = (int)((vsbar.getValue()+lastSize.height/2f)/lastZoom*zoom-szy/2f); - if (pos > (psz.height-asz.height)) pos = psz.height-asz.height; - if (pos < 0) pos = 0; - if (asz.height <= 0) asz.height = 1; - if (psz.height <= 0) psz.height = 1; - vsbar.setValues(pos,asz.height,0,psz.height); - asz.height = (int)(asz.height*BLOCK_INCREMENT_PROPORTION); - if (asz.height <= 0) asz.height = 1; - vsbar.setBlockIncrementI(asz.height); - - // Save the zoom and display size used in the scrollbar calculation - lastZoom = zoom; - lastSize.width = szx; - lastSize.height = szy; - } - - /** - * This class implements the component that displays the currently - * viewable image portion inside the ImgScrollPane. It handles the - * necessary erasing, zooming and panning. - * - *

NOTE: extending 'Canvas' instead of 'Component' solves the - * flickering problem of lightweight components which are in heavyweight - * containers. - * - * */ - private class ImageScrollDisplay extends Canvas { - - /** The image to be displayed - * - * @serial */ - Image img; - - /** The preferred size for this component - * - * @serial */ - Dimension dim = new Dimension(); - - /** If the current graphics context should be erased prior to drawing - * the image. Set when the image and/or zoom factor is changed. - * - * @serial */ - boolean erase; - - /** The image dimensions, without any scaling. Set as soon as they are - known. - * - * @serial */ - Dimension imgDim = new Dimension(); - - /** The image dimension flags, as in ImageObserver. The - * ImageObserver.WIDTH and ImageObserver.HEIGHT flags are set whenever - * the dimension is stored in imgDim. They are reset whenever the - * image changes. - * - * @serial */ - int dimFlags; - - /** The last offset used in update(). - * - * @serial */ - Point lastUpdateOffset; - - /** - * Sets the image to display in this component. If the image is not - * ready for display it will be prepared in the current thread. The - * current zoom factor applies. - * - *

If the image is not ready for display (i.e. it has not been - * rendered at its natural size) it will be rendered in the current - * thread, if not being already rendered in another one. This means - * that the current thread can block until the image is ready. - * - *

If the image is rendered incrementally (it depends on the - * underlying 'ImageProducer') it will be displayed in that way if the - * incremental display is set for the Component class. See the - * 'imageUpdate()' method of the 'Component' class. - * - *

If the image is the same as the current one nothing is done. - * - * @param img The image to display. - * - * @see Component#imageUpdate - * - * */ - void setImage(Image img) { - // Update object state - synchronized (ImgScrollPane.this) { - if (img == null) { - throw new IllegalArgumentException(); - } - // If same image do nothing - if (this.img == img) { - return; - } - - // (Re)initialize - dimFlags = 0; - this.img = img; - lastSize = null; - lastZoom = 0f; - setScrollbars(); - // Set to erase previous image - erase = true; - } - // Start image production (if the image is already being prepared - // the method does nothing) - ImgScrollPane.this.prepareImage(img,this); - } - - /** - * Returns the minimum size for this component, which is (0,0). - * - * @return The minimum size - * - * */ - public Dimension getMinimumSize() { - return new Dimension(0,0); - } - - /** - * Returns the maximum size for this component, which is infinite. - * - * @return The maximum size - * - * */ - public Dimension getMaximumSize() { - return new Dimension(Integer.MAX_VALUE,Integer.MAX_VALUE); - } - - /** - * Returns the preferred size for this component, which is the image - * display size, if known, the previous image display size, if any, or - * the size specified at the constructor. - * - * @return The preferred size for this component. - * - * */ - public Dimension getPreferredSize() { - return dim; - } - - /** - * Monitors the image rendering for dimensions and calls the - * superclass' 'imageUpdate()' method. If the display size of the - * image is not yet known and the image dimensions are obtained, then - * the scrollbars' values are set. If 'img' is not the current image - * to display nothing is done and 'false' is returned indicating that - * nothing more is necessary for it. - * - * @see ImageObserver#imageUpdate - * - * @see Component#imageUpdate - * - * */ - public boolean imageUpdate(Image img, int infoflags, - int x, int y, int w, int h) { - if (this.img != img) { - // Not the image we want to display now (might be an old one) - // => do nothing and no more info needed on that image - return false; - } - // If got the image dimensions then store them and set component - // size as appropriate. - if ((infoflags & (ImageObserver.WIDTH|ImageObserver.HEIGHT)) != 0) { - // Got some image dimension - synchronized (ImgScrollPane.this) { - // Read the dimensions received - if ((infoflags & ImageObserver.WIDTH) != 0) { - imgDim.width = w; - dimFlags |= ImageObserver.WIDTH; - } - if ((infoflags & ImageObserver.HEIGHT) != 0) { - imgDim.height = h; - dimFlags |= ImageObserver.HEIGHT; - } - // If we got to know the image dimensions force the layout - // to be done (to see if it is necessary to show - // scrollbars) - if (dimFlags == - (ImageObserver.WIDTH|ImageObserver.HEIGHT)) { - ImgScrollPane.this.doLayout(); - } - } - } - // Call the superclass' method to continue processing - return super.imageUpdate(img,infoflags,x,y,w,h); - } - - /** - * Paints the image, if any, on the graphics context by calling - * update(). - * - * @param g The graphics context to paint on. - * - * */ - public void paint(Graphics g) { - // Now call update as usual - update(g); - } - - /** - * Updates the component by drawing the relevant part of the image - * that fits within the Graphics clipping area of 'g'. If the image is - * not already being prepared for rendering or is not already rendered - * this method does not start it. This is to avoid blocking the AWT - * threads for rendering the image. The image rendering is started by - * the 'setImage()' method. - * - * @param g The graphics context where to draw - * - * @see #setImage - * - * */ - public void update(Graphics g) { - Image img; // The image to display - float zoom; // The zoom factor - boolean erase; // If the display area should be erased - int dx1,dy1; // Scaling destionation upper-left corner - int dx2,dy2; // Scaling destination down-right corner - int sx1,sy1; // Scaling source upper-left corner - int sx2,sy2; // Scaling source down-right corner - int ox,oy; // Centering offset - Rectangle b; // Bounds of the display area - int offx,offy; // Offset of the upper-left corner - int loffx,loffy; // Offset of the upper-left corner of last update - boolean copyScroll;// If the scrolling should be done by copying - Rectangle clip; // The clipping area - int status; // The image fetching status - - // Copy to local variables in a synchronized block to avoid races - synchronized (ImgScrollPane.this) { - img = this.img; - zoom = ImgScrollPane.this.zoom; - erase = this.erase; - copyScroll = ImgScrollPane.this.copyScroll; - this.erase = false; - - // If no image or the image has not started preparation yet do - // nothing. We do not want to start the image preparation in - // this thread because it can be long. - if (img == null || (status = this.checkImage(img,null)) == 0) { - return; - } - // Get the display size and eventual centering offset for the - // image. - b = this.getBounds(); - ox = (b.width > dim.width) ? (b.width-dim.width)/2 : 0; - oy = (b.height > dim.height) ? (b.height-dim.height)/2 : 0; - // Get the display offset - clip = g.getClipBounds(); - if (lastUpdateOffset != null && - (clip.width < b.width || clip.height < b.height)) { - // The clip is smaller than the display area => we need to - // paint with the last offset to avoid screwing up the - // displayed image. - offx = lastUpdateOffset.x; - offy = lastUpdateOffset.y; - } - else { - // The clipping area covers the whole display area => we - // can use the current offset. - offx = hsbar.getValue(); - offy = vsbar.getValue(); - } - // Get and update the offset of last update - if (lastUpdateOffset == null) { - lastUpdateOffset = new Point(); - } - loffx = lastUpdateOffset.x; - loffy = lastUpdateOffset.y; - lastUpdateOffset.x = offx; - lastUpdateOffset.y = offy; - // Set the display size according to zoom - if (zoom == 1f) { - // Natural image size, no scaling - // Displace the origin of the image according to offset - ox -= offx; - oy -= offy; - // No zoom so no translation for scaling compensation needed - sx1 = sy1 = 0; // to keep compiler happy - sx2 = sy2 = 0; // to keep compiler happy - dx1 = dy1 = 0; // to keep compiler happy - dx2 = dy2 = 0; // to keep compiler happy - } - else { - int sox,soy; // Scaling compensation offset - // Calculate coordinates of lower right corner for scaling - if (dimFlags != - (ImageObserver.WIDTH|ImageObserver.HEIGHT)) { - // Image dims not yet available we can't display - return; - } - sx1 = sy1 = 0; - sx2 = imgDim.width; - sy2 = imgDim.height; - dx1 = dy1 = 0; - dx2 = dim.width; - dy2 = dim.height; - sox = soy = 0; - // Limit the scaling area according to display size so - // that scaling operates only on the area to be displayed - if (dx2 > b.width) { - // Calculate coordinates of displayed portion - dx2 = b.width+ ((zoom>1f) ? (int)Math.ceil(zoom) : 0); - if ((int)zoom == zoom) { - // For integer zoom make dx2 a multiple of zoom - dx2 = (int)(Math.ceil(dx2/zoom)*zoom); - } - sx1 = (int)(offx/zoom); - sx2 = sx1 + (int)(dx2/zoom); - // Compensate the scaling on integer coordinates with - // an offset - sox = (int)(sx1*zoom-offx); - } - if (dy2 > b.height) { - // Calculate coordinates of displayed portion - dy2 = b.height + ((zoom>1f) ? (int)Math.ceil(zoom) : 0); - if ((int)zoom == zoom) { - // For integer zoom make dy2 a multiple of zoom - dy2 = (int)(Math.ceil(dy2/zoom)*zoom); - } - sy1 = (int)(offy/zoom); - sy2 = sy1 + (int)(dy2/zoom); - // Compensate the scaling on integer coordinates with - // an extra offset - soy = (int)(sy1*zoom-offy); - } - // Apply centering offset and scaling compensation offset - dx1 += ox + sox; - dy1 += oy + soy; - dx2 += ox + sox; - dy2 += oy + soy; - } - } - // If the image is not yet complete and we are scrolling set to - // erase to avoid leftovers of previous scroll on parts of the - // image which are not yet ready - if ((status & ImageObserver.ALLBITS) == 0 && - (loffx != offx || loffy != offy)) { - erase = true; - } - // Now we have the necessary info for display. We do it outside - // synchronized to avoid any potential deadlocks with imageUpdate(). - if (erase) { - // We need to erase the current image. Make sure that we - // redraw everything by setting the clipping area to the whole - // display one. - g.setClip(0,0,b.width,b.height); - g.setColor(this.getBackground()); - g.fillRect(0,0,b.width,b.height); - } - - // Use copy scrolling if the image has not been erased, we are - // scrolling, the image is complete, and copy scrolling is enabled. - if (copyScroll && !erase && (loffx != offx || loffy != offy) && - (status & ImageObserver.ALLBITS) != 0) { - // We might be able to move some part of the displayed area - // instead of redrawing everything. - - // We are just trasnlating the current image, so we can reuse - // a part of it. - - int culx,culy; // Clipping area upper-left corner (inclusive) - int cdrx,cdry; // Clipping area down-right corner (exclusive) - int vulx,vuly; // Valid area upper-left corner (inclusive) - int vdrx,vdry; // Valid area down-right corner (exclusive) - - culx = clip.x; - culy = clip.y; - cdrx = clip.x+clip.width; - cdry = clip.y+clip.height; - - // Initialize valid area as the current display area after the - // translation. - vulx = loffx-offx; - vuly = loffy-offy; - vdrx = vulx+b.width; - vdry = vuly+b.height; - - // Make new valid area the intersection of the clipping area - // and the valid area. - if (culx > vulx) vulx = culx; - if (culy > vuly) vuly = culy; - if (cdrx < vdrx) vdrx = cdrx; - if (cdry < vdry) vdry = cdry; - - // If the new valid area is non-empty then copy current image - // data - if (vulx < vdrx && vuly < vdry) { - // Ok we can move a part instead of repainting - g.copyArea(vulx+offx-loffx,vuly+offy-loffy, - vdrx-vulx,vdry-vuly, - loffx-offx,loffy-offy); - // Now we need to redraw the other parts - if (culx < vulx) { // Need to draw at left - g.setClip(culx,culy,vulx-culx,cdry-culy); - if (zoom == 1f) { // No scaling - g.drawImage(img,ox,oy,this); - } - else { // Draw the image using on the fly scaling - g.drawImage(img,dx1,dy1,dx2,dy2,sx1,sy1,sx2,sy2, - this); - } - } - if (vdrx < cdrx) { // Need to draw at right - g.setClip(vdrx,culy,cdrx-vdrx,cdry-culy); - if (zoom == 1f) { // No scaling - g.drawImage(img,ox,oy,this); - } - else { // Draw the image using on the fly scaling - g.drawImage(img,dx1,dy1,dx2,dy2,sx1,sy1,sx2,sy2, - this); - } - } - if (culy < vuly) { // Need to draw at top - g.setClip(vulx,culy,vdrx-vulx,vuly-culy); - if (zoom == 1f) { // No scaling - g.drawImage(img,ox,oy,this); - } - else { // Draw the image using on the fly scaling - g.drawImage(img,dx1,dy1,dx2,dy2,sx1,sy1,sx2,sy2, - this); - } - } - if (vdry < cdry) { // Need to draw at bottom - g.setClip(vulx,vdry,vdrx-vulx,cdry-vdry); - if (zoom == 1f) { // No scaling - g.drawImage(img,ox,oy,this); - } - else { // Draw the image using on the fly scaling - g.drawImage(img,dx1,dy1,dx2,dy2,sx1,sy1,sx2,sy2, - this); - } - } - } - else { - // New valid area is empty, we need to draw everything - if (zoom == 1f) { // No scaling - g.drawImage(img,ox,oy,this); - } - else { // Draw the image using on the fly scaling - g.drawImage(img,dx1,dy1,dx2,dy2,sx1,sy1,sx2,sy2,this); - } - } - } - else { - // We are not translating, so we can't copy - if (zoom == 1f) { // No scaling - g.drawImage(img,ox,oy,this); - } - else { // Draw the image using on the fly scaling - g.drawImage(img,dx1,dy1,dx2,dy2,sx1,sy1,sx2,sy2,this); - } - } - } - - /** - * Calculates the image display dimensions according to the zoom and - * image size. The dimensions are stored in 'dim'. - * - * @return True if the dimensions could be calculated, false if not - * (i.e. not enough info is available). - * - * */ - boolean calcDim() { - // We need the image dimensions - if (dimFlags != (ImageObserver.WIDTH|ImageObserver.HEIGHT)) { - // Image dims not yet available we can't do anything - return false; - } - // Calculate dims - if (zoom == 1f) { - // Natural image dimension - dim.width = imgDim.width; - dim.height = imgDim.height; - } - else { - // Apply zoom - dim.width = (int)(zoom*imgDim.width); - dim.height = (int)(zoom*imgDim.height); - } - return true; - } - } - - /** - * Scrollbars for the ImgScrollPane container. They are normal AWT - * Scrollbars, but with a thickness of - * ImgScrollPane.SCROLLBAR_THICKNESS. Also many of the set method of the - * Adjustable interface are overriden and throw IllegalArgumentException - * since they are not to be used externally. - * - * */ - class ISPScrollbar extends Scrollbar { - - /** - * Constructs a new scroll bar with the specified orientation and - * values. - * - *

The orientation argument must take one of the two values - * Scrollbar.HORIZONTAL, or Scrollbar.VERTICAL, indicating a - * horizontal or vertical scroll bar, respectively. - * - * @param orientation indicates the orientation of the scroll bar - * - * @param value the initial value of the scroll bar. - * - * @param visible the size of the scroll bar's bubble, representing - * the visible portion; the scroll bar uses this value when paging up - * or down by a page. - * - * @param min the minimum value of the scroll bar. - * - * @param max the maximum value of the scroll bar. - * - * @param svt The scrollbar visible type - **/ - ISPScrollbar(int orientation, - int value, int visible, int min, int max) { - super(orientation,value,visible,min,max); - } - - /** - * Returns the preferred size of the scrollbar. It is the same as the - * preferred size of a normal scrollbar but with a thickness of - * ImgScrollPane.SCROLLBAR_THICKNESS. - * - * @return The Scrollbar preferred size - * */ - public Dimension getPreferredSize() { - Dimension psz = super.getPreferredSize(); - if (getOrientation() == HORIZONTAL) { - psz.height = ImgScrollPane.SCROLLBAR_THICKNESS; - } - else { - psz.width = ImgScrollPane.SCROLLBAR_THICKNESS; - } - return psz; - } - - /** - * Throws an IllegalArgumentException since the minimum value should - * never be set externally. - * */ - public void setMinimum(int min) { - throw new IllegalArgumentException(); - } - - /** - * Throws an IllegalArgumentException since the maximum value should - * never be set externally. - * */ - public void setMaximum(int max) { - throw new IllegalArgumentException(); - } - - /** - * Throws an IllegalArgumentException since the visible amount should - * never be set externally. - * */ - public void setVisibleAmount(int v) { - throw new IllegalArgumentException(); - } - - /** - * Throws an IllegalArgumentException since the block increment should - * never be set externally. - * */ - public void setBlockIncrement(int b) { - super.setBlockIncrement(b); - } - - /** - * Sets the block increment for this scroll bar. - * - *

The block increment is the value that is added (subtracted) when - * the user activates the block increment area of the scroll bar, - * generally through a mouse or keyboard gesture that the scroll bar - * receives as an adjustment event. - * - *

This is a version to be used by The ImgScrollPane class only. - * - * @param v the amount by which to increment or decrement the scroll - * bar's value. - * */ - void setBlockIncrementI(int v) { - super.setBlockIncrement(v); - } - - /** - * Sets the value of this scroll bar to the specified value. - * - *

If the value supplied is less than the current minimum or - * greater than the current maximum, then one of those values is - * substituted, as appropriate. - * - *

This is a version to be used by The ImgScrollPane class only. - * - * @param newValue he new value of the scroll bar. - * */ - void setValueI(int newValue) { - super.setValue(newValue); - } - - /** - * Sets the value of this scroll bar to the specified value and - * requests a repaint of the image area. - * - *

If the value supplied is less than the current minimum or - * greater than the current maximum, then one of those values is - * substituted, as appropriate. - * - * @param newValue he new value of the scroll bar. - * */ - public void setValue(int newValue) { - // Set the value and check if we need to repaint - synchronized (ImgScrollPane.this) { - super.setValue(newValue); - newValue = getValue(); // get the actual value for check - if (imgDisplay.lastUpdateOffset != null) { - if (getOrientation() == HORIZONTAL) { - if (imgDisplay.lastUpdateOffset.x == newValue) { - return; // No change - } - } - else { - if (imgDisplay.lastUpdateOffset.y == newValue) { - return; // No change - } - } - } - } - // New value changes from last drawn => repaint - imgDisplay.repaint(); - } - } -} diff --git a/CSJ2K/jj2kdecoder/disp/TitleUpdater.jsl b/CSJ2K/jj2kdecoder/disp/TitleUpdater.jsl deleted file mode 100644 index 7eafe69e..00000000 --- a/CSJ2K/jj2kdecoder/disp/TitleUpdater.jsl +++ /dev/null @@ -1,118 +0,0 @@ -/* - * CVS identifier: - * - * $Id: TitleUpdater.java,v 1.8 2002/06/24 14:04:58 grosbois Exp $ - * - * Class: TitleUpdater - * - * Description: Thread to update display window title - * - * - * - * COPYRIGHT: - * - * This software module was originally developed by Raphaël Grosbois and - * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel - * Askelöf (Ericsson Radio Systems AB); and Bertrand Berthelot, David - * Bouchard, Félix Henry, Gerard Mozelle and Patrice Onno (Canon Research - * Centre France S.A) in the course of development of the JPEG2000 - * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This - * software module is an implementation of a part of the JPEG 2000 - * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio - * Systems AB and Canon Research Centre France S.A (collectively JJ2000 - * Partners) agree not to assert against ISO/IEC and users of the JPEG - * 2000 Standard (Users) any of their rights under the copyright, not - * including other intellectual property rights, for this software module - * with respect to the usage by ISO/IEC and Users of this software module - * or modifications thereof for use in hardware or software products - * claiming conformance to the JPEG 2000 Standard. Those intending to use - * this software module in hardware or software products are advised that - * their use may infringe existing patents. The original developers of - * this software module, JJ2000 Partners and ISO/IEC assume no liability - * for use of this software module or modifications thereof. No license - * or right to this software module is granted for non JPEG 2000 Standard - * conforming products. JJ2000 Partners have full right to use this - * software module for his/her own purpose, assign or donate this - * software module to any third party and to inhibit third parties from - * using this software module for non JPEG 2000 Standard conforming - * products. This copyright notice must be included in all copies or - * derivative works of this software module. - * - * Copyright (c) 1999/2000 JJ2000 Partners. - * */ -package CSJ2K.disp; - -import java.awt.*; - -/** - * This class should run as an independent thread to update tha main - * display window title with current image scroll position and - * zoom. - * */ -public class TitleUpdater implements Runnable { - - /** The update perion, in milliseconds: 100 */ - static final int UPDATE_T = 100; - - /** The ImgScrollPane where the image is displayed */ - ImgScrollPane isp; - - /** The frame which title to update */ - Frame win; - - /** The base of the title */ - String btitle; - - /** The thread exits when this is true */ - volatile public boolean done = false; - - /** - * Instantiates the title updater. The title of 'win' will be - * regularly updated with the current zoom and scroll point. The - * current zoom and scroll point are added to the basic title - * given by 'btitle'. - * - * @param isp Where the image is displayed - * - * @param win The window which title to update - * - * @param btitle The base of the title. - * */ - public TitleUpdater(ImgScrollPane isp, Frame win, String btitle) { - this.isp = isp; - this.win = win; - this.btitle = btitle; - } - - /** - * The method that executes this thread. The method periodically - * updates the title, if necessary, and puts to sleep the thread - * for 100 msec. This method never returns. If the sleep of the - * thread is interrupted, the title will be updated earlier and - * the cycle will continue. - * */ - public void run() { - // Periodically update the window title - Point lsp,sp; - float lzf,zf; - lsp = isp.getScrollPosition(); - lzf = isp.getZoom(); - while (!done) { - sp = isp.getScrollPosition(); - zf = isp.getZoom(); - // Update title only if necessary - if (zf != lzf || !sp.equals(lsp)) { - win.setTitle(btitle+ - " @ ("+(int)(sp.x/zf)+","+ - (int)(sp.y/zf)+") : "+isp.getZoom()); - } - lsp = sp; - lzf = zf; - try { - Thread.currentThread().sleep(UPDATE_T); - } - catch (InterruptedException e) { - } - } - } -} diff --git a/CSJ2K/jj2kdecoder/j2kdecoder.vjsproj b/CSJ2K/jj2kdecoder/j2kdecoder.vjsproj deleted file mode 100644 index ecb180fc..00000000 --- a/CSJ2K/jj2kdecoder/j2kdecoder.vjsproj +++ /dev/null @@ -1,61 +0,0 @@ - - - Debug - x86 - 8.0.50727 - 2.0 - {32801F5D-4A99-47E2-B1A3-62A8F3ABFA99} - Exe - j2kdecoder - j2kdecoder - 4 - %24/csj2k/CSJ2K/jj2kdecoder - . - https://tfs03.codeplex.com - {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} - - - true - full - false - bin\Debug\ - DEBUG;TRACE - - - pdbonly - true - bin\Release\ - TRACE - - - - - - - - - - - - - - - - - - - - - {1EA0F9BA-0194-4F08-9E55-89888D5A4724} - CSJ2K - - - - - \ No newline at end of file diff --git a/CSJ2K/jj2kdecoder/j2kdecoder.vjsproj.user b/CSJ2K/jj2kdecoder/j2kdecoder.vjsproj.user deleted file mode 100644 index cc8465b8..00000000 --- a/CSJ2K/jj2kdecoder/j2kdecoder.vjsproj.user +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/CSJ2K/jj2kdecoder/j2kdecoder.vjsproj.vspscc b/CSJ2K/jj2kdecoder/j2kdecoder.vjsproj.vspscc deleted file mode 100644 index feffdeca..00000000 --- a/CSJ2K/jj2kdecoder/j2kdecoder.vjsproj.vspscc +++ /dev/null @@ -1,10 +0,0 @@ -"" -{ -"FILE_VERSION" = "9237" -"ENLISTMENT_CHOICE" = "NEVER" -"PROJECT_FILE_RELATIVE_PATH" = "" -"NUMBER_OF_EXCLUDED_FILES" = "0" -"ORIGINAL_PROJECT_FILE_PATH" = "" -"NUMBER_OF_NESTED_PROJECTS" = "0" -"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" -} diff --git a/CSJ2K/jj2kencoder/CmdLnEncoder.jsl b/CSJ2K/jj2kencoder/CmdLnEncoder.jsl deleted file mode 100644 index 851fc21b..00000000 --- a/CSJ2K/jj2kencoder/CmdLnEncoder.jsl +++ /dev/null @@ -1,213 +0,0 @@ -/* - * CVS identifier: - * - * $Id: CmdLnEncoder.java,v 1.53 2001/01/23 12:58:11 grosbois Exp $ - * - * Class: CmdLnEncoder - * - * Description: Runs JJ2000's encoder from the command line - * - * - * - * COPYRIGHT: - * - * This software module was originally developed by Raphaël Grosbois and - * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel - * Askelöf (Ericsson Radio Systems AB); and Bertrand Berthelot, David - * Bouchard, Félix Henry, Gerard Mozelle and Patrice Onno (Canon Research - * Centre France S.A) in the course of development of the JPEG2000 - * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This - * software module is an implementation of a part of the JPEG 2000 - * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio - * Systems AB and Canon Research Centre France S.A (collectively JJ2000 - * Partners) agree not to assert against ISO/IEC and users of the JPEG - * 2000 Standard (Users) any of their rights under the copyright, not - * including other intellectual property rights, for this software module - * with respect to the usage by ISO/IEC and Users of this software module - * or modifications thereof for use in hardware or software products - * claiming conformance to the JPEG 2000 Standard. Those intending to use - * this software module in hardware or software products are advised that - * their use may infringe existing patents. The original developers of - * this software module, JJ2000 Partners and ISO/IEC assume no liability - * for use of this software module or modifications thereof. No license - * or right to this software module is granted for non JPEG 2000 Standard - * conforming products. JJ2000 Partners have full right to use this - * software module for his/her own purpose, assign or donate this - * software module to any third party and to inhibit third parties from - * using this software module for non JPEG 2000 Standard conforming - * products. This copyright notice must be included in all copies or - * derivative works of this software module. - * - * Copyright (c) 1999/2000 JJ2000 Partners. - * */ -package CSJ2K.j2k.encoder; - -import CSJ2K.j2k.util.*; - -import java.util.*; -import java.io.*; - -/** - * This class runs JJ2000's encoder from the command line interface. It parses - * command-line arguments to fill a ParameterList object which will be - * provided to an Encoder object. - * */ -public class CmdLnEncoder -{ - /** The parameter list (arguments) */ - private ParameterList pl; - - /** The default parameter list (arguments) */ - private ParameterList defpl; - - /** The current encoder object */ - private Encoder enc; - - /** - * The starting point of the program. It creates a CmdLnEncoder - * object, initializes it, and performs coding. - * - * @param argv The command line arguments - * */ - public static void main(String argv[]) - { - if (argv.length == 0) - { - FacilityManager.getMsgLogger() - .println("CmdLnEncoder: JJ2000's JPEG 2000 Encoder\n" + - " use CSJ2K.j2k.encoder.CmdLnEncoder -u " + - "to get help\n", 0, 0); - System.exit(1); - } - - new CmdLnEncoder(argv); - } - - /** - * Instantiates a command line encoder object, with the 'argv' command - * line arguments. It also initializes the default parameters. If the - * argument list is empty an IllegalArgumentException is thrown. If an - * error occurs while parsing the arguments error messages are written to - * stderr and the run exit code is set to non-zero, see getExitCode() - * - * @exception IllegalArgumentException If 'argv' is empty - * - * @see Encoder#getExitCode - * */ - public CmdLnEncoder(String argv[]) - { - // Initialize default parameters - defpl = new ParameterList(); - String[][] param = Encoder.getAllParameters(); - - for (int i = param.length - 1; i >= 0; i--) - { - if (param[i][3] != null) - { - defpl.Set(param[i][0], param[i][3]); - } - } - - // Create parameter list using defaults - pl = new ParameterList(defpl); - - if (argv.length == 0) - { - throw new IllegalArgumentException("No arguments!"); - } - - // Parse arguments from argv - try - { - pl.parseArgs(argv); - } - catch (StringFormatException e) - { - System.err.println("An error occured while parsing the " + - "arguments:\n" + e.get_Message()); - return; - } - - /* - // Parse the arguments from some file? - if (pl.getParameter("pfile") != null) - { - // Load parameters from file - ParameterList tmpPl = new ParameterList(); - InputStream is; - try - { - is = new FileInputStream(pl.getParameter("pfile")); - is = new BufferedInputStream(is); - tmpPl.load(is); - } - catch (FileNotFoundException e) - { - System.err.println("Could not load the argument file " + - pl.getParameter("pfile")); - return; - } - catch (IOException e) - { - System.err.println("An error ocurred while reading from the " + - "argument file " + pl.getParameter("pfile")); - return; - } - try - { - is.close(); - } - catch (IOException e) - { - System.out.println("[WARNING] Could not close the argument file" + - " after reading"); - } - Enumeration Enum = tmpPl.keys(); - String str; - - while (Enum.hasMoreElements()) - { - str = (String)Enum.nextElement(); - if (pl.get(str) == null) - { - pl.put(str, tmpPl.get(str)); - } - } - } - */ - - // **** Check parameters **** - try - { - pl.checkList(Encoder.vprfxs, pl.toNameArray(param)); - } - catch (IllegalArgumentException e) - { - System.err.println(e.getMessage()); - return; - } - - // Instantiate encoder - enc = new Encoder(pl); - if (enc.getExitCode() != 0) - { // An error ocurred - System.exit(enc.getExitCode()); - } - // Run the encoder - try - { - enc.run(); - } - catch (Throwable e) - { - e.printStackTrace(); - } - finally - { - if (enc.getExitCode() != 0) - { - System.exit(enc.getExitCode()); - } - } - } -} diff --git a/CSJ2K/jj2kencoder/Encoder.jsl b/CSJ2K/jj2kencoder/Encoder.jsl deleted file mode 100644 index 4d1f8cab..00000000 --- a/CSJ2K/jj2kencoder/Encoder.jsl +++ /dev/null @@ -1,1111 +0,0 @@ -/* - * CVS identifier: - * - * $Id: Encoder.java,v 1.68 2002/05/22 14:59:08 grosbois Exp $ - * - * Class: Encoder - * - * Description: The encoder object - * - * [from CmdLnEncoder, Diego SANTA CRUZ, May-19-1999] - * - * - * COPYRIGHT: - * - * This software module was originally developed by Raphaël Grosbois and - * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel - * Askelöf (Ericsson Radio Systems AB); and Bertrand Berthelot, David - * Bouchard, Félix Henry, Gerard Mozelle and Patrice Onno (Canon Research - * Centre France S.A) in the course of development of the JPEG2000 - * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This - * software module is an implementation of a part of the JPEG 2000 - * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio - * Systems AB and Canon Research Centre France S.A (collectively JJ2000 - * Partners) agree not to assert against ISO/IEC and users of the JPEG - * 2000 Standard (Users) any of their rights under the copyright, not - * including other intellectual property rights, for this software module - * with respect to the usage by ISO/IEC and Users of this software module - * or modifications thereof for use in hardware or software products - * claiming conformance to the JPEG 2000 Standard. Those intending to use - * this software module in hardware or software products are advised that - * their use may infringe existing patents. The original developers of - * this software module, JJ2000 Partners and ISO/IEC assume no liability - * for use of this software module or modifications thereof. No license - * or right to this software module is granted for non JPEG 2000 Standard - * conforming products. JJ2000 Partners have full right to use this - * software module for his/her own purpose, assign or donate this - * software module to any third party and to inhibit third parties from - * using this software module for non JPEG 2000 Standard conforming - * products. This copyright notice must be included in all copies or - * derivative works of this software module. - * - * Copyright (c) 1999/2000 JJ2000 Partners. - * */ -package CSJ2K.j2k.encoder; - -import CSJ2K.j2k.quantization.quantizer.*; -import CSJ2K.j2k.image.forwcomptransf.*; -import CSJ2K.j2k.codestream.writer.*; -import CSJ2K.j2k.fileformat.writer.*; -import CSJ2K.j2k.wavelet.analysis.*; -import CSJ2K.j2k.entropy.encoder.*; -import CSJ2K.j2k.quantization.*; -import CSJ2K.j2k.image.input.*; -import CSJ2K.j2k.roi.encoder.*; -import CSJ2K.j2k.codestream.*; -import CSJ2K.j2k.image.*; -import CSJ2K.j2k.util.*; -import CSJ2K.j2k.*; - -import java.util.*; -import java.io.*; - -/** - * This class is the main class of JJ2000's encoder. It instantiates all - * objects of the chain and launchs the encoding process. It then writes the - * header and the compressed bit stream to the output file. Finally, - * packed packet headers (through codestream post-manipulation) and - * file-format may be created if needed. - * - *

First the encoder should be initialized with a ParameterList object - * provided through the constructor. Then, the run() method is invoked and the - * encoder executes. The exit code of the class can be obtained with the - * getExitCode() method, after the constructor and after the run method. A - * non-zero value indicates that an error has occurred.

- * - *

The modules are inserted in the encoding chain with the following - * order:

- * - *
    - *
  • ImgReader
  • - *
  • ImgDataJoiner (if multiple image readers)
  • - *
  • Tiler
  • - *
  • ForwCompTransf
  • - *
  • ImgDataConverter
  • - *
  • ForwardWT
  • - *
  • Quantizer
  • - *
  • ROIScaler
  • - *
  • EntropyCoder
  • - *
  • PostCompRateAllocator
  • - *
- * - *

The encoder uses a pull model. This means that the last module - * (PostCompRateAllocator) requests data from its source (EntropyCoder), - * ...

- * - *

Writing of the codestream writing (header+bit stream) is realized by - * HeaderEncoder and CodestreamWriter modules.

- * - *

Packed packet headers and file-format creation are carried out by - * CodestreamManipulator and FileFormatWriter modules respectively.

- * - *

Many modules of the encoder may behave differently depending on the - * tile-component. The specifications of their behaviour are kept in - * specialized modules extending ModuleSpec class. All these modules are - * accessible through an instance of EncoderSpecs class.

- * - * @see ImgReader - * @see ImgDataJoiner - * @see ForwCompTransf - * @see Tiler - * @see ImgDataConverter - * @see ForwardWT - * @see Quantizer - * @see ROIScaler - * @see EntropyCoder - * @see PostCompRateAllocator - * @see HeaderEncoder - * @see CodestreamWriter - * @see CodestreamManipulator - * @see FileFormatWriter - * @see ModuleSpec - * @see EncoderSpecs - * */ -public class Encoder implements Runnable { - - /** The exit code of the run method */ - private int exitCode; - - /** The parameter list (arguments) */ - private ParameterList pl; - - /** The default parameter list (arguments) */ - private ParameterList defpl; - - /** The valid list of options prefixes */ - public final static char vprfxs[] = { - ForwCompTransf.OPT_PREFIX, // Mixer module - AnWTFilter.OPT_PREFIX, // Filters type spec - ForwardWT.OPT_PREFIX, // Wavelets module - Quantizer.OPT_PREFIX, // Quantizer module - ROIScaler.OPT_PREFIX, // ROI module - HeaderEncoder.OPT_PREFIX, // HeaderEncoder module - EntropyCoder.OPT_PREFIX, // Coding modules - PostCompRateAllocator.OPT_PREFIX, // Rate allocator - PktEncoder.OPT_PREFIX, // Packet encoder - }; - - /** The parameter information for this class */ - private final static String[][] pinfo = { - { "debug", null, - "Print debugging messages when an error is encountered.","off"}, - { "disable_jp2_extension", "[on|off]", - "JJ2000 automatically adds .jp2 extension when using 'file_format'"+ - "option. This option disables it when on.", "off"}, - { "file_format", "[on|off]", - "Puts the JPEG 2000 codestream in a JP2 file format wrapper.","off"}, - { "pph_tile", "[on|off]", - "Packs the packet headers in the tile headers.","off"}, - { "pph_main", "[on|off]", - "Packs the packet headers in the main header.","off"}, - { "pfile", "", - "Loads the arguments from the specified file. Arguments that are "+ - "specified on the command line override the ones from the file.\n"+ - "The arguments file is a simple text file with one argument per "+ - "line of the following form:\n" + - " =\n"+ - "If the argument is of boolean type (i.e. its presence turns a "+ - "feature on), then the 'on' value turns it on, while the 'off' "+ - "value turns it off. The argument name does not include the '-' "+ - "or '+' character. Long lines can be broken into several lines "+ - "by terminating them with '\'. Lines starting with '#' are "+ - "considered as comments. This option is not recursive: any 'pfile' "+ - "argument appearing in the file is ignored.",null}, - { "tile_parts", "", - "This option specifies the maximum number of packets to have in "+ - "one tile-part. 0 means include all packets in first tile-part "+ - "of each tile","0"}, - { "tiles", " ", - "This option specifies the maximum tile dimensions to use. "+ - "If both dimensions are 0 then no tiling is used.","0 0"}, - { "ref", " ", - "Sets the origin of the image in the canvas system. It sets the "+ - "coordinate of the top-left corner of the image reference grid, "+ - "with respect to the canvas origin","0 0"}, - { "tref", " ", - "Sets the origin of the tile partitioning on the reference grid, "+ - "with respect to the canvas origin. The value of 'x' ('y') "+ - "specified can not be larger than the 'x' one specified in the ref "+ - "option.","0 0"}, - { "rate", "", - "This is the output bitrate of the codestream in bits per pixel."+ - " When equal to -1, no image information (beside quantization "+ - "effects) is discarded during compression.\n"+ - "Note: In the case where '-file_format' option is used, the "+ - "resulting file may have a larger bitrate.","-1"}, - { "lossless", "[on|off]", - "Specifies a lossless compression for the encoder. This options"+ - " is equivalent to use reversible quantization ('-Qtype "+ - "reversible')"+ - " and 5x3 wavelet filters pair ('-Ffilters w5x3'). Note that "+ - "this option cannot be used with '-rate'. When this option is "+ - "off, the quantization type and the filters pair is defined by "+ - "'-Qtype' and '-Ffilters' respectively.","off"}, - { "i", " [, [, ... ]]", - "Mandatory argument. This option specifies the name of the input "+ - "image files. If several image files are provided, they have to be"+ - " separated by commas in the command line. Supported formats are "+ - "PGM (raw), PPM (raw) and PGX, "+ - "which is a simple extension of the PGM file format for single "+ - "component data supporting arbitrary bitdepths. If the extension "+ - "is '.pgm', PGM-raw file format is assumed, if the extension is "+ - "'.ppm', PPM-raw file format is assumed, otherwise PGX file "+ - "format is assumed. PGM and PPM files are assumed to be 8 bits "+ - "deep. A multi-component image can be specified by either "+ - "specifying several PPM and/or PGX files, or by specifying one "+ - "PPM file.",null}, - { "o", "", - "Mandatory argument. This option specifies the name of the output "+ - "file to which the codestream will be written.",null}, - { "verbose", null, - "Prints information about the obtained bit stream.","on"}, - { "v", "[on|off]", - "Prints version and copyright information.","off"}, - { "u", "[on|off]", - "Prints usage information. "+ - "If specified all other arguments (except 'v') are ignored","off"}, - }; - - /** - * Instantiates an encoder object, width the ParameterList object given as - * argument. It also retrieves the default ParameterList. - * - * @param pl The ParameterList for this decoder (contains also defaults - * values); - * */ - public Encoder(ParameterList pl) { - this.pl = pl; - defpl = pl.get_DefaultParameterList(); - } - - /** - * Returns the exit code of the class. This is only initialized after the - * constructor and when the run method returns. - * - * @return The exit code of the constructor and the run() method. - * */ - public int getExitCode() { - return exitCode; - } - - /** - * Runs the encoder. After completion the exit code is set, a non-zero - * value indicates that an error ocurred. - * - * @see #getExitCode - * */ - public void run() { - boolean verbose; - boolean useFileFormat = false; - boolean pphTile = false; - boolean pphMain = false; - boolean tempSop = false; - boolean tempEph = false; - ImgReader imreader[]; - String inext,infile; - StreamTokenizer stok; - StringTokenizer sgtok; - int ncomp; - boolean ppminput; - Vector imreadervec; - boolean imsigned[]; - BlkImgDataSrc imgsrc; - int i; - int imgcmpidxs[]; - int tw,th; - int refx,refy; - int trefx,trefy; - int pktspertp; - Tiler imgtiler; - //BlkImgDataSrc cursrc; - ForwCompTransf fctransf; - ImgDataConverter converter; - EncoderSpecs encSpec; - ForwardWT dwt; - Quantizer quant; - ROIScaler rois; - EntropyCoder ecoder; - PostCompRateAllocator ralloc; - HeaderEncoder headenc; - CodestreamWriter bwriter; - FileFormatWriter ffw; - String outname; - float rate; - int fileLength; - - try { - - // **** Usage and version **** - try { - // Do we print version information? - if (pl.getBooleanParameter("v")) { - printVersionAndCopyright(); - } - // Do we print usage information? - if (pl.getParameter("u").equals("on")) { - printUsage(); - return; // When printing usage => exit - } - // Do we print info ? - verbose = pl.getBooleanParameter("verbose"); - } catch (StringFormatException e) { - error("An error occured while parsing the arguments:\n"+ - e.get_Message(),1); - if(pl.getParameter("debug").equals("on")) { - error(e.get_StackTrace(), 2); // e.printStackTrace(); - } else { - error("Use '-debug' option for more details",2); - } - return; - } catch (NumberFormatException e) { - error("An error occured while parsing the arguments:\n"+ - e.getMessage(),1); - if(pl.getParameter("debug").equals("on")) { - e.printStackTrace(); - } else { - error("Use '-debug' option for more details",2); - } - return; - } - - // **** Get general parameters **** - - // Check that we have the mandatory parameters - if (pl.getParameter("i") == null) { - error("Mandatory input file is missing (-i option)",2); - return; - } - - if (pl.getParameter("o") == null) { - error("Mandatory output file is missing (-o option)",2); - return; - } - outname = pl.getParameter("o"); - - if (pl.getParameter("file_format").equals("on")) { - useFileFormat = true; - if(pl.getParameter("rate")!=null && - pl.getFloatParameter("rate")!= - defpl.getFloatParameter("rate")) { - warning("Specified bit-rate applies only on the "+ - "codestream but not on the whole file."); - } - } - - if(useFileFormat) { - String outext = null; - String outns = outname; - if(outname.lastIndexOf('.')!=-1) { - outext = outname.substring(outname.lastIndexOf('.'), - outname.length()); - outns = outname.substring(0,outname.lastIndexOf('.')); - } - - if(outext==null || !outext.equalsIgnoreCase(".jp2")) { - if(!pl.getBooleanParameter("disable_jp2_extension")) { - FacilityManager.getMsgLogger(). - printmsg(MsgLogger_Fields.INFO,"JPEG 2000 file names"+ - " end with .jp2 extension when using"+ - " the file format of part 1. This "+ - "extension is automatically"+ - " added by CSJ2K. Use "+ - "'-disable_jp2_extension' to "+ - "disable it."); - - outname = outns+".jp2"; - } - } - } - - if (pl.getParameter("tiles") == null) { - error("No tiles option specified",2); - return; - } - - if (pl.getParameter("pph_tile").equals("on")){ - pphTile = true; - - if(pl.getParameter("Psop").equals("off")){ - pl.Set("Psop","on"); - tempSop = true; - } - if(pl.getParameter("Peph").equals("off")){ - pl.Set("Peph","on"); - tempEph = true; - } - } - - if (pl.getParameter("pph_main").equals("on")){ - pphMain = true; - - if(pl.getParameter("Psop").equals("off")){ - pl.Set("Psop","on"); - tempSop = true; - } - if(pl.getParameter("Peph").equals("off")){ - pl.Set("Peph","on"); - tempEph = true; - } - } - - if(pphTile && pphMain) - error("Can't have packed packet headers in both main and"+ - " tile headers",2); - - if(pl.getBooleanParameter("lossless") && - pl.getParameter("rate")!=null && - pl.getFloatParameter("rate")!=defpl.getFloatParameter("rate")) - throw new IllegalArgumentException("Cannot use '-rate' and "+ - "'-lossless' option at "+ - " the same time."); - - if (pl.getParameter("rate") == null) { - error("Target bitrate not specified",2); - return; - } - try { - rate = pl.getFloatParameter("rate"); - if(rate==-1) { - rate = Float.MAX_VALUE; - } - } catch (NumberFormatException e) { - error("Invalid value in 'rate' option: "+ - pl.getParameter("rate"),2); - if(pl.getParameter("debug").equals("on")) { - e.printStackTrace(); - } else { - error("Use '-debug' option for more details",2); - } - return; - } - try { - pktspertp = pl.getIntParameter("tile_parts"); - if(pktspertp != 0){ - if(pl.getParameter("Psop").equals("off")){ - pl.Set("Psop","on"); - tempSop = true; - } - if(pl.getParameter("Peph").equals("off")){ - pl.Set("Peph","on"); - tempEph = true; - } - } - } catch (NumberFormatException e) { - error("Invalid value in 'tile_parts' option: "+ - pl.getParameter("tile_parts"),2); - if(pl.getParameter("debug").equals("on")) { - e.printStackTrace(); - } else { - error("Use '-debug' option for more details",2); - } - return; - } - - // **** ImgReader **** - sgtok = new StringTokenizer(pl.getParameter("i"),","); - ncomp = 0; - ppminput = false; - imreadervec = new Vector(); - int nTokens = sgtok.countTokens(); - - for(int n=0; n 0) { - error("With PPM input format only 1 input "+ - "file can be specified",2); - return; - } - imreadervec.addElement(new ImgReaderPPM(infile)); - ppminput = true; - ncomp += 3; - } else { // Should be PGX - imreadervec.addElement(new ImgReaderPGX(infile)); - ncomp+=1; - } - } catch (System.IO.IOException e) { - error("Could not open or read from file "+infile + - ((e.get_Message() != null) ? - (":\n"+e.get_Message()) : ""),3); - if(pl.getParameter("debug").equals("on")) { - error(e.get_StackTrace(), 2); //e.printStackTrace(); - } else { - error("Use '-debug' option for more details",2); - } - return; - } - finally { - if (exitCode != 0) { - // Close the other files - while (imreadervec.size() > 0) { - try { - ((ImgReader)imreadervec. - elementAt(imreadervec.size()-1)).close(); - imreadervec. - removeElementAt(imreadervec.size()-1); - } catch (Exception e) { } - } - } - } - } - imreader = new ImgReader[imreadervec.size()]; - imreadervec.copyInto(imreader); - imreadervec.removeAllElements(); - imreadervec = null; - imsigned = new boolean[ncomp]; - - // **** ImgDataJoiner (if needed) **** - if (ppminput || ncomp == 1) { // Just one input - imgsrc = imreader[0]; - for (i=0; i join all readers into 1 - imgcmpidxs = new int[ncomp]; - for (i=0; i refx || trefy > refy) { - throw new IllegalArgumentException("Invalid value in 'tref' "+ - "option "); - } - - // Instantiate tiler - try { - imgtiler = new Tiler(imgsrc,refx,refy,trefx,trefy,tw,th); - } catch (IllegalArgumentException e) { - error("Could not tile image"+ - ((e.getMessage() != null) ? - (":\n"+e.getMessage()) : ""),2); - if(pl.getParameter("debug").equals("on")) { - e.printStackTrace(); - } else { - error("Use '-debug' option for more details",2); - } - return; - } - int ntiles = imgtiler.getNumTiles(); - - // **** Encoder specifications **** - encSpec = new EncoderSpecs(ntiles, ncomp, imgsrc, pl); - - // **** Component transformation **** - if (ppminput && pl.getParameter("Mct") != null && - pl.getParameter("Mct").equals("off")) { - FacilityManager.getMsgLogger(). - printmsg(MsgLogger_Fields.WARNING, - "Input image is RGB and no color transform has "+ - "been specified. Compression performance and "+ - "image quality might be greatly degraded. Use "+ - "the 'Mct' option to specify a color transform"); - } - try { - fctransf = new ForwCompTransf(imgtiler,encSpec); - } catch (IllegalArgumentException e) { - error("Could not instantiate forward component "+ - "transformation"+ - ((e.getMessage() != null) ? - (":\n"+e.getMessage()) : ""),2); - if(pl.getParameter("debug").equals("on")) { - e.printStackTrace(); - } else { - error("Use '-debug' option for more details",2); - } - return; - } - - // **** ImgDataConverter **** - converter = new ImgDataConverter(fctransf); - - - // **** ForwardWT **** - try { - dwt = ForwardWT.createInstance(converter,pl,encSpec); - } catch (IllegalArgumentException e) { - error("Could not instantiate wavelet transform"+ - ((e.getMessage() != null) ? - (":\n"+e.getMessage()) : ""),2); - if(pl.getParameter("debug").equals("on")) { - e.printStackTrace(); - } else { - error("Use '-debug' option for more details",2); - } - return; - } - - // **** Quantizer **** - try{ - quant = Quantizer.createInstance(dwt,encSpec); - } catch(IllegalArgumentException e) { - error("Could not instantiate quantizer"+ - ((e.getMessage() != null) ? - (":\n"+e.getMessage()) : ""),2); - if(pl.getParameter("debug").equals("on")) { - e.printStackTrace(); - } else { - error("Use '-debug' option for more details",2); - } - return; - } - - // **** ROIScaler **** - try{ - rois = ROIScaler.createInstance(quant,pl,encSpec); - } catch (IllegalArgumentException e) { - error("Could not instantiate ROI scaler"+ - ((e.getMessage() != null) ? - (":\n"+e.getMessage()) : ""),2); - if(pl.getParameter("debug").equals("on")) { - e.printStackTrace(); - } else { - error("Use '-debug' option for more details",2); - } - return; - } - - // **** EntropyCoder **** - try { - ecoder = EntropyCoder.createInstance(rois,pl,encSpec.cblks, - encSpec.pss,encSpec.bms, - encSpec.mqrs,encSpec.rts, - encSpec.css,encSpec.sss, - encSpec.lcs,encSpec.tts); - } catch (IllegalArgumentException e) { - error("Could not instantiate entropy coder"+ - ((e.getMessage() != null) ? - (":\n"+e.getMessage()) : ""),2); - if(pl.getParameter("debug").equals("on")) { - e.printStackTrace(); - } else { - error("Use '-debug' option for more details",2); - } - return; - } - - // **** CodestreamWriter **** - try { - // Rely on rate allocator to limit amount of data - bwriter = new FileCodestreamWriter(outname,Integer.MAX_VALUE); - } catch (System.IO.IOException e) { - error("Could not open output file"+ - ((e.get_Message() != null) ? - (":\n"+e.get_Message()) : ""),2); - if(pl.getParameter("debug").equals("on")) { - error(e.get_StackTrace(), 2); //e.printStackTrace(); - } else { - error("Use '-debug' option for more details",2); - } - return; - } - - // **** Rate allocator **** - try { - ralloc = PostCompRateAllocator.createInstance(ecoder,pl,rate, - bwriter,encSpec); - } catch (IllegalArgumentException e) { - error("Could not instantiate rate allocator"+ - ((e.getMessage() != null) ? - (":\n"+e.getMessage()) : ""),2); - if(pl.getParameter("debug").equals("on")) { - e.printStackTrace(); - } else { - error("Use '-debug' option for more details",2); - } - return; - } - - // **** HeaderEncoder **** - headenc = new HeaderEncoder(imgsrc,imsigned,dwt,imgtiler,encSpec, - rois,ralloc,pl); - ralloc.set_HeaderEncoder(headenc); - - // **** Write header to be able to estimate header overhead **** - headenc.encodeMainHeader(); - - // **** Initialize rate allocator, with proper header - // overhead. This will also encode all the data **** - ralloc.initialize(); - - // **** Write header (final) **** - headenc.reset(); - headenc.encodeMainHeader(); - - // Insert header into the codestream - bwriter.commitBitstreamHeader(headenc); - - // **** Report info **** - if (verbose) { - // Print target rate info - if(pl.getFloatParameter("rate")!=-1) { - FacilityManager.getMsgLogger(). - println("Target bitrate = "+rate+" bpp (i.e. "+ - (int)(rate*imgsrc.get_ImgWidth() - *imgsrc.get_ImgHeight()/8)+ " bytes)", - 4,6); - } - } - - // **** Now do the rate-allocation and write result **** - ralloc.runAndWrite(); - - // **** Done **** - bwriter.close(); - - // **** Calculate file length **** - fileLength = bwriter.get_Length(); - - // **** Tile-parts and packed packet headers **** - if(pktspertp>0 || pphTile || pphMain) { - //int headInc; - try { - CodestreamManipulator cm = new - CodestreamManipulator(outname,ntiles,pktspertp, - pphMain,pphTile,tempSop,tempEph); - fileLength += cm.doCodestreamManipulation(); - //String res=""; - if(pktspertp>0) { - FacilityManager. - getMsgLogger().println("Created tile-parts "+ - "containing at most "+ - pktspertp+ - " packets per tile.",4,6); - } - if(pphTile) { - FacilityManager.getMsgLogger(). - println("Moved packet headers "+ - "to tile headers",4,6); - } - if(pphMain) { - FacilityManager.getMsgLogger(). - println("Moved packet headers "+ - "to main header",4,6); - } - } catch(System.IO.IOException e) { - error("Error while creating tileparts or packed packet"+ - " headers"+ - ((e.get_Message() != null) ? - (":\n"+e.get_Message()) : ""),2); - if(pl.getParameter("debug").equals("on")) { - error(e.get_StackTrace(), 2); //e.printStackTrace(); - } else { - error("Use '-debug' option for more details",2); - } - return; - } - } - - // **** File Format **** - if(useFileFormat) { - try{ - int nc= imgsrc.get_NumComps() ; - int[] bpc=new int[nc]; - for(int comp = 0; comp=0; i--) - vec.addElement(str[i]); - - str = ForwCompTransf.get_ParameterInfo(); - if(str!=null) - for(int i=str.length-1; i>=0; i--) - vec.addElement(str[i]); - - str = AnWTFilter.get_ParameterInfo(); - if(str!=null) - for(int i=str.length-1; i>=0; i--) - vec.addElement(str[i]); - - str = ForwardWT.get_ParameterInfo(); - if(str!=null) - for(int i=str.length-1; i>=0; i--) - vec.addElement(str[i]); - - str = Quantizer.get_ParameterInfo(); - if(str!=null) - for(int i=str.length-1; i>=0; i--) - vec.addElement(str[i]); - - str = ROIScaler.get_ParameterInfo(); - if(str!=null) - for(int i=str.length-1; i>=0; i--) - vec.addElement(str[i]); - - str = EntropyCoder.get_ParameterInfo(); - if(str!=null) - for(int i=str.length-1; i>=0; i--) - vec.addElement(str[i]); - - str = HeaderEncoder.get_ParameterInfo(); - if(str!=null) - for(int i=str.length-1; i>=0; i--) - vec.addElement(str[i]); - - str = PostCompRateAllocator.get_ParameterInfo(); - if(str!=null) - for(int i=str.length-1; i>=0; i--) - vec.addElement(str[i]); - - str = PktEncoder.get_ParameterInfo(); - if(str!=null) - for(int i=str.length-1; i>=0; i--) - vec.addElement(str[i]); - - str = new String[vec.size()][4]; - if(str!=null) - for(int i=str.length-1; i>=0; i--) - str[i] = (String[])vec.elementAt(i); - - return str; - } - - /** - * Prints the error message 'msg' to standard err, prepending "ERROR" to - * it, and sets the exitCode to 'code'. An exit code different than 0 - * indicates that there where problems. - * - * @param msg The error message - * - * @param code The exit code to set - * */ - private void error(String msg, int code) { - exitCode = code; - FacilityManager.getMsgLogger().printmsg(MsgLogger_Fields.ERROR,msg); - } - - /** - * Prints the warning message 'msg' to standard err, prepending "WARNING" - * to it. - * - * @param msg The error message - * */ - private void warning(String msg) { - FacilityManager.getMsgLogger().printmsg(MsgLogger_Fields.WARNING,msg); - } - - /** - * Prints version and copyright information to stdout, using the - * MsgPrinter. - * */ - private void printVersionAndCopyright() { - FacilityManager.getMsgLogger() - .println("JJ2000's JPEG 2000 Encoder\n",2,4); - FacilityManager.getMsgLogger() - .println("Version: "+JJ2KInfo.version+"\n",2,4); - FacilityManager.getMsgLogger() - .println("Copyright:\n\n"+JJ2KInfo.copyright+"\n",2,4); - FacilityManager.getMsgLogger() - .println("Send bug reports to: "+JJ2KInfo.bugaddr+"\n",2,4); - } - - /** - * Prints the usage information to stdout. The usage information - * is written for all modules in the encoder. - * */ - private void printUsage() { - //String opts[][]; - //int i; - MsgLogger ml = FacilityManager.getMsgLogger(); - - ml.println("Usage:",0,0); - ml.println("JJ2KEncoder args...\n",10,12); - ml.println("The exit code of the encoder is non-zero "+ - "if an error occurs.\n",2,4); - ml.println("Note: Many encoder modules accept tile-component "+ - "specific parameters. These parameters must be provided "+ - "according to the pattern:\n \"[] "+ - "\" (repeated as many time as needed). ",2,4); - ml.println("\n"+ - " respect the following policy"+ - " according to the degree of priority: \n"+ - " (1) t c : Tile-component specification.\n"+ - " (2) t : Tile specification.\n"+ - " (3) c : Component specification\n"+ - " (4) : Default specification.\n\n"+ - "Where the priorities of the specifications are:\n"+ - "(1) > (2) > (3) > (4), (\'>\' means \"overrides\")\n",2,4); - ml.println(" : ',' separates indexes, '-' separates bounds of "+ - "indexes list. (ex: 0,2-4 means indexes 0,2,3 and "+ - " 4).\n",2,4); - ml.println("The following arguments are recognized:",2,4); - - // Info of each encoder parameter - printParamInfo(ml,getAllParameters()); - - // Print bug-report address - FacilityManager.getMsgLogger().println("\n\n",0,0); - FacilityManager.getMsgLogger(). - println("Send bug reports to: "+JJ2KInfo.bugaddr+"\n",2,4); - } - - /** - * Prints the parameters in 'pinfo' to the provided output, 'out', showing - * the existing defaults. The 'pinfo' argument is a 2D String array. The - * first dimension contains String arrays, 1 for each parameter. Each of - * these arrays has 3 elements, the first element is the parameter name, - * the second element is the synopsis for the parameter and the third one - * is a long description of the parameter. If the synopsis or description - * is 'null' then no synopsis or description is printed, respectively. If - * there is a default value for a parameter it is also printed. - * - * @param out Where to print. - * - * @param pinfo The parameter information to write. - * */ - private void printParamInfo(MsgLogger out, String pinfo[][]) { - String defval; - - if (pinfo == null) { - return; - } - - for (int i=0; iThe image data is not rescaled to fit the available dynamic range (not - * even the alpha values for RGBA data).

- * - *

BlkImgDataSrc sources with 1, 3 and 4 components are supported. If 1, it - * is assumed to be gray-level data. If 3 it is assumed to be RGB data, in - * that order. If 4 it is assumed to be RGBA data (RGB plus alpha plane), in - * that order. All components must have the same size.

- * - * @see ImageProducer - * @see BlkImgDataSrc - * */ -public class BlkImgDataSrcImageProducer implements ImageProducer { - - /** The list of image consumers for this image producer */ - private volatile Vector consumers; - - /** The source of image data */ - private BlkImgDataSrc src; - - /** The type of image: GRAY, RGB or RGBA */ - private int type; - - /** The gray-level image type (256 levels). For this type the source of - * image data must have only 1 component. */ - private static final int GRAY = 0; - - /** The color image type (24 bits RGB). No alpha plane. For this type the - * source of image data must have 3 components, which are considered to be - * R, G and B, in that order */ - private static final int RGB = 1; - - /** The color image type (32 bits RGBA). For this type the source of image - * data must have 4 components, which are considered to be R, G, B and A, - * in that order. */ - private static final int RGBA = 2; - - /** The default color model (0xAARRGGBB) used in Java */ - private static final ColorModel cm = ColorModel.getRGBdefault(); - - /** - * Creates an image producer which uses 'src' as the source of image - * data. If 'once' is true then the image is produced only once. - * - * @param src The source of image data. - * - * @param once If the image is to be produced only once or not. - * */ - public BlkImgDataSrcImageProducer(BlkImgDataSrc src) { - int i; - - // Check for image type - switch (src.get_NumComps()) { - case 1: - type = GRAY; - break; - case 3: - type = RGB; - break; - case 4: - type = RGBA; - break; - default: - throw new IllegalArgumentException("Only 1, 3, and 4 components "+ - "supported"); - } - // Check component sizes and bit depths - int imh = src.getCompImgHeight(0); - int imw = src.getCompImgWidth(0); - for(i=src.get_NumComps()-1; i>=0; i--) { - if(src.getCompImgHeight(i) != imh || - src.getCompImgWidth(i) != imw) { - throw new IllegalArgumentException("All components must have "+ - "the same dimensions and "+ - "no subsampling"); - } - if(src.getNomRangeBits(i)>8) { - throw new IllegalArgumentException("Depths greater than 8 "+ - "bits per component is "+ - "not supported"); - } - } - this.src = src; - consumers = new Vector(); - } - - /** - * Returns an Image object given an BlkImgDataSrc source. It will use a - * new J2KImageProducer object as the underlying image producer. - * - *

This method uses the JVM default Toolkit, which might not be what it - * is desired.

- * - * @param src The source of image data. - * - * @return An image which has a J2KImageProducer object as the underlying - * image producer. - * */ - public static Image createImage(BlkImgDataSrc src) { - // Use the system toolkit's createImage method - return Toolkit.getDefaultToolkit(). - createImage(new BlkImgDataSrcImageProducer(src)); - } - - /** - * Returns an Image object given an BlkImgDataSrc source. It will use a - * new J2KImageProducer object as the underlying image producer. - * - *

This method uses the component's toolkit. The toolkit of a component - * may change if it is moved from one frame to another one, since it is - * the frame that controls which toolkit is used.

- * - * @param src The source of image data. - * - * @param c The component to use to generate the 'Image' object from the - * 'ImageProducer'. - * - * @return An image which has a J2KImageProducer object as the underlying - * image producer. - * */ - public static Image createImage(BlkImgDataSrc src, Component c){ - // Use the component's toolkit createImage method - return c.getToolkit(). - createImage(new BlkImgDataSrcImageProducer(src)); - } - - /** - * Registers an image consumer with this image producer. The delivery of - * image data does not start immediately. It will only start after the - * next call to the startProduction() method. - * - * @param ic The image consumer to which image data has to be delivered. - * - * @see #startProduction - * */ - public final synchronized void addConsumer(ImageConsumer ic) { - if (ic != null && !consumers.contains(ic)) { - consumers.addElement(ic); - } - } - - /** - * This method determines if the given image consumer, 'ic', is registered - * with this image producer. - * - * @param ic The image consumer to test. - * - * @return True if 'ic' is registered with this image producer, false - * otherwise. - * */ - public boolean isConsumer(ImageConsumer ic) { - return consumers.contains(ic); - } - - /** - * Removes the given image consumer 'ic' from the list of consumers - * registered with this producer. This image producer will stop sending - * pixel data to 'ic' as soon as it is feasible. The method call is - * ignored if 'ic' has not been registered with this image producer. - * - * @param ic The image consumer to be removed - * */ - public synchronized void removeConsumer(ImageConsumer ic) { - consumers.removeElement(ic); - } - - /** - * Registers the given ImageConsumer object as a consumer and starts an - * immediate reconstruction of the image data which will then be delivered - * to this consumer and any other consumer which may have already been - * registered with the producer. - * - *

Delivery is performed in "parallel" to all the registered image - * consumers. By "parallel" it is meant that each line of the image is - * delivered to all consumers before delivering the next line.

- * - *

If the data returned by the BlkImgDataSrc source happens to be - * progressive (see BlkImgDataSrc and DataBlk) then the abort condition is - * sent to the image consumers and no further data is delivered.

- * - *

Once all the data is sent to a consumer this one is automatically - * removed from the list of registered ones, unless an abort happens.

- * - *

To start the BlkImgDataSrc is set to tile (0,0), and the tiles are - * produced in raster sacn order. Once the last tile is produced, - * setTile(0,0) is called again, which signals that we are done with the - * current tile, which might free up resources.

- * - * @param ic The image consumer to register - * */ - public void startProduction(ImageConsumer ic) { - int i,k1,k2,k3,k4,l; // counters - int tmp1,tmp2,tmp3,tmp4; // temporary storage for sample values - int mv1=0,mv2,mv3,mv4; // max value for each component - int ls1=0,ls2,ls3,ls4; // level shift for each component - int fb1=0,fb2,fb3,fb4; // fractional bits for each component - int[] data1,data2,data3,data4; // references to data buffers - final ImageConsumer[] cons; // image consumers cache - int hints; // hints to image consumers - int height; // image height - int width; // image width - int pixbuf[]; // line buffer for pixel data - DataBlkInt db1,db2,db3,db4; // data-blocks to request data from src - int tOffx, tOffy; // Active tile offset - boolean prog; // Flag for progressive data - Coord nT = src.getNumTiles(null); - int tIdx = 0; // index of the current tile - - // Register ic - if (ic != null) { - addConsumer(ic); - } - - // Set the cache for the consumers - synchronized (this) { - // synchronized to avoid addition or deletion of consumers while - // copying them to cache - cons = new ImageConsumer[consumers.size()]; - consumers.copyInto(cons); - } - - if(src == null) { - // We cant't render with no source - for (i=cons.length-1; i>=0; i--) { - cons[i].imageComplete(ImageConsumer.IMAGEERROR); - } - return; // can not continue processing - } - - // Initialize - pixbuf = null; // to keep compiler happy - ls2 = fb2 = mv2 = 0; // to keep compiler happy - ls3 = fb3 = mv3 = 0; // to keep compiler happy - ls4 = fb4 = mv4 = 0; // to keep compiler happy - db1 = db2 = db3 = db4 = null; // to keep compiler happy - switch (type) { - case RGBA: - db4 = new DataBlkInt(); // Alpha plane - ls4 = 1<<(src.getNomRangeBits(3)-1); - mv4 = (1<=0; i--) { - cons[i].setColorModel(cm); - cons[i].setDimensions(src.getCompImgWidth(0), - src.getCompImgHeight(0)); - cons[i].setHints(hints); - } - - // Start the data delivery to the cached consumers tile by tile - for(int y=0; y=0; i--) { - cons[i].imageComplete(ImageConsumer.IMAGEABORTED); - } - return; // can not continue processing - } - // Put pixel data in line buffer - switch (type) { - case GRAY: - data1 = db1.data; - k1 = db1.offset+width-1; - for (i=width-1; i>=0; i--) { - tmp1 = (data1[k1--]>>fb1)+ls1; - tmp1 = (tmp1 < 0) ? 0 : - ((tmp1 > mv1) ? mv1 : tmp1); - pixbuf[i] = (0xFF<<24)|(tmp1<<16)|(tmp1<<8)|tmp1; - } - break; - case RGB: - data1 = db1.data; // red - data2 = db2.data; // green - data3 = db3.data; // blue - k1 = db1.offset+width-1; - k2 = db2.offset+width-1; - k3 = db3.offset+width-1; - for (i=width-1; i>=0; i--) { - tmp1 = (data1[k1--]>>fb1)+ls1; - tmp1 = (tmp1 < 0) ? 0 : - ((tmp1 > mv1) ? mv1 : tmp1); - tmp2 = (data2[k2--]>>fb2)+ls2; - tmp2 = (tmp2 < 0) ? 0 : - ((tmp2 > mv2) ? mv2 : tmp2); - tmp3 = (data3[k3--]>>fb3)+ls3; - tmp3 = (tmp3 < 0) ? 0 : - ((tmp3 > mv3) ? mv3 : tmp3); - pixbuf[i] = (0xFF<<24)|(tmp1<<16)|(tmp2<<8)|tmp3; - } - break; - case RGBA: - data1 = db1.data; // red - data2 = db2.data; // green - data3 = db3.data; // blue - data4 = db4.data; // alpha - k1 = db1.offset+width-1; - k2 = db2.offset+width-1; - k3 = db3.offset+width-1; - k4 = db4.offset+width-1; - for (i=width-1; i>=0; i--) { - tmp1 = (data1[k1--]>>fb1)+ls1; - tmp1 = (tmp1 < 0) ? 0 : - ((tmp1 > mv1) ? mv1 : tmp1); - tmp2 = (data2[k2--]>>fb2)+ls2; - tmp2 = (tmp2 < 0) ? 0 : - ((tmp2 > mv2) ? mv2 : tmp2); - tmp3 = (data3[k3--]>>fb3)+ls3; - tmp3 = (tmp3 < 0) ? 0 : - ((tmp3 > mv3) ? mv3 : tmp3); - tmp4 = (data4[k4--]>>fb4)+ls4; - tmp4 = (tmp4 < 0) ? 0 : - ((tmp4 > mv4) ? mv4 : tmp4); - pixbuf[i] = (tmp4<<24)|(tmp1<<16)|(tmp2<<8)|tmp3; - } - break; - } - // Send the line data to the consumers - for (i=cons.length-1; i>=0; i--) { - cons[i].setPixels(tOffx,tOffy+l,width,1,cm,pixbuf, - 0,width); - } - } - } // End loop on horizontal tiles - } // End loop on vertical tiles - - // Signal that this frame is complete. This is so that display of the - // last tile occurs as soon as possible. When calling with - // STATICIMAGEDONE the ImageConsumer might do some cleanup that will - // take a considerable amount of time on large images, this is why we - // first signal the frame as done (even though there is only one). - for (i=cons.length-1; i>=0; i--) { - cons[i].imageComplete(ImageConsumer.SINGLEFRAMEDONE); - } - // Signal that image is complete - for (i=cons.length-1; i>=0; i--) { - cons[i].imageComplete(ImageConsumer.STATICIMAGEDONE); - } - // Remove the consumers since all the data has been sent - synchronized (this) { - for (i=cons.length-1; i>=0; i--) { - consumers.removeElement(cons[i]); - } - } - } - - /** - * Starts the delivery of pixel data in the top-down letf-right order to - * the image consumer 'ic'. The TOPDOWNLEFTRIGHT hint is set in the image - * consumer on delivery. - * - *

Currently this call is ignored (which is perfectly legal according - * to the ImageProducer interface specification).

- * - * @param ic The image consumer to which the data is sent in top-down, - * left-right order. - * */ - public void requestTopDownLeftRightResend(ImageConsumer ic) { } -} diff --git a/CSJ2K/jj2kencoder/disp/ExitHandler.jsl b/CSJ2K/jj2kencoder/disp/ExitHandler.jsl deleted file mode 100644 index 0a4ebe77..00000000 --- a/CSJ2K/jj2kencoder/disp/ExitHandler.jsl +++ /dev/null @@ -1,71 +0,0 @@ -/* - * CVS identifier: - * - * $Id: ExitHandler.java,v 1.6 2000/09/05 09:21:59 grosbois Exp $ - * - * Class: ExitHandler - * - * Description: Handles exiting from window close event - * - * - * - * COPYRIGHT: - * - * This software module was originally developed by Raphaël Grosbois and - * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel - * Askelöf (Ericsson Radio Systems AB); and Bertrand Berthelot, David - * Bouchard, Félix Henry, Gerard Mozelle and Patrice Onno (Canon Research - * Centre France S.A) in the course of development of the JPEG2000 - * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This - * software module is an implementation of a part of the JPEG 2000 - * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio - * Systems AB and Canon Research Centre France S.A (collectively JJ2000 - * Partners) agree not to assert against ISO/IEC and users of the JPEG - * 2000 Standard (Users) any of their rights under the copyright, not - * including other intellectual property rights, for this software module - * with respect to the usage by ISO/IEC and Users of this software module - * or modifications thereof for use in hardware or software products - * claiming conformance to the JPEG 2000 Standard. Those intending to use - * this software module in hardware or software products are advised that - * their use may infringe existing patents. The original developers of - * this software module, JJ2000 Partners and ISO/IEC assume no liability - * for use of this software module or modifications thereof. No license - * or right to this software module is granted for non JPEG 2000 Standard - * conforming products. JJ2000 Partners have full right to use this - * software module for his/her own purpose, assign or donate this - * software module to any third party and to inhibit third parties from - * using this software module for non JPEG 2000 Standard conforming - * products. This copyright notice must be included in all copies or - * derivative works of this software module. - * - * Copyright (c) 1999/2000 JJ2000 Partners. - * - * - * - */ -package jj2000.disp; - -import jj2000.j2k.decoder.*; - -import java.awt.event.*; -import java.awt.*; - - -/** This class implements the WindowHandler for the ImageFrames */ -public class ExitHandler extends WindowAdapter { - /** The decoder instance */ - private Decoder dec; - - /** - * Class constructor. Keep a reference to the decoder to properly - * exit when windowClosing method is called. */ - public ExitHandler(Decoder dec){ - this.dec = dec; - } - - - /** Close the window and exit the application */ - public void windowClosing(WindowEvent evt) { - dec.exit(); - } -} diff --git a/CSJ2K/jj2kencoder/disp/ImgKeyListener.jsl b/CSJ2K/jj2kencoder/disp/ImgKeyListener.jsl deleted file mode 100644 index ca3eed4a..00000000 --- a/CSJ2K/jj2kencoder/disp/ImgKeyListener.jsl +++ /dev/null @@ -1,274 +0,0 @@ -/* - * CVS identifier: - * - * $Id: ImgKeyListener.java,v 1.8 2000/09/21 16:12:41 dsanta Exp $ - * - * Class: ImgKeyListener - * - * Description: Handles the key events for zooming and scrolling - * an image displayed in an ImgScrollPane. - * - * - * - * COPYRIGHT: - * - * This software module was originally developed by Raphaël Grosbois and - * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel - * Askelöf (Ericsson Radio Systems AB); and Bertrand Berthelot, David - * Bouchard, Félix Henry, Gerard Mozelle and Patrice Onno (Canon Research - * Centre France S.A) in the course of development of the JPEG2000 - * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This - * software module is an implementation of a part of the JPEG 2000 - * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio - * Systems AB and Canon Research Centre France S.A (collectively JJ2000 - * Partners) agree not to assert against ISO/IEC and users of the JPEG - * 2000 Standard (Users) any of their rights under the copyright, not - * including other intellectual property rights, for this software module - * with respect to the usage by ISO/IEC and Users of this software module - * or modifications thereof for use in hardware or software products - * claiming conformance to the JPEG 2000 Standard. Those intending to use - * this software module in hardware or software products are advised that - * their use may infringe existing patents. The original developers of - * this software module, JJ2000 Partners and ISO/IEC assume no liability - * for use of this software module or modifications thereof. No license - * or right to this software module is granted for non JPEG 2000 Standard - * conforming products. JJ2000 Partners have full right to use this - * software module for his/her own purpose, assign or donate this - * software module to any third party and to inhibit third parties from - * using this software module for non JPEG 2000 Standard conforming - * products. This copyright notice must be included in all copies or - * derivative works of this software module. - * - * Copyright (c) 1999/2000 JJ2000 Partners. - * - * - * - */ -package jj2000.disp; - -import jj2000.j2k.decoder.*; - -import java.awt.event.*; -import java.awt.*; - -/** - * This class implements the listener for keyboard events for the JJ2000 - * decoder that displays in a ImgScrollPane. - * - *

The following key sequences are defined: - *
- * - : scroll image up
- * - : scroll image down
- * - : scroll image left
- * - : scroll image right
- * - : scroll image up by a vertical block increment
- * - : scroll image down by a vertical block increment
- * - 'Q' or 'q': exit the application
- * - '-': zoom out by 2
- * - '=' or '+': zoom in by 2
- * - '1': display at a zoom of 1
- * - 'Ctrl-C': exit the application
- * - *

The amount by which the arrows scroll the image is determined by the - * modifier keys. If the Ctrl key is held down, the block increment will be - * used, otherwise the unit increment will. If the Shift key is held down then - * the increment is multiplied by ACCEL_FACTOR. That is the Ctrl key selects - * between unit and block increments, while the Shift key selects between - * normal and accelerated mode. - * - * */ -public class ImgKeyListener extends KeyAdapter { - - /** Frame used to display tools */ - Frame helpFrame = null; - - /** The component where the image is displayed */ - ImgScrollPane isp; - - /** Decoder instance */ - Decoder dec; - - /** The acceleration factor when the shift key is pressed: 10 */ - public static final int ACCEL_FACTOR = 10; - - /** - * Instantiate a new ImgKeyListener that will work on the specified - * ImgScrollPane. - * - * @param isp The image scroll pane on which the actions should - * operate. - * - * @param dec The decoder instance - * */ - public ImgKeyListener(ImgScrollPane isp,Decoder dec) { - this.isp = isp; - this.dec = dec; - } - - /** - * Hanldes the keyPressed events. Normal keys are not treated here because - * some don't have a defined keycode (as incredible as it might seem!). - * - * @param evt The key event to process. - * */ - public void keyPressed(KeyEvent evt) { - Adjustable adj; - - // Do nothing if consumed - if (evt.isConsumed()) return; - - // Perform action based on key - switch (evt.getKeyCode()) { - case KeyEvent.VK_LEFT: // Move left - adj = isp.getHAdjustable(); - adj.setValue(adj.getValue()-calcIncrement(evt,adj)); - break; - case KeyEvent.VK_RIGHT: // Move right - adj = isp.getHAdjustable(); - adj.setValue(adj.getValue()+calcIncrement(evt,adj)); - break; - case KeyEvent.VK_UP: // Move up - adj = isp.getVAdjustable(); - adj.setValue(adj.getValue()-calcIncrement(evt,adj)); - break; - case KeyEvent.VK_DOWN: // Move down - adj = isp.getVAdjustable(); - adj.setValue(adj.getValue()+calcIncrement(evt,adj)); - break; - case KeyEvent.VK_PAGE_UP: // Move up by a page - adj = isp.getVAdjustable(); - adj.setValue(adj.getValue()-adj.getBlockIncrement()); - break; - case KeyEvent.VK_PAGE_DOWN: // Move down by a page - adj = isp.getVAdjustable(); - adj.setValue(adj.getValue()+adj.getBlockIncrement()); - break; - case KeyEvent.VK_C: - // Exit if ctrl is pressed - if (evt.isControlDown()) { - dec.exit(); - } - break; - default: - return; - } - - // Consume the event so nothing else is done - evt.consume(); - } - - /** - * Handles the key typed event. Normal (i.e. "text") keys are handled - * here. - * - * @param evt The key event to process. - * */ - public void keyTyped(KeyEvent evt) { - - // Do nothing if consumed - if (evt.isConsumed()) return; - - // Perform action based on key - switch (evt.getKeyChar()) { - case '+': - case '=': - // Zoom in - isp.zoom(2f); - break; - case '-': - // Zoom out - isp.zoom(0.5f); - break; - case '1': - // Set zoom to 1 - isp.setZoom(1f); - break; - case 'q': - case 'Q': - // Exit - dec.exit(); - break; - case 'h': - case 'H': - // Help display - if(helpFrame==null){ - helpFrame = new Frame("Tools"); - helpFrame.add(getHelp()); - helpFrame.pack(); - helpFrame.setResizable(false); - helpFrame.addWindowListener(new WindowAdapter(){ - public void windowClosing(WindowEvent e){ - helpFrame.setVisible(false); - } - }); - } - if(helpFrame.isVisible()) - helpFrame.setVisible(false); - else - helpFrame.setVisible(true); - break; - default: - return; - } - - // Consume the event so nothing else is done - evt.consume(); - } - - /** - * Returns the increment based on the modifier keys of the KeyEvent. If - * control is down then the Adjustable block increment is used, otherwise - * the unit one is used. If the shift key is down the increment is - * multiplied by ACCEL_FACTOR. - * - * @param evt The KeyEvent fom where to obtain the modifiers - * - * @param adj The Adjustable from where to obtain the increments - * */ - private int calcIncrement(KeyEvent evt, Adjustable adj) { - int incr; - // Control selects block instead of unit - if (evt.isControlDown()) { - incr = adj.getBlockIncrement(); - } - else { - incr = adj.getUnitIncrement(); - } - // Shift accelerates by ACCEL_FACTOR - if (evt.isShiftDown()) { - incr *= ACCEL_FACTOR; - } - return incr; - } - - /** - * Create a help TextArea concerning the tools associated with keys. - * - * @return The help TextArea - * - */ - private static TextArea getHelp(){ - TextArea ta = new TextArea("",17,61,TextArea.SCROLLBARS_NONE); - ta.setEditable(false); - ta.setFont(new Font("Monospaced",Font.PLAIN,10)); - - ta.append("The following key sequences are recognized in the \n"+ - "image display window:\n\n"); - ta.append("'-' : zoom out by a factor of 2.\n"); - ta.append("'+' or '=' : zoom in by a factor of 2.\n"); - ta.append("'1' : set the zoom factor to 1 (i.e. no zoom).\n"); - ta.append(" : scroll the image up by one pixel.\n"); - ta.append(" : scroll the image down by one pixel.\n"); - ta.append(" : scroll the image left by one pixel.\n"); - ta.append(" : scroll the image right by one pixel.\n"); - ta.append(" : scroll the image up by a whole page.\n"); - ta.append(" : scroll the image down by a whole page.\n"); - ta.append("Ctrl+ : scroll in the direction of the arrow a \n"+ - " page at a time instead of a pixel at a time.\n"); - ta.append("Shift+ : accelerate the scroll speed by 10.\n"); - ta.append("'Q' or 'q' : exit the application.\n"); - ta.append("'Ctrl-C' : exit the application.\n"); - - return ta; - } -} diff --git a/CSJ2K/jj2kencoder/disp/ImgMouseListener.jsl b/CSJ2K/jj2kencoder/disp/ImgMouseListener.jsl deleted file mode 100644 index 5d82dbaf..00000000 --- a/CSJ2K/jj2kencoder/disp/ImgMouseListener.jsl +++ /dev/null @@ -1,129 +0,0 @@ -/* - * CVS identifier: - * - * $Id: ImgMouseListener.java,v 1.7 2000/09/21 16:12:42 dsanta Exp $ - * - * Class: ImgMouseListener - * - * Description: Handles the mouse events for scrolling an image - * displayed in an ImgScrollPane. - * - * - * - * COPYRIGHT: - * - * This software module was originally developed by Raphaël Grosbois and - * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel - * Askelöf (Ericsson Radio Systems AB); and Bertrand Berthelot, David - * Bouchard, Félix Henry, Gerard Mozelle and Patrice Onno (Canon Research - * Centre France S.A) in the course of development of the JPEG2000 - * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This - * software module is an implementation of a part of the JPEG 2000 - * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio - * Systems AB and Canon Research Centre France S.A (collectively JJ2000 - * Partners) agree not to assert against ISO/IEC and users of the JPEG - * 2000 Standard (Users) any of their rights under the copyright, not - * including other intellectual property rights, for this software module - * with respect to the usage by ISO/IEC and Users of this software module - * or modifications thereof for use in hardware or software products - * claiming conformance to the JPEG 2000 Standard. Those intending to use - * this software module in hardware or software products are advised that - * their use may infringe existing patents. The original developers of - * this software module, JJ2000 Partners and ISO/IEC assume no liability - * for use of this software module or modifications thereof. No license - * or right to this software module is granted for non JPEG 2000 Standard - * conforming products. JJ2000 Partners have full right to use this - * software module for his/her own purpose, assign or donate this - * software module to any third party and to inhibit third parties from - * using this software module for non JPEG 2000 Standard conforming - * products. This copyright notice must be included in all copies or - * derivative works of this software module. - * - * Copyright (c) 1999/2000 JJ2000 Partners. - * - * - * - */ -package jj2000.disp; - -import jj2000.j2k.decoder.*; - -import java.awt.event.*; -import java.awt.*; - -/** - * This class handles the dragging of an image displayed in an - * ImgScrollPane. When the mouse is dragged the image scrolls accordingly. - * - *

Objects of this class must be registerd as both mouse listener and mouse - * motion listener. - * - *

While the dragging is taking place the cursor is changed to the - * MOVE_CURSOR type. The original cursor is restored when the mouse is - * released after the drag. - * - * */ -public class ImgMouseListener extends MouseAdapter - implements MouseMotionListener { - /** The component where the image is displayed */ - ImgScrollPane isp; - - /** The horizontal coordinate where the drag starts */ - int startMouseX; - - /** The vertical coordinate where the drag starts */ - int startMouseY; - - /** The horizontal scroll position when the drag started */ - int startScrollX; - - /** The vertical scroll position when the drag started */ - int startScrollY; - - Cursor prevCursor; - - /** - * Instantiate a new ImgMouseListener that will work on the specified - * ImgScrollPane. - * - * @param isp The image scroll pane on which the actions should operate. - * */ - public ImgMouseListener(ImgScrollPane isp) { - this.isp = isp; - } - - public void mousePressed(MouseEvent e) { - // Get the possibly start drag position - startMouseX = e.getX(); - startMouseY = e.getY(); - // Get the start scroll position - startScrollX = isp.getHAdjustable().getValue(); - startScrollY = isp.getVAdjustable().getValue(); - } - - public void mouseReleased(MouseEvent e) { - // Restore the last cursor, if any - if (prevCursor != null) { - isp.setCursor(prevCursor); - prevCursor = null; - } - } - - public void mouseDragged(MouseEvent evt) { - int scrollX,scrollY; - - // Set the drag cursor - if (prevCursor == null) { - prevCursor = isp.getCursor(); - isp.setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); - } - - // Calculate new scroll position and set it - scrollX = startScrollX + startMouseX - evt.getX(); - scrollY = startScrollY + startMouseY - evt.getY(); - isp.setScrollPosition(scrollX,scrollY); - } - - public void mouseMoved(MouseEvent evt) { - } -} diff --git a/CSJ2K/jj2kencoder/disp/ImgScrollPane.jsl b/CSJ2K/jj2kencoder/disp/ImgScrollPane.jsl deleted file mode 100644 index 62a72bd6..00000000 --- a/CSJ2K/jj2kencoder/disp/ImgScrollPane.jsl +++ /dev/null @@ -1,1402 +0,0 @@ -/* - * CVS identifier: - * - * $Id: ImgScrollPane.java,v 1.10 2000/12/04 17:19:27 grosbois Exp $ - * - * Class: ImgScrollPane - * - * Description: - * - * - * - * COPYRIGHT: - * - * This software module was originally developed by Raphaël Grosbois and - * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel - * Askelöf (Ericsson Radio Systems AB); and Bertrand Berthelot, David - * Bouchard, Félix Henry, Gerard Mozelle and Patrice Onno (Canon Research - * Centre France S.A) in the course of development of the JPEG2000 - * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This - * software module is an implementation of a part of the JPEG 2000 - * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio - * Systems AB and Canon Research Centre France S.A (collectively JJ2000 - * Partners) agree not to assert against ISO/IEC and users of the JPEG - * 2000 Standard (Users) any of their rights under the copyright, not - * including other intellectual property rights, for this software module - * with respect to the usage by ISO/IEC and Users of this software module - * or modifications thereof for use in hardware or software products - * claiming conformance to the JPEG 2000 Standard. Those intending to use - * this software module in hardware or software products are advised that - * their use may infringe existing patents. The original developers of - * this software module, JJ2000 Partners and ISO/IEC assume no liability - * for use of this software module or modifications thereof. No license - * or right to this software module is granted for non JPEG 2000 Standard - * conforming products. JJ2000 Partners have full right to use this - * software module for his/her own purpose, assign or donate this - * software module to any third party and to inhibit third parties from - * using this software module for non JPEG 2000 Standard conforming - * products. This copyright notice must be included in all copies or - * derivative works of this software module. - * - * Copyright (c) 1999/2000 JJ2000 Partners. - * */ -package jj2000.disp; - -import java.awt.event.*; -import java.awt.image.*; -import java.awt.*; - -/** - * This class implements an image viewer that can display an image larger than - * the actual display area, and presents scrollbars to scroll the viewable - * area. This class also supports zooming in and out the image, with no extra - * memory requirements. - * - *

The zoom factor by default is 1. It can be changed with the 'zoom()' and - * 'setZoom()' methods. The maximum zoom factor is defined by MAX_ZOOM. - * - *

The zoom scaling is done directly by the AWT display system. In general - * it is performed by dropping or repeating lines. It is just intended to - * provide a display zoom and not for proper scaling of an image. - * - *

The scrolling can be performed by copying the actual displayed data to - * the new scrolled position and redrawing the damaged parts, or by redrawing - * the entire displayed image portion at the new scrolled position. Which is - * more efficient depends on the JVM and working environment. By default it is - * done by copying since it tends to provide less annoying visual artifacts - * while scrolling, but that can be changed with 'setCopyScroll()'. - * - *

This class is very similar to the AWT ScrollPane one, but it is - * optimized for display of large images and does not suffer from the problems - * of ScrollPane when changing zoom. The Adjustable elements that represent - * the scrollbars are made available as in ScrollPane, but the minimum, - * maximum, visible amount and block increment should not be set - * (IllegalArgumentException is thrown if attempted), since they are set - * internally by this class. - * - *

Focus and key event listeners that are registered are in fact registered - * with the components that implement the three areas (the image display and - * the two scrollbars) so that if any such event is fired in any of these - * areas it is handled by the registered listener. - * - *

Mouse and mouse movement event listeners that are registered are in fact - * registered with the image display component only. The mouse and mouse - * movement events on the scrollbars are handled by the Scrollbar default - * listeners only. - * - *

Although it is implemented as a container, it behaves like a - * component. Specifically no components can be added or removed from objects - * of this class. Furthermore, no layout manager can be set. It is internally - * set and it can not be changed. - * - *

The implementation uses a lightweight container with an inner class to - * display the image itself, and two scrollbars. The layout manager is a - * BorderLayout. - * - *

This class should be really implemented as a Component, but it is - * implemented as a Container for easyness. It should not be assumed it is a - * subclass of Container since in the future it might be rewritten as a - * subclass of Component only. - * - * - * @see ScrollPane - * - * @see Adjustable - * */ -public class ImgScrollPane extends Container { - - /** The ID for always visible scrollbars */ - public final static int SCROLLBARS_ALWAYS = ScrollPane.SCROLLBARS_ALWAYS; - - /** The ID for as needed visible scrollbars */ - public final static int SCROLLBARS_AS_NEEDED = - ScrollPane.SCROLLBARS_AS_NEEDED; - - /** The ID for never visible scrollbars */ - public final static int SCROLLBARS_NEVER = ScrollPane.SCROLLBARS_NEVER; - - /** The maximum possible zoom factor: 32. */ - // This is used because factors too large cause problems with JVMs. - public static final float MAX_ZOOM = 32f; - - /** The thickness of the scrollbars: 16 pixels */ - final static int SCROLLBAR_THICKNESS = 16; - - /** The inetrnal gap between the elements, in pixels: 0 */ - final static int INTERNAL_GAP = 0; - - /** The propertion between the visible scrollbar length and the block - * increment amount: 0.8 */ - final static float BLOCK_INCREMENT_PROPORTION = 0.8f; - - /** The horizontal scrollbar. - * - * @serial - */ - ISPScrollbar hsbar; - - /** The vertical scrollabr. - * - * @serial - */ - ISPScrollbar vsbar; - - /** The image display - * - * @serial - */ - private ImageScrollDisplay imgDisplay; - - /** The scrollbar type (always, as needed, etc.) - * - * @serial - */ - private int sbType; - - /** The zoom to use in displaying the image. A factor larger than one - * produces a zoom in effect. - * - * @serial - */ - private float zoom = 1f; - - /** The zoom used in the last scrollbar calculation. - * - * @serial - */ - private float lastZoom; - - /** The viewable size used in the last scrollbar calculation. - * - * @serial - */ - private Dimension lastSize; - - /** If scrolling is to be done by copying ot not. If not done by copying - * everything is redrawn. - * - * @serial*/ - private boolean copyScroll = true; - - /** - * Creates a new ImgScrollPane with SCROLLBARS_AS_NEEDED scrollbars. - * */ - public ImgScrollPane() { - this(SCROLLBARS_AS_NEEDED); - } - - /** - * Creates a new ImgScrollPane with the specified type of scrollbar - * visibility. - * - * @param svt The scrollbar visibility type - * */ - public ImgScrollPane(int svt) { - // Initialize - super.setLayout(new BorderLayout(INTERNAL_GAP,INTERNAL_GAP)); - sbType = svt; - hsbar = new ISPScrollbar(Scrollbar.HORIZONTAL,0,1,0,1); - vsbar = new ISPScrollbar(Scrollbar.VERTICAL,0,1,0,1); - imgDisplay = new ImageScrollDisplay(); - super.add(hsbar,BorderLayout.SOUTH); - super.add(vsbar,BorderLayout.EAST); - super.add(imgDisplay,BorderLayout.CENTER); - - // Set the initial scrollbar visibility - switch (svt) { - case SCROLLBARS_NEVER: - case SCROLLBARS_AS_NEEDED: - hsbar.setVisible(false); - vsbar.setVisible(false); - break; - case SCROLLBARS_ALWAYS: - hsbar.setVisible(true); - vsbar.setVisible(true); - break; - default: - throw new IllegalArgumentException(); - } - } - - /** - * Sets the image to display in this component. If the image is not - * ready for display it will be prepared in the current thread. The - * current zoom factor applies. - * - *

If the image is not ready for display (i.e. it has not been - * rendered at its natural size) it will be rendered in the current - * thread, if not being already rendered in another one. This means - * that the current thread can block until the image is ready. - * - *

If the image is rendered incrementally (it depends on the - * underlying 'ImageProducer') it will be displayed in that way if the - * incremental display is set for the Component class. See the - * 'imageUpdate()' method of the 'Component' class. - * - *

If the image is the same as the current one nothing is done. - * - * @param img The image to display. - * - * @see Component#imageUpdate - * */ - public void setImage(Image img) { - imgDisplay.setImage(img); - } - - /** - * Returns the image that is displayed in this component. - * - * @return The image displayed in this component, or null if none. - * */ - public synchronized Image getImage() { - return imgDisplay.img; - } - - /** - * Sets the zoom factor to display the image. A zoom factor larger than 1 - * corresponds to a zoom in. A factor of 1 corresponds to no - * scaling. After setting the zoom factor the component is invalidated and - * 'repaint()' is automatically called so that the image is redrawn at the - * new zoom factor. In order to revalidate the layout 'validate()' should - * be called on one of the parent containers. If the new zoom factor is - * larger than MAX_ZOOM, then MAX_ZOOM will be used. - * - * @param zf The zoom factor - * */ - public synchronized void setZoom(float zf) { - if (zf == zoom || (zf > MAX_ZOOM && zoom == MAX_ZOOM)) { - // No change => do nothing - return; - } - // Set the zoom factor and recalculate the component dimensions - zoom = zf; - if (zoom > MAX_ZOOM) zoom = MAX_ZOOM; - setScrollbars(); - // Check if we need to change the scrollbar display - if (sbType == SCROLLBARS_AS_NEEDED) doLayout(); - // We need to erase previous scaled image - imgDisplay.erase = true; - // Redraw image - imgDisplay.repaint(); - } - - /** - * Modifies the current zoom factor by the given multiplier. After setting - * the zoom factor the component is invalidated and 'repaint()' is - * automatically called so that the image is redrawn at the new zoom - * factor. In order to revalidate the layout 'validate()' should be called - * on one of the parent containers. If the resulting zoom factor is larger - * than MAX_ZOOM, then MAX_ZOOM will be used. - * - * @param zm The zoom multiplier to apply. - * */ - public synchronized void zoom(float zm) { - setZoom(zoom*zm); - } - - /** - * Returns the current zoom factor. - * - * @return The current zoom factor - * */ - public synchronized float getZoom() { - return zoom; - } - - /** - * Returns the Adjustable object which represents the state of the - * horizontal scrollbar. - * */ - public Adjustable getHAdjustable() { - return hsbar; - } - - /** - * Returns the Adjustable object which represents the state of the - * vertical scrollbar. - * */ - public Adjustable getVAdjustable() { - return vsbar; - } - - /** - * Returns the display policy for the scrollbars. - * - * @return the display policy for the scrollbars - * */ - public int getScrollbarDisplayPolicy() { - return sbType; - } - - /** - * Sets the display policy for the scrollbars. - * - * @param v the display policy for the scrollbars - * */ - public void setScrollbarDisplayPolicy(int v) { - // If no change do nothing - if (v == sbType) return; - switch (sbType) { - case SCROLLBARS_NEVER: - case SCROLLBARS_AS_NEEDED: - hsbar.setVisible(false); - vsbar.setVisible(false); - break; - case SCROLLBARS_ALWAYS: - hsbar.setVisible(true); - vsbar.setVisible(true); - break; - default: - throw new IllegalArgumentException(); - } - // Now redo the layout - doLayout(); - } - - /** - * Scrolls to the specified position within the image. Specifying a - * position outside of the legal scrolling bounds of the image will scroll - * to the closest legal position. This is a convenience method which - * interfaces with the Adjustable objects which represent the state of the - * scrollbars. - * - * @param x the x position to scroll to - * - * @param y the y position to scroll to - * */ - public synchronized void setScrollPosition(int x, int y) { - hsbar.setValueI(x); - vsbar.setValueI(y); - // Check if we need to repaint - x = hsbar.getValue(); // get the actual value for check - y = vsbar.getValue(); // get the actual value for check - if (imgDisplay.lastUpdateOffset != null && - imgDisplay.lastUpdateOffset.x == x && - imgDisplay.lastUpdateOffset.y == y) { - return; // No change - } - // New value changes from last drawn => repaint - imgDisplay.repaint(); - } - - /** - * Scrolls to the specified position within the image. Specifying a - * position outside of the legal scrolling bounds of the image will scroll - * to the closest legal position. This is a convenience method which - * interfaces with the Adjustable objects which represent the state of the - * scrollbars. - * - * @param p the position to scroll to - * */ - public synchronized void setScrollPosition(Point p) { - setScrollPosition(p.x,p.y); - } - - /** - * Returns the current x,y position within the child which is displayed at - * the 0,0 location of the scrolled panel's view port. This is a - * convenience method which interfaces with the adjustable objects which - * represent the state of the scrollbars. - * - * @return the coordinate position for the current scroll position - * */ - public Point getScrollPosition() { - return new Point(hsbar.getValue(),vsbar.getValue()); - } - - /** - * Returns the current size of the image scroll pane's view port. This is - * the size of the image display area. If this component has not been - * layed out yet the value is not defined. - * - * @return The size of the image display area - * */ - public Dimension getViewportSize() { - return imgDisplay.getSize(); - } - - /** - * Sets if the scrolling is to be done by copying and redrawing of damaged - * parts of the displayed image. Otherwise it is done by redrawing the - * entire displayed image. In general copy scrolling is faster and - * produces less annoying effects. See the class description. - * - * @param v If true scrolling will be done by copying. - * */ - public synchronized void setCopyScroll(boolean v) { - copyScroll = v; - } - - /** - * Returns true if the scrolling is done by copying. - * - * @return If the copy is done by scrolling - * */ - public synchronized boolean getCopyScroll() { - return copyScroll; - } - - /** - * Causes this container to lay out its components. Most programs should - * not call this method directly, but should invoke the validate method - * instead. - * */ - public synchronized void doLayout() { - // Let's see if we should include the scrollbars or not - if (sbType == SCROLLBARS_AS_NEEDED && imgDisplay.calcDim()) { - Dimension sz = getSize(); - Dimension imsz = imgDisplay.getPreferredSize(); - - if (sz.width>=imsz.width+2*INTERNAL_GAP) { - if (sz.height>=imsz.height+2*INTERNAL_GAP) { - // We don't need scrollbars - hsbar.setVisible(false); - vsbar.setVisible(false); - } - else { - // We need at least the vertical one, check again for the - // horizontal. - vsbar.setVisible(true); - if (sz.width >= - imsz.width+3*INTERNAL_GAP+SCROLLBAR_THICKNESS) { - hsbar.setVisible(false); - } - else { - hsbar.setVisible(true); - } - } - } - else { - // We need at least the horizontal, check for the vertical - // one. - hsbar.setVisible(true); - if (sz.height >= - imsz.height+3*INTERNAL_GAP+SCROLLBAR_THICKNESS) { - vsbar.setVisible(false); - } - else { - vsbar.setVisible(true); - } - } - } - // Indicate that we are erasing the image (the doLayout() will erase) - imgDisplay.erase = true; - // Now do the layout - super.doLayout(); - // Trick the lower scrollbar: if both scrollbars are showing then - // shorten the horizontal one so that the traditional empty square - // appears at the lower right corner. This is probably not the best - // solution but it works. - if (hsbar.isVisible() && vsbar.isVisible()) { - Rectangle b = hsbar.getBounds(); - if (b.width > SCROLLBAR_THICKNESS+INTERNAL_GAP) { - b.width -= SCROLLBAR_THICKNESS+INTERNAL_GAP; - } - hsbar.setBounds(b); - } - // We need to calculate the scrollbars with the possibly new size - setScrollbars(); - } - - /** - * Adds the specified focus listener to receive focus events from this - * component. It is added to the image and scrollbar areas. - * - * @param l the focus listener - * */ - public synchronized void addFocusListener(FocusListener l) { - super.addFocusListener(l); - imgDisplay.addFocusListener(l); - hsbar.addFocusListener(l); - vsbar.addFocusListener(l); - } - - /** - * Removes the specified focus listener so that it no longer receives - * focus events from this component. - * - * @param l the focus listener - * */ - public synchronized void removeFocusListener(FocusListener l) { - super.removeFocusListener(l); - imgDisplay.removeFocusListener(l); - hsbar.removeFocusListener(l); - vsbar.removeFocusListener(l); - } - - /** - * Adds the specified key listener to receive key events from this - * component. It is added to the image and scrollbar areas. - * - * @param l the key listener - * */ - public synchronized void addKeyListener(KeyListener l) { - super.addKeyListener(l); - imgDisplay.addKeyListener(l); - hsbar.addKeyListener(l); - vsbar.addKeyListener(l); - } - - /** - * Removes the specified key listener so that it no longer receives key - * events from this component. - * - * @param l the key listener - * */ - public synchronized void removeKeyListener(KeyListener l) { - super.removeKeyListener(l); - imgDisplay.removeKeyListener(l); - hsbar.removeKeyListener(l); - vsbar.removeKeyListener(l); - } - - /** - * Adds the specified mouse listener to receive mouse events from this - * component. It is actually added to the image area only and not to the - * scrollbar areas. - * - * @param l the mouse listener - * */ - public synchronized void addMouseListener(MouseListener l) { - super.addMouseListener(l); - imgDisplay.addMouseListener(l); - } - - /** - * Removes the specified mouse listener so that it no longer receives - * mouse events from this component. - * - * @param l the mouse listener - * */ - public synchronized void removeMouseListener(MouseListener l) { - super.removeMouseListener(l); - imgDisplay.removeMouseListener(l); - } - - /** - * Adds the specified mouse motion listener to receive mouse motion events - * from this component. It is actually added to the image area only and - * not to the scrollbar areas. - * - * @param l the mouse motion listener - * */ - public synchronized void addMouseMotionListener(MouseMotionListener l) { - super.addMouseMotionListener(l); - imgDisplay.addMouseMotionListener(l); - } - - /** - * Removes the specified mouse motion listener so that it no longer - * receives mouse motion events from this component. - * - * @param l the mouse motion listener - * */ - public synchronized void removeMouseMotionListener(MouseMotionListener l) { - super.removeMouseMotionListener(l); - imgDisplay.removeMouseMotionListener(l); - } - /** - * Sets the background color of this component. It sets the background of - * the 3 areas (image and scrollbars) plus the container itself. - * - * @param c The color to become background color for this component - * */ - public synchronized void setBackground(Color c) { - super.setBackground(c); - imgDisplay.setBackground(c); - hsbar.setBackground(c); - vsbar.setBackground(c); - } - - /** - * Set the cursor image to a predefined cursor. It sets the cursor of the - * image area and this container to the specified one. It does not set the - * cursor of the scrollbars. - * - * @param cursor One of the constants defined by the Cursor class. - * */ - public synchronized void setCursor(Cursor cursor) { - super.setCursor(cursor); - imgDisplay.setCursor(cursor); - } - - /** - * Enables or disables this component, depending on the value of the - * parameter b. An enabled component can respond to user input and - * generate events. Components are enabled initially by default. - * - * @param b If true, this component is enabled; otherwise this component - * is disabled. - * */ - public synchronized void setEnabled(boolean b) { - super.setEnabled(b); - imgDisplay.setEnabled(b); - hsbar.setEnabled(b); - vsbar.setEnabled(b); - } - - /** - * Sets the foreground color of this component. It sets the foreground of - * the 3 areas (image display and scrollbars) plus this contaioner's - * foreground. - * - * @param c The color to become this component's foreground color. - * */ - public synchronized void setForeground(Color c) { - super.setForeground(c); - imgDisplay.setForeground(c); - hsbar.setForeground(c); - vsbar.setForeground(c); - } - - /** - * Throws an IllegalArgumentException since no components can be added to - * this container. - * */ - public Component add(Component comp) { - throw new IllegalArgumentException(); - } - - /** - * Throws an IllegalArgumentException since no components can be added to - * this container. - * */ - public Component add(String name,Component comp) { - throw new IllegalArgumentException(); - } - - /** - * Throws an IllegalArgumentException since no components can be added to - * this container. - * */ - public Component add(Component comp, int index) { - throw new IllegalArgumentException(); - } - - /** - * Throws an IllegalArgumentException since no components can be added to - * this container. - * */ - public void add(Component comp, Object constraints) { - throw new IllegalArgumentException(); - } - - /** - * Throws an IllegalArgumentException since no components can be added to - * this container. - * */ - public void add(Component comp, Object constraints, int index) { - throw new IllegalArgumentException(); - } - - /** - * Throws an IllegalArgumentException since the components should never be - * removed from this container. - * */ - public void remove(int index) { - throw new IllegalArgumentException(); - } - - /** - * Throws an IllegalArgumentException since the components should never be - * removed from this container. - * */ - public void remove(Component comp) { - throw new IllegalArgumentException(); - } - - /** - * Throws an IllegalArgumentException since the components should never be - * removed from this container. - * */ - public void removeAll() { - throw new IllegalArgumentException(); - } - - /** - * Throws an IllegalArgumentException since the layout manager is - * internally set and can not be changed. - * */ - public void setLayout(LayoutManager mgr) { - throw new IllegalArgumentException(); - } - - /** - * Sets the scrollbars values, according to the image display area and - * image size. The current scroll position is kept. - * - * */ - private void setScrollbars() { - Dimension asz; // actual image area size - Dimension psz; // preferred size - int pos; // current scroll position - int szx,szy; // actual image display area size - - if (!imgDisplay.calcDim()) { - // While the image dimensions are not known we can't really update - // the scrollbar. - return; - } - - // Get the dimensions - asz = imgDisplay.getSize(); - psz = imgDisplay.getPreferredSize(); - - // Initialize lastZoom and lastSize if never done yet - if (lastZoom == 0f) lastZoom = zoom; - if (lastSize == null) lastSize = new Dimension(asz.width,asz.height); - - // Get the actual display size - szx = (asz.width < psz.width) ? asz.width : psz.width; - szy = (asz.height < psz.height) ? asz.height : psz.height; - - // Set horizontal scrollbar - pos = (int)((hsbar.getValue()+lastSize.width/2f)/lastZoom*zoom-szx/2f); - if (pos > (psz.width-asz.width)) pos = psz.width-asz.width; - if (pos < 0) pos = 0; - if (asz.width <= 0) asz.width = 1; - if (psz.width <= 0) psz.width = 1; - hsbar.setValues(pos,asz.width,0,psz.width); - asz.width = (int)(asz.width*BLOCK_INCREMENT_PROPORTION); - if (asz.width <= 0) asz.width = 1; - hsbar.setBlockIncrementI(asz.width); - - // Set vertical scrollbar - pos = (int)((vsbar.getValue()+lastSize.height/2f)/lastZoom*zoom-szy/2f); - if (pos > (psz.height-asz.height)) pos = psz.height-asz.height; - if (pos < 0) pos = 0; - if (asz.height <= 0) asz.height = 1; - if (psz.height <= 0) psz.height = 1; - vsbar.setValues(pos,asz.height,0,psz.height); - asz.height = (int)(asz.height*BLOCK_INCREMENT_PROPORTION); - if (asz.height <= 0) asz.height = 1; - vsbar.setBlockIncrementI(asz.height); - - // Save the zoom and display size used in the scrollbar calculation - lastZoom = zoom; - lastSize.width = szx; - lastSize.height = szy; - } - - /** - * This class implements the component that displays the currently - * viewable image portion inside the ImgScrollPane. It handles the - * necessary erasing, zooming and panning. - * - *

NOTE: extending 'Canvas' instead of 'Component' solves the - * flickering problem of lightweight components which are in heavyweight - * containers. - * - * */ - private class ImageScrollDisplay extends Canvas { - - /** The image to be displayed - * - * @serial */ - Image img; - - /** The preferred size for this component - * - * @serial */ - Dimension dim = new Dimension(); - - /** If the current graphics context should be erased prior to drawing - * the image. Set when the image and/or zoom factor is changed. - * - * @serial */ - boolean erase; - - /** The image dimensions, without any scaling. Set as soon as they are - known. - * - * @serial */ - Dimension imgDim = new Dimension(); - - /** The image dimension flags, as in ImageObserver. The - * ImageObserver.WIDTH and ImageObserver.HEIGHT flags are set whenever - * the dimension is stored in imgDim. They are reset whenever the - * image changes. - * - * @serial */ - int dimFlags; - - /** The last offset used in update(). - * - * @serial */ - Point lastUpdateOffset; - - /** - * Sets the image to display in this component. If the image is not - * ready for display it will be prepared in the current thread. The - * current zoom factor applies. - * - *

If the image is not ready for display (i.e. it has not been - * rendered at its natural size) it will be rendered in the current - * thread, if not being already rendered in another one. This means - * that the current thread can block until the image is ready. - * - *

If the image is rendered incrementally (it depends on the - * underlying 'ImageProducer') it will be displayed in that way if the - * incremental display is set for the Component class. See the - * 'imageUpdate()' method of the 'Component' class. - * - *

If the image is the same as the current one nothing is done. - * - * @param img The image to display. - * - * @see Component#imageUpdate - * - * */ - void setImage(Image img) { - // Update object state - synchronized (ImgScrollPane.this) { - if (img == null) { - throw new IllegalArgumentException(); - } - // If same image do nothing - if (this.img == img) { - return; - } - - // (Re)initialize - dimFlags = 0; - this.img = img; - lastSize = null; - lastZoom = 0f; - setScrollbars(); - // Set to erase previous image - erase = true; - } - // Start image production (if the image is already being prepared - // the method does nothing) - ImgScrollPane.this.prepareImage(img,this); - } - - /** - * Returns the minimum size for this component, which is (0,0). - * - * @return The minimum size - * - * */ - public Dimension getMinimumSize() { - return new Dimension(0,0); - } - - /** - * Returns the maximum size for this component, which is infinite. - * - * @return The maximum size - * - * */ - public Dimension getMaximumSize() { - return new Dimension(Integer.MAX_VALUE,Integer.MAX_VALUE); - } - - /** - * Returns the preferred size for this component, which is the image - * display size, if known, the previous image display size, if any, or - * the size specified at the constructor. - * - * @return The preferred size for this component. - * - * */ - public Dimension getPreferredSize() { - return dim; - } - - /** - * Monitors the image rendering for dimensions and calls the - * superclass' 'imageUpdate()' method. If the display size of the - * image is not yet known and the image dimensions are obtained, then - * the scrollbars' values are set. If 'img' is not the current image - * to display nothing is done and 'false' is returned indicating that - * nothing more is necessary for it. - * - * @see ImageObserver#imageUpdate - * - * @see Component#imageUpdate - * - * */ - public boolean imageUpdate(Image img, int infoflags, - int x, int y, int w, int h) { - if (this.img != img) { - // Not the image we want to display now (might be an old one) - // => do nothing and no more info needed on that image - return false; - } - // If got the image dimensions then store them and set component - // size as appropriate. - if ((infoflags & (ImageObserver.WIDTH|ImageObserver.HEIGHT)) != 0) { - // Got some image dimension - synchronized (ImgScrollPane.this) { - // Read the dimensions received - if ((infoflags & ImageObserver.WIDTH) != 0) { - imgDim.width = w; - dimFlags |= ImageObserver.WIDTH; - } - if ((infoflags & ImageObserver.HEIGHT) != 0) { - imgDim.height = h; - dimFlags |= ImageObserver.HEIGHT; - } - // If we got to know the image dimensions force the layout - // to be done (to see if it is necessary to show - // scrollbars) - if (dimFlags == - (ImageObserver.WIDTH|ImageObserver.HEIGHT)) { - ImgScrollPane.this.doLayout(); - } - } - } - // Call the superclass' method to continue processing - return super.imageUpdate(img,infoflags,x,y,w,h); - } - - /** - * Paints the image, if any, on the graphics context by calling - * update(). - * - * @param g The graphics context to paint on. - * - * */ - public void paint(Graphics g) { - // Now call update as usual - update(g); - } - - /** - * Updates the component by drawing the relevant part of the image - * that fits within the Graphics clipping area of 'g'. If the image is - * not already being prepared for rendering or is not already rendered - * this method does not start it. This is to avoid blocking the AWT - * threads for rendering the image. The image rendering is started by - * the 'setImage()' method. - * - * @param g The graphics context where to draw - * - * @see #setImage - * - * */ - public void update(Graphics g) { - Image img; // The image to display - float zoom; // The zoom factor - boolean erase; // If the display area should be erased - int dx1,dy1; // Scaling destionation upper-left corner - int dx2,dy2; // Scaling destination down-right corner - int sx1,sy1; // Scaling source upper-left corner - int sx2,sy2; // Scaling source down-right corner - int ox,oy; // Centering offset - Rectangle b; // Bounds of the display area - int offx,offy; // Offset of the upper-left corner - int loffx,loffy; // Offset of the upper-left corner of last update - boolean copyScroll;// If the scrolling should be done by copying - Rectangle clip; // The clipping area - int status; // The image fetching status - - // Copy to local variables in a synchronized block to avoid races - synchronized (ImgScrollPane.this) { - img = this.img; - zoom = ImgScrollPane.this.zoom; - erase = this.erase; - copyScroll = ImgScrollPane.this.copyScroll; - this.erase = false; - - // If no image or the image has not started preparation yet do - // nothing. We do not want to start the image preparation in - // this thread because it can be long. - if (img == null || (status = this.checkImage(img,null)) == 0) { - return; - } - // Get the display size and eventual centering offset for the - // image. - b = this.getBounds(); - ox = (b.width > dim.width) ? (b.width-dim.width)/2 : 0; - oy = (b.height > dim.height) ? (b.height-dim.height)/2 : 0; - // Get the display offset - clip = g.getClipBounds(); - if (lastUpdateOffset != null && - (clip.width < b.width || clip.height < b.height)) { - // The clip is smaller than the display area => we need to - // paint with the last offset to avoid screwing up the - // displayed image. - offx = lastUpdateOffset.x; - offy = lastUpdateOffset.y; - } - else { - // The clipping area covers the whole display area => we - // can use the current offset. - offx = hsbar.getValue(); - offy = vsbar.getValue(); - } - // Get and update the offset of last update - if (lastUpdateOffset == null) { - lastUpdateOffset = new Point(); - } - loffx = lastUpdateOffset.x; - loffy = lastUpdateOffset.y; - lastUpdateOffset.x = offx; - lastUpdateOffset.y = offy; - // Set the display size according to zoom - if (zoom == 1f) { - // Natural image size, no scaling - // Displace the origin of the image according to offset - ox -= offx; - oy -= offy; - // No zoom so no translation for scaling compensation needed - sx1 = sy1 = 0; // to keep compiler happy - sx2 = sy2 = 0; // to keep compiler happy - dx1 = dy1 = 0; // to keep compiler happy - dx2 = dy2 = 0; // to keep compiler happy - } - else { - int sox,soy; // Scaling compensation offset - // Calculate coordinates of lower right corner for scaling - if (dimFlags != - (ImageObserver.WIDTH|ImageObserver.HEIGHT)) { - // Image dims not yet available we can't display - return; - } - sx1 = sy1 = 0; - sx2 = imgDim.width; - sy2 = imgDim.height; - dx1 = dy1 = 0; - dx2 = dim.width; - dy2 = dim.height; - sox = soy = 0; - // Limit the scaling area according to display size so - // that scaling operates only on the area to be displayed - if (dx2 > b.width) { - // Calculate coordinates of displayed portion - dx2 = b.width+ ((zoom>1f) ? (int)Math.ceil(zoom) : 0); - if ((int)zoom == zoom) { - // For integer zoom make dx2 a multiple of zoom - dx2 = (int)(Math.ceil(dx2/zoom)*zoom); - } - sx1 = (int)(offx/zoom); - sx2 = sx1 + (int)(dx2/zoom); - // Compensate the scaling on integer coordinates with - // an offset - sox = (int)(sx1*zoom-offx); - } - if (dy2 > b.height) { - // Calculate coordinates of displayed portion - dy2 = b.height + ((zoom>1f) ? (int)Math.ceil(zoom) : 0); - if ((int)zoom == zoom) { - // For integer zoom make dy2 a multiple of zoom - dy2 = (int)(Math.ceil(dy2/zoom)*zoom); - } - sy1 = (int)(offy/zoom); - sy2 = sy1 + (int)(dy2/zoom); - // Compensate the scaling on integer coordinates with - // an extra offset - soy = (int)(sy1*zoom-offy); - } - // Apply centering offset and scaling compensation offset - dx1 += ox + sox; - dy1 += oy + soy; - dx2 += ox + sox; - dy2 += oy + soy; - } - } - // If the image is not yet complete and we are scrolling set to - // erase to avoid leftovers of previous scroll on parts of the - // image which are not yet ready - if ((status & ImageObserver.ALLBITS) == 0 && - (loffx != offx || loffy != offy)) { - erase = true; - } - // Now we have the necessary info for display. We do it outside - // synchronized to avoid any potential deadlocks with imageUpdate(). - if (erase) { - // We need to erase the current image. Make sure that we - // redraw everything by setting the clipping area to the whole - // display one. - g.setClip(0,0,b.width,b.height); - g.setColor(this.getBackground()); - g.fillRect(0,0,b.width,b.height); - } - - // Use copy scrolling if the image has not been erased, we are - // scrolling, the image is complete, and copy scrolling is enabled. - if (copyScroll && !erase && (loffx != offx || loffy != offy) && - (status & ImageObserver.ALLBITS) != 0) { - // We might be able to move some part of the displayed area - // instead of redrawing everything. - - // We are just trasnlating the current image, so we can reuse - // a part of it. - - int culx,culy; // Clipping area upper-left corner (inclusive) - int cdrx,cdry; // Clipping area down-right corner (exclusive) - int vulx,vuly; // Valid area upper-left corner (inclusive) - int vdrx,vdry; // Valid area down-right corner (exclusive) - - culx = clip.x; - culy = clip.y; - cdrx = clip.x+clip.width; - cdry = clip.y+clip.height; - - // Initialize valid area as the current display area after the - // translation. - vulx = loffx-offx; - vuly = loffy-offy; - vdrx = vulx+b.width; - vdry = vuly+b.height; - - // Make new valid area the intersection of the clipping area - // and the valid area. - if (culx > vulx) vulx = culx; - if (culy > vuly) vuly = culy; - if (cdrx < vdrx) vdrx = cdrx; - if (cdry < vdry) vdry = cdry; - - // If the new valid area is non-empty then copy current image - // data - if (vulx < vdrx && vuly < vdry) { - // Ok we can move a part instead of repainting - g.copyArea(vulx+offx-loffx,vuly+offy-loffy, - vdrx-vulx,vdry-vuly, - loffx-offx,loffy-offy); - // Now we need to redraw the other parts - if (culx < vulx) { // Need to draw at left - g.setClip(culx,culy,vulx-culx,cdry-culy); - if (zoom == 1f) { // No scaling - g.drawImage(img,ox,oy,this); - } - else { // Draw the image using on the fly scaling - g.drawImage(img,dx1,dy1,dx2,dy2,sx1,sy1,sx2,sy2, - this); - } - } - if (vdrx < cdrx) { // Need to draw at right - g.setClip(vdrx,culy,cdrx-vdrx,cdry-culy); - if (zoom == 1f) { // No scaling - g.drawImage(img,ox,oy,this); - } - else { // Draw the image using on the fly scaling - g.drawImage(img,dx1,dy1,dx2,dy2,sx1,sy1,sx2,sy2, - this); - } - } - if (culy < vuly) { // Need to draw at top - g.setClip(vulx,culy,vdrx-vulx,vuly-culy); - if (zoom == 1f) { // No scaling - g.drawImage(img,ox,oy,this); - } - else { // Draw the image using on the fly scaling - g.drawImage(img,dx1,dy1,dx2,dy2,sx1,sy1,sx2,sy2, - this); - } - } - if (vdry < cdry) { // Need to draw at bottom - g.setClip(vulx,vdry,vdrx-vulx,cdry-vdry); - if (zoom == 1f) { // No scaling - g.drawImage(img,ox,oy,this); - } - else { // Draw the image using on the fly scaling - g.drawImage(img,dx1,dy1,dx2,dy2,sx1,sy1,sx2,sy2, - this); - } - } - } - else { - // New valid area is empty, we need to draw everything - if (zoom == 1f) { // No scaling - g.drawImage(img,ox,oy,this); - } - else { // Draw the image using on the fly scaling - g.drawImage(img,dx1,dy1,dx2,dy2,sx1,sy1,sx2,sy2,this); - } - } - } - else { - // We are not translating, so we can't copy - if (zoom == 1f) { // No scaling - g.drawImage(img,ox,oy,this); - } - else { // Draw the image using on the fly scaling - g.drawImage(img,dx1,dy1,dx2,dy2,sx1,sy1,sx2,sy2,this); - } - } - } - - /** - * Calculates the image display dimensions according to the zoom and - * image size. The dimensions are stored in 'dim'. - * - * @return True if the dimensions could be calculated, false if not - * (i.e. not enough info is available). - * - * */ - boolean calcDim() { - // We need the image dimensions - if (dimFlags != (ImageObserver.WIDTH|ImageObserver.HEIGHT)) { - // Image dims not yet available we can't do anything - return false; - } - // Calculate dims - if (zoom == 1f) { - // Natural image dimension - dim.width = imgDim.width; - dim.height = imgDim.height; - } - else { - // Apply zoom - dim.width = (int)(zoom*imgDim.width); - dim.height = (int)(zoom*imgDim.height); - } - return true; - } - } - - /** - * Scrollbars for the ImgScrollPane container. They are normal AWT - * Scrollbars, but with a thickness of - * ImgScrollPane.SCROLLBAR_THICKNESS. Also many of the set method of the - * Adjustable interface are overriden and throw IllegalArgumentException - * since they are not to be used externally. - * - * */ - class ISPScrollbar extends Scrollbar { - - /** - * Constructs a new scroll bar with the specified orientation and - * values. - * - *

The orientation argument must take one of the two values - * Scrollbar.HORIZONTAL, or Scrollbar.VERTICAL, indicating a - * horizontal or vertical scroll bar, respectively. - * - * @param orientation indicates the orientation of the scroll bar - * - * @param value the initial value of the scroll bar. - * - * @param visible the size of the scroll bar's bubble, representing - * the visible portion; the scroll bar uses this value when paging up - * or down by a page. - * - * @param min the minimum value of the scroll bar. - * - * @param max the maximum value of the scroll bar. - * - * @param svt The scrollbar visible type - **/ - ISPScrollbar(int orientation, - int value, int visible, int min, int max) { - super(orientation,value,visible,min,max); - } - - /** - * Returns the preferred size of the scrollbar. It is the same as the - * preferred size of a normal scrollbar but with a thickness of - * ImgScrollPane.SCROLLBAR_THICKNESS. - * - * @return The Scrollbar preferred size - * */ - public Dimension getPreferredSize() { - Dimension psz = super.getPreferredSize(); - if (getOrientation() == HORIZONTAL) { - psz.height = ImgScrollPane.SCROLLBAR_THICKNESS; - } - else { - psz.width = ImgScrollPane.SCROLLBAR_THICKNESS; - } - return psz; - } - - /** - * Throws an IllegalArgumentException since the minimum value should - * never be set externally. - * */ - public void setMinimum(int min) { - throw new IllegalArgumentException(); - } - - /** - * Throws an IllegalArgumentException since the maximum value should - * never be set externally. - * */ - public void setMaximum(int max) { - throw new IllegalArgumentException(); - } - - /** - * Throws an IllegalArgumentException since the visible amount should - * never be set externally. - * */ - public void setVisibleAmount(int v) { - throw new IllegalArgumentException(); - } - - /** - * Throws an IllegalArgumentException since the block increment should - * never be set externally. - * */ - public void setBlockIncrement(int b) { - super.setBlockIncrement(b); - } - - /** - * Sets the block increment for this scroll bar. - * - *

The block increment is the value that is added (subtracted) when - * the user activates the block increment area of the scroll bar, - * generally through a mouse or keyboard gesture that the scroll bar - * receives as an adjustment event. - * - *

This is a version to be used by The ImgScrollPane class only. - * - * @param v the amount by which to increment or decrement the scroll - * bar's value. - * */ - void setBlockIncrementI(int v) { - super.setBlockIncrement(v); - } - - /** - * Sets the value of this scroll bar to the specified value. - * - *

If the value supplied is less than the current minimum or - * greater than the current maximum, then one of those values is - * substituted, as appropriate. - * - *

This is a version to be used by The ImgScrollPane class only. - * - * @param newValue he new value of the scroll bar. - * */ - void setValueI(int newValue) { - super.setValue(newValue); - } - - /** - * Sets the value of this scroll bar to the specified value and - * requests a repaint of the image area. - * - *

If the value supplied is less than the current minimum or - * greater than the current maximum, then one of those values is - * substituted, as appropriate. - * - * @param newValue he new value of the scroll bar. - * */ - public void setValue(int newValue) { - // Set the value and check if we need to repaint - synchronized (ImgScrollPane.this) { - super.setValue(newValue); - newValue = getValue(); // get the actual value for check - if (imgDisplay.lastUpdateOffset != null) { - if (getOrientation() == HORIZONTAL) { - if (imgDisplay.lastUpdateOffset.x == newValue) { - return; // No change - } - } - else { - if (imgDisplay.lastUpdateOffset.y == newValue) { - return; // No change - } - } - } - } - // New value changes from last drawn => repaint - imgDisplay.repaint(); - } - } -} diff --git a/CSJ2K/jj2kencoder/disp/TitleUpdater.jsl b/CSJ2K/jj2kencoder/disp/TitleUpdater.jsl deleted file mode 100644 index 2f1103e9..00000000 --- a/CSJ2K/jj2kencoder/disp/TitleUpdater.jsl +++ /dev/null @@ -1,118 +0,0 @@ -/* - * CVS identifier: - * - * $Id: TitleUpdater.java,v 1.8 2002/06/24 14:04:58 grosbois Exp $ - * - * Class: TitleUpdater - * - * Description: Thread to update display window title - * - * - * - * COPYRIGHT: - * - * This software module was originally developed by Raphaël Grosbois and - * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel - * Askelöf (Ericsson Radio Systems AB); and Bertrand Berthelot, David - * Bouchard, Félix Henry, Gerard Mozelle and Patrice Onno (Canon Research - * Centre France S.A) in the course of development of the JPEG2000 - * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This - * software module is an implementation of a part of the JPEG 2000 - * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio - * Systems AB and Canon Research Centre France S.A (collectively JJ2000 - * Partners) agree not to assert against ISO/IEC and users of the JPEG - * 2000 Standard (Users) any of their rights under the copyright, not - * including other intellectual property rights, for this software module - * with respect to the usage by ISO/IEC and Users of this software module - * or modifications thereof for use in hardware or software products - * claiming conformance to the JPEG 2000 Standard. Those intending to use - * this software module in hardware or software products are advised that - * their use may infringe existing patents. The original developers of - * this software module, JJ2000 Partners and ISO/IEC assume no liability - * for use of this software module or modifications thereof. No license - * or right to this software module is granted for non JPEG 2000 Standard - * conforming products. JJ2000 Partners have full right to use this - * software module for his/her own purpose, assign or donate this - * software module to any third party and to inhibit third parties from - * using this software module for non JPEG 2000 Standard conforming - * products. This copyright notice must be included in all copies or - * derivative works of this software module. - * - * Copyright (c) 1999/2000 JJ2000 Partners. - * */ -package jj2000.disp; - -import java.awt.*; - -/** - * This class should run as an independent thread to update tha main - * display window title with current image scroll position and - * zoom. - * */ -public class TitleUpdater implements Runnable { - - /** The update perion, in milliseconds: 100 */ - static final int UPDATE_T = 100; - - /** The ImgScrollPane where the image is displayed */ - ImgScrollPane isp; - - /** The frame which title to update */ - Frame win; - - /** The base of the title */ - String btitle; - - /** The thread exits when this is true */ - volatile public boolean done = false; - - /** - * Instantiates the title updater. The title of 'win' will be - * regularly updated with the current zoom and scroll point. The - * current zoom and scroll point are added to the basic title - * given by 'btitle'. - * - * @param isp Where the image is displayed - * - * @param win The window which title to update - * - * @param btitle The base of the title. - * */ - public TitleUpdater(ImgScrollPane isp, Frame win, String btitle) { - this.isp = isp; - this.win = win; - this.btitle = btitle; - } - - /** - * The method that executes this thread. The method periodically - * updates the title, if necessary, and puts to sleep the thread - * for 100 msec. This method never returns. If the sleep of the - * thread is interrupted, the title will be updated earlier and - * the cycle will continue. - * */ - public void run() { - // Periodically update the window title - Point lsp,sp; - float lzf,zf; - lsp = isp.getScrollPosition(); - lzf = isp.getZoom(); - while (!done) { - sp = isp.getScrollPosition(); - zf = isp.getZoom(); - // Update title only if necessary - if (zf != lzf || !sp.equals(lsp)) { - win.setTitle(btitle+ - " @ ("+(int)(sp.x/zf)+","+ - (int)(sp.y/zf)+") : "+isp.getZoom()); - } - lsp = sp; - lzf = zf; - try { - Thread.currentThread().sleep(UPDATE_T); - } - catch (InterruptedException e) { - } - } - } -} diff --git a/CSJ2K/jj2kencoder/j2kencoder.vjsproj b/CSJ2K/jj2kencoder/j2kencoder.vjsproj deleted file mode 100644 index 85b6b25f..00000000 --- a/CSJ2K/jj2kencoder/j2kencoder.vjsproj +++ /dev/null @@ -1,54 +0,0 @@ - - - Debug - x86 - 8.0.50727 - 2.0 - {F6477386-69EA-494B-AEC0-5E3A1FDBA10D} - Exe - j2kencoder - j2kencoder - 4 - %24/csj2k/CSJ2K/jj2kencoder - . - https://tfs03.codeplex.com - {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} - - - true - full - false - bin\Debug\ - DEBUG;TRACE - - - pdbonly - true - bin\Release\ - TRACE - - - - - - - - - - - - - - {1EA0F9BA-0194-4F08-9E55-89888D5A4724} - CSJ2K - - - - - \ No newline at end of file diff --git a/OpenMetaverse/Imaging/OpenJPEG.cs b/OpenMetaverse/Imaging/OpenJPEG.cs index 8bbca620..fdf8d769 100644 --- a/OpenMetaverse/Imaging/OpenJPEG.cs +++ b/OpenMetaverse/Imaging/OpenJPEG.cs @@ -47,7 +47,7 @@ namespace OpenMetaverse.Imaging /// Defines the beginning and ending file positions of a layer in an /// LRCP-progression JPEG2000 file /// - [System.Diagnostics.DebuggerDisplay("Start = {Start} End = {End} Size = {Start - End}")] + [System.Diagnostics.DebuggerDisplay("Start = {Start} End = {End} Size = {End - Start}")] [StructLayout(LayoutKind.Sequential, Pack = 4)] public struct J2KLayerInfo { diff --git a/bin/CSJ2K.dll b/bin/CSJ2K.dll index 79aa0c61..522f3739 100644 Binary files a/bin/CSJ2K.dll and b/bin/CSJ2K.dll differ diff --git a/prebuild.xml b/prebuild.xml index 43bceef1..70f61f24 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -54,6 +54,26 @@ + + + + + ../bin/ + + + + + ../bin/ + + + + ../bin/ + + + + + +